html, body { height: 100%; overflow: hidden; }
#host { position: fixed; inset: 0; }

#quiz {
  position: fixed; inset: 0; overflow-y: auto; padding: max(28px, env(safe-area-inset-top)) 20px max(28px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px; max-width: 560px; margin: 0 auto;
}
/* centred when it fits, scrolls from the top when it doesn't (justify-content: center would cut the top off) */
#quiz { justify-content: flex-start; }
#quiz > :first-child { margin-top: auto; }
#quiz > :last-child { margin-bottom: auto; }
.qprompt { font-size: clamp(20px, 5.5vw, 26px); font-weight: 600; line-height: 1.25; margin: 0 0 6px; }
#quiz pre { margin: 0; font: 14px/1.45 ui-monospace, monospace; background: #0e0e10; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; white-space: pre-wrap; overflow-x: auto; }
.col { display: flex; flex-direction: column; gap: 10px; }

.opts { display: flex; flex-direction: column; gap: 8px; }
.opt { display: flex; gap: 14px; align-items: center; text-align: left; padding: 14px 16px; background: #0e0e10; border: 1px solid var(--line); border-radius: 10px; }
.opt b { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; border: 1px solid #444; font-size: 14px; color: var(--mute); }
.opt.pick, .opt.sel { border-color: var(--accent); }
.opt.pick b, .opt.sel b { background: var(--accent); border-color: var(--accent); color: #111; }

.scale { display: grid; grid-template-columns: repeat(auto-fit, minmax(44px, 1fr)); gap: 8px; }
.scale button { font-size: 18px; font-weight: 600; padding: 14px 0; background: #0e0e10; border: 1px solid var(--line); }
.scale button.sel { background: var(--accent); border-color: var(--accent); color: #111; }
.scale-l { display: flex; justify-content: space-between; color: var(--mute); font-size: 13px; }

.saved { margin: 0; min-height: 1.2em; color: var(--mute); font-size: 14px; }

/* results on a phone (#results itself gets the .res class) */
#results { margin-top: 10px; font-size: 14px; }
#results .bar { grid-template-columns: 28px 1fr 44px; grid-template-rows: auto 8px; gap: 4px 12px; font-size: 15px; }
#results .key { width: 28px; height: 28px; font-size: 13px; border-width: 1px; grid-row: 1 / 3; grid-column: 1; }
#results .lbl { grid-row: 1; grid-column: 2; white-space: normal; overflow: visible; }
#results .track { grid-row: 2; grid-column: 2; height: 6px; }
#results .num { grid-row: 1 / 3; grid-column: 3; font-size: 13px; }
#results .hist { height: 140px; gap: 4px; }
#results .cnt, #results .clbl { font-size: 12px; }
#results .cloud { min-height: 0; font-size: 12px; }

/* "this or that" (waiting room game, at your own pace) */
.tot-top { display: flex; justify-content: space-between; color: var(--mute); font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.tot-progress { height: 4px; border-radius: 2px; background: #1c1c1f; overflow: hidden; margin-top: -4px; }
.tot-progress i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.tot-btns { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.tot-btn { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 96px; padding: 18px 20px; text-align: left; background: #0e0e10; border: 2px solid var(--line); border-radius: 16px; font-size: 22px; transition: border-color .15s, background .15s; }
.tot-btn b { font-weight: 800; }
.tot-btn .tot-pct { flex: none; font-size: 22px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.tot-btn.sel { border-color: var(--accent); background: rgba(221,180,13,.14); }
.tot-ou { align-self: center; color: var(--mute); font-size: 14px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
.tot-note { margin: -4px 0 0; text-align: center; color: var(--mute); font-size: 14px; }
.tot-mine { display: flex; flex-direction: column; gap: 4px; }
.tot-li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 12px; background: #0e0e10; border: 1px solid var(--line); border-radius: 8px; font-size: 15px; }
.tot-li b { flex: none; color: var(--accent); font-variant-numeric: tabular-nums; }

/* game on a phone: meters + scene above the options (gameHeader), consequence / report cards (renderSlide) */
.ghead { display: flex; flex-direction: column; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
:is(.ghead, .pcard) .meters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 4px; }
:is(.ghead, .pcard) .meter { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 9px 10px; background: #0e0e10; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; }
:is(.ghead, .pcard) .mlbl { color: var(--mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 54px; }
:is(.ghead, .pcard) .mval { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
:is(.ghead, .pcard) .money .mval { color: var(--accent); }
:is(.ghead, .pcard) .mbar { display: block; height: 6px; border-radius: 3px; background: #262626; overflow: hidden; order: 3; }
:is(.ghead, .pcard) .mfill { display: block; height: 100%; background: var(--accent); transition: width 1s cubic-bezier(.2,.7,.2,1) .3s; }
:is(.ghead, .pcard) .m-risco .mfill { background: var(--bad); }
:is(.ghead, .pcard) .mdelta { position: absolute; right: 8px; top: 8px; font: 800 12px system-ui, sans-serif; font-style: normal; padding: 1px 6px; border-radius: 5px; animation: g-delta 4s ease-out .4s both; }
:is(.ghead, .pcard) .mdelta.up { background: var(--accent); color: #000; }
:is(.ghead, .pcard) .mdelta.down { background: #3a3a3a; color: #fff; }
:is(.ghead, .pcard) .m-risco .mdelta.up { background: var(--bad); color: #fff; }
:is(.ghead, .pcard) .m-risco .mdelta.down { background: var(--ok); color: #000; }
@keyframes g-delta { 0% { opacity: 0; transform: translateY(6px); } 10%, 100% { opacity: 1; transform: none; } }
:is(.ghead, .pcard) .kicker { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
:is(.ghead, .pcard) h1 { font-size: 23px; font-weight: 800; line-height: 1.2; margin: 0; }
:is(.ghead, .pcard) .narr { margin: 0; color: #d6d3cb; font-size: 15px; line-height: 1.5; }
.ghead .notif { padding: 10px 12px; border-radius: 12px; background: #16181d; border: 1px solid #333; animation: g-notif .5s cubic-bezier(.2,.8,.2,1) .8s both; }
@keyframes g-notif { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
.ghead .notif .nh { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; font-weight: 700; color: var(--mute); text-transform: uppercase; letter-spacing: .08em; }
.ghead .notif.tg .app { color: #3e9bff; } .ghead .notif.mail .app { color: var(--accent); }
.ghead .notif.note .app { color: var(--bad); } .ghead .notif.call .app { color: var(--ok); }
.ghead .notif .from { margin-top: 4px; font-size: 13px; font-weight: 700; }
.ghead .notif .nt { margin-top: 4px; font-size: 15px; line-height: 1.4; }
.ghead .notif.note .nt { font-family: ui-monospace, monospace; font-size: 14px; }
#quiz .ghead + .qprompt { font-size: 18px; }

.pcard { display: flex; flex-direction: column; gap: 12px; }
.pcard .obody { display: flex; flex-direction: column; gap: 12px; }
.pcard .narr { font-size: 17px; }
.pcard .note { margin: 0; padding-left: 12px; border-left: 3px solid var(--accent); color: var(--mute); font-size: 14px; }
.pcard .later { margin: 4px 0 0; color: var(--accent); font-weight: 700; font-size: 15px; }
.preport .rtop { display: flex; flex-direction: column; gap: 12px; }
.preport .grade b { display: block; font-size: 96px; line-height: .9; font-weight: 800; color: var(--accent); }
.preport .grade [data-grade="D"] b, .preport .grade [data-grade="E"] b { color: var(--bad); }
.preport .grade span { font-size: 22px; font-weight: 800; }
.preport .rverdict { margin: 0; font-size: 17px; font-weight: 600; }
.preport .gfinal { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preport .gf { display: flex; flex-direction: column; gap: 4px; padding: 9px 10px; background: #0e0e10; border: 1px solid var(--line); border-radius: 10px; }
.preport .gf span { font-size: 11px; color: var(--mute); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; }
.preport .gf b { font-size: 18px; }
.preport .lessons { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.preport .lessons li { padding-left: 12px; border-left: 3px solid var(--accent); font-size: 15px; line-height: 1.4; }
.preport .legal { color: var(--mute); font-size: 12px; }

#off { position: fixed; top: 8px; right: 10px; font-size: 12px; color: var(--mute); z-index: 9; }

/* laptops: same layout, just bigger (most students follow on a PC) */
@media (min-width: 900px) and (min-height: 560px) {
  #quiz { max-width: 760px; gap: 18px; }
  .qprompt { font-size: 34px; margin-bottom: 10px; }
  #quiz pre { font-size: 17px; padding: 16px 18px; }
  .opts { gap: 10px; }
  .opt { font-size: 20px; padding: 18px 20px; gap: 18px; }
  .opt:hover { border-color: #555; }
  .opt b { width: 34px; height: 34px; font-size: 16px; }
  .scale button { font-size: 22px; padding: 18px 0; }
  .scale button:hover { border-color: #555; }
  .scale-l, .saved { font-size: 16px; }
  #quiz input { font-size: 20px; padding: 16px 18px; }
  #quiz .send { font-size: 18px; padding: 14px; }
  #results { font-size: 16px; }
  #results .bar { grid-template-columns: 34px 1fr 56px; grid-template-rows: auto 10px; font-size: 18px; }
  #results .key { width: 34px; height: 34px; font-size: 15px; }
  #results .track { height: 10px; }
  #results .num { font-size: 16px; }
  #results .hist { height: 200px; }
  #results .cnt, #results .clbl { font-size: 15px; }
  #results .cloud { font-size: 15px; }
}
