/* AEA Coach – styles (mobile first, light/dark) */
:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --surface2: #f1f4f9;
  --line: #e2e7ef;
  --line-strong: #c3ccd9;
  --ink: #18212f;
  --ink2: #3b4657;
  --muted: #6b7686;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #d8f3ef;
  /* Pfister / product */
  --p: #0d9488; --p-bg: #dcf5f1; --p-ink: #0b4f49;
  /* Braunschweig / company */
  --c: #4f46e5; --c-bg: #e6e5fd; --c-ink: #2e2a8c;
  --g: #15803d; --g-bg: #dcfce7; --g-ink: #14532d;
  --o: #c2410c; --o-bg: #ffedd5; --o-ink: #7c2d12;
  --r: #b91c1c; --r-bg: #fee2e2; --r-ink: #7f1d1d;
  --y: #a16207; --y-bg: #fef3c7; --y-ink: #713f12;
  --b: #1d4ed8; --b-bg: #dbeafe; --b-ink: #1e3a8a;
  --v: #7e22ce; --v-bg: #f3e8ff; --v-ink: #581c87;
  --n-bg: #eef1f6; --n: #8c97a8; --n-ink: #233044;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 2px 8px rgba(16, 24, 40, .05);
  --radius: 16px;
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e131b; --surface: #161d28; --surface2: #1d2633; --line: #263142; --line-strong: #3a475b;
    --ink: #e8edf5; --ink2: #c4cdda; --muted: #8d99ab; --accent: #2dd4bf; --accent-ink: #062b27; --accent-soft: #123a36;
    --p: #2dd4bf; --p-bg: #0f3a36; --p-ink: #b6f2e9;
    --c: #a5a1ff; --c-bg: #26245a; --c-ink: #dcdafe;
    --g: #4ade80; --g-bg: #12341f; --g-ink: #c6f6d5;
    --o: #fb923c; --o-bg: #3f2312; --o-ink: #fed7aa;
    --r: #f87171; --r-bg: #3d1717; --r-ink: #fecaca;
    --y: #facc15; --y-bg: #3a2f0b; --y-ink: #fde68a;
    --b: #60a5fa; --b-bg: #132a4d; --b-ink: #bfdbfe;
    --v: #c084fc; --v-bg: #2e1846; --v-ink: #e9d5ff;
    --n-bg: #222c3a; --n: #6c7a8f; --n-ink: #dbe2ec;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 10px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e131b; --surface: #161d28; --surface2: #1d2633; --line: #263142; --line-strong: #3a475b;
  --ink: #e8edf5; --ink2: #c4cdda; --muted: #8d99ab; --accent: #2dd4bf; --accent-ink: #062b27; --accent-soft: #123a36;
  --p: #2dd4bf; --p-bg: #0f3a36; --p-ink: #b6f2e9;
  --c: #a5a1ff; --c-bg: #26245a; --c-ink: #dcdafe;
  --g: #4ade80; --g-bg: #12341f; --g-ink: #c6f6d5;
  --o: #fb923c; --o-bg: #3f2312; --o-ink: #fed7aa;
  --r: #f87171; --r-bg: #3d1717; --r-ink: #fecaca;
  --y: #facc15; --y-bg: #3a2f0b; --y-ink: #fde68a;
  --b: #60a5fa; --b-bg: #132a4d; --b-ink: #bfdbfe;
  --v: #c084fc; --v-bg: #2e1846; --v-ink: #e9d5ff;
  --n-bg: #222c3a; --n: #6c7a8f; --n-ink: #dbe2ec;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 2px 10px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15.5px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
  overflow-x: hidden;
}
a { color: var(--accent); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .4em; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.08rem; }
h4 { font-size: .98rem; }
p { margin: .35em 0 .7em; }
code { background: var(--surface2); border: 1px solid var(--line); border-radius: 6px; padding: 0 .3em; font-size: .92em; }
ul, ol { padding-left: 1.25em; margin: .3em 0 .8em; }
li { margin: .18em 0; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { border-bottom: 1px solid var(--line); padding: 6px 6px; text-align: left; vertical-align: top; }
th { color: var(--ink2); font-weight: 650; background: var(--surface2); }
.tbl-wrap { overflow-x: auto; margin: .4em 0 .9em; border: 1px solid var(--line); border-radius: 12px; }
.tbl-wrap table th:first-child, .tbl-wrap table td:first-child { padding-left: 10px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }

/* header */
.app-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.header-inner { max-width: 780px; margin: 0 auto; display: flex; align-items: center; gap: 8px; padding: 8px 14px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; flex: 1; }
.brand-logo { width: 36px; height: 36px; flex: none; }
.brand-txt { min-width: 0; }
.brand h1 { font-size: 1.02rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand p { margin: 0; font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back-btn { border: 0; background: var(--surface); color: var(--ink); width: 34px; height: 34px; border-radius: 10px; font-size: 1.5rem; line-height: 1; box-shadow: var(--shadow); cursor: pointer; flex: none; }
.hstats { display: flex; gap: 6px; flex: none; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: .82rem; color: var(--ink); text-decoration: none; white-space: nowrap; }

/* layout */
main { max-width: 780px; margin: 0 auto; padding: 14px 16px 24px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 15px; box-shadow: var(--shadow); margin: 0 0 12px; }
.card.flat { box-shadow: none; }
.card h3 { margin-top: 0; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 18px 2px 8px; }
.section-title h2, .section-title h3 { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tiny { font-size: .76rem; }
.center { text-align: center; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.mt { margin-top: 10px; }
.mt2 { margin-top: 18px; }
.mb0 { margin-bottom: 0; }
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
@media (min-width: 560px) { .grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.grid.tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 620px) { .grid.tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.grid > * { min-width: 0; }
.tile b, .tile .muted, .lrow .lt b, .task .tt b, h2, h3 { hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }
.tile b { overflow-wrap: anywhere; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; border-radius: 12px; padding: 10px 14px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--accent); color: var(--accent-ink); min-height: 42px; }
.btn:active { transform: translateY(1px); }
.btn.sec { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn.ghost { background: transparent; color: var(--accent); border-color: transparent; }
.btn.p { background: var(--p); color: #fff; }
.btn.c { background: var(--c); color: #fff; }
.btn.warn { background: var(--o); color: #fff; }
.btn.sm { padding: 6px 10px; min-height: 34px; font-size: .88rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.btn-row .btn { flex: 1 1 auto; }

/* tags & chips */
.tag { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .02em; padding: 2px 8px; border-radius: 999px; background: var(--n-bg); color: var(--n-ink); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.tag.P { background: var(--p-bg); color: var(--p-ink); }
.tag.C { background: var(--c-bg); color: var(--c-ink); }
.tag.X { background: var(--y-bg); color: var(--y-ink); }
.tag.small { background: var(--g-bg); color: var(--g-ink); }
.tag.big { background: var(--o-bg); color: var(--o-ink); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.chip { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 11px; font: inherit; font-size: .86rem; cursor: pointer; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* hero */
.hero { background: linear-gradient(135deg, var(--p) 0%, var(--c) 100%); color: #fff; border: 0; }
.hero h2 { margin: 0 0 4px; font-size: 1.25rem; }
.hero p { margin: 0; opacity: .92; }
.hero .big-num { font-size: 2.3rem; font-weight: 800; line-height: 1; }
.hero .phase { display: inline-block; margin-top: 8px; padding: 3px 10px; border-radius: 999px; background: rgba(255,255,255,.18); font-size: .82rem; font-weight: 600; }

/* progress bars */
.pbar { height: 8px; border-radius: 99px; background: var(--surface2); overflow: hidden; border: 1px solid var(--line); }
.pbar > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s; }
.pbar.P > i { background: var(--p); }
.pbar.C > i { background: var(--c); }

/* tiles */
.tile { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); min-height: 108px; }
.tile .ti { font-size: 1.45rem; line-height: 1; }
.tile b { font-size: .95rem; line-height: 1.25; }
.tile .muted { font-size: .78rem; line-height: 1.3; }
.tile .pbar { margin-top: auto; }
.tile.P { border-left: 4px solid var(--p); }
.tile.C { border-left: 4px solid var(--c); }
.tile.X { border-left: 4px solid var(--y); }

/* list rows */
.lrow { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--ink); margin-bottom: 8px; }
.lrow .li { font-size: 1.3rem; width: 30px; text-align: center; flex: none; }
.lrow .lt { flex: 1; min-width: 0; }
.lrow .lt b { display: block; font-size: .95rem; }
.lrow .lt span { display: block; font-size: .8rem; color: var(--muted); }
.lrow .chev { color: var(--muted); font-size: 1.2rem; }

/* daily tasks */
.task { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-bottom: 8px; }
.task .ck { width: 26px; height: 26px; border-radius: 8px; border: 2px solid var(--line-strong); flex: none; display: grid; place-items: center; font-size: .95rem; cursor: pointer; background: var(--surface); color: transparent; margin-top: 1px; }
.task.done .ck { background: var(--g); border-color: var(--g); color: #fff; }
.task.done .tt b { text-decoration: line-through; color: var(--muted); }
.task .tt { flex: 1; min-width: 0; }
.task .tt b { display: block; font-size: .95rem; }
.task .tt span { font-size: .8rem; color: var(--muted); }
.task .go { flex: none; }

/* learn content */
.learn h3 { margin-top: 4px; }
.learn .sec { margin-bottom: 12px; }
.callout { border-radius: 12px; padding: 10px 12px; margin: 8px 0 12px; border: 1px solid var(--line); background: var(--surface2); }
.callout.tip { background: var(--g-bg); border-color: transparent; color: var(--g-ink); }
.callout.trap { background: var(--r-bg); border-color: transparent; color: var(--r-ink); }
.callout.exam { background: var(--c-bg); border-color: transparent; color: var(--c-ink); }
.callout.key { background: var(--y-bg); border-color: transparent; color: var(--y-ink); }
.callout b:first-child { display: inline; }
.phrase { border-left: 3px solid var(--c); padding: 6px 10px; margin: 6px 0; background: var(--surface2); border-radius: 0 10px 10px 0; font-style: italic; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.formula { font-family: "Cambria Math", "STIX Two Math", Georgia, serif; font-size: 1.02rem; background: var(--surface2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 6px 0 10px; overflow-x: auto; white-space: normal; line-height: 1.6; }
.tbl-wrap table { font-size: .84rem; }
details.acc { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-bottom: 8px; }
details.acc > summary { cursor: pointer; padding: 11px 12px; font-weight: 650; list-style: none; display: flex; align-items: center; gap: 8px; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after { content: '▾'; margin-left: auto; color: var(--muted); transition: transform .2s; }
details.acc[open] > summary::after { transform: rotate(180deg); }
details.acc > .acc-body { padding: 0 12px 12px; }

/* diagrams */
figure.dgf { margin: 8px 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px; }
figure.dgf figcaption { font-size: .82rem; color: var(--muted); margin-top: 6px; }
figure.dgf .dg-title { font-weight: 700; font-size: .92rem; margin: 0 0 6px; }
svg.dg { width: 100%; height: auto; display: block; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
svg.dg text { fill: var(--ink); }
svg.dg .lab { fill: var(--muted); }
svg.dg .bold { font-weight: 700; }
svg.dg .ital { font-style: italic; }
svg.dg rect, svg.dg circle, svg.dg ellipse, svg.dg polygon { stroke-width: 1.3; }
.b-n { fill: var(--n-bg); stroke: var(--n); } .t-n { fill: var(--n-ink) !important; }
.b-w { fill: var(--surface); stroke: var(--line-strong); } .t-w { fill: var(--ink) !important; }
.b-p { fill: var(--p-bg); stroke: var(--p); } .t-p { fill: var(--p-ink) !important; }
.b-c { fill: var(--c-bg); stroke: var(--c); } .t-c { fill: var(--c-ink) !important; }
.b-g { fill: var(--g-bg); stroke: var(--g); } .t-g { fill: var(--g-ink) !important; }
.b-o { fill: var(--o-bg); stroke: var(--o); } .t-o { fill: var(--o-ink) !important; }
.b-r { fill: var(--r-bg); stroke: var(--r); } .t-r { fill: var(--r-ink) !important; }
.b-y { fill: var(--y-bg); stroke: var(--y); } .t-y { fill: var(--y-ink) !important; }
.b-b { fill: var(--b-bg); stroke: var(--b); } .t-b { fill: var(--b-ink) !important; }
.b-v { fill: var(--v-bg); stroke: var(--v); } .t-v { fill: var(--v-ink) !important; }
.b-a { fill: var(--accent); stroke: var(--accent); } .t-a { fill: var(--accent-ink) !important; }
.b-none { fill: none; stroke: var(--line-strong); }
.dash { stroke-dasharray: 5 4; }
.ar { stroke: var(--muted); stroke-width: 1.5; fill: none; }
.ar-a { stroke: var(--accent); }
.ar-g { stroke: var(--g); }
.ar-r { stroke: var(--r); }
.ln { stroke: var(--line-strong); stroke-width: 1; fill: none; }
.ln-a { stroke: var(--accent); stroke-width: 2; fill: none; }
.mk { fill: var(--muted); } .mk-a { fill: var(--accent); } .mk-g { fill: var(--g); } .mk-r { fill: var(--r); }
.fill-p { fill: var(--p); } .fill-c { fill: var(--c); } .fill-g { fill: var(--g); } .fill-r { fill: var(--r); } .fill-o { fill: var(--o); } .fill-n { fill: var(--n); } .fill-y { fill: var(--y); } .fill-b { fill: var(--b); } .fill-v { fill: var(--v); }
.stroke-p { stroke: var(--p); } .stroke-c { stroke: var(--c); } .stroke-r { stroke: var(--r); } .stroke-g { stroke: var(--g); } .stroke-o { stroke: var(--o); } .stroke-b { stroke: var(--b); }
svg.dg .hot { cursor: pointer; }
svg.dg .hot:hover > rect, svg.dg .hot:hover > circle, svg.dg .hot:hover > ellipse, svg.dg .hot:hover > polygon { stroke-width: 2.4; }
svg.dg .hot.sel > rect, svg.dg .hot.sel > circle, svg.dg .hot.sel > ellipse, svg.dg .hot.sel > polygon { stroke-width: 3; stroke: var(--accent); }
.dg-info { margin-top: 8px; padding: 9px 11px; border-radius: 10px; background: var(--accent-soft); color: var(--ink); font-size: .9rem; display: none; }
.dg-info.on { display: block; }
.dg-hint { font-size: .76rem; color: var(--muted); margin-top: 4px; }

/* calculators */
.calc { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; margin: 8px 0 14px; }
.calc h4 { margin: 0 0 6px; }
.calc .inp { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; margin: 6px 0; font-size: .9rem; }
.calc .inp input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); }
.calc .inp .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.calc select, .calc input[type=number], .field { font: inherit; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }
.calc .out { margin-top: 8px; padding: 10px; border-radius: 10px; background: var(--surface2); font-size: .92rem; }
.calc .out b { font-variant-numeric: tabular-nums; }
.calc .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.calc table td, .calc table th { font-size: .85rem; padding: 5px; }
.calc input.cell { width: 74px; font: inherit; font-size: .85rem; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }

/* games */
.qcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.qhead { display: flex; align-items: center; gap: 6px 8px; justify-content: space-between; margin-bottom: 8px; flex-wrap: wrap; min-width: 0; }
.qhead .tag { min-width: 0; flex: 0 1 auto; }
.card, .qcard, .lrow, .task, .calc, figure.dgf, .callout { min-width: 0; overflow-wrap: break-word; }
.stroke-ink { stroke: var(--ink); }
.qtext { font-size: 1.04rem; font-weight: 600; margin: 4px 0 12px; }
.opt { display: block; width: 100%; text-align: left; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: 12px; padding: 11px 12px; font: inherit; margin: 7px 0; cursor: pointer; }
.opt:hover { border-color: var(--accent); }
.opt.ok { border-color: var(--g); background: var(--g-bg); color: var(--g-ink); }
.opt.bad { border-color: var(--r); background: var(--r-bg); color: var(--r-ink); }
.opt.dim { opacity: .55; }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.expl { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface2); font-size: .93rem; }
.flip { min-height: 170px; display: flex; flex-direction: column; justify-content: center; cursor: pointer; }
.flip .front { font-size: 1.08rem; font-weight: 650; }
.flip .back { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line-strong); }
.rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.rate .btn { padding: 8px 4px; font-size: .84rem; min-height: 46px; flex-direction: column; gap: 0; }
.rate .btn small { font-weight: 500; opacity: .85; font-size: .7rem; }
.rate .r0 { background: var(--r); color: #fff; } .rate .r1 { background: var(--o); color: #fff; } .rate .r2 { background: var(--g); color: #fff; } .rate .r3 { background: var(--b); color: #fff; }
.olist .oi { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line-strong); border-radius: 12px; padding: 9px 10px; margin: 6px 0; background: var(--surface); }
.olist .oi .num { width: 24px; height: 24px; border-radius: 50%; background: var(--surface2); display: grid; place-items: center; font-size: .8rem; font-weight: 700; flex: none; }
.olist .oi .tx { flex: 1; font-size: .93rem; }
.olist .oi .mv { display: flex; flex-direction: column; gap: 2px; }
.olist .oi .mv button { border: 1px solid var(--line-strong); background: var(--surface2); color: var(--ink); border-radius: 7px; width: 32px; height: 24px; cursor: pointer; font-size: .8rem; }
.olist .oi.ok { border-color: var(--g); background: var(--g-bg); }
.olist .oi.bad { border-color: var(--r); background: var(--r-bg); }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.match .mi { border: 1.5px solid var(--line-strong); border-radius: 12px; padding: 9px 10px; background: var(--surface); cursor: pointer; font-size: .88rem; min-height: 46px; display: flex; align-items: center; }
.match .mi.sel { border-color: var(--accent); background: var(--accent-soft); }
.match .mi.done { opacity: .55; cursor: default; }
.match .mi.flash { border-color: var(--r); background: var(--r-bg); }
.sortq .si { border: 1.5px solid var(--line-strong); border-radius: 12px; padding: 9px 10px; margin: 7px 0; background: var(--surface); }
.sortq .si .tx { font-size: .93rem; margin-bottom: 6px; }
.sortq .si .chips { margin: 0; }
.sortq .si.ok { border-color: var(--g); background: var(--g-bg); }
.sortq .si.bad { border-color: var(--r); background: var(--r-bg); }
.kw { display: flex; gap: 8px; align-items: flex-start; padding: 7px 8px; border-radius: 10px; border: 1px solid var(--line); margin: 5px 0; cursor: pointer; background: var(--surface); font-size: .93rem; }
.kw .box { width: 20px; height: 20px; border-radius: 6px; border: 2px solid var(--line-strong); flex: none; display: grid; place-items: center; font-size: .75rem; color: transparent; margin-top: 1px; }
.kw.on { background: var(--g-bg); border-color: transparent; color: var(--g-ink); }
.kw.on .box { background: var(--g); border-color: var(--g); color: #fff; }
.fuq { border-top: 1px dashed var(--line-strong); margin-top: 10px; padding-top: 8px; }
.fuq details { margin: 6px 0; }
.fuq summary { cursor: pointer; font-weight: 600; font-size: .92rem; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.progress-top { display: flex; align-items: center; gap: 10px; margin: 0 2px 10px; }
.progress-top .pbar { flex: 1; }
.numin { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.numin input { flex: 1; font: inherit; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink); min-width: 0; }
.steps { margin: 8px 0 0; padding-left: 1.2em; }
.steps li { margin: 4px 0; }
.summary-big { font-size: 2.6rem; font-weight: 800; text-align: center; line-height: 1.1; }
textarea.notes { width: 100%; min-height: 140px; font: inherit; font-size: .92rem; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); resize: vertical; }
.case-text { font-size: .95rem; }
.case-text p { margin: .3em 0 .6em; }
.who { font-size: .72rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.who.P { background: var(--p-bg); color: var(--p-ink); }
.who.B { background: var(--c-bg); color: var(--c-ink); }
.big-timer { font-size: 2.4rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface2); border-radius: 12px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 1.35rem; }
.stat span { font-size: .75rem; color: var(--muted); }
.heat { display: grid; grid-template-columns: repeat(14, 1fr); gap: 3px; }
.heat i { aspect-ratio: 1; border-radius: 3px; background: var(--surface2); border: 1px solid var(--line); }
.heat i.l1 { background: color-mix(in srgb, var(--accent) 30%, var(--surface)); }
.heat i.l2 { background: color-mix(in srgb, var(--accent) 60%, var(--surface)); }
.heat i.l3 { background: var(--accent); }
.search-box { width: 100%; font: inherit; padding: 12px 14px; border-radius: 14px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink); }
.hl { background: var(--y-bg); color: var(--y-ink); border-radius: 3px; padding: 0 2px; }

/* bottom nav */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.nav-in { max-width: 780px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); height: var(--nav-h); }
.nav-in a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .7rem; font-weight: 600; }
.nav-in a .ni { font-size: 1.25rem; line-height: 1; filter: grayscale(.6); }
.nav-in a.on { color: var(--accent); }
.nav-in a.on .ni { filter: none; }

.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 9px 16px; border-radius: 12px; font-size: .9rem; opacity: 0; pointer-events: none; transition: all .25s; z-index: 50; max-width: 90vw; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.err { position: fixed; top: 70px; left: 10px; right: 10px; z-index: 60; background: var(--r-bg); color: var(--r-ink); border: 1px solid var(--r); border-radius: 12px; padding: 10px; font-size: .8rem; white-space: pre-wrap; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
@media print { .bottom-nav, .app-header, .btn { display: none !important; } body { padding: 0; } }
