/* Smartphone-Ansicht */
@font-face { font-family: 'Caveat'; font-weight: 500; font-display: swap; src: url(vendor/fonts/caveat-latin-500.woff2) format('woff2'); }
@font-face { font-family: 'Caveat'; font-weight: 700; font-display: swap; src: url(vendor/fonts/caveat-latin-700.woff2) format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-weight: 400; font-display: swap; src: url(vendor/fonts/source-sans-3-latin-400.woff2) format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-weight: 600; font-display: swap; src: url(vendor/fonts/source-sans-3-latin-600.woff2) format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-weight: 700; font-display: swap; src: url(vendor/fonts/source-sans-3-latin-700.woff2) format('woff2'); }

:root {
  --bg: #f5f7f5; --surface: #ffffff; --fg: #1d2721; --muted: #5b6a61; --line: #d5ddd7;
  --accent: #005f50; --accent-soft: #e3efeb;
  --ok: #1f7a3a; --ok-soft: #e4f3e8; --bad: #a3322a; --bad-soft: #f8e7e5;
  --board: #2f4b3c; --chalk: #f4f4ee; --chalk-dim: #b9c8bd;
  --a1: #b4532a; --a2: #2b6c8f; --a3: #a07a12; --a4: #6a4c93;
  --f-body: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-chalk: 'Caveat', 'Comic Sans MS', cursive;
}
@media (prefers-color-scheme: dark) {
  :root:not(.hell) {                 /* SCORM-Paket setzt class="hell": OPAL ist immer hell */
    --bg: #121815; --surface: #1a221e; --fg: #e4ebe6; --muted: #9aaba1; --line: #2e3a33;
    --accent: #5cc0a8; --accent-soft: #1d332c; --ok: #6fd08b; --ok-soft: #1b3324; --bad: #f08a80; --bad-soft: #3a1f1c;
    --a1: #d87a52; --a2: #5aa3c9; --a3: #c9a23e; --a4: #9c80c4;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 17px/1.5 var(--f-body); min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
[hidden] { display: none !important; }
main { width: 100%; max-width: 34rem; margin: 0 auto; flex: 1; display: flex; flex-direction: column; background: var(--surface); }
@media (min-width: 34rem) { main { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }

.phone-top { padding: 12px 16px 10px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.phone-top .row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: .85rem; color: var(--muted); }
.phone-top .row b { color: var(--fg); }
.bar { height: 6px; background: var(--line); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.phone-body { padding: 14px 16px 22px; display: flex; flex-direction: column; gap: 12px; flex: 1; min-width: 0; }

.tafelbild { background: var(--board); color: var(--chalk); border-radius: 8px; padding: 10px 12px; font-size: .85rem; }
.tafelbild summary { cursor: pointer; font-family: var(--f-chalk); font-size: 1.15rem; list-style: none; }
.tafelbild summary::-webkit-details-marker { display: none; }
.tafelbild summary::after { content: " ▾"; color: var(--chalk-dim); font-size: .9rem; }
.tafelbild[open] summary::after { content: " ▴"; }
.tafelbild ol { margin: 6px 0 0; padding-left: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.tafelbild li { overflow: visible; }      /* Breite regelt fitEls(); kein Scrollen wegen überstehender Formelränder */
.tafelbild .op { color: var(--chalk-dim); font-size: .78rem; display: block; }
.tafelbild li.last { border-left: 3px solid var(--chalk); padding-left: 8px; }
.tafelbild mjx-container { color: var(--chalk); }

.frage { font-weight: 600; font-size: 1rem; }
.hilfe { border: 1px dashed var(--line); border-radius: 8px; padding: 6px 10px; font-size: .85rem; }
.hilfe summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.hilfe pre { margin: 6px 0; padding: 8px; background: var(--accent-soft); border-radius: 6px; overflow-x: auto; overflow-y: hidden; font-size: .72rem; line-height: 1.4; white-space: pre; }
.hilfe pre .out { color: var(--accent); font-weight: 700; }
.kontext { background: var(--accent-soft); border-radius: 8px; padding: 8px 10px; overflow: visible; font-size: .9rem; }
.opts { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); align-items: center; gap: 8px; text-align: left;
  border: 2px solid transparent; border-radius: 10px; padding: 8px 10px 8px 6px; font: inherit; font-size: .9rem;
  color: var(--fg); background: var(--surface); cursor: pointer; box-shadow: inset 0 0 0 1px var(--line);
}
.opt:hover:not(:disabled) { box-shadow: inset 0 0 0 2px var(--accent); }
.opt:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.opt .shape { width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; color: #fff; font-size: 15px; }
.opt .tex { overflow: hidden; min-width: 0; }
.opt.tried { opacity: .45; cursor: not-allowed; background: var(--bad-soft); text-decoration: line-through; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt:disabled { cursor: default; }
.s1 { background: var(--a1); } .s2 { background: var(--a2); } .s3 { background: var(--a3); } .s4 { background: var(--a4); }

.fb { border-radius: 8px; padding: 10px 12px; font-size: .9rem; }
.fb.bad { background: var(--bad-soft); border-left: 4px solid var(--bad); }
.fb.ok { background: var(--ok-soft); border-left: 4px solid var(--ok); }
.fb > b:first-child { display: block; margin-bottom: 2px; }
.btn { font: inherit; font-weight: 700; border: 0; border-radius: 10px; padding: 12px 16px; background: var(--accent); color: var(--surface); cursor: pointer; }
.btn:focus-visible { outline: 3px solid var(--fg); outline-offset: 2px; }
.btn:disabled { opacity: .6; }
.spacer { flex: 1; }
.milestone { background: var(--board); color: var(--chalk); border-radius: 10px; padding: 14px; text-align: center; }
.milestone .chalk { font-family: var(--f-chalk); font-size: 1.6rem; line-height: 1.1; }
.milestone mjx-container { color: var(--chalk); }
.small { font-size: .82rem; color: var(--muted); }
.wait { text-align: center; }

.netz { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); background: var(--bad); color: #fff; font-size: .85rem; font-weight: 600; padding: 6px 14px; border-radius: 999px; box-shadow: 0 4px 12px rgba(0,0,0,.2); z-index: 5; }
footer { text-align: center; color: var(--muted); font-size: .75rem; padding: 10px; }
