/* Gemeinsame Gestaltung aller Module: ruhig, wenig Text, große Touch-Flächen für das iPad */

/* Andika liegt im Ordner fonts (offline, ohne Google-Server). Fehlt die Datei, wird die Systemschrift genommen. */
@font-face{font-family:"Andika";src:url("../fonts/Andika-Regular.woff2") format("woff2");font-weight:400;font-display:swap}
@font-face{font-family:"Andika";src:url("../fonts/Andika-Bold.woff2") format("woff2");font-weight:700;font-display:swap}

:root{
  --bg:#EEF2F4; --surface:#FFFFFF; --ink:#1F2B3A; --muted:#5B6878; --line:#C9D2DA;
  --honey:#F2B632; --honey-soft:#FCEFC9; --honey-ink:#6A4800;
  --sky:#2F7FD0; --sky-soft:#DCEBFA;
  --leaf:#24804F; --leaf-soft:#DDF1E5; --hint:#B4521A; --hint-soft:#FBE6D8;
  --font:"Andika",system-ui,sans-serif;
}
@media (prefers-color-scheme: dark){:root:not([data-theme="light"]){
  --bg:#151B22; --surface:#1E2630; --ink:#E8EEF3; --muted:#9AA8B6; --line:#3A4654;
  --honey:#F2B632; --honey-soft:#3A2F12; --honey-ink:#FFD978;
  --sky:#6FB2F2; --sky-soft:#17293C;
  --leaf:#5CC48A; --leaf-soft:#173325; --hint:#F0985A; --hint-soft:#3A2418; color-scheme:dark}}
:root[data-theme="dark"]{
  --bg:#151B22; --surface:#1E2630; --ink:#E8EEF3; --muted:#9AA8B6; --line:#3A4654;
  --honey:#F2B632; --honey-soft:#3A2F12; --honey-ink:#FFD978;
  --sky:#6FB2F2; --sky-soft:#17293C;
  --leaf:#5CC48A; --leaf-soft:#173325; --hint:#F0985A; --hint-soft:#3A2418; color-scheme:dark}

*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--ink)}
body{font-family:var(--font);font-size:18px;line-height:1.35;-webkit-text-size-adjust:100%;
  padding:max(16px,env(safe-area-inset-top,0px)) max(16px,env(safe-area-inset-right,0px)) 32px max(16px,env(safe-area-inset-left,0px))}
/* Kein Doppeltipp-Zoom und kein Markieren beim schnellen Tippen */
button,a{-webkit-tap-highlight-color:transparent;touch-action:manipulation}
button{-webkit-user-select:none;user-select:none}
button:focus-visible,a:focus-visible{outline:3px solid var(--ink);outline-offset:2px}

.wrap{max-width:620px;margin:0 auto;display:flex;flex-direction:column;gap:16px}
header{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
header h1{font-size:1.4rem;margin:0;flex:1}
.home{flex:none;width:44px;height:44px;border-radius:50%;border:2px solid var(--line);background:var(--surface);color:var(--ink);display:grid;place-items:center;text-decoration:none}
.home svg{width:22px;height:22px}

/* Stufenwahl */
.levels{display:flex;gap:6px;flex-wrap:wrap}
.lv{font:inherit;font-size:.95rem;border:2px solid var(--line);background:var(--surface);color:var(--ink);border-radius:999px;padding:6px 14px;cursor:pointer;min-height:40px}
.lv[aria-pressed="true"]{background:var(--honey);border-color:var(--honey);color:#2B1E00;font-weight:700}
.lv.fest{cursor:default}

/* Fortschritt: ein Punkt pro Aufgabe */
.dots{display:flex;gap:6px;justify-content:center}
.dot{width:14px;height:14px;border-radius:50%;background:var(--line)}
.dot.star{background:var(--honey)} .dot.ok{background:var(--leaf)} .dot.now{outline:3px solid var(--ink);outline-offset:2px}

/* Aufgabenkarte */
.card{background:var(--surface);border-radius:20px;padding:20px 16px;display:flex;flex-direction:column;gap:16px;align-items:center}
.step{font-size:.9rem;color:var(--muted);letter-spacing:.06em;text-transform:uppercase;text-align:center}
.askrow{display:flex;gap:10px;align-items:center;justify-content:center;width:100%}
.ask{font-size:1.15rem;text-align:center;margin:0;text-wrap:balance;min-width:0}
.say{flex:none;width:44px;height:44px;border-radius:50%;border:2px solid var(--line);background:var(--surface);color:var(--ink);cursor:pointer;display:grid;place-items:center;padding:0}
.say svg{width:22px;height:22px}

/* Aufgaben und Zahlen */
.eq{display:flex;align-items:center;justify-content:center;gap:10px;font-size:2.6rem;font-weight:700;font-variant-numeric:tabular-nums;flex-wrap:wrap}
.eq.small{font-size:1.6rem;color:var(--muted);gap:8px}
.num{font:inherit;color:inherit;background:none;border:3px dashed transparent;border-radius:14px;padding:2px 10px;min-width:1.8em;text-align:center}
button.num{cursor:pointer;border-color:var(--line)}
button.num:hover{border-color:var(--honey)}
.num.sel{background:var(--honey-soft);border:3px solid var(--honey);color:var(--honey-ink)}
.hz{color:var(--honey-ink);background:var(--honey-soft);border-radius:10px;padding:0 8px}
.hk{color:var(--sky);background:var(--sky-soft);border-radius:10px;padding:0 8px}
.ans{display:inline-block;min-width:2.2em;border-bottom:4px solid var(--honey);text-align:center;color:var(--honey-ink)}

/* Karte mit zwei Spalten: auf dem Handy untereinander, auf dem iPad (hoch und quer) nebeneinander */
.spalte{display:flex;flex-direction:column;gap:inherit;align-items:center;width:100%;min-width:0}
@media (min-width:700px){
  .wrap.breit{max-width:1000px}
  .card.zwei{display:grid;grid-template-columns:1fr 1fr;align-items:center;gap:16px 24px}
}

/* Rechenweg wie an der Tafel: eine Zeile pro Schritt */
.tafel{display:flex;flex-direction:column;gap:4px;align-items:center}
.tafel .eq.small{color:var(--ink)}

/* Hundertertafel und Zehnerstangen */
.hundert{display:grid;grid-template-columns:repeat(10,1fr);gap:3px;width:100%;max-width:340px;font-variant-numeric:tabular-nums}
.hundert span{display:grid;place-items:center;aspect-ratio:1;font-size:.8rem;border-radius:6px;background:var(--bg);color:var(--muted);border:2px solid transparent}
.hundert .m-gelb{background:var(--honey);color:#2B1E00;font-weight:700}
.hundert .m-gelb-rand{border-color:var(--honey);color:var(--honey-ink);font-weight:700}
.hundert .m-blau{background:var(--sky);color:#fff;font-weight:700}
.hundert .m-blau-rand{border-color:var(--sky);color:var(--sky);font-weight:700}
.stangen{display:flex;gap:6px;justify-content:center;flex-wrap:wrap;min-height:90px;align-items:center}
.stange{width:14px;height:84px;border-radius:4px;background:var(--honey);background-image:repeating-linear-gradient(to bottom,transparent 0 7.4px,rgba(0,0,0,.18) 7.4px 8.4px)}
.stange.blau{background-color:var(--sky)}
.stange.weg{background-color:var(--line);opacity:.5;position:relative}
.stange.weg::after{content:"";position:absolute;left:-4px;right:-4px;top:50%;height:3px;background:var(--hint);transform:rotate(-60deg)}

/* Stellenwert-Bild: Zehnerstangen und Einerwürfel */
.stellen-bild{display:flex;flex-direction:column;gap:10px;align-items:flex-start}
.stellen-reihe{display:flex;align-items:center;gap:12px}
.stellen-reihe .zahl{min-width:2.6em;font-weight:700;font-size:1.15rem;text-align:right;font-variant-numeric:tabular-nums}
.stellen{display:flex;gap:4px;align-items:flex-end;min-height:62px}
.stellen .stange{width:11px;height:60px;background-image:repeating-linear-gradient(to bottom,transparent 0 5px,rgba(0,0,0,.18) 5px 6px)}
.wuerfel-feld{display:grid;grid-template-rows:repeat(5,10px);grid-auto-flow:column;grid-auto-columns:10px;gap:2.5px;margin-left:6px}
.wuerfel{background:var(--sky);border-radius:2px}
.wuerfel.weg{background:transparent;outline:2px dashed var(--line);outline-offset:-2px}

/* Ausgleichen: Aufgabe, Veränderungen, neue Aufgabe untereinander */
.ausgleich{display:grid;grid-template-columns:auto auto auto;gap:6px 12px;align-items:center;justify-items:center;font-size:1.9rem;font-weight:700;font-variant-numeric:tabular-nums}
.ausgleich .pfeil{font-size:1.05rem;padding:2px 10px;min-width:3.2em;text-align:center}
.ausgleich > span:empty{min-height:1.6rem}
.ausgleich .num{min-width:1.8em}

/* Auswahl der kleinen Aufgabe */
.wahl{display:grid;grid-template-columns:1fr;gap:10px;width:100%;max-width:320px}
.wahl .big{font-size:1.7rem}

/* Knöpfe und Zahlenfeld */
.row{display:flex;gap:12px;justify-content:center;flex-wrap:wrap}
.big{font:inherit;font-size:1.5rem;font-weight:700;min-width:72px;min-height:64px;border-radius:16px;border:2px solid var(--line);background:var(--surface);color:var(--ink);cursor:pointer;padding:0 16px}
.big:active{transform:scale(.96)}
.go{background:var(--honey);border-color:var(--honey);color:#2B1E00;padding:0 28px}
.pad{display:grid;grid-template-columns:repeat(5,1fr);gap:8px;width:100%;max-width:400px}
.pad .big{min-width:0;padding:0;font-size:1.4rem}

/* Rückmeldungen */
.msg{border-radius:14px;padding:12px 16px;font-size:1.05rem;text-align:center;width:100%;display:flex;gap:10px;align-items:center;justify-content:center}
.msg.good{background:var(--leaf-soft);color:var(--leaf)}
.msg.hint{background:var(--hint-soft);color:var(--hint)}
.msg .say{width:36px;height:36px;border-color:currentColor;background:transparent;color:inherit}
.msg .say svg{width:18px;height:18px}

/* Rechenstrich */
.legend{display:flex;gap:14px;font-size:.9rem;color:var(--muted);flex-wrap:wrap;justify-content:center}
.legend span{display:flex;align-items:center;gap:6px}
.legend i{width:22px;height:5px;border-radius:3px;display:inline-block}
svg.strich{width:100%;max-width:440px;height:auto}
svg.strich text{font-family:var(--font)}

/* Auswertung */
.done-stars{font-size:2.6rem;letter-spacing:.1em;color:var(--honey)}
.done-stars .leer{color:var(--line)}
details.teacher{background:var(--bg);border-radius:16px;padding:12px 16px;font-size:.95rem;width:100%}
details.teacher summary{cursor:pointer;color:var(--muted);min-height:32px}
.tbl{overflow-x:auto;margin-top:10px}
table{border-collapse:collapse;width:100%;font-variant-numeric:tabular-nums}
th,td{text-align:left;padding:6px 8px;border-bottom:1px solid var(--line)}
th{color:var(--muted);font-weight:400;font-size:.85rem;letter-spacing:.04em}
.pill{display:inline-block;padding:4px 12px;border-radius:999px;font-weight:700}
.pill.g{background:var(--leaf-soft);color:var(--leaf)} .pill.y{background:var(--honey-soft);color:var(--honey-ink)} .pill.r{background:var(--hint-soft);color:var(--hint)}
.kv{display:grid;grid-template-columns:auto 1fr;gap:4px 16px;margin:10px 0 0}
.kv dt{color:var(--muted)} .kv dd{margin:0}

/* Startseite */
.tiles{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:16px}
.tile{display:flex;flex-direction:column;gap:6px;background:var(--surface);border-radius:20px;padding:20px;text-decoration:none;color:var(--ink);border:3px solid transparent;min-height:120px}
.tile:hover,.tile:active{border-color:var(--honey)}
.tile .nr{font-size:.85rem;color:var(--muted);letter-spacing:.06em;text-transform:uppercase}
.tile b{font-size:1.35rem}
.tile span.bsp{color:var(--muted);font-variant-numeric:tabular-nums}
.note{font-size:.85rem;color:var(--muted);text-align:center}

/* iPad im Querformat: weniger Höhe, also alles etwas enger, damit nichts gescrollt werden muss */
@media (max-height:820px){
  body{padding-top:max(10px,env(safe-area-inset-top,0px))}
  .wrap{gap:10px}
  .card{gap:10px;padding:14px 16px}
  .eq{font-size:2.2rem}
  .eq.small{font-size:1.35rem}
  svg.strich{max-width:400px}
  .big{min-height:56px}
}

@media (prefers-reduced-motion:reduce){.big:active{transform:none}}
