:root {
  --gruen: #0f5132; --gruen-hell: #d1e7dd; --rasen: #2d7a46;
  --bg: #f4f7f5; --karte: #ffffff; --text: #1b1f1d; --leise: #5c6b63;
  --gut: #198754; --schlecht: #c0392b; --warn: #e67e22;
  --bronze: #b0722f; --silber: #8e9aa6; --gold: #d4a017; --grau: #c9d1cc;
  --radius: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { display: flex; flex-direction: column; min-height: 100dvh; }
button { font: inherit; cursor: pointer; border: 0; }

#kopf { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); background: var(--gruen); color: #fff; }
.marke { font-weight: 800; font-size: 20px; background: none; color: inherit; padding: 0; }
.login { max-width: 380px; margin: 60px auto; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login input { font-size: 22px; padding: 16px; border-radius: 14px; border: 3px solid var(--gruen-hell); text-align: center; }
.login .fehler { color: var(--schlecht); font-weight: 700; min-height: 22px; }
.profilwahl { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; max-width: 640px; margin: 40px auto; }
.profilwahl button { background: #fff; border-radius: 22px; padding: 30px 16px; font-size: 22px; font-weight: 800; box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.profilwahl .av { font-size: 64px; display: block; margin-bottom: 8px; }
.status { display: flex; align-items: center; gap: 14px; font-size: 18px; font-weight: 700; }
#tagesziel { position: relative; width: 120px; height: 24px; background: rgba(255,255,255,.25); border-radius: 12px; overflow: hidden; }
#tagesziel-balken { position: absolute; inset: 0 auto 0 0; width: 0; background: #7ee2a8; transition: width .4s; }
#tagesziel-text { position: relative; display: block; text-align: center; font-size: 14px; line-height: 24px; }

main { flex: 1; overflow-y: auto; padding: 16px; padding-bottom: 96px; max-width: 1100px; width: 100%; margin: 0 auto; }
h2 { margin: 8px 0 12px; font-size: 22px; }
h3 { margin: 20px 0 8px; font-size: 17px; color: var(--leise); text-transform: uppercase; letter-spacing: .04em; }
.leise { color: var(--leise); }

#navi { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(5, 1fr);
  background: #fff; border-top: 1px solid #dde3df; padding-bottom: env(safe-area-inset-bottom); }
#navi[hidden] { display: none; }
#navi button { background: none; padding: 10px 0 12px; font-size: 24px; display: flex; flex-direction: column; align-items: center; color: var(--leise); }
#navi button span { font-size: 13px; margin-top: 2px; }
#navi button.aktiv { color: var(--gruen); font-weight: 700; }

.gross { background: var(--gruen); color: #fff; font-size: 20px; font-weight: 700; padding: 18px 28px; border-radius: var(--radius); width: 100%; }
.gross.zweit { background: var(--gruen-hell); color: var(--gruen); }

/* Kacheln */
.kacheln { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.kachel { background: var(--karte); border-radius: var(--radius); padding: 14px; text-align: left; border-left: 8px solid var(--grau);
  box-shadow: 0 1px 3px rgba(0,0,0,.08); min-height: 96px; display: flex; flex-direction: column; gap: 4px; }
.kachel .id { font-size: 12px; color: var(--leise); font-weight: 700; }
.kachel .name { font-weight: 700; font-size: 16px; }
.kachel .sp { font-size: 13px; color: var(--leise); }
.kachel.s1 { border-left-color: var(--bronze); } .kachel.s2 { border-left-color: var(--silber); } .kachel.s3 { border-left-color: var(--gold); }

/* Drill */
.drill { display: flex; flex-direction: column; gap: 14px; max-width: 640px; margin: 0 auto; }
.drill-kopf { display: flex; justify-content: space-between; font-weight: 700; color: var(--leise); }
.zeitbalken { height: 10px; border-radius: 5px; background: #e3e9e5; overflow: hidden; }
.zeitbalken div { height: 100%; width: 0; background: var(--gut); }
.zeitbalken div.ueber { background: var(--warn); }
.frage { background: var(--karte); border-radius: var(--radius); padding: 28px 16px; text-align: center; font-size: clamp(28px, 6vw, 44px); font-weight: 800; min-height: 130px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.frage.lang { font-size: clamp(22px, 4.2vw, 30px); }
.eingabe { background: #fff; border: 3px solid var(--gruen-hell); border-radius: var(--radius); font-size: 38px; font-weight: 800; text-align: center; padding: 10px; min-height: 68px; }
.eingabe.richtig { border-color: var(--gut); background: #e8f6ee; }
.eingabe.falsch { border-color: var(--schlecht); background: #fbeaea; }
.loesung { text-align: center; font-size: 20px; min-height: 28px; font-weight: 700; }
.tastatur { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tastatur button { background: #fff; border-radius: 14px; font-size: 30px; font-weight: 700; padding: 16px 0; box-shadow: 0 2px 0 #cfd8d3; }
.tastatur button:active { transform: translateY(2px); box-shadow: none; }
.tastatur .ok { background: var(--gruen); color: #fff; grid-row: span 2; font-size: 26px; }
.tastatur .del { background: #eef2ef; }

/* Module */
.modul-reihe { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 12px; }
.modul { background: #fff; border-radius: var(--radius); padding: 16px; text-align: left; display: flex; flex-direction: column; gap: 4px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); font-size: 17px; }
.modul .gr { font-size: 34px; }
.stufenwahl { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.stufenwahl button { background: var(--gruen-hell); color: var(--gruen); font-weight: 700; border-radius: 12px; padding: 12px 14px; font-size: 16px; }
.aufgabentext { background: #fff; border-radius: var(--radius); padding: 20px; font-size: 20px; line-height: 1.45; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.hinweis { text-align: center; font-size: 14px; }
.optionen { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.optionen.eins { grid-template-columns: 1fr; }
.optionen button { background: #fff; border: 3px solid var(--gruen-hell); border-radius: 14px; padding: 16px 12px; font-size: 17px; font-weight: 700; text-align: left; min-height: 64px; }
.optionen button.richtig { border-color: var(--gut); background: #e8f6ee; }
.optionen button.falsch { border-color: var(--schlecht); background: #fbeaea; }
.optionen button:disabled { color: var(--text); }
.familien { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.familien button { background: #fff; border: 3px solid var(--gruen-hell); border-radius: 16px; padding: 12px 10px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 120px; }
.familien .fi { font-size: 36px; }
.familien b { font-size: 16px; }
.familien small { font-size: 12px; color: var(--leise); line-height: 1.3; }
.familien button.richtig { border-color: var(--gut); background: #e8f6ee; }
.familien button.falsch { border-color: var(--schlecht); background: #fbeaea; }
.familien button:disabled { color: var(--text); }
.frage-klein { font-weight: 800; font-size: 18px; margin: 10px 0 8px; text-align: center; }
.erklaerung { background: #fff7e6; border-left: 6px solid var(--warn); border-radius: 12px; padding: 12px 14px; margin: 12px 0; line-height: 1.5; }
.erklaerung.gut { background: #e8f6ee; border-left-color: var(--gut); }

/* Würfel (CSS-3D) */
.kipp-szene { display: flex; align-items: center; justify-content: center; gap: 28px; flex-wrap: wrap; background: #fff; border-radius: var(--radius); padding: 22px 12px; }
.kipp-szene.gross-w { padding: 50px 12px; }
.w3d { width: var(--s); height: var(--s); perspective: calc(var(--s) * 6); margin: calc(var(--s) * .2); }
.w3d-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transform: rotateX(-28deg) rotateY(-38deg); }
.w3d-f { position: absolute; inset: 0; background: #fffdf7; border: 2px solid #333; border-radius: 12%; display: flex; }
.w3d-f svg { width: 100%; height: 100%; fill: #1b1f1d; }
.w3d-f.vorne { transform: translateZ(calc(var(--s) / 2)); }
.w3d-f.rechts { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); background: #f1ede2; }
.w3d-f.oben { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); background: #ffffff; }
svg.weg { width: 100%; height: auto; }
svg.weg rect { fill: #f4f7f5; stroke: #9aa8a0; stroke-width: 1.5; }
svg.weg rect.start { fill: #d1e7dd; } svg.weg rect.ziel { fill: #fff3cd; }
.pfeile { text-align: center; font-size: 28px; font-weight: 900; letter-spacing: 4px; margin-top: 6px; }
.augen { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.augen button { background: #fff; border: 3px solid var(--gruen-hell); border-radius: 12px; padding: 8px; aspect-ratio: 1; }
.augen svg { width: 100%; height: 100%; fill: #1b1f1d; }
.kipp-loesung { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.kipp-schritt { display: flex; flex-direction: column; align-items: center; font-weight: 900; font-size: 20px; }
.kipp-tasten { display: grid; grid-template-columns: repeat(3, 80px); gap: 10px; justify-content: center; }
.kipp-tasten button { background: #fff; border-radius: 14px; font-size: 32px; font-weight: 900; height: 72px; box-shadow: 0 2px 0 #cfd8d3; }

/* Zusammenfassung */
.bilanz { background: var(--karte); border-radius: var(--radius); padding: 20px; text-align: center; }
.bilanz .gross-zahl { font-size: 56px; font-weight: 900; color: var(--gruen); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0; }
.pill { background: var(--gruen-hell); color: var(--gruen); border-radius: 999px; padding: 6px 12px; font-weight: 700; }
.pill.rot { background: #fbeaea; color: var(--schlecht); }

/* Team */
.aufstellung { background: linear-gradient(180deg, var(--rasen), #256b3c); border-radius: 20px; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.reihe h4 { margin: 0 0 8px; color: #e8f5ec; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.reihe .karten { display: flex; flex-wrap: wrap; gap: 10px; }
.sk { width: 132px; border-radius: 14px; padding: 10px; color: #1b1f1d; background: #eef1ef; position: relative; box-shadow: 0 3px 8px rgba(0,0,0,.25); }
.sk .kreis { width: 64px; height: 64px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 20px;
  background: #fff center 20% / cover no-repeat; margin-bottom: 6px; border: 3px solid rgba(255,255,255,.8); }
.lg { position: relative; }
.lg .lg-bild { width: 100%; aspect-ratio: 1; border-radius: 12px; background: #333 center 20% / cover no-repeat; display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 900; }
.lg.zu .lg-bild { filter: grayscale(1) blur(3px) brightness(.8); }
.lg .schloss { position: absolute; top: 44px; left: 0; right: 0; text-align: center; font-size: 40px; z-index: 1; }
.nachweis { margin-top: 24px; font-size: 13px; }
.nachweis summary { cursor: pointer; font-weight: 700; color: var(--leise); }
.nachweis li { margin: 4px 0; }
.sk .nm { font-weight: 800; font-size: 14px; line-height: 1.15; min-height: 32px; }
.sk .fe { font-size: 11px; color: #4a5750; margin-top: 2px; min-height: 26px; }
.sk .werte { display: flex; justify-content: space-between; font-size: 12px; font-weight: 800; margin-top: 6px; }
.sk .stufe { position: absolute; top: 8px; right: 10px; font-size: 11px; font-weight: 900; text-transform: uppercase; }
.sk.s0 { opacity: .55; filter: grayscale(1); }
.sk.s1 { background: linear-gradient(160deg, #f1d3b3, #c98a4b); }
.sk.s2 { background: linear-gradient(160deg, #f4f6f8, #aeb8c2); }
.sk.s3 { background: linear-gradient(160deg, #fff4c2, #d4a017); }
.legenden { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.lg { border-radius: 16px; padding: 14px; background: #1d1d1d; color: #f5d76e; min-height: 150px; display: flex; flex-direction: column; gap: 6px; box-shadow: 0 3px 10px rgba(0,0,0,.3); }
.lg .nm { font-weight: 900; font-size: 17px; }
.lg .land { font-size: 12px; color: #cfc08a; }
.lg .ziel { font-size: 12px; color: #d9d9d9; margin-top: auto; }
.lg.zu { background: #e6e9e7; color: #7b8781; box-shadow: none; }
.lg.zu .ziel { color: #5c6b63; }

/* Badges */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge { background: var(--karte); border-radius: 16px; padding: 14px; text-align: center; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.badge .icon { font-size: 40px; }
.badge .nm { font-weight: 800; margin-top: 4px; }
.badge .ziel { font-size: 12px; color: var(--leise); }
.badge.zu { opacity: .45; filter: grayscale(1); }

/* Statistik */
table.stat { width: 100%; border-collapse: collapse; background: #fff; border-radius: 12px; overflow: hidden; font-size: 14px; }
.stat th, .stat td { padding: 8px 10px; border-bottom: 1px solid #edf1ee; text-align: left; }
.stat th { background: #eef3f0; font-size: 12px; text-transform: uppercase; color: var(--leise); }
.punkt { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--grau); }
.punkt.s1 { background: var(--bronze); } .punkt.s2 { background: var(--silber); } .punkt.s3 { background: var(--gold); }

/* Verlauf */
.umschalter { display: inline-flex; background: #e6ece8; border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.umschalter button { background: none; padding: 8px 16px; border-radius: 9px; font-weight: 700; color: var(--leise); }
.umschalter button.an { background: #fff; color: var(--gruen); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.kacheln-stat { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 8px; }
.stat-kachel { background: #fcfcfb; border-radius: 14px; padding: 12px 14px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.stat-kachel .label { font-size: 13px; color: #52514e; }
.stat-kachel .wert { font-size: 30px; font-weight: 700; color: #0b0b0b; }
.delta { font-weight: 700; font-size: 13px; color: #52514e; }
.delta.gut { color: #006300; } .delta.schlecht { color: #b42318; }
.vkarten { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.vkarte { background: #fcfcfb; border-radius: 16px; padding: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.vkarte header { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.vkarte .deltas { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: #52514e; margin-bottom: 6px; }
.vkarte details { margin-top: 6px; font-size: 13px; overflow-x: auto; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.charts.gesamt { background: #fcfcfb; border-radius: 16px; padding: 12px; margin-bottom: 8px; }
figure.chart { margin: 0; }
figure.chart figcaption { font-size: 12px; font-weight: 700; color: #52514e; margin-bottom: 2px; }
figure.chart svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
figure.chart .gitter { stroke: #e1e0d9; stroke-width: 1; }
figure.chart .ref { stroke: #898781; stroke-width: 1; }
figure.chart .achse { font-size: 10px; fill: #898781; font-variant-numeric: tabular-nums; }
figure.chart .endwert { font-size: 11px; font-weight: 700; fill: #0b0b0b; }
figure.chart .fadenkreuz { stroke: #c3c2b7; stroke-width: 1; }
#chart-tip { position: fixed; z-index: 20; background: #0b0b0b; color: #fff; font-size: 13px; padding: 6px 10px; border-radius: 8px; pointer-events: none; }
#chart-tip span { color: #c3c2b7; }
@media (max-width: 420px) { .charts { grid-template-columns: 1fr; } }

/* Modal */
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 10; }
#modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 22px; padding: 24px; max-width: 460px; width: 100%; text-align: center; animation: pop .35s ease-out; }
.modal-box .feier { font-size: 60px; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
