:root {
  color-scheme: dark;
  --bg: #0e0d09;
  --surface: #161510;
  --surface-soft: #1e1c14;
  --text: #d4c9a8;
  --muted: rgba(212, 201, 168, 0.5);
  --line: rgba(184, 168, 50, 0.18);
  --line-strong: rgba(184, 168, 50, 0.35);
  --accent: #b8a832;
  --accent-hover: #cfc040;
  --accent-dark: #0e0d09;
  --danger: #c47a3a;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.5);
  --cover-shadow: 0 7px 18px rgba(0, 0, 0, 0.42);
  --clip-progress: 0%;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background-color: var(--bg);
  background-image: radial-gradient(circle, rgba(184, 168, 50, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  font-family: "Archivo Narrow", "Arial Narrow", Arial, sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button,
label,
.eyebrow,
.mode-button,
.stats-mode-button,
.modal-close {
  font-variant: small-caps;
  letter-spacing: 0.08em;
}

button {
  min-height: 44px;
  padding: 0 14px;
  color: var(--accent-dark);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
}

button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  filter: none;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.page-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  width: min(100% - 32px, 408px);
  margin: 0 auto;
  padding: 18px 0 24px;
  align-content: start;
}

.game-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 48px;
  padding: 0 4px 8px;
  border-bottom: 1px solid rgba(184, 168, 50, 0.15);
}

.brand {
  color: var(--text);
  text-align: center;
}

.brand h1 {
  margin: 0;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.1rem;
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.header-actions:last-child {
  justify-content: flex-end;
}

.header-button {
  display: grid;
  width: 34px;
  height: 34px;
  min-height: 34px;
  place-items: center;
  padding: 0;
  color: var(--accent);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
}

.header-button:hover {
  color: var(--text);
  background: var(--surface-soft);
  border-color: var(--line);
}

.icon-help {
  display: block;
  width: 18px;
  height: 18px;
}

.icon-help::before {
  display: block;
  content: "?";
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1rem;
  font-style: italic;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.stat-icon {
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 3px;
  padding-bottom: 8px;
}

.stat-icon span {
  display: block;
  width: 4px;
  background: var(--accent);
  border-radius: 1px;
}

.stat-icon span:nth-child(1) {
  height: 10px;
}

.stat-icon span:nth-child(2) {
  height: 16px;
}

.stat-icon span:nth-child(3) {
  height: 7px;
}

.intro-panel {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 6px 8px 8px;
  text-align: center;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.intro-copy {
  max-width: 390px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.mode-switch,
.stats-mode-switch {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.mode-switch {
  margin-top: 2px;
}

.mode-button,
.stats-mode-button {
  min-height: 30px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 3px;
  font-size: 0.82rem;
}

.mode-button:hover,
.mode-button.is-active,
.stats-mode-button:hover,
.stats-mode-button.is-active {
  color: var(--accent-dark);
  background: var(--accent);
  border-color: var(--accent);
}

.game-panel {
  padding: 20px 18px;
  background: var(--surface);
  border: 1px solid rgba(184, 168, 50, 0.18);
  border-left: 2px solid rgba(184, 168, 50, 0.45);
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.cover-placeholder {
  display: grid;
  width: min(100%, 336px);
  place-items: center;
  margin: 0 auto;
  overflow: hidden;
  color: var(--accent);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 2px;
  outline: 1px solid rgba(184, 168, 50, 0.15);
  outline-offset: 3px;
  box-shadow:
    inset 0 0 0 1px rgba(184, 168, 50, 0.25),
    0 6px 24px rgba(0, 0, 0, 0.6);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 3.25rem;
  font-style: italic;
  font-weight: 700;
  text-align: center;
}

.cover-placeholder img {
  display: block;
  width: 100%;
  height: auto;
}

.cover-fallback {
  padding: 18px;
  color: var(--text);
  font-family: "Archivo Narrow", "Arial Narrow", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.35;
}

.cover-fallback strong,
.cover-fallback span {
  display: block;
}

.cover-fallback span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.caption {
  width: min(100%, 336px);
  margin: 10px auto 0;
  padding-top: 10px;
  color: var(--muted);
  border-top: 1px solid rgba(184, 168, 50, 0.15);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-align: center;
}

.answer-link {
  display: block;
  margin-top: 6px;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 700;
  text-align: center;
}

.answer-link:hover {
  color: var(--accent-hover);
}

.schedule-message {
  margin: 14px 0 0;
  padding: 10px 12px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 3px;
  font-size: 0.9rem;
  line-height: 1.35;
  text-align: center;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 12px;
  padding-top: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}

.player-shell {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-top: 4px;
}

.play-button {
  display: grid;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  background: var(--accent);
  border-color: var(--accent);
  border-radius: 2px;
}

.play-button:hover {
  background: var(--accent-hover);
}

.play-icon {
  display: block;
  width: 0;
  height: 0;
  margin-left: 3px;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid currentColor;
}

.play-button.is-playing .play-icon {
  width: 13px;
  height: 15px;
  margin-left: 0;
  border: 0;
  border-right: 4px solid currentColor;
  border-left: 4px solid currentColor;
}

.progress-track {
  position: relative;
  flex: 1;
  height: 16px;
  overflow: hidden;
  background: rgba(184, 168, 50, 0.08);
  border: 1px solid var(--line-strong);
  border-radius: 0;
}

.progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  display: block;
  width: var(--clip-progress);
  height: 100%;
  background: var(--accent);
  border-radius: 0;
  transition: width 80ms linear;
}

.progress-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1;
  width: 1px;
  background: rgba(184, 168, 50, 0.25);
  transform: translateX(-0.5px);
}

.clip-length {
  width: 32px;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: right;
}

.guess-form {
  display: grid;
  gap: 10px;
}

.guess-field {
  position: relative;
  display: grid;
  gap: 8px;
}

label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 3px;
}

input {
  min-height: 44px;
  padding: 0 12px;
}

.guess-field:has(.suggestion-list:not([hidden])) input {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

input:focus,
textarea:focus {
  outline: 1px solid rgba(184, 168, 50, 0.55);
  border-color: var(--accent);
}

.suggestion-list {
  position: absolute;
  right: 0;
  bottom: calc(100% - 24px);
  left: 0;
  z-index: 4;
  max-height: 218px;
  margin: 0;
  padding: 0;
  overflow: auto;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 0;
  list-style: none;
}

.suggestion-list li {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.suggestion-list li:hover,
.suggestion-list li.is-active {
  background: rgba(184, 168, 50, 0.1);
}

.suggestion-title {
  font-weight: 700;
}

.suggestion-artist {
  color: var(--muted);
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.secondary-button {
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--line-strong);
}

.secondary-button:hover {
  color: var(--accent-hover);
  background: rgba(184, 168, 50, 0.08);
  border-color: rgba(184, 168, 50, 0.55);
}

.next-button {
  display: block;
  width: 100%;
  margin-top: 16px;
  color: var(--accent-dark);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
  box-shadow: 0 2px 0 rgba(184, 168, 50, 0.28);
}

.share-button {
  width: 100%;
  margin-top: 8px;
  color: rgba(212, 201, 168, 0.6);
  background: transparent;
  border: 1px solid rgba(184, 168, 50, 0.3);
  font-weight: 600;
}

.share-button:hover {
  color: var(--accent);
  background: transparent;
  border-color: rgba(184, 168, 50, 0.38);
}

.share-output {
  min-height: 92px;
  margin-top: 8px;
  padding: 10px;
  resize: vertical;
  border-radius: 3px;
  font-size: 0.82rem;
  line-height: 1.35;
}

.game-panel.is-complete .guess-form {
  display: none;
}

.guess-history {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.guess-history h3 {
  margin: 0 0 8px;
  padding-bottom: 6px;
  color: var(--accent);
  border-bottom: 1px solid rgba(184, 168, 50, 0.2);
  font-size: 0.84rem;
  font-variant: small-caps;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.guess-history ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guess-history li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-left: 2px solid rgba(184, 168, 50, 0.4);
  border-radius: 0;
  font-size: 0.86rem;
}

.guess-history .guess-result {
  flex: 0 0 auto;
  padding: 2px 8px;
  color: rgba(212, 201, 168, 0.4);
  background: transparent;
  border: 1px solid currentColor;
  border-radius: 2px;
  font-size: 0.72rem;
  font-variant: small-caps;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.guess-history .is-correct {
  color: #b8a832;
}

.guess-history .is-wrong {
  color: #c47a3a;
}

.guess-history .is-skipped {
  color: rgba(212, 201, 168, 0.4);
}

.guess-history .empty-guess {
  justify-content: center;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: min(100% - 32px, 408px);
  margin: 0 auto 22px;
  padding-top: 14px;
  color: rgba(184, 168, 50, 0.48);
  border-top: 1px solid rgba(184, 168, 50, 0.12);
  font-size: 0.72rem;
}

.site-footer p {
  margin: 0;
}

.site-footer nav {
  display: flex;
  gap: 14px;
}

.site-footer a:hover {
  color: #b8a832;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.72);
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 11;
  width: min(100% - 32px, 480px);
  max-height: min(86vh, 620px);
  overflow: auto;
  padding: 26px 24px 28px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 18px 70px rgba(0, 0, 0, 0.48);
  transform: translate(-50%, -50%);
}

.modal h2 {
  margin: 0 0 24px;
  color: var(--accent);
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1rem;
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0;
  text-align: center;
  text-transform: none;
}

.modal p {
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.48;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 3px;
  font-size: 1.2rem;
}

.modal-close:hover {
  color: var(--accent);
  background: var(--surface-soft);
}

.instruction-list {
  display: grid;
  gap: 18px;
}

.instruction-list p {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  margin: 0;
}

.instruction-list span {
  color: var(--accent);
  font-size: 1.2rem;
  line-height: 1;
}

.modal-action {
  display: block;
  margin: 26px auto 0;
}

.stats-mode-switch {
  justify-content: center;
  width: max-content;
  margin: -8px auto 26px;
}

.guess-scale {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin: 38px 0 26px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.guess-scale div {
  display: grid;
  grid-template-rows: auto 76px auto;
  gap: 8px;
  align-items: end;
}

.guess-bar {
  display: block;
  width: 100%;
  min-height: 4px;
  background: rgba(184, 168, 50, 0.22);
  border: 1px solid var(--line);
  border-radius: 0;
}

.guess-scale strong {
  color: var(--text);
  font-size: 0.95rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px 12px;
  text-align: center;
}

.stats-grid div {
  display: grid;
  gap: 4px;
}

.stats-grid div:nth-child(4) {
  grid-column: 1 / 3;
}

.stats-grid strong {
  color: var(--accent);
  font-size: 1.25rem;
}

.stats-grid span {
  color: var(--muted);
  font-size: 0.84rem;
}

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 24px, 408px);
    min-height: auto;
    padding-top: 10px;
    align-content: start;
  }

  .game-header {
    min-height: 50px;
  }

  .brand h1 {
    font-size: 1rem;
  }

  .header-button {
    width: 34px;
    height: 34px;
    min-height: 34px;
  }

  .intro-copy {
    display: none;
  }

  .button-row {
    grid-template-columns: 1fr;
  }

  .site-footer {
    display: grid;
    justify-content: stretch;
    width: min(100% - 24px, 408px);
    text-align: center;
  }

  .site-footer nav {
    justify-content: center;
  }
}
