:root {
  --bg: #efe9df;
  --paper: #fffaf2;
  --ink: #22211f;
  --muted: #6f6a63;
  --line: #d9d0c4;
  --accent: #2f5d62;
  --accent-soft: #dce9e8;
  --danger: #8e3d35;
  --danger-soft: #f1ded9;
  --shadow: 0 24px 80px rgba(54, 45, 33, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,.9) 0 1px, transparent 2px),
    linear-gradient(135deg, rgba(255,255,255,.3), rgba(199,185,165,.15)),
    var(--bg);
  background-size: 26px 26px, auto, auto;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, a { font: inherit; }

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.game-card {
  width: min(760px, 100%);
  min-height: 720px;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid rgba(58, 50, 40, .12);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.game-card::before,
.game-card::after {
  content: "";
  position: absolute;
  width: 110px;
  height: 26px;
  background: rgba(220, 204, 175, .52);
  transform: rotate(-5deg);
  pointer-events: none;
}

.game-card::before { top: 8px; left: 42%; }
.game-card::after { bottom: 10px; right: 6%; transform: rotate(4deg); }

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 28px 30px 18px;
  border-bottom: 1px dashed var(--line);
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: .08em;
  font-size: .8rem;
  white-space: nowrap;
}

.mode {
  color: var(--muted);
  font-size: .73rem;
  font-weight: 700;
  letter-spacing: .18em;
}

.streak-pill {
  justify-self: end;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-width: 68px;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,.55);
  font-weight: 700;
}

.flame {
  color: var(--muted);
  font-size: .62rem;
  font-weight: 850;
  letter-spacing: .08em;
}

.view {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 54px 44px 36px;
  text-align: center;
}

.landing-view {
  justify-content: center;
  min-height: 560px;
  position: relative;
  overflow: hidden;
}

.landing-scene {
  position: absolute;
  inset: 20px;
  pointer-events: none;
}

.landing-note {
  position: absolute;
  display: grid;
  place-items: center;
  border: 1px solid rgba(83, 73, 62, .28);
  background:
    linear-gradient(135deg, rgba(255,255,255,.88), rgba(255,250,242,.7)),
    var(--paper);
  box-shadow: 0 18px 36px rgba(54, 45, 33, .12);
  color: rgba(34, 33, 31, .72);
  font-weight: 850;
  letter-spacing: .08em;
}

.landing-note::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  width: 72px;
  height: 18px;
  background: rgba(213, 199, 174, .68);
  transform: translateX(-50%) rotate(-4deg);
}

.note-a {
  width: 150px;
  height: 170px;
  left: 5%;
  top: 10%;
  transform: rotate(-8deg);
  font-size: 4rem;
}

.note-b {
  width: 138px;
  height: 156px;
  right: 8%;
  top: 12%;
  transform: rotate(7deg);
  font-size: 3.6rem;
}

.note-majority {
  width: 126px;
  height: 86px;
  left: 13%;
  bottom: 14%;
  transform: rotate(5deg);
  color: var(--accent);
  font-size: 1.4rem;
}

.note-streak {
  width: 148px;
  height: 78px;
  right: 12%;
  bottom: 16%;
  transform: rotate(-5deg);
  color: var(--danger);
  font-size: .9rem;
}

.landing-title {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: "Patrick Hand", "Comic Sans MS", cursive;
  font-size: clamp(4rem, 13vw, 7.4rem);
  font-weight: 400;
  line-height: .78;
}

.landing-title span {
  display: block;
}

.landing-copy {
  position: relative;
  z-index: 1;
  max-width: 430px;
  margin: 24px 0 28px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
}

.start-button,
.landing-best {
  position: relative;
  z-index: 1;
}

.challenge-panel {
  position: relative;
  z-index: 2;
  width: min(340px, 100%);
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: -6px 0 18px;
}

.turnstile-widget {
  width: min(300px, 100%);
  min-height: 65px;
  display: grid;
  place-items: center;
}

.challenge-message {
  min-height: 20px;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 750;
  line-height: 1.35;
}

.landing-best {
  margin-top: 16px;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 750;
}

.eyebrow {
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 22px;
}

.eyebrow.danger { color: var(--danger); }

.question {
  max-width: 630px;
  margin: 0;
  font-family: "Patrick Hand", "Comic Sans MS", cursive;
  font-size: clamp(2rem, 4.6vw, 3.3rem);
  line-height: 1.05;
  font-weight: 400;
}

.hint {
  max-width: 540px;
  margin: 18px 0 34px;
  color: var(--muted);
  font-size: .94rem;
  line-height: 1.6;
}

.choices {
  width: min(680px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: 14px;
}

.choice {
  --pct: 0%;
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 210px;
  display: grid;
  grid-template-columns: 42px 1fr;
  grid-template-rows: auto 1fr auto;
  align-items: start;
  gap: 14px 12px;
  padding: 22px;
  border: 1px solid rgba(83, 73, 62, .32);
  background:
    linear-gradient(135deg, rgba(255,255,255,.84), rgba(255,250,242,.68)),
    var(--paper);
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  box-shadow:
    0 16px 32px rgba(54, 45, 33, .12),
    inset 0 0 0 1px rgba(255,255,255,.58);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  overflow: hidden;
}

#choiceA { transform: rotate(-.7deg); }
#choiceB { transform: rotate(.7deg); }

.choice::after {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  width: 78px;
  height: 20px;
  background: rgba(213, 199, 174, .68);
  border: 1px solid rgba(132, 117, 91, .12);
  transform: translateX(-50%) rotate(-3deg);
  z-index: 4;
  pointer-events: none;
}

#choiceB::after { transform: translateX(-50%) rotate(3deg); }

.choice:hover:not(:disabled) {
  transform: translateY(-4px) rotate(0deg);
  border-color: var(--accent);
  box-shadow:
    0 22px 40px rgba(47, 93, 98, .16),
    inset 0 0 0 1px rgba(255,255,255,.7);
}

#choiceA:hover:not(:disabled),
#choiceB:hover:not(:disabled) {
  transform: translateY(-4px) rotate(0deg);
}

.choice:focus-visible {
  outline: 3px solid rgba(47,93,98,.25);
  outline-offset: 3px;
}

.choice:disabled { cursor: default; }

.choice-label {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: .78rem;
  font-weight: 800;
  z-index: 3;
}

.choice-text {
  grid-column: 1 / -1;
  align-self: center;
  font-family: "Patrick Hand", "Comic Sans MS", cursive;
  font-size: clamp(1.45rem, 2.3vw, 1.9rem);
  font-weight: 400;
  line-height: 1.08;
  text-wrap: balance;
  z-index: 3;
}

.choice-pct {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  justify-self: end;
  min-width: 52px;
  text-align: right;
  font-weight: 800;
  opacity: 0;
  z-index: 3;
}

.choice.revealed .choice-pct { opacity: 1; }

.choice-bar {
  position: absolute;
  z-index: 2;
  inset: auto auto 0 0;
  height: 10px;
  width: var(--pct);
  background: var(--accent-soft);
  transform-origin: left;
  transition: width .55s cubic-bezier(.2,.75,.25,1);
}

.choice.wrong .choice-bar { background: var(--danger-soft); }
.choice.correct {
  border-color: var(--accent);
  box-shadow:
    0 18px 38px rgba(47, 93, 98, .17),
    inset 0 0 0 2px rgba(47, 93, 98, .12);
}
.choice.wrong {
  border-color: var(--danger);
  box-shadow:
    0 18px 38px rgba(142, 61, 53, .13),
    inset 0 0 0 2px rgba(142, 61, 53, .10);
}

.or {
  align-self: center;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(155, 148, 138, .35);
  border-radius: 50%;
  background: rgba(255, 250, 242, .88);
  color: #9b948a;
  box-shadow: 0 10px 20px rgba(54, 45, 33, .08);
  font-size: .56rem;
  font-weight: 800;
  letter-spacing: .08em;
}

.feedback {
  min-height: 30px;
  margin: 28px 0 18px;
  font-family: "Patrick Hand", cursive;
  font-size: 1.6rem;
}

.feedback.success { color: var(--accent); }
.feedback.fail { color: var(--danger); }

.primary {
  border: 0;
  background: var(--ink);
  color: white;
  padding: 14px 20px;
  min-width: 220px;
  cursor: pointer;
  font-weight: 750;
  letter-spacing: .01em;
  transition: transform .15s ease, opacity .15s ease;
}

.primary:hover { transform: translateY(-1px); }

.primary:disabled {
  cursor: not-allowed;
  opacity: .48;
  transform: none;
}

.game-over-title {
  margin: 0;
  font-family: "Patrick Hand", cursive;
  font-size: clamp(3.2rem, 8vw, 5.4rem);
  font-weight: 400;
}

.game-over-copy {
  color: var(--muted);
  margin: 8px 0 30px;
}

.score-block {
  width: min(380px, 100%);
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  padding: 24px;
  margin-bottom: 26px;
}

.score-label {
  color: var(--muted);
  font-size: .78rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 800;
}

.score {
  font-family: "Patrick Hand", cursive;
  font-size: 5rem;
  line-height: 1;
  margin: 8px 0;
}

.best-score { color: var(--muted); font-size: .9rem; }

.last-result {
  width: min(540px, 100%);
  padding: 18px 20px;
  margin-bottom: 24px;
  background: rgba(142, 61, 53, .07);
  border: 1px solid rgba(142, 61, 53, .20);
  color: #5c2f2a;
  line-height: 1.55;
}

.round-summary {
  width: min(620px, 100%);
  margin-bottom: 24px;
  text-align: left;
}

.round-summary-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.round-summary-title {
  margin: 0;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.round-summary-count {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: .8rem;
  font-weight: 800;
}

.round-summary-list {
  max-height: 230px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
}

.round-summary-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 10px 2px;
  border-top: 1px solid rgba(217, 208, 196, .72);
}

.round-summary-item:first-child { border-top: 0; }

.summary-index {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  line-height: 1.35;
}

.round-summary-item.is-correct .summary-index { color: var(--accent); }
.round-summary-item.is-wrong .summary-index { color: var(--danger); }

.summary-question {
  margin: 0;
  font-size: .9rem;
  font-weight: 750;
  line-height: 1.3;
}

.summary-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.35;
}

.round-summary-item.is-wrong .summary-meta { color: #7a3b34; }

.footer-note {
  padding: 20px 30px 26px;
  text-align: center;
  color: #a59d93;
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.hidden { display: none !important; }

@media (max-width: 620px) {
  .app-shell { padding: 0; }
  .game-card {
    min-height: 100vh;
    min-height: 100svh;
    border: 0;
  }
  .topbar {
    gap: 8px;
    padding: 14px 14px 10px;
  }
  .view { padding: 24px 14px 18px; }
  #gameView { padding-top: 28px; }
  .landing-view { min-height: 620px; }
  .landing-scene { inset: 18px 8px; }
  .note-a,
  .note-b {
    width: 96px;
    height: 116px;
    font-size: 2.6rem;
  }
  .note-a { left: 2%; top: 10%; }
  .note-b { right: 2%; top: 12%; }
  .note-majority {
    width: 104px;
    height: 70px;
    left: 6%;
    bottom: 10%;
    font-size: 1.05rem;
  }
  .note-streak {
    width: 116px;
    height: 64px;
    right: 5%;
    bottom: 9%;
    font-size: .72rem;
  }
  .brand {
    max-width: 92px;
    white-space: normal;
    line-height: 1.05;
    font-size: .72rem;
    letter-spacing: .06em;
  }
  .mode {
    font-size: .64rem;
    letter-spacing: .14em;
  }
  .streak-pill {
    gap: 6px;
    min-width: 84px;
    padding: 6px 9px;
    font-size: .92rem;
  }
  .flame {
    font-size: .56rem;
    letter-spacing: .06em;
  }
  .landing-title { font-size: 4.2rem; }
  .landing-copy { max-width: 300px; }
  .eyebrow {
    margin-bottom: 12px;
    font-size: .66rem;
    line-height: 1.35;
    letter-spacing: .13em;
  }
  .question {
    max-width: 360px;
    font-size: clamp(1.72rem, 8.3vw, 2.15rem);
    line-height: 1;
  }
  .hint {
    max-width: 340px;
    margin: 10px 0 18px;
    font-size: .8rem;
    line-height: 1.35;
  }
  .choices {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }
  .choice {
    min-height: 132px;
    padding: 14px 10px 12px;
    grid-template-columns: 30px 1fr;
    grid-template-rows: 30px 1fr auto;
    gap: 9px 8px;
    transform: rotate(0deg);
  }
  #choiceA,
  #choiceB { transform: rotate(0deg); }
  .choice:hover:not(:disabled) { transform: translateY(-2px); }
  #choiceA:hover:not(:disabled),
  #choiceB:hover:not(:disabled) { transform: translateY(-2px); }
  .choice::after {
    width: 62px;
    height: 16px;
  }
  .choice-label {
    width: 28px;
    height: 28px;
    font-size: .68rem;
  }
  .choice-text {
    font-size: clamp(1.05rem, 5.2vw, 1.3rem);
    line-height: 1.03;
  }
  .choice-pct {
    min-width: 42px;
    font-size: .86rem;
  }
  .choice-bar { height: 7px; }
  .or {
    display: none;
  }
  .feedback {
    min-height: 24px;
    margin: 16px 0 12px;
    font-size: 1.25rem;
  }
  .primary {
    min-width: min(210px, 100%);
    padding: 12px 16px;
    font-size: .92rem;
  }
  .footer-note {
    padding: 10px 16px 14px;
    font-size: .58rem;
    letter-spacing: .1em;
  }
}

@media (max-width: 620px) and (max-height: 760px) {
  .topbar { padding: 12px 12px 8px; }
  .view { padding: 18px 12px 14px; }
  #gameView { padding-top: 20px; }
  .eyebrow {
    margin-bottom: 10px;
    font-size: .6rem;
  }
  .question {
    font-size: clamp(1.55rem, 7.3vw, 1.92rem);
  }
  .hint {
    margin: 8px 0 14px;
    font-size: .74rem;
  }
  .choice {
    min-height: 112px;
    padding: 12px 9px 10px;
  }
  .choice-text {
    font-size: clamp(.98rem, 4.7vw, 1.18rem);
  }
  .feedback {
    margin: 12px 0 10px;
    font-size: 1.15rem;
  }
  .footer-note { padding: 8px 14px 10px; }
}
