/* Tab on a phone (loaded only below 600 px wide, or in landscape under 500 px tall: see the media attribute in index.html).
   No scaled canvas here: a normal single-column layout at native size (1rem = 10 px, body text 16 px or more).
   The page scrolls, and the main button of each screen sits in a bar that sticks to the bottom. */

/* ---------- page: native size, scrolling ---------- */
html:has(.canvas) { overflow-x: hidden; overflow-x: clip; overflow-y: auto; }
html:has(.canvas) body { overflow: visible; }
html, body { height: auto; min-height: 100%; }
body { font-size: 1.6rem; }
.canvas { position: relative; left: auto; top: auto; width: auto; height: auto; margin: 0; transform: none; min-height: 100vh; min-height: 100dvh;
  --vw: 1vw; --vh: 1vh; --vmax: 1vmax; }
.bleed::before, .bleed::after { display: none; }
#app { height: auto; min-height: 100vh; min-height: 100dvh; }
.screen { position: fixed; inset: 0; transform: none; }
.screen.active { position: relative; inset: auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- backdrop: fixed behind the page; one tonal band, no bright slab edges behind text ---------- */
.backdrop { position: fixed; inset: 0; overflow: hidden; }
.backdrop .bg-field, .backdrop .shade { inset: 0; }
/* a navy wash keeps 16 px text at AA over the brightest parts of the backdrop */
.backdrop .shade { background: linear-gradient(rgba(0, 14, 56, .5), rgba(0, 14, 56, .5)), radial-gradient(140% 90% at 50% 40%, transparent 55%, rgba(0, 6, 30, .55) 100%); }
.backdrop .sl.s, .backdrop .sl.e, .backdrop .sl.ln, .backdrop .sl.y, .backdrop .sl.w { display: none; }
.backdrop .sl.e2 { left: -50%; width: 200%; top: 46vh; height: 120vh; transform: skewY(-7deg); opacity: .6; }
.backdrop .bg-speed { left: -20vw; top: 0; width: 120vw; height: 100%; }
.backdrop .bg-glow { transform: translate3d(60vw, 20vh, 0); }
.backdrop .bg-sweep { top: -20%; height: 140%; }

/* ---------- shared pieces at phone size ---------- */
.chip { height: 3.2rem; padding: 0 1.3rem; max-width: 100%; }
.scene .chip .eyebrow, .form-brand .chip .eyebrow, .res-main .chip .eyebrow, .paused .chip .eyebrow, .q-head .eyebrow { font-size: 1.1rem; letter-spacing: .06em; }
.btn { min-height: 5.6rem; padding: 0 2rem; gap: 1.2rem; font-size: 2rem; }
.btn::before { left: -1.1rem; width: .4rem; }
/* the bar that holds the main button of a screen */
.home-bar, .form-actions, .res-actions, .feedback {
  position: sticky; bottom: 0; z-index: 5; margin-top: auto;
  background: linear-gradient(180deg, #06185f, var(--space-blue)); box-shadow: inset 0 1px 0 rgba(181, 210, 244, .35), 0 -.8rem 2rem rgba(0, 4, 26, .35);
  padding: 1.2rem 1.8rem calc(1.2rem + env(safe-area-inset-bottom, 0px)) 2.4rem;
  overflow: hidden; }   /* the button sheen must not widen the page */

/* ---------- 1. Home ---------- */
#screen-home.active { padding: 2rem 2rem 0; }
.loop { position: relative; left: auto; right: auto; top: auto; bottom: auto; width: auto; height: 23.6rem; flex: none; }
.scene { justify-content: flex-start; }
/* headings start below the logo plate (6.5rem high, top right) */
.home-title { margin-top: 2.7rem; font-size: 5.8rem; max-width: none; }
.home-subrow { margin-top: 1.6rem; gap: 1.2rem; }
.home-subrow .dash { width: 3.6rem; height: .4rem; }
.home-sub { font-size: 2.3rem; }
.ch-score { gap: 1.2rem; margin-top: 2.7rem; }
.ch-num { font-size: 7.4rem; }
.ch-unit { font-size: 1.8rem; padding-bottom: .7rem; }
.ch-sectors { gap: .5rem; margin-top: 1.6rem; }
.ch-sectors i { width: 5.2rem; height: 2.8rem; }
.ch-sectors b { font-size: 1.3rem; }
.ch-tag { margin-top: 1.4rem; font-size: 1.7rem; max-width: none; }
.ch-how { margin-top: .8rem; gap: .3rem 1rem; font-size: 1.6rem; }
.prize-head { margin-top: 3.6rem; font-size: 3.6rem; max-width: none; }
.prize-list { margin-top: 1.4rem; gap: .8rem; }
.prize-list li { gap: 1.2rem; }
.pl-place { width: 6rem; height: 3.4rem; }
.pl-place b { font-size: 1.8rem; }
.pl-name { font-size: 1.9rem; }

/* prizes: a white panel in the page, one row per prize (photo, then badge and name plate) */
#prizeRow { position: relative; inset: auto; flex: none; margin: 1.2rem 0 2rem; padding: 1.2rem 1.4rem; display: flex; flex-direction: column; gap: .8rem;
  background: #fff; border-radius: var(--r); box-shadow: var(--elev), 0 0 4rem rgba(25, 83, 255, .45); --plate-h: 3.2rem; --plate-fs: 1.5rem; }
#prizeRow .pz.p1, #prizeRow .pz.p2, #prizeRow .pz.p3 { position: relative; left: auto; top: auto; bottom: auto; width: auto; height: 6.9rem; flex-direction: row; align-items: center; justify-content: flex-start; --z: 1; }
#prizeRow .pz.p1 { height: 8.4rem; }
#prizeRow .pz-pic { flex: none; width: 9rem; height: 100%; animation: none; }
#prizeRow .pz-tag { align-self: center; align-items: flex-start; margin: 0 0 0 1.6rem; gap: .5rem; }
#prizeRow .pz-floor, #prizeRow .pz::before { display: none; }
#prizeRow .pz-pic img { filter: none; }
#prizeRow .pz-chip { background: linear-gradient(180deg, #06185f, var(--space-blue)); color: #fff; }
#prizeRow .pz.p1 .pz-chip { background: linear-gradient(90deg, #f1c35c, var(--gold) 50%, var(--gold-deep)); color: var(--space-blue); }
#prizeRow .pz.card .pz-pic { width: 9rem; height: 100%; margin: 0; border-radius: 0; box-shadow: none; }
#prizeRow .pz-name { box-shadow: var(--edge); }
#prizeRow .pz-chip { height: 3rem; padding: 0 1.2rem; }
#prizeRow .pz-chip b { font-size: 1.7rem; }
#prizeRow .pz-name { padding: 0 1.2rem; }
@media (max-width: 379px) { #prizeRow { padding: 1.2rem 1rem; } #prizeRow .pz-pic { width: 6.6rem; } #prizeRow .pz-tag { margin-left: 1.2rem; } }

.home-bar { left: auto; right: auto; height: auto; margin-left: -2rem; margin-right: -2rem; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 1rem; }
.hb-info { flex-direction: row; align-items: center; justify-content: space-between; gap: 1.2rem; }
.hb-round { flex: 1; gap: .7rem; font-size: 1.6rem; min-width: 0; }
.hb-round .chip { flex: none; white-space: nowrap; }
.hb-round .live-dot { flex: none; }
.hb-text { min-width: 0; }
.hb-round .chip { height: 3.2rem; padding: 0 1rem; font-size: 1.6rem; }
.home-locked { font-size: 1.6rem; }
.scene-dots { gap: .5rem; padding: 0; flex: none; }
@media (max-width: 479px) { .scene-dots { display: none; } }
.scene-dots i { width: 2.2rem; }
.tap-btn { width: auto; margin: 0; align-self: stretch; min-height: 5.6rem; font-size: 2.1rem; }

/* ---------- 2. Form ---------- */
.form-layout { position: relative; inset: auto; flex: 1; display: flex; flex-direction: column; gap: 0; padding: 2rem 2rem 0; align-items: stretch; }
.fb-title { margin-top: 2.6rem; font-size: 3.8rem; }
.fb-lead { margin-top: .8rem; font-size: 1.6rem; }
.steps { display: none; }
.form-card { flex: 1; display: flex; flex-direction: column; max-width: none; margin: 1.8rem -2rem 0; padding: 1.8rem 2rem 0; border-radius: 0; justify-self: auto; }
.fc-head { gap: 1.2rem; margin-bottom: 1.4rem; }
.fc-head .chip { height: 3rem; padding: 0 1.2rem; }
.fc-head .cap { font-size: 1.1rem; }
.fc-head h3 { font-size: 2.3rem; }
.fields { display: block; margin: 0; }
.fields .field, .field { margin-bottom: 1.2rem; }
.field input, .field .pick-btn { height: 5.8rem; padding: 2.3rem 1.4rem .4rem; font-size: 1.7rem; }
.field .pick-btn { padding-right: 4rem; }
.field .pick-btn .chev { right: 1.2rem; margin-top: -.9rem; font-size: 1.8rem; }
.field.pick.has-val label { transform: translate3d(0, -1.1rem, 0) scale(.78); }
.form-layout { transition: none; }
.field label { left: 1.4rem; top: 1.8rem; font-size: 1.6rem; }
.field input:focus + label, .field input:not(:placeholder-shown) + label { transform: translate3d(0, -1.1rem, 0) scale(.78); }
.field.phone .cc { min-width: 10.6rem; height: 5.8rem; }
.field.phone .cc-face { gap: .7rem; padding: 0 .8rem 0 1.2rem; font-size: 1.7rem; }
.field.phone .cc-face .flag { width: 2.4rem; height: 1.7rem; }
.field.phone .cc-face .flag.globe { width: 2.2rem; height: 2.2rem; }
.field.phone .cc-face .chev { font-size: 1.6rem; }
.field.phone input, .field.phone input:focus, .field.phone.invalid input { padding-left: 1.2rem; }
.field.phone label { margin-left: 1.2rem; }
.consent { gap: 1.2rem; padding: 1rem 1.2rem; margin-bottom: 1.2rem; }
.consent .box { width: 2.8rem; height: 2.8rem; }
.consent .box .ic { font-size: 2rem; }
.consent-text { font-size: 1.6rem; line-height: 1.35; }
.form-error { gap: 1rem; padding: 1rem 1.2rem; margin-bottom: 1.2rem; font-size: 1.6rem; }
.form-error .ic { font-size: 2rem; }
.form-actions { margin-left: -2rem; margin-right: -2rem; gap: 1.2rem; }
.form-actions .btn { min-height: 5.6rem; font-size: 1.9rem; }
.form-actions .ghost { flex: 0 0 10.4rem; padding: 0 1rem; }
.form-actions #startBtn { margin-left: 1.2rem; white-space: nowrap; }
@media (max-width: 379px) { .form-actions .btn { font-size: 1.8rem; gap: .8rem; } .form-actions .ghost { flex-basis: 9.4rem; } }

/* ---------- 3. Quiz ---------- */
.quiz { position: relative; inset: auto; flex: 1; display: flex; flex-direction: column; }
.quiz-top { position: sticky; top: 0; flex: none; flex-wrap: wrap; align-content: center; gap: .9rem 1rem; padding: 1rem 1.8rem 1.2rem; z-index: 5; box-shadow: inset 0 -1px 0 rgba(181, 210, 244, .3), 0 .8rem 2rem rgba(0, 4, 26, .35); }
.q-count { order: 1; height: 4rem; padding: 0 1.4rem; }
.q-count .in { gap: .7rem; }
.q-count .cap { font-size: 1.1rem; }
.q-count b { font-size: 2.3rem; }
.q-count .of { font-size: 1.5rem; }
.score-box { order: 2; margin-left: auto; height: 4rem; padding: 0 1.5rem; }
.score-box .in { gap: .6rem; padding-top: .5rem; }
.score-box b { font-size: 2.4rem; }
.score-box .of { font-size: 1.4rem; }
.progress { order: 3; flex: 0 0 100%; gap: .5rem; padding: 0 .5rem; }
.seg { height: 2.8rem; }
.seg b { font-size: 1.3rem; }
.q-wrap { flex: 1; display: block; padding: 2rem 1.8rem 2.4rem; }
/* upright here: the slanted question block needs the width of a tablet */
.q-body { transform: none; gap: 1.2rem; }
.q-body.enter { animation-name: qin-phone; }
@keyframes qin-phone { from { opacity: 0; transform: translate3d(3rem, 0, 0); } to { opacity: 1; transform: none; } }
.q-text, .opt .txt, .opt .key b, .opt .mark, .timer, .gain b { transform: none; }
.q-head { margin-bottom: -1.2rem; padding-left: .6rem; }
.q-head .chip { height: 3.2rem; transform: skewX(var(--sk)); }
.q-head .chip .in { transform: skewX(calc(var(--sk) * -1)); }
.timer { gap: .8rem; }
.timer .tbar { width: 8rem; }
.timer b { font-size: 2rem; }
.q-card { width: 100%; min-height: 0; padding: 2.2rem 1.8rem 1.8rem; border-radius: var(--r); }
.q-text, .q-text.long { font-size: 2.3rem; line-height: 1.18; }
.q-text.xlong { font-size: 2rem; line-height: 1.22; }
.options { grid-template-columns: minmax(0, 1fr); gap: 1rem; margin-top: .2rem; }
.opt { min-height: 6.4rem; gap: 1.4rem; padding: .9rem 1.4rem .9rem 0; border-radius: var(--r); }
.opt .key { width: 5.2rem; }
.opt .key b { font-size: 2.3rem; }
.opt .txt, .options.dense .opt .txt { font-size: 1.7rem; line-height: 1.25; }
.opt .mark { width: 2.8rem; height: 2.8rem; }
.opt .mark .ic { font-size: 2.8rem; }
.gain { height: 3.6rem; padding: 0 1.3rem; border-radius: var(--r); }
.gain b { font-size: 1.8rem; }
.feedback { flex: none; min-height: 6rem; gap: 1.2rem; padding-left: 1.8rem; padding-right: 1.8rem; font-size: 1.6rem; flex-wrap: wrap; }
.fb-chip { height: 3.6rem; padding: 0 1.4rem; }
.fb-chip > span { gap: .7rem; font-size: 1.9rem; }
.fb-chip .ic { font-size: 1.9rem; }
.fb-text.hint { gap: .8rem; }
.fb-text.hint .ic { font-size: 2.1rem; }

/* ---------- 4. Result ---------- */
.result { position: relative; inset: auto; flex: 1; display: flex; flex-direction: column; align-items: stretch; gap: 2.2rem; padding: 2.4rem 2rem 0; }
.res-main { max-width: none; }
.result-points { margin-top: 2.6rem; }
.result-points .big { font-size: 8.4rem; }
.result-points .of { font-size: 1.9rem; margin-top: .2rem; }
.bands { gap: .5rem; margin-top: 1.6rem; padding-right: 0; }
.bands::before { inset: -1rem -.6rem -1rem -1rem; }
.band i { height: 1.2rem; }
.band span { display: none; }   /* five names do not fit a phone line; the reached band is named in full just below */
.result-label { margin-top: 1.8rem; font-size: 2.7rem; }
.res-correct { margin-top: .6rem; font-size: 1.7rem; }
.res-side { flex: 1; gap: 1.6rem; padding: 0; }
.result-stats { transform: none; gap: .8rem; }
.result-stats .tile { height: 6.6rem; border-radius: var(--r); }
.tile .in { transform: none; gap: 1.2rem; padding: 0 1.6rem; }
.tile .cap { font-size: 1.2rem; }
.tile .sub { font-size: 1.6rem; }
.tile b { font-size: 2.9rem; }
.result-cta { padding: 0; font-size: 1.6rem; }
.disc, .res-disc { font-size: 1.5rem; padding: 0; }
.home-disc { position: static; height: auto; display: block; margin: -.6rem 0 2rem; }
.res-actions { display: flex; margin-left: -2rem; margin-right: -2rem; }
.done-btn { flex: 1; margin: 0; padding: 0 2.2rem; min-height: 5.6rem; }
.done-btn .auto b { font-size: 1.8rem; }

/* ---------- Paused, toast ---------- */
.paused { position: relative; inset: auto; flex: 1; padding: 2.4rem 2rem; }
.paused-title { margin-top: 1.6rem; font-size: 4.4rem; max-width: none; }
.paused-text { margin-top: 1.6rem; font-size: 1.7rem; max-width: none; }
.net-toast { top: 1rem; max-width: calc(100vw - 2rem); padding: 1rem 1.4rem; font-size: 1.6rem; }

/* ---------- phone on its side: less height, more width ---------- */
@media (orientation: landscape) {
  .loop { height: 18rem; }
  .home-title { font-size: 5rem; }
  .quiz-top { flex-wrap: nowrap; padding: .8rem 1.8rem; }
  .progress { order: 2; flex: 1; }
  .score-box { order: 3; margin-left: 0; }
  .options { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  #prizeRow { flex-direction: row; flex-wrap: wrap; }
  #prizeRow .pz.p1, #prizeRow .pz.p2, #prizeRow .pz.p3 { flex: 1 1 40%; min-width: 0; height: 7.4rem; }
  #prizeRow .pz-pic { width: 6.4rem; }
  #prizeRow .pz-tag { margin-left: 1rem; }
  .result-points { flex-direction: row; align-items: baseline; gap: 1.2rem; }
  .result-points .big { font-size: 6.4rem; }
}

/* ---------- logo and kiosk prompt on phones ---------- */
/* the logo plate sits top right on every screen: logo 68 px wide (minimum 50 px), clear zone 14 px on every side.
   During the quiz it stays in the sticky top bar: 56 px wide, clear zone 12 px. */
.logo-plate { --lh: 3.6rem; --mr: 1rem; }
.logo-plate { overflow: hidden; }   /* the plate's fill must not widen the page */
body[data-screen="quiz"] .logo-plate { --lh: 3rem; --mr: .8rem; position: fixed; }
.quiz-top { padding-right: 1.8rem; }
.score-box { margin-right: 9.4rem; }
@media (orientation: landscape) { .quiz-top { padding-right: 12rem; } .score-box { margin-right: 0; } }
@media (max-width: 379px) { .q-count .cap { display: none; } .q-count { padding: 0 1.2rem; } .score-box { padding: 0 1.1rem; } }
.kiosk-ask { position: fixed; padding: 2rem; }
.ka-card { width: 100%; max-width: none; padding: 2rem; }
.ka-card h3 { font-size: 2.4rem; }
.ka-card p { margin: 1rem 0 1.6rem; font-size: 1.6rem; }
.ka-actions { gap: 1.2rem; padding: 0 .6rem; margin-top: 1.6rem; }
.ka-actions .btn { min-height: 5.6rem; font-size: 1.9rem; }
.ka-actions .ghost { flex: 0 0 10.4rem; padding: 0 1rem; }
.ka-actions .btn[type="submit"] { margin-left: 1.2rem; }


/* ---------- touch picker on phones: a full-screen sheet ---------- */
.picker { position: fixed; padding: 0; align-items: stretch; }
.pk-card { width: 100%; max-height: none; height: auto; border-radius: 0; }
body.kb-open .pk-card { max-height: none; }
body.picking { overflow: hidden; }
.pk-head { padding: 1rem 1rem 1rem 2rem; }
.pk-head h3 { font-size: 2.3rem; }
.pk-close, .pk-back { width: 4.8rem; height: 4.8rem; }
.pk-back { margin-left: -1rem; }
.pk-close .ic, .pk-back .ic { font-size: 2.2rem; }
.pk-search { padding: 1rem 2rem; }
.pk-search input { height: 5rem; padding: 0 1.4rem; font-size: 1.7rem; }
.pk-list { padding: 0 1rem calc(1rem + env(safe-area-inset-bottom, 0px)); }
.pk-group { padding: 1rem 1rem .6rem; font-size: 1.3rem; }
.pk-opt { min-height: 5.2rem; padding: .6rem 1rem; font-size: 1.7rem; }
.pk-opt .ic { font-size: 2rem; }
.pk-none { padding: 1.6rem 1rem; font-size: 1.6rem; }
.pk-other { padding: 1.6rem 2rem 2rem; gap: 1.4rem; }
.pk-other .btn { min-height: 5.6rem; font-size: 1.9rem; margin: 0 .8rem 0 1.6rem; }
