/* Football trivia match game (codename Trivia Match). Fonts: VT323 and Press Start 2P, both SIL Open Font License 1.1 (see /fonts). */
@font-face { font-family: 'VT323'; src: url('../fonts/vt323-VT323-Regular.woff2?v=d84b2d9') format('woff2'), url('../fonts/vt323-VT323-Regular.ttf?v=d84b2d9') format('truetype'); font-display: swap; }
@font-face { font-family: 'Press Start 2P'; src: url('../fonts/pressstart2p-PressStart2P-Regular.woff2?v=d84b2d9') format('woff2'), url('../fonts/pressstart2p-PressStart2P-Regular.ttf?v=d84b2d9') format('truetype'); font-display: swap; }

:root {
  --ink: #161a33;          /* panel */
  --ink-2: #20264a;        /* raised panel */
  --line: #0a0c1c;         /* outline */
  --cream: #f6f1e4;
  --mute: #98a0d2;
  --amber: #ffd23f;
  --amber-d: #c9931a;
  --orange: #ff8a3c;
  --mint: #6ff2b4;
  --red: #ff5d6c;
  --perfect: #5fe08a;
  --close: #ffd23f;
  --meh: #ff9a4a;
  --wrong: #ff5d6c;
  --timeout: #6c7399;
  --px: 4px;
  /* The insets every screen is padded with. env() is the safe area. --gt/--gr/--gb/--gl are set by js/main.js
     (shapeGuards) where a rounded window corner needs more: an unfolded iPhone Duo in Split View has a safe
     area of zero and round corners. --tm-banner is the apps' banner ad under the game. */
  --sal: max(env(safe-area-inset-left, 0px), var(--gl, 0px)); --sar: max(env(safe-area-inset-right, 0px), var(--gr, 0px));
  --sat: max(env(safe-area-inset-top, 0px), var(--gt, 0px)); --sab: max(calc(env(safe-area-inset-bottom, 0px) + var(--tm-banner, 0px)), var(--gb, 0px));
  --col: 420px; --leftw: 400px; --foldto: 0px;
}
#safe-probe { position: fixed; visibility: hidden; pointer-events: none; padding: var(--sat) var(--sar) var(--sab) var(--sal); }
#env-probe { position: fixed; visibility: hidden; pointer-events: none; padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) calc(env(safe-area-inset-bottom, 0px) + var(--tm-banner, 0px)) env(safe-area-inset-left, 0px); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: #0a1420; }
body { position: fixed; width: 100%; }
body { font-family: 'VT323', ui-monospace, Menlo, monospace; color: var(--cream); font-size: 22px; line-height: 1.05; -webkit-font-smoothing: none; font-smooth: never; touch-action: manipulation; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }

#app { position: fixed; top: 0; left: 0; width: 100%; height: 100%; overflow: hidden; }
#pitch { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; display: block; }
#crt { position: absolute; inset: 0; pointer-events: none; z-index: 60;
  background:
    repeating-linear-gradient(to bottom, rgba(10, 12, 40, 0) 0, rgba(10, 12, 40, 0) 2px, rgba(10, 12, 40, 0.13) 2px, rgba(10, 12, 40, 0.13) 3px),
    radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 58%, rgba(8, 8, 30, 0.32) 100%); }

.lbl { font-family: 'Press Start 2P', monospace; font-size: 8px; letter-spacing: 1px; color: var(--mute); text-transform: uppercase; line-height: 1.4; }

/* Chunky stepped-corner panel, drawn with box-shadows so it scales with content. */
.panel { position: relative; background: var(--ink); margin: calc(var(--px) * 2);
  box-shadow: 0 calc(var(--px) * -1) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink), calc(var(--px) * -1) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink),
    calc(var(--px) * -1) calc(var(--px) * -1) 0 0 var(--line), var(--px) calc(var(--px) * -1) 0 0 var(--line), calc(var(--px) * -1) var(--px) 0 0 var(--line), var(--px) var(--px) 0 0 var(--line),
    0 calc(var(--px) * -2) 0 0 var(--line), 0 calc(var(--px) * 2) 0 0 var(--line), calc(var(--px) * -2) 0 0 0 var(--line), calc(var(--px) * 2) 0 0 0 var(--line),
    0 calc(var(--px) * 4) 0 0 rgba(6, 8, 24, 0.35); }
.panel.thin { --px: 3px; }

.btn { --b: var(--ink-2); --bd: #0d1026; --px: 3px; position: relative; border: 0; background: var(--b); color: var(--cream); padding: 13px 14px 11px; margin: 6px;
  font-family: 'Press Start 2P', monospace; font-size: 11px; letter-spacing: 1px; line-height: 1.2; text-transform: uppercase;
  box-shadow: 0 calc(var(--px) * -1) 0 0 var(--b), calc(var(--px) * -1) 0 0 0 var(--b), var(--px) 0 0 0 var(--b), 0 var(--px) 0 0 var(--b),
    0 calc(var(--px) * 2) 0 0 var(--bd), calc(var(--px) * -1) var(--px) 0 0 var(--bd), var(--px) var(--px) 0 0 var(--bd),
    0 calc(var(--px) * -2) 0 0 var(--line), calc(var(--px) * -2) 0 0 0 var(--line), calc(var(--px) * 2) 0 0 0 var(--line), 0 calc(var(--px) * 3) 0 0 var(--line),
    calc(var(--px) * -1) calc(var(--px) * -1) 0 0 var(--line), var(--px) calc(var(--px) * -1) 0 0 var(--line), calc(var(--px) * -2) var(--px) 0 0 var(--line), calc(var(--px) * 2) var(--px) 0 0 var(--line),
    calc(var(--px) * -1) calc(var(--px) * 2) 0 0 var(--line), var(--px) calc(var(--px) * 2) 0 0 var(--line); }
.btn:active { transform: translateY(3px); }
.btn:focus-visible, .sq:focus-visible, input:focus-visible { outline: 2px solid var(--mint); outline-offset: 5px; }
.btn.primary { --b: var(--amber); --bd: var(--amber-d); color: #1a1530; }
.btn.small { font-size: 8px; padding: 11px 9px 9px; }
.btn[disabled] { opacity: 0.55; }
.sq { width: 34px; height: 34px; flex: none; border: 0; background: var(--ink); color: var(--mute); font-size: 15px; line-height: 1; padding: 0;
  box-shadow: 0 -3px 0 0 var(--ink), 0 3px 0 0 var(--ink), -3px 0 0 0 var(--ink), 3px 0 0 0 var(--ink), 0 -6px 0 0 var(--line), 0 6px 0 0 var(--line), -6px 0 0 0 var(--line), 6px 0 0 0 var(--line),
    -3px -3px 0 0 var(--line), 3px -3px 0 0 var(--line), -3px 3px 0 0 var(--line), 3px 3px 0 0 var(--line); margin: 6px; }
.sq.off { color: #4a5080; text-decoration: line-through; }

.screen { position: absolute; left: 0; right: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; }

/* ---------- HUD ---------- */
#hud { position: absolute; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; justify-content: center; gap: 4px;
  padding: calc(6px + var(--sat)) max(4px, var(--sar)) 0 max(4px, var(--sal)); }
.tile { --px: 3px; background: var(--ink); margin: 6px; padding: 5px 9px 3px; min-width: 76px; display: flex; flex-direction: column; gap: 1px;
  box-shadow: 0 -3px 0 0 var(--ink), 0 3px 0 0 var(--ink), -3px 0 0 0 var(--ink), 3px 0 0 0 var(--ink), 0 -6px 0 0 var(--line), 0 6px 0 0 var(--line), -6px 0 0 0 var(--line), 6px 0 0 0 var(--line),
    -3px -3px 0 0 var(--line), 3px -3px 0 0 var(--line), -3px 3px 0 0 var(--line), 3px 3px 0 0 var(--line); }
.tile .lbl { font-size: 7px; white-space: nowrap; }
.tile .val { font-size: 30px; line-height: 0.85; color: var(--cream); letter-spacing: 1px; }
.tile-r { align-items: flex-end; }
.tile .val.pts { color: var(--amber); }
.tile .val.bump { animation: bump 0.5s steps(4); }
@keyframes bump { 0% { transform: translateY(0); color: #fff; } 40% { transform: translateY(-5px); color: #fff; } 100% { transform: translateY(0); } }
.hud-mid { flex: 1 1 auto; max-width: 300px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 5px; }
#pips { display: flex; gap: 2px; align-items: center; }
#pips i { width: 9px; height: 9px; background: #23284f; box-shadow: 0 0 0 2px var(--line); margin: 2px; display: block; }
#pips i:nth-child(7) { margin-left: 8px; }
#pips i.now { background: var(--cream); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { background: #7d84b8; } }
#pips i.perfect, .sqr.perfect { background: var(--perfect); }
#pips i.close, .sqr.close { background: var(--close); }
#pips i.meh, .sqr.meh { background: var(--meh); }
#pips i.wrong, .sqr.wrong { background: var(--wrong); }
#pips i.timeout, .sqr.timeout { background: var(--timeout); }
#pips i.goal-us { box-shadow: 0 0 0 2px #fff; }
#pips i.goal-them { box-shadow: 0 0 0 2px #7a1020; }
#hud-min { color: #2a2550; font-size: 7px; white-space: nowrap; background: rgba(255, 248, 240, 0.55); padding: 3px 5px 2px; }

/* ---------- banner over the pitch ---------- */
#banner { position: absolute; left: 0; right: 0; z-index: 15; text-align: center; pointer-events: none; font-family: 'Press Start 2P', monospace; }
#banner span { display: inline-block; padding: 10px 14px 8px; font-size: 22px; color: #1a1530; background: var(--amber); box-shadow: 0 0 0 4px var(--line), 0 8px 0 0 rgba(6, 8, 24, 0.4);
  animation: pop 0.35s steps(5) both; }
#banner span.bad { background: var(--red); color: #fff; }
#banner span.info { background: var(--cream); font-size: 13px; }
@keyframes pop { 0% { transform: scale(0.2) rotate(-6deg); opacity: 0; } 70% { transform: scale(1.15) rotate(2deg); opacity: 1; } 100% { transform: scale(1) rotate(-2deg); } }

/* ---------- home ---------- */
#home { top: 0; bottom: 0; justify-content: space-between; padding: calc(18px + var(--sat)) max(12px, var(--sar)) calc(14px + var(--sab)) max(12px, var(--sal)); pointer-events: none; }
#home > * { pointer-events: auto; }
.logo { text-align: center; }
.logo-kicker { font-family: 'Press Start 2P', monospace; font-size: 9px; letter-spacing: 3px; color: #2a2550; background: rgba(255, 248, 240, 0.6); padding: 5px 8px 3px; }
.logo h1 { margin: 12px 0 6px; font-family: 'Press Start 2P', monospace; font-weight: 400; font-size: clamp(30px, 10.5vw, 64px); line-height: 1.12; letter-spacing: 2px; color: var(--cream);
  text-shadow: 4px 0 0 var(--line), -4px 0 0 var(--line), 0 4px 0 var(--line), 0 -4px 0 var(--line), 4px 4px 0 var(--line), -4px 4px 0 var(--line), 4px -4px 0 var(--line), -4px -4px 0 var(--line), 0 10px 0 rgba(22, 26, 51, 0.5); }
.logo h1 span { display: block; }
.logo h1 span:last-child { color: var(--amber); }
.tagline { margin: 12px 0 0; font-size: 24px; color: #241f48; }
.menu { width: 100%; max-width: 380px; display: flex; flex-direction: column; align-items: stretch; }
.menu .btn.primary { font-size: 13px; padding: 17px 12px 15px; }
.menu .sub, .sub { margin: 4px 6px 8px; text-align: center; color: var(--mute); font-size: 19px; }
.row { display: flex; justify-content: center; align-items: stretch; }
.row .btn { flex: 1 1 0; }
.row .btn.sqb { flex: 0 0 40px; font-size: 13px; padding-left: 0; padding-right: 0; }
.row .btn.sqb.sfx { font-size: 9px; letter-spacing: 0; }          /* the sound-effects toggle, next to the music one */
@media (max-width: 370px) { .row .btn.sqb { flex-basis: 32px; } .row .btn.sqb.sfx { font-size: 8px; } .row .btn.small { padding-left: 6px; padding-right: 6px; } }
.btn.off { color: #5b628f; text-decoration: line-through; }

/* ---------- play ---------- */
#play { bottom: 0; padding: 0 max(6px, var(--sar)) calc(6px + var(--sab)) max(6px, var(--sal)); }
.card { width: calc(100% - 16px); max-width: 640px; padding: 9px 12px 8px; }
.card-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
#q-where { color: var(--orange); }
#q-where.def { color: #b9a4ff; }
.worth { color: var(--amber); white-space: nowrap; }
#q-text { margin: 7px 0 8px; font-size: 26px; line-height: 0.98; min-height: 2.9em; color: var(--cream); text-wrap: pretty; }
#q-text.small { font-size: 23px; }
#q-result { min-height: 3.6em; margin: 4px 0 6px; }
.tier-row { display: flex; justify-content: space-between; align-items: baseline; font-family: 'Press Start 2P', monospace; font-size: 15px; }
#r-tier.perfect { color: var(--perfect); } #r-tier.close { color: var(--close); } #r-tier.meh { color: var(--meh); } #r-tier.wrong { color: var(--wrong); } #r-tier.timeout { color: var(--mute); }
#r-pts { font-size: 11px; color: var(--amber); }
#r-pts.neg { color: var(--red); }
#r-answer { margin: 7px 0 2px; font-size: 22px; color: var(--mute); }
#r-answer b { color: var(--cream); font-weight: 400; }
#r-comment { margin: 2px 0 0; font-size: 22px; color: var(--mint); min-height: 1.05em; }
#r-comment.bad { color: #ff9aa6; }
.timer { display: flex; align-items: center; gap: 8px; height: 14px; }
.timer-track { flex: 1; height: 6px; background: #0d1026; box-shadow: 0 0 0 2px var(--line); }
#timer-bar { height: 100%; width: 100%; background: var(--mint); transform-origin: left center; }
#timer-bar.low { background: var(--red); }
#timer-num { font-family: 'Press Start 2P', monospace; font-size: 9px; color: var(--mute); min-width: 132px; text-align: right; white-space: nowrap; }
#timer-num.short { min-width: 22px; color: var(--cream); }
.entry { width: 100%; max-width: 656px; display: flex; align-items: stretch; margin-top: 2px; }
.field { flex: 1; display: flex; align-items: center; background: #f6f1e4; --ink: #f6f1e4; min-width: 0; }
.field input { flex: 1; min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: #1a1530; font-size: 28px; padding: 6px 10px 4px; height: 44px; border-radius: 0; }
.field input::placeholder { color: #9a96ad; }
#unit { color: #6d6890; font-size: 20px; padding-right: 10px; white-space: nowrap; }
.go { flex: none; min-width: 64px; font-size: 13px; margin: 6px 8px 6px 2px; }
#play.locked .field { --ink: #cfcbdc; background: #cfcbdc; }
#play.locked .go { opacity: 0.5; }

/* ---------- result ---------- */
#result { top: 0; bottom: 0; justify-content: flex-end; padding: calc(64px + var(--sat)) max(6px, var(--sar)) calc(8px + var(--sab)) max(6px, var(--sal)); pointer-events: none; }
.result-panel { pointer-events: auto; width: calc(100% - 16px); max-width: 520px; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; padding: 14px 12px 10px; display: flex; flex-direction: column; align-items: stretch; text-align: center; scrollbar-width: none; }
.result-panel::-webkit-scrollbar { display: none; }
.res-score { display: flex; justify-content: center; align-items: center; gap: 12px; font-family: 'Press Start 2P', monospace; font-size: 40px; margin: 12px 0 10px; }
.res-score .side { font-size: 10px; color: var(--mute); }
.res-score .dash { color: var(--mute); font-size: 20px; }
#res-us { color: var(--orange); } #res-them { color: #b9a4ff; }
.res-line { display: flex; justify-content: center; align-items: baseline; gap: 10px; }
.tag { font-family: 'Press Start 2P', monospace; font-size: 10px; padding: 5px 7px 3px; background: var(--perfect); color: #10241a; }
.tag.D { background: var(--close); } .tag.L { background: var(--wrong); color: #fff; }
#res-pts { font-size: 46px; line-height: 0.8; color: var(--amber); }
#res-grid { display: flex; flex-direction: column; align-items: center; gap: 5px; margin: 14px 0 6px; }
#res-grid div { display: flex; gap: 4px; align-items: center; min-height: 18px; }
.sqr { width: 16px; height: 16px; display: inline-block; box-shadow: 0 0 0 2px var(--line); }
.ball { font-size: 15px; line-height: 1; }
.sub.played { margin: 8px 6px 0; color: var(--cream); background: var(--ink-2); padding: 7px 8px 5px; font-size: 20px; }
.btn.quiet { --b: var(--ink); color: var(--mute); }
.nick { display: flex; align-items: stretch; margin-top: 2px; }
.nick .btn { flex: none; font-size: 9px; margin-left: 2px; }
.err { color: #ff9aa6; }
#res-break { display: grid; grid-template-columns: 1fr auto; gap: 3px 12px; margin: 12px 8px 4px; text-align: left; font-size: 21px; color: var(--mute); }
#res-break dd { margin: 0; text-align: right; color: var(--cream); }
#res-review { text-align: left; margin: 8px 6px 2px; }
#res-review summary { cursor: pointer; padding: 6px 0; color: var(--mint); }
#res-list { margin: 4px 0 0; padding: 0; list-style: none; font-size: 19px; }
#res-list li { padding: 6px 0 6px 12px; border-left: 4px solid var(--timeout); margin-bottom: 6px; color: var(--mute); }
#res-list li.perfect { border-color: var(--perfect); } #res-list li.close { border-color: var(--close); } #res-list li.meh { border-color: var(--meh); } #res-list li.wrong { border-color: var(--wrong); }
#res-list li b { color: var(--cream); font-weight: 400; display: block; }

/* ---------- modal, toast ---------- */
#modal { position: absolute; inset: 0; z-index: 40; background: rgba(8, 9, 26, 0.72); display: flex; align-items: center; justify-content: center;
  padding: max(12px, var(--sat)) max(12px, var(--sar)) max(12px, var(--sab)) max(12px, var(--sal)); }
.modal-panel { width: 100%; max-width: 460px; max-height: calc(100% - 24px); overflow-y: auto; padding: 10px 12px 14px; scrollbar-width: none; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head .lbl { color: var(--amber); font-size: 10px; }
.modal-head .sq { background: var(--ink-2); box-shadow: none; margin: 0; }
#modal-body { font-size: 22px; color: var(--cream); }
#modal-body p { margin: 8px 0; }
#modal-body .key { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; align-items: center; margin: 10px 0; color: var(--mute); }
#modal-body .key .sqr { width: 14px; height: 14px; }
table.board { width: 100%; border-collapse: collapse; font-size: 23px; margin-top: 6px; }
table.board td { padding: 3px 4px; }
table.board td:first-child { color: var(--mute); width: 2.2em; }
table.board td:nth-child(3), table.board td:nth-child(4) { text-align: right; }
table.board td:nth-child(3) { color: var(--mute); }
table.board td:nth-child(4) { color: var(--amber); }
table.board tr.me td { background: #2a2f5c; color: var(--cream); }
#toast { position: absolute; left: 50%; top: calc(86px + var(--sat)); transform: translateX(-50%); z-index: 70; background: var(--cream); color: #1a1530; padding: 8px 12px 6px; font-size: 21px; box-shadow: 0 0 0 3px var(--line); white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }

/* ==========================================================================================
   Layout variants. js/main.js measures the space that is visible right now (visualViewport, so
   the on-screen keyboard counts) and sets these attributes on #app. There are no width or
   height media queries: an unfolded phone with the keyboard up is wide AND very short.
     data-layout  stack | side     side: pitch on the left, question and input on the right
     data-dense   0 | 1 | 2        1: one-line HUD, tighter card. 2: tightest, no sky or crowd
     data-big     1                roomy screens (desktop, iPad): larger type on the 8px grid
     data-wrap    1                narrow and not dense: turn pips sit on their own row
     data-narrow  1                very narrow phones
     data-touch   1                coarse pointer (a phone or tablet)
   ========================================================================================== */

/* ---------- account, credits, sign-in ---------- */
.menu .row + .row { margin-top: 0; }
.save { margin-top: 2px; }
.btn.save-btn { font-size: 9px; line-height: 1.5; padding: 11px 8px 9px; --b: var(--mint); --bd: #2f9e74; color: #10241a; }
.form-col { display: flex; flex-direction: column; align-items: stretch; }
.form-col .field input { font-size: 26px; }
.form-col .btn { margin-top: 8px; }
.invite-cta { font-size: 18px; padding: 2px 6px; margin: 0 auto; display: block; }
.invite-pips { display: flex; gap: 6px; justify-content: center; margin: 6px 0 2px; }
.invite-pips span { width: 34px; height: 14px; background: var(--ink-2, #232850); box-shadow: inset 0 0 0 2px var(--line); }
.invite-pips span.on { background: var(--mint); }
.invite-count { text-align: center; color: var(--amber); }
.invite-share { flex-wrap: wrap; justify-content: center; gap: 6px; }
.invite-share .btn { text-decoration: none; color: var(--cream); }
.invite-link-box { font-size: 18px !important; width: 100%; }
.invite-big { font-family: 'Press Start 2P', monospace; color: var(--amber); font-size: 22px; text-align: center; margin: 6px 0; }
.social { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 2px 0 6px; }
/* Sign in with Apple: Apple's black style (white logo and text, system font), as wide as Google's button */
.btn-apple { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; max-width: 320px; height: 44px; padding: 0 16px;
  background: #000; color: #fff; border: 1px solid #000; border-radius: 6px; font: 600 17px/1 -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif; letter-spacing: 0; cursor: pointer; }
.btn-apple:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.btn-apple[disabled] { opacity: .6; }
.btn-google { min-height: 44px; display: flex; justify-content: center; width: 100%; max-width: 320px; }
.social-or { margin: 2px 0 0; }
.linkish { background: none; border: 0; color: var(--mint); text-decoration: underline; padding: 6px; font-size: 20px; }
.linkish.danger { color: #ff9aa6; }
#modal-body a { color: var(--mint); }
#modal-body h3 { font-family: 'Press Start 2P', monospace; font-weight: 400; font-size: 9px; letter-spacing: 1px; color: var(--amber); margin: 16px 0 6px; text-transform: uppercase; }
#modal-body .fine { font-size: 19px; color: var(--mute); }
#modal-body ul { margin: 6px 0; padding-left: 20px; }
.code-input { letter-spacing: 6px; text-align: center; }

/* ---------- pips on their own row (narrow, roomy height) ---------- */
#app[data-wrap="1"] #hud { flex-wrap: wrap; justify-content: space-between; row-gap: 0; }
#app[data-wrap="1"] .hud-mid { order: 9; flex: 0 0 100%; max-width: none; flex-direction: row; justify-content: center; gap: 10px; margin-top: 1px; }
#app[data-wrap="1"] .tile { flex: 1 1 0; }
#app[data-narrow="1"] .tile { min-width: 66px; padding: 4px 7px 3px; }
#app[data-narrow="1"] .tile .val { font-size: 26px; }
#app[data-narrow="1"] #pips i { width: 7px; height: 7px; }
#app[data-narrow="1"] #q-text { font-size: 23px; }

/* ---------- dense: one-line HUD, tighter card ---------- */
#app:not([data-dense="0"]) #hud { padding-top: calc(1px + var(--sat)); gap: 0; flex-wrap: nowrap; justify-content: space-between; }
#app:not([data-dense="0"]) .tile { flex: 0 0 auto; flex-direction: row; align-items: center; min-width: 0; padding: 3px 7px 0; margin: 5px 6px; }
#app:not([data-dense="0"]) .tile .lbl { display: none; }
#app:not([data-dense="0"]) .tile .val { font-size: 24px; line-height: 0.9; }
#app:not([data-dense="0"]) .sq { width: 22px; height: 22px; font-size: 12px; margin: 5px 7px; }
#app:not([data-dense="0"]) .hud-mid { flex: 1 1 auto; order: 0; max-width: none; flex-direction: row; justify-content: center; gap: 6px; margin: 0; }
#app:not([data-dense="0"]) #pips i { width: 6px; height: 6px; margin: 2px 1px; }
#app:not([data-dense="0"]) #pips i:nth-child(7) { margin-left: 6px; }
#app:not([data-dense="0"]) #hud-min { padding: 2px 4px 1px; }
#app:not([data-dense="0"])[data-narrow="1"] #hud-min { display: none; }
#app:not([data-dense="0"]) .card { padding: 6px 10px 6px; --px: 3px; }
#app:not([data-dense="0"]) #q-text { margin: 4px 0 5px; min-height: 2em; font-size: 23px; }
#app:not([data-dense="0"]) #q-result { min-height: 2.9em; margin: 5px 0 4px; }
#app:not([data-dense="0"]) #r-answer { margin-top: 4px; font-size: 20px; }
#app:not([data-dense="0"]) #r-comment { font-size: 20px; }
#app:not([data-dense="0"]) .tier-row { font-size: 13px; }
#app:not([data-dense="0"]) .field input { height: 38px; font-size: 26px; }
#app:not([data-dense="0"]) #banner span { font-size: 16px; padding: 7px 10px 5px; }
#app:not([data-dense="0"]) #banner span.info { font-size: 11px; }
#app:not([data-dense="0"]) #toast { top: calc(40px + var(--sat)); }
#app:not([data-dense="0"]) #play { padding-bottom: calc(3px + var(--sab)); }

#app[data-dense="2"] .card { padding: 4px 9px 4px; margin-top: 5px; margin-bottom: 5px; }
#app[data-dense="2"] #q-text { font-size: 21px; margin: 2px 0 3px; min-height: 1.9em; }
#app[data-dense="2"] #q-result { min-height: 2.6em; margin: 1px 0 2px; }
#app[data-dense="2"] .timer { height: 10px; }
#app[data-dense="2"] .field input { height: 34px; font-size: 24px; }
#app[data-dense="2"] .field.panel { margin-top: 5px; margin-bottom: 5px; }
#app[data-dense="2"] .go { margin-top: 5px; margin-bottom: 5px; padding-top: 9px; padding-bottom: 7px; }

/* ---------- side: pitch left, question and input right ---------- */
#app[data-layout="side"] #hud { right: auto; width: var(--leftw); padding-right: 2px; }
#app[data-layout="side"] #play { top: 0; bottom: 0; left: auto; right: 0; width: var(--col); justify-content: center; padding: calc(3px + var(--sat)) max(4px, var(--sar)) calc(3px + var(--sab)) 0; }
#app[data-layout="side"] .card { flex: 0 1 auto; min-height: 0; width: calc(100% - 16px); display: flex; flex-direction: column; overflow: hidden; }
#app[data-layout="side"] #q-text { flex: none; min-height: 1em; }
#app[data-layout="side"] #q-result { flex: none; min-height: 0; }
#app[data-layout="side"] .card-top, #app[data-layout="side"] .timer, #app[data-layout="side"] .entry { flex: none; }
#app[data-layout="side"] #toast { left: calc(var(--leftw) / 2); }
#app[data-hudwrap="1"] #hud { flex-wrap: wrap; row-gap: 0; }
#app[data-hudwrap="1"] .hud-mid { order: 9; flex: 0 0 100%; margin-top: 1px; }

#app[data-layout="side"] #q-result { font-size: 20px; }
#app[data-layout="side"] #r-answer, #app[data-layout="side"] #r-comment { font-size: 1em; }

#app[data-layout="side"][data-roomy="1"] #q-text { font-size: 27px; margin: 8px 0 10px; }
#app[data-layout="side"][data-roomy="1"] #q-result { font-size: 23px; }
#app[data-layout="side"][data-roomy="1"] .card { padding: 10px 14px 9px; }
#app[data-layout="side"][data-roomy="1"] .field input { height: 46px; font-size: 28px; }
/* home, side by side: title over the pitch on the left, menu on the right */
#app[data-layout="side"] #home { flex-direction: row; align-items: stretch; justify-content: space-between; padding-top: calc(8px + var(--sat)); padding-bottom: calc(6px + var(--sab)); }
#app[data-layout="side"] #home .logo { width: calc(var(--leftw) - var(--sal) - 12px); align-self: flex-start; }
#app[data-layout="side"] #home .menu { width: calc(var(--col) - var(--sar) - 12px); max-width: none; justify-content: center; }
#app[data-layout="side"] .logo h1 { font-size: clamp(16px, calc((var(--leftw) - var(--sal) - 24px) / 16.5), 40px); margin: 6px 0 2px; letter-spacing: 1px; white-space: nowrap;
  text-shadow: 3px 0 0 var(--line), -3px 0 0 var(--line), 0 3px 0 var(--line), 0 -3px 0 var(--line), 3px 3px 0 var(--line), -3px 3px 0 var(--line), 3px -3px 0 var(--line), -3px -3px 0 var(--line); }
#app[data-layout="side"] .logo h1 span { display: inline; }
#app[data-layout="side"] .tagline { font-size: 20px; margin-top: 6px; }
#app:not([data-dense="0"]) .logo h1 { margin: 8px 0 4px; }
#app[data-layout="stack"]:not([data-dense="0"]) .logo h1 { font-size: clamp(22px, 7.5vw, 44px); }
#app:not([data-dense="0"]) .tagline { margin-top: 6px; font-size: 20px; }
#app:not([data-dense="0"]) .menu .btn { padding-top: 9px; padding-bottom: 7px; margin-top: 5px; margin-bottom: 5px; }
#app:not([data-dense="0"]) .menu .btn.primary { padding-top: 12px; padding-bottom: 10px; }
#app:not([data-dense="0"]) .menu .sub { margin: 2px 6px 3px; font-size: 17px; }
#app[data-dense="2"] .tagline, #app[data-dense="2"] .logo-kicker { display: none; }
#app[data-dense="2"] .logo h1 { margin-top: 0; }

/* result, side by side */
#app[data-layout="side"] #result { left: auto; right: 0; width: var(--col); justify-content: center; padding: calc(4px + var(--sat)) max(4px, var(--sar)) calc(6px + var(--sab)) 0; }
#app:not([data-dense="0"]) #result { padding-top: calc(40px + var(--sat)); }
#app[data-layout="side"]:not([data-dense="0"]) #result { padding-top: calc(4px + var(--sat)); }
#app:not([data-dense="0"]) .res-score { font-size: 28px; margin: 6px 0 6px; }
#app:not([data-dense="0"]) #res-pts { font-size: 36px; }
#app:not([data-dense="0"]) #res-grid { margin: 8px 0 4px; }


/* ---------- roomy screens (1x desktop, iPad): keep Press Start 2P on its 8px grid ---------- */
#app[data-big="1"] { font-size: 24px; }
#app[data-big="1"] .lbl { font-size: 8px; }
#app[data-big="1"] #hud { padding-top: calc(14px + var(--sat)); gap: 10px; }
#app[data-big="1"] .tile { min-width: 128px; padding: 8px 12px 5px; }
#app[data-big="1"] .tile .lbl { font-size: 8px; }
#app[data-big="1"] .tile .val { font-size: 40px; }
#app[data-big="1"] #pips i { width: 13px; height: 13px; margin: 3px; }
#app[data-big="1"] #hud-min { font-size: 8px; }
#app[data-big="1"] .hud-mid { max-width: 420px; }
#app[data-big="1"] .btn { font-size: 16px; padding: 14px 16px 12px; }
#app[data-big="1"] .btn.small { font-size: 8px; padding: 13px 10px 11px; }
#app[data-big="1"] .btn.save-btn { font-size: 8px; padding: 13px 10px 11px; }
#app[data-big="1"] .menu .btn.primary { font-size: 16px; }
#app[data-big="1"] .nick .btn { font-size: 8px; }
#app[data-big="1"] .go { font-size: 16px; }
#app[data-big="1"] #play { padding-bottom: calc(22px + var(--sab)); }
#app[data-big="1"] .card { padding: 14px 18px 12px; }
#app[data-big="1"] .card-top .lbl { font-size: 8px; letter-spacing: 2px; }
#app[data-big="1"] #q-text { font-size: 34px; min-height: 2.2em; }
#app[data-big="1"] #q-text.small { font-size: 30px; }
#app[data-big="1"] #r-answer, #app[data-big="1"] #r-comment { font-size: 26px; }
#app[data-big="1"] .tier-row { font-size: 16px; }
#app[data-big="1"] #r-pts { font-size: 16px; }
#app[data-big="1"] #timer-num { font-size: 8px; }
#app[data-big="1"] .field input { height: 52px; font-size: 34px; }
#app[data-big="1"] .logo-kicker { font-size: 8px; letter-spacing: 4px; }
#app[data-big="1"] .logo h1 { font-size: 64px; }
#app[data-big="1"] .tagline { font-size: 30px; }
#app[data-big="1"] .tag { font-size: 8px; }
#app[data-big="1"] .res-score .side { font-size: 8px; }
#app[data-big="1"] .res-score .dash { font-size: 16px; }
#app[data-big="1"] .modal-head .lbl { font-size: 8px; }
#app[data-big="1"] #home { padding-top: calc(34px + var(--sat)); padding-bottom: calc(30px + var(--sab)); }
#app[data-big="1"] #result { justify-content: center; padding-top: calc(90px + var(--sat)); }
#app[data-big="1"] #banner span { font-size: 32px; padding: 14px 20px 10px; }
#app[data-big="1"] #banner span.info { font-size: 16px; }
#app[data-big="1"] #modal-body h3 { font-size: 8px; }

@media (prefers-reduced-motion: reduce) { #banner span, .tile .val.bump, #pips i.now { animation: none; } }

/* no sky behind the title or HUD: switch the dark-on-pastel labels to light-on-dark */
#app[data-sky="0"] .tagline { color: var(--mute); }
#app[data-sky="0"] .logo-kicker, #app[data-sky="0"] #hud-min { color: var(--mute); background: rgba(22, 26, 51, 0.7); }

/* ---------- micro: a phone on its side with the keyboard up leaves under 130px of height ---------- */
#app:not([data-micro="0"]) #hud { padding-top: var(--sat); }
#app:not([data-micro="0"]) .tile { margin: 4px 5px; padding: 1px 5px 0; }
#app:not([data-micro="0"]) .tile .val { font-size: 19px; }
#app:not([data-micro="0"]) .sq { width: 16px; height: 16px; font-size: 10px; margin: 4px 6px; }
#app:not([data-micro="0"]) #play { padding-top: calc(1px + var(--sat)); padding-bottom: calc(1px + var(--sab)); }
#app:not([data-micro="0"]) .card { margin: 5px 6px 3px; padding: 2px 7px 3px; --px: 2px; }
#app:not([data-micro="0"]) .card-top { display: none; }
#app:not([data-micro="0"]) #q-text { font-size: 18px; line-height: 0.95; margin: 0 0 2px; min-height: 1em; }
#app:not([data-micro="0"]) #q-result { font-size: 16px; margin: 0; }
#app:not([data-micro="0"]) .tier-row { font-size: 9px; }
#app:not([data-micro="0"]) #r-pts { font-size: 9px; }
#app:not([data-micro="0"]) #r-answer, #app:not([data-micro="0"]) #r-comment { margin: 1px 0 0; line-height: 0.95; }
#app:not([data-micro="0"]) .timer { height: 7px; }
#app:not([data-micro="0"]) .timer-track { height: 4px; }
#app:not([data-micro="0"]) #timer-num { font-size: 7px; min-width: 16px; }
#app:not([data-micro="0"]) .field.panel { margin: 4px 6px; --px: 2px; }
#app:not([data-micro="0"]) .field input { height: 26px; font-size: 21px; padding: 3px 8px 1px; }
#app:not([data-micro="0"]) #unit { font-size: 16px; }
#app:not([data-micro="0"]) .go { margin: 4px 7px 6px 3px; padding: 6px 8px 3px; min-width: 46px; font-size: 10px; --px: 2px; }
#app:not([data-micro="0"]) #banner span { font-size: 11px; padding: 5px 7px 3px; }

/* ---------- nano: under about 90px (landscape phone, keyboard, browser tab bar). Score chip, pitch strip, question, input. ---------- */
#app[data-nano="1"] #hud { width: auto; padding: var(--sat) 0 0 var(--sal); }
#app[data-nano="1"] #btn-quit, #app[data-nano="1"] .hud-mid, #app[data-nano="1"] .tile-r, #app[data-nano="1"] #btn-mute { display: none; }
#app[data-nano="1"] .tile { margin: 5px; padding: 0 4px; }
#app[data-nano="1"] .tile .val { font-size: 16px; }
#app[data-nano="1"] .card { margin: 4px 6px 2px; padding: 1px 6px 2px; }
#app[data-nano="1"] #q-text { font-size: 16px; line-height: 0.9; margin: 0 0 1px; }
#app[data-nano="1"] #q-result { font-size: 13px; }
#app[data-nano="1"] .timer { height: 4px; }
#app[data-nano="1"] .timer-track { height: 3px; box-shadow: none; }
#app[data-nano="1"] #timer-num { display: none; }
#app[data-nano="1"] .field.panel { margin: 3px 6px; }
#app[data-nano="1"] .field input { height: 21px; font-size: 18px; padding: 2px 6px 0; }
#app[data-nano="1"] .go { margin: 3px 7px 5px 3px; padding: 4px 7px 2px; font-size: 9px; }

/* ---------- one row: under about 50px. Score chip, pitch strip, question and input side by side. ---------- */
#app[data-micro="3"] #play { flex-direction: row; align-items: center; padding-top: var(--sat); padding-bottom: var(--sab); }
#app[data-micro="3"] .card { flex: 1 1 50%; width: auto; margin: 2px 5px; padding: 0 5px 1px; max-height: calc(100% - 4px); }
#app[data-micro="3"] #q-text { font-size: 13px; line-height: 0.88; margin: 0; }
#app[data-micro="3"] #q-result { font-size: 11px; }
#app[data-micro="3"] .tier-row { font-size: 7px; }
#app[data-micro="3"] #r-answer { display: none; }
#app[data-micro="3"] .timer { height: 3px; }
#app[data-micro="3"] .entry { flex: 1 1 50%; width: auto; margin: 0; }
#app[data-micro="3"] .field.panel { margin: 2px 5px; }
#app[data-micro="3"] .go { margin: 2px 6px 4px 2px; }
#app[data-micro="3"] .tile { margin: 3px 4px; }

/* ---------- a part-open iPhone Duo: nothing sits across the fold (js/main.js picks the arrangement) ----------
   data-fold="v": held like a book. The pitch is the left leaf, the question the right; dialogs open on the right leaf.
   data-fold="h": stood like a laptop. The pitch is the upper leaf; the question, menus and dialogs the lower. */
#app[data-fold="v"] #modal, #app[data-fold="v"] #ad-break { justify-content: flex-end; padding-left: calc(100% - var(--col) + 12px); }
#app[data-fold="v"] .modal-panel { max-width: none; }
#app[data-fold="h"] #modal, #app[data-fold="h"] #ad-break { align-items: flex-end; padding-top: calc(var(--foldto) + 12px); }
#app[data-fold="h"] .modal-panel { max-height: 100%; }
#app[data-fold="h"] #result { padding-top: calc(var(--foldto) + 12px); justify-content: flex-start; }
#app[data-fold="h"] #toast { top: calc(var(--foldto) + 12px); }

/* Practice topics and "report this question" (modal) */
.topics { display: flex; flex-wrap: wrap; justify-content: center; margin: 4px 0 8px; }
.topics .btn { flex: 1 1 40%; margin: 4px; }
#res-list .report { display: block; margin-top: 4px; padding: 2px 0; border: 0; background: none; color: var(--mute); font: inherit; font-size: 17px; text-decoration: underline; cursor: pointer; }
#res-list .report:disabled { text-decoration: none; cursor: default; }
.report-note { width: 100%; box-sizing: border-box; margin-top: 4px; padding: 8px; font: inherit; font-size: 20px; color: var(--cream); background: var(--ink-2); border: 2px solid #0d1026; }
