/* ============================================================
   ÉKHO Wortspiel (Arbeitstitel: SemantiQ) — Prototyp v0.3 im Design v3 „Semantischer Raum“
   Dunkel und technisch, aber ruhig: ein Messinstrument, kein Cockpit.
   Basis: design-test-v3/styles.css, ergänzt um die app-spezifischen Teile
   (Verbindung, Vorschläge, Busy-/Sperrzustände, Labor-Rundenhinweis).
   Nur Systemschriften, keine externen Ressourcen.
   ============================================================ */

:root {
  --bg0: #08111C;            /* Seitenhintergrund außen */
  --bg1: #0B1624;            /* Hauptgrund */
  --bg2: #0F1E30;            /* Panels */
  --bg3: #13253A;            /* erhöhte Flächen / Hover */
  --bg4: #19324C;            /* aktive Fläche / Auswahl */
  --line: rgba(196, 219, 241, 0.10);
  --line-2: rgba(196, 219, 241, 0.18);
  --line-3: rgba(196, 219, 241, 0.34);
  --text: #E9F1FA;
  --text-2: #A9BBCE;
  --muted: #7C90A6;
  --accent: #B8E04A;         /* Limette: primäre Aktion, Fokus, Erfolg */
  --accent-hover: #C8EC66;
  --accent-ink: #08111C;     /* Text auf Limette */
  --cyan: #7BC4FF;           /* technische Markierung, Links, Maschinenweg */
  --heat-0: #61788F;         /* kalt */
  --heat-0d: #8298AD;        /* kalt-Symbol */
  --heat-1: #C99A3F;         /* lau */
  --heat-2: #EE8A3C;         /* warm */
  --heat-3: #FF6A3D;         /* heiß */
  --heat-4: #FF3E4D;         /* Ziel / Rang 1 */
  --miss: #FF9C8C;

  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", "SF Mono", Consolas, "Liberation Mono", monospace;

  --panel-fill: linear-gradient(180deg, rgba(19, 37, 58, 0.85), rgba(15, 30, 48, 0.95));
  --shadow-panel: 0 1px 0 rgba(233, 241, 250, 0.035) inset, 0 28px 60px -34px rgba(0, 0, 0, 0.75);
  --shadow-pop: 0 1px 0 rgba(233, 241, 250, 0.05) inset, 0 24px 60px -20px rgba(0, 0, 0, 0.8);
  --grid-line: rgba(140, 175, 210, 0.045);
  --ease: cubic-bezier(0.22, 0.7, 0.2, 1);
}

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; background: var(--bg0); }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 780px at 32% -10%, #122540 0%, #0B1624 55%, #08111C 100%) no-repeat, var(--bg0);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Feines technisches Raster: Textur, keine Achse — nach unten ausgeblendet */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.6) 45%, transparent 92%);
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.6) 45%, transparent 92%);
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
strong { font-weight: 650; }
em { font-style: normal; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); font-weight: 400; }

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

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 200;
  padding: 10px 16px; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); text-decoration: none; font-weight: 650;
}
.skip-link:focus { top: 12px; }

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

::selection { background: rgba(123, 196, 255, 0.3); color: var(--text); }

/* Mono-Kicker: sparsam, nur als Kopfzeilen-Marke */
.kicker {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ------------------------------------------------------------
   Grundbausteine: Panels, Buttons, Chips
   ------------------------------------------------------------ */

.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-fill);
  box-shadow: var(--shadow-panel);
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 8px;
  background: transparent;
  font-size: 14.5px; font-weight: 600; line-height: 1;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.2s ease, color 0.15s ease;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 0 0 1px rgba(184, 224, 74, 0.4), 0 0 22px rgba(184, 224, 74, 0.16);
}
.btn--secondary { border-color: var(--line-3); color: var(--text); }
.btn--secondary:hover:not(:disabled) { background: rgba(196, 219, 241, 0.06); border-color: rgba(196, 219, 241, 0.5); }
.btn:disabled { opacity: 0.42; cursor: not-allowed; }
.btn.is-armed { border-color: var(--heat-3); color: #FFC2B3; background: rgba(255, 106, 61, 0.1); }

.text-btn {
  padding: 6px 2px; border: 0; background: none;
  color: var(--cyan); font-size: 15px; font-weight: 600;
  text-decoration: none; text-underline-offset: 4px; text-decoration-thickness: 1px;
}
.text-btn:hover { text-decoration: underline; }

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 40px; height: 40px; padding: 0;
  border: 1px solid var(--line-2); border-radius: 8px;
  background: transparent; color: var(--text-2);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg .fill { fill: currentColor; stroke: none; }
.icon-btn:hover, .icon-btn[aria-expanded="true"] { background: var(--bg3); border-color: var(--line-3); color: var(--text); }

.segmented {
  display: inline-flex; gap: 2px; padding: 3px;
  border: 1px solid var(--line-2); border-radius: 8px;
  background: rgba(8, 17, 28, 0.5);
}
.seg {
  padding: 6px 13px; border: 0; border-radius: 6px; background: none;
  font-size: 14px; font-weight: 600; color: var(--text-2);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.seg:hover { color: var(--text); }
.seg[aria-checked="true"], .seg[aria-selected="true"] { background: var(--bg4); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-3); }

/* ------------------------------------------------------------
   Kopfzeile
   ------------------------------------------------------------ */

.app { display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 100vh; }

.topbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 26px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 17, 28, 0.55);
}

.brand { display: flex; align-items: center; gap: 10px; }
/* Marke ist ein Link zur ekho.ooo-Website (neuer Tab); Optik unverändert, Hover zeigt ↗ */
a.brand { position: relative; color: inherit; text-decoration: none; border-radius: 6px; }
a.brand:hover .brand-name { color: var(--accent); }
a.brand:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
a.brand::after {
  content: "↗"; position: absolute; right: -15px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  opacity: 0; transition: opacity 0.2s ease; pointer-events: none;
}
a.brand:hover::after, a.brand:focus-visible::after { opacity: 0.8; }
.brand-mark { width: 26px; height: 26px; flex: none; fill: var(--bg1); stroke: var(--text-2); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark .brand-hot { fill: var(--accent); stroke: var(--accent); }
.brand-name { font-size: 19px; font-weight: 650; letter-spacing: -0.01em; }
.brand-tag {
  padding: 3px 8px; border: 1px solid var(--line-2); border-radius: 6px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-2);
}

.round { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 22px; }
.round-title { margin: 0; color: var(--text-2); font-size: 14.5px; }
.round-player { font-weight: 650; color: var(--text); }
.progress { display: flex; align-items: center; gap: 12px; font-size: 14.5px; color: var(--text-2); }
.progress .num { color: var(--text); font-size: 14px; }
.progress strong.num { font-weight: 600; }
.progress-track { position: relative; width: 104px; height: 2px; background: var(--line-2); overflow: hidden; }
.progress-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--text-2); transition: width 0.6s var(--ease); }

.seal-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 6px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-2);
}
.seal-chip-icon { width: 9px; height: 9px; border: 1px dashed var(--text-2); }
.seal-chip.is-open { border-color: rgba(255, 62, 77, 0.55); color: #FFB7BD; background: rgba(255, 62, 77, 0.08); }
.seal-chip.is-open .seal-chip-icon { border: 0; border-radius: 50%; background: var(--heat-4); box-shadow: 0 0 8px rgba(255, 62, 77, 0.7); }

.actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.data-chip {
  margin-right: 6px; padding: 4px 10px;
  border: 1px dashed var(--line-3); border-radius: 6px;
  font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap;
}
.btn-lab svg { width: 19px; height: 19px; }

/* ------------------------------------------------------------
   Popover (Hilfe, Einstellungen)
   ------------------------------------------------------------ */

.pop-wrap { position: relative; }
.popover {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 60;
  width: 380px; max-width: calc(100vw - 32px);
  padding: 16px 18px 14px;
  border: 1px solid var(--line-2); border-radius: 12px;
  background: linear-gradient(180deg, var(--bg3), var(--bg2));
  box-shadow: var(--shadow-pop);
  animation: pop-in 0.22s var(--ease) both;
}
.popover--narrow { width: 320px; }
.pop-title { margin: 4px 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-size: 20px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }

.legend-scale { display: block; margin-bottom: 12px; }
.legend-bar {
  display: block; height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--heat-0) 0%, var(--heat-0) 12%, var(--heat-1) 30%, var(--heat-2) 52%, var(--heat-3) 75%, var(--heat-4) 100%);
}
.legend-ends { display: flex; justify-content: space-between; margin-top: 5px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.legend-bands, .legend-rules { margin: 0; padding: 0; list-style: none; }
.legend-bands li {
  display: grid; grid-template-columns: 1.4em 1fr auto; align-items: baseline; gap: 8px;
  padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 15px;
}
.legend-bands .lb-range { font-family: var(--mono); font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sym { text-align: center; font-weight: 700; color: var(--c, var(--text)); }
.sym--ghost { color: var(--muted); font-weight: 400; }
.legend-rules { margin-top: 12px; font-size: 14.5px; color: var(--text-2); }
.legend-rules strong { color: var(--text); }
.legend-rules li + li { margin-top: 6px; }
.legend-note {
  margin: 12px 0 6px; padding: 8px 0 0 12px; border-left: 1px solid var(--line-3);
  color: var(--text-2); font-size: 14px;
}

.switch {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  width: 100%; padding: 11px 2px; border: 0; border-top: 1px solid var(--line);
  background: none; text-align: left;
}
.switch:first-of-type { border-top: 0; }
.switch-text { display: flex; flex-direction: column; line-height: 1.35; }
.switch-label { font-weight: 600; font-size: 15px; }
.switch-sub { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.switch-knob {
  position: relative; flex: none; width: 40px; height: 22px; border-radius: 11px;
  border: 1px solid var(--line-3); background: var(--bg1);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.switch-knob::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--text-2); transition: transform 0.2s var(--ease), background-color 0.2s ease;
}
.switch[aria-pressed="true"] .switch-knob { background: rgba(184, 224, 74, 0.16); border-color: var(--accent); }
.switch[aria-pressed="true"] .switch-knob::after { transform: translateX(18px); background: var(--accent); }
.switch:disabled { opacity: 0.5; cursor: not-allowed; }

/* Versuche pro Runde (Einstellungen): vier Vorgaben, gewählte in Akzentfarbe */
.setting { padding: 11px 2px 12px; border-top: 1px solid var(--line); }
.setting .switch-label { display: block; margin: 0; }
.setting .switch-sub { display: block; margin: 7px 0 0; line-height: 1.35; }
.choices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.choice {
  flex: 1 1 52px; min-height: 40px; padding: 0 8px;
  border: 1px solid var(--line-3); border-radius: 8px; background: var(--bg1);
  font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--text-2);
  font-variant-numeric: tabular-nums;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.choice:hover { color: var(--text); border-color: var(--text-2); }
.choice[aria-pressed="true"] { border-color: var(--accent); background: rgba(184, 224, 74, 0.14); color: var(--text); box-shadow: inset 0 0 0 1px rgba(184, 224, 74, 0.35); }

/* Einwilligung zur Spracheingabe (Opt-in, im Einstellungen-Popover) */
.consent {
  margin: 2px 0 10px; padding: 12px 14px 14px;
  border: 1px solid var(--line-3); border-left: 2px solid var(--cyan); border-radius: 8px;
  background: rgba(8, 17, 28, 0.55);
  font-size: 14px; color: var(--text-2);
}
.consent-title { margin: 0 0 6px; font-weight: 650; font-size: 15px; color: var(--text); }
.consent-list { margin: 0; padding-left: 18px; }
.consent-list li + li { margin-top: 4px; }
.consent-list strong { color: var(--text); }
.consent-more { margin: 8px 0 0; }
.consent-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.consent-actions .btn { flex: 1 1 auto; white-space: normal; text-align: center; line-height: 1.2; }

/* Links zu Impressum · Datenschutz · Lizenzen (Hilfe-Popover) */
.legal-links { margin: 10px 0 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.consent a, .legal-links a { color: var(--cyan); text-underline-offset: 3px; }
.consent a:hover, .legal-links a:hover { color: var(--text); }

/* ------------------------------------------------------------
   Hauptlayout
   ------------------------------------------------------------ */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(380px, 26vw, 480px);
  gap: 16px;
  padding: 16px 20px 20px;
  min-height: 0;
}

/* Bühne */
.stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0; min-height: 0;
  overflow: hidden;
  container-type: inline-size;
}

.stage-head { padding: 16px 24px 12px; border-bottom: 1px solid var(--line); }
.stage-title { margin: 2px 0 0; font-size: 30px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.stage-sub { margin: 4px 0 0; color: var(--text-2); font-size: 14.5px; }
.stage-sub em { color: var(--text); font-weight: 500; }

.map { position: relative; min-height: 0; overflow: hidden; }
.map::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(140, 175, 210, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(140, 175, 210, 0.05) 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: center center;
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, #000 20%, transparent 85%);
  mask-image: radial-gradient(ellipse 70% 70% at 50% 50%, #000 20%, transparent 85%);
}
.islands, .tokens { position: absolute; inset: 0; }
.edges { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.tokens { pointer-events: none; }

/* Statische Konstellation: einmal gezeichnet, Illustration — verbindet Einführung und Spiel */
.constellation {
  position: absolute; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
  transition: opacity 1.2s ease;
}
.constellation .cn-edge { stroke: rgba(140, 175, 210, 0.11); stroke-width: 1; }
.constellation .cn-node { fill: rgba(169, 187, 206, 0.32); }
.constellation .cn-node--hi { fill: rgba(169, 187, 206, 0.5); }
.map.has-words .constellation { opacity: 0.5; }
.map.is-revealed .constellation { opacity: 0.32; }

/* Themenfeld-Zonen */
.island {
  position: absolute; left: 0; top: 0;
  --zone: 97, 120, 143;
  border: 1px solid rgba(var(--zone), 0.24);
  border-radius: 12px;
  background: rgba(var(--zone), var(--zone-a, 0.05));
  box-shadow: inset 0 1px 0 rgba(233, 241, 250, 0.03);
  will-change: transform;
  transition: background-color 1.2s ease, border-color 1.2s ease;
}
.island-label {
  position: absolute; left: 8px; top: 6px;
  display: flex; align-items: baseline; gap: 8px;
  padding: 2px 8px 3px 6px;
  border-radius: 5px;
  background: var(--bg2);
  white-space: nowrap;
}
.island-label::before {
  content: ""; align-self: center;
  width: 7px; height: 7px; border-radius: 2px;
  background: rgb(var(--zone));
  box-shadow: 0 0 8px rgba(var(--zone), 0.6);
  transition: background-color 1.2s ease;
}
.il-name { font-size: 14px; font-weight: 600; color: var(--text-2); }
.il-val { font-family: var(--mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.island.is-new { animation: island-in 0.9s var(--ease) both; }

/* Wortkarten */
.tok { position: absolute; left: 0; top: 0; pointer-events: auto; will-change: transform; }
.token {
  --heat-rgb: 97, 120, 143;
  position: relative;
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 7px 12px 8px 10px;
  border: 1px solid rgba(var(--heat-rgb), calc(0.2 + 0.3 * var(--t, 0)));
  border-radius: 8px;
  background: var(--bg2);
  color: var(--text);
  font-size: 16px;
  font-size: clamp(15px, 1.15cqi, 17px);
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 0 calc(4px + 18px * var(--t, 0)) -6px rgba(var(--heat-rgb), calc(0.08 + 0.3 * var(--t, 0))), 0 8px 18px -12px rgba(0, 0, 0, 0.8);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}
.token:hover, .tok.is-active .token {
  border-color: var(--line-3);
  background: var(--bg3);
  box-shadow: 0 0 0 1px rgba(var(--heat-rgb), 0.35), 0 0 calc(10px + 24px * var(--t, 0)) -4px rgba(var(--heat-rgb), calc(0.2 + 0.4 * var(--t, 0))), 0 8px 18px -12px rgba(0, 0, 0, 0.8);
}
.token:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.tok-sym { color: var(--heat-sym, var(--text)); font-weight: 700; }
.tok-word { font-weight: 560; }
.tok-rank { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tok-check { color: var(--accent); font-weight: 700; }
.tok-check:empty { display: none; }
.tok.is-new .token { animation: land 0.85s var(--ease) var(--delay, 0s) both; }
.tok.is-pulse .token { animation: pulse 1.3s ease-out both; }

.token--neighbor {
  border: 1px dashed rgba(var(--heat-rgb), 0.7);
  background: rgba(15, 30, 48, 0.92);
  color: var(--text-2);
  box-shadow: none;
}
.token--neighbor .tok-word { font-weight: 500; }
/* Ziel-Nachbarn als kompakte Wort-Chips: Rang steht in Popover, Auswertung und aria-label */
.token--neighbor:not(.token--path) {
  gap: 6px;
  padding: 5px 9px 6px 8px;
  font-size: 14.5px;
  font-size: calc(0.92 * clamp(15px, 1.15cqi, 17px));
}
.token--neighbor .tok-rank { display: none; }
/* Stationen des Maschinenwegs (gleiche Optik, aber volle Karte) behalten ihren Rang */
.token--path .tok-rank { display: inline; }
.token--probe {
  padding: 4px 10px 5px 8px;
  font-size: 0.88em;
  border: 1px dashed var(--line-3);
  background: rgba(15, 30, 48, 0.88);
  color: var(--text-2);
  box-shadow: none;
}
.token--probe .tok-sym { color: var(--muted); font-weight: 400; }

/* Siegel (gesuchtes Ziel): Messrahmen mit Eckwinkeln */
.seal {
  --seal-c: var(--text-2);
  position: absolute; left: 0; top: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: 220px; padding: 16px 18px 17px;
  border: 1px dashed var(--line-3);
  border-radius: 3px;
  background: rgba(8, 17, 28, 0.72);
  text-align: center;
  transform: var(--seal-pos, translate(-9999px, 0));
  transition: border-color 0.8s ease, background-color 0.8s ease, box-shadow 1.2s ease;
  will-change: transform;
}
.seal::before {
  content: ""; position: absolute; inset: -6px; pointer-events: none;
  background:
    linear-gradient(var(--seal-c), var(--seal-c)) left top / 14px 1.5px,
    linear-gradient(var(--seal-c), var(--seal-c)) left top / 1.5px 14px,
    linear-gradient(var(--seal-c), var(--seal-c)) right top / 14px 1.5px,
    linear-gradient(var(--seal-c), var(--seal-c)) right top / 1.5px 14px,
    linear-gradient(var(--seal-c), var(--seal-c)) left bottom / 14px 1.5px,
    linear-gradient(var(--seal-c), var(--seal-c)) left bottom / 1.5px 14px,
    linear-gradient(var(--seal-c), var(--seal-c)) right bottom / 14px 1.5px,
    linear-gradient(var(--seal-c), var(--seal-c)) right bottom / 1.5px 14px;
  background-repeat: no-repeat;
  transition: opacity 0.8s ease;
}
/* dezenter Innen-Schein; atmet langsam (einziges Dauer-Element, abschaltbar) */
.seal::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(123, 196, 255, 0.1), rgba(123, 196, 255, 0));
  animation: seal-breathe 6s ease-in-out infinite alternate;
}
.seal-kicker {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--muted); transition: color 0.8s ease;
}
.seal-word { font-size: 17px; font-weight: 500; color: var(--text-2); line-height: 1.2; transition: color 0.8s ease; }
.seal.is-open {
  --seal-c: var(--heat-4);
  border: 1px solid rgba(255, 62, 77, 0.5);
  background: rgba(8, 17, 28, 0.82);
  box-shadow: 0 0 0 1px rgba(255, 62, 77, 0.12), 0 0 70px -12px rgba(255, 62, 77, 0.5);
}
.seal.is-open::after { animation: none; background: radial-gradient(closest-side, rgba(255, 62, 77, 0.2), rgba(255, 62, 77, 0)); }
.seal.is-open .seal-kicker { color: #FFB7BD; }
.seal.is-open .seal-word {
  font-size: 38px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1;
  color: var(--heat-4);
  text-shadow: 0 0 24px rgba(255, 62, 77, 0.55);
}
.seal.is-open.is-new { animation: seal-open 0.9s var(--ease) both; }

.map-warmth {
  position: absolute; left: 0; top: 0; z-index: 0;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 62, 77, 0.08), rgba(238, 138, 60, 0.03) 45%, rgba(238, 138, 60, 0) 100%);
  opacity: 0; transform: scale(0.05);
  pointer-events: none;
}
.map-warmth.is-on { opacity: 1; transform: scale(1); }
.map-warmth.is-wave { animation: wave 2.2s var(--ease) both; }

.map-empty {
  position: absolute; left: 50%; top: calc(50% + 72px); transform: translateX(-50%);
  margin: 0; color: var(--muted); font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.02em;
  white-space: nowrap; pointer-events: none;
}

/* Kanten: nur wo Daten sie tragen */
.edge { fill: none; }
.edge-thread { stroke: var(--accent); stroke-width: 1.5; stroke-linecap: round; animation: thread 3.4s ease-out both; }
.edge-probe { stroke: rgba(123, 196, 255, 0.55); stroke-width: 1; stroke-dasharray: 3 4; }
.edge-neighbor { stroke-width: 1.3; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s var(--ease) both; }
.edge-machine { stroke: var(--cyan); stroke-width: 2; stroke-dasharray: 7 6; stroke-linecap: round; animation: fade-in 0.8s ease both; }
.map.is-stacked .edge-neighbor { stroke-opacity: 0.55; }
.tok-step {
  display: inline-grid; place-items: center; align-self: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px;
  background: var(--cyan); color: var(--bg0);
  font-family: var(--mono); font-size: 12px; font-weight: 700; line-height: 1;
}
.tok-step:empty { display: none; }

/* Detail-Popover zur Wortkarte */
.tip {
  position: absolute; left: 0; top: 0; z-index: 30;
  max-width: 300px; padding: 10px 13px 11px;
  border: 1px solid var(--line-3); border-radius: 8px;
  background: var(--bg3);
  font-size: 14px; line-height: 1.45;
  box-shadow: var(--shadow-pop);
  pointer-events: none;
}
.tip strong { display: block; font-size: 17px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.tip .tip-row { display: block; color: var(--text-2); }
.tip .tip-row.is-data { font-family: var(--mono); font-size: 12.5px; color: var(--text); }

/* ------------------------------------------------------------
   Unterer Streifen: Dein Weg / Auflösung
   ------------------------------------------------------------ */

.dock {
  position: relative; z-index: 20;
  border-top: 1px solid var(--line);
  background: rgba(11, 22, 36, 0.94);
}
.stage.is-overlay-dock .dock {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: #0E1C2D;
  box-shadow: 0 -18px 40px -24px rgba(0, 0, 0, 0.8);
}
.stage.is-overlay-dock .dock-body { max-height: min(50vh, 380px); }
.stage.is-overlay-dock .map { margin-bottom: var(--dock-bar-h, 56px); }

.dock-bar { display: flex; align-items: center; gap: 18px; min-height: 56px; padding: 8px 18px 8px 14px; }
.dock-tabs { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line-2); border-radius: 8px; background: rgba(8, 17, 28, 0.5); }
.dock-tab {
  padding: 5px 12px; border: 0; border-radius: 6px; background: none;
  font-size: 14px; font-weight: 600; color: var(--text-2);
}
.dock-tab:hover { color: var(--text); }
.dock-tab[aria-selected="true"] { color: var(--text); background: var(--bg4); box-shadow: inset 0 0 0 1px var(--line-3); }
.spark { width: 150px; height: 30px; flex: none; overflow: visible; }
.dock-summary {
  flex: 1; min-width: 0; margin: 0;
  font-family: var(--mono); font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dock-summary strong { color: var(--text); font-weight: 600; }
.dock-toggle {
  display: inline-flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 8px; background: transparent;
  font-size: 14px; font-weight: 600; color: var(--text-2);
}
.dock-toggle:hover { border-color: var(--line-3); color: var(--text); }
.chev { width: 7px; height: 7px; border-left: 1.5px solid currentColor; border-top: 1.5px solid currentColor; transform: translateY(2px) rotate(45deg); transition: transform 0.25s var(--ease); }
.dock-toggle[aria-expanded="true"] .chev { transform: translateY(-2px) rotate(225deg); }

.dock-body { padding: 4px 20px 14px; max-height: min(36vh, 340px); overflow-y: auto; animation: rise 0.45s var(--ease) both; scrollbar-width: thin; scrollbar-color: var(--line-3) transparent; }

.weg-curve { display: block; width: 100%; height: 96px; overflow: visible; }
.weg-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.weg-list:empty::before { content: "Noch kein Versuch — der Weg beginnt mit deinem ersten Wort."; color: var(--muted); font-size: 14.5px; }
.weg-chip {
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 5px 11px 6px 10px; border-radius: 6px;
  border: 1px solid var(--line-2); border-left: 3px solid var(--heat, var(--line-2));
  background: var(--bg2); font-size: 15px;
}
.weg-chip:hover, .weg-chip.is-active { border-color: var(--line-3); border-left-color: var(--heat); background: var(--bg3); }
.weg-chip .c-nr { font-family: var(--mono); color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.weg-chip .c-word { font-weight: 560; }
.weg-chip .c-rank { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.weg-chip .c-pred { font-size: 14px; font-weight: 700; }
.c-pred.is-hit { color: var(--accent); }
.c-pred.is-miss { color: var(--miss); }

/* Auflösung */
.reveal { display: grid; grid-template-columns: 1.05fr 1fr 1fr; gap: 12px 36px; padding-top: 6px; }
.reveal-col { min-width: 0; }
.reveal-word {
  margin: 4px 0 6px;
  font-size: 40px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.05;
  color: var(--heat-4);
  text-shadow: 0 0 24px rgba(255, 62, 77, 0.35);
}
.reveal-word:focus { outline: none; }
.reveal-summary { margin: 0 0 10px; color: var(--text-2); font-size: 15px; }
.why-btn { display: inline-block; margin: -4px 0 8px; font-size: 14px; }
.why-btn[aria-expanded="true"] { text-decoration: underline; }
.reveal-why {
  margin: 0 0 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px;
  background: rgba(196, 219, 241, 0.03);
  color: var(--text-2); font-size: 14px; line-height: 1.45;
  overflow-wrap: break-word;
}
.reveal-why p { margin: 0 0 8px; }
.reveal-why p:last-child { margin-bottom: 0; }
.reveal-why .why-title { color: var(--text); }
.reveal-why .why-src { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.reveal-why .why-note { color: var(--muted); font-size: 12.5px; }
.key-sentence {
  margin: 0 0 12px; padding: 8px 12px;
  border-left: 2px solid var(--cyan);
  background: rgba(123, 196, 255, 0.06);
  border-radius: 0 8px 8px 0;
  color: var(--text); font-size: 14.5px;
}
.reveal-sub { margin: 2px 0 8px; font-size: 15.5px; font-weight: 600; }
.list-head {
  display: grid; grid-template-columns: 1fr 64px 64px; gap: 10px;
  padding: 0 0 4px; border-bottom: 1px solid var(--line-2);
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted);
}
.list-head span:not(:first-child) { text-align: right; }
.neighbor-list, .field-list { margin: 0; padding: 0; list-style: none; font-size: 14.5px; line-height: 1.35; }
.neighbor-list li {
  display: grid; grid-template-columns: 1fr 64px 64px; gap: 10px; align-items: baseline;
  padding: 2px 0 3px; border-bottom: 1px solid var(--line);
}
.neighbor-list .n-sym { font-weight: 700; margin-right: 7px; }
.neighbor-list .n-done { margin-left: 7px; color: var(--accent); font-family: var(--mono); font-size: 12px; }
.neighbor-list .n-rank, .neighbor-list .n-cos, .field-list .f-val { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; }
.field-list { margin-top: 10px; }
.field-list li {
  display: grid; grid-template-columns: minmax(0, 1fr) 72px 64px; gap: 10px; align-items: center;
  padding: 3px 0 4px; border-bottom: 1px solid var(--line);
}
.field-list .f-bar { height: 2px; background: var(--line-2); overflow: hidden; }
.field-list .f-bar span { display: block; height: 100%; }
.field-list .f-mine { margin-left: 7px; color: var(--muted); font-family: var(--mono); font-size: 12px; }

.check { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 15px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--cyan); }
.check input:disabled + span { opacity: 0.5; }
.fineprint { margin: 5px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.fineprint--seal { margin: 0 0 10px; font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.fineprint:empty { display: none; }

/* ------------------------------------------------------------
   Tutor-Chat
   ------------------------------------------------------------ */

.chat {
  container-type: inline-size;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0; min-height: 0;
  overflow: hidden;
}

.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px 12px; border-bottom: 1px solid var(--line); }
.chat-avatar {
  display: grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 8px;
  border: 1px solid rgba(123, 196, 255, 0.45);
  background: rgba(123, 196, 255, 0.07);
  color: var(--cyan); font-family: var(--mono); font-size: 16px; font-weight: 600;
}
.chat-head-text { min-width: 0; }
.chat-title { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.chat-sub { margin: 0 0 0 auto; align-self: flex-end; font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }

.chat-log {
  display: flex; flex-direction: column; gap: 12px;
  padding: 18px;
  overflow-y: auto;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--line-3) transparent;
}
.chat-log:focus-visible { outline-offset: -3px; }

.msg { max-width: 94%; animation: msg-in 0.4s var(--ease) both; }
.msg-meta { display: block; margin: 0 2px 4px 0; font-family: var(--mono); color: var(--muted); font-size: 12px; }
.msg-body { overflow-wrap: anywhere; }
.msg-body p { margin: 0; }
.msg-body p + p { margin-top: 7px; }
.msg--tutor .msg-body {
  padding: 11px 15px 12px;
  border: 1px solid var(--line);
  border-left: 2px solid rgba(123, 196, 255, 0.6);
  border-radius: 4px 10px 10px 4px;
  background: var(--bg2);
  color: var(--text); font-size: 15.5px;
}
.msg--tutor strong { color: var(--text); font-weight: 650; }
.msg--user { align-self: flex-end; text-align: right; }
.msg--user .msg-body {
  display: inline-block; text-align: left;
  padding: 9px 15px 10px;
  border: 1px solid var(--line-2);
  border-right: 3px solid var(--accent);
  border-radius: 10px 4px 4px 10px;
  background: var(--bg4);
  color: var(--text); font-size: 15.5px;
}
.msg--system { align-self: stretch; max-width: 100%; }
.msg--system .msg-body {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-family: var(--mono); font-size: 12px; text-align: center;
}
.msg--system .msg-body p { flex: 0 1 auto; }
.msg--system .msg-body::before, .msg--system .msg-body::after { content: ""; flex: 1 0 18px; height: 1px; background: var(--line-2); }

/* Ergebniskarte im Chat: Datenreadout */
.result {
  --heat-rgb: 97, 120, 143;
  align-self: stretch; max-width: 100%;
  padding: 11px 14px 12px 16px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(var(--heat-rgb), 0.08), rgba(8, 17, 28, 0.55) 45%);
  box-shadow: inset 3px 0 0 rgb(var(--heat-rgb));
  animation: msg-in 0.5s var(--ease) both;
}
.result-head {
  display: flex; justify-content: space-between; gap: 10px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted);
}
.result-band { color: var(--text-2); }
.result-main { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 6px; }
.result-word { font-size: 20px; font-weight: 600; line-height: 1.2; }
.result-word .r-sym { color: var(--heat-sym); margin-right: 8px; }
.result-rank { text-align: right; line-height: 1; }
.result-rank small { display: block; margin-bottom: 3px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.result-rank b { font-family: var(--mono); font-size: 32px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.bandbar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 10px; }
.bandbar i { display: block; height: 2px; background: var(--line-2); }
.bandbar i.is-on { background: var(--c); }
.bandbar i.is-now { height: 3px; margin-top: -0.5px; box-shadow: 0 0 10px var(--c); }
.bandbar-labels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 4px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.bandbar-labels span.is-now { color: var(--text); }
.result-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; color: var(--text-2); font-size: 14px; }
.result-meta .up { color: var(--heat-2); }
.result-meta .down { color: var(--cyan); }
.result-meta .hit { color: var(--accent); }
.result-meta .miss { color: var(--miss); }

/* Eingabe */
.composer { padding: 12px 16px 14px; border-top: 1px solid var(--line); background: rgba(8, 17, 28, 0.35); }

.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.quick:empty { display: none; }
.quick button {
  padding: 5px 10px; border-radius: 6px;
  border: 1px solid var(--line-2); background: transparent;
  font-size: 14px; color: var(--text-2);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.quick button:hover { background: var(--bg3); border-color: var(--line-3); color: var(--text); }

.predict { display: grid; grid-template-columns: repeat(4, auto); gap: 6px; margin: 0 0 10px; padding: 0; border: 0; min-width: 0; }
.predict-legend {
  display: block; width: 100%; margin: 0 0 6px; padding: 0;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted);
}
.pchip { position: relative; min-width: 0; cursor: pointer; }
.pchip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.pchip span {
  display: flex; align-items: baseline; justify-content: center; gap: 6px;
  padding: 5px 8px; border-radius: 6px;
  border: 1px solid var(--line-2); background: rgba(8, 17, 28, 0.45);
  font-family: var(--mono); font-size: 12.5px; color: var(--text-2); white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.pchip b { color: var(--c); font-family: var(--sans); }
.pchip:hover span { background: var(--bg3); color: var(--text); }
.pchip input:checked + span { border-color: var(--accent); background: rgba(184, 224, 74, 0.1); color: var(--text); box-shadow: inset 0 0 0 1px rgba(184, 224, 74, 0.35); }
.pchip input:focus-visible + span { outline: 2px solid var(--cyan); outline-offset: 2px; }
.predict:disabled { opacity: 0.42; }
/* schmale Chatspalte: Schätzung als 2 × 2 */
@container (max-width: 440px) {
  .predict { grid-template-columns: 1fr 1fr; }
}

.entry { display: flex; align-items: center; gap: 8px; }
.mic {
  position: relative; flex: none;
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 8px;
  border: 1px solid rgba(123, 196, 255, 0.5); background: transparent; color: var(--cyan);
  touch-action: none; user-select: none; -webkit-user-select: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.mic svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.mic:hover { background: rgba(123, 196, 255, 0.08); }
.mic[aria-pressed="true"] { background: rgba(123, 196, 255, 0.18); border-color: var(--cyan); }
.mic[aria-pressed="true"]::after {
  content: ""; position: absolute; inset: -5px; border-radius: 11px;
  border: 1px solid rgba(123, 196, 255, 0.5);
  animation: mic-ring 1.4s ease-out infinite;
}
.mic:disabled { opacity: 0.4; cursor: not-allowed; }

.entry-field { position: relative; flex: 1; min-width: 0; }
#entry {
  width: 100%; height: 44px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg0);
  font-size: 16px; color: var(--text);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
#entry::placeholder { color: var(--muted); }
#entry:hover { border-color: var(--line-3); }
#entry:focus-visible { outline-offset: 1px; border-color: transparent; }
#entry:disabled { opacity: 0.55; cursor: not-allowed; }
#entry[aria-busy="true"] { border-color: rgba(123, 196, 255, 0.45); }
.level {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  display: none; align-items: center; gap: 3px; height: 24px;
  pointer-events: none;
}
.level i { display: block; width: 2px; height: 100%; background: var(--cyan); transform-origin: center; transform: scaleY(0.25); }
.entry-field.is-listening .level { display: flex; }
.entry-field.is-listening #entry { border-color: rgba(123, 196, 255, 0.6); background: rgba(123, 196, 255, 0.06); }
.entry-field.is-listening .level i { animation: level 0.9s ease-in-out infinite alternate; }
.level i:nth-child(2) { animation-delay: -0.15s !important; }
.level i:nth-child(3) { animation-delay: -0.5s !important; }
.level i:nth-child(4) { animation-delay: -0.3s !important; }
.level i:nth-child(5) { animation-delay: -0.75s !important; }
.level i:nth-child(6) { animation-delay: -0.2s !important; }
.level i:nth-child(7) { animation-delay: -0.6s !important; }
.level i:nth-child(8) { animation-delay: -0.4s !important; }
.level i:nth-child(9) { animation-delay: -0.1s !important; }

.send { flex: none; height: 44px; padding: 0 18px; }

.asr-note { margin-top: 8px; font-size: 14.5px; }
.asr-note:empty { display: none; }
.asr-box {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  padding: 8px 12px; border-radius: 8px;
  border: 1px solid rgba(123, 196, 255, 0.3);
  background: rgba(123, 196, 255, 0.07); color: var(--text);
}
.asr-tag { font-family: var(--mono); font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--cyan); }
.asr-box button { padding: 3px 12px; border-radius: 6px; border: 1px solid var(--cyan); background: transparent; color: var(--cyan); font-weight: 600; }
.asr-box button:hover { background: rgba(123, 196, 255, 0.12); }
.asr-box button[aria-pressed="true"] { background: rgba(123, 196, 255, 0.18); }
.asr-privacy { flex-basis: 100%; color: var(--muted); font-size: 13px; }

.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.tool {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 12px; border-radius: 8px;
  border: 1px solid var(--line-2); background: transparent;
  font-size: 14px; font-weight: 600; color: var(--text-2);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.tool:hover:not(:disabled) { background: var(--bg3); border-color: var(--line-3); color: var(--text); }
.tool:disabled { opacity: 0.42; cursor: not-allowed; }
.count {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 4px; background: var(--bg4); color: var(--text);
  font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums;
}
.tools-hint { margin: 0 0 0 auto; font-family: var(--mono); color: var(--muted); font-size: 12px; }
.tools-vocab { margin: 0; font-family: var(--mono); color: var(--muted); font-size: 12px; }

.noscript { padding: 12px; border: 1px solid var(--heat-3); border-radius: 8px; }

/* Verbindungsmeldung über der Eingabe — ruhig, kein Dialog; genau eine, wird aktualisiert */
.conn {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 12px;
  margin: 0 0 10px; padding: 10px 12px 10px 14px; border-radius: 8px;
  border: 1px solid var(--line-2);
  background: rgba(255, 156, 140, 0.06);
  box-shadow: inset 3px 0 0 var(--miss);
  color: var(--text-2); font-size: 14px; line-height: 1.45;
  animation: msg-in 0.4s var(--ease) both;
}
.conn-text { margin: 0; grid-column: 1 / -1; }
.conn-text strong { color: var(--text); font-weight: 650; }
.conn-text code {
  font-family: var(--mono); font-size: 12px; color: var(--text);
  padding: 1px 6px; border-radius: 4px; background: var(--bg0); overflow-wrap: anywhere;
}
.conn-note { margin: 0; grid-column: 1; grid-row: 2; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.conn-note:empty { visibility: hidden; }
.conn-btn { grid-column: 2; grid-row: 2; white-space: nowrap; }

/* Aktion im Chat (z. B. „Neue Runde“) und „Meintest du …?“-Vorschläge */
.msg-action { margin-top: 10px; }
.msg--system .msg-body:has(.msg-action) { flex-wrap: wrap; }
.msg--system .msg-action { order: 3; display: flex; justify-content: center; flex-basis: 100%; margin-top: 6px; }
.msg-suggest { display: flex; flex-wrap: wrap; gap: 6px; }
.msg-suggest .tool { font-size: 15px; font-weight: 600; color: var(--text); }
.msg-suggest .tool:not(:disabled) { border-color: rgba(184, 224, 74, 0.45); }
.msg-suggest .tool:hover:not(:disabled) { border-color: var(--accent); background: rgba(184, 224, 74, 0.08); }

/* ------------------------------------------------------------
   Einführung: Plexus-Overlay „Semantischer Raum“
   ------------------------------------------------------------ */

body.intro-open, body.lab-open { overflow: hidden; }

.intro {
  position: fixed; inset: 0; z-index: 100;
  overflow: hidden;
  background: radial-gradient(1300px 900px at 68% 46%, #10233B 0%, #0B1624 52%, #08111C 100%);
}
.intro::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.5) 55%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.5) 55%, transparent 100%);
}
.intro-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: pan-y; }
.intro-scrim {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(8, 17, 28, 0.94) 0%, rgba(8, 17, 28, 0.82) 26%, rgba(8, 17, 28, 0.35) 40%, rgba(8, 17, 28, 0) 52%);
}
.intro-card {
  position: absolute; left: clamp(28px, 6vw, 112px); top: 50%;
  width: min(560px, calc(100% - 56px));
  transform: translateY(-50%);
}
.intro-brand {
  display: flex; align-items: center; gap: 10px; margin: 0 0 30px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-2);
}
.intro-brand .brand-mark { width: 24px; height: 24px; }
.intro-progress { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.intro-dots { display: inline-flex; gap: 8px; }
.intro-dots i { display: block; width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--line-3); transition: background-color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease; }
.intro-dots i.is-on { background: var(--text-2); border-color: var(--text-2); }
.intro-dots i.is-now { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 3px rgba(184, 224, 74, 0.18), 0 0 12px rgba(184, 224, 74, 0.4); }
.intro-step { font-family: var(--mono); font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); font-variant-numeric: tabular-nums; }
.intro-title { margin: 0 0 14px; font-size: 34px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.18; text-wrap: balance; }
.intro-text { margin: 0; color: var(--text-2); font-size: 17px; line-height: 1.6; max-width: 34em; }
.intro-copy.is-new { animation: copy-in 0.6s var(--ease) both; }
.intro-note {
  margin: 26px 0 0; padding-left: 14px;
  border-left: 1px solid var(--line-3);
  color: var(--muted); font-size: 14px; line-height: 1.5;
}
.intro-actions { display: flex; align-items: center; gap: 22px; margin-top: 30px; }
.intro-actions .btn { min-width: 132px; height: 44px; font-size: 15px; }

/* ------------------------------------------------------------
   Vektor-Labor
   ------------------------------------------------------------ */

.lab {
  position: fixed; inset: 0; z-index: 90;
  display: grid; place-items: center;
  padding: 28px;
  background: rgba(5, 10, 17, 0.78);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  animation: fade-in 0.25s ease both;
}
.lab-sheet {
  width: min(1180px, 100%);
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 22px 26px 18px;
  background: linear-gradient(180deg, var(--bg3), var(--bg2) 60%);
  border-color: var(--line-2);
  box-shadow: var(--shadow-pop);
  scrollbar-width: thin; scrollbar-color: var(--line-3) transparent;
  animation: rise 0.35s var(--ease) both;
}
.lab-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.lab-title { margin: 4px 0 2px; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.lab-sub { margin: 0; color: var(--text-2); font-size: 15px; }
.lab-round-note {
  display: inline-block; margin: 8px 0 0; padding: 3px 10px;
  border: 1px solid rgba(123, 196, 255, 0.4); border-radius: 6px;
  background: rgba(123, 196, 255, 0.07);
  font-family: var(--mono); font-size: 12px; color: var(--cyan);
}
.lab-tabs { margin: 16px 0 14px; }
.lab-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.lab-form { display: flex; gap: 8px; }
.lab-input {
  height: 44px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg0);
  font-size: 16px; color: var(--text);
}
.lab-input::placeholder { color: var(--muted); }
.lab-input:hover { border-color: var(--line-3); }
.lab-input:focus-visible { outline-offset: 1px; border-color: transparent; }
.lab-form .lab-input { width: 320px; }
.lab-form .btn, .lab-analogy .btn { height: 44px; }
.lab-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lab-chips button {
  padding: 5px 10px; border-radius: 6px;
  border: 1px solid var(--line-2); background: rgba(8, 17, 28, 0.45);
  font-family: var(--mono); font-size: 12.5px; color: var(--text-2);
}
.lab-chips button:hover { background: var(--bg3); border-color: var(--line-3); color: var(--text); }
.lab-chips button[aria-pressed="true"] { border-color: var(--line-3); color: var(--text); background: var(--bg4); }
.lab-msg { min-height: 1.4em; margin: 12px 0 4px; font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.lab-msg.is-error { color: var(--miss); }
.lab-trail-row { display: flex; align-items: center; gap: 14px; min-height: 30px; }
.lab-trail { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.lab-trail button {
  padding: 2px 4px; border: 0; border-bottom: 1px solid transparent; background: none;
  font-family: var(--mono); font-size: 12.5px; color: var(--text-2);
}
.lab-trail button:hover { color: var(--text); border-bottom-color: var(--line-3); }
.lab-trail button[aria-current="step"] { color: var(--text); border-bottom-color: var(--accent); cursor: default; }
.lab-trail .sep { color: var(--muted); font-family: var(--mono); font-size: 12px; }

.lab-nb-result { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); gap: 26px; margin-top: 8px; }
.lab-scene {
  position: relative;
  border: 1px solid var(--line); border-radius: 10px;
  background:
    radial-gradient(closest-side, rgba(123, 196, 255, 0.05), transparent),
    rgba(8, 17, 28, 0.55);
  overflow: hidden;
}
.lab-scene::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(140, 175, 210, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(140, 175, 210, 0.045) 1px, transparent 1px);
  background-size: 32px 32px;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
}
.lab-svg { position: relative; display: block; width: 100%; height: auto; max-height: 470px; }
.lv-link { stroke: rgba(169, 187, 206, 0.34); stroke-width: 1; }
.lv-halo { opacity: 0.16; }
.lv-node { cursor: pointer; }
.lv-node:hover .lv-word { fill: var(--accent); }
.lv-node:hover .lv-core { stroke: var(--accent); stroke-width: 1.5; }
.lv-word { fill: var(--text); font-family: var(--sans); font-weight: 500; }
.lv-val { fill: var(--muted); font-family: var(--mono); font-size: 12.5px; }
.lv-center-ring { fill: rgba(8, 17, 28, 0.85); stroke: var(--accent); stroke-width: 1; }
.lv-center-glow { fill: rgba(184, 224, 74, 0.1); }
.lv-center { fill: var(--text); font-family: var(--sans); font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
.lv-center-kick { fill: var(--muted); font-family: var(--mono); font-size: 12px; letter-spacing: 0.07em; }
.lv-new { animation: fade-in 0.5s ease both; }

.lab-side { min-width: 0; }
.lab-h3 { margin: 2px 0 8px; font-size: 16px; font-weight: 600; }
.lab-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line-2); }
.lab-list li { border-bottom: 1px solid var(--line); }
.lab-list button {
  display: grid; grid-template-columns: minmax(0, 1fr) 90px 48px; align-items: center; gap: 12px;
  width: 100%; padding: 8px 6px 8px 4px; border: 0; background: none; text-align: left;
  border-radius: 4px;
}
.lab-list button:hover { background: var(--bg3); }
.lab-list button:hover .w { color: var(--accent); }
.lab-list .w { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lab-list .w small { margin-left: 6px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.lab-list .bar, .lab-cands .bar { display: block; height: 2px; background: var(--line-2); }
.lab-list .bar i, .lab-cands .bar i { display: block; height: 100%; }
.lab-list .v, .lab-cands .v { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; }
.lab-note { margin: 12px 0 0; color: var(--muted); font-size: 14px; }

.lab-analogy { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.lab-term { display: flex; align-items: center; gap: 8px; }
.lab-term-key {
  display: grid; place-items: center; width: 26px; height: 26px;
  border: 1px solid var(--line-3); border-radius: 6px;
  font-family: var(--mono); font-size: 12.5px; color: var(--text-2);
}
.lab-term .lab-input { width: 168px; }
.lab-op { font-family: var(--mono); font-size: 18px; color: var(--muted); }
.lab-panel#lab-panel-an .lab-chips { margin-top: 12px; }
.lab-an-result { margin-top: 10px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px; background: rgba(8, 17, 28, 0.5); }
.lab-formula { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 24px; margin: 0 0 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.lab-formula .f-q { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.lab-formula .f-calc { font-family: var(--mono); font-size: 14px; color: var(--text-2); }
.lab-formula .f-calc .op { color: var(--cyan); }
.list-head--cands { grid-template-columns: 34px minmax(0, 1fr) minmax(120px, 260px) 56px; }
.list-head--cands span:nth-child(2), .list-head--cands span:nth-child(3) { text-align: left; }
.lab-cands { margin: 0; padding: 0; list-style: none; }
.lab-cands li {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) minmax(120px, 260px) 56px; align-items: center; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--line);
}
.lab-cands .n { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.lab-cands .w { font-size: 15.5px; }
.lab-cands li.is-top .w { font-size: 18px; font-weight: 600; }
.lab-foot { margin: 18px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------
   Rechtliche Seiten: Impressum, Datenschutz, Lizenzen (statisch, ohne JS)
   ------------------------------------------------------------ */

.legal {
  max-width: 760px; margin: 0 auto; padding: 28px 22px 56px;
  font-size: 16.5px; line-height: 1.65; color: var(--text-2);
}
.legal-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 18px; margin-bottom: 26px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.legal-head .brand { color: var(--text); text-decoration: none; }
.legal-head .brand-name { font-size: 18px; }
.legal h1 { margin: 6px 0 10px; font-size: 32px; font-weight: 650; line-height: 1.2; letter-spacing: -0.01em; color: var(--text); }
.legal h2 { margin: 34px 0 10px; font-size: 21px; font-weight: 650; line-height: 1.3; color: var(--text); }
.legal h3 { margin: 22px 0 6px; font-size: 17px; font-weight: 650; color: var(--text); }
.legal p, .legal ul, .legal ol, .legal dl { margin: 0 0 12px; }
.legal ul, .legal ol { padding-left: 22px; }
.legal li + li { margin-top: 6px; }
.legal strong { color: var(--text); }
.legal code { font-family: var(--mono); font-size: 0.88em; color: var(--text); overflow-wrap: anywhere; }
.legal address { font-style: normal; margin: 0 0 12px; color: var(--text); }
.legal a { color: var(--cyan); text-underline-offset: 3px; text-decoration-thickness: 1px; overflow-wrap: anywhere; }
.legal a:hover { color: var(--text); }
.legal a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 2px; }
.legal-stand { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.legal-draft {
  margin: 0 0 22px; padding: 12px 16px;
  border: 1px solid rgba(238, 138, 60, 0.6); border-left: 3px solid var(--heat-2); border-radius: 8px;
  background: rgba(238, 138, 60, 0.08); color: var(--text);
}
.legal-short {
  margin: 0 0 8px; padding: 16px 18px 6px;
  border: 1px solid var(--line-3); border-left: 3px solid var(--accent); border-radius: 10px;
  background: var(--panel-fill); color: var(--text);
}
.legal-short h2 { margin-top: 0; }
.legal-short li { font-size: 17px; }
.legal-table { width: 100%; margin: 0 0 14px; border-collapse: collapse; font-size: 15px; }
.legal-table th, .legal-table td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.legal-table th { color: var(--text); font-weight: 650; }
.legal-nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 34px; padding-top: 14px; border-top: 1px solid var(--line); font-size: 15px; }
.legal-back { font-weight: 650; }

@media (max-width: 600px) {
  .legal { padding: 18px 16px 40px; font-size: 16px; }
  .legal h1 { font-size: 26px; }
  .legal h2 { font-size: 19px; }
  .legal-table { display: block; overflow-x: auto; }
}

/* ------------------------------------------------------------
   Animationen — ruhig, einmalig; Dauer nur für das Atmen des Siegels
   ------------------------------------------------------------ */

@keyframes land { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(var(--heat-rgb), 0.6); }
  40% { box-shadow: 0 0 0 6px rgba(var(--heat-rgb), 0.2), 0 0 30px rgba(var(--heat-rgb), 0.45); }
  100% { box-shadow: 0 0 0 0 rgba(var(--heat-rgb), 0); }
}
@keyframes island-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes seal-open { 0% { transform: var(--seal-pos) scale(0.94); } 60% { transform: var(--seal-pos) scale(1.02); } 100% { transform: var(--seal-pos) scale(1); } }
@keyframes seal-breathe { from { opacity: 0.45; } to { opacity: 1; } }
@keyframes wave { 0% { opacity: 0; transform: scale(0.05); } 30% { opacity: 1; } 100% { opacity: 1; transform: scale(1); } }
@keyframes thread { 0% { opacity: 0; stroke-dasharray: 0 2000; } 25% { opacity: 0.85; } 60% { opacity: 0.7; stroke-dasharray: 2000 0; } 100% { opacity: 0; stroke-dasharray: 2000 0; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes copy-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes mic-ring { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(1.18); } }
@keyframes level { from { transform: scaleY(0.2); } to { transform: scaleY(1); } }

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-delay: 0s !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}
body.reduce-motion .seal::after { opacity: 0.8; }
body.reduce-motion .entry-field.is-listening .level i { transform: scaleY(0.6); }
body.reduce-motion .entry-field.is-listening .level i:nth-child(odd) { transform: scaleY(0.9); }

body.is-hidden *,
body.is-hidden *::before,
body.is-hidden *::after { animation-play-state: paused !important; }

/* ------------------------------------------------------------
   Großer Bildschirm: App füllt den Viewport
   ------------------------------------------------------------ */

@media (min-width: 901px) and (min-height: 640px) {
  .app { height: 100vh; }
  .layout { overflow: hidden; }
}

.data-inline { display: none; }

@media (max-width: 1440px) {
  .data-chip { display: none; }
  .stage-sub .data-inline { display: inline; }
}

@media (max-width: 1200px) {
  .topbar { gap: 8px 18px; padding: 10px 18px; }
  .layout { grid-template-columns: minmax(0, 1fr) 350px; gap: 14px; padding: 14px 14px 14px; }
  .reveal { grid-template-columns: 1fr 1fr; }
  .reveal-col--head { grid-column: 1 / -1; }
  .reveal-word { font-size: 38px; }
  .progress-track { width: 72px; }
  .tools-hint { display: none; }
  .stage-head { padding: 14px 20px 10px; }
  .stage-title { font-size: 26px; }
  .spark { display: none; }
  /* m1: Zusammenfassung bricht in höchstens zwei Zeilen um, statt abgeschnitten zu werden */
  .dock-summary { white-space: normal; line-height: 1.35; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
  .lab-nb-result { grid-template-columns: minmax(0, 1.2fr) minmax(280px, 1fr); gap: 20px; }
  .intro-card { width: min(440px, calc(100% - 56px)); }
  .intro-title { font-size: 30px; }
  .intro-text { font-size: 16px; }
}

@media (max-width: 1100px) {
  .intro-card { left: 40px; width: min(400px, calc(100% - 80px)); }
  .topbar { gap: 8px 14px; }
  .round { gap: 6px 14px; }
  .round-mode, .progress-track, .brand-tag { display: none; }
  .actions { gap: 6px; }
  .btn { padding: 0 12px; }
}

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .stage { min-height: 600px; }
  .map { min-height: 460px; }
  .dock-body { max-height: none; }
  .chat { min-height: 560px; max-height: 92vh; }
  .reveal { grid-template-columns: 1fr; }
  .lab-nb-result { grid-template-columns: minmax(0, 1fr); }
  .lab-svg { max-height: 380px; }
}

@media (max-width: 760px) {
  /* Einführung mobil: Text unten, Konstellation dahinter, Scrim von unten */
  .intro-scrim { background: linear-gradient(0deg, rgba(8, 17, 28, 0.97) 0%, rgba(8, 17, 28, 0.9) 42%, rgba(8, 17, 28, 0.25) 62%, rgba(8, 17, 28, 0) 72%); }
  .intro-card { left: 20px; right: 20px; top: auto; bottom: 22px; width: auto; transform: none; }
  .intro-brand { position: fixed; left: 20px; top: 18px; margin: 0; }
  .intro-title { font-size: 25px; margin-bottom: 10px; }
  .intro-text { font-size: 16px; line-height: 1.55; }
  .intro-note { margin-top: 16px; }
  .intro-actions { margin-top: 18px; justify-content: space-between; }
}

@media (max-width: 600px) {
  /* Kopfzeile in zwei Reihen: Marke · Labor · Hilfe · Einstellungen / Versuche · Auflösen · Nochmal
     (::after erzwingt den Umbruch; Rundenkennung und Siegel-Chip zeigt die Karte bzw. der Status) */
  .topbar { gap: 0 6px; padding: 8px 12px; }
  .topbar::after { content: ""; order: 5; flex-basis: 100%; }
  .actions { display: contents; }
  .brand { order: 1; min-height: 40px; }
  .btn-lab { order: 2; width: 40px; margin-left: auto; padding: 0; }
  .btn-lab-label { display: none; }
  .actions > .pop-wrap { order: 3; }
  .round { order: 6; flex: 1 1 0; flex-wrap: nowrap; min-width: 0; margin-top: 6px; }
  .round-title, .seal-chip { display: none; }
  .progress { min-width: 0; font-size: 14px; }
  .progress-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #btn-giveup, #btn-reset { order: 7; flex: none; margin-top: 6px; padding: 0 12px; font-size: 14px; }
  .popover { position: fixed; left: 12px; right: 12px; top: 56px; width: auto; max-width: none; max-height: calc(100vh - 72px); max-height: calc(100dvh - 72px); overflow-y: auto; }
  .layout { padding: 12px 10px 14px; gap: 12px; }
  .stage { min-height: 560px; }
  /* Bühnenkopf kompakt: Titel und Hinweis „keine Distanzkarte“ bleiben, Kicker und Datenhinweis entfallen */
  .stage-head { padding: 6px 12px 7px; }
  .stage-head .kicker { display: none; }
  .stage-title { margin: 0; font-size: 18px; line-height: 1.25; }
  .stage-sub { margin-top: 1px; font-size: 12.5px; line-height: 1.35; }
  .sub-lead, .stage-sub .data-inline { display: none; }
  .token { gap: 6px; padding: 5px 9px 6px 8px; font-size: 14.5px; }
  .token--neighbor:not(.token--path) { gap: 5px; padding: 4px 8px 5px 7px; font-size: 13.5px; }
  .seal { width: 184px; padding: 12px 14px 13px; }
  .seal-word { font-size: 16px; }
  .seal.is-open .seal-word { font-size: 30px; }
  .island-label { left: 6px; }
  /* Streifen-Leiste einzeilig: Tabs · Zusammenfassung (gekürzt) · Aufklappen */
  .dock-bar { flex-wrap: nowrap; gap: 8px; min-height: 0; padding: 1px 8px; }
  .dock-tabs { flex: none; padding: 2px; }
  .dock-tab { padding: 0 10px; font-size: 13.5px; }
  .dock-summary { display: block; flex: 1 1 0; font-size: 12px; white-space: nowrap; }
  .dock-toggle { flex: none; justify-content: center; min-width: 40px; margin-left: auto; gap: 8px; padding: 0 10px; font-size: 13.5px; }
  /* nach der Auflösung zwei Tabs: Zusammenfassung weicht, „Aufklappen/Einklappen“ nur als Pfeil (Name bleibt für Screenreader) */
  .dock-bar:has(#tab-reveal:not([hidden])) .dock-summary { display: none; }
  .dock-bar:has(#tab-reveal:not([hidden])) #dock-toggle-label {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .dock-body { padding: 4px 14px 14px; }
  .reveal-word { font-size: 34px; }
  /* Chat kompakt */
  .chat-head { gap: 10px; padding: 6px 12px; }
  .chat-head .kicker { display: none; }
  .chat-avatar { width: 30px; height: 30px; font-size: 14px; }
  .chat-title { font-size: 17px; }
  .chat-sub { align-self: center; }
  .chat-log { gap: 10px; padding: 10px 12px; }
  .msg--tutor .msg-body { padding: 9px 12px 10px; font-size: 15px; }
  .msg--user .msg-body { padding: 8px 12px 9px; font-size: 15px; }
  .result { padding: 9px 12px 10px 14px; }
  .result-main { margin-top: 4px; }
  .result-word { font-size: 18px; }
  .result-rank b { font-size: 26px; }
  .bandbar { margin-top: 8px; }
  /* Eingabe kompakt: Schnellfragen (horizontal scrollbar) und Sonde in einer Reihe,
     darunter die vier Schätz-Bänder in einer Zeile, darunter Mikrofon · Eingabe · Senden */
  .composer { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; padding: 8px 10px 10px; }
  .conn, .predict, .entry, .asr-note { flex: 0 0 100%; }
  .conn { order: 0; }
  .quick { order: 1; flex: 1 1 0; flex-wrap: nowrap; min-width: 0; margin: 0; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  .quick::-webkit-scrollbar { display: none; }
  .quick button { flex: none; padding: 0 10px; white-space: nowrap; }
  .tools { order: 2; flex: none; flex-wrap: nowrap; gap: 6px; margin: 0 0 0 auto; }
  .tools-vocab, .tools-hint { display: none; }
  .predict { order: 3; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 6px 0 0; }
  .predict-legend { margin-bottom: 4px; }
  /* Band-Chips als Tabellenzelle: Symbol und Text fließen gemeinsam, höchstens zwei Zeilen, mittig */
  .pchip { display: table; width: 100%; table-layout: fixed; }
  .pchip span { display: table-cell; width: 100%; height: 40px; padding: 2px 4px; vertical-align: middle; font-size: 12px; line-height: 1.15; white-space: normal; text-align: center; }
  .pchip b { margin-right: 4px; }
  .entry { order: 4; margin-top: 8px; }
  .asr-note { order: 5; }
  .send { padding: 0 14px; }
  .lab { padding: 0; place-items: stretch; }
  .lab-sheet { max-height: none; height: 100%; border-radius: 0; padding: 16px 14px 14px; }
  .lab-form { flex: 1 1 100%; }
  .lab-form .lab-input { flex: 1; width: auto; min-width: 0; }
  .lab-term .lab-input { width: calc(100vw - 110px); }
  .lab-op { display: none; }
  .lab-list button { grid-template-columns: minmax(0, 1fr) 60px 44px; }
  .list-head--cands, .lab-cands li { grid-template-columns: 26px minmax(0, 1fr) 54px 48px; }
}

/* Touch- und Tablet-Breiten: Bedienelemente mindestens 40 px hoch, primäre 44 px */
@media (max-width: 1100px), (pointer: coarse) {
  .icon-btn { width: 44px; height: 44px; }
  .btn { height: 44px; }
  .tool { height: 44px; }
  .dock-toggle { height: 44px; }
  .dock-tab { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; }
  .seg { display: inline-flex; align-items: center; min-height: 40px; }
  .quick button { min-height: 40px; }
  .pchip span { align-items: center; min-height: 40px; }
  .lab-chips button, .asr-box button { min-height: 40px; }
  .lab-trail button { min-height: 40px; }
  .text-btn { min-height: 40px; }
  .weg-chip { min-height: 40px; align-items: center; }
  .check { min-height: 40px; }
}

/* ------------------------------------------------------------
   Mobile App-Hülle (≤ 900 px breit, ab 661 px hoch — Smartphones und Tablets hochkant)
   Die App füllt genau den sichtbaren Viewport, die Seite selbst scrollt nicht: Kopfzeile,
   darunter Karte und Chat. Intern scrollen nur der Chatverlauf, der aufgeklappte Streifen
   und — wenn viele Felder entdeckt sind — die Bühne mit der Karte. Eingabe, Senden und
   Sonde bleiben immer im ersten Viewport.
   Fallback für kleine Höhen (≤ 660 px, z. B. 360 × 640 oder Querformat): Es gilt der Block
   „max-width: 900px“ weiter oben — die Seite scrollt, Mindesthöhen wie bisher; alle
   Bedienelemente bleiben erreichbar (nichts ist versteckt oder abgeschnitten).
   ------------------------------------------------------------ */

@media (max-width: 900px) and (min-height: 661px) {
  body { min-height: 100vh; min-height: 100dvh; }
  .app { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(240px, 1fr) minmax(0, 1fr);
    gap: 10px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
    min-height: 0;
    overflow: hidden;
  }
  /* Bühne: Kopf, Karte, Streifen untereinander; braucht die Karte mehr Höhe, scrollt nur die Bühne */
  .stage {
    display: flex; flex-direction: column;
    min-height: 0;
    overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: var(--line-3) transparent;
  }
  .stage-head { flex: none; }
  .map { flex: 1 0 auto; min-height: 120px; }
  /* Streifen: Leiste klebt am unteren Bühnenrand, der Inhalt klappt über der Karte auf (eigener Scroll) */
  .dock { flex: none; position: sticky; bottom: 0; background: #0E1C2D; }
  .dock-body {
    position: absolute; left: 0; right: 0; bottom: 100%;
    max-height: var(--dock-room, 40vh);
    border-top: 1px solid var(--line-2);
    background: #0E1C2D;
    box-shadow: 0 -18px 40px -24px rgba(0, 0, 0, 0.8);
  }
  /* Chat: Kopf und Eingabe fest, nur der Verlauf scrollt; wird es sehr eng (z. B. Verbindungsbanner),
     gibt erst der Verlauf Platz ab, dann scrollt die Eingabe selbst — nichts wird abgeschnitten */
  .chat { display: flex; flex-direction: column; min-height: 0; max-height: none; overflow: hidden; }
  .chat-head { flex: none; }
  .chat-log { flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .composer { flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
}

@media (max-width: 600px) and (min-height: 661px) {
  .layout { grid-template-rows: minmax(220px, 38%) minmax(0, 1fr); gap: 8px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .map-empty { top: auto; bottom: 8px; }
}

/* Smartphone: kompakte Bedienelemente — weiterhin mindestens 40 px hoch (Eingabezeile 44 px) */
@media (max-width: 600px) {
  .topbar .icon-btn { width: 40px; height: 40px; }
  .topbar .btn { height: 40px; }
  .dock-toggle { height: 40px; }
  .tools .tool { height: 40px; padding: 0 10px; }
}

@media (forced-colors: active) {
  .token, .pchip span, .btn, .tool, .mic, .icon-btn, .seal, .island { border: 1px solid CanvasText; }
}
