/* Pulse by Ally Creation: one design system for phone, trainer and projector */
:root {
  /* 60-30-10: midnight ink and warm neutrals, iris as the brand colour, coral as the spark */
  --ink: #14182e; --ink2: #23284a; --ink3: #343a63;
  --navy: #0e1227; --navy2: #1a1f42;
  --accent: #4f46e5; --accent-h: #4338ca; --accent-l: #eef0ff; --accent-on-dark: #a5a8ff;
  --warm: #c8402f; --warm-l: #fff0ec; --warm-on-dark: #ff7a66;
  --text: #14182e; --muted: #5a5f78; --faint: #8b8fa6;
  --line: #e6e4ee; --line2: #d6d4e2; --bg: #f7f6fb; --card: #fff; --soft: #f2f1f8;
  --ok: #15803d; --mid: #b45309; --bad: #b91c1c; --none: #cbd2e1;
  --focus: #6366f1;
  --r-sm: 10px; --r: 14px; --r-lg: 20px; --r-xl: 28px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --sh1: 0 1px 2px rgba(15, 23, 51, .06), 0 1px 1px rgba(15, 23, 51, .04);
  --sh2: 0 1px 2px rgba(15, 23, 51, .05), 0 8px 24px -8px rgba(15, 23, 51, .12);
  --sh3: 0 2px 4px rgba(15, 23, 51, .06), 0 24px 48px -16px rgba(15, 23, 51, .22);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font: 500 16px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.015em; font-weight: 800; }
h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.wrap { max-width: 1240px; margin: 0 auto; padding: var(--s5) var(--s4); }
.narrow { max-width: 560px; margin: 0 auto; padding: var(--s4) var(--s4) calc(112px + env(safe-area-inset-bottom)); padding-left: max(var(--s4), env(safe-area-inset-left)); padding-right: max(var(--s4), env(safe-area-inset-right)); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* brand */
.brand { font-weight: 800; letter-spacing: -.01em; font-size: 1.35rem; display: inline-flex; align-items: center; gap: 10px; }
.brand::before { content: ""; width: 12px; height: 12px; border-radius: 4px; background: var(--accent-on-dark); box-shadow: 8px 8px 0 -2px var(--warm-on-dark); margin-right: 8px; flex: none; }
.brand span { color: var(--accent-on-dark); font-weight: 600; font-size: .6em; letter-spacing: .01em; margin-left: 2px; }

/* hero (phone join, sign-in) */
.hero { background: var(--navy); color: #fff; padding: calc(var(--s6) + env(safe-area-inset-top)) var(--s5) 76px; }
.hero > * { max-width: 528px; margin-left: auto; margin-right: auto; }
.hero .brand { font-size: 1.5rem; display: flex; }
.hero p { color: #c3cbe0; margin: var(--s2) auto 0; font-size: 1.05rem; }

/* cards and forms */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s5); box-shadow: var(--sh2); margin-bottom: var(--s4); animation: rise .35s var(--ease) both; }
.lift { margin-top: -52px; position: relative; z-index: 1; box-shadow: var(--sh3); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
label { display: block; font-weight: 700; font-size: .875rem; margin: var(--s4) 0 6px; color: var(--ink2); }
form label:first-child { margin-top: 0; }
input, select, textarea { width: 100%; min-height: 48px; padding: 12px 14px; border: 1.5px solid var(--line2); border-radius: var(--r-sm); background: #fff; color: var(--text); transition: border-color .15s, box-shadow .15s; }
select { appearance: none; padding-right: 40px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23556079' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center; }
input:hover, select:hover, textarea:hover { border-color: #b9c0d0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(79, 70, 229, .22); }
input[type=checkbox] { width: 20px; height: 20px; min-height: 0; accent-color: var(--accent); padding: 0; }
textarea { min-height: 104px; resize: vertical; line-height: 1.45; }
::placeholder { color: var(--faint); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; border: 1px solid transparent; border-radius: var(--r-sm); padding: 10px 18px; font-weight: 700; cursor: pointer; background: var(--accent); color: #fff; transition: transform .1s, background .15s, box-shadow .15s, border-color .15s; box-shadow: var(--sh1); text-decoration: none; }
.btn:hover { background: var(--accent-h); }
.btn:active { transform: scale(.98); }
.btn.big { width: 100%; min-height: 54px; font-size: 1.05rem; margin-top: var(--s4); border-radius: var(--r); }
.btn.ghost { background: #fff; color: var(--ink2); border-color: var(--line2); box-shadow: none; }
.btn.ghost:hover { background: var(--soft); border-color: #b9c0d0; }
.btn.dark { background: var(--ink2); } .btn.dark:hover { background: var(--ink3); }
.btn.warn { background: #fff; color: #b42318; border-color: #f2c4c0; box-shadow: none; } .btn.warn:hover { background: #fef3f2; }
.btn.sm { padding: 8px 14px; font-size: .875rem; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.btn[aria-pressed="false"] { background: #fff; color: var(--muted); border-color: var(--line2); box-shadow: none; }
.btn[aria-pressed="true"].ghost { background: var(--accent-l); color: var(--accent-h); border-color: #c7c9fb; }

.muted { color: var(--muted); font-size: .9rem; } .note { color: var(--muted); font-size: .85rem; margin: var(--s3) 0 0; }
.err { color: #b42318; font-weight: 600; } .err:empty { display: none; }
.row { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; } .between { justify-content: space-between; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 700; letter-spacing: .02em; padding: 3px 10px; border-radius: 99px; background: var(--soft); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.chip.open { background: var(--accent-l); color: var(--accent-h); border-color: #b5ded8; }
.chip.open::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.chip.rev { background: #eef0fe; color: #3730a3; border-color: #d4d8fb; }
.chip.g { background: #e7f6ec; color: #116530; border-color: #bfe5cb; }
.chip.a { background: #fdf3e3; color: #8a4205; border-color: #f4d6a8; }
.chip.r { background: #fdecec; color: #9b1c1c; border-color: #f5c2c2; }

/* =============== phone =============== */
.topbar { position: sticky; top: 0; z-index: 5; background: rgba(255, 255, 255, .9); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.topbar .narrow { padding-top: 10px; padding-bottom: 10px !important; }
.avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: .9rem; color: #fff; background: var(--ink2); flex: none; }
.who { gap: var(--s3); min-width: 0; } .who b { display: block; line-height: 1.2; }
.who small { display: block; color: var(--muted); font-size: .8rem; }
.topbar select { width: auto; min-height: 44px; padding: 8px 34px 8px 12px; font-size: .85rem; border-radius: 99px; background-position: right 12px center; }
.topbar .btn.sm { border-radius: 99px; }
.progress { height: 6px; background: #e4e7ef; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .6s var(--ease); }
.qcard { padding: var(--s5); }
.qcard .tag { color: var(--warm); font-weight: 800; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.qcard h2 { font-size: 1.3rem; margin: 6px 0 var(--s4); line-height: 1.3; }
.choices { display: grid; gap: 10px; }
.choice { display: flex; align-items: center; gap: 14px; text-align: left; width: 100%; min-height: 60px; padding: 12px 14px; border-radius: var(--r); border: 1.5px solid var(--line2); background: #fff; font-weight: 600; font-size: 1.02rem; cursor: pointer; transition: border-color .15s, background .15s, transform .1s, box-shadow .15s; color: var(--text); box-shadow: var(--sh1); }
.choice:hover { border-color: #9aa3b8; background: #fbfcfe; }
.choice:active { transform: scale(.985); }
.choice .k { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; color: var(--ink); font-weight: 800; font-size: .9rem; background: color-mix(in srgb, var(--c, #8a94a6) 18%, #fff); border: 1.5px solid color-mix(in srgb, var(--c, #8a94a6) 55%, #fff); transition: background .15s, color .15s; }
.choice.picked { border-color: var(--accent); background: var(--accent-l); box-shadow: 0 0 0 3px rgba(79, 70, 229, .18); }
.choice.picked .k { background: var(--accent); border-color: var(--accent); color: #fff; }
.choice:disabled { cursor: default; } .choice:disabled:not(.picked) { opacity: .55; }
.stars { display: flex; gap: 6px; justify-content: center; padding: var(--s2) 0; }
.stars button { font-size: 2.6rem; line-height: 1; min-width: 52px; min-height: 52px; background: none; border: 0; border-radius: 12px; cursor: pointer; color: #c9cfdb; transition: transform .12s var(--ease), color .12s; }
.stars:hover button { color: #f0a400; } .stars button:hover ~ button { color: #c9cfdb; }
.stars button:hover, .stars button.on { transform: scale(1.12); }
.yn { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.yn button { min-height: 88px; border-radius: var(--r); border: 1.5px solid var(--line2); background: #fff; font-weight: 800; font-size: 1.15rem; cursor: pointer; color: var(--text); box-shadow: var(--sh1); transition: transform .1s, border-color .15s, background .15s; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.yn button::before { content: ""; width: 28px; height: 28px; border-radius: 50%; background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/18px no-repeat; }
.yn button.no::before { background: var(--warm) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 12h10' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round'/%3E%3C/svg%3E") center/18px no-repeat; }
.yn button:hover { border-color: #9aa3b8; } .yn button:active { transform: scale(.98); }
.yn button.yes.picked { border-color: var(--ok); background: #e7f6ec; } .yn button.no.picked { border-color: var(--warm); background: var(--warm-l); }
.scaleout { text-align: center; font-size: 3rem; font-weight: 800; color: var(--accent); line-height: 1.1; margin: var(--s2) 0; font-variant-numeric: tabular-nums; }
input[type=range] { padding: 0; min-height: 44px; border: 0; accent-color: var(--accent); background: none; box-shadow: none !important; }
.rank ol { list-style: none; padding: 0; margin: 0; counter-reset: r; }
.rank li { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border: 1.5px solid var(--line2); border-radius: var(--r); margin-bottom: 8px; background: #fff; box-shadow: var(--sh1); }
.rank li::before { counter-increment: r; content: counter(r); width: 28px; height: 28px; border-radius: 8px; background: var(--ink2); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .85rem; flex: none; }
.rank li span { flex: 1; font-weight: 600; }
.rank li button { border: 1px solid var(--line); background: var(--soft); border-radius: 10px; min-width: 44px; min-height: 44px; cursor: pointer; font-size: .9rem; color: var(--ink2); }
.rank li button:hover { background: #e6e9f1; }
.pad, .plot { position: relative; aspect-ratio: 1; border-radius: var(--r); border: 1.5px solid var(--line2); background: linear-gradient(90deg, #f1f0ff 50%, #fff3ef 50%) top / 100% 50% no-repeat, linear-gradient(90deg, #fff8ec 50%, #eefaf7 50%) bottom / 100% 50% no-repeat; }
.pad { cursor: crosshair; touch-action: manipulation; }
.pad::before, .pad::after, .plot::before, .plot::after { content: ""; position: absolute; background: #c2c8d6; }
.pad::before, .plot::before { left: 50%; top: 0; bottom: 0; width: 1.5px; } .pad::after, .plot::after { top: 50%; left: 0; right: 0; height: 1.5px; }
.pad .ax, .plot .ax { position: absolute; font-size: .78rem; font-weight: 700; color: var(--ink2); background: rgba(255, 255, 255, .92); padding: 2px 8px; border-radius: 6px; z-index: 1; box-shadow: var(--sh1); }
.pad .dot { position: absolute; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 4px rgba(79, 70, 229, .25), 0 2px 6px rgba(0, 0, 0, .25); z-index: 2; animation: pop .3s var(--ease) both; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.timer { display: flex; align-items: center; gap: 12px; font-weight: 800; color: #b42318; margin-bottom: var(--s4); font-variant-numeric: tabular-nums; }
.timer > span { display: inline-flex; align-items: center; gap: 8px; }
.timer > span::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #e5484d; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .3; } }
.timer .tb { flex: 1; height: 8px; border-radius: 99px; background: #fde4e3; overflow: hidden; } .timer .tb i { display: block; height: 100%; background: #e5484d; border-radius: 99px; transition: width 1s linear; }
.sent { text-align: center; padding: var(--s6) var(--s3); }
.sent h2 { font-size: 1.5rem; margin-top: var(--s4); }
.tick { width: 84px; height: 84px; margin: 0 auto; display: block; }
.tick circle { fill: var(--accent); transform-origin: center; animation: pop .4s var(--ease) both; }
.tick path { fill: none; stroke: #fff; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .35s .25s ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.sentline { display: inline-flex; align-items: center; gap: 8px; background: var(--accent-l); color: var(--accent-h); font-weight: 800; font-size: .9rem; padding: 6px 14px 6px 8px; border-radius: 99px; margin-bottom: var(--s3); animation: rise .35s var(--ease) both; }
.sentline::before { content: ""; width: 20px; height: 20px; border-radius: 50%; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 12.5l4 4 8-9' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat; }
.qcard #room .card { box-shadow: none; border: 0; padding: var(--s3) 0 0; margin: 0; border-top: 1px solid var(--line); border-radius: 0; }
#room > .card { margin-top: 0; }
.feedback { font-weight: 700; font-size: 1rem; margin: 0 0 var(--s4); color: var(--ink2); background: var(--soft); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.feedback::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--warm-on-dark); box-shadow: 0 0 0 4px #fdf3e3; flex: none; }
.feedback.yes { color: #116530; background: #e7f6ec; border-color: #bfe5cb; font-size: 1.15rem; }
.feedback.yes::before { background: var(--ok); box-shadow: 0 0 0 4px #cdebd6; }
.react { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; display: flex; justify-content: center; gap: 8px; padding: 10px max(10px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); background: rgba(255, 255, 255, .92); border-top: 1px solid var(--line); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); }
.react button { font-size: 1.5rem; width: 50px; height: 50px; border-radius: 16px; border: 1px solid var(--line); background: #fff; cursor: pointer; transition: transform .12s var(--ease), background .15s; box-shadow: var(--sh1); }
.react button:hover { background: var(--soft); } .react button:active { transform: scale(.85); }
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 20; overflow: hidden; }
.fx .fl { position: absolute; bottom: 80px; font-size: 2rem; animation: floatup 2.4s ease-out forwards; }
@keyframes floatup { to { transform: translateY(-60vh) scale(1.4); opacity: 0; } }
.fx .cf { position: absolute; width: 8px; height: 13px; border-radius: 2px; animation: conf 1.1s ease-out forwards; }
@keyframes conf { to { transform: translate(var(--dx), var(--dy)) rotate(540deg); opacity: 0; } }
.waiting { text-align: center; padding: var(--s7) var(--s5); }
.waiting h2 { font-size: 1.35rem; }
.pulse { display: inline-flex; gap: 6px; margin-bottom: var(--s4); } .pulse i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pl 1.2s infinite ease-in-out; }
.pulse i:nth-child(2) { animation-delay: .15s; } .pulse i:nth-child(3) { animation-delay: .3s; background: var(--warm-on-dark); }
@keyframes pl { 0%, 80%, 100% { transform: scale(.6); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }
.qcard.full { min-height: 58vh; }
.qcard.full h2 { font-size: 1.45rem; }
.qcard.full .choice { min-height: 64px; font-size: 1.08rem; }
.qcard.full .yn button { min-height: 112px; font-size: 1.25rem; }
.qcard.full .stars button { font-size: 3rem; min-width: 56px; }

/* =============== trainer =============== */
.tbar { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 5; box-shadow: 0 1px 0 rgba(255, 255, 255, .06); }
.tbar .wrap { padding: 10px var(--s4); gap: var(--s3); }
.tbar .brand { font-size: 1.1rem !important; margin-right: var(--s2); }
.tbar select { width: auto; min-height: 40px; padding: 8px 34px 8px 12px; border-radius: var(--r-sm); border: 1px solid rgba(255, 255, 255, .16); background-color: rgba(255, 255, 255, .08); color: #fff; font-size: .9rem; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23c3cbe0' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); }
.tbar select option { color: var(--text); background: #fff; }
.tbar .btn.dark { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16); box-shadow: none; } .tbar .btn.dark:hover { background: rgba(255, 255, 255, .16); }
.tbar .btn.ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .28); } .tbar .btn.ghost:hover { background: rgba(255, 255, 255, .1); }
.tabs { display: flex; gap: 2px; background: rgba(255, 255, 255, .07); padding: 4px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .08); }
.tabs button { border: 0; background: none; color: #c3cbe0; padding: 8px 16px; min-height: 40px; border-radius: 9px; font-weight: 700; font-size: .9rem; cursor: pointer; transition: background .15s, color .15s; }
.tabs button:hover { color: #fff; } .tabs button.on { background: #fff; color: var(--navy); box-shadow: var(--sh1); }
.cols { display: grid; grid-template-columns: minmax(360px, 440px) 1fr; gap: var(--s5); align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr !important; } }
.card > .row.between > h2 { margin: 0; }
#qs { margin-top: var(--s3); }
.qi { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; margin-bottom: 10px; background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s; }
.qi:hover { border-color: var(--line2); background: #fbfcfe; } .qi.sel { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); background: #fff; }
.qi .row { gap: 6px; }
.qi .p { font-weight: 700; margin: 8px 0 10px; line-height: 1.35; color: var(--ink); }
.qi select { width: auto; min-height: 44px; padding: 8px 32px 8px 10px !important; font-size: .875rem; background-position: right 10px center; }
.pbar { position: sticky; top: 68px; z-index: 4; }
.pbar .card { margin: 0 0 var(--s4); padding: 14px 18px; border: 1px solid var(--line); border-left: 4px solid var(--accent); box-shadow: var(--sh3); animation: none; }
.pbar .card > div:first-child { min-width: 0; flex: 1 1 320px; }
.pbar .card > div:first-child > b { display: inline-flex; align-items: center; gap: 8px; margin-right: 8px; color: var(--ink); }
.pbar .card > div:first-child > b::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--faint); }
.pbar .card:has([data-p=stop]:not([disabled])) > div:first-child > b::before { background: #e5484d; box-shadow: 0 0 0 4px #fde4e3; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s4); margin-bottom: var(--s5); }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--sh2); }
.kpi b { display: block; font-size: 2rem; line-height: 1.1; color: var(--ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums; } .kpi span { color: var(--muted); font-size: .85rem; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: var(--soft); }
th:first-child { border-top-left-radius: var(--r-sm); } th:last-child { border-top-right-radius: var(--r-sm); }
tbody tr:hover td { background: #fafbfd; }
.scroll { overflow-x: auto; }
.cell { width: 30px; height: 26px; border-radius: 7px; display: inline-grid; place-items: center; font-size: .75rem; font-weight: 800; color: #fff; }
.c3 { background: var(--ok); } .c2 { background: var(--mid); } .c1, .c0 { background: var(--bad); } .cn { background: var(--soft); color: #6b7489; }
#dmsg:empty { display: none; }

/* join QR (trainer dialog, projector) */
.qr { background: #fff; border-radius: var(--r-lg); padding: 18px; line-height: 0; }
.qr svg { width: 100%; height: auto; display: block; }
.qrdialog { border: 0; border-radius: var(--r-xl); padding: var(--s6); max-width: min(92vw, 560px); width: 100%; text-align: center; box-shadow: var(--sh3); color: var(--text); }
.qrdialog::backdrop { background: rgba(11, 20, 48, .72); }
.qrdialog .qr { width: min(100%, 440px); margin: var(--s4) auto; border: 1px solid var(--line); }
.qrdialog .url { font-size: clamp(1.3rem, 3.2vw, 1.9rem); font-weight: 800; color: var(--accent); word-break: break-all; }
.qrdialog h2 { font-size: 1.5rem; margin: 0; }

/* =============== results (trainer, phone, projector) =============== */
.bars .b { margin: 14px 0; }
.bars .lbl { display: flex; justify-content: space-between; gap: 12px; font-weight: 700; margin-bottom: 6px; align-items: baseline; }
.bars .lbl span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bars .tr { height: 30px; background: var(--soft); border-radius: 8px; overflow: hidden; }
.bars .fill { height: 100%; min-width: 4px; border-radius: 8px; transition: width .8s var(--ease); }
.bars .b.correct .lbl span:first-child { color: var(--ok); }
.bars .b.correct .lbl span:last-child::after { content: "  correct"; color: var(--ok); white-space: pre; font-weight: 800; }
.hist { display: flex; align-items: flex-end; gap: 8px; height: 220px; padding-top: 8px; }
.hist .hc { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 6px; min-width: 0; }
.hist .hc i { display: block; width: 100%; min-height: 3px; border-radius: 8px 8px 3px 3px; background: var(--accent); transition: height .8s var(--ease); }
.hist .hc span { font-weight: 800; font-size: .9rem; font-variant-numeric: tabular-nums; } .hist .hc b { font-size: .85rem; color: var(--muted); }
.cols3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: var(--s4); align-items: start; }
.cmts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; } .cmts .ans { margin: 0; }
.cloud { text-align: center; line-height: 1.1; padding: var(--s3); font-size: 1rem; }
.cloud span { display: inline-block; margin: .2em .45em; font-weight: 800; letter-spacing: -.02em; }
.cloud span.in, .ans.in, .plot .d.in { animation: rise .45s var(--ease) both; }
.plot .d.in { animation-name: pop; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: var(--s4); }
.tile { background: var(--soft); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; text-align: center; }
.tile b { display: block; font-size: 1.6rem; line-height: 1.2; color: var(--ink); font-variant-numeric: tabular-nums; } .tile span { font-size: .78rem; color: var(--muted); font-weight: 600; }
.ans { border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px 12px 16px; margin: 8px 0; background: #fff; position: relative; box-shadow: var(--sh1); }
.ans::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.ans small { display: block; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.plot { max-width: 520px; margin: 0 auto; }
.plot .d { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2px solid #fff; z-index: 2; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
.plot .qn { position: absolute; font-weight: 800; font-size: 1.4rem; color: var(--ink2); opacity: .4; transform: translate(-50%, -50%); }
.lead { margin: 0; } .lead li { display: flex; justify-content: space-between; padding: 10px 14px; border-radius: var(--r-sm); margin: 6px 0; background: var(--soft); border: 1px solid var(--line); font-weight: 700; }
.lead li:first-child { background: var(--warm-l); border-color: #f4d6a8; }
.wall .ans { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.vote { min-height: 44px; border: 1.5px solid var(--line2); background: #fff; border-radius: 99px; padding: 6px 14px; font-weight: 800; cursor: pointer; color: var(--ink); flex: none; font-variant-numeric: tabular-nums; transition: transform .1s, background .15s; }
.vote:hover { background: var(--soft); } .vote:active { transform: scale(.94); }
.vote:disabled { background: var(--accent-l); border-color: #c7c9fb; color: var(--accent-h); cursor: default; }
.ans.qa .vt { float: right; font-weight: 800; margin-left: 12px; font-variant-numeric: tabular-nums; }

/* =============== projector (?screen) =============== */
body[data-mode=screen] { background: var(--navy); color: #fff; min-height: 100vh; overflow: hidden; }
body[data-mode=screen] .wrap, body[data-mode=screen] .narrow { color: var(--text); }
.screen { padding: 3.2vh 3.6vw; height: 100vh; display: flex; flex-direction: column; background: radial-gradient(120% 80% at 50% -10%, #17245a 0%, var(--navy) 60%); }
.screen > .row.between { flex-wrap: nowrap; align-items: center; gap: 24px; }
.screen .brand { font-size: clamp(1.2rem, 1.5vw, 1.8rem); }
.screen .brand span { font-size: .72em; color: var(--warm-on-dark); }
.screen h1 { font-size: clamp(2.2rem, 3.9vw, 4.6rem); line-height: 1.12; margin: 3vh 0 1.5vh; letter-spacing: -.025em; max-width: 30ch; text-wrap: balance; }
.screen .meta { color: #b4bfdc; font-size: clamp(1rem, 1.3vw, 1.5rem); font-weight: 600; }
.screen .stage { flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 0; }
.screen .muted { color: #b4bfdc; }
.joinstrip { display: flex; align-items: center; gap: 16px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); border-radius: var(--r-lg); padding: 10px 20px 10px 10px; flex: none; }
.joinstrip .qr { width: clamp(96px, 8.4vw, 150px); padding: 8px; border-radius: 12px; }
.joinstrip small { display: block; color: #b4bfdc; font-size: clamp(.85rem, .9vw, 1.1rem); font-weight: 600; }
.joinstrip b { display: block; font-size: clamp(1.1rem, 1.5vw, 1.9rem); color: #fff; letter-spacing: -.01em; }
.screen .join { display: grid; grid-template-columns: auto 1fr; gap: 6vw; align-items: center; }
.screen .join .qr { width: clamp(420px, 50vh, 640px); padding: 26px; border-radius: var(--r-xl); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6); }
.screen .join h1 { font-size: clamp(3rem, 5vw, 6rem); margin: 0 0 2vh; }
.screen .join .kicker { color: var(--accent-on-dark); font-weight: 800; text-transform: uppercase; letter-spacing: .14em; font-size: clamp(1rem, 1.2vw, 1.4rem); margin-bottom: 1.5vh; }
.screen .url { font-size: clamp(2rem, 3.4vw, 4rem); font-weight: 800; color: var(--accent-on-dark); word-break: break-all; letter-spacing: -.02em; line-height: 1.15; }
.screen .joined { margin-top: 5vh; display: inline-flex; align-items: baseline; gap: 18px; padding: 18px 30px; border-radius: var(--r-xl); background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); }
.screen .big-count { font-size: clamp(4rem, 8vw, 9rem); font-weight: 800; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.screen .joined .meta { font-size: clamp(1.3rem, 1.8vw, 2.2rem); }
.screen .timer { font-size: clamp(1.6rem, 2.2vw, 2.6rem); color: #ffb4b0; margin: 0 0 1vh; } .screen .timer .tb { height: 12px; background: rgba(255, 255, 255, .1); }
.ringrow { display: grid; grid-template-columns: clamp(220px, 17vw, 320px) 1fr; gap: 4vw; align-items: center; flex: 1; min-height: 0; }
@media (max-width: 800px) { .ringrow { grid-template-columns: 1fr; } .screen .join { grid-template-columns: 1fr; } .screen .join .qr { width: min(90vw, 420px); } body[data-mode=screen] { overflow: auto; } .screen { height: auto; min-height: 100vh; } }
.ring { position: relative; width: 100%; aspect-ratio: 1; animation: breathe 2.8s ease-in-out infinite; }
.ring.full { animation: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; }
.ring .bg { stroke: rgba(255, 255, 255, .1); }
.ring .fg { stroke: var(--accent-on-dark); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset .8s var(--ease), stroke .3s; }
.ring.full .fg { stroke: #4ade80; }
.ring .rt { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .rt b { font-size: clamp(3rem, 4.6vw, 5.6rem); line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -.03em; } .ring .rt span { color: #b4bfdc; font-size: clamp(1rem, 1.25vw, 1.5rem); font-weight: 600; margin-top: 6px; }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.03); } }
.screen .bars .b { margin: 1.8vh 0; }
.screen .bars .lbl { font-size: clamp(1.3rem, 1.9vw, 2.3rem); margin-bottom: 1vh; }
.screen .bars .lbl span:last-child { color: #d5dcef; }
.screen .bars .tr { height: clamp(36px, 5.4vh, 64px); background: rgba(255, 255, 255, .07); border-radius: 12px; }
.screen .bars .fill { border-radius: 12px; }
.screen .bars .b.correct .lbl span:first-child, .screen .bars .b.correct .lbl span:last-child::after { color: #4ade80; }
.screen .tiles { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px; margin-bottom: 3vh; }
.screen .tile { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .1); padding: 2vh 16px; }
.screen .tile b { color: #fff; font-size: clamp(2rem, 3.2vw, 3.8rem); } .screen .tile span { color: #b4bfdc; font-size: clamp(.9rem, 1.1vw, 1.3rem); }
.screen .ans { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .1); font-size: clamp(1.2rem, 1.6vw, 1.9rem); color: #fff; padding: 1.6vh 22px 1.6vh 26px; box-shadow: none; }
.screen .ans::before { background: var(--accent-on-dark); }
.screen .ans small { color: #b4bfdc; font-size: .7em; }
.screen .stage:has(> .ans) { justify-content: flex-start; overflow: hidden; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr)); align-content: start; gap: 14px; }
.screen .stage > .ans { margin: 0; }
.screen .ans.qa .vt { font-size: 1em; color: var(--warm-on-dark); }
.screen .cloud { font-size: clamp(1.1rem, 1.5vw, 1.9rem); max-height: 62vh; overflow: hidden; }
.screen .cloud span { filter: brightness(1.3); } /* the shared palette is tuned for white; lift it on navy */
.screen .plot { width: min(100%, 62vh); max-width: none; border-color: rgba(255, 255, 255, .2); }
.screen .plot .ax { font-size: clamp(.9rem, 1.1vw, 1.3rem); }
.screen .plot .d { width: 26px; height: 26px; margin: -13px 0 0 -13px; border-width: 3px; }
.screen .plot .qn { font-size: clamp(1.8rem, 2.6vw, 3rem); }
.screen .fx .fl { bottom: 30px; font-size: 3rem; }
.screen .hist { height: 42vh; gap: 1vw; } .screen .hist .hc i { background: var(--accent-on-dark); border-radius: 12px 12px 4px 4px; }
.screen .hist .hc span { font-size: clamp(1.3rem, 1.8vw, 2.2rem); color: #fff; } .screen .hist .hc b { font-size: clamp(1.1rem, 1.5vw, 1.8rem); color: #b4bfdc; }
.screen .stage > p.muted:only-child { text-align: center; font-size: clamp(1.4rem, 2vw, 2.4rem); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } .tick path { stroke-dashoffset: 0; } }
