:root {
  --bg: #f3f5f9; --surface: #ffffff; --surface2: #eef1f6; --text: #1b2230; --muted: #667085;
  --border: #dde2ea; --accent: #5b8def; --accent-h: #4678db; --good: #1fa463; --bad: #e5484d;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.06);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #121316; --surface: #1b1d22; --surface2: #262930; --text: #e8eaf0; --muted: #9aa1ae;
  --border: #2f333c; --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); min-height: 100vh; min-height: 100dvh;
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { line-height: 1.3; margin: 0; }
.muted { color: var(--muted); }
.center { justify-content: center; text-align: center; }
.show-sm { display: none; }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: var(--bg); border-bottom: 1px solid var(--border);
}
@supports (background: color-mix(in srgb, red, blue)) {
  .topbar { background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); }
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; }
.logo { display: block; width: 36px; height: 36px; border-radius: 9px; }
.spacer { flex: 1; }
.userchip { max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Layout ---------- */
.wrap {
  max-width: 1100px; margin: 0 auto;
  padding: clamp(14px, 3vw, 30px) max(clamp(14px, 3vw, 30px), env(safe-area-inset-right)) calc(48px + env(safe-area-inset-bottom)) max(clamp(14px, 3vw, 30px), env(safe-area-inset-left));
  display: flex; flex-direction: column; gap: 18px;
}
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: clamp(14px, 3vw, 24px); box-shadow: var(--shadow); }
.page-title { font-size: clamp(1.5rem, 4.5vw, 2.1rem); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }

/* ---------- Formularelemente ---------- */
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface2); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px; min-height: 44px; width: 100%; min-width: 0;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="checkbox"] { width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--accent); }
input[type="color"] { padding: 3px; width: 56px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; color: var(--muted); flex: 1 1 160px; }
.field.small { flex: 0 1 150px; }
.chk { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; cursor: pointer; }

.btn {
  font: inherit; font-weight: 650; cursor: pointer; color: var(--text); background: var(--surface2);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 16px; min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-h); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface2); }
.btn.sm { min-height: 38px; padding: 6px 12px; font-size: .92rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.danger-text { color: var(--bad); }

/* ---------- Startmaske / Kacheln ---------- */
.hero { display: flex; flex-direction: column; gap: 4px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 16px; }
.tile {
  --tile: var(--accent); position: relative; display: flex; flex-direction: column; gap: 6px; padding: 24px 22px 20px;
  border-radius: 22px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  overflow: hidden; transition: transform .15s ease, border-color .15s ease; min-height: 168px;
}
.tile::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--tile); }
.tile:hover { transform: translateY(-3px); border-color: var(--tile); }
.tile .ico { font-size: 2.6rem; line-height: 1; }
.tile h3 { font-size: 1.25rem; margin-top: 6px; }
.tile .meta { color: var(--muted); font-size: .9rem; }
.tile.add { border-style: dashed; align-items: center; justify-content: center; color: var(--muted); }
.progress { height: 8px; background: var(--surface2); border-radius: 99px; overflow: hidden; width: 100%; }
.progress .bar { height: 100%; background: var(--good); border-radius: 99px; transition: width .3s; }
.tile .progress { margin-top: auto; }

/* ---------- Fach-Ansicht ---------- */
.subject-head { --tile: var(--accent); display: flex; align-items: center; gap: 12px; }
.subject-head .ico { font-size: 2rem; }
.subject-head h1 { font-size: clamp(1.5rem, 5vw, 2.2rem); }
.back { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 18px; border-radius: 99px; font-weight: 650; white-space: nowrap; background: var(--surface); border: 1px solid var(--border); }
.tab.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.filters { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; cursor: pointer; color: var(--text); background: var(--surface2); border: 1px solid var(--border); border-radius: 99px; padding: 6px 14px; min-height: 36px; }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip small { opacity: .7; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; background: var(--surface2); border: 1px solid var(--border); font-size: .82rem; color: var(--muted); }
.badge.admin { background: var(--accent); border-color: var(--accent); color: #fff; }

.opts { padding: 8px 16px; }
.opts summary { cursor: pointer; font-weight: 650; padding: 8px 0; list-style-position: inside; }
.opts[open] summary { margin-bottom: 8px; }
.opts .filters { padding: 0; border: 0; box-shadow: none; background: transparent; }

/* ---------- Quiz ---------- */
.quiz { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; padding: clamp(18px, 5vw, 44px); }
.q-chip { padding: 4px 14px; border-radius: 99px; background: var(--accent); color: #fff; font-size: .82rem; font-weight: 700; min-height: 26px; }
.q-chip:empty { visibility: hidden; }
.q-text { font-size: clamp(1.7rem, 6.5vw, 2.8rem); font-weight: 750; line-height: 1.2; overflow-wrap: anywhere; }
.q-input { width: min(100%, 560px); font-size: clamp(1.1rem, 4.5vw, 1.5rem); text-align: center; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--border); }
.q-input.good { border-color: var(--good); }
.q-input.bad { border-color: var(--bad); }
.feedback { min-height: 3.2rem; font-size: 1.15rem; font-weight: 700; overflow-wrap: anywhere; }
.feedback.good { color: var(--good); }
.feedback.bad { color: var(--bad); }
.result { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0 18px; }
.result .big { font-size: clamp(2.6rem, 12vw, 4.5rem); font-weight: 800; }

/* ---------- Listen ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; padding: 10px 14px; border-radius: 12px; background: var(--surface2); border-left: 4px solid var(--border); }
.item.ok { border-left-color: var(--good); }
.item.bad { border-left-color: var(--bad); }
.item .q { font-weight: 650; }
.topic-btn { display: flex; justify-content: space-between; align-items: center; width: 100%; font: inherit; color: var(--text); cursor: pointer; text-align: left; padding: 14px 16px; border-radius: 14px; background: var(--surface2); border: 1px solid var(--border); min-height: 52px; }
.topic-btn:hover { border-color: var(--accent); }
.group-title { font-size: .85rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 8px 0 -2px; }
.card-row { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 8px; align-items: center; }
.user-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: var(--surface2); }
.user-row .name { font-weight: 700; flex: 1 1 140px; min-width: 0; overflow-wrap: anywhere; }
.user-row select { width: auto; }
.stat { background: var(--surface2); border-radius: 14px; padding: 14px 16px; }
.stat b { display: block; font-size: 1.6rem; }

/* ---------- Anmeldung ---------- */
.auth { max-width: 420px; margin: clamp(10px, 8vh, 80px) auto 0; width: 100%; }
.auth h1 { margin-bottom: 4px; }
.error { color: var(--bad); font-weight: 600; min-height: 1.4em; }

/* ---------- Hinweis-Toast ---------- */
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 50; max-width: min(92vw, 460px); padding: 12px 18px; border-radius: 14px; background: var(--text); color: var(--bg); font-weight: 600; transition: .2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--bad); color: #fff; }

/* ---------- Responsiv ---------- */
@media (max-width: 720px) {
  .hide-sm { display: none; }
  .show-sm { display: inline; }
  .brand-name { display: none; }
  .card-row { grid-template-columns: 1fr 1fr; }
  .card-row > :nth-child(n+3) { justify-self: start; }
  .field.small { flex: 1 1 130px; }
}
@media (max-width: 560px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .tile { padding: 18px 14px 14px; min-height: 140px; }
  .tile .ico { font-size: 2.1rem; }
  .tile h3 { font-size: 1.05rem; }
  .row > .btn.grow-sm { flex: 1 1 100%; }
  .user-row select, .user-row .btn { flex: 1 1 40%; }
}
@media (min-width: 1100px) { .tiles { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); } }

/* ---------- Motivation: Tagesziel, Serie, Woche ---------- */
.motivation { display: flex; flex-direction: column; gap: 16px; }
.mot-main { display: grid; grid-template-columns: 1.4fr 1fr; gap: 18px; align-items: center; }
.mot-badges { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mot-badges .stat { padding: 10px 12px; font-size: .85rem; color: var(--muted); }
.mot-badges .stat b { font-size: 1.25rem; color: var(--text); }
.good-text { color: var(--good); font-weight: 650; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; }
.day { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: .78rem; color: var(--muted); }
.day .col { width: 100%; max-width: 38px; height: 56px; background: var(--surface2); border-radius: 8px; display: flex; align-items: flex-end; overflow: hidden; }
.day .fill { width: 100%; background: var(--accent); border-radius: 8px; min-height: 0; }
.day.met .fill { background: var(--good); }
.day.met { color: var(--good); font-weight: 700; }

/* ---------- Aufgaben ---------- */
.task { --tile: var(--accent); display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); border-left: 6px solid var(--tile); box-shadow: var(--shadow); }
.task:hover { border-color: var(--tile); }
.task .ico { font-size: 1.8rem; }
.task-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.task-main .muted { font-size: .88rem; overflow-wrap: anywhere; }
.task.done { opacity: .75; }
.task.late { border-left-color: var(--bad); }
.badge.done { background: color-mix(in srgb, var(--good) 18%, transparent); border-color: var(--good); color: var(--good); }

/* ---------- Multiple Choice / Zuordnen ---------- */
.q-row { display: flex; align-items: center; justify-content: center; gap: 8px; max-width: 100%; }
.answer-box { width: min(100%, 640px); display: flex; justify-content: center; }
.mc { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mc-btn, .match-btn { font: inherit; font-weight: 600; color: var(--text); cursor: pointer; text-align: left; background: var(--surface2); border: 2px solid var(--border); border-radius: 14px; padding: 12px 14px; min-height: 54px; display: flex; align-items: center; gap: 10px; overflow-wrap: anywhere; }
.mc-btn:hover:not(:disabled), .match-btn:hover:not(:disabled) { border-color: var(--accent); }
.mc-key { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border); font-size: .82rem; color: var(--muted); flex: none; }
.mc-btn.sel, .match-btn.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface2)); }
.mc-btn.right, .match-btn.right { border-color: var(--good); background: color-mix(in srgb, var(--good) 18%, var(--surface2)); opacity: 1; }
.mc-btn.wrong, .match-btn.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 18%, var(--surface2)); }
.mc-btn:disabled, .match-btn:disabled { cursor: default; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.match-col { display: flex; flex-direction: column; gap: 10px; }
.match-btn { justify-content: center; text-align: center; }
.big-emoji { font-size: 3.4rem; line-height: 1; }

/* ---------- Foto-Import ---------- */
.ocr-row { display: grid; grid-template-columns: auto 1fr 1fr auto; gap: 8px; align-items: center; }
.ocr-row .merge { min-width: 44px; padding: 6px 8px; }
.crop-wrap { position: relative; width: 100%; touch-action: none; user-select: none; cursor: crosshair; line-height: 0; }
.crop-wrap canvas { display: block; margin: 0 auto; max-width: 100%; max-height: 70vh; }
.crop-box { position: absolute; border: 2px solid var(--accent); box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45); border-radius: 4px; pointer-events: none; }
.crop-wrap { overflow: hidden; border-radius: 10px; }

@media (max-width: 720px) {
  .mot-main { grid-template-columns: 1fr; }
  .mc { grid-template-columns: 1fr; }
  .ocr-row { grid-template-columns: auto 1fr auto; }
  .ocr-row .ocr-b { grid-column: 2; }
  .ocr-row .merge { grid-row: 1 / span 2; grid-column: 3; }
  .ocr-row input[type="checkbox"] { grid-row: 1 / span 2; }
}
@media (max-width: 420px) {
  .match { gap: 8px; }
  .match-btn { padding: 10px 8px; font-size: .95rem; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Fußzeile, Hilfe, Neuigkeiten, Dialog, Assistent, Protokoll ---------- */
.footer { display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: center; padding: 18px 16px 28px; color: var(--muted); font-size: .88rem; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--accent); }
.help-toc { display: flex; flex-wrap: wrap; gap: 8px; }
.help-toc .chip { text-decoration: none; display: inline-flex; align-items: center; }
.help-section { scroll-margin-top: 80px; }
.help-section p { margin: 0; line-height: 1.55; }
.help-section.flash { outline: 2px solid var(--accent); outline-offset: 2px; }
ul.news { margin: 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.badge.good { background: color-mix(in srgb, var(--good) 18%, transparent); border-color: var(--good); color: var(--good); }
.badge.info { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: var(--accent); color: var(--accent); }
.badge.warn { background: color-mix(in srgb, #f59e0b 18%, transparent); border-color: #f59e0b; color: #b45309; }
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .5); display: grid; place-items: center; padding: 16px; }
.modal { background: var(--bg); border-radius: 18px; padding: 22px; width: min(640px, 100%); max-height: 85vh; overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.modal h1 { font-size: 1.4rem; margin: 0; }
.wizard-steps { display: flex; flex-wrap: wrap; gap: 8px; }
.wizard-steps .chip { cursor: default; }
.wizard-steps .chip.done { border-color: var(--good); color: var(--good); }
pre.log { margin: 0; max-height: 420px; overflow: auto; padding: 12px; border-radius: 12px; background: var(--surface2); font-size: .8rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
code { font-size: .88em; word-break: break-all; }

/* ---------- 10 Finger Tippen ---------- */
:root { --f0: #c084fc; --f1: #60a5fa; --f2: #34d399; --f3: #fbbf24; --f4: #cbd5e1; --f5: #cbd5e1; --f6: #fb923c; --f7: #4ade80; --f8: #38bdf8; --f9: #e879f9; }
[data-theme="dark"] { --f0: #7e3fbf; --f1: #2f69b8; --f2: #1f8a63; --f3: #a87b10; --f4: #4b5563; --f5: #4b5563; --f6: #b4581a; --f7: #23864a; --f8: #1a7aa3; --f9: #9b36a6; }
.f0 { --fc: var(--f0); } .f1 { --fc: var(--f1); } .f2 { --fc: var(--f2); } .f3 { --fc: var(--f3); } .f4 { --fc: var(--f4); }
.f5 { --fc: var(--f5); } .f6 { --fc: var(--f6); } .f7 { --fc: var(--f7); } .f8 { --fc: var(--f8); } .f9 { --fc: var(--f9); }
.warn-card { border-left: 4px solid #f59e0b; }
.small { font-size: .88rem; }
ul.tips { margin: 10px 0 0; padding-left: 1.2em; display: grid; gap: 6px; }
.lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.lesson { display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; border-radius: 14px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); font: inherit; box-shadow: var(--shadow); }
.lesson:hover:not(:disabled) { border-color: var(--accent); }
.lesson.locked { opacity: .55; cursor: not-allowed; }
.lesson.done { border-left: 4px solid var(--good); }
.lesson-no { display: grid; place-items: center; min-width: 34px; height: 34px; border-radius: 10px; background: var(--surface2); font-weight: 700; }
.lesson-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.lesson-main .muted { font-size: .85rem; }
.stars { color: #f5a623; font-size: 2.4rem; letter-spacing: 4px; line-height: 1; }
.stars.small { font-size: 1.05rem; letter-spacing: 1px; }
.stars.none { color: var(--muted); opacity: .6; }
.big-note { font-size: 2.2rem; font-weight: 800; display: flex; flex-direction: column; }
.big-note small { font-size: .85rem; font-weight: 400; color: var(--muted); }
.typing-run .live .stat { padding: 8px 12px; }
.typing-run .live .stat b { font-size: 1.3rem; }
.type-text { font: 1.45rem/1.9 ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: pre-wrap; word-break: break-word;
  background: var(--surface2); border-radius: 14px; padding: 14px 18px; max-height: 11.8em; overflow: hidden; outline: none; position: relative; }
.type-text:focus-visible { box-shadow: 0 0 0 3px var(--accent); }
.tc { border-radius: 4px; }
.tc.ok { color: var(--good); }
.tc.fixed { color: #d97706; }
.tc.cur { background: var(--accent); color: #fff; }
.tc.sp.cur { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.tc.bad { background: var(--bad); color: #fff; }
.tc.sp.bad { background: var(--bad); }
.shake { animation: shake .18s; }
@keyframes shake { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@media (prefers-reduced-motion: reduce) { .shake { animation: none; } }
.kb-wrap { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.kb { display: flex; flex-direction: column; gap: 4px; width: 100%; max-width: 760px; }
.kb-row { display: flex; gap: 4px; }
.kb-key { flex: var(--w) 1 0; min-width: 0; height: 42px; border-radius: 7px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--fc) 38%, var(--surface)); border: 1px solid var(--border); font-size: .9rem; font-weight: 600; position: relative; line-height: 1.05; }
.kb-key small { font-size: .65rem; font-weight: 400; opacity: .75; }
.kb-key.bump::after { content: ''; position: absolute; bottom: 6px; width: 10px; height: 2px; border-radius: 2px; background: currentColor; opacity: .6; }
.kb-key.enter2 { border-top: none; }
.kb-key.next { background: var(--fc); outline: 3px solid var(--text); outline-offset: -1px; transform: translateY(1px); }
.hands { display: flex; gap: 60px; align-items: flex-end; }
.hand { display: flex; gap: 6px; align-items: flex-end; }
.finger { width: 22px; border-radius: 11px 11px 6px 6px; background: color-mix(in srgb, var(--fc) 50%, var(--surface)); border: 1px solid var(--border); transition: transform .1s; }
.finger.n0, .finger.n9 { height: 42px; } .finger.n1, .finger.n8 { height: 56px; } .finger.n2, .finger.n7 { height: 62px; }
.finger.n3, .finger.n6 { height: 56px; } .finger.n4, .finger.n5 { height: 34px; width: 26px; }
.hand.left .n4 { transform: rotate(35deg); transform-origin: bottom left; } .hand.right .n5 { transform: rotate(-35deg); transform-origin: bottom right; }
.finger.next { background: var(--fc); outline: 3px solid var(--text); }
.kb-hint { min-height: 1.5em; text-align: center; }
.weak-keys { display: flex; flex-wrap: wrap; gap: 10px; }
.weak-key { background: color-mix(in srgb, var(--fc) 45%, var(--surface)); border-radius: 12px; padding: 10px 14px; text-align: center; min-width: 64px; }
.weak-key b { display: block; font-size: 1.5rem; }
.cpm-chart { position: relative; display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 6px; border-bottom: 1px solid var(--border); }
.cpm-bar { flex: 1; max-width: 28px; background: var(--accent); border-radius: 5px 5px 0 0; opacity: .75; }
.cpm-bar.test { background: var(--accent-h); opacity: 1; }
.target-line { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--good); }
@media (max-width: 720px) {
  .kb-key { height: 30px; font-size: .7rem; border-radius: 5px; }
  .kb-key small { display: none; }
  .hands { gap: 30px; } .finger { width: 15px; }
  .type-text { font-size: 1.15rem; }
}
.typing-run .live { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 720px) {
  .typing-run .live .stat { padding: 6px 8px; font-size: .72rem; }
  .typing-run .live .stat b { font-size: 1.05rem; }
}
.stack > .field { flex: 0 0 auto; }

/* ---------- Version 1.3 ---------- */
a.stat { color: inherit; text-decoration: none; display: block; }
a.stat:hover { outline: 2px solid var(--accent); }
.mini-bar { height: 4px; background: var(--border); border-radius: 4px; margin-top: 6px; overflow: hidden; }
.mini-bar > div { height: 100%; background: #f5a623; }
.due-line { margin: 6px 0 0; font-weight: 600; }
.tile .meta.due { color: var(--accent); font-weight: 650; }
.bad-text { color: var(--bad); font-weight: 650; }
.badge-pop { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: flex; gap: 12px; align-items: center; max-width: 360px;
  background: var(--surface); border: 2px solid #f5a623; border-radius: 16px; padding: 12px 16px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  animation: pop-in .35s ease-out; transition: opacity .5s, transform .5s; }
.badge-pop.out { opacity: 0; transform: translateY(20px); }
.bp-ico { font-size: 2.2rem; }
@keyframes pop-in { from { transform: scale(.6) translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.badge-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 16px 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; opacity: .6; }
.badge-card.got { opacity: 1; border-color: #f5a623; box-shadow: var(--shadow); }
.bc-ico { font-size: 2.4rem; }
.leitner { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.lt-box { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
.lt-bar { width: 100%; height: 90px; background: var(--surface2); border-radius: 10px; display: flex; align-items: flex-end; overflow: hidden; }
.lt-fill { width: 100%; background: var(--accent); }
.lt-box.b1 .lt-fill { background: var(--bad); } .lt-box.b5 .lt-fill { background: var(--good); }
.speed-kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.speed { align-items: center; }
.speed .live { width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.speed-q { font-size: 2.6rem; font-weight: 800; text-align: center; margin: 10px 0; }
.speed-in { max-width: 260px; text-align: center; font-size: 1.6rem; margin: 0 auto; }
.speed-flash { min-height: 1.6em; text-align: center; font-size: 1.1rem; }
.points-grid { display: grid; gap: 8px; }
.points-row { display: flex; align-items: center; gap: 12px; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); }
.points-row input { width: 110px; }
.rain { position: relative; height: 380px; overflow: hidden; border-radius: 14px; outline: none;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 22%, var(--surface2)), var(--surface2)); }
.rain::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--bad); opacity: .6; }
.rain.hurt { animation: hurt .35s; }
@keyframes hurt { 50% { box-shadow: inset 0 0 0 4px var(--bad); } }
.drop { position: absolute; left: 0; top: 0; padding: 4px 10px; border-radius: 10px; background: var(--surface); box-shadow: var(--shadow);
  font: 1.15rem ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: nowrap; transition: opacity .25s; }
.drop .hit { color: var(--good); font-weight: 700; }
.drop.pop { opacity: 0; }
.rain-buf { font-family: ui-monospace, Consolas, monospace; font-weight: 700; color: var(--accent); display: inline-block; min-width: 2ch; }
.report h3 { margin-top: 8px; }
.report-logo { width: 56px; height: 56px; }
.report-days .day small { font-size: .75rem; color: var(--muted); }
@media print {
  .topbar, .footer, .no-print, .tabs, #toast { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .wrap { max-width: none; padding: 0; }
}
@media (max-width: 720px) { .leitner { gap: 4px; } .lt-box .small { font-size: .65rem; } .speed-q { font-size: 2rem; } }
