:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --surface-2: #f3ede3;
  --line: #e4ddd0;
  --line-strong: #cfc5b4;
  --text: #1c1917;
  --muted: #665e55;
  --accent: #0f766e;
  --accent-hover: #115e59;
  --accent-soft: #e6f5f3;
  --amber: #9a5b13;
  --amber-line: #d97706;
  --amber-soft: #fef6e6;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --der: #1d4ed8;
  --der-soft: #eff6ff;
  --die: #be185d;
  --die-soft: #fdf2f8;
  --das: #15803d;
  --das-soft: #f0fdf4;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.num {
  font-variant-numeric: tabular-nums;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
}

/* Top bar: strictly 56px */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 56px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1rem;
  min-height: 44px;
  min-width: 0;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-text {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-accent {
  color: var(--accent);
}

.primary-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-2);
  padding: 4px;
  border-radius: 10px;
}

.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 140ms ease-out, color 140ms ease-out;
}

.nav-tab.is-active {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.grade-pill-select {
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
}

.stat-pill .icon {
  color: var(--amber-line);
}

/* Main container */
.app-main {
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 16px 44px;
  min-width: 0;
}

/* Hero Mission Card */
.mission-hero {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.mission-copy {
  min-width: 0;
  max-width: 62ch;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.hero-title {
  margin: 0 0 4px;
  font-size: 1.35rem;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.hero-sub {
  margin: 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 140ms ease-out, border-color 140ms ease-out;
}

.btn-compact {
  min-height: 44px;
  padding: 0 12px;
  font-size: 0.875rem;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.btn-icon {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
}

.is-active-soft {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* Dashboard Grid */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 12px;
}

.section-title {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 700;
}

.section-meta {
  font-size: 0.8125rem;
  color: var(--muted);
}

.tracks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(275px, 100%), 1fr));
  gap: 14px;
}

.track-card {
  display: flex;
  flex-direction: column;
  text-align: left;
  width: 100%;
  min-width: 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: transform 140ms ease-out, border-color 140ms ease-out;
}

.track-card.is-upcoming {
  background: #fdfbf7;
  border-style: dashed;
}

.track-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  margin-bottom: 10px;
}

.domain-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--muted);
}

.level-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  font-variant-numeric: tabular-nums;
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--amber-soft);
  color: var(--amber);
  border: 1px solid var(--amber-line);
}

.track-preview {
  width: 100%;
  aspect-ratio: 132 / 72;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.track-art {
  width: 100%;
  height: 100%;
  display: block;
}

.track-name {
  display: block;
  width: 100%;
  font-size: 1.0625rem;
  font-weight: 700;
  margin: 0 0 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-sub {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0 0 12px;
}

.upcoming-foot {
  margin-top: auto;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent);
}

.mastery-row {
  margin-top: auto;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mastery-bar {
  flex: 1;
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
}

.mastery-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 180ms ease-out;
}

.mastery-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--muted);
}

/* Lab Studio Shell */
.exercise-shell {
  max-width: 740px;
  margin: 0 auto;
  min-width: 0;
}

.exercise-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.bar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.compact-select {
  min-height: 44px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-weight: 600;
}

.progress-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.p-dot {
  width: 20px;
  height: 8px;
  border-radius: 999px;
  background: var(--line);
}

.p-dot.is-current {
  background: var(--amber-line);
}

.p-dot.is-done {
  background: var(--accent);
}

.exercise-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  min-width: 0;
}

.topic-kicker {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 4px;
}

.prompt-text {
  margin: 0 0 16px;
  font-size: 1.09375rem;
  font-weight: 700;
  line-height: 1.45;
  max-width: 66ch;
}

/* 2-Tap Wort-Lupe */
.lupe-term {
  display: inline;
  padding: 0 2px;
  margin: 0;
  border: none;
  border-bottom: 2px dotted var(--accent);
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.lupe-popover {
  position: fixed;
  z-index: 60;
  width: min(300px, calc(100vw - 24px));
  background: var(--surface);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: 0 10px 28px rgba(28, 25, 23, 0.16);
}

.lupe-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.875rem;
  color: var(--accent);
  margin-bottom: 6px;
}

.lupe-close {
  min-width: 36px;
  min-height: 36px;
  border: none;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.lupe-de {
  margin: 0 0 8px;
  font-size: 0.875rem;
  color: var(--text);
}

.lupe-step2-btn {
  min-height: 40px;
  width: 100%;
  padding: 0 10px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  color: var(--muted);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.lupe-gloss {
  padding-top: 6px;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Parent Whisper Drawer & Gate Banner */
.whisper-drawer,
.gate-banner {
  background: var(--surface);
  border: 1.5px solid var(--amber-line);
  border-left-width: 4px;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 14px;
}

.whisper-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.mini-lang-group {
  display: flex;
  gap: 4px;
}

.mini-lang-btn {
  min-height: 36px;
  min-width: 42px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--bg);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.mini-lang-btn.is-on {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.whisper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(195px, 100%), 1fr));
  gap: 12px;
}

.whisper-col p {
  margin: 4px 0 0;
  font-size: 0.875rem;
  color: var(--text);
}

.w-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--amber);
}

.gate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

/* =========================================================================
   FLAGSHIP LAB 1: GEOMETRIE MANIPULATIVES
   ========================================================================= */
.mirror-board {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.mirror-board.is-horizontal {
  flex-direction: column;
}

.mirror-pane {
  display: grid;
  grid-template-columns: repeat(var(--grid-n, 3), 48px);
  gap: 4px;
}

.m-cell {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.m-cell.is-source {
  background: var(--accent);
  border-color: var(--accent);
}

.m-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ffffff;
}

.m-cell.is-interactive {
  cursor: pointer;
}

.m-cell.is-painted {
  background: #0284c7;
  border-color: #0369a1;
}

.m-cell.is-ok {
  background: var(--ok);
  border-color: var(--ok);
}

.mirror-axis {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  border-left: 3px dashed #dc2626;
  padding: 0 4px;
}

.mirror-board.is-horizontal .mirror-axis {
  border-left: none;
  border-top: 3px dashed #dc2626;
  padding: 4px 0;
}

.axis-tag {
  font-size: 0.7rem;
  font-weight: 700;
  color: #b91c1c;
  background: #fef2f2;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Bauplan + 3D Isometric Dual View */
.dual-geo-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 14px;
}

.geo-pane {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.pane-caption {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--muted);
}

.iso-svg {
  width: 100%;
  max-width: 230px;
  aspect-ratio: 230 / 156;
  display: block;
}

.live-iso-mini {
  width: 100%;
  max-width: 195px;
}

.bauplan-grid {
  display: grid;
  grid-template-columns: repeat(var(--bp-cols, 2), 54px);
  gap: 6px;
}

.bauplan-cell {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  border: 2px solid var(--line-strong);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--muted);
  cursor: pointer;
}

.bauplan-cell.has-cubes {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.bauplan-cell.is-ok {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok);
}

/* Garden Perimeter / Area Spanner */
.garden-stage {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.garden-grid {
  display: grid;
  grid-template-columns: repeat(var(--g-cols, 6), 46px);
  gap: 2px;
}

.garden-cell {
  width: 46px;
  height: 46px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  padding: 0;
  cursor: pointer;
}

.garden-cell.is-on {
  background: #bbf7d0;
  border-color: #86efac;
}

.garden-cell.f-top { border-top: 3.5px solid #92400e; }
.garden-cell.f-bottom { border-bottom: 3.5px solid #92400e; }
.garden-cell.f-left { border-left: 3.5px solid #92400e; }
.garden-cell.f-right { border-right: 3.5px solid #92400e; }

.metric-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.metric-pill {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 0.85rem;
}

/* Cube-Net Folder */
.net-stage {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  justify-content: center;
  overflow-x: auto;
}

.net-grid {
  display: grid;
  grid-template-columns: repeat(var(--net-cols, 4), 56px);
  gap: 5px;
}

.net-empty {
  width: 56px;
  height: 56px;
}

.net-face {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  border: 2px solid var(--accent);
  background: var(--surface);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.net-face.is-base {
  background: var(--surface-2);
  border-style: double;
  border-width: 3px;
  cursor: default;
}

.net-face.is-star {
  background: var(--amber-soft);
  border-color: var(--amber-line);
  color: var(--amber);
  cursor: default;
}

.net-face.is-picked {
  background: var(--der-soft);
  border-color: var(--der);
  color: var(--der);
}

.net-face.is-ok {
  background: var(--ok-soft);
  border-color: var(--ok);
  color: var(--ok);
}

.net-sub {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--muted);
}

/* Composite Area + Compact Swiss Keypad */
.composite-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.geo-stage {
  width: 100%;
  max-width: 360px;
  aspect-ratio: 260 / 156;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.geo-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.kpad-shell {
  width: 100%;
  max-width: 300px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
}

.kpad-readout {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 10px;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
}

.kpad-val {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 800;
}

.kpad-val.is-placeholder {
  color: var(--muted);
}

.kpad-unit {
  font-weight: 700;
  color: var(--muted);
}

.kpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.kpad-btn {
  min-height: 46px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}

/* 3D Cube Roller */
.roller-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.roll-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 108px));
  gap: 6px;
}

.roll-cell {
  min-height: 68px;
  padding: 8px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.roll-cell.is-start {
  background: var(--surface);
  border-color: var(--accent);
}

.roll-cell.is-path {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.roll-cell.is-target {
  background: var(--amber-soft);
  border-color: var(--amber-line);
}

.die-badge {
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.78rem;
  margin-bottom: 2px;
}

.die-badge.is-goal {
  background: var(--amber-line);
}

.die-picker-label {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--muted);
}

.die-picker-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.die-pick-btn {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  border: 2px solid var(--line-strong);
  background: var(--surface);
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
}

.die-pick-btn.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.die-pick-btn.is-ok {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok);
}

/* =========================================================================
   FLAGSHIP LAB 2: SPRACHE IM FOKUS MANIPULATIVES
   ========================================================================= */
.komposita-stage,
.morph-stage,
.klammer-stage,
.v2-stage,
.faelle-stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.train-track {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 2px solid var(--line-strong);
}

.train-track.gender-der { border-color: var(--der); background: var(--der-soft); }
.train-track.gender-die { border-color: var(--die); background: var(--die-soft); }
.train-track.gender-das { border-color: var(--das); background: var(--das-soft); }

.train-slot {
  min-height: 46px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1.5px dashed var(--line-strong);
  background: var(--surface);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.train-slot.is-grundwort {
  border-style: solid;
  border-width: 2px;
}

.gw-tag,
.tile-art {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  font-size: 0.7rem;
  color: var(--muted);
}

.train-plus {
  font-weight: 800;
  color: var(--muted);
}

.compound-result {
  font-size: 1rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.dock-label {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--muted);
}

.art-dock,
.tile-dock,
.stem-row,
.grapheme-row,
.stamp-dock {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.art-chip,
.word-tile,
.stem-card,
.grapheme-btn,
.stamp-btn {
  min-height: 46px;
  padding: 8px 14px;
  border-radius: 9px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.art-chip.is-active.gender-der { border-color: var(--der); background: var(--der); color: #ffffff; }
.art-chip.is-active.gender-die { border-color: var(--die); background: var(--die); color: #ffffff; }
.art-chip.is-active.gender-das { border-color: var(--das); background: var(--das); color: #ffffff; }

.word-tile.is-used {
  opacity: 0.45;
}

.sentence-workbench {
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px solid var(--line);
}

.token-sentence {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.token-btn {
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  font: inherit;
  font-size: 1.02rem;
  font-weight: 600;
  cursor: pointer;
}

.token-btn.is-cap {
  border-color: var(--der);
  background: var(--der-soft);
  color: var(--der);
  font-weight: 800;
}

.token-btn.is-ok {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 800;
}

.punct-mark {
  font-size: 1.2rem;
  font-weight: 800;
}

/* Wortstamm & Präteritum */
.morph-word-preview {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 1.35rem;
  font-weight: 800;
  text-align: center;
}

.morph-gap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 2px 8px;
  margin: 0 3px;
  border-radius: 6px;
  border: 2px dashed var(--amber-line);
  background: var(--amber-soft);
  color: var(--amber);
}

.morph-gap.is-filled {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.stem-card.is-selected,
.grapheme-btn.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.stem-card.is-ok,
.grapheme-btn.is-ok {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--ok);
}

.source-sentence {
  font-size: 0.92rem;
  color: var(--muted);
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.klammer-frame {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 1.08rem;
  line-height: 2.1;
}

.klammer-slot {
  min-height: 44px;
  padding: 4px 12px;
  border-radius: 8px;
  border: 2px dashed var(--amber-line);
  background: var(--amber-soft);
  font: inherit;
  font-weight: 800;
  color: var(--amber);
  cursor: pointer;
}

.klammer-slot.is-focused {
  border-color: var(--accent);
}

.klammer-slot.is-filled {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* Verschiebeprobe V2 Hinge */
.v2-rail {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto minmax(180px, 1.5fr);
  gap: 10px;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.vorfeld-box,
.v2-hinge,
.mittelfeld-box {
  min-height: 74px;
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.vorfeld-box {
  border: 2px dashed var(--accent);
  background: var(--surface);
  text-align: left;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.vorfeld-box.is-filled {
  border-style: solid;
  background: var(--accent-soft);
}

.v2-hinge {
  border: 2px solid var(--amber-line);
  background: var(--amber-soft);
  color: var(--amber);
  text-align: center;
}

.mittelfeld-box {
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
}

.mittelfeld-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.placed-chunk {
  min-height: 38px;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.slot-tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
}

.slot-placeholder {
  font-size: 0.85rem;
  color: var(--muted);
}

/* 4 Fälle Stamper */
.faelle-sentence {
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--bg);
  border: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
}

.phrase-slot {
  min-height: 46px;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1.5px dashed var(--line-strong);
  background: var(--surface);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.phrase-slot.has-role {
  border-style: solid;
}

.case-tag {
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.72rem;
  background: var(--surface-2);
  color: var(--muted);
}

.stamp-btn.is-active,
.phrase-slot.case-nom { border-color: var(--der); background: var(--der-soft); }
.phrase-slot.case-gen { border-color: var(--amber-line); background: var(--amber-soft); }
.phrase-slot.case-dat { border-color: var(--die); background: var(--die-soft); }
.phrase-slot.case-akk { border-color: var(--das); background: var(--das-soft); }

/* Feedback & Action Bar */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.feedback-banner {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--accent);
  background: var(--surface-2);
  font-size: 0.9375rem;
  max-width: 65ch;
}

.feedback-banner.is-ok {
  background: var(--ok-soft);
  border-left-color: var(--ok);
}

.feedback-banner.is-coach {
  background: var(--amber-soft);
  border-left-color: var(--amber-line);
}

.feedback-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  margin-bottom: 4px;
}

.milestone-note {
  margin-top: 6px;
  font-weight: 700;
  color: var(--ok);
}

/* Methoden-SOS & Eltern Cards */
.panel-card,
.sos-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 14px;
}

.sos-card.is-highlighted {
  border-color: var(--accent);
  border-width: 2px;
}

.sos-top-row,
.sos-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.sos-title {
  margin: 4px 0 0;
  font-size: 1.15rem;
}

.sos-art-wrap {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 220 / 88;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin: 10px 0 14px;
}

.sos-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.sos-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr));
  gap: 12px;
}

.sos-box {
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--line);
}

.sos-box.is-swiss {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.sos-box.is-warn {
  background: var(--amber-soft);
  border-color: var(--amber-line);
}

.sos-box p {
  margin: 5px 0 0;
  font-size: 0.875rem;
}

.search-row {
  margin-top: 12px;
}

.search-input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1.5px solid var(--line-strong);
  background: var(--bg);
}

.chip-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.centered-strip {
  justify-content: center;
}

.chip-btn {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.chip-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.word-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 8px 0;
}

.word-pill {
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

.diag-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.diag-list {
  margin: 8px 0 0;
  padding-left: 20px;
}

.diag-list li {
  margin-bottom: 6px;
  font-size: 0.92rem;
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.file-btn {
  cursor: pointer;
}

/* Toast & Mobile Nav */
.toast {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  background: var(--text);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.875rem;
}

.toast-undo {
  min-height: 36px;
  padding: 0 10px;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.18);
  color: #fef3c7;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.mobile-nav {
  display: none;
}

@media (hover: hover) {
  .track-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
  }
  .btn:hover {
    background: var(--surface-2);
  }
  .btn-primary:hover {
    background: var(--accent-hover);
  }
}

@media (max-width: 720px) {
  .desktop-nav {
    display: none;
  }
  .app-main {
    padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }
  .mission-hero {
    flex-direction: column;
    align-items: stretch;
  }
  .v2-rail {
    grid-template-columns: 1fr;
  }
  .garden-grid {
    grid-template-columns: repeat(var(--g-cols, 6), 44px);
  }
  .garden-cell {
    width: 44px;
    height: 44px;
  }
  .mobile-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 25;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mobile-tab {
    min-height: 56px;
    border: none;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
  }
  .mobile-tab.is-active {
    color: var(--accent);
  }
  .toast {
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
