:root {
  --navy: #0f1b3d; --navy2: #1b2b5c; --teal: #14b8a6; --teal-d: #0d8f81; --amber: #f59e0b; --coral: #f43f5e; --violet: #8b5cf6; --sky: #38bdf8;
  --ink: #16213e; --muted: #64708a; --line: #e3e8f2; --bg: #f4f6fb; --card: #fff;
  --ok: #10b981; --mid: #f59e0b; --bad: #ef4444; --none: #cbd2e1;
  --r: 16px; --shadow: 0 6px 24px rgba(15, 27, 61, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 16px/1.5 "Plus Jakarta Sans", system-ui, "Segoe UI", sans-serif; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 560px; margin: 0 auto; padding: 16px 16px 110px; }

/* hero and cards */
.hero { background: linear-gradient(135deg, var(--navy), var(--navy2) 55%, #24407e); color: #fff; padding: 28px 22px 64px; border-radius: 0 0 28px 28px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(20, 184, 166, .55), transparent 70%); }
.brand { font-weight: 800; letter-spacing: .5px; font-size: 1.6rem; }
.brand span { color: var(--teal); }
.hero p { opacity: .85; margin: .3rem 0 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; animation: rise .35s ease both; }
.lift { margin-top: -44px; position: relative; z-index: 1; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
label { display: block; font-weight: 700; font-size: .9rem; margin: .8rem 0 .3rem; }
input, select, textarea { width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(20, 184, 166, .2); }
textarea { min-height: 96px; resize: vertical; }
.btn { border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 700; cursor: pointer; background: var(--teal); color: #fff; transition: transform .1s, background .2s; }
.btn:hover { background: var(--teal-d); } .btn:active { transform: scale(.97); }
.btn.big { width: 100%; padding: 15px; font-size: 1.05rem; margin-top: 14px; }
.btn.ghost { background: #eaf7f5; color: var(--teal-d); } .btn.ghost:hover { background: #d7f1ed; }
.btn.dark { background: var(--navy); } .btn.warn { background: #fff1f2; color: var(--coral); }
.btn.sm { padding: 7px 11px; font-size: .85rem; border-radius: 9px; }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.muted { color: var(--muted); font-size: .9rem; } .err { color: var(--coral); font-weight: 600; } .note { color: var(--muted); font-size: .85rem; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; } .between { justify-content: space-between; }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: #eef1f7; color: var(--muted); }
.chip.open { background: var(--teal); color: #fff; } .chip.rev { background: var(--violet); color: #fff; }
.chip.g { background: #d1fae5; color: #047857; } .chip.a { background: #fef3c7; color: #b45309; } .chip.r { background: #fee2e2; color: #b91c1c; }

/* participant */
.topbar { position: sticky; top: 0; z-index: 5; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .narrow { padding: 10px 16px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--teal), var(--violet)); }
.who small { display: block; color: var(--muted); font-size: .8rem; }
.topbar select { width: auto; padding: 6px 10px; font-size: .85rem; border-radius: 99px; }
.progress { height: 6px; background: #e8ecf4; border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--teal), var(--violet)); transition: width .5s; }
.qcard .tag { color: var(--violet); font-weight: 800; font-size: .75rem; text-transform: uppercase; letter-spacing: .6px; }
.qcard h2 { font-size: 1.15rem; margin: .3rem 0 .8rem; }
.choices { display: grid; gap: 10px; }
.choice { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; padding: 14px; border-radius: 14px; border: 2px solid var(--line); background: #fff; font-weight: 600; cursor: pointer; transition: border-color .15s, transform .1s; color: var(--ink); }
.choice:hover { border-color: var(--teal); } .choice:active { transform: scale(.98); }
.choice .k { width: 32px; height: 32px; flex: none; border-radius: 9px; display: grid; place-items: center; color: #fff; font-weight: 800; }
.stars { display: flex; gap: 8px; justify-content: center; }
.stars button { font-size: 2.2rem; background: none; border: 0; cursor: pointer; filter: grayscale(1); opacity: .5; transition: transform .1s; }
.stars button:hover, .stars button.on { filter: none; opacity: 1; transform: scale(1.12); }
.yn { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.yn button { padding: 18px; border-radius: 14px; border: 0; font-weight: 800; font-size: 1.1rem; cursor: pointer; color: #fff; }
.scaleout { text-align: center; font-size: 2rem; font-weight: 800; color: var(--teal-d); }
input[type=range] { padding: 0; accent-color: var(--teal); }
.rank li { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 12px; margin-bottom: 8px; background: #fff; }
.rank ol { list-style: none; padding: 0; margin: 0; counter-reset: r; }
.rank li::before { counter-increment: r; content: counter(r); width: 26px; height: 26px; border-radius: 8px; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .85rem; flex: none; }
.rank li span { flex: 1; } .rank li button { border: 0; background: #eef1f7; border-radius: 8px; width: 34px; height: 34px; cursor: pointer; font-size: 1rem; }
.pad { position: relative; aspect-ratio: 1; border-radius: 14px; background:
  linear-gradient(#fff0, #fff0) padding-box, conic-gradient(from 90deg at 50% 50%, #e0f7f4 0 25%, #ede9fe 0 50%, #fef3c7 0 75%, #e0f2fe 0) ; border: 2px solid var(--line); cursor: crosshair; touch-action: manipulation; }
.pad::before, .pad::after { content: ""; position: absolute; background: #b8c2d6; }
.pad::before { left: 50%; top: 0; bottom: 0; width: 1.5px; } .pad::after { top: 50%; left: 0; right: 0; height: 1.5px; }
.pad .ax { position: absolute; font-size: .72rem; font-weight: 700; color: var(--muted); background: rgba(255, 255, 255, .85); padding: 1px 6px; border-radius: 6px; z-index: 1; }
.pad .dot { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--coral); border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); z-index: 2; }
.timer { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--coral); margin-bottom: 10px; }
.timer .tb { flex: 1; height: 8px; border-radius: 99px; background: #ffe4e6; overflow: hidden; } .timer .tb i { display: block; height: 100%; background: var(--coral); transition: width 1s linear; }
.sent { text-align: center; padding: 26px 10px; } .sent .big { font-size: 2.6rem; }
.react { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; display: flex; justify-content: center; gap: 6px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, .95); border-top: 1px solid var(--line); backdrop-filter: blur(8px); }
.react button { font-size: 1.6rem; width: 52px; height: 52px; border-radius: 50%; border: 0; background: #f1f4fa; cursor: pointer; transition: transform .1s; }
.react button:active { transform: scale(.85); }
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 20; overflow: hidden; }
.fx .fl { position: absolute; bottom: 70px; 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: 9px; height: 14px; 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: 34px 16px; }
.pulse { display: inline-flex; gap: 6px; margin-bottom: 12px; } .pulse i { width: 12px; height: 12px; border-radius: 50%; background: var(--teal); animation: pl 1.2s infinite ease-in-out; }
.pulse i:nth-child(2) { animation-delay: .15s; background: var(--violet); } .pulse i:nth-child(3) { animation-delay: .3s; background: var(--amber); }
@keyframes pl { 0%, 80%, 100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

/* trainer */
.tbar { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 5; }
.tbar .wrap { padding: 10px 16px; }
.tbar select { width: auto; padding: 7px 10px; border-radius: 9px; border: 0; }
.tabs { display: flex; gap: 4px; background: rgba(255, 255, 255, .08); padding: 4px; border-radius: 11px; }
.tabs button { border: 0; background: none; color: #cdd6ee; padding: 7px 14px; border-radius: 8px; font-weight: 700; cursor: pointer; }
.tabs button.on { background: #fff; color: var(--navy); }
.cols { display: grid; grid-template-columns: 400px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }
.qi { border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; background: #fff; cursor: pointer; transition: border-color .15s; }
.qi:hover { border-color: #b9c4dc; } .qi.sel { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(20, 184, 166, .15); }
.qi .p { font-weight: 600; margin: 4px 0 8px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow); }
.kpi b { display: block; font-size: 1.8rem; color: var(--navy); } .kpi span { color: var(--muted); font-size: .85rem; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.scroll { overflow-x: auto; }
.cell { width: 30px; height: 26px; border-radius: 6px; 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: #eef1f7; color: #9aa4ba; }

/* results (shared by trainer and screen) */
.bars .b { margin: 10px 0; } .bars .lbl { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 4px; }
.bars .tr { height: 30px; background: #eef1f7; border-radius: 9px; overflow: hidden; }
.bars .fill { height: 100%; border-radius: 9px; transition: width .7s cubic-bezier(.2, .8, .2, 1); }
.bars .b.correct .lbl::after { content: " ✓ correct"; color: var(--ok); }
.cloud { text-align: center; line-height: 1.15; padding: 10px; }
.cloud span { display: inline-block; margin: 6px 12px; font-weight: 800; animation: rise .5s ease both; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 12px; }
.tile { background: #f4f7fc; border-radius: 12px; padding: 12px; text-align: center; } .tile b { display: block; font-size: 1.6rem; color: var(--navy); } .tile span { font-size: .8rem; color: var(--muted); }
.ans { border: 1px solid var(--line); border-left: 5px solid var(--teal); border-radius: 10px; padding: 10px 12px; margin: 8px 0; background: #fff; animation: rise .35s ease both; }
.ans small { display: block; color: var(--muted); }
.plot { position: relative; aspect-ratio: 1; max-width: 520px; margin: 0 auto; border-radius: 14px; border: 2px solid var(--line); background: conic-gradient(from 90deg at 50% 50%, #e0f7f4 0 25%, #ede9fe 0 50%, #fef3c7 0 75%, #e0f2fe 0); }
.plot::before, .plot::after { content: ""; position: absolute; background: #b8c2d6; }
.plot::before { left: 50%; top: 0; bottom: 0; width: 1.5px; } .plot::after { top: 50%; left: 0; right: 0; height: 1.5px; }
.plot .ax { position: absolute; font-size: .78rem; font-weight: 700; color: var(--muted); background: rgba(255, 255, 255, .85); padding: 1px 6px; border-radius: 6px; z-index: 1; }
.plot .d { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2px solid #fff; opacity: .85; animation: rise .4s ease both; z-index: 2; }
.plot .qn { position: absolute; font-weight: 800; font-size: 1.1rem; color: var(--navy); opacity: .55; }
.lead li { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 10px; margin: 6px 0; background: #f4f7fc; font-weight: 700; }
.lead li:first-child { background: linear-gradient(90deg, #fde68a, #fef3c7); }

/* projector screen */
body[data-mode=screen] { background: radial-gradient(ellipse at top, #1d2f66, var(--navy) 60%); color: #fff; min-height: 100vh; }
.screen { padding: 34px 48px; min-height: 100vh; display: flex; flex-direction: column; }
.screen .brand { font-size: 1.4rem; }
.screen h1 { font-size: clamp(1.8rem, 3.4vw, 3rem); margin: 18px 0 10px; }
.screen .meta { color: #a9b6da; font-size: 1.1rem; }
.screen .stage { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.screen .bars .tr { height: 46px; background: rgba(255, 255, 255, .08); } .screen .bars .lbl { font-size: 1.35rem; }
.screen .tile, .screen .lead li { background: rgba(255, 255, 255, .08); } .screen .tile b { color: #fff; } .screen .tile span { color: #a9b6da; }
.screen .lead li:first-child { background: linear-gradient(90deg, #f59e0b, #fbbf24); color: var(--navy); }
.screen .ans { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .12); border-left-color: var(--teal); font-size: 1.25rem; color: #fff; }
.screen .ans small { color: #a9b6da; }
.screen .cloud span { color: #fff; }
.screen .big-count { font-size: clamp(4rem, 10vw, 8rem); font-weight: 800; background: linear-gradient(90deg, var(--teal), var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.screen .timer { font-size: 2rem; color: #fda4af; } .screen .timer .tb { height: 12px; background: rgba(255, 255, 255, .1); }
.screen .join { display: grid; grid-template-columns: auto 1fr; gap: 48px; align-items: center; }
.screen .join img { background: #fff; padding: 14px; border-radius: 20px; }
.screen .url { font-size: clamp(1.6rem, 3vw, 2.6rem); font-weight: 800; color: var(--teal); }
.screen .plot { max-width: 60vh; }
.screen .fx .fl { bottom: 30px; font-size: 3rem; }
