/* Paru-paruku Kesayanganku — Tantangan Tahan Napas */

[hidden] { display: none !important; }
:root {
  --blue: #0000c9; --blue-2: #1f3bff; --sky: #38b6ff; --ink: #0d1330; --muted: #5b6485;
  --bg: #f3f6ff; --card: #fff; --line: #e3e8f7; --gold: #f5b400; --silver: #9aa6bf; --bronze: #e0782f;
  --ok: #12a150; --bad: #e0342b;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body { font-family: Inter, system-ui, sans-serif; background: var(--bg); color: var(--ink); overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select { font: inherit; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }

.page { min-height: 100dvh; padding: 0 16px calc(40px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }
.boot { padding: 40vh 20px; text-align: center; color: var(--muted); }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: calc(14px + env(safe-area-inset-top)) 0 14px; min-height: 62px; }
.logo { height: 34px; width: auto; }
.logo:not([src]) { visibility: hidden; }
.tag { font-size: 12px; font-weight: 700; color: var(--blue); background: #e6e9ff; padding: 5px 10px; border-radius: 99px; }
.tag:empty { display: none; }
.live { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 800; color: #fff; background: var(--ok); padding: 5px 10px; border-radius: 99px; letter-spacing: .06em; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }

.hero { text-align: center; padding: 24px 4px 20px; }
.lungs { font-size: 64px; line-height: 1; margin-bottom: 8px; animation: breathe 3s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.12); } }
.hero h1 { font-family: Fredoka, Inter, sans-serif; font-size: 40px; line-height: 1.05; color: var(--blue); }
.hero h1 .accent { color: var(--sky); -webkit-text-stroke: 1px var(--blue); }
.hero .sub { color: var(--muted); margin: 12px auto 22px; max-width: 360px; }

.btn { display: block; width: 100%; padding: 13px 18px; border-radius: 14px; font-weight: 700; font-size: 15px; text-align: center; transition: transform .08s; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 8px 20px rgba(0,0,201,.25); }
.btn.primary:disabled { opacity: .4; box-shadow: none; cursor: default; }
.btn.big { padding: 16px 18px; font-size: 17px; }
.btn.ghost { color: var(--blue); margin-top: 8px; }
.btn.light { background: rgba(255,255,255,.95); color: var(--blue); }
.btn.ghost.light { color: #fff; background: transparent; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: 0 6px 24px rgba(13,19,48,.05); margin-bottom: 14px; }
.card h2 { font-size: 20px; margin-bottom: 14px; }
.card h3 { font-size: 15px; margin-bottom: 10px; color: var(--blue); }
.how ol { padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
.fine { font-size: 12px; color: var(--muted); margin-top: 12px; line-height: 1.5; }
.center { text-align: center; }
.muted { color: var(--muted); text-align: center; padding: 20px; }
.notice { font-size: 13px; line-height: 1.5; background: #e6e9ff; color: var(--ink); border-radius: 12px; padding: 10px 12px; margin-bottom: 14px; }
.notice-error { background: #fff0ef; color: var(--bad); }

/* ---------- GAME ---------- */
.screen.game { position: fixed; inset: 0; background: #000; overflow: hidden; color: #fff; }
#cam { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.g-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; padding: calc(12px + env(safe-area-inset-top)) 14px 0; z-index: 5; }
.icon-btn { width: 38px; height: 38px; border-radius: 50%; background: rgba(0,0,0,.45); font-size: 16px; }
.rec { font-size: 11px; font-weight: 800; background: rgba(224,52,43,.9); padding: 6px 10px; border-radius: 99px; height: fit-content; }
.g-center { position: absolute; left: 16px; right: 16px; bottom: calc(120px + env(safe-area-inset-bottom)); text-align: center; font-family: Fredoka, sans-serif; font-size: 20px; font-weight: 600; text-shadow: 0 2px 8px rgba(0,0,0,.7); z-index: 4; pointer-events: none; }
.g-loading, .g-error { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: #050a2e; z-index: 6; padding: 24px; text-align: center; }
.g-error .btn { max-width: 320px; }
.g-error p { color: #c9d0ff; font-size: 14px; max-width: 340px; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 4px solid rgba(255,255,255,.2); border-top-color: var(--sky); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.g-result { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); z-index: 5; background: linear-gradient(0deg, rgba(0,0,40,.85), rgba(0,0,40,0)); }
.res-actions { max-width: 420px; margin: 0 auto; display: grid; gap: 10px; }
.res-actions .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.res-actions .row .btn { font-size: 14px; padding: 12px 8px; }
.finish-btn { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 5; background: rgba(0,0,0,.55); color: #fff; font-size: 13px; font-weight: 600; padding: 10px 16px; border-radius: 99px; border: 1px solid rgba(255,255,255,.4); white-space: nowrap; }

.sim-btn {
  position: absolute; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 170px); transform: translateX(-50%); z-index: 5;
  padding: 12px 20px; border-radius: 99px; border: 2px dashed rgba(255,255,255,.6);
  background: rgba(0,0,0,.35); color: #fff; font-weight: 600; font-size: 14px; touch-action: none;
  user-select: none; -webkit-user-select: none; white-space: nowrap;
}
.sim-btn.is-down { background: var(--sky); color: var(--ink); border-style: solid; }
.debug {
  position: absolute; left: 10px; top: calc(env(safe-area-inset-top) + 60px); z-index: 7; padding: 8px 10px;
  font: 12px/1.4 ui-monospace, monospace; background: rgba(0,0,0,.6); color: #9ff; border-radius: 8px;
}

/* ---------- FORM ---------- */
form { display: grid; gap: 14px; }
.field-label, form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.fields { display: grid; gap: 14px; }
.fields .hint { font-size: 12px; font-weight: 400; color: var(--muted); }
input[type=text], select { width: 100%; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fbfcff; color: var(--ink); font-size: 16px; outline: none; }
select { appearance: none; -webkit-appearance: none; padding-right: 38px;
  background: #fbfcff 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='%235b6485' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center; }
input:focus, select:focus { border-color: var(--blue); }
.invalid input, .invalid select { border-color: var(--bad); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #eef1fb; border-radius: 12px; padding: 4px; }
.seg button { padding: 10px; border-radius: 9px; font-weight: 700; color: var(--muted); font-size: 14px; }
.seg button.on { background: #fff; color: var(--blue); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
form label.check { grid-template-columns: 22px 1fr; align-items: start; font-weight: 500; color: var(--ink); font-size: 13px; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--blue); }
.err { color: var(--bad); font-size: 13px; min-height: 1em; }
.err:empty { display: none; }
.score-chip { display: inline-block; background: #e6e9ff; color: var(--blue); border-radius: 99px; padding: 6px 12px; font-size: 13px; margin-bottom: 10px; }
.score-chip b { font-size: 16px; }

/* ---------- QUIZ ---------- */
.progress { height: 6px; background: #eef1fb; border-radius: 99px; overflow: hidden; margin-bottom: 16px; }
.progress i { display: block; height: 100%; background: var(--blue); width: 20%; transition: width .3s; }
.quiz h2 { font-size: 18px; line-height: 1.35; }
.opts { display: grid; gap: 10px; margin-bottom: 10px; }
.opt { display: flex; gap: 12px; align-items: center; text-align: left; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fbfcff; font-size: 15px; }
.opt b { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #eef1fb; color: var(--blue); font-size: 13px; text-transform: uppercase; }
.opt:disabled { cursor: default; color: inherit; }
.opt.right { border-color: var(--ok); background: #ecfbf2; }
.opt.right b { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: #fff0ef; }
.opt.wrong b { background: var(--bad); color: #fff; }
.why { font-size: 13px; color: var(--muted); min-height: 1.2em; margin-bottom: 14px; }

/* ---------- BOARD ---------- */
.board-hero { text-align: center; padding: 6px 0 14px; }
.board-hero h1 { font-family: Fredoka, sans-serif; color: var(--blue); font-size: 26px; line-height: 1.15; }
.board-hero p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: #e6e9ff; border-radius: 14px; padding: 4px; margin-bottom: 12px; }
.tabs button { padding: 11px; border-radius: 11px; font-weight: 700; color: var(--blue); font-size: 14px; }
.tabs button.on { background: var(--blue); color: #fff; }
.me { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: linear-gradient(135deg, var(--blue), var(--blue-2)); color: #fff; border: 0; }
.me-label { font-size: 12px; opacity: .8; }
.me-rank { font-family: Fredoka, sans-serif; font-size: 40px; line-height: 1; }
.me-break { text-align: right; font-size: 13px; line-height: 1.5; }
.me-break b { font-size: 22px; }
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 8px; margin: 4px 0 18px; min-height: 40px; }
.podium:empty { display: none; }
.pod { text-align: center; min-width: 0; }
.pod .av { width: 48px; height: 48px; border-radius: 50%; margin: 0 auto 6px; display: grid; place-items: center; font-size: 24px; background: #eef1fb; border: 3px solid #fff; box-shadow: 0 4px 10px rgba(0,0,0,.1); }
.pod.p1 .av { width: 60px; height: 60px; font-size: 30px; background: #fff6d6; }
.pod .nm { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pod .in { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pod .blk { margin-top: 6px; border-radius: 10px 10px 0 0; color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 15px; }
.pod.p1 .blk { height: 84px; background: linear-gradient(var(--gold), #d99500); }
.pod.p2 .blk { height: 62px; background: linear-gradient(#b7c1d6, var(--silver)); }
.pod.p3 .blk { height: 48px; background: linear-gradient(#f39a57, var(--bronze)); }
table.board { width: 100%; border-collapse: collapse; font-size: 14px; }
.board th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.board td { padding: 11px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; word-break: break-word; }
.board td .sub { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.board .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.board td.num.total { font-weight: 800; color: var(--blue); }
.board tr.mine { background: #fff8dc; }
.board tr.mine td:first-child { box-shadow: inset 4px 0 0 var(--gold); }
.no-quiz .quiz-col { display: none; }
.cta-row { margin-top: 6px; }
@media (max-width: 520px) { .hide-sm { display: none; } }
@media (min-width: 521px) { .board td .sub.inst-sm { display: none; } }

/* Mode layar besar (booth/event): ?tv=1 atau ?screen=1 */
body.bigscreen .page { max-width: 1100px; }
body.bigscreen .board-hero h1 { font-size: 44px; }
body.bigscreen table.board { font-size: 20px; }
body.bigscreen .cta-row, body.bigscreen #you, body.bigscreen #you-review { display: none !important; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 40px); opacity: 0; background: #0d1330; color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; transition: .25s; z-index: 50; max-width: 90vw; text-align: center; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  .lungs, .live i { animation: none; }
  .btn, .progress i, .toast { transition: none; }
}
