:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --text: #15202b;
  --muted: #5b6875;
  --border: #dde2e8;
  --brand: #1b3a6b;
  --brand-ink: #ffffff;
  --accent: #2f6fdb;
  --ok: #1f8a4c;
  --warn: #b7791f;
  --bad: #c0392b;
  --chip: #e8eef8;
  --chip-on: #1b3a6b;
  --radius: 14px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141a;
    --surface: #171e26;
    --surface-2: #1f2832;
    --text: #e6ebf0;
    --muted: #93a1af;
    --border: #2a3542;
    --brand: #7aa2e3;
    --brand-ink: #0f141a;
    --accent: #7aa2e3;
    --chip: #223042;
    --chip-on: #7aa2e3;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141a;
  --surface: #171e26;
  --surface-2: #1f2832;
  --text: #e6ebf0;
  --muted: #93a1af;
  --border: #2a3542;
  --brand: #7aa2e3;
  --brand-ink: #0f141a;
  --accent: #7aa2e3;
  --chip: #223042;
  --chip-on: #7aa2e3;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

.topbar { position: sticky; top: 0; z-index: 5; background: var(--brand); color: var(--brand-ink); padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar b { font-weight: 650; letter-spacing: .2px; }
.topbar small { opacity: .8; }

.wrap { max-width: 720px; margin: 0 auto; padding: 16px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stack > * + * { margin-top: 12px; }
.muted { color: var(--muted); }
h1 { font-size: 1.35rem; margin: 0 0 8px; }
h2 { font-size: 1.1rem; margin: 0 0 8px; }

label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=tel], select, textarea {
  width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }

.btn { appearance: none; border: 0; border-radius: 10px; padding: 11px 16px; background: var(--brand); color: var(--brand-ink); font-weight: 600; cursor: pointer; }
.btn.secondary { background: var(--surface-2); color: var(--text); }
a.btn { display: inline-block; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, a:focus-visible, .scroll:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.topbar a { color: inherit; padding: 8px 10px; margin: -8px -10px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.small { font-size: .85rem; }
.err { color: var(--bad); font-size: .9rem; }
.err:empty { display: none; }
.live { font-size: .9rem; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* data category tags (dashboard) */
.tag { display: inline-block; font-size: .8rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; margin-right: 6px; }
.tag { background: var(--surface-2); color: var(--text); }
.tag.bad { background: #fde2e0; color: #8e2318; }
.tag.warn { background: #fdf0d5; color: #7a4f0b; }
.tag.ok { background: #dcf3e5; color: #155c33; }
.alert { background: #fdf0d5; color: #7a4f0b; border-radius: 10px; padding: 8px 10px; font-size: .9rem; }

/* dashboard */
.dash { max-width: 1280px; margin: 0 auto; padding: 16px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.kpis { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi .v { font-size: 2.2rem; font-weight: 700; line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: .9rem; }
.bars .bar { margin: 6px 0; }
.bars .bar .top { display: flex; justify-content: space-between; font-size: .9rem; gap: 8px; }
.bars .bar .top b { white-space: nowrap; }
.bars .bar .track { height: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.bars .bar .fill { height: 100%; background: var(--accent); border-radius: 6px; }
.bars .bar .fill.bad, .fill.bad { background: var(--bad); }
.bars .bar .fill.warn, .fill.warn { background: var(--warn); }
.bars .bar .fill.ok, .fill.ok { background: var(--ok); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: .85rem; color: var(--muted); }
.legend .sw { width: 14px; height: 10px; border-radius: 3px; background: var(--accent); margin-right: 6px; display: inline-block; vertical-align: middle; }
.legend .sw.bad { background: var(--bad); } .legend .sw.warn { background: var(--warn); } .legend .sw.ok { background: var(--ok); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.pill { display: inline-block; font-size: .78rem; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.modal .card { text-align: center; max-width: 520px; width: 100%; }
.qr { display: inline-block; padding: 16px; background: #fff; border-radius: 12px; }
.code { font-size: 2.4rem; font-weight: 800; letter-spacing: 6px; }
.scroll { max-height: 420px; overflow: auto; }
.tablewrap { overflow-x: auto; }
.badge { font-size: .75rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #7a4f0b; background: #fdf0d5; padding: 3px 8px; border-radius: 999px; }
body.mirror .card.private, body.mirror .private-only { display: none; }
h2.section { margin: 10px 0 0; color: var(--muted); font-size: 1rem; text-transform: uppercase; letter-spacing: .04em; }
td.nowrap { white-space: nowrap; }
.modal .card .qr { max-width: 100%; }
.modal .card .qr img { max-width: 100%; height: auto; }
.card.private { border-color: color-mix(in srgb, var(--warn) 45%, var(--border)); }
h3 { font-size: 1rem; margin: 12px 0 6px; }
.prose { max-width: 70ch; }
.themes { margin: 0; max-width: 70ch; }
.themes dt { font-weight: 650; margin-top: 10px; }
.themes dd { margin: 2px 0 0; color: var(--text); }
.modal .card .qr img { display: block; }

/* projector: the room's screen. Big type, few things, no free text. */
body.projector { background: #ffffff; color: #15202b; overflow: hidden; }
body.projector .topbar { display: none; }
body.projector .dash { max-width: none; height: 100vh; display: flex; flex-direction: column; padding: clamp(24px, 3vh, 48px) clamp(32px, 4vw, 80px); font-size: clamp(18px, 1.6vw, 30px); }
.projector .stage { flex: 1; min-height: 0; display: flex; flex-direction: column; cursor: pointer; overflow: hidden; }
.projector .small, .projector .muted.small { font-size: .7em; }
.projector .slide.concept { font-size: .9em; }
.projector .cols { grid-template-columns: 1.05fr 1fr; }
.projector .situations { margin: 0; padding-left: 1.2em; font-size: 1.05em; }
.projector .situations li { margin: .3em 0; text-wrap: pretty; }
.projector .hint { margin-top: 1.5em; }
.projector .cols3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5vw; }
.projector .closing-list { font-size: 1.5em; line-height: 1.35; padding-left: 1.2em; margin: .4em 0; }
.projector .closing-list li { margin: .5em 0; text-wrap: pretty; }
.projector .lead a { color: var(--accent); }
.projector .slide { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .6em; }
.projector h1 { font-size: 2.1em; line-height: 1.15; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
.projector h2 { font-size: 1.15em; margin: .6em 0 .2em; color: var(--muted); font-weight: 600; }
.projector .lead { font-size: 1.1em; margin: 0; max-width: 40ch; text-wrap: pretty; }
.projector .join { flex-direction: row; align-items: center; justify-content: space-between; gap: 4vw; }
.projector .join .code { font-size: 4em; letter-spacing: .14em; margin: .2em 0 0; }
.projector .join .joined { font-size: 1.4em; font-weight: 650; margin-top: .6em; }
.projector .join .qr { flex: none; padding: 1em; background: #fff; border: 1px solid var(--border); border-radius: 16px; }
.projector .join .qr img { display: block; width: min(560px, 60vh); height: auto; }
.projector .bigs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2vw; }
.projector .big .v { font-size: 3.4em; font-weight: 750; line-height: 1; }
.projector .big .l { color: var(--muted); margin-top: .2em; }
.projector .slide.overview { font-size: .88em; }
.projector .slide.overview h1 { font-size: 2em; }
.projector .slide.overview .big .v { font-size: 2.8em; }
.projector .bars .bar { margin: .2em 0; }
.projector .bars .bar .top { font-size: 1em; }
.projector .bars .bar .track { height: .7em; }
.projector .legend { font-size: .75em; }
.projector .scorebar .scoretext { font-size: 1.6em; font-weight: 700; margin-bottom: .2em; }
.projector .scorebar .track { height: .8em; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.projector .scorebar .fill { height: 100%; background: var(--accent); }
.projector .scorebar .fill.bad { background: var(--bad); } .projector .scorebar .fill.warn { background: var(--warn); } .projector .scorebar .fill.ok { background: var(--ok); }
.projector .scoretext.bad { color: var(--bad); } .projector .scoretext.warn { color: var(--warn); } .projector .scoretext.ok { color: var(--ok); }
.projector .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 3vw; min-height: 0; }
.projector .mis { margin: 0; padding-left: 1.2em; }
.projector .mis li { margin: .25em 0; }
.projector .core { margin: 0; font-size: 1.05em; text-wrap: pretty; }
.projector .scenario { margin: 0; font-size: 1.1em; font-weight: 600; text-wrap: pretty; }
.projector .opts { margin: .4em 0 0; padding-left: 1.4em; }
.projector .opts li { margin: .3em 0; padding: .25em .5em; border-radius: 8px; }
.projector .opts li.correct { background: #dcf3e5; color: #155c33; font-weight: 650; }
.projector .foot { display: flex; justify-content: space-between; gap: 2vw; margin-top: .8em; font-size: .7em; color: var(--muted); }

/* projector motion: slides enter, bars grow, numbers count (admin.js animate). Only changed values move on refresh. */
.projector .fill { transition: width .9s cubic-bezier(.2, .7, .2, 1); }
.projector [data-k] { display: inline-block; transform-origin: left center; }
.projector .big [data-k] { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(.6em); } }
@keyframes bump { 30% { transform: scale(1.08); color: var(--accent); } }
.projector .slide.enter > :not(.bars) { animation: rise .5s cubic-bezier(.2, .7, .2, 1) both; }
.projector .slide.enter > :nth-child(2) { animation-delay: .08s; }
.projector .slide.enter > :nth-child(3) { animation-delay: .16s; }
.projector .slide.enter > :nth-child(n+4) { animation-delay: .24s; }
.projector .slide.enter .bar,
.projector .slide.enter .closing-list li { animation: rise .45s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(.15s + var(--i, 0) * .05s); }
.projector .slide.enter .closing-list li { animation-delay: calc(.25s + var(--i, 0) * .25s); }
.projector .reveal { animation: rise .45s cubic-bezier(.2, .7, .2, 1) both; }
.projector .reveal + .reveal { animation-delay: .12s; }
.projector .bump { animation: bump .7s ease-out; }
@media (prefers-reduced-motion: reduce) {
  .projector .fill { transition: none; }
  .projector .slide.enter *, .projector .slide.enter > *, .projector .reveal, .projector .bump { animation: none !important; }
}
