:root {
  --bg: #06030b;
  --panel: rgba(31, 11, 42, 0.74);
  --text: #fff7ff;
  --muted: #c9a8d8;
  --pink: #ff4fa3;
  --violet: #9d4edd;
  --violet-bright: #c77dff;
  --green: #39ffbc;
  --border: rgba(255, 79, 163, 0.3);
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.58);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 16% 18%, rgba(157, 78, 221, 0.3), transparent 20rem),
    radial-gradient(circle at 88% 40%, rgba(255, 79, 163, 0.28), transparent 22rem),
    linear-gradient(145deg, #05020a 0%, #13081d 48%, #050309 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(115deg, transparent 0 42px, rgba(255, 79, 163, 0.052) 43px 44px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 7px);
  opacity: 0.7;
}

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

button {
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  color: inherit;
  font: inherit;
  font-weight: 950;
  transition: transform 160ms ease, filter 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

button:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.game-shell {
  position: relative;
  z-index: 1;
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 30px;
  display: grid;
  grid-template-rows: auto auto;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 950;
}

.brand img {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  box-shadow: 0 0 22px rgba(255, 79, 163, 0.28);
}

.scoreboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(86px, 1fr));
  gap: 8px;
}

.scoreboard div {
  padding: 12px 14px;
  text-align: center;
  border: 1px solid rgba(255, 79, 163, 0.26);
  border-radius: 8px;
  background: rgba(16, 7, 25, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.scoreboard span,
.eyebrow,
.year-readout span,
.inline-result span {
  color: #ff9bd3;
  font-size: 0.66rem;
  font-weight: 950;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.scoreboard strong {
  display: block;
  margin-top: 4px;
  color: var(--violet-bright);
  font-size: 1.35rem;
}

.game-card {
  display: grid;
  grid-template-columns: minmax(300px, 420px) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}

.song-panel,
.timeline-panel,
.start-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 79, 163, 0.11), transparent 42%),
    rgba(24, 9, 35, 0.72);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(18px);
}

.song-panel {
  padding: 22px;
  display: grid;
  grid-template-rows: auto auto auto auto;
  align-content: start;
  gap: 16px;
}

.cover-frame {
  width: min(100%, 310px);
  aspect-ratio: 1;
  margin: 8px auto 0;
  padding: 10px;
  border: 1px solid rgba(255, 122, 200, 0.36);
  border-radius: 8px;
  background: rgba(8, 4, 14, 0.58);
  box-shadow: 0 0 34px rgba(157, 78, 221, 0.16);
}

#cover {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  border-radius: 6px;
  background: rgba(8, 4, 14, 0.6);
}

.song-copy {
  text-align: center;
  margin-top: 8px;
}

h1,
h2 {
  color: transparent;
  background: linear-gradient(90deg, #c77dff 0%, #ff7ac8 48%, #ff3d99 100%);
  -webkit-background-clip: text;
  background-clip: text;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 0.95;
}

.song-copy p,
.start-box p:not(.eyebrow) {
  margin-top: 10px;
  color: var(--muted);
  font-weight: 730;
  line-height: 1.45;
}

#play-preview {
  color: #fff7ff;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  box-shadow: 0 18px 42px rgba(255, 79, 163, 0.22);
}

.timeline-panel {
  padding: clamp(18px, 3vw, 34px);
  display: grid;
  align-content: start;
  gap: 22px;
}

.mode-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.mode-button {
  min-height: 42px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 122, 200, 0.22);
}

.mode-button.is-active {
  color: #fff7ff;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  border-color: rgba(255, 79, 163, 0.68);
}

.range-meta {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-weight: 900;
}

.range-meta span:last-child {
  text-align: right;
}

#guess-year {
  min-width: 124px;
  padding: 12px 18px;
  display: inline-grid;
  place-items: center;
  color: var(--pink);
  border: 1px solid rgba(255, 79, 163, 0.36);
  border-radius: 8px;
  background: rgba(8, 4, 14, 0.58);
  font-size: clamp(2.4rem, 7vw, 4.8rem);
  line-height: 1;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.timeline-wrap {
  position: relative;
  padding: 24px 0;
}

#year-slider {
  width: 100%;
  position: relative;
  z-index: 2;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

#year-slider::-webkit-slider-runnable-track {
  height: 14px;
  border: 1px solid rgba(255, 122, 200, 0.24);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 79, 163, 0.42), rgba(157, 78, 221, 0.34), rgba(57, 255, 188, 0.26));
}

#year-slider::-webkit-slider-thumb {
  appearance: none;
  width: 32px;
  height: 32px;
  margin-top: -10px;
  border: 3px solid #fff7ff;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  box-shadow: 0 0 30px rgba(255, 79, 163, 0.42);
}

#year-slider::-moz-range-track {
  height: 14px;
  border: 1px solid rgba(255, 122, 200, 0.24);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255, 79, 163, 0.42), rgba(157, 78, 221, 0.34), rgba(57, 255, 188, 0.26));
}

#year-slider::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: 3px solid #fff7ff;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  box-shadow: 0 0 30px rgba(255, 79, 163, 0.42);
}

.timeline-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34px;
}

#guess-marker,
#answer-marker {
  position: absolute;
  top: 3px;
  width: 2px;
  height: 28px;
  border-radius: 999px;
  transform: translateX(-1px);
}

#guess-marker {
  background: var(--pink);
  box-shadow: 0 0 18px rgba(255, 79, 163, 0.5);
}

#answer-marker {
  display: none;
  background: var(--green);
  box-shadow: 0 0 18px rgba(57, 255, 188, 0.5);
}

.is-revealed #answer-marker {
  display: block;
}

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

.year-readout div {
  min-height: 86px;
  padding: 14px;
  display: grid;
  place-items: center;
  text-align: center;
  border: 1px solid rgba(255, 122, 200, 0.24);
  border-radius: 8px;
  background: rgba(8, 4, 14, 0.5);
}

.year-readout strong {
  color: var(--violet-bright);
  font-size: clamp(1.5rem, 4vw, 2.2rem);
}

.year-readout strong.is-counting {
  animation: number-pop 420ms ease;
}

.inline-result {
  display: none;
  grid-template-columns: minmax(160px, auto) 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(57, 255, 188, 0.28);
  border-radius: 8px;
  background:
    radial-gradient(circle at 12% 50%, rgba(57, 255, 188, 0.14), transparent 10rem),
    rgba(8, 4, 14, 0.58);
  box-shadow: 0 0 34px rgba(57, 255, 188, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.inline-result.is-visible {
  display: grid;
  animation: result-rise 360ms ease both;
}

.inline-result strong {
  display: block;
  margin-top: 4px;
  color: var(--green);
  font-size: clamp(1.35rem, 3vw, 2.05rem);
  line-height: 1;
}

.inline-result p {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.35;
}

.inline-result button {
  min-width: 132px;
  min-height: 44px;
  color: #fff7ff;
  background: linear-gradient(135deg, var(--green), var(--violet));
  box-shadow: 0 14px 32px rgba(57, 255, 188, 0.14);
}

#lock-answer {
  color: #fff7ff;
  background: linear-gradient(135deg, var(--pink), var(--violet));
  box-shadow: 0 18px 42px rgba(255, 79, 163, 0.22);
}

.start-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 22px;
  background: rgba(4, 2, 8, 0.82);
  backdrop-filter: blur(18px);
}

.start-screen.is-visible {
  display: grid;
}

.start-box {
  width: min(440px, 100%);
  padding: 30px;
  text-align: center;
}

.start-box img {
  width: 104px;
  height: 104px;
  margin-bottom: 16px;
  border-radius: 22px;
}

.start-box h2 {
  margin-top: 8px;
  font-size: 2.7rem;
  line-height: 0.95;
}

#start-game {
  width: 100%;
  margin-top: 22px;
  color: #fff7ff;
  background: linear-gradient(135deg, var(--pink), var(--violet));
}

@keyframes result-rise {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes number-pop {
  0% {
    filter: brightness(1);
    transform: scale(0.96);
  }

  60% {
    filter: brightness(1.35);
    transform: scale(1.08);
  }

  100% {
    filter: brightness(1);
    transform: scale(1);
  }
}

@media (max-width: 820px) {
  .game-shell {
    width: min(100% - 16px, 1120px);
    padding: 12px 0 18px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .scoreboard {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .scoreboard div {
    padding: 8px;
  }

  .game-card {
    min-height: auto;
    grid-template-columns: 1fr;
  }

  .song-panel {
    padding: 16px;
    grid-template-rows: auto auto auto auto;
    gap: 12px;
  }

  .cover-frame {
    width: min(62vw, 220px);
    margin-top: 4px;
  }

  .song-copy {
    margin-top: 2px;
  }

  h1 {
    font-size: clamp(2rem, 13vw, 3.4rem);
  }

  .timeline-panel {
    padding: 16px;
    gap: 16px;
  }

  .mode-row,
  .year-readout {
    grid-template-columns: repeat(2, 1fr);
  }

  .inline-result {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .inline-result button {
    width: 100%;
  }

  .range-meta {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .range-meta span:last-child {
    text-align: center;
  }
}
