/* Fonts are served from this site (public/fonts, SIL Open Font License), so visitors' browsers never contact Google. */
@font-face { font-family: "Bricolage Grotesque"; src: url("/fonts/bricolage-grotesque-latin-opsz-normal.woff2") format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Sans"; src: url("/fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }

:root {
  --bg: #EDF1EC;
  --surface: #F9FBF8;
  --ink: #14201B;
  --muted: #56655D;
  --line: #CFD8D1;
  --accent: #1E5C47;
  --accent-soft: #DCEAE2;
  --you: #B9770E;
  --you-soft: #F6E7C8;
  --track: #DDE4DE;
  --danger: #A33A2C;
  --danger-soft: #F6E0DB;
  --f-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-body: "IBM Plex Sans", "Helvetica Neue", Arial, system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1512; --surface: #161F1B; --ink: #E4ECE7; --muted: #95A69C; --line: #2B3832;
    --accent: #62C29A; --accent-soft: #1D3A2F; --you: #F0B24A; --you-soft: #3D2F15; --track: #24302B;
    --danger: #F08A7A; --danger-soft: #3E211C; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1512; --surface: #161F1B; --ink: #E4ECE7; --muted: #95A69C; --line: #2B3832;
  --accent: #62C29A; --accent-soft: #1D3A2F; --you: #F0B24A; --you-soft: #3D2F15; --track: #24302B;
  --danger: #F08A7A; --danger-soft: #3E211C; color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 15px; line-height: 1.55; }
.app {
  max-width: 780px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 20px 40px;
  display: flex; flex-direction: column; gap: 28px; min-height: 100%;
}
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--f-display); font-weight: 700; font-size: 20px; letter-spacing: -0.01em; }
.brand svg { flex: none; }
.chip { font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 700; letter-spacing: -0.015em; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(28px, 6vw, 42px); line-height: 1.08; }
h2 { font-size: clamp(22px, 4.5vw, 28px); line-height: 1.2; }
h3 { font-size: 16px; font-weight: 500; letter-spacing: 0; }
p { margin: 0; }
.eyebrow { font-weight: 600; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); }
.lede { font-size: 17px; color: var(--muted); max-width: 58ch; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn { border: 0; border-radius: 10px; padding: 13px 22px; font-weight: 600; background: var(--accent); color: var(--surface); transition: transform .12s ease, opacity .12s ease; }
.btn:hover { opacity: .92; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-link { background: none; border: 0; padding: 6px 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* Intro */
.intro { display: grid; grid-template-columns: 1fr auto; gap: 28px; align-items: center; }
.intro > div { min-width: 0; }
.fine { font-size: 13px; color: var(--muted); }
.count { font-size: 14px; color: var(--muted); }
.count b { color: var(--ink); font-weight: 500; }
@media (max-width: 620px) { .intro { grid-template-columns: 1fr; } .intro .gauge-wrap { order: -1; justify-self: start; } }

/* Question */
.progress { display: flex; flex-direction: column; gap: 8px; }
.progress-meta { display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: 12px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.bar { height: 4px; background: var(--track); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); transition: width .25s ease; }
.options { display: flex; flex-direction: column; gap: 10px; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; padding: 15px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 16px; transition: border-color .12s ease, background .12s ease; }
.opt:hover { border-color: var(--accent); }
.opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.opt kbd { font-family: var(--f-mono); font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; flex: none; }
.opt .num { font-family: var(--f-mono); color: var(--muted); margin-right: 10px; }

/* Email step */
.field { display: flex; flex-direction: column; gap: 6px; max-width: 440px; }
.field label { font-weight: 500; }
.field input[type=email], .field input[type=password] { font: inherit; font-size: 16px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 100%; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--muted); max-width: 520px; }
.check input { margin-top: 4px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.err { color: var(--danger); font-size: 14px; }
.notice { background: var(--danger-soft); color: var(--ink); border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.notice.neutral { background: var(--accent-soft); }

/* Results */
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filt { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 14px; font-size: 14px; }
.filt[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.filt .n { font-family: var(--f-mono); font-size: 12px; opacity: .7; margin-left: 4px; }
.hero { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; }
.hero > div { min-width: 0; }
@media (max-width: 620px) { .hero { grid-template-columns: 1fr; } }
.hero .big { font-family: var(--f-display); font-size: 20px; font-weight: 700; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.card-head .avg { font-family: var(--f-mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.dist { display: flex; flex-direction: column; gap: 9px; }
.dist-row { display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 4px 10px; align-items: center; font-size: 13.5px; }
.dist-row .lbl { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dist-row .pct { font-family: var(--f-mono); font-variant-numeric: tabular-nums; text-align: right; color: var(--muted); font-size: 12.5px; }
.dist-row .track { grid-column: 1 / -1; height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.dist-row .track > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.dist-row.me .track > i { background: var(--you); }
.dist-row.me .pct { color: var(--ink); }
.you { font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase; background: var(--you-soft); color: var(--ink); border-radius: 4px; padding: 1px 5px; }
.mix { display: flex; gap: 24px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.mix b { color: var(--ink); font-weight: 500; }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: 14px; padding: 22px; color: var(--muted); }
footer { margin-top: auto; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Additions to the prototype: page reset, gauge/brand colours as classes (no inline styles, so a strict CSP works), footer link, privacy page. */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
.app { min-height: 100vh; }
.s-track { stroke: var(--track); }
.s-line { stroke: var(--line); }
.s-accent { stroke: var(--accent); }
.s-you { stroke: var(--you); }
.f-ink { fill: var(--ink); }
.g-num { fill: var(--ink); font-family: var(--f-display); font-weight: 700; font-size: 44px; }
.g-cap { fill: var(--muted); font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .08em; }
.g-tick { fill: var(--muted); font-family: var(--f-mono); font-size: 10px; }
.legend i.dot-accent { background: var(--accent); }
.legend i.dot-you { background: var(--you); }
.brand { color: inherit; text-decoration: none; }
a { color: var(--accent); text-underline-offset: 3px; }
footer a { color: var(--muted); }
.check a { color: inherit; }
.prose { max-width: 66ch; display: flex; flex-direction: column; gap: 14px; }
.prose h2 { margin-top: 14px; }
.prose ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.draft { background: var(--you-soft); border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.turnstile { margin-top: -12px; }
.turnstile[hidden] { display: none; }

/* Start page: quarterly round note and the moving gauge */
.round { display: flex; gap: 10px; align-items: baseline; font-size: 14px; color: var(--muted); max-width: 58ch; }
.round b { color: var(--ink); font-weight: 600; }
.live-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); transform: translateY(-1px); animation: live 2s ease-out infinite; }
@keyframes live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }
.gauge-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.gauge-note { text-align: center; }
.g-fill { animation: glow 2.4s ease-in-out infinite; }
@keyframes glow { 50% { opacity: .7; } }
@media (prefers-reduced-motion: reduce) { .live-dot, .g-fill { animation: none; } }

/* Start page on a laptop-height screen: tighten spacing so it fits without scrolling. */
@media (min-width: 621px) and (max-height: 900px) {
  .app { padding-block: 16px 20px; gap: 20px; }
  .intro .stack-lg { gap: 18px; }
  .intro .stack { gap: 12px; }
  .intro h1 { font-size: clamp(28px, 5.2vh, 40px); }
  .intro .lede { font-size: 16px; }
}

/* Results: share prompt */
.share { display: flex; flex-direction: column; gap: 12px; background: var(--accent-soft); border-radius: 14px; padding: 18px 20px; }
.share .btn { text-decoration: none; display: inline-block; }
.empty b { color: var(--ink); }
.share .btn-ghost { border-color: var(--accent); }
.copy-field { font: inherit; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--accent); background: var(--surface); color: var(--ink); min-width: 0; width: 240px; }
.btn-sm { padding: 9px 14px; font-size: 14px; }
