/* ── Design tokens ──────────────────────────────────────────────────────────── */
:root {
  --board: #0c0c0c;
  --board-raised: rgba(255, 255, 255, 0.025);
  --chalk-white: #f0ece0;
  --chalk-dim: rgba(240, 236, 224, 0.55);
  --chalk-faint: rgba(240, 236, 224, 0.22);
  --chalk-orange: #e8650a;
  --chalk-orange-soft: rgba(232, 101, 10, 0.12);
  --chalk-orange-glow: rgba(232, 101, 10, 0.35);
  --chalk-gold: #f5cc42;
  --chalk-border: rgba(240, 236, 224, 0.1);
  --chalk-border-strong: rgba(240, 236, 224, 0.25);

  --font-chalk: "Caveat", cursive;
  --font-bistro: "Playfair Display", Georgia, serif;
  --font-graffiti: "Permanent Marker", cursive;

  --max-w: 620px;
  --card-pad: 2rem 1.75rem;
}

/* ── Reset ──────────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}
h1,
h2,
p,
ul {
  margin: 0;
  padding: 0;
}

/* ── Chalkboard background ──────────────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-chalk);
  color: var(--chalk-white);
  background-color: var(--board);
  /* Three-point vignette for board depth */
  background-image:
    radial-gradient(
      ellipse 110% 55% at 50% 0%,
      rgba(26, 20, 10, 0.75) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse 60% 65% at 5% 90%,
      rgba(30, 18, 5, 0.5) 0%,
      transparent 55%
    ),
    radial-gradient(
      ellipse 50% 45% at 95% 15%,
      rgba(18, 8, 0, 0.45) 0%,
      transparent 50%
    );
  overflow-x: hidden;
}

/* Chalk grain overlay — subtle diagonal hatching imitates chalk texture */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image:
    repeating-linear-gradient(
      62deg,
      transparent 0px,
      transparent 4px,
      rgba(255, 255, 255, 0.0035) 4px,
      rgba(255, 255, 255, 0.0035) 5px
    ),
    repeating-linear-gradient(
      -62deg,
      transparent 0px,
      transparent 7px,
      rgba(255, 255, 255, 0.002) 7px,
      rgba(255, 255, 255, 0.002) 8px
    );
}

/* ── Graffiti / decoration layer ────────────────────────────────────────────── */
.chalk-deco {
  position: fixed;
  inset: 0;
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.graffiti {
  position: absolute;
  font-family: var(--font-graffiti);
  line-height: 1;
}

/* Top-left: music notes */
.g-notes {
  top: 7%;
  left: 2.5%;
  font-size: 3rem;
  color: var(--chalk-white);
  opacity: 0.07;
  transform: rotate(-14deg);
}

/* Bottom-right: Rock! in orange */
.g-rock {
  bottom: 14%;
  right: 2.5%;
  font-size: 4.5rem;
  color: var(--chalk-orange);
  opacity: 0.1;
  transform: rotate(-7deg);
}

/* Left edge: 80s rotated vertically */
.g-80s {
  top: 42%;
  left: -1%;
  font-size: 7.5rem;
  color: var(--chalk-white);
  opacity: 0.04;
  transform: rotate(-90deg) translateX(-40%);
  transform-origin: left center;
  letter-spacing: -0.04em;
}

/* Bottom-left: Pop! */
.g-pop {
  bottom: 5%;
  left: 3.5%;
  font-size: 2.8rem;
  color: var(--chalk-white);
  opacity: 0.07;
  transform: rotate(6deg);
}

/* Top-right: star cluster */
.g-stars {
  top: 2.5%;
  right: 3%;
  font-size: 1rem;
  color: var(--chalk-orange);
  opacity: 0.14;
  letter-spacing: 0.7rem;
}

/* Right-middle: yeah! */
.g-yeah {
  top: 60%;
  right: 1.5%;
  font-size: 2.5rem;
  color: var(--chalk-white);
  opacity: 0.055;
  transform: rotate(-80deg);
  transform-origin: right center;
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.site-header,
.quiz-main {
  position: relative;
  z-index: 2;
  max-width: var(--max-w);
  margin: 0 auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

/* ── Header ──────────────────────────────────────────────────────────────────── */
.site-header {
  padding-top: 1.5rem;
  text-align: center;
}

.top-nav {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}

.nav-link {
  font-family: var(--font-chalk);
  font-size: 1.15rem;
  color: var(--chalk-dim);
  text-decoration: none;
  letter-spacing: 0.05em;
  transition: color 0.2s ease;
  padding: 0.1rem 0;
  border-bottom: 1px solid transparent;
}
.nav-link:hover {
  color: var(--chalk-orange);
  border-bottom-color: rgba(232, 101, 10, 0.4);
}

/* Title block */
.title-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.title-pre {
  font-family: var(--font-bistro);
  font-style: italic;
  font-weight: 400;
  font-size: 0.95rem;
  color: var(--chalk-orange);
  letter-spacing: 0.18em;
  opacity: 0.85;
  margin-bottom: -0.3rem;
  animation: fadeUp 0.6s 0.1s ease-out both;
}

.title-main {
  font-family: var(--font-chalk);
  font-weight: 700;
  font-size: clamp(5rem, 20vw, 8.5rem);
  color: var(--chalk-white);
  line-height: 0.92;
  letter-spacing: -0.01em;
  text-shadow:
    0 0 50px rgba(240, 236, 224, 0.07),
    3px 3px 0 rgba(0, 0, 0, 0.55);
  animation: chalkReveal 0.85s ease-out both;
}

.title-era {
  font-family: var(--font-bistro);
  font-style: italic;
  font-weight: 400;
  font-size: 1.05rem;
  color: var(--chalk-dim);
  letter-spacing: 0.22em;
  margin-top: 0.1rem;
  animation: fadeUp 0.6s 0.3s ease-out both;
}

.title-ornament {
  margin-top: 1.1rem;
  color: var(--chalk-orange);
  font-family: var(--font-bistro);
  font-size: 0.7rem;
  letter-spacing: 1.3rem;
  opacity: 0.5;
  animation: fadeUp 0.5s 0.5s ease-out both;
}

/* ── Animations ─────────────────────────────────────────────────────────────── */
@keyframes chalkReveal {
  from {
    opacity: 0;
    filter: blur(14px);
    letter-spacing: 0.14em;
  }
  to {
    opacity: 1;
    filter: blur(0);
    letter-spacing: -0.01em;
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Quiz main ──────────────────────────────────────────────────────────────── */
.quiz-main {
  padding-top: 2.25rem;
  padding-bottom: 5rem;
}

/* ── Chalk card ──────────────────────────────────────────────────────────────── */
.chalk-card {
  background: var(--board-raised);
  border: 1px solid var(--chalk-border);
  border-radius: 5px;
  padding: var(--card-pad);
  animation: fadeUp 0.35s ease-out both;
}

/* ── Setup phase ─────────────────────────────────────────────────────────────── */
.card-title {
  font-family: var(--font-chalk);
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--chalk-dim);
  text-align: center;
  letter-spacing: 0.1em;
  margin-bottom: 1.5rem;
}

.size-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.size-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 1.1rem 0.5rem;
  background: transparent;
  border: 2px solid var(--chalk-border-strong);
  border-radius: 4px;
  color: var(--chalk-dim);
  cursor: pointer;
  font-family: var(--font-chalk);
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.size-btn .size-name {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
}

.size-btn .size-count {
  font-size: 0.82rem;
  opacity: 0.6;
}

.size-btn.active {
  border-color: var(--chalk-orange);
  background: var(--chalk-orange-soft);
  color: var(--chalk-orange);
  box-shadow: 0 0 14px rgba(232, 101, 10, 0.18);
}

.size-btn.active .size-count {
  opacity: 0.85;
}

.size-btn:hover:not(.active):not(:disabled) {
  border-color: rgba(240, 236, 224, 0.45);
  color: var(--chalk-white);
}

.size-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.build-status {
  min-height: 1.5rem;
  font-size: 1rem;
  text-align: center;
  color: var(--chalk-dim);
  font-style: italic;
}

/* ── Ready phase ─────────────────────────────────────────────────────────────── */
.ready-icon {
  font-family: var(--font-chalk);
  font-size: 3.5rem;
  text-align: center;
  color: var(--chalk-orange);
  margin-bottom: 0.5rem;
  line-height: 1;
}

.ready-text {
  text-align: center;
  color: var(--chalk-dim);
  font-size: 1.1rem;
  line-height: 1.55;
  margin-bottom: 1.75rem;
}

/* ── Primary button ─────────────────────────────────────────────────────────── */
.chalk-btn-primary {
  display: block;
  width: 100%;
  background: var(--chalk-orange);
  color: #0c0c0c;
  border: none;
  border-radius: 4px;
  font-family: var(--font-chalk);
  font-size: 1.65rem;
  font-weight: 700;
  padding: 0.65rem 2rem;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.15s ease;
  box-shadow: 0 0 20px rgba(232, 101, 10, 0.28);
}

.chalk-btn-primary:hover {
  background: #ff7820;
  box-shadow: 0 0 32px rgba(232, 101, 10, 0.5);
  transform: translateY(-2px);
}

.chalk-btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 0 14px rgba(232, 101, 10, 0.3);
}

/* ── Question phase ─────────────────────────────────────────────────────────── */
.quiz-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--chalk-border);
}

.meta-item {
  font-size: 1rem;
  color: var(--chalk-dim);
}

.meta-score {
  color: var(--chalk-orange);
  font-weight: 700;
  font-size: 1.1rem;
}

.question-area {
  margin-bottom: 0.5rem;
}

.question-text {
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--chalk-white);
  line-height: 1.3;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 10px rgba(240, 236, 224, 0.05);
}

.points-hint {
  font-size: 1.15rem;
  font-weight: 600;
  color: #ffffff;
  margin-bottom: 0.2rem;
}

.track-hint {
  font-size: 0.95rem;
  color: var(--chalk-orange);
  opacity: 0.8;
  margin-bottom: 0.5rem;
}

/* Answer row */
.answer-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
  margin-top: 1.5rem;
}

.chalk-input {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 2px solid var(--chalk-border-strong);
  color: var(--chalk-white);
  font-family: var(--font-chalk);
  font-size: 1.6rem;
  padding: 0.35rem 0;
  outline: none;
  min-width: 0;
  transition: border-color 0.2s ease;
}

.chalk-input::placeholder {
  color: var(--chalk-faint);
  font-style: italic;
}

.chalk-input:focus {
  border-bottom-color: var(--chalk-orange);
}

.chalk-btn-submit {
  flex-shrink: 0;
  background: transparent;
  border: 2px solid var(--chalk-orange);
  border-radius: 3px;
  color: var(--chalk-orange);
  font-family: var(--font-chalk);
  font-size: 1.25rem;
  font-weight: 700;
  padding: 0.35rem 1.25rem;
  cursor: pointer;
  letter-spacing: 0.05em;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.chalk-btn-submit:hover:not(:disabled) {
  background: var(--chalk-orange);
  color: #0c0c0c;
  box-shadow: 0 0 14px rgba(232, 101, 10, 0.4);
}

.chalk-btn-submit:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Feedback box ────────────────────────────────────────────────────────────── */
.feedback-box {
  margin-top: 1.25rem;
  padding: 0.9rem 1.1rem;
  border-radius: 4px;
  border-left: 3px solid;
  font-size: 1.1rem;
  line-height: 1.5;
  animation: fadeUp 0.25s ease-out;
}

.feedback-correct {
  color: var(--chalk-orange);
  border-left-color: var(--chalk-orange);
  background: rgba(232, 101, 10, 0.07);
}

.feedback-partial {
  color: var(--chalk-gold);
  border-left-color: var(--chalk-gold);
  background: rgba(245, 204, 66, 0.07);
}

.feedback-wrong {
  color: var(--chalk-dim);
  border-left-color: rgba(240, 236, 224, 0.28);
  background: rgba(255, 255, 255, 0.025);
}

/* ── Next button ─────────────────────────────────────────────────────────────── */
.next-wrap {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}

.chalk-btn-secondary {
  background: transparent;
  border: 1px solid var(--chalk-border-strong);
  border-radius: 3px;
  color: var(--chalk-dim);
  font-family: var(--font-chalk);
  font-size: 1.15rem;
  padding: 0.35rem 1.1rem;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition:
    color 0.2s ease,
    border-color 0.2s ease;
}

.chalk-btn-secondary:hover {
  color: var(--chalk-white);
  border-color: rgba(240, 236, 224, 0.5);
}

/* ── Summary phase ───────────────────────────────────────────────────────────── */
.summary-title {
  font-family: var(--font-chalk);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--chalk-white);
  text-align: center;
  margin-bottom: 0.3rem;
}

.summary-meta {
  font-size: 0.85rem;
  color: var(--chalk-faint);
  text-align: center;
  margin-bottom: 1.75rem;
  font-style: italic;
}

.summary-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.75rem;
}

.summary-item {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  font-size: 1.05rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--chalk-border);
}

.summary-item:last-child {
  border-bottom: none;
}

.summary-pts {
  font-weight: 700;
  min-width: 2.5rem;
  flex-shrink: 0;
  font-size: 1rem;
}

.summary-pts-2 {
  color: var(--chalk-orange);
}
.summary-pts-1 {
  color: var(--chalk-gold);
}
.summary-pts-0 {
  color: rgba(240, 236, 224, 0.3);
}

.summary-q {
  color: var(--chalk-dim);
  line-height: 1.4;
}

.summary-a {
  font-style: italic;
  color: var(--chalk-faint);
}

/* ── Music service login buttons ─────────────────────────────────────────────── */
.music-login-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
  justify-content: center;
}

.music-login-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--chalk-border-strong);
  background: var(--board-raised);
  color: var(--chalk-white);
  border-radius: 10px;
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease;
}

.music-login-spotify {
  background: #1db954;
  color: #fff;
  border-color: #1db954;
}

.music-login-spotify:hover {
  background: #1ed760;
}

.music-login-tidal {
  background: #000;
  color: #fff;
  border-color: rgba(240, 236, 224, 0.4);
}

.music-login-tidal:hover {
  background: #1a1a1a;
}

/* ── Player bar theming ──────────────────────────────────────────────────────── */
#now-playing-bar {
  background: rgba(10, 10, 10, 0.97) !important;
  border-top: 1px solid rgba(232, 101, 10, 0.35) !important;
  backdrop-filter: blur(10px);
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 500px) {
  :root {
    --card-pad: 1.4rem 1.1rem;
  }

  .title-main {
    font-size: clamp(4rem, 22vw, 6rem);
  }

  .size-grid {
    grid-template-columns: 1fr;
  }

  .size-btn {
    flex-direction: row;
    justify-content: space-between;
    padding: 0.85rem 1rem;
  }

  .answer-row {
    flex-direction: column;
    align-items: stretch;
  }
  .chalk-btn-submit {
    width: 100%;
    text-align: center;
  }
}

/* Lynrunde sequencer */
.lynrunde-sequencer {
  margin: 0.75rem 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.lynrunde-sequencer[hidden] {
  display: none;
}

.lynrunde-clip-counter {
  font-size: 1rem;
  color: var(--chalk-orange);
  opacity: 0.9;
  margin: 0;
}
