/* Quiz-specific styles.

   The look comes from the ADA design system in /ada.css (generated from the
   `ada-brand` repo by `npm run brand:sync`): buttons, cards, headings, form
   fields, badges, stat tiles and the dark Hero band are all its `ada-*`
   classes. This file only adds what a live quiz needs and the system has no
   component for (answer tiles, countdown, podium, projector sizing), and it
   builds those from the system's `--ada-*` tokens. */

/* The design system's fonts, served from this site so pages load nothing
   from a third party. Both files are variable fonts. */
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/montserrat-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Montserrat'; font-style: normal; font-weight: 400 700; font-display: swap; src: url(/fonts/montserrat-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/poppins-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/poppins-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* Answer tiles: 4 brand colours that also differ in lightness, each paired
     with a shape and a letter so colour is never the only cue. Status colours
     (green, amber, red) are deliberately not used here: in the design system
     they mean state only. */
  --q-o0: var(--ada-navy);
  --q-o1: var(--ada-blue-strong);
  --q-o2: var(--ada-teal);
  --q-o3: var(--ada-gold-light);
}

html, body { margin: 0; min-height: 100%; }
body.ada-page {
  min-height: 100vh; min-height: 100dvh; -webkit-text-size-adjust: 100%;
  /* The page ground: the design system's pale wash, plus 2 soft glows in its
     blue and green and a faint network motif (public/bg.svg, drawn by
     scripts/make-background.mjs) tucked into opposite corners. Everything is
     kept under about 10% contrast so a question is always the loudest thing
     on screen. */
  background:
    url(/bg.svg) right -14vmin top -16vmin / 62vmin no-repeat fixed,
    url(/bg.svg) left -20vmin bottom -22vmin / 70vmin no-repeat fixed,
    radial-gradient(46% 40% at 100% 0%, rgba(52, 148, 245, .14), transparent 70%) fixed,
    radial-gradient(50% 44% at 0% 100%, rgba(95, 208, 160, .13), transparent 70%) fixed,
    var(--ada-page) fixed,
    var(--ada-white);
}
[hidden] { display: none !important; }
.grow { flex: 1; }
.center { justify-content: center; }
.end { margin-left: auto; }
.between { justify-content: space-between; }
.ada-input { font-size: 16px; }            /* 16px stops iOS zooming into a focused field */
.ada-btn.q-danger { color: var(--ada-danger); }
.ada-btn.q-danger:hover:not(:disabled) { border-color: var(--ada-danger); }
.ada-hero .ada-heading__accent { color: var(--ada-gold-light); }

/* ---------- answer tiles ---------- */
.opt {
  --c: var(--q-o0); --fg: var(--ada-white); --chip: rgba(255, 255, 255, .2);
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: .7em; width: 100%; min-height: 72px;
  padding: 18px 20px; border: 0; border-radius: var(--ada-radius-lg);
  background: var(--c); color: var(--fg); text-align: left;
  font: 600 19px/1.25 var(--ada-font-heading);
  transition: opacity .2s ease, box-shadow .2s ease;
}
button.opt { cursor: pointer; }
.opt.o1 { --c: var(--q-o1); }
.opt.o2 { --c: var(--q-o2); }
.opt.o3 { --c: var(--q-o3); --fg: var(--ada-navy); --chip: rgba(16, 58, 105, .14); }
.opt .shape { flex: none; width: 1.9em; height: 1.9em; display: grid; place-items: center; border-radius: 50%; background: var(--chip); font-size: .9em; }
.opt .label { flex: 1; overflow-wrap: anywhere; }
.opt:disabled { cursor: default; }
.opt:focus-visible { outline: none; box-shadow: var(--ada-focus); }
.opt.dim { opacity: .5; }
.opt.picked { box-shadow: inset 0 0 0 4px var(--ada-white), 0 0 0 3px var(--c); }

/* ---------- countdown ---------- */
.timer { height: 10px; border-radius: var(--ada-radius-pill); background: var(--ada-line); overflow: hidden; }
.timer i { display: block; height: 100%; background: var(--ada-blue); border-radius: inherit; transform-origin: left; }

/* ---------- reconnecting notice ---------- */
.banner { position: fixed; left: 12px; right: 12px; top: 12px; z-index: 10; justify-content: center; box-shadow: var(--ada-shadow-pop); }

/* ---------- player (phone) ---------- */
.phone { max-width: 520px; margin: 0 auto; min-height: calc(100dvh - 2 * var(--ada-space-5)); }
body.ada-page.player { padding: var(--ada-space-5) var(--ada-space-4); }
.phone > header { min-height: 40px; }
.me { max-width: 60%; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; padding: 7px 14px; }
.me b { color: var(--ada-blue-strong); }
.pin-input.ada-input { font: 600 34px var(--ada-font-heading); letter-spacing: .2em; text-align: center; padding-left: calc(16px + .2em); }
.qimg { width: 100%; max-height: 22vh; object-fit: contain; border-radius: var(--ada-radius-md); background: var(--ada-white); }
/* Right or wrong is a state, so this is the system's status palette. */
.result { border: 1px solid transparent; border-radius: var(--ada-radius-lg); padding: var(--ada-space-6) var(--ada-space-5); text-align: center; font: 600 30px/1.2 var(--ada-font-heading); }
.result small { display: block; margin-top: 6px; font: 500 17px var(--ada-font-body); }
.result.good { background: var(--ada-success-bg); color: #145c40; border-color: #bfe6d3; }
.result.bad { background: var(--ada-danger-bg); color: #8f2621; border-color: #f5c6c2; }
.result.none { background: var(--ada-wash); color: var(--ada-navy); border-color: var(--ada-line); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--ada-space-3); }
.ranks { display: flex; flex-direction: column; gap: var(--ada-space-2); }
.ranks .row { display: flex; align-items: center; gap: var(--ada-space-3); padding: 12px 16px; border-radius: var(--ada-radius-md); background: var(--ada-wash); color: var(--ada-navy); font-weight: 500; }
.ranks .n { width: 1.6em; font: 600 1.05em var(--ada-font-heading); color: var(--ada-blue-strong); }
.ranks .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranks .s { font-variant-numeric: tabular-nums; }

/* ---------- projector ----------
   The system's type scale tops out at 50px for web pages. A room reads this
   screen from the back row, so sizes here scale with the viewport instead. */
body.ada-page.screen { padding: clamp(14px, 2vw, 36px); }
.stage { min-height: calc(100dvh - 2 * clamp(14px, 2vw, 36px)); gap: clamp(12px, 1.6vw, 26px); }
.stage > header .ada-logo { height: clamp(32px, 3vw, 52px); }
.stage > header .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(14px, 1.3vw, 20px); }
.stage > main { flex: 1; display: flex; flex-direction: column; gap: clamp(12px, 1.6vw, 26px); min-height: 0; }
.stage .ada-hero { padding: clamp(20px, 3vw, 56px); gap: clamp(12px, 1.6vw, 28px); }
.stage .ada-hero.fill { flex: 1; justify-content: center; }
.stage .ada-hero.compact { padding: clamp(14px, 1.8vw, 32px); gap: clamp(8px, 1vw, 16px); }
.stage .ada-hero.compact .bigq { font-size: clamp(22px, 2.6vw, 46px); }
.stage .ada-eyebrow--glass { font-size: clamp(13px, 1.2vw, 20px); }
.stage > footer { min-height: 60px; }
.stage .hint { font-size: clamp(13px, 1vw, 16px); }
.stage .ada-btn--lg { font-size: clamp(17px, 1.5vw, 24px); padding: .85em 1.6em; }

.join { display: grid; grid-template-columns: 1fr auto; gap: clamp(20px, 4vw, 70px); align-items: center; }
.join .where { font: 500 clamp(18px, 2.2vw, 36px)/1.3 var(--ada-font-body); color: #f4f4ff; }
.join .where.label { margin-top: .7em; opacity: .85; }
.join .where b { font-weight: 600; color: var(--ada-gold-light); }
.join .pin { margin-top: .08em; font: 600 clamp(64px, 12vw, 200px)/1 var(--ada-font-heading); letter-spacing: .04em; font-variant-numeric: tabular-nums; color: var(--ada-white); }
.join .qr { width: clamp(150px, 20vw, 320px); aspect-ratio: 1; padding: 6px; border-radius: var(--ada-radius-lg); background: var(--ada-white); }
.join .qr img { display: block; width: 100%; height: 100%; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start; }
.chip { cursor: pointer; border: 1px solid var(--ada-line); border-radius: var(--ada-radius-pill); padding: .4em 1em; background: var(--ada-white); color: var(--ada-navy); font: 500 clamp(15px, 1.5vw, 24px) var(--ada-font-body); animation: pop .25s ease-out; }
.chip:hover { border-color: var(--ada-danger); color: var(--ada-danger); text-decoration: line-through; }
.chip:focus-visible { outline: none; box-shadow: var(--ada-focus); }
.chip.off { opacity: .45; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.count { font: 600 clamp(20px, 2.2vw, 36px) var(--ada-font-heading); color: var(--ada-navy); }

.bigq { margin: 0; text-align: center; text-wrap: balance; font: 600 clamp(26px, 3.6vw, 64px)/1.2 var(--ada-font-heading); color: var(--ada-white); }
.qrow { display: flex; align-items: center; justify-content: center; gap: clamp(16px, 3vw, 50px); min-height: 0; }
.qrow img { max-height: 34vh; max-width: 56vw; min-height: 0; object-fit: contain; border-radius: var(--ada-radius-lg); background: var(--ada-white); }
.clock { flex: none; width: clamp(90px, 10vw, 170px); aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: var(--ada-glass); border: 1px solid var(--ada-glass-line); color: var(--ada-white); font: 600 clamp(36px, 4.4vw, 76px) var(--ada-font-heading); font-variant-numeric: tabular-nums; }
.clock.low { background: var(--ada-gold-light); color: var(--ada-navy); border-color: transparent; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(10px, 1.2vw, 20px); }
.tiles.one { grid-template-columns: 1fr; align-content: center; }
.tiles.one .opt { font-size: clamp(17px, 1.8vw, 32px); padding: .5em .8em; min-height: 2.3em; }
.tiles .opt { font-size: clamp(18px, 2.2vw, 38px); padding: .7em .8em; min-height: 2.6em; }
.tiles .opt .n { margin-left: auto; font-variant-numeric: tabular-nums; }
.tiles .opt .bar { position: absolute; left: 0; bottom: 0; height: 8px; width: 0; background: currentColor; opacity: .7; transition: width .6s ease-out; }
.tiles .opt .tick { font-size: 1.1em; }
.tiles .opt.right { box-shadow: inset 0 0 0 5px var(--ada-white), 0 0 0 4px var(--c); }
.split { display: grid; grid-template-columns: 1.5fr 1fr; gap: clamp(16px, 2.4vw, 44px); flex: 1; min-height: 0; }
.split.solo { grid-template-columns: 1fr; }
.board .ranks .row { font-size: clamp(16px, 1.7vw, 30px); padding: .45em .8em; }

.podium { display: flex; justify-content: center; align-items: flex-end; gap: clamp(10px, 1.6vw, 28px); flex: 1; min-height: 0; width: 100%; }
.podium .place { flex: 0 1 24vw; min-width: 0; display: flex; flex-direction: column; gap: 10px; text-align: center; }
.podium .who { font: 600 clamp(18px, 2.4vw, 44px)/1.2 var(--ada-font-heading); color: var(--ada-white); overflow-wrap: anywhere; }
.podium .pts { font: 500 clamp(14px, 1.4vw, 24px) var(--ada-font-body); color: #f4f4ff; }
.podium .block { display: grid; place-items: center; border-radius: var(--ada-radius-lg) var(--ada-radius-lg) 0 0; background: var(--ada-glass); border: 1px solid var(--ada-glass-line); border-bottom: 0; color: var(--ada-white); font: 600 clamp(40px, 6vw, 110px) var(--ada-font-heading); }
.podium .p1 .block { height: 30vh; background: var(--ada-gold-light); border-color: transparent; color: var(--ada-navy); }
.podium .p2 .block { height: 22vh; }
.podium .p3 .block { height: 15vh; }
.notice { max-width: 34em; margin: auto; }

/* On a projector the whole screen must fit without scrolling, so the stage is
   exactly 1 viewport tall and a question's picture shrinks to whatever room
   is left after the question, the answers and the footer. */
@media (min-width: 761px) {
  .stage { height: calc(100dvh - 2 * clamp(14px, 2vw, 36px)); }
  .stage .ada-hero.fill { min-height: 0; }
  .stage .ada-hero.has-image { padding-block: clamp(14px, 1.8vw, 32px); gap: clamp(8px, 1vw, 18px); }
  .stage .ada-hero.has-image .bigq { font-size: clamp(22px, 2.8vw, 50px); }
  .stage .ada-hero.has-image .qrow { flex: 1; align-self: stretch; }
  .stage .ada-hero.has-image .qrow img { max-height: 100%; }
}

@media (max-width: 760px) {
  .join, .split { grid-template-columns: 1fr; }
  .join .qr { margin: 0 auto; }
  .qrow { flex-direction: column; }
}

/* ---------- dashboard ---------- */
.dash { max-width: 980px; margin: 0 auto; gap: var(--ada-space-8); padding-bottom: var(--ada-space-16); }
.dash > header .who { font-size: 14px; color: var(--ada-muted); }
.narrow { max-width: 440px; }
.item { flex-direction: row; flex-wrap: wrap; align-items: center; padding: 14px 18px; }
.item .t { flex: 1; min-width: 180px; }
.item .t b { display: block; font: 600 17px/1.3 var(--ada-font-heading); color: var(--ada-navy); }
.item .t span { font-size: 13px; color: var(--ada-muted); }
.qedit .two { display: grid; grid-template-columns: 1fr 190px; gap: var(--ada-space-3); }
.qedit .answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.qedit .ans { --fg: var(--ada-white); display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 12px; border-radius: var(--ada-radius-md); background: var(--c); color: var(--fg); }
.qedit .ans.o3 { --fg: var(--ada-navy); }
.qedit .ans .ada-input { border-color: transparent; padding: 10px 12px; }
.qedit .ans input[type=radio] { flex: none; width: 22px; height: 22px; accent-color: var(--ada-navy); cursor: pointer; }
.qedit .ans .shape { flex: none; width: 1.2em; text-align: center; font-weight: 600; }
.sticky { position: sticky; bottom: 12px; z-index: 2; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; border-radius: var(--ada-radius-pill); box-shadow: var(--ada-shadow-pop); }
.sticky .ada-error { padding: 0 8px; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { padding: 8px 10px; text-align: left; font: 600 13px var(--ada-font-body); color: var(--ada-muted); }
td { padding: 10px; border-top: 1px solid var(--ada-line-soft); color: var(--ada-navy); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pct { display: flex; align-items: center; gap: 10px; }
.pct i { flex: 1; height: 8px; border-radius: var(--ada-radius-pill); background: var(--ada-line); overflow: hidden; }
.pct i b { display: block; height: 100%; background: var(--ada-blue); }
@media (max-width: 640px) {
  .qedit .two, .qedit .answers { grid-template-columns: 1fr; }
}
