/* Weltkarte, Stall, Eltern, Duell */
:root {
  /* Lernstand-Farben (Fach 0–4) – gemeinsam für Stall und Heatmap */
  /* sequentiell in einem Farbton (Gold): dunkel = neu, hell = automatisiert */
  --b-x: #1c2a58;
  --b0: #3b4677;
  --b1: #6a5426;
  --b2: #9c772b;
  --b3: #d0a03b;
  --b4: #ffd668;
}
.muted { color: var(--text-3); }
.small { font-size: var(--t-14); }

/* ---------- Karte ---------- */
.map-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 300px; gap: 24px; }
.map-card { padding: 8px; display: grid; place-items: center; overflow: hidden; background: #0c1736; }
.worldmap { width: 100%; height: 100%; max-height: 100%; }
.graticule { stroke: rgb(143 180 255 / 0.08); stroke-width: 1; fill: none; }
.route { stroke: rgb(143 180 255 / 0.3); stroke-width: 2.5; fill: none; stroke-dasharray: 2 8; stroke-linecap: round; }
.route-done { stroke: var(--gold); stroke-width: 3.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.city circle { fill: #2a3c78; stroke: #0c1736; stroke-width: 2; }
.city text { fill: var(--text-2); font-size: 15px; font-weight: 600; paint-order: stroke; stroke: #0c1736; stroke-width: 4px; }
.city.is-done circle { fill: var(--gold); }
.city.is-done text { fill: var(--text); }
.city.is-goal circle { stroke: var(--gold); stroke-width: 2.5; }
.city.is-goal text { fill: var(--gold-2); font-size: 17px; font-weight: 800; }
.city .ring { fill: none !important; stroke: var(--gold) !important; stroke-width: 2 !important; opacity: 0.6; }
.pole circle { fill: #fff; }
.pole text { fill: #fff; font-size: 14px; font-weight: 700; paint-order: stroke; stroke: #0c1736; stroke-width: 4px; }
.map-side { padding: 24px; display: flex; flex-direction: column; gap: 12px; overflow: auto; }
.map-side h2 { font-size: var(--t-24); }
.map-side h3 { font-size: var(--t-17); margin-top: 12px; display: flex; justify-content: space-between; }
.parts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.parts li { display: flex; align-items: center; gap: 10px; min-height: 36px; color: var(--text-3); }
.parts li small { margin-left: auto; font-size: var(--t-12); color: var(--text-3); }
.parts .tick { width: 24px; height: 24px; border-radius: 50%; background: var(--s2); display: grid; place-items: center; flex: none; }
.parts .tick .icon { width: 16px; height: 16px; stroke-width: 3; }
.parts li.is-on { color: var(--text); }
.parts li.is-on .tick { background: var(--gold); color: var(--gold-ink); }

/* ---------- Stall ---------- */
.stalls { flex: 1; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stall { display: flex; gap: 16px; padding: 16px; align-items: center; }
.stall .deer { width: 124px; height: 116px; flex: none; }
.deer-fig { position: relative; width: 100%; height: 100%; display: block; }
.deer-fig .fig { width: 100%; height: 100%; }
.deer-badge { position: absolute; right: 0; bottom: 4px; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 14px; background: var(--c); color: #fff; font-weight: 800; font-size: var(--t-14); display: grid; place-items: center; box-shadow: 0 0 0 2px var(--s1); }
.stall .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.stall h2 { font-size: var(--t-20); }
.stall .level { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: var(--t-14); font-weight: 600; }
.stall .status { font-size: var(--t-14); color: var(--text-2); }
.stall small { color: var(--text-3); font-size: var(--t-12); }
.stall--seven { box-shadow: inset 0 0 0 2px rgb(247 198 79 / 0.5), var(--sh-1); }
.medal { width: 14px; height: 14px; border-radius: 50%; background: var(--s3); flex: none; }
.medal.m1 { background: #c8814a; } .medal.m2 { background: #c9d2e3; } .medal.m3 { background: var(--gold); } .medal.m4 { background: #fff; box-shadow: 0 0 0 2px var(--gold); }
.meter { height: 8px; border-radius: 4px; background: var(--s2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--gold); transform-origin: left; border-radius: 4px; }
.meter.health i { background: var(--gold); }
.chips { display: flex; gap: 4px; margin-top: 2px; }
.chip { display: inline-block; width: 14px; height: 14px; border-radius: 4px; background: var(--b-x); vertical-align: -2px; }
.chip.bx { background: var(--b-x); } .chip.b0 { background: var(--b0); } .chip.b1 { background: var(--b1); }
.chip.b2 { background: var(--b2); } .chip.b3 { background: var(--b3); } .chip.b4 { background: var(--b4); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.legend .chip { margin-right: -10px; }

@media (max-width: 1100px) {
  .map-grid { grid-template-columns: 1fr 260px; }
  .stall .deer { width: 88px; height: 92px; }
}

/* ---------- PIN ---------- */
.pin-wrap { flex: 1; display: flex; align-items: center; justify-content: center; gap: 64px; }
.pin-left { display: flex; flex-direction: column; gap: 12px; max-width: 340px; }
.pin-left h2 { font-size: var(--t-32); }
.pin-dots { display: flex; gap: 16px; margin: 12px 0; }
.pin-dots i { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--text-3); transition: background-color 120ms ease, box-shadow 120ms ease; }
.pin-dots i.on { background: var(--gold); box-shadow: none; }
.pin-dots.shake { animation: shake 300ms var(--ease-out); }
.pin-error { color: #ffb4a8; min-height: 1.4em; }

/* ---------- Eltern-Dashboard ---------- */
.parents { gap: 16px; user-select: text; }
.parents .topbar .muted { font-size: var(--t-14); }
.dash { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; padding-bottom: 24px; }
.panel { padding: 20px; display: flex; flex-direction: column; gap: 12px; border-radius: var(--r); }
.panel h2 { font-size: var(--t-20); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.panel .ph { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.prog, .seven, .time { grid-column: span 2; }
.heat { grid-column: span 4; }
.top { grid-column: span 2; }
.chart-card, .settings, .backup { grid-column: span 3; }
.big { font-size: var(--t-48); font-weight: 800; line-height: 1; display: block; }
.big small { font-size: var(--t-24); color: var(--text-3); font-weight: 700; }
.prog-main { display: flex; align-items: center; gap: 16px; }
.prog-main span { color: var(--text-2); }
.ampel { width: 28px; height: 28px; border-radius: 50%; flex: none; box-shadow: 0 0 0 4px var(--s2); }
.ampel.green { background: #4cbb78; } .ampel.yellow { background: #f0c03a; } .ampel.red { background: #e0604a; }
.stack { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; }
.stack i { display: block; min-width: 4px; }
.stack i.b0 { background: var(--b0); } .stack i.b1 { background: var(--b1); } .stack i.b2 { background: var(--b2); } .stack i.b3 { background: var(--b3); } .stack i.b4 { background: var(--b4); }
.legend span { display: inline-flex; align-items: center; gap: 6px; margin-right: 12px; color: var(--text-2); }
.parents .legend .chip { margin-right: 0; }
.milestones { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: var(--t-14); color: var(--text-2); }
.milestones li { display: flex; gap: 8px; align-items: center; }
.milestones .mk { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--s3); display: grid; place-items: center; flex: none; }
.milestones .mk .icon { width: 14px; height: 14px; stroke-width: 3; }
.milestones li.ok .mk { background: var(--gold); color: var(--gold-ink); box-shadow: none; }
.milestones li.miss { color: #ffb4a8; }
.seven-row { display: flex; align-items: center; gap: 16px; }
.seven-row .deer { width: 120px; height: 104px; flex: none; }
.big-chips { flex-wrap: wrap; gap: 8px 12px; }
.chip-l { display: inline-flex; align-items: center; gap: 4px; font-size: var(--t-14); color: var(--text-2); }
.kv { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--text-2); }

.hm { display: grid; grid-template-columns: 28px repeat(10, minmax(0, 1fr)); gap: 3px; }
.hm-h, .hm-corner { display: grid; place-items: center; font-size: var(--t-14); color: var(--text-3); font-weight: 700; min-height: 28px; }
.hm-cell { aspect-ratio: 1.6; min-height: 30px; border: 0; border-radius: 6px; background: var(--b-x); transition: transform 120ms var(--ease-out); }
.hm-cell.b0 { background: var(--b0); } .hm-cell.b1 { background: var(--b1); } .hm-cell.b2 { background: var(--b2); }
.hm-cell.b3 { background: var(--b3); } .hm-cell.b4 { background: var(--b4); }
.hm-cell.sel { box-shadow: 0 0 0 3px var(--text); }
.hm-cell:active { transform: scale(0.94); }
.hm-detail { min-height: 2.8em; color: var(--text-2); font-size: var(--t-14); }
.hm-detail b { color: var(--text); }
.top5 { margin: 0; padding-left: 24px; display: flex; flex-direction: column; gap: 10px; }
.top5 li b { display: block; font-size: var(--t-20); }
.top5 li span { color: var(--text-2); font-size: var(--t-14); }
.empty { padding: 24px; border-radius: 12px; background: var(--s2); color: var(--text-2); text-align: center; }

.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; touch-action: pan-y; }
.chart .tick line { stroke: var(--line); }
.chart .tick text, .chart .xl { fill: var(--text-3); font-size: 12px; }
.chart .line { fill: none; stroke: var(--gold); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { fill: var(--gold); stroke: var(--s1); stroke-width: 2; }
.chart .bar { fill: var(--gold); }
.chart .target { stroke: var(--text-2); stroke-dasharray: 4 4; stroke-width: 1.5; }
.chart .target-l { fill: var(--text-2); font-size: 12px; font-weight: 600; }
.chart .cross { stroke: var(--text-3); stroke-width: 1; transition: opacity 120ms ease; }
.chart .tip { position: absolute; transform: translate(-50%, calc(-100% - 12px)); padding: 6px 10px; border-radius: 8px; background: var(--s3); box-shadow: var(--sh-1); font-size: var(--t-14); font-weight: 600; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 120ms ease; }
.chart .tip.on { opacity: 1; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { color: var(--text-2); font-size: var(--t-14); }
.field input, .field textarea {
  min-height: 44px; padding: 10px 12px; border-radius: 12px; border: 0;
  background: var(--s2); box-shadow: inset 0 0 0 1px var(--line); resize: vertical;
}
.field input:focus-visible, .field textarea:focus-visible { outline: 3px solid var(--gold); outline-offset: 1px; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--s2); gap: 2px; align-self: flex-start; }
.seg button { min-height: 40px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; color: var(--text-2); font-weight: 600; transition: background-color 150ms ease, color 150ms ease; }
.seg button[aria-checked="true"] { background: var(--s3); color: var(--text); box-shadow: var(--sh-1); }
.toggle { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.toggle input { appearance: none; -webkit-appearance: none; width: 52px; height: 32px; border-radius: 16px; background: var(--s3); position: relative; flex: none; margin: 0; transition: background-color 180ms ease; cursor: pointer; }
.toggle input::after { content: ""; position: absolute; left: 3px; top: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); transition: transform 200ms var(--ease-out); }
.toggle input:checked { background: var(--gold); }
.toggle input:checked::after { transform: translateX(20px); }
#set-pin { align-self: flex-start; }
.backup .row { display: flex; gap: 12px; flex-wrap: wrap; }
.danger-link { align-self: flex-start; color: #ffb4a8; padding: 0 8px; }

@media (max-width: 900px) {
  .dash { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prog, .seven, .time, .top, .chart-card, .settings, .backup { grid-column: span 1; }
  .heat { grid-column: span 2; }
  .pin-wrap { flex-direction: column; gap: 32px; }
}

/* ---------- Duell ---------- */
.duel-cfgs { flex: 1; display: grid; grid-template-columns: 1fr auto 1fr; gap: 24px; align-items: start; }
.duel-cfg { padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.duel-cfg .field input { font-size: var(--t-20); font-weight: 700; }
.seg--wrap { flex-wrap: wrap; }
.seg--wrap button { min-height: 44px; }
.vs { align-self: center; color: var(--text-3); font-weight: 800; font-size: var(--t-20); }
.duel-start { display: flex; align-items: center; justify-content: center; gap: 24px; padding-bottom: 8px; }
.duel-start .seg button { min-height: 48px; padding: 0 18px; }

.duel-play { flex-direction: row; gap: 0; padding: 0; position: relative; }
.duel-half {
  flex: 1; min-width: 0; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding: max(16px, env(safe-area-inset-top)) 24px max(16px, env(safe-area-inset-bottom));
  --key: 76px; --gap: 10px;
}
.duel-half[data-p="p1"] { padding-left: var(--pad-x); }
.duel-half[data-p="p2"] { padding-right: var(--pad-r); background: rgb(255 255 255 / 0.02); }
.duel-half header { align-self: stretch; display: flex; align-items: center; gap: 12px; }
.duel-half header b { font-size: var(--t-24); }
.duel-score { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; height: 48px; padding: 0 16px; border-radius: 999px; background: var(--s1); font-size: var(--t-32); font-weight: 800; }
.duel-score .icon { color: var(--gold); width: 28px; height: 28px; }
.duel-t { font-size: 4.5rem; }
.duel-answer { min-width: 180px; height: 88px; font-size: 4rem; border-radius: 20px; }
.duel-mid { width: 96px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); position: relative; }
.duel-mid #stop { position: absolute; top: max(16px, env(safe-area-inset-top)); }
.duel-clock { font-size: var(--t-48); font-weight: 800; line-height: 1; }
.duel-clock.hurry { color: var(--gold); }
.duel-penalty { position: absolute; inset: 0; display: grid; place-items: center; background: rgb(6 13 34 / 0.6); z-index: 5; animation: fade-in 120ms ease-out; }
.duel-penalty > div { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px 28px; border-radius: 20px; background: var(--s2); box-shadow: var(--sh-2); }
.duel-penalty b { font-size: var(--t-48); color: var(--calm); }
.duel-penalty span { color: var(--text-2); }
.duel-count { position: absolute; inset: 0; z-index: 20; display: grid; place-items: center; font-size: 10rem; font-weight: 800; color: var(--gold); background: rgb(6 13 34 / 0.7); }
.interlude .actions { display: flex; gap: 12px; margin-top: 8px; }
@media (max-height: 800px) { .duel-half { --key: 72px; gap: 12px; } .duel-t { font-size: 4rem; } .duel-answer { height: 76px; font-size: 3.5rem; } }
