:root {
  color-scheme: dark;
  --bg: #121212;
  --bg-deep: #0d0d0d;
  --panel: #1e1e1e;
  --panel-raised: #282828;
  --input: #141414;
  --text: #ffffff;
  --muted: #c7c7c7;
  --hint: #a8a8a8;
  --border: #383838;
  --border-strong: rgba(229, 178, 93, 0.45);
  --primary: #e5b25d;
  --primary-press: #c99641;
  --primary-soft: rgba(229, 178, 93, 0.16);
  --primary-text: #18110a;
  --action: #70a9ff;
  --action-soft: rgba(112, 169, 255, 0.15);
  --disabled: #3a3a3a;
  --disabled-text: #969696;
  --success: #77d48a;
  --success-bg: rgba(119, 212, 138, 0.12);
  --danger: #ff8b8b;
  --danger-bg: rgba(255, 139, 139, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top, rgba(229, 178, 93, 0.14), transparent 34rem),
    linear-gradient(180deg, #171717 0%, var(--bg) 38%, var(--bg-deep) 100%);
  color: var(--text);
}

.page {
  width: min(100%, 460px);
  margin: 0 auto;
  padding: 22px 18px 34px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.brand-block {
  min-width: 0;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: 0;
  color: var(--primary);
}

.brand-block p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.25;
  font-weight: 700;
}

.home-nav {
  width: auto;
  min-height: 44px;
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--primary);
  font-size: 16px;
  font-weight: 800;
}

.panel {
  display: grid;
  gap: 14px;
}

.view-page {
  min-height: 0;
}

.tab-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--input);
}

.tab-button {
  min-height: 52px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
}

.tab-button.active {
  border-color: var(--border-strong);
  background: var(--panel-raised);
  color: var(--primary);
}

.tab-panel,
.result-panel {
  margin-top: 0;
}

.tab-panel,
.notice {
  padding: 16px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
}

.result-tabs {
  margin: 16px 0 0;
}

label {
  font-size: 18px;
  font-weight: 800;
}

.paste-button {
  min-height: 56px;
  border: 1px solid var(--border-strong);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 21px;
  font-weight: 900;
}

textarea {
  width: 100%;
  height: 124px;
  min-height: 124px;
  resize: vertical;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input);
  color: var(--text);
  font: inherit;
  font-size: 18px;
  line-height: 1.45;
  outline: none;
}

textarea::placeholder {
  color: #8c8c8c;
}

textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(229, 178, 93, 0.18);
}

textarea[readonly] {
  color: var(--hint);
  background: #191919;
}

input[type="text"],
input[type="file"] {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--input);
  color: var(--text);
  font: inherit;
  font-size: 16px;
  line-height: 1.4;
}

input[type="file"]:focus,
input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(229, 178, 93, 0.18);
  outline: none;
}

input[type="text"]:disabled,
input[type="file"]:disabled {
  color: var(--hint);
  background: #191919;
}

.native-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.file-picker {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 21px;
  font-weight: 900;
  cursor: pointer;
  touch-action: manipulation;
}

.native-file-input:focus + .file-name,
.native-file-input:focus-visible + .file-name {
  outline: 3px solid rgba(229, 178, 93, 0.22);
  outline-offset: 2px;
}

.file-name {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.input-hint {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
}

button,
.button-link {
  width: 100%;
  min-height: 58px;
  border: 0;
  border-radius: 10px;
  padding: 14px 18px;
  font: inherit;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}

.primary,
button[type="submit"] {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-press) 100%);
  color: var(--primary-text);
  box-shadow: 0 6px 16px rgba(201, 150, 65, 0.26);
}

.primary:active,
button[type="submit"]:active {
  background: var(--primary-press);
}

button:disabled {
  background: var(--disabled);
  color: var(--disabled-text);
  cursor: not-allowed;
  box-shadow: none;
}

.secondary {
  min-height: 52px;
  border: 1px solid var(--border);
  background: var(--panel-raised);
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
}

.result {
  margin-top: 0;
}

.result:empty {
  display: none;
}

.notice h2 {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 24px;
  line-height: 1.25;
  letter-spacing: 0;
}

.notice p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.45;
}

.song-title {
  margin: -2px 0 0;
  color: var(--text);
  font-size: 21px;
  line-height: 1.35;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.notice.success {
  border-color: rgba(229, 178, 93, 0.38);
  background: var(--panel);
}

.notice.success h2 {
  color: var(--primary);
}

.notice.danger {
  border-color: rgba(255, 139, 139, 0.3);
  background: var(--danger-bg);
}

.notice.danger h2 {
  color: var(--danger);
}

.player {
  margin-top: 16px;
  padding: 10px;
  border-radius: 12px;
  background: var(--input);
  border: 1px solid var(--border);
}

audio {
  display: block;
  width: 100%;
  min-height: 48px;
}

.small-note {
  margin: 14px 0 0;
  color: var(--hint);
  font-size: 15px;
  line-height: 1.45;
}

.task-id {
  margin-top: 12px;
  color: var(--hint);
  font-size: 13px;
  line-height: 1.4;
}

.result-actions {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.copy-button {
  border-color: var(--border-strong);
  background: var(--primary-soft);
  color: var(--primary);
}

.current-version {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: var(--input);
  border: 1px solid var(--border);
}

.section-label {
  margin: 0 0 2px;
  color: var(--hint);
  font-size: 14px;
  line-height: 1.3;
}

.current-version-name {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  padding: 5px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 19px;
  line-height: 1.3;
  font-weight: 900;
}

.variant-bar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.variant-button {
  min-height: 46px;
  border: 1px solid var(--border);
  background: var(--panel-raised);
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
}

.variant-button.active,
.variant-button:disabled {
  border-color: var(--border-strong);
  background: var(--primary);
  color: var(--primary-text);
  cursor: default;
}

.pitch-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border-radius: 12px;
  background: var(--input);
  border: 1px solid var(--border);
}

.pitch-panel h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: 0;
}

.pitch-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.choice {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-raised);
  font-size: 18px;
  font-weight: 800;
}

.choice input {
  width: 20px;
  height: 20px;
  margin: 0 8px 0 0;
  accent-color: var(--primary);
}

.pitch-select-label {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.pitch-select-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.pitch-select-heading span {
  color: var(--hint);
  font-size: 14px;
  line-height: 1.3;
  text-align: right;
}

.pitch-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pitch-choice {
  position: relative;
  display: block;
  min-height: 56px;
}

.pitch-choice input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.pitch-choice span {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-raised);
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
}

.pitch-choice input:checked + span {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-text);
}

.pitch-choice input:focus-visible + span {
  outline: 3px solid rgba(229, 178, 93, 0.25);
  outline-offset: 2px;
}

.pitch-status {
  color: var(--success);
  font-weight: 800;
}

.processing-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.72);
}

.processing-modal {
  width: min(100%, 360px);
  padding: 24px 20px;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--panel);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  text-align: center;
}

.processing-modal h3 {
  margin: 0 0 12px;
  color: var(--primary);
  font-size: 24px;
  line-height: 1.25;
}

.processing-modal p {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.45;
  font-weight: 800;
}

.processing-modal .processing-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 700;
}

.page-footer {
  margin-top: 28px;
  text-align: center;
}

.app-version {
  margin: 0;
  color: var(--hint);
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 359px) {
  .page {
    padding-left: 14px;
    padding-right: 14px;
  }

  textarea {
    height: 118px;
    min-height: 118px;
  }

  h1 {
    font-size: 27px;
  }

  button,
  .button-link {
    font-size: 20px;
  }

  .tab-button {
    font-size: 17px;
  }
}
