/* Daily quiz and family game. Built on the tokens in app.css (loaded first).

   Design notes
   - Answer tiles carry a colour AND a shape (circle, square, triangle, diamond, pentagon),
     so colour is never the only cue. Tile colours are brand colours; success and danger
     appear only at the reveal, as rings and badges.
   - Motion is feedback only: answer lock-in, reveal, points, leaderboard movement and the
     streak or podium moment. All of it is transform/opacity and stops under reduced motion
     (global rule in app.css).
   - Shape system as app.css: controls 14px, cards 20px, chips 10px, pills round.
*/

:root {
  --tile-0: var(--brand-green); --tile-0-ink: #FFFFFF; --tile-0-lip: #041F07;
  --tile-1: var(--brand-blue); --tile-1-ink: #FFFFFF; --tile-1-lip: #173F9E;
  --tile-2: var(--brand-gold); --tile-2-ink: var(--brand-ink); --tile-2-lip: var(--brand-gold-deep);
  --tile-3: var(--brand-ink); --tile-3-ink: #FFFFFF; --tile-3-lip: #000C11;
  --tile-4: var(--brand-gold-deep); --tile-4-ink: var(--brand-ink); --tile-4-lip: #7A640F;

  --p-0: #0A3D11; --p-1: #2B63E8; --p-2: #E0BA22; --p-3: #011C26;
  --p-4: #BA9917; --p-5: #5F8BF2; --p-6: #2F7D3B; --p-7: #EDCD58;

  --gold-glow: rgba(224, 186, 34, 0.35);
}
@media (prefers-color-scheme: dark) {
  :root {
    --tile-0: #1F6B2A; --tile-0-lip: #0B3511;
    --tile-1: #3A70EC; --tile-1-lip: #1C47B8;
    --tile-3: #DCE6E4; --tile-3-ink: var(--brand-ink); --tile-3-lip: #9FB1B3;
    --p-0: #2F7D3B; --p-3: #A2B4B6;
    --gold-glow: rgba(224, 186, 34, 0.22);
  }
}

.icon.lg { width: 1.6em; height: 1.6em; }
.icon.xl { width: 2.4rem; height: 2.4rem; }

/* ---------- Hub ---------- */
.hub-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-5); }
.hub-head h1 { margin: 0; }
.hub-grid { display: grid; gap: var(--s-4); align-items: stretch; }
@media (min-width: 900px) { .hub-grid { grid-template-columns: 1.45fr 1fr; gap: var(--s-6); } }
.hub-grid .card { margin: 0; }

.daily-panel {
  position: relative; overflow: hidden; isolation: isolate;
  background:
    radial-gradient(90% 120% at 100% 0%, rgba(224, 186, 34, 0.22), transparent 60%),
    var(--brand-green);
  color: #fff; display: grid; gap: var(--s-4); align-content: start;
}
.daily-panel h2 { color: #fff; font-size: var(--fs-2xl); margin: 0; }
.daily-panel p { color: rgba(255, 255, 255, 0.84); margin: 0; }
.daily-panel .btn.gold { justify-self: start; min-width: 12rem; }
.streak-badge {
  display: inline-flex; align-items: center; gap: .5rem; align-self: start; justify-self: start;
  background: rgba(1, 28, 38, 0.32); color: var(--brand-gold); border-radius: var(--r-pill);
  padding: .35rem .9rem .35rem .7rem; font-size: var(--fs-sm); box-shadow: inset 0 0 0 1px rgba(224, 186, 34, 0.35);
}
.streak-badge strong { font-weight: 400; font-size: var(--fs-lg); font-variant-numeric: tabular-nums; color: #fff; }
.daily-panel .done-note { display: flex; align-items: center; gap: .6rem; color: #fff; font-size: var(--fs-lg); }
.daily-panel .done-note .icon { color: var(--brand-gold); }

.family-panel { display: grid; gap: var(--s-3); align-content: start; }
.family-panel h2 { margin: 0; display: flex; align-items: center; gap: .55rem; }
.family-panel h2 .icon { color: var(--highlight-ink); }
.family-panel .actions { display: grid; gap: var(--s-2); grid-template-columns: 1fr 1fr; margin-top: var(--s-2); }
.family-panel .actions .btn { white-space: nowrap; }
@media (max-width: 480px) { .family-panel .actions { grid-template-columns: 1fr; } }

.stat-band { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-4) var(--s-5); margin: var(--s-6) 0 var(--s-5); }
@media (min-width: 720px) { .stat-band { grid-template-columns: repeat(4, 1fr); } }
.stat-band div { display: grid; gap: .1rem; }
.stat-band strong { font-size: var(--fs-2xl); font-weight: 400; font-variant-numeric: tabular-nums; line-height: 1.2; }
.stat-band span { font-size: var(--fs-sm); color: var(--text-muted); }

.day-strip { list-style: none; display: grid; grid-template-columns: repeat(14, 1fr); gap: .35rem; padding: 0; margin: var(--s-2) 0 var(--s-1); max-width: 34rem; }
.day-strip li { aspect-ratio: 1; border-radius: 6px; box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.day-strip li.l1 { background: rgba(224, 186, 34, 0.35); box-shadow: none; }
.day-strip li.l2 { background: rgba(224, 186, 34, 0.65); box-shadow: none; }
.day-strip li.l3, .day-strip li.l4 { background: var(--brand-gold); box-shadow: none; }
.day-strip li.today { outline: 2px solid var(--info); outline-offset: 2px; }
.strip-legend { display: flex; justify-content: space-between; max-width: 34rem; font-size: var(--fs-xs); color: var(--text-subtle); }

.revise-list { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: var(--s-2) 0 0; padding: 0; list-style: none; }
.revise-list li { display: inline-flex; align-items: baseline; gap: .5rem; padding: .3rem .8rem; border-radius: var(--r-sm); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.revise-list .ar { font-size: 1.4rem; line-height: 1.7; }
.revise-list small { color: var(--text-muted); }

/* ---------- Shared game chrome ---------- */
/* .play-top is the shared focus-mode island in app.css. */
.play-top .grow { flex: 1; min-width: 0; }
.score-pill {
  display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; flex: none;
  background: var(--highlight-soft); color: var(--highlight-ink); border-radius: var(--r-pill);
  padding: 0 1rem; font-variant-numeric: tabular-nums; font-size: var(--fs-sm); min-height: 44px;
}
.score-pill strong { font-weight: 400; font-size: var(--fs-base); color: var(--text); }
.acts { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 6px; }
.acts span { height: 8px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; position: relative; }
.acts span i {
  position: absolute; inset: 0; transform-origin: left center; transform: scaleX(0);
  background: linear-gradient(180deg, #EDCB45, var(--brand-gold)); border-radius: inherit;
  transition: transform var(--dur-slow) var(--ease-out);
}
.q-meta { display: flex; justify-content: center; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: var(--s-2); font-size: var(--fs-sm); color: var(--text-muted); }
.q-meta .tag {
  display: inline-flex; align-items: center; gap: .35rem; border-radius: var(--r-pill); padding: .15rem .7rem;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); color: var(--text-muted);
}
.q-meta .tag.gold { background: var(--highlight-soft); color: var(--highlight-ink); box-shadow: none; }
.q-meta .tag.blue { background: var(--info-soft); color: var(--info-ink); box-shadow: none; }
.exercise.golden { box-shadow: 0 0 0 2px var(--brand-gold), 0 18px 48px -20px var(--gold-glow), var(--shadow-md); }

/* ---------- Answer tiles ---------- */
.tiles { display: grid; gap: var(--s-3); margin: var(--s-4) 0 var(--s-2); }
/* Amiri Quran's vowel marks reach below the line box: give the big word room above the tiles. */
.word-display + .tiles { margin-top: var(--s-6); }
.tiles.grid2 { grid-template-columns: 1fr 1fr; }
.tile {
  --c: var(--tile-0); --ink: var(--tile-0-ink); --lip: var(--tile-0-lip);
  position: relative; width: 100%; min-height: 64px; padding: .75rem 1rem .75rem 2.9rem;
  border: 0; border-radius: var(--r-option); font-weight: 600; cursor: pointer; font: inherit; font-size: var(--fs-base); line-height: 1.35;
  background: var(--c); color: var(--ink); text-align: left; box-shadow: 0 4px 0 var(--lip);
  transition: transform var(--dur-fast) var(--ease-press), box-shadow var(--dur-fast) var(--ease-press),
              opacity var(--dur) var(--ease-out), filter var(--dur) var(--ease-out);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.tile.ar { font-family: var(--arabic); font-size: 1.85rem; line-height: 1.6; text-align: center; padding: .35rem 1rem .35rem 2.9rem; }
.tile:hover:not([disabled]) { filter: brightness(1.06); }
.tile:active:not([disabled]) { transform: translateY(3px); box-shadow: 0 1px 0 var(--lip); }
.tile[disabled] { cursor: default; }
.tile.c1 { --c: var(--tile-1); --ink: var(--tile-1-ink); --lip: var(--tile-1-lip); }
.tile.c2 { --c: var(--tile-2); --ink: var(--tile-2-ink); --lip: var(--tile-2-lip); }
.tile.c3 { --c: var(--tile-3); --ink: var(--tile-3-ink); --lip: var(--tile-3-lip); }
.tile.c4 { --c: var(--tile-4); --ink: var(--tile-4-ink); --lip: var(--tile-4-lip); }
/* The shape marker */
.tile::before {
  content: ""; position: absolute; left: 1rem; top: 50%; width: 1.05rem; height: 1.05rem; margin-top: -.525rem;
  background: currentColor; opacity: .9; border-radius: 50%;
}
.tile.c1::before { border-radius: 3px; }
.tile.c2::before { border-radius: 0; clip-path: polygon(50% 4%, 100% 96%, 0 96%); }
.tile.c3::before { border-radius: 0; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.tile.c4::before { border-radius: 0; clip-path: polygon(50% 0, 100% 38%, 82% 100%, 18% 100%, 0 38%); }
.tile .badge {
  position: absolute; right: .6rem; top: 50%; transform: translateY(-50%); width: 2rem; height: 2rem; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); color: var(--success); box-shadow: var(--shadow-sm);
  animation: pop var(--dur-slow) var(--ease-out) both;
}
.tile .badge .icon { width: 1.1rem; height: 1.1rem; }
.tile.picked { transform: translateY(3px); box-shadow: 0 1px 0 var(--lip), 0 0 0 3px var(--surface), 0 0 0 6px var(--info); }
.tiles.locked .tile:not(.picked):not(.is-right) { opacity: .45; }
.tile.is-right { opacity: 1; box-shadow: 0 4px 0 var(--lip), 0 0 0 3px var(--surface), 0 0 0 6px var(--success); }
.tile.is-wrong { opacity: .75; box-shadow: 0 1px 0 var(--lip), 0 0 0 3px var(--surface), 0 0 0 6px var(--danger); }
.tile.is-wrong .badge { color: var(--danger); }
.tile.removed { visibility: hidden; }
@media (max-width: 380px) { .tiles.grid2 { grid-template-columns: 1fr; } }

/* ---------- Text with a blank / tappable words ---------- */
.text-display .blank {
  display: inline-block; min-width: 3.2em; height: 1.5em; vertical-align: middle; margin: 0 .1em;
  border-radius: 10px; box-shadow: inset 0 0 0 2px var(--hint-underline); background: var(--highlight-soft);
}
.text-display .blank.filled { box-shadow: none; background: var(--success-soft); color: var(--success-ink); min-width: 0; height: auto; padding: 0 .15em; }
.text-display .cut { color: var(--text-subtle); padding: 0 .1em; }
.prompt-meaning { color: var(--text-muted); font-size: var(--fs-lg); margin: -.25rem 0 var(--s-3); }

/* ---------- Matching ---------- */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); margin: var(--s-4) 0 var(--s-2); }
.match .col { display: grid; gap: var(--s-2); align-content: start; }
.mcard {
  position: relative; min-height: 56px; border-radius: var(--r-md); border: 0; cursor: pointer; font: inherit;
  background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line-strong), 0 3px 0 var(--line-strong);
  padding: .5rem .75rem; line-height: 1.3; transition: transform var(--dur-fast) var(--ease-press), background-color var(--dur) var(--ease-out);
}
.mcard.ar { font-family: var(--arabic); font-size: 1.6rem; line-height: 1.6; }
.mcard:active:not([disabled]) { transform: translateY(2px); }
.mcard.armed { box-shadow: inset 0 0 0 2.5px var(--info), 0 3px 0 var(--info); background: var(--info-soft); }
.mcard[data-pair] { color: var(--ink); background: var(--c); box-shadow: 0 3px 0 var(--lip); }
.mcard[data-pair="0"] { --c: var(--tile-0); --ink: var(--tile-0-ink); --lip: var(--tile-0-lip); }
.mcard[data-pair="1"] { --c: var(--tile-1); --ink: var(--tile-1-ink); --lip: var(--tile-1-lip); }
.mcard[data-pair="2"] { --c: var(--tile-2); --ink: var(--tile-2-ink); --lip: var(--tile-2-lip); }
.mcard[data-pair="3"] { --c: var(--tile-3); --ink: var(--tile-3-ink); --lip: var(--tile-3-lip); }
.mcard.ok { box-shadow: 0 0 0 3px var(--success); }
.mcard.bad { box-shadow: 0 0 0 3px var(--danger); opacity: .8; }
.pair-list { list-style: none; padding: 0; margin: var(--s-3) 0 0; display: grid; gap: .35rem; text-align: left; }
.pair-list li { display: flex; align-items: center; gap: .6rem; padding: .3rem .75rem; border-radius: var(--r-sm); background: var(--success-soft); color: var(--success-ink); }
.pair-list li.bad { background: var(--danger-soft); color: var(--danger-ink); }
.pair-list .ar { font-size: 1.35rem; line-height: 1.7; }

/* ---------- Word order ---------- */
.order-line {
  min-height: 72px; display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: .45rem;
  direction: rtl; padding: .6rem; margin: var(--s-3) 0; border-radius: var(--r-md);
  background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--line-strong);
}
.order-line:empty::after { content: attr(data-empty); direction: ltr; color: var(--text-subtle); font-size: var(--fs-sm); }
.order-bank { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; direction: rtl; margin-bottom: var(--s-4); min-height: 56px; }
.wtile {
  font-family: var(--arabic); font-size: 1.6rem; line-height: 1.6; padding: .1rem .85rem; border: 0; border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); cursor: pointer; box-shadow: inset 0 0 0 1.5px var(--line-strong), 0 3px 0 var(--line-strong);
  animation: pop var(--dur) var(--ease-out) both;
}
.order-line .wtile { background: var(--info-soft); box-shadow: inset 0 0 0 1.5px var(--info); }
.order-line.ok .wtile { background: var(--success-soft); box-shadow: inset 0 0 0 1.5px var(--success); color: var(--success-ink); }
.order-line.bad .wtile { background: var(--danger-soft); box-shadow: inset 0 0 0 1.5px var(--danger); color: var(--danger-ink); }
.order-answer { font-family: var(--arabic); font-size: 1.6rem; line-height: 1.8; color: var(--success-ink); direction: rtl; }

/* ---------- Clues ---------- */
.clues { list-style: none; padding: 0; margin: 0 0 var(--s-3); display: grid; gap: var(--s-2); text-align: left; }
.clues li { display: flex; gap: .75rem; align-items: center; padding: .6rem .9rem; border-radius: var(--r-md); background: var(--highlight-soft); color: var(--text); animation: rise var(--dur-slow) var(--ease-out) both; }
.clues li .n { flex: none; width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center; background: var(--brand-green); color: #fff; font-size: var(--fs-xs); font-weight: 600; }
.clues li .ar { font-size: 1.5rem; line-height: 1.7; }
.clues li .text-display { font-size: 1.45rem; line-height: 2; margin: 0; }
.clue-share { font-size: var(--fs-sm); color: var(--text-muted); margin: 0 0 var(--s-2); }

/* ---------- Feedback extras ---------- */
.points-pop {
  display: inline-flex; align-items: center; gap: .35rem; font-size: var(--fs-xl); color: var(--highlight-ink);
  font-variant-numeric: tabular-nums; animation: pop var(--dur-slow) var(--ease-out) both;
}
.points-pop.none { color: var(--text-muted); }
.combo { display: inline-flex; align-items: center; gap: .35rem; font-size: var(--fs-sm); color: var(--highlight-ink); margin-left: .6rem; }
.insight {
  text-align: left; background: var(--highlight-soft); border-radius: var(--r-md); margin: var(--s-4) 0 0;
  padding: var(--s-4) var(--s-5); box-shadow: inset 3px 0 0 var(--brand-gold); animation: rise var(--dur-slow) var(--ease-out) both;
}
.insight .label { display: flex; align-items: center; gap: .45rem; color: var(--highlight-ink); font-size: var(--fs-sm); margin-bottom: .25rem; }
.insight p { margin: .2rem 0; }
.insight .ar { font-size: 1.6rem; line-height: 1.7; }
.insight .family { font-size: var(--fs-sm); color: var(--text-muted); }
.insight .source { font-size: var(--fs-xs); color: var(--text-muted); }
.answer-line { margin: var(--s-3) 0 0; font-size: var(--fs-lg); }
.answer-line .ar { font-size: 1.7rem; line-height: 1.7; }
/* After a wrong pick in a clue round: what the chosen word means. */
.answer-line.contrast { font-size: var(--fs-base); color: var(--text-muted); }
.answer-line.contrast .ar { font-size: 1.4rem; color: var(--text); }

/* ---------- Results ---------- */
.results { text-align: center; }
.results .score-big { font-size: clamp(3rem, 14vw, 4.5rem); line-height: 1; font-variant-numeric: tabular-nums; color: var(--highlight-ink); margin: var(--s-2) 0 var(--s-1); }
.results .score-label { color: var(--text-muted); margin-bottom: var(--s-5); }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3); margin: 0 0 var(--s-5); }
.result-stats div { background: var(--surface-2); border-radius: var(--r-md); padding: var(--s-3) var(--s-2); box-shadow: inset 0 0 0 1px var(--line); }
.result-stats strong { display: block; font-size: var(--fs-xl); font-weight: 400; font-variant-numeric: tabular-nums; }
.result-stats span { font-size: var(--fs-xs); color: var(--text-muted); }
.streak-moment {
  display: flex; align-items: center; justify-content: center; gap: .75rem; margin: 0 auto var(--s-5); padding: var(--s-4) var(--s-5);
  border-radius: var(--r-lg); background: var(--brand-green); color: #fff; max-width: 26rem; position: relative; overflow: hidden;
}
.streak-moment .icon { width: 2.6rem; height: 2.6rem; color: var(--brand-gold); animation: pop var(--dur-slow) var(--ease-out) both; }
.streak-moment div { text-align: left; }
.streak-moment strong { display: block; font-size: var(--fs-2xl); font-weight: 400; line-height: 1.1; }
.streak-moment span { color: rgba(255, 255, 255, 0.8); font-size: var(--fs-sm); }
.word-groups { display: grid; gap: var(--s-4); text-align: left; margin-bottom: var(--s-4); }
@media (min-width: 560px) { .word-groups { grid-template-columns: 1fr 1fr; } }
.word-groups h3 { font-size: var(--fs-base); color: var(--text-muted); margin-bottom: var(--s-2); }

/* ---------- Join and create ---------- */
.join-card { max-width: 30rem; margin: 0 auto; }
.code-input {
  font-size: 2rem; letter-spacing: .45em; text-transform: uppercase; text-align: center; font-variant-numeric: tabular-nums;
  padding-left: calc(.9rem + .45em);
}
.band-choice { display: grid; gap: var(--s-2); margin: 0; padding: 0; border: 0; }
.band-choice legend { font-size: var(--fs-sm); margin-bottom: .375rem; padding: 0; }
.band-choice label {
  display: flex; align-items: center; gap: .75rem; margin: 0; padding: .7rem 1rem; border-radius: var(--r-md); cursor: pointer;
  box-shadow: inset 0 0 0 1.5px var(--line-strong); font-size: var(--fs-base);
}
.band-choice label:has(input:checked) { box-shadow: inset 0 0 0 2.5px var(--info); background: var(--info-soft); }
.band-choice input { width: 20px; height: 20px; accent-color: var(--brand-green); margin: 0; }
.length-choice { display: grid; gap: var(--s-3); margin: 0 0 var(--s-5); padding: 0; border: 0; }
@media (min-width: 560px) { .length-choice { grid-template-columns: repeat(3, 1fr); } }
.length-choice label {
  display: grid; gap: .15rem; margin: 0; padding: var(--s-4); border-radius: var(--r-lg); cursor: pointer;
  background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--line-strong);
}
.length-choice label:has(input:checked) { box-shadow: inset 0 0 0 2.5px var(--brand-gold); background: var(--highlight-soft); }
.length-choice input { position: absolute; opacity: 0; pointer-events: none; }
.length-choice strong { font-weight: 400; font-size: var(--fs-lg); }
.length-choice span { font-size: var(--fs-sm); color: var(--text-muted); }

/* ---------- Family game ---------- */
.game-root { min-height: 60dvh; }
.lobby-code {
  display: flex; justify-content: center; gap: .4rem; margin: var(--s-2) 0 var(--s-3); direction: ltr;
}
.lobby-code span {
  width: 3.2rem; height: 4rem; border-radius: var(--r-md); display: grid; place-items: center; font-size: 2.2rem;
  background: var(--brand-green); color: var(--brand-gold); font-variant-numeric: tabular-nums;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25); animation: pop var(--dur-slow) var(--ease-out) both;
}
@media (prefers-color-scheme: dark) { .lobby-code span { background: #0E2933; box-shadow: inset 0 0 0 1.5px rgba(224, 186, 34, 0.4); } }
.join-at { display: flex; justify-content: center; align-items: center; gap: .5rem; flex-wrap: wrap; color: var(--text-muted); margin-bottom: var(--s-5); }
.join-at code { font-family: var(--ui); color: var(--text); font-size: var(--fs-lg); }

.players { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--s-2); justify-content: center; }
.players li {
  display: inline-flex; align-items: center; gap: .5rem; padding: .3rem .4rem .3rem .3rem; border-radius: var(--r-pill);
  background: var(--surface); box-shadow: var(--shadow-sm); animation: pop var(--dur) var(--ease-out) both; font-size: var(--fs-sm);
}
.players li.away { opacity: .55; }
.players li .state { color: var(--success); display: inline-flex; }
.players li .state.wait { color: var(--text-subtle); }
.players li button.kick { border: 0; background: none; color: var(--text-subtle); cursor: pointer; padding: .2rem; border-radius: 50%; display: inline-flex; }
.players li button.kick:hover { color: var(--danger); }
.disc {
  --pc: var(--p-0); --pi: #fff;
  width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--pc); color: var(--pi); font-size: .95rem; line-height: 1; text-transform: uppercase;
}
.disc.lg { width: 3rem; height: 3rem; font-size: 1.3rem; }
.disc.p1 { --pc: var(--p-1); }
.disc.p2 { --pc: var(--p-2); --pi: var(--brand-ink); }
.disc.p3 { --pc: var(--p-3); }
.disc.p4 { --pc: var(--p-4); --pi: var(--brand-ink); }
.disc.p5 { --pc: var(--p-5); }
.disc.p6 { --pc: var(--p-6); }
.disc.p7 { --pc: var(--p-7); --pi: var(--brand-ink); }
@media (prefers-color-scheme: dark) { .disc.p3 { --pi: var(--brand-ink); } }

.phase-card { text-align: center; }
.phase-card.enter { animation: rise var(--dur-slow) var(--ease-out) both; }
.round-label { font-size: var(--fs-sm); color: var(--text-muted); margin: 0 0 var(--s-2); font-variant-numeric: tabular-nums; }
.round-icon {
  width: 5rem; height: 5rem; margin: var(--s-2) auto var(--s-4); border-radius: 26px; display: grid; place-items: center;
  background: var(--highlight-soft); color: var(--highlight-ink); animation: pop var(--dur-slow) var(--ease-out) both;
}
.round-icon .icon { width: 2.6rem; height: 2.6rem; }
.round-icon.final { background: var(--brand-gold); color: var(--brand-ink); }
.phase-card h2 { font-size: var(--fs-3xl); margin-bottom: var(--s-2); }
.event-banner {
  display: grid; grid-template-columns: auto 1fr; gap: .25rem 1rem; align-items: center; text-align: left;
  margin: var(--s-5) 0 0; padding: var(--s-4) var(--s-5); border-radius: var(--r-lg);
  background: var(--brand-green); color: #fff; animation: rise var(--dur-slow) var(--ease-out) .25s both;
}
.event-banner .icon { grid-row: span 2; width: 2.4rem; height: 2.4rem; color: var(--brand-gold); }
.event-banner strong { font-weight: 400; font-size: var(--fs-xl); }
.event-banner span { color: rgba(255, 255, 255, 0.82); font-size: var(--fs-sm); }
.event-golden_word .event-banner { background: var(--brand-gold); color: var(--brand-ink); }
.event-golden_word .event-banner .icon { color: var(--brand-ink); }
.event-golden_word .event-banner span { color: rgba(1, 28, 38, 0.75); }
.discovery-word { margin: var(--s-5) 0 0; padding: var(--s-5); border-radius: var(--r-lg); background: var(--highlight-soft); }
.discovery-word .word-display { margin: 0; }
.discovery-word p { font-size: var(--fs-xl); margin: 0; }

.choices { display: grid; gap: var(--s-3); margin: var(--s-4) 0 0; }
@media (min-width: 640px) { .choices { grid-template-columns: repeat(3, 1fr); } }
.choice {
  display: grid; justify-items: center; gap: .35rem; padding: var(--s-5) var(--s-4); border: 0; border-radius: var(--r-lg); cursor: pointer;
  font: inherit; background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line-strong), 0 4px 0 var(--line-strong);
  transition: transform var(--dur-fast) var(--ease-press), box-shadow var(--dur-fast) var(--ease-press), opacity var(--dur) var(--ease-out);
}
.choice .icon { width: 2.2rem; height: 2.2rem; color: var(--success-ink); }
.choice[data-choice="brave"] .icon { color: var(--highlight-ink); }
.choice strong { font-weight: 400; font-size: var(--fs-xl); }
.choice span { font-size: var(--fs-sm); color: var(--text-muted); }
.choice .mult { font-size: var(--fs-lg); color: var(--highlight-ink); font-variant-numeric: tabular-nums; }
.choice:active:not([disabled]) { transform: translateY(3px); }
.choice.picked { box-shadow: inset 0 0 0 3px var(--info), 0 1px 0 var(--info); transform: translateY(3px); background: var(--info-soft); }
.choices.locked .choice:not(.picked) { opacity: .45; }

.timer { height: 10px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; }
.timer i { display: block; height: 100%; border-radius: inherit; background: var(--success); transform-origin: left center; transition-property: transform; transition-timing-function: linear; }
.timer.low i { background: var(--brand-gold); }
.secs { font-variant-numeric: tabular-nums; font-size: var(--fs-sm); color: var(--text-muted); min-width: 2.2rem; text-align: right; }

.waiting { text-align: center; padding: var(--s-6) 0; }
.waiting .round-icon { background: var(--info-soft); color: var(--info); }
.waiting h2 { margin: var(--s-3) 0 var(--s-2); }

.verdict { text-align: center; margin-bottom: var(--s-3); }
.verdict h2 { font-size: var(--fs-3xl); margin: 0 0 var(--s-1); display: inline-flex; align-items: center; gap: .6rem; }
.verdict.good h2 { color: var(--success-ink); }
.verdict.bad h2 { color: var(--text); }
.verdict .tags { display: flex; justify-content: center; gap: .4rem; flex-wrap: wrap; margin-top: var(--s-2); }
.coop-card { display: flex; align-items: center; gap: var(--s-3); text-align: left; margin-top: var(--s-4); padding: var(--s-4) var(--s-5); border-radius: var(--r-lg); background: var(--info-soft); color: var(--info-ink); }
.coop-card.won { background: var(--success-soft); color: var(--success-ink); }
.coop-card .icon { width: 2rem; height: 2rem; }

.board { list-style: none; padding: 0; margin: var(--s-3) 0 0; display: grid; gap: var(--s-2); position: relative; }
.board li {
  display: grid; grid-template-columns: 2rem auto 1fr auto; align-items: center; gap: var(--s-3);
  padding: .55rem .9rem; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-sm);
  transition: transform 520ms var(--ease-out);
}
.board li.me { box-shadow: inset 0 0 0 2px var(--info), var(--shadow-sm); }
.board .rank { font-variant-numeric: tabular-nums; color: var(--text-muted); text-align: center; }
.board .who { min-width: 0; display: flex; align-items: center; gap: .5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .move { display: inline-flex; color: var(--success); }
.board .pts { text-align: right; font-variant-numeric: tabular-nums; }
.board .pts strong { display: block; font-weight: 400; font-size: var(--fs-lg); }
.board .pts small { color: var(--highlight-ink); }
.family-meter { margin-top: var(--s-5); text-align: left; }
.family-meter .row { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); font-size: var(--fs-sm); }
.family-meter .row strong { font-weight: 400; display: inline-flex; align-items: center; gap: .4rem; }
.family-meter progress { height: 14px; }

.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: var(--s-2); margin: var(--s-5) 0 var(--s-4); }
.podium .step { display: grid; justify-items: center; gap: .35rem; }
.podium .block {
  width: 100%; border-radius: var(--r-md) var(--r-md) 6px 6px; display: grid; place-items: start center; padding-top: .5rem;
  font-variant-numeric: tabular-nums; color: var(--brand-ink); transform-origin: bottom center; animation: grow 700ms var(--ease-out) both;
}
.podium .s1 .block { height: 8.5rem; background: var(--brand-gold); animation-delay: .5s; }
.podium .s2 .block { height: 6rem; background: #DCE5DE; animation-delay: .25s; }
.podium .s3 .block { height: 4.5rem; background: #E8DFC2; }
@media (prefers-color-scheme: dark) { .podium .s2 .block { background: #A9BDB0; } .podium .s3 .block { background: #C9B98A; } }
.podium .name { font-size: var(--fs-sm); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .s1 .icon { color: var(--highlight-ink); width: 1.8rem; height: 1.8rem; }
.highlight-card {
  display: grid; grid-template-columns: auto 1fr; gap: .2rem 1rem; align-items: center; text-align: left;
  padding: var(--s-4) var(--s-5); border-radius: var(--r-lg); background: var(--brand-green); color: #fff; margin: var(--s-4) 0;
}
.highlight-card .icon { grid-row: span 2; width: 2.6rem; height: 2.6rem; color: var(--brand-gold); }
.highlight-card strong { font-weight: 400; font-size: var(--fs-xl); }
.highlight-card span { color: rgba(255, 255, 255, 0.82); }
.highlights { list-style: none; padding: 0; margin: var(--s-3) 0 0; display: grid; gap: var(--s-2); text-align: left; }
.highlights li { display: flex; align-items: center; gap: .75rem; padding: .5rem .8rem; border-radius: var(--r-md); background: var(--surface-2); }
.highlights li .icon { color: var(--highlight-ink); }
.highlights li div span { color: var(--text-muted); font-size: var(--fs-sm); }
.highlights li strong { font-weight: 400; }

.host-bar { display: flex; justify-content: flex-end; gap: var(--s-2); margin-top: var(--s-4); }
.net-toast {
  position: fixed; top: max(.75rem, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: var(--z-sheet);
  display: inline-flex; align-items: center; gap: .5rem; padding: .5rem 1rem; border-radius: var(--r-pill);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); font-size: var(--fs-sm);
}
.net-toast .icon { color: var(--danger); }

@keyframes pop { 0% { opacity: 0; transform: scale(.6); } 60% { opacity: 1; transform: scale(1.06); } 100% { opacity: 1; transform: scale(1); } }
@keyframes grow { from { transform: scaleY(.1); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.nudge { animation: nudge 320ms var(--ease-out) 1; }

/* "Extra time" option on the new-game form (helper text aligned with the label, room before the button). */
.extra-time { margin: var(--s-4, 1rem) 0 var(--s-1, .25rem); }
.extra-time + .form-help { margin: 0 0 var(--s-5, 1.25rem) calc(24px + .6rem); }
