/* Schindler Field Coach demo. Tokens from DESIGN.md. Dark APP UI, one accent. */

@font-face { font-family: 'Space Grotesk'; font-weight: 500; font-display: swap; src: url('/fonts/SpaceGrotesk-500.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-weight: 600; font-display: swap; src: url('/fonts/SpaceGrotesk-600.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 400; font-display: swap; src: url('/fonts/IBMPlexSans-400.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-weight: 500; font-display: swap; src: url('/fonts/IBMPlexSans-500.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 400; font-display: swap; src: url('/fonts/IBMPlexMono-400.woff2') format('woff2'); }

:root {
  --bg: #0E0F11;
  --surface: #17181C;
  --raised: #1F2126;
  --line: #2A2D33;
  --text: #F2F2F0;
  --muted: #9A9CA3;
  --accent: #E2231A;
  --accent-text: #FF6B61;
  --ok: #3DBE7A;
  --warn: #F2B134;
  --font-display: 'Space Grotesk', 'Helvetica Neue', Arial, sans-serif;
  --font-body: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', Menlo, Consolas, monospace;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s6: 24px; --s8: 32px; --s12: 48px;
  --r-chip: 4px; --r-panel: 8px;
  --t-scene: 240ms; --t-state: 150ms; --t-text: 200ms; --t-seg: 300ms; --t-ring: 900ms;
  --max: 720px;
  color-scheme: dark;
}

@media (prefers-reduced-motion: reduce) {
  :root { --t-scene: 0ms; --t-state: 0ms; --t-text: 0ms; --t-seg: 0ms; --t-ring: 0ms; }
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
button, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 24px; line-height: 30px; }
h2 { font-size: 20px; line-height: 26px; }
p { margin: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: var(--r-chip); }
.mono { font-family: var(--font-mono); font-size: 13px; line-height: 18px; }
.muted { color: var(--muted); }
.caption { font-size: 13px; line-height: 18px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Shell */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: var(--s3);
  padding: calc(var(--s3) + env(safe-area-inset-top, 0px)) var(--s4) var(--s3);
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.topbar .wordmark { font-family: var(--font-display); font-weight: 500; font-size: 16px; margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip {
  display: inline-flex; align-items: center; gap: var(--s1);
  min-height: 32px; padding: 0 var(--s3);
  border: 1px solid var(--line); border-radius: var(--r-chip); background: transparent;
  font-family: var(--font-mono); font-size: 13px; line-height: 18px; color: var(--text);
}
button.chip:hover { background: var(--raised); }
.chip.xp { font-weight: 500; }
.chip.icon { min-width: 44px; justify-content: center; }

.scene { flex: 1; width: 100%; max-width: var(--max); margin: 0 auto; padding: var(--s6) var(--s4) calc(var(--s12) * 2); animation: enter var(--t-scene) ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.scene--full { max-width: none; padding: 0; }

/* Progress */
.progress { display: flex; gap: 2px; margin: 0 0 var(--s4); }
.progress span { flex: 1; height: 3px; background: var(--line); transition: background var(--t-seg); }
.progress span.done { background: var(--muted); }
.progress span.active { background: var(--text); }
.steplabel { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--s4); }
.urgency { display: inline-flex; align-items: center; gap: var(--s2); padding: 2px var(--s2); border: 1px solid var(--line); border-radius: var(--r-chip); font-size: 13px; color: var(--muted); }
.urgency::before { content: ''; width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }

/* Coach line */
.coachline { display: flex; gap: var(--s3); margin-bottom: var(--s6); animation: textin var(--t-text) ease-out; }
@keyframes textin { from { opacity: 0; } to { opacity: 1; } }
.avatar { flex: 0 0 36px; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; background: var(--surface); }
.avatar.customer { border-radius: var(--r-chip); }
.coachline p { font-size: 18px; line-height: 26px; }
.coachline .who { font-size: 13px; color: var(--muted); margin-bottom: 2px; }

/* Panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: var(--s4); }
.panel + .panel, .panel + .options, .options + .panel { margin-top: var(--s4); }
.diagram { color: var(--text); overflow-x: auto; }
.diagram svg { display: block; width: 100%; height: auto; max-height: 360px; }
.diagram img { display: block; width: 100%; height: auto; border-radius: var(--r-chip); }
.diagram .placeholder { color: var(--muted); font-size: 13px; padding: var(--s6); border: 1px dashed var(--line); border-radius: var(--r-chip); text-align: left; }

/* Options */
.options { display: flex; flex-direction: column; gap: var(--s2); margin: 0; padding: 0; list-style: none; }
.option {
  display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: 56px;
  padding: var(--s3) var(--s4); text-align: left;
  background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-panel);
  transition: border-color var(--t-state), background var(--t-state);
}
.option:hover:not(:disabled) { border-color: var(--muted); }
.option[aria-checked="true"] { border-color: var(--text); }
.option:disabled { cursor: default; }
.option .mark { flex: 0 0 18px; width: 18px; height: 18px; border: 1.5px solid var(--muted); border-radius: 50%; display: grid; place-items: center; }
.option[role="checkbox"] .mark { border-radius: 3px; }
.option[aria-checked="true"] .mark::after { content: ''; width: 8px; height: 8px; background: var(--text); border-radius: inherit; }
.option.is-correct { border: 2px solid var(--ok); }
.option.is-wrong { border: 2px solid var(--accent); }
.option .tag { margin-left: auto; font-family: var(--font-mono); font-size: 13px; }
.option.is-correct .tag { color: var(--ok); }
.option.is-wrong .tag { color: var(--accent-text); }

/* Free text */
.field label { display: block; font-weight: 500; margin-bottom: var(--s2); }
.field textarea {
  width: 100%; min-height: 140px; resize: vertical;
  padding: var(--s3) var(--s4); background: var(--raised); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-panel);
}
.field textarea:focus { border-color: var(--text); outline: none; }
.field .counter { display: flex; justify-content: space-between; margin-top: var(--s2); font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.field .nudge { color: var(--warn); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 48px; padding: 0 var(--s6); border-radius: var(--r-chip);
  border: 1px solid var(--line); background: var(--raised); color: var(--text); font-weight: 500;
  transition: background var(--t-state), border-color var(--t-state);
}
.btn:hover:not(:disabled) { border-color: var(--muted); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; width: 100%; }
.btn.primary:hover:not(:disabled) { background: #c81f17; }
.btn.ghost { background: transparent; }
.actions { position: sticky; bottom: 0; padding: var(--s4) 0 calc(var(--s4) + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--bg) 70%, transparent); margin-top: var(--s6); }
.dots::after { content: ''; display: inline-block; width: 1.5em; text-align: left; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }

/* Feedback */
.verdict { display: flex; align-items: baseline; gap: var(--s3); margin: var(--s6) 0 var(--s3); }
.verdict h2 { font-size: 24px; line-height: 30px; }
.verdict.ok h2 { color: var(--ok); }
.verdict.warn h2 { color: var(--warn); }
.verdict.bad h2 { color: var(--accent-text); }
.scorebar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: var(--s2) 0 var(--s4); }
.scorebar span { display: block; height: 100%; width: 0; background: var(--text); transition: width 600ms ease-out; }
.pointlist { list-style: none; padding: 0; margin: var(--s2) 0 0; display: flex; flex-direction: column; gap: var(--s1); }
.pointlist li { display: flex; gap: var(--s2); align-items: baseline; }
.pointlist li::before { content: ''; flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: var(--muted); }
.pointlist.ok li::before { background: var(--ok); }
.pointlist li .src { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.grounded { margin-top: var(--s4); font-size: 13px; color: var(--muted); }
.cites { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s3); }
.cite { display: inline-flex; align-items: center; gap: var(--s2); min-height: 32px; padding: 0 var(--s2); border: 1px solid var(--line); border-radius: var(--r-chip); background: transparent; font-family: var(--font-mono); font-size: 13px; color: var(--text); }
.cite b { font-weight: 400; color: var(--muted); }
.cite:hover { background: var(--raised); }
details.master { margin-top: var(--s4); border-top: 1px solid var(--line); padding-top: var(--s3); }
details.master summary { cursor: pointer; font-weight: 500; }
details.master ol { padding-left: 20px; margin: var(--s3) 0 0; display: flex; flex-direction: column; gap: var(--s3); }
details.master li .q { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }

/* Dialog step */
.transcript { display: flex; flex-direction: column; gap: var(--s3); }
.turn { display: flex; gap: var(--s3); }
.turn.me { flex-direction: row-reverse; text-align: right; }
.turn .bubble { max-width: 85%; padding: var(--s3) var(--s4); background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-panel); }
.turn.me .bubble { background: transparent; }
.turn .bubble .who { font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.qchips { display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s4); }
.qchips .option { min-height: 48px; }
.qchips .option:disabled { opacity: 0.45; }

/* Landing */
.push { border: 1px solid var(--line); border-radius: var(--r-panel); padding: var(--s4); background: var(--surface); margin-bottom: var(--s6); animation: enter var(--t-scene) ease-out; }
.push .title { font-size: 13px; color: var(--muted); display: flex; gap: var(--s2); align-items: center; }
.push .title::before { content: ''; width: 8px; height: 8px; background: var(--accent); border-radius: 50%; }
.push p.body { font-size: 18px; line-height: 26px; margin-top: var(--s2); }
.scenario-row { display: flex; align-items: center; gap: var(--s4); width: 100%; padding: var(--s4); text-align: left; background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-panel); }
.scenario-row + .scenario-row { margin-top: var(--s2); }
.scenario-row .meta { font-family: var(--font-mono); font-size: 13px; color: var(--muted); margin-top: 2px; }
.scenario-row .new { margin-left: auto; font-family: var(--font-mono); font-size: 13px; color: var(--accent-text); }
.scenario-row.locked { opacity: 0.6; }
.scenario-row.locked .new { color: var(--muted); }
.landing-actions { margin-top: var(--s6); display: flex; flex-direction: column; gap: var(--s2); }

/* Call */
.call { min-height: 100dvh; display: flex; flex-direction: column; padding: calc(var(--s8) + env(safe-area-inset-top, 0px)) var(--s4) calc(var(--s6) + env(safe-area-inset-bottom, 0px)); background: var(--surface); }
.call .caller { text-align: center; margin-bottom: var(--s8); }
.call .ring { width: 72px; height: 72px; margin: 0 auto var(--s3); border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; font-family: var(--font-display); font-size: 24px; position: relative; }
.call .ring.live::after { content: ''; position: absolute; inset: -6px; border: 1px solid var(--muted); border-radius: 50%; animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { from { transform: scale(0.9); opacity: 0.8; } to { transform: scale(1.25); opacity: 0; } }
.call .caller .name { font-family: var(--font-display); font-weight: 600; font-size: 20px; }
.call .caller .meta { color: var(--muted); font-size: 13px; }
.call .lines { flex: 1; display: flex; flex-direction: column; gap: var(--s4); max-width: var(--max); margin: 0 auto; width: 100%; }
.call .line { font-size: 18px; line-height: 26px; color: var(--muted); transition: color var(--t-text); padding-left: var(--s3); border-left: 2px solid transparent; }
.call .line.live { color: var(--text); border-left-color: var(--text); }
.call .line.done { color: var(--text); }
.call .status { display: flex; justify-content: center; align-items: center; gap: var(--s3); margin: var(--s6) 0; font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.level { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; }
.level i { width: 3px; background: var(--muted); height: 4px; }
.level.on i { animation: level 0.8s ease-in-out infinite alternate; }
.level.on i:nth-child(2) { animation-delay: 0.2s; }
.level.on i:nth-child(3) { animation-delay: 0.4s; }
@keyframes level { from { height: 4px; } to { height: 14px; } }
.call .btn { max-width: var(--max); margin: 0 auto; }

/* Debrief */
.ringwrap { display: flex; align-items: center; gap: var(--s6); margin: var(--s4) 0 var(--s6); }
.ring-svg { width: 120px; height: 120px; flex: 0 0 120px; }
.ring-svg .track { fill: none; stroke: var(--line); stroke-width: 4; }
.ring-svg .arc { fill: none; stroke: var(--text); stroke-width: 4; stroke-linecap: butt; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset var(--t-ring) ease-out; }
.ring-svg text { font-family: var(--font-display); font-weight: 600; font-size: 28px; fill: var(--text); }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s3) var(--s6); }
.stats .k { font-size: 13px; color: var(--muted); }
.stats .v { font-family: var(--font-display); font-weight: 600; font-size: 20px; }
.stats .v .delta { display: block; font-family: var(--font-mono); font-size: 13px; line-height: 18px; font-weight: 400; color: var(--muted); }
.stats .v .delta.up { color: var(--ok); }
.badges { display: flex; flex-wrap: wrap; gap: var(--s2); }
.badge { padding: var(--s2) var(--s3); border: 1px solid var(--text); border-radius: var(--r-chip); font-family: var(--font-mono); font-size: 13px; }
.badge.off { border-color: var(--line); color: var(--muted); }
.review { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--s2); }
.review details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); }
.review summary { display: flex; align-items: center; gap: var(--s3); min-height: 56px; padding: var(--s3) var(--s4); cursor: pointer; list-style: none; }
.review summary::-webkit-details-marker { display: none; }
.review .dot { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--ok); }
.review .dot.filled { background: var(--ok); }
.review .dot.warn { border-color: var(--warn); background: var(--warn); }
.review .dot.bad { border-color: var(--accent); }
.review .dot.na { border-color: var(--line); }
.review summary .n { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.review summary .t { flex: 1; }
.review summary .s { font-family: var(--font-mono); font-size: 13px; }
.review .body { padding: 0 var(--s4) var(--s4); border-top: 1px solid var(--line); }
.review .body h3 { font-size: 16px; margin: var(--s3) 0 var(--s2); }
.section { margin-top: var(--s8); }
.section h2 { margin-bottom: var(--s3); }

/* Next card */
.nextcard { background: var(--accent); color: #fff; border-radius: var(--r-panel); padding: var(--s6); }
.nextcard .k { font-size: 13px; opacity: 0.85; }
.nextcard h2 { color: #fff; margin: var(--s2) 0; }
.nextcard .btn { background: #fff; color: #111; border-color: #fff; margin-top: var(--s4); }
.nextcard .why { font-size: 13px; opacity: 0.85; }
.qr { margin-top: var(--s6); display: flex; gap: var(--s4); align-items: center; }
.qr img { width: 120px; height: 120px; background: #fff; padding: 6px; border-radius: var(--r-chip); }

/* Sheets and modals */
dialog.sheet { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: var(--r-panel); padding: 0; width: min(560px, calc(100% - 32px)); max-height: 85dvh; }
dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog.sheet .head { display: flex; align-items: center; justify-content: space-between; padding: var(--s4); border-bottom: 1px solid var(--line); }
dialog.sheet .body { padding: var(--s4); overflow: auto; }
.doc { padding: var(--s3) 0; border-bottom: 1px solid var(--line); }
.doc:last-child { border-bottom: 0; }
.doc .id { font-family: var(--font-mono); font-size: 13px; color: var(--muted); }
.doc .meta { font-size: 13px; color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); margin-top: var(--s2); }

/* Toasts */
.toasts { position: fixed; left: 50%; bottom: calc(var(--s12) + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); display: flex; flex-direction: column; gap: var(--s2); z-index: 20; pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: var(--s2) var(--s4); border-radius: var(--r-chip); font-family: var(--font-mono); font-size: 13px; animation: enter var(--t-scene) ease-out; }

/* Boot / errors */
.boot { display: grid; place-items: center; min-height: 60dvh; gap: var(--s4); }
.boot-bar { width: 120px; height: 3px; background: var(--line); position: relative; overflow: hidden; }
.boot-bar::after { content: ''; position: absolute; inset: 0; width: 40%; background: var(--text); animation: boot 1s linear infinite; }
@keyframes boot { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.error-card { margin: var(--s12) auto; max-width: 420px; text-align: left; }

/* Presenter panel */
.debug { position: fixed; right: var(--s3); bottom: var(--s3); z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: var(--s3); font-family: var(--font-mono); font-size: 12px; max-width: 280px; }
.debug .row { display: flex; justify-content: space-between; gap: var(--s3); }
.debug .jump { display: flex; flex-wrap: wrap; gap: var(--s1); margin-top: var(--s2); }
.debug .jump button { min-width: 28px; min-height: 28px; padding: 0 var(--s1); }

/* Phone frame mode for projectors */
body.frame-phone { background: #050506; }
body.frame-phone .app { width: 390px; min-height: 844px; height: 844px; margin: 24px auto; border: 1px solid var(--line); border-radius: 24px; overflow: auto; background: var(--bg); }
body.frame-phone .scene--full .call { min-height: 844px; }

/* Tablet and up */
@media (min-width: 768px) {
  .scene { padding-top: var(--s8); }
  .step-grid { display: grid; grid-template-columns: 40% 1fr; gap: var(--s6); align-items: start; }
  .step-grid .diagram { position: sticky; top: 80px; }
  .btn.primary { width: auto; min-width: 240px; }
  .actions { position: static; background: none; padding-bottom: 0; }
}
@media (min-width: 1200px) {
  :root { --max: 1040px; }
  .scene--debrief, .scene--landing, .scene--next { max-width: 720px; }
}

/* Inline SVG diagram classes (presentation via CSS so the CSP needs no inline styles) */
.diagram .ln { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.diagram .thin { fill: none; stroke: currentColor; stroke-width: 1; stroke-dasharray: 3 3; }
.diagram .lbl { font-family: var(--font-body); font-size: 14px; fill: currentColor; }
.diagram .mono-lbl { font-family: var(--font-mono); font-size: 12px; fill: currentColor; }
.diagram .muted { fill: var(--muted); }
.diagram .dot { fill: currentColor; }

/* Motion and chat additions */
@keyframes reveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.reveal { animation: reveal var(--t-scene) ease-out both; }
.stagger li { animation: reveal var(--t-scene) ease-out both; }
.stagger li:nth-child(1) { animation-delay: 60ms; } .stagger li:nth-child(2) { animation-delay: 120ms; }
.stagger li:nth-child(3) { animation-delay: 180ms; } .stagger li:nth-child(4) { animation-delay: 240ms; }
.stagger li:nth-child(5) { animation-delay: 300ms; } .stagger li:nth-child(n+6) { animation-delay: 360ms; }
.typing::after { content: '|'; margin-left: 1px; animation: caret 0.8s steps(1) infinite; color: var(--muted); }
@keyframes caret { 50% { opacity: 0; } }
.typing-dots { display: inline-flex; gap: 4px; align-items: center; height: 20px; }
.typing-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: dotpulse 1.1s ease-in-out infinite; }
.typing-dots i:nth-child(2) { animation-delay: 0.18s; } .typing-dots i:nth-child(3) { animation-delay: 0.36s; }
@keyframes dotpulse { 0%, 70%, 100% { transform: translateY(0); opacity: 0.5; } 35% { transform: translateY(-4px); opacity: 1; } }
.avatar { position: relative; transition: border-color var(--t-state); }
.avatar.speaking { border-color: var(--text); }
.avatar.speaking::after { content: ''; position: absolute; inset: -5px; border-radius: inherit; border: 1px solid var(--muted); animation: pulse 1.4s ease-out infinite; }
.chip.xp.bump { border-color: var(--text); transition: border-color var(--t-state); }
.option:active:not(:disabled) { transform: scale(0.99); }
.option { transition: border-color var(--t-state), background var(--t-state), transform var(--t-state); }
.transcript.chat { gap: var(--s2); }
.transcript.chat .turn { animation: reveal var(--t-scene) ease-out both; }
.transcript.preamble { margin-bottom: var(--s4); }
.options.replies .option { align-items: flex-start; line-height: 24px; }
.badge.earned { animation: badgein 500ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both; }
.badge.off { opacity: 0.55; }
@keyframes badgein { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: none; } }
.scorebar span { transition: width 700ms cubic-bezier(0.2, 0.8, 0.2, 1); }
@media (prefers-reduced-motion: reduce) {
  .reveal, .stagger li, .transcript.chat .turn, .badge.earned { animation: none; }
  .typing-dots i, .avatar.speaking::after, .typing::after { animation: none; }
}

/* Round 2: character portraits */
.avatar { overflow: hidden; }
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.avatar.small { flex: 0 0 32px; width: 32px; height: 32px; align-self: flex-end; }
.avatar.large { flex: 0 0 56px; width: 56px; height: 56px; }
.turn .avatar { margin-bottom: 2px; }
.call .ring { width: 112px; height: 112px; overflow: hidden; border-radius: 50%; }
.call .ring img { display: block; width: 100%; height: 100%; object-fit: cover; }
.hero { margin: 0 0 var(--s6); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; background: var(--surface); }
.hero img { display: block; width: 100%; height: auto; }
.coachline.tight { margin: var(--s2) 0 var(--s3); }
.coachline .fb { font-size: 16px; line-height: 24px; }
.reaction { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s3); }

/* Expert voice note */
.note { display: flex; gap: var(--s3); margin-top: var(--s4); padding: var(--s3); background: var(--raised); border: 1px solid var(--line); border-radius: var(--r-panel); }
.note-body { flex: 1; min-width: 0; }
.note-controls { display: flex; align-items: center; gap: var(--s3); margin: var(--s2) 0; }
.btn.note-play { min-height: 40px; padding: 0 var(--s4); width: auto; min-width: 0; }
.note-transcript summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.note-transcript p { margin-top: var(--s2); font-size: 15px; line-height: 22px; }

/* Debrief additions */
.mood { display: flex; align-items: center; gap: var(--s3); margin: calc(var(--s3) * -1) 0 var(--s4); }
.mood .k { font-size: 13px; color: var(--muted); }
.mood .v { font-family: var(--font-display); font-weight: 600; font-size: 18px; }
.radarwrap { display: flex; justify-content: center; padding: var(--s2) 0; }
.radar { width: min(480px, 100%); height: auto; overflow: visible; }
.radar .grid { fill: none; stroke: var(--line); stroke-width: 1; }
.radar .shape { fill: var(--text); fill-opacity: 0.18; stroke: var(--text); stroke-width: 1.5; stroke-linejoin: round; transform: scale(0.05); transform-origin: 240px 180px; transition: transform 600ms cubic-bezier(0.2, 0.8, 0.2, 1); }
.radar .shape.in { transform: scale(1); }
.radar .lbl { font-family: var(--font-body); font-size: 14px; fill: var(--text); }
.radar .val { font-family: var(--font-mono); font-size: 13px; fill: var(--muted); }

/* Personal plan */
.plan { list-style: none; padding: 0; margin: var(--s4) 0 0; }
.plan-item { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) 0; border-top: 1px solid rgba(255, 255, 255, 0.3); }
.plan-body { flex: 1; min-width: 0; }
.plan-body .title { font-weight: 500; }
.nextcard .muted { color: rgba(255, 255, 255, 0.8); }
.nextcard .cite.static { color: #fff; border-color: rgba(255, 255, 255, 0.5); cursor: default; }
.nextcard .cite.static b { color: rgba(255, 255, 255, 0.8); }
.nextcard .btn.ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.6); min-height: 40px; padding: 0 var(--s3); margin-top: 0; flex: none; }
.nextcard .btn.ghost:hover:not(:disabled) { border-color: #fff; background: rgba(255, 255, 255, 0.12); }
@media (max-width: 560px) {
  .plan-item { flex-wrap: wrap; }
  .plan-body { flex: 1 1 60%; }
  .plan-item .btn.ghost { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .radar .shape { transition: none; transform: scale(1); }
}

/* Scenario 02: scenario list */
a.scenario-row { text-decoration: none; color: inherit; }
.scenario-row .tags { margin-left: auto; display: flex; gap: var(--s2); align-items: center; flex: none; }
.scenario-row .tag-draft { font-family: var(--font-mono); font-size: 11px; color: var(--warn); border: 1px solid var(--warn); border-radius: var(--r-chip); padding: 1px 6px; }
.scenario-row .done { font-family: var(--font-mono); font-size: 13px; color: var(--ok); }
.scenario-row.current { border-color: var(--text); }
.draft-chip { display: inline-flex; align-items: center; gap: var(--s2); font-family: var(--font-mono); font-size: 12px; color: var(--warn); border: 1px solid var(--warn); border-radius: var(--r-chip); padding: 2px var(--s2); }
.draft-chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }

/* Simulated SMLCD */
.lcd { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); padding: var(--s3); }
.lcd-screen { background: #0B1A12; color: #9FE2B0; border: 2px solid #2A3A30; border-radius: 6px; padding: var(--s3); font-family: var(--font-mono); font-size: 13px; line-height: 20px; min-height: 176px; outline: none; }
.lcd-screen:focus-visible { border-color: #9FE2B0; }
.lcd-title { display: flex; justify-content: space-between; border-bottom: 1px dashed #2F5A40; padding-bottom: 4px; margin-bottom: 6px; letter-spacing: 0.08em; }
.lcd-crumb { color: #5FA776; }
.lcd-line { white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.lcd-line.cursor { background: #9FE2B0; color: #0B1A12; }
.lcd-screen .lcd-line[onclick], .lcd-screen .lcd-line { cursor: default; }
.lcd-more { color: #5FA776; margin-top: 4px; font-size: 11px; }
.lcd-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s2); margin-top: var(--s3); }
.lcd-key { min-height: 40px; border: 1px solid var(--line); border-radius: var(--r-chip); background: var(--raised); color: var(--text); font-family: var(--font-mono); font-size: 12px; }
.lcd-key:hover:not(:disabled) { border-color: var(--muted); }
.lcd-key:disabled { opacity: 0.4; cursor: not-allowed; }
.lcd-key.primary { border-color: var(--text); }

/* Ordered procedure step */
.order-list { list-style: none; padding: 0; margin: 0 0 var(--s3); display: flex; flex-direction: column; gap: var(--s2); min-height: 56px; border: 1px dashed var(--line); border-radius: var(--r-panel); padding: var(--s2); }
.order-list:empty::after { content: attr(data-empty); color: var(--muted); font-size: 13px; padding: var(--s3); display: block; }
.order-list .option { min-height: 48px; }
.order-list .num { flex: 0 0 24px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--text); display: grid; place-items: center; font-family: var(--font-mono); font-size: 12px; }
.order-list .option.is-correct .num { border-color: var(--ok); color: var(--ok); }
.order-list .option.is-wrong .num { border-color: var(--accent-text); color: var(--accent-text); }
.order-pool { display: flex; flex-direction: column; gap: var(--s2); }
.order-pool .option { min-height: 48px; }
.order-tools { display: flex; justify-content: space-between; align-items: center; margin: var(--s2) 0; }

/* Safety stop */
.safety-stop { background: var(--accent); color: #fff; border-radius: var(--r-panel); padding: var(--s4); margin: var(--s4) 0; display: flex; gap: var(--s3); align-items: flex-start; animation: stopin 300ms ease-out both; }
.safety-stop::before { content: ''; flex: 0 0 12px; width: 12px; height: 12px; margin-top: 6px; border-radius: 50%; background: #fff; animation: blink 1s steps(2, start) 4; }
.safety-stop h3 { color: #fff; font-size: 18px; margin-bottom: 2px; }
.safety-stop p { font-size: 14px; opacity: 0.92; }
@keyframes stopin { from { transform: translateY(-6px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes blink { 50% { opacity: 0.2; } }
.stats .v.bad { color: var(--accent-text); }

/* Ask the coach */
.ask-chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s3); }
.ask-chips .chip { cursor: pointer; }
.ask-input { width: 100%; min-height: 72px; resize: vertical; padding: var(--s3) var(--s4); background: var(--raised); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-panel); }
.ask-input:focus { border-color: var(--text); outline: none; }
.ask-actions { display: flex; align-items: center; gap: var(--s3); margin-top: var(--s2); }
.ask-actions .btn.primary { width: auto; min-width: 0; }
.ask-answer { margin-top: var(--s4); }
.ask-answer .coachline { margin-bottom: var(--s3); }
.ask-answer .src-note { font-size: 13px; color: var(--muted); margin-top: var(--s2); }
.carry { display: flex; gap: var(--s2); align-items: center; font-size: 13px; color: var(--muted); margin: 0 0 var(--s4); }
.carry::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.intro-image { margin: 0 0 var(--s4); }
.intro-image img { display: block; width: 100%; height: auto; border-radius: var(--r-panel); border: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) {
  .safety-stop, .safety-stop::before { animation: none; }
}
