/* ============================================================================
   Saving Strat · GAME DAY · the wizards (2026-11)
   Loaded by templates/layout.php after app.css (only when this file exists).
   Covers: templates/chat.php, advanced.php, advanced_done.php, partials/late_card.php.
   Plain selectors on purpose: app.css's Game Day layer is ":where(.gd) .x" (zero
   specificity), so order alone lets these win. Where an OLD rule is more specific
   the selector here matches it (noted inline).
   Phone first: 360-430px is the main canvas. Calm inside the product: question
   text and labels stay in Barlow sentence case; display type only on numerals,
   the stage name and buttons.
   ========================================================================== */

/* ------------------------------------------------------------ 1. page frame */
.chat{ gap:clamp(1rem,3vw,2rem) }
.chat__main{ min-width:0 }

/* ------------------------------------------------ 2. scoreboard progress header */
.stepper{ position:relative; margin-bottom:.9rem; padding:.7rem .85rem .8rem; background:var(--black); border:1px solid var(--line) }
.stepper__top{ display:flex; align-items:center; justify-content:space-between; flex-wrap:nowrap; gap:.5rem .9rem; margin-bottom:.75rem }
.stepper__title{ display:flex; align-items:center; gap:.8rem; min-width:0; font-size:1rem }
.stepper__no{ flex:none; display:inline-flex; align-items:baseline; gap:.12rem; padding:.28rem .7rem .3rem .6rem; margin-left:.2rem;
  background:var(--volt); color:var(--on-volt); transform:skewX(var(--skew)) }
.stepper__no b,.stepper__no i{ display:inline-block; transform:skewX(10deg) }
.stepper__no b{ font-family:var(--disp); font-style:italic; font-weight:900; font-size:1.75rem; line-height:.9; letter-spacing:0; color:var(--on-volt); font-variant-numeric:tabular-nums }
.stepper__no i{ font-family:var(--mono); font-style:normal; font-weight:700; font-size:.62rem; letter-spacing:.02em }
.stepper__txt{ display:flex; flex-direction:column; gap:.18rem; min-width:0 }
.stepper__k{ font-family:var(--mono); font-size:.6rem; font-weight:600; letter-spacing:.11em; text-transform:uppercase; color:var(--mute); white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.stepper__name{ font-family:var(--disp); font-style:italic; font-weight:800; font-size:1.3rem; line-height:1; letter-spacing:.01em; text-transform:uppercase; color:var(--chalk);
  overflow-wrap:anywhere; padding-right:.15em }
.stepper__count{ flex:none; display:flex; flex-direction:column; align-items:flex-end; gap:.2rem; text-align:right; font-size:.62rem; line-height:1.2; white-space:nowrap }
.stepper__count b{ color:var(--chalk); font-weight:700 }
.stepper__eta{ color:var(--volt) }

/* stages as scoreboard segments: done = volt, current = outlined volt, to come = steel */
.stepper__route{ display:grid; grid-auto-flow:column; grid-auto-columns:1fr; gap:5px; height:8px; padding:0 3px }
.stepper__route::before,.stepper__route::after{ content:none }
.stepper__wp{ width:auto; height:8px; border:0; background:#262D35; box-shadow:none }
.stepper__wp .ico{ display:none }
.stepper__wp--done{ background:var(--volt) }
.stepper__wp--cur{ background:linear-gradient(90deg,var(--volt) 0 38%,rgba(200,255,26,.28) 38% 100%); box-shadow:none }
.stepper__wp--cur::after{ content:none }

/* ------------------------------------------------------------ 3. coach line */
.coach{ margin-bottom:.9rem; padding:.85rem 1rem; gap:.85rem; align-items:center }
.coach p{ font-size:.95rem; line-height:1.5 }

/* ------------------------------------------------------------ 4. question card */
.qcard{ padding:clamp(1.3rem,3vw,2rem) }
.qcard__top{ margin-bottom:1rem }
.backlink{ gap:.45rem; min-height:44px; padding:.3rem .85rem .3rem .65rem; border:1px solid var(--line); font-family:var(--mono); font-size:.68rem; font-weight:600;
  letter-spacing:.09em; text-transform:uppercase; color:var(--chalk-2) }
.backlink:hover{ border-color:var(--volt) }
.skipahead{ display:inline-flex; align-items:center; min-height:44px; font-size:.9rem; text-align:right }
/* the stage name already sits in the header above; the eyebrow only shows the "editing" marker */
.qcard__stage{ font-size:0; letter-spacing:0; margin-bottom:.7rem }
.qcard__stage:not(:has(.qcard__editing)){ display:none }
.qcard__editing{ display:inline-flex; align-items:center; gap:.45rem; font-family:var(--mono); font-size:.66rem; font-weight:600; letter-spacing:.11em; text-transform:uppercase }
.qcard__editing::before{ content:""; width:.5rem; height:.5rem; background:var(--amber); transform:skewX(var(--skew)) }
.qlabel{ margin-bottom:.45rem; text-wrap:balance }
.qlabel:focus{ outline:none }
.qhelp{ margin:0 0 .2rem; max-width:36rem }
.qform{ margin-top:1.3rem }
.securenote,.prefillnote{ font-size:.9rem; line-height:1.45; align-items:flex-start }
.qerror{ display:flex; gap:.55rem; align-items:flex-start; margin:.9rem 0 0; padding:.75rem .9rem; border-left-width:4px; line-height:1.45 }
.why{ margin-top:1.4rem; padding-top:.5rem }
.why summary{ width:100% }

/* ------------------------------------------------------------ 5. inputs */
.field{ margin-bottom:0 }
.field--money{ max-width:22rem }
.field--inline .input--num{ max-width:11rem }
.input--date{ max-width:16rem; min-width:12rem }
.input--area{ min-height:8.5rem; line-height:1.5 }
.suffix{ font-size:.9rem }

/* ------------------------------------------- 6. option tiles (tap = answer + go) */
.choices{ gap:.6rem }
.choice{ position:relative; min-height:62px; padding:.8rem 2.7rem .8rem 1rem; -webkit-tap-highlight-color:transparent; touch-action:manipulation }
.choice::after{ content:""; position:absolute; right:1.15rem; top:50%; width:.55rem; height:.55rem; margin-top:-.3rem;
  border-top:2px solid #56616D; border-right:2px solid #56616D; transform:rotate(45deg); transition:transform .15s ease, border-color .15s ease }
.choice:hover::after,.choice:focus-visible::after{ border-color:var(--volt); transform:translateX(3px) rotate(45deg) }
.choice:focus-visible{ outline:3px solid var(--volt); outline-offset:3px }
.choice__label{ line-height:1.3 }
.choice__icon{ width:2.5rem; height:2.5rem }
/* saved / suggested answer: the tick or tag replaces the chevron */
.choice.is-on,.choice.is-suggested{ padding-right:1rem }
.choice.is-on::after,.choice.is-suggested::after{ content:none }
.choice.is-on .choice__icon,.choice.is-suggested .choice__icon{ background:var(--volt); color:var(--on-volt); border-color:var(--volt) }
.choice__cur{ color:var(--volt) }
.choice__sug{ margin-left:auto; flex:none; padding:.25rem .45rem; font-weight:700 }
/* the 200ms "called" confirmation before the answer posts */
.choice.is-picked{ background:var(--volt); border-color:var(--volt); color:var(--on-volt); box-shadow:none }
.choice.is-picked .choice__label{ font-weight:600 }
.choice.is-picked .choice__icon{ background:var(--on-volt); color:var(--volt); border-color:var(--on-volt) }
.choice.is-picked::after{ border-color:var(--on-volt) }
.choice.is-picked .choice__cur{ color:var(--on-volt) }
.choice.is-picked .choice__sug{ background:var(--on-volt); color:var(--volt) }
/* yes / no: two big side-by-side tiles at every width (old rule stacked them under 480px) */
.choices--bool{ grid-template-columns:1fr 1fr; max-width:26rem }
.choices--bool .choice{ min-height:68px; padding:.8rem 1rem; justify-content:center; font-size:1.1rem }
.choices--bool .choice::after{ content:none }

/* ------------------------------------------------ 7. multi-select (pick several) */
.chip{ position:relative; min-height:50px; padding:.6rem 1rem .6rem .85rem; gap:.65rem; -webkit-tap-highlight-color:transparent; touch-action:manipulation; line-height:1.3 }
.chip::before{ content:""; flex:none; width:1.2rem; height:1.2rem; border:1.5px solid #56616D; border-radius:2px; background:var(--pitch) center/82% no-repeat }
.chip:has(input:checked){ background:#232B1B; border-color:var(--volt); color:var(--chalk); font-weight:500 }
.chip:has(input:checked)::before{ border-color:var(--volt); background-color:var(--volt);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2306080A' stroke-width='3.4' stroke-linecap='square'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") }
.chip:has(input:checked) .chip__icon{ color:var(--volt) }

/* ------------------------------------------------------------ 8. consent (plain) */
.consent{ gap:.85rem; padding:1rem 1.05rem; margin-bottom:0; align-items:flex-start }
.consent input{ width:1.5rem; height:1.5rem; margin-top:.1rem }
.consent span{ font-size:.95rem; line-height:1.55; color:var(--chalk) }
.consent:has(input:checked){ border-color:rgba(200,255,26,.5) }
.consent:has(input:focus-visible){ outline:3px solid var(--volt); outline-offset:3px }

/* ------------------------------------------------------------ 9. action bar */
.qbar{ display:flex; align-items:center; gap:.75rem; margin-top:1.4rem }
.qbar__back{ display:none }
.qbar__go{ min-width:11.5rem }
.qform__actions{ margin-top:.9rem }
.qform__add{ font-size:1.05rem }

/* --------------------------------------------------------- 10. debts grid */
.debts{ margin-bottom:0 }
.debts__cell{ display:block; min-width:0 }
.debts__lab{ display:none }
.debts__row{ align-items:center }
.debts__row input,.debts__row select{ width:100%; min-width:0 }
.debts__row .debts__type{ font-size:.9rem; min-height:44px }
.debts__row .debts__name{ gap:.4rem }

/* ------------------------------------------- 11. repeatable rows (advanced) */
.grp{ gap:.8rem; counter-reset:grprow }
.grp__row{ counter-increment:grprow; padding:.75rem .85rem .95rem; gap:.7rem .65rem; background:var(--steel2); border:1px solid var(--line) }
.grp__row::before{ content:"Entry " counter(grprow); grid-column:1 / -1; display:flex; align-items:center; min-height:2rem;
  font-family:var(--mono); font-size:.62rem; font-weight:600; letter-spacing:.11em; text-transform:uppercase; color:var(--volt) }
.grp__lab{ font-size:.62rem; color:var(--mute); line-height:1.3 }
.grp__in{ min-height:48px; padding:.55rem .7rem; color:var(--chalk) }
select.grp__in{ text-overflow:ellipsis }
.grp__del{ top:.3rem; right:.3rem; width:44px; height:44px; border:0; background:transparent; color:var(--mute); font-size:1.5rem }
.grp__del:hover{ color:var(--red); background:rgba(255,107,94,.1) }
.grp__hint{ margin:.8rem 0 0; font-size:.9rem; color:var(--mute) }

/* ------------------------------------------------------------ 12. uploads */
.upload{ gap:.85rem }
.upload__zone{ padding:1.5rem 1rem; border-width:2px; border-color:#56616D }
.upload__zone:has(input:focus-visible){ outline:3px solid var(--volt); outline-offset:3px }
.upload__inner{ gap:.3rem; font-size:.95rem }
.upload__inner .ico{ width:1.7rem; height:1.7rem; color:var(--volt); margin-bottom:.35rem }
.upload__inner b{ display:inline-flex; align-items:center; min-height:44px; padding:.4rem 1.1rem; margin-bottom:.2rem; border:2px solid rgba(243,245,239,.4);
  font-family:var(--disp); font-style:italic; font-weight:800; font-size:1.15rem; letter-spacing:.02em; text-transform:uppercase; color:var(--chalk) }
.upload__zone:hover .upload__inner b{ border-color:var(--volt); color:var(--volt) }
.upload.has-files .upload__zone .upload__inner b{ color:var(--volt); border-color:var(--volt) }
.upload__inner small{ font-size:.86rem; line-height:1.4; color:var(--mute) }
.upload__selected li,.upload__list li{ min-height:44px; font-size:.92rem; background:var(--steel2); border:1px solid var(--line); color:var(--chalk) }
.upload__have{ font-family:var(--mono); font-size:.62rem; letter-spacing:.1em }
.upload__safe{ font-size:.9rem; line-height:1.45; align-items:flex-start }
.upload__safe .ico{ margin-top:.2rem }
.upload__later{ min-height:48px; padding:.6rem .85rem; gap:.75rem; align-items:center; font-size:.95rem; line-height:1.4; color:var(--chalk-2); background:var(--pitch); border:1px solid var(--line); border-radius:var(--r) }
.upload__later input{ flex:none }
.upload__later:has(input:checked){ border-color:rgba(200,255,26,.5); color:var(--chalk) }

/* ------------------------------------------------------------ 13. review step */
.reviewbar{ margin-bottom:.9rem; padding:.85rem 1rem }
.reviewbar__txt{ font-size:.95rem }
.review{ padding:1rem 1.1rem 1.1rem; margin:1.1rem 0 0; background:var(--pitch); border:1px solid var(--line); max-height:26rem; overscroll-behavior:contain }
.review__head{ font-size:1rem; font-weight:600; color:var(--chalk); margin-bottom:.2rem }
.review__head .ico{ color:var(--volt) }
.review__sec{ align-items:center; min-height:44px; margin-top:.8rem; padding-top:.5rem; border-top:1px solid var(--line); font-size:.64rem }
.review__sec a{ display:inline-flex; align-items:center; min-height:44px; padding:0 .2rem 0 .9rem; font-family:var(--sans); font-size:.9rem; font-weight:600; color:var(--volt); text-decoration:underline; text-underline-offset:3px }
.review__group{ font-size:.95rem; margin-top:.6rem; color:var(--chalk) }
.review__item{ font-size:.9rem; line-height:1.45; padding:.1rem 0 .1rem .8rem; border-left:2px solid var(--line); color:var(--chalk-2) }
.review__kv{ font-size:.92rem; line-height:1.4; padding:.4rem 0; border-bottom:1px solid rgba(43,50,59,.6) }
.review__kv span{ color:var(--mute) }
.review__kv span{ flex:1 1 auto; min-width:0 }
.review__kv b{ flex:0 1 auto; max-width:55%; font-weight:500; overflow-wrap:break-word }

/* ------------------------------------------------------- 14. under the card */
.chat__nav{ gap:.4rem 1rem; flex-wrap:wrap; margin-top:.9rem; font-size:.9rem }
.chat__nav .muted-link{ display:inline-flex; align-items:center; min-height:44px }
.finishlater button{ min-height:44px; gap:.5rem; text-align:left; color:var(--chalk-2); text-decoration:underline; text-underline-offset:3px; text-decoration-color:var(--line) }
.finishlater button:hover{ color:var(--volt) }
.finishlater .ico{ flex:none; color:var(--volt) }
.stepcount{ font-size:.64rem }

/* --------------------------------------------- 15. side panels (score / depth) */
.scorepanel__band{ font-size:.92rem }
.scorepanel__proj{ font-size:.9rem }
.depthpanel__sub{ font-size:.9rem }
.chapter__lab{ font-size:.92rem }

/* ----------------------------------------------------- 16. advanced: done */
.advdone{ margin:1rem auto 1.5rem }
.advdone__card{ text-align:left; padding:clamp(1.4rem,4vw,2.4rem) }
.advdone__badge{ margin:0 0 1.1rem .3rem; width:3.4rem; height:3.4rem }
.advdone__card h1{ font-size:clamp(2.1rem,8.5vw,3.2rem); margin:.3rem 0 .6rem; overflow-wrap:anywhere }
.advdone__card .lede{ color:var(--chalk-2); max-width:34rem }
.advdone__updated{ display:flex; gap:.5rem; align-items:flex-start; margin:1rem 0 0; padding:.7rem .85rem; background:var(--volt-06); border:1px solid var(--volt-20); font-size:.92rem; line-height:1.45; color:var(--chalk-2); text-align:left }
.advdone__updated .ico{ flex:none; width:1.05rem; height:1.05rem; margin-top:.2rem; color:var(--volt) }
.advdone__list{ gap:.5rem; margin:1.4rem 0 }
.advdone__list li{ align-items:flex-start; gap:.8rem; padding:.8rem .9rem; font-size:.95rem; line-height:1.45; background:var(--steel2); border:1px solid var(--line); overflow-wrap:anywhere }
.advdone__list .ico{ color:var(--volt); margin-top:.1rem }
.advdone__actions{ justify-content:flex-start; gap:.75rem .9rem; margin-top:1.5rem }
.advdone__fine{ font-size:.86rem; line-height:1.55; text-align:left; color:var(--mute) }

/* ------------------------------------- 17. late question card (on the report) */
.latecard{ padding:1.1rem 1.15rem 1.2rem }
.latecard__copy h3{ font-size:1.15rem; line-height:1.3; margin:.3rem 0 .25rem }
.latecard__help{ font-size:.92rem; line-height:1.5 }
.latecard__form{ margin-top:1.1rem }
.latecard__opts{ gap:.55rem }
.latecard__opt{ min-height:50px; padding:.6rem 1.1rem; font-size:1rem; color:var(--chalk); background:var(--steel); cursor:pointer; touch-action:manipulation }
.latecard__opt:active{ background:var(--volt); border-color:var(--volt); color:var(--on-volt) }
.latecard__opt:focus-visible{ outline:3px solid var(--volt); outline-offset:3px }
.latecard__row{ gap:.7rem }
.latecard__affix{ font-family:var(--mono); color:var(--mute) }
.latecard .chips{ margin-bottom:.2rem }
.latecard .why{ border-top:1px solid var(--line) }

/* =========================================================== phone + tablet */
@media (max-width:900px){
  /* score / depth summary sits under the question on small screens: keep it quiet */
  .scorepanel,.depthpanel{ margin-top:1.4rem }
}

@media (max-width:640px){
  .stepper{ margin-inline:calc(var(--gutter-l,16px) * -1) calc(var(--gutter-r,16px) * -1); border-width:1px 0; padding:.7rem var(--gutter-r,16px) .8rem var(--gutter-l,16px) }
  .chat__main > .stepper:first-child{ margin-top:-1.2rem; border-top-width:0 }
  .stepper__name{ font-size:1.2rem }
  .stepper__title{ gap:.65rem }

  .qcard{ padding:1.15rem 1rem 1.2rem }
  .qlabel{ font-size:clamp(1.3rem,6vw,1.5rem) }
  /* Back lives in the bottom bar when the question has one */
  .qcard--bar .qcard__top .backlink{ display:none }
  .qcard--bar .qcard__top:not(:has(.skipahead)){ display:none }
  .qcard--bar .qcard__top{ justify-content:flex-end }

  .field--money,.input--date,.field--inline .input--num{ max-width:none }
  .field--inline .input--num{ flex:1 }
  .input--date{ width:100% }
  .choices--bool{ max-width:none }

  /* pick-several: one full-width row each, easy to scan and hit with a thumb */
  .qform .chips{ display:grid; grid-template-columns:1fr; gap:.5rem }
  .qform .chip{ width:100%; min-height:54px }

  /* sticky action bar: Back + the one volt action, above the home indicator */
  .qbar{ position:sticky; bottom:0; z-index:6; margin:1.2rem -1rem 0; padding:.7rem calc(1rem + 5px) calc(.75rem + env(safe-area-inset-bottom)) 1rem; background:var(--steel) }
  .qbar::before{ content:""; position:absolute; left:0; right:0; bottom:100%; height:20px; background:linear-gradient(to top,var(--steel),rgba(20,24,29,0)); pointer-events:none }
  .qbar__back{ display:inline-grid; place-items:center; flex:none; width:54px; height:54px; min-height:54px; padding:0; border:2px solid rgba(243,245,239,.35); color:var(--chalk) }
  .qbar__back .ico{ width:1.25rem; height:1.25rem; transform:rotate(180deg); stroke-width:2.2 }
  .qbar__go{ flex:1; min-width:0; min-height:54px; font-size:1.4rem }
  .qform__actions .qform__add{ width:100% }
  .why{ margin-top:.6rem }

  /* debts: every row becomes its own card with labelled fields; nothing is hidden */
  .debts[data-debts]{ display:grid; gap:.7rem; border:0; overflow:visible; counter-reset:debtrow }
  .debts[data-debts] .debts__head{ display:none }
  .debts[data-debts] .debts__row{ counter-increment:debtrow; grid-template-columns:repeat(3,minmax(0,1fr)); gap:.6rem .5rem; align-items:end;
    padding:.7rem .75rem .85rem; background:var(--steel2); border:1px solid var(--line); border-radius:var(--r) }
  .debts[data-debts] .debts__row::before{ content:"Debt " counter(debtrow); grid-column:1 / -1; font-family:var(--mono); font-size:.62rem; font-weight:600; letter-spacing:.11em; text-transform:uppercase; color:var(--volt) }
  .debts[data-debts] .debts__row .debts__name,.debts[data-debts] .debts__cell--name{ grid-column:1 / -1 }
  .debts[data-debts] .debts__row .debts__name{ display:grid; grid-template-columns:minmax(0,1.2fr) minmax(0,1fr); gap:.5rem }
  .debts[data-debts] .debts__lab{ display:block; margin-bottom:.3rem; font-family:var(--mono); font-size:.6rem; font-weight:500; letter-spacing:.08em; text-transform:uppercase; color:var(--mute); white-space:nowrap }
  .debts[data-debts] .debts__cell--name .debts__lab{ display:none }
  .debts[data-debts] .debts__row input,.debts[data-debts] .debts__row input:last-child{ display:block; min-height:48px; padding:.5rem .6rem }
  .debts[data-debts] .debts__cell:not(.debts__cell--name) input{ font-family:var(--mono); font-size:.95rem }

  .grp__row{ grid-template-columns:1fr 1fr }
  .grp__cell--date{ grid-column:1 / -1 }
  .stepper__kx{ display:none }
  .review{ max-height:none; padding:.9rem .85rem 1rem }
  .review__kv{ gap:.75rem }

  .chat__nav{ flex-direction:column; align-items:flex-start; gap:0 }
  .stepcount{ display:none }

  .advdone__actions{ flex-direction:column; align-items:stretch }
  .advdone__actions .btn{ width:auto; margin-right:5px }
  .advdone__actions .btn--ghost{ margin-right:0 }

  .latecard__opts{ display:grid; grid-template-columns:1fr 1fr }
  .latecard__opt{ width:100% }
}

@media (max-width:380px){
  .stepper__no b{ font-size:1.55rem }
  .stepper__name{ font-size:1.08rem }
  .stepper__count{ font-size:.58rem }
  .choice{ padding-left:.85rem }
  .debts[data-debts] .debts__row{ padding-inline:.6rem }
}

/* desktop: a little more presence for the header strip */
@media (min-width:901px){
  .stepper{ padding:.8rem 1rem .9rem }
  .stepper__name{ font-size:1.5rem }
  .stepper__no b{ font-size:2rem }
  .stepper__count{ font-size:.66rem }
}

@media (prefers-reduced-motion:reduce){
  .choice::after{ transition:none }
}

/* ------------------------------------------------------------ late fixes */
.qhelp + .securenote,.qhelp + .prefillnote{ margin-top:.8rem }
.securenote + .qform,.prefillnote + .qform{ margin-top:1.1rem }

/* ------------------------------------------------------------ QA pass (2026-11-12) */
/* The old swap-in slid the card 26px in from the right, which made phones 8px wider than the screen
   for a third of a second after every answer. Rise in place instead: no sideways overflow. */
@media (prefers-reduced-motion:no-preference){
  .chat.qswap-in .qcard,.chat.qswap-in .coach{ animation-name:gdQIn }
  @keyframes gdQIn{ from{ opacity:0; transform:translateY(10px) } to{ opacity:1; transform:none } }
}
