/* Diagnose – shared styles (pupil check, teacher dashboard, QR cards). System fonts only: works offline. */
:root {
  color-scheme: light;
  --bg: #f3f5f7; --surface: #ffffff; --sunken: #e8ecf0; --ink: #121a22; --ink-2: #4a5663; --muted: #7a8591; --line: #d3d9df;
  --accent: #0f6f68; --accent-ink: #ffffff; --accent-soft: #d8efec;
  --blk-mv: #3f73d9; --blk-ctl: #d99100; --blk-ink: #ffffff;
  --wall: #3a4552; --flag: #d33b3b; --bot: #0f6f68;
  /* charts (validated: dataviz validator, light surface) */
  --v-ok: #2a78d6; --v-idk: #a3a19a; --v-no: #e34948; --v-dot: #2a78d6;
  --v-grid: #e1e0d9; --v-axis: #c3c2b7; --v-surface: #fcfcfb;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Liberation Sans", Arial, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1419; --surface: #171e25; --sunken: #0b0f13; --ink: #e8edf2; --ink-2: #a6b1bc; --muted: #7d8893; --line: #2b3640;
    --accent: #3cb8ad; --accent-ink: #06201d; --accent-soft: #123a37;
    --blk-mv: #4a7fe6; --blk-ctl: #c98500; --wall: #8a96a3; --flag: #e66767; --bot: #3cb8ad;
    --v-ok: #3987e5; --v-idk: #5a5955; --v-no: #e66767; --v-dot: #3987e5;
    --v-grid: #2c2c2a; --v-axis: #383835; --v-surface: #1a1a19;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1419; --surface: #171e25; --sunken: #0b0f13; --ink: #e8edf2; --ink-2: #a6b1bc; --muted: #7d8893; --line: #2b3640;
  --accent: #3cb8ad; --accent-ink: #06201d; --accent-soft: #123a37;
  --blk-mv: #4a7fe6; --blk-ctl: #c98500; --wall: #8a96a3; --flag: #e66767; --bot: #3cb8ad;
  --v-ok: #3987e5; --v-idk: #5a5955; --v-no: #e66767; --v-dot: #3987e5;
  --v-grid: #2c2c2a; --v-axis: #383835; --v-surface: #1a1a19;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 1.0625rem/1.5 var(--font); }
h1, h2, h3 { line-height: 1.15; margin: 0; text-wrap: balance; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 760px; margin: 0 auto; padding-inline: 16px; padding-block: 16px 48px; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.el { display: block; font-size: .88em; color: var(--ink-2); }
.note { color: var(--ink-2); font-size: .95rem; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn { border: 2px solid var(--line); background: var(--surface); border-radius: 10px; padding: 10px 16px; font-weight: 650; min-height: 48px; }
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: .92rem; }

/* ---------- brand mark: 3×3 pixels ---------- */
.mark { display: inline-grid; grid-template-columns: repeat(3, 7px); gap: 2px; vertical-align: middle; }
.mark i { width: 7px; height: 7px; background: var(--accent); border-radius: 1px; }
.mark i:nth-child(2n) { opacity: .35; }

/* ---------- pupil check ---------- */
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-block: 8px 14px; }
.top b { font-weight: 750; }
.steps { display: flex; gap: 3px; }
.steps i { flex: 1; height: 14px; border-radius: 4px; background: var(--sunken); }
.steps i.done { background: var(--accent); }
.steps i.cur { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.steps-label { margin: 8px 0 16px; font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; display: grid; gap: 16px; }
.q { font-size: 1.35rem; font-weight: 700; line-height: 1.3; }
.pic { display: flex; justify-content: center; overflow-x: auto; }
.opts { display: grid; gap: 10px; }
.opt { display: flex; align-items: center; gap: 14px; text-align: left; width: 100%; min-height: 56px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px; background: var(--surface); }
.opt:hover { border-color: var(--ink-2); }
.opt[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.opt .opt-pic { flex: none; display: flex; align-items: center; }
.opt .opt-txt { flex: 1; }
.opt.idk { border-style: dashed; color: var(--ink-2); }
.opts.has-pics .opt { align-items: flex-start; }
.faces { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.faces .opt { flex-direction: column; justify-content: center; text-align: center; min-height: 96px; }
.faces .face { font-size: 2.2rem; line-height: 1; }
.nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.nav .btn { flex: 1; }
.speak { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: .92rem; }
.warn { border-left: 4px solid var(--blk-ctl); background: var(--surface); padding: 10px 12px; border-radius: 6px; font-size: .95rem; }
.endqr { display: grid; justify-items: center; gap: 12px; text-align: center; }
.endqr .qr { width: min(78vw, 320px); height: auto; border: 8px solid #fff; border-radius: 8px; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .8rem; word-break: break-all; color: var(--ink-2); user-select: all; }
.field { display: grid; gap: 6px; }
.field input, .field select, .field textarea { padding: 10px 12px; border: 2px solid var(--line); border-radius: 10px; background: var(--surface); }

/* ---------- pictures ---------- */
.ico { width: 40px; height: 40px; color: var(--ink); }
.ico-opt { width: 34px; height: 34px; }
.icons { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; }
.icons figure { margin: 0; display: grid; justify-items: center; gap: 4px; min-width: 76px; }
.icons figcaption { font-size: .9rem; text-align: center; }
.tree, .tree ul { list-style: none; margin: 0; padding-left: 22px; }
.tree { padding-left: 0; font-size: 1.05rem; }
.tree li { margin: 4px 0; }
.tree li > .ico { width: 22px; height: 22px; vertical-align: -5px; margin-right: 6px; }
.ico-dir { color: var(--blk-ctl); }
.grid { width: 100%; max-width: 360px; height: auto; }
.gridprog { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; align-items: flex-start; }
.gridprog .grid { flex: 1 1 220px; }
.g-cell { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.g-wall { fill: var(--wall); }
.g-hatch { stroke: var(--surface); stroke-width: 2; opacity: .35; }
.g-pole { stroke: var(--ink); stroke-width: 2.5; }
.g-flag { fill: var(--flag); }
.g-bot { fill: var(--bot); }
.g-arrow { fill: #fff; }
.g-mark { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.g-mark-t { fill: var(--ink); font: 700 15px var(--font); }
.blocks { display: grid; gap: 4px; justify-items: start; min-width: 220px; }
.blk { border-radius: 8px; font-weight: 650; font-size: .98rem; }
.blk.mv { background: var(--blk-mv); color: var(--blk-ink); padding: 7px 12px; }
.blk.ctl { background: var(--blk-ctl); color: var(--blk-ink); padding: 0; display: grid; }
.blk-h { padding: 7px 12px; }
.blk-mid { border-top: 3px solid rgba(0,0,0,.12); }
.blk-b { margin-left: 18px; padding: 4px 6px 4px 0; display: grid; gap: 4px; justify-items: start; background: var(--surface); border-radius: 0 6px 6px 0; }
.blk-f { height: 12px; }
.blk .el { color: rgba(255,255,255,.85); font-weight: 500; font-size: .85em; }
.sg { border: 2px solid var(--ink); background: var(--surface); min-width: 240px; max-width: 420px; width: 100%; font-size: .98rem; }
.sg-s { padding: 8px 10px; border-bottom: 1.5px solid var(--ink); }
.sg > :last-child > .sg-s:last-child, .sg > .sg-s:last-child { border-bottom: 0; }
.sg-loop { border-bottom: 1.5px solid var(--ink); }
.sg-loop:last-child { border-bottom: 0; }
.sg-head { font-weight: 650; }
.sg-in { display: flex; }
.sg-bar { width: 26px; flex: none; border-right: 1.5px solid var(--ink); }
.sg-body { flex: 1; }
.sg-body > :last-child { border-bottom: 0; }
.sg-if { border-bottom: 1.5px solid var(--ink); }
.sg-if:last-child { border-bottom: 0; }
.sg-cond { position: relative; height: 58px; border-bottom: 1.5px solid var(--ink); }
.sg-v { position: absolute; inset: 0; width: 100%; height: 100%; }
.sg-v path { fill: none; stroke: var(--ink); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.sg-q { position: absolute; left: 0; right: 0; top: 4px; text-align: center; font-weight: 650; }
.sg-ja { position: absolute; left: 8px; bottom: 4px; font-size: .9rem; }
.sg-nein { position: absolute; right: 8px; bottom: 4px; font-size: .9rem; }
.sg-cols { display: grid; grid-template-columns: 1fr 1fr; }
.sg-cols > div:first-child { border-right: 1.5px solid var(--ink); }
.sg-cols .sg-s:last-child { border-bottom: 0; }
.sg-empty { color: var(--muted); text-align: center; }
.sg .el { font-size: .82em; }
.shape { width: 64px; height: 60px; }
.shape path { fill: none; stroke: var(--ink); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.badge { display: inline-block; border: 2.5px solid var(--ink); border-radius: 999px; padding: 4px 14px; font-weight: 800; letter-spacing: .04em; }

/* ---------- dashboard ---------- */
.dash { max-width: 1200px; margin: 0 auto; padding-inline: 16px; padding-block: 12px 56px; }
.dash-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; align-items: center; padding-block: 8px 12px; border-bottom: 1px solid var(--line); }
.dash-top h1 { font-size: 1.35rem; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab { border: 1px solid transparent; background: none; border-radius: 999px; padding: 6px 14px; color: var(--ink-2); }
.tab[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.panel { padding-top: 20px; display: grid; gap: 22px; }
.sect { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 12px; min-width: 0; }
.sect h2 { font-size: 1.1rem; }
.sect .sub { color: var(--ink-2); font-size: .92rem; }
.cols2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
@media (max-width: 860px) { .cols2 { grid-template-columns: 1fr; } }
.cols3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
@media (max-width: 1000px) { .cols3 { grid-template-columns: 1fr; } }
.stat { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: baseline; }
.stat b { font-size: 2rem; font-weight: 750; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: .85rem; font-variant-numeric: tabular-nums; }
.chip.miss { border-style: dashed; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .88rem; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.viz { width: 100%; height: auto; display: block; overflow: visible; }
.viz text { fill: var(--ink-2); font: 12px var(--font); }
.viz .t-strong { fill: var(--ink); font-weight: 650; }
.viz .t-grp { fill: var(--ink); font-weight: 700; font-size: 11px; letter-spacing: .06em; }
.viz .gridl { stroke: var(--v-grid); stroke-width: 1; }
.viz .axis { stroke: var(--v-axis); stroke-width: 1; }
.viz .hit { fill: transparent; }
.viz .hit:hover + .hl, .viz .hl.on { opacity: 1; }
.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; font-size: .9rem; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-weight: 650; color: var(--ink-2); font-size: .8rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.heat td.cell { width: 26px; min-width: 26px; height: 26px; padding: 0; text-align: center; font-size: .8rem; font-weight: 700; border: 2px solid var(--surface); color: #fff; }
.heat td.c-ok { background: var(--v-ok); }
.heat td.c-no { background: var(--v-no); }
.heat td.c-idk { background: var(--v-idk); color: var(--ink); }
.heat td.c-none { background: var(--sunken); color: var(--muted); }
.heat th.grp { text-align: center; border-left: 2px solid var(--line); }
.heat th.it { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 500; padding: 4px 2px; }
.itemrow { display: grid; grid-template-columns: minmax(0, 1fr) 220px; gap: 8px 16px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.itemrow details { grid-column: 1 / -1; }
.itemrow summary { cursor: pointer; color: var(--accent); font-weight: 600; }
@media (max-width: 640px) { .itemrow { grid-template-columns: 1fr; } }
.tip { position: fixed; z-index: 30; pointer-events: none; background: var(--ink); color: var(--bg); padding: 6px 10px; border-radius: 8px; font-size: .85rem; max-width: 280px; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 40; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-weight: 600; box-shadow: 0 8px 22px rgba(0,0,0,.22); max-width: calc(100% - 32px); }
.toast.bad { background: var(--v-no); color: #fff; }
.danger { border-color: var(--v-no); color: var(--v-no); }

/* ---------- QR cards ---------- */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.qcard { border: 1.5px dashed #9aa4ae; border-radius: 10px; padding: 12px; display: grid; grid-template-columns: 118px 1fr; gap: 12px; background: #fff; color: #111; break-inside: avoid; }
.qcard .qr { width: 118px; height: 118px; }
.qcard h3 { font-size: 1.5rem; letter-spacing: .02em; }
.qcard .who { border-bottom: 1px solid #333; min-height: 1.6em; font-size: 1rem; }
.qcard ol { margin: 4px 0 0; padding-left: 18px; font-size: .82rem; line-height: 1.35; }
.qcard .small { font-size: .74rem; color: #444; }
@media print {
  @page { size: A4; margin: 10mm; }
  body { background: #fff; }
  .no-print, .dash-top, .toast, .tip { display: none !important; }
  .print-only { display: block !important; }
  .dash, .panel { padding: 0; }
  .cards { gap: 6mm; }
  .qcard { min-height: 62mm; grid-template-columns: 38mm 1fr; }
  .qcard .qr { width: 38mm; height: 38mm; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
