/* ===== Brain-Resonance · accessible UI ===== */
:root {
  --bg: #f4f7f9;
  --surface: #ffffff;
  --text: #1a2b33;
  --muted: #5a6f7a;
  --primary: #1a5f7a;
  --primary-dark: #134a5f;
  --accent: #57c5b6;
  --success: #2d8a4e;
  --warning: #c47b1a;
  --danger: #b33a3a;
  --border: #d5e0e6;
  --shadow: 0 4px 18px rgba(26, 95, 122, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --touch: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 18px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

button, input, select { font: inherit; color: inherit; }

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

/* 40 Hz overlay — opacity driven by light40hz.js (rAF square wave @ 40 Hz).
   CSS animation is only a no-JS fallback; JS sets animation:none when active. */
.light-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000; /* above app content, below modals (10000) */
  pointer-events: none;
  background: #fff;
  opacity: 0;
  display: none;
  will-change: opacity;
}

.light-overlay.active {
  display: block;
  /* Fallback if JS fails: intended 40 Hz (25 ms period), 50 % duty */
  animation: flicker40 25ms steps(1, end) infinite;
}

@keyframes flicker40 {
  0%,
  49.999% {
    opacity: 0.32;
  }
  50%,
  100% {
    opacity: 0;
  }
}

/*
 * Light session (40 Hz): cool near-white underlay — NOT Family cream.
 * Cream (--bg #efe9dd) + white overlay @ low opacity killed flicker contrast.
 * Games stay near-white with stronger edge contrast so tiles remain readable.
 */
body.light-on,
body.light-on .app {
  position: relative;
  z-index: 1;
  background: #f4f7f9;
}

body.light-on .game-area,
body.light-on #view-play,
body.light-on .play-shell,
body.light-on .play-board,
body.light-on .modal-card {
  background: #fafcfd;
  position: relative;
  z-index: 2;
}

body.light-on .game-btn,
body.light-on .memory-tile {
  /* stronger edge so higher flash opacity does not wash tile affordance */
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(51, 41, 28, 0.08);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 30, 40, 0.55);
}

.modal.hidden,
.modal[hidden] {
  display: none !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.modal-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px 24px;
  max-width: 520px;
  width: 100%;
  box-shadow: var(--shadow);
}

.modal-card h2 { margin: 0 0 12px; font-size: 1.5rem; color: var(--primary); }
.modal-card p { margin: 0 0 12px; color: var(--muted); }
.warning-note {
  background: #fff6e8;
  border-left: 4px solid var(--warning);
  padding: 12px 14px;
  border-radius: 8px;
  color: var(--text) !important;
}

/* App shell — wider on tablets (aligned with SGA portal ~1320–1600).
   Left padding kept modest so brand (Gehirn-Logo + Titel) sitzt klar links oben. */
.app {
  max-width: min(1320px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(10px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  width: 100%;
  box-sizing: border-box;
}

@media (min-width: 1024px) {
  .app {
    max-width: min(1440px, 100%);
    padding-left: max(16px, env(safe-area-inset-left, 0px));
    padding-right: 24px;
  }
}

@media (min-width: 1366px) {
  .app {
    max-width: min(1600px, 100%);
    padding-left: max(20px, env(safe-area-inset-left, 0px));
    padding-right: 28px;
  }
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  width: 100%;
  flex-wrap: wrap;
}

/* Brand: Logo ganz links oben, Überschrift eng daneben nach links */
.brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  text-align: left;
  margin: 0;
  padding: 0;
}

.brand-logo-link {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  text-decoration: none;
  line-height: 0;
}

.brand-logo {
  display: block;
  height: clamp(36px, 5.5vw, 48px);
  width: auto;
  max-width: min(240px, 42vw);
  object-fit: contain;
  object-position: left center;
}

/* Legacy text brand (kept for older CSS hooks) */
.brand--with-intro {
  align-items: flex-start;
}
.brand-head {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0;
  min-width: 0;
}
.brand-intro {
  display: none !important; /* long marketing line removed from app chrome */
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  margin-left: auto;
  position: relative;
  z-index: 6;
}

/* Path switch: Privat ↔ Einrichtung (test + staff) */
.btn-path-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--touch, 44px);
  min-width: var(--touch, 44px);
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  flex-shrink: 0;
}
.btn-path-toggle:hover,
.btn-path-toggle:focus-visible {
  border-color: var(--primary);
  background: #eef7f6;
  outline: none;
}
.btn-path-toggle[aria-pressed="true"] {
  border-color: var(--primary);
  background: #e0f2f0;
  box-shadow: 0 0 0 2px rgba(20, 120, 130, 0.2);
}
.btn-path-icon {
  font-size: 1.2rem;
  line-height: 1;
}
.btn-path-label {
  white-space: nowrap;
}
body.path-facility .facility-card {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  box-shadow: 0 4px 16px rgba(20, 120, 130, 0.12);
}
body.path-facility .brand-intro {
  /* keep readable; optional subtle badge via ::after not needed */
}
@media (max-width: 700px) {
  .btn-path-label {
    display: none;
  }
  .btn-path-toggle {
    padding: 8px 10px;
  }
}

/* Network / offline mode status strip */
.offline-banner {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 8px 14px;
  box-sizing: border-box;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #7c2d12;
  background: linear-gradient(90deg, #ffedd5 0%, #fde68a 50%, #ffedd5 100%);
  border-bottom: 2px solid #d97706;
  z-index: 40;
  position: sticky;
  top: 0;
}
.offline-banner.is-visible {
  display: flex;
}
.offline-banner.is-ready {
  color: #14532d;
  background: linear-gradient(90deg, #dcfce7 0%, #bbf7d0 50%, #dcfce7 100%);
  border-bottom-color: #15803d;
}
.offline-banner-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d97706;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.25);
}
.offline-banner.is-ready .offline-banner-dot {
  background: #15803d;
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.25);
}

/* Sleep timer under mixer */
.sleep-timer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 10px;
  width: 100%;
}
.sleep-timer-label {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
}
.sleep-timer-select {
  min-width: 7rem;
  max-width: 10rem;
}
.sleep-timer-status {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
}
.sleep-timer-cancel {
  min-height: 36px !important;
  padding: 6px 12px !important;
  font-size: 0.85rem !important;
}

/* Lesson course / Superlearning */
.lesson-course-panel {
  margin-top: 18px;
}
.lesson-upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.lesson-upload-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.lesson-upload-btn--sm {
  min-height: 40px !important;
  padding: 6px 10px !important;
  font-size: 0.85rem !important;
}
.lesson-upload-icon {
  font-size: 1.25rem;
  line-height: 1;
}
.lesson-player-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  margin-bottom: 10px;
}
.lesson-track-meta {
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}
.lesson-transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.lesson-t-btn {
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  font-size: 1.1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  touch-action: manipulation;
}
.lesson-t-play {
  min-width: 52px;
}
.lesson-loop-btn.is-active {
  border-color: var(--primary);
  background: #e0f2f0;
  box-shadow: 0 0 0 2px rgba(20, 120, 130, 0.15);
}
.lesson-week-info {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.lesson-upload-progress {
  margin: 6px 0 0;
  font-weight: 700;
  color: var(--primary);
}
.lesson-track-list {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  max-height: 160px;
  overflow: auto;
  font-size: 0.88rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.lesson-track-list li {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}
.lesson-track-list li:last-child {
  border-bottom: none;
}
.lesson-track-list li.is-current {
  background: #eef7f6;
  color: var(--primary);
  font-weight: 700;
}

/* Offline top-nav: 3 clear visual states (idle | loading | ready) */
.btn-offline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch, 44px);
  min-width: 4.5rem;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  touch-action: manipulation;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
/* 1 — Offline inaktiv (Modus aus; Daten können trotzdem gespeichert sein) */
.btn-offline[data-offline-state="idle"] {
  border: 3px solid #8a96a3;
  background: #f0f3f5;
  color: #4a5560;
  box-shadow: none;
}
.btn-offline[data-offline-state="idle"]:hover,
.btn-offline[data-offline-state="idle"]:focus-visible {
  border-color: #5c6b78;
  background: #e4e9ed;
  outline: none;
}
/* 2 — Daten werden geladen */
.btn-offline[data-offline-state="loading"] {
  border: 3px solid #d97706;
  background: #fff7ed;
  color: #9a3412;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.28);
  cursor: wait;
  animation: offline-pulse 1.1s ease-in-out infinite;
}
/* 3 — Offline aktiv, Paket vollständig */
.btn-offline[data-offline-state="ready"] {
  border: 3px solid #15803d;
  background: #dcfce7;
  color: #14532d;
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.25);
}
.btn-offline[data-offline-state="ready"]:hover,
.btn-offline[data-offline-state="ready"]:focus-visible {
  background: #bbf7d0;
  outline: none;
}
.btn-offline-label {
  white-space: nowrap;
}
@keyframes offline-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.22);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(217, 119, 6, 0.35);
  }
}
@media (max-width: 700px) {
  .btn-offline {
    min-width: var(--touch, 44px);
    padding: 8px 10px;
    font-size: 0.8rem;
  }
}

.offline-confirm-meta {
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
  color: var(--muted, #5a6a75);
  font-weight: 600;
}
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 1.25rem;
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch, 44px);
  padding: 10px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
}
.btn-secondary:hover,
.btn-secondary:focus-visible {
  border-color: var(--primary);
  background: #eef7f6;
  outline: none;
}

/* Reload app without URL bar (iPad / kiosk) — left of language select */
.btn-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--touch, 44px);
  min-width: var(--touch, 44px);
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  flex-shrink: 0;
}
.btn-refresh:hover,
.btn-refresh:focus {
  border-color: var(--primary);
  background: #eef7f6;
  outline: none;
}
.btn-refresh:active {
  transform: scale(0.97);
}
.btn-refresh-icon {
  font-size: 1.35rem;
  line-height: 1;
  font-weight: 800;
}
.btn-refresh-label {
  white-space: nowrap;
}
@media (max-width: 700px) {
  .btn-refresh-label {
    display: none; /* icon-only on narrow; keeps topbar clean */
  }
  .btn-refresh {
    padding: 8px 10px;
  }
}

/* Language switcher: flag + short code — compact to content width (16px = no iOS zoom) */
.lang-select {
  min-height: var(--touch);
  width: auto;
  min-width: 3.75rem; /* 🇩🇪 DE + caret */
  max-width: min(5.5rem, 28vw);
  padding: 6px 6px 6px 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
  cursor: pointer;
  color: var(--text);
  -webkit-appearance: menulist;
  appearance: menulist;
  touch-action: manipulation;
  position: relative;
  z-index: 7;
  flex-shrink: 0;
}
.lang-select:hover,
.lang-select:focus {
  border-color: var(--primary);
  outline: none;
}

.btn-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: var(--touch);
  padding: 8px 12px 8px 10px;
  border: 2px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  max-width: min(200px, 36vw);
}

.btn-user:hover {
  border-color: var(--primary);
  background: #eef7f6;
}

.btn-user-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
}

.btn-user-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Buttons */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  background: var(--surface);
  cursor: pointer;
  min-height: 48px;
  transition: transform 0.12s ease, background 0.12s ease;
}

.btn:active { transform: scale(0.97); }

.btn-icon {
  min-width: var(--touch);
  min-height: var(--touch);
  font-size: 1.25rem;
  border: 2px solid var(--border);
  background: var(--surface);
}

.btn-large {
  min-height: var(--touch);
  padding: 16px 28px;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: var(--radius);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover, .btn-primary:focus-visible {
  background: var(--primary-dark);
}

.btn-secondary {
  background: #e8f2f6;
  color: var(--primary);
  border: 2px solid var(--border);
}

.btn-danger {
  background: #fdeaea;
  color: var(--danger);
  border: 2px solid #f0c4c4;
}

.btn-back {
  background: transparent;
  color: var(--primary);
  font-weight: 600;
  padding: 8px 4px;
  min-height: 44px;
}

.btn-therapy {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  padding: 12px 16px;
  background: var(--surface);
  border: 3px solid var(--border);
  border-radius: var(--radius);
  text-align: left;
}

.btn-therapy[aria-pressed="true"] {
  border-color: var(--accent);
  background: #e8faf7;
  box-shadow: 0 0 0 3px rgba(87, 197, 182, 0.25);
}

.therapy-icon { font-size: 1.55rem; flex-shrink: 0; }
.therapy-label { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.therapy-label strong { font-size: 0.92rem; line-height: 1.15; }
.therapy-label small { color: var(--muted); font-size: 0.78rem; line-height: 1.2; }
.therapy-label .therapy-purpose {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  line-height: 1.15;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.therapy-label .therapy-hint {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.15;
}

/* Upper control bar (therapy) always visible; mixer panel collapsible */
.settings-shell {
  margin-bottom: 12px;
}

.settings-shell > .therapy-bar {
  margin-bottom: 8px;
}

/* Dezente Markierung: obere Steuer-Leiste (ohne Farbwörter in der Hilfe nötig) */
.settings-shell > .therapy-bar {
  padding: 10px 10px 10px 12px;
  border-radius: var(--radius);
  border: 2px solid color-mix(in srgb, var(--primary) 35%, var(--border));
  background: color-mix(in srgb, var(--surface) 88%, var(--primary) 12%);
  box-shadow: var(--shadow);
  border-left: 5px solid var(--primary);
}

.settings-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow);
}

/* Topbar help = compact "?" */
.btn-help {
  min-width: 40px;
  width: 40px;
  height: 40px;
  min-height: 40px;
  padding: 0;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--primary);
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.btn-help:hover,
.btn-help:focus-visible {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(20, 120, 130, 0.18);
}
/* Hilfe aktiv: Fragezeichen rot */
.btn-help.is-active {
  border-color: #b91c1c;
  background: #fef2f2;
  color: #b91c1c;
  box-shadow: 0 0 0 2px rgba(185, 28, 28, 0.2);
}
.btn-help-glyph {
  font-size: 1.2rem;
  font-weight: 800;
}

/* Home: session status instead of duplicate nav cards */
.session-status-chip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 2px solid var(--primary);
  background: #e8f4f7;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.3;
}
.session-status-chip[hidden] {
  display: none !important;
}
.session-status-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
  background: #fff;
  border-radius: 999px;
  padding: 3px 8px;
}
.session-status-text {
  flex: 1 1 auto;
  min-width: 0;
}
.home-nav-hint {
  margin: 12px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.35;
}

.settings-toggle:active {
  transform: scale(0.99);
}

.settings-toggle-icon {
  display: inline-flex;
  width: 1.4em;
  transition: transform 0.15s ease;
  font-size: 0.85rem;
}

.settings-toggle[aria-expanded="true"] .settings-toggle-icon {
  transform: rotate(90deg);
}

.settings-toggle-label {
  flex: 1;
  font-size: 1.05rem;
}

.settings-toggle-hint {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.settings-panel {
  margin-top: 10px;
  animation: fadeIn 0.18s ease;
}

.settings-panel.is-collapsed,
.settings-panel[hidden] {
  display: none !important;
}

/* Therapy bar: Licht | Rosa | Aff|Gesch | Klänge kompakt | Sprachkurs */
.therapy-bar {
  display: grid;
  grid-template-columns: 1fr 1fr 1.1fr 1.2fr 1.15fr;
  gap: 8px;
  margin-bottom: 10px;
  align-items: stretch;
}

.therapy-item {
  min-width: 0;
  height: 100%;
}

/* Shared stacked columns (voice / sound / course) */
.therapy-item--voice,
.therapy-item--sound,
.therapy-item--course {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  height: 100%;
}
.therapy-item--voice .btn-therapy,
.therapy-item--sound .btn-therapy,
.therapy-item--course .btn-therapy {
  flex: 1 1 auto;
  min-height: 72px;
  height: auto;
}

.voice-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  min-height: 36px;
  flex: 0 0 auto;
}
.voice-mode-btn {
  min-height: 36px;
  padding: 4px 6px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  line-height: 1.15;
}
.voice-mode-btn.is-active {
  border-color: var(--primary);
  background: #e8f4f7;
  color: var(--primary);
}
.voice-mode-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.voice-mode-btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
}

.therapy-bar .btn-therapy {
  min-height: 96px;
  height: 100%;
  padding: 10px 10px;
  gap: 8px;
}

/* Klänge: Select + Upload unter dem An/Aus-Button */
.sound-compact-tools {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 0 0 auto;
  min-width: 0;
}

.therapy-bar .sound-select-face {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 36px;
  height: 36px;
  padding: 4px 8px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-sizing: border-box;
}
.therapy-bar .sound-select-face:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(20, 120, 130, 0.18);
}
.therapy-bar .sound-select-icon {
  flex-shrink: 0;
  font-size: 1.05rem;
  line-height: 1;
  width: 1.25em;
  text-align: center;
  pointer-events: none;
  user-select: none;
}
.therapy-bar .sound-select {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 2px 0;
  border: none;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  line-height: 1.2;
  box-sizing: border-box;
  cursor: pointer;
  appearance: auto;
  text-align: left;
}
.therapy-bar .sound-select:focus {
  outline: none;
}
.therapy-bar .sound-select:focus-visible {
  outline: none;
}

.therapy-bar .custom-sound-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 3px;
  align-items: stretch;
  min-height: 32px;
  width: 100%;
}

.therapy-bar .custom-sound-btn {
  flex: 1 1 auto;
  min-height: 32px;
  height: 32px;
  max-height: 32px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 10px;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

.therapy-bar .custom-sound-btn--clear {
  flex: 0 1 auto;
  min-width: 4.2rem;
  max-width: 5.5rem;
  padding: 2px 6px;
  font-size: 0.68rem;
}

.therapy-bar .custom-sound-meta {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  font-size: 0.62rem;
  line-height: 1.15;
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.therapy-bar .custom-sound-meta:empty {
  display: none;
}

/* Sprachkurs-Slot */
.course-manage-btn {
  min-height: 36px;
  padding: 4px 8px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  cursor: pointer;
  line-height: 1.15;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.course-manage-btn:hover,
.course-manage-btn:focus-visible {
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 0 0 2px rgba(20, 120, 130, 0.15);
}
#btn-course[aria-pressed="true"] {
  border-color: var(--primary);
  background: #e8f4f7;
}

/* Kurs-Panel unter dem Mixer */
.lesson-course-panel {
  margin-top: 12px;
  scroll-margin-top: 12px;
  transition: box-shadow 0.35s ease, border-color 0.35s ease;
}
.lesson-course-panel.is-highlight {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(20, 120, 130, 0.22);
}
.lesson-course-panel .lesson-upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
}
.lesson-upload-btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

/* —— KI Sprachkurs Wizard —— */
.course-wizard {
  margin-top: 14px;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 92%, var(--primary) 8%);
}
.cw-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.cw-head h4 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--primary);
}
.cw-sub {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.cw-intro {
  margin: 0 0 12px;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.4;
}
.cw-job-badge {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 0.78rem;
  font-weight: 800;
}
.cw-label {
  display: block;
  margin: 12px 0 6px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}
.cw-step .sound-select {
  width: 100%;
  max-width: 100%;
}
.cw-pair {
  margin: 10px 0 0;
  font-size: 0.88rem;
  color: var(--primary);
  font-weight: 600;
  line-height: 1.35;
}
.cw-hint {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}
.cw-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.cw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.cw-chip {
  min-height: 40px;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.cw-chip.is-on {
  border-color: var(--primary);
  background: #e8f4f7;
  color: var(--primary);
}
.cw-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  font-size: 0.9rem;
  font-weight: 600;
}
.cw-summary {
  margin-bottom: 8px;
}
.cw-summary-list {
  margin: 0;
  padding-left: 1.2em;
  line-height: 1.5;
  font-size: 0.95rem;
}
.cw-summary-note {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.cw-pipe-title {
  margin: 18px 0 8px;
  font-size: 0.95rem;
  color: var(--primary);
}
.cw-pipeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.cw-pipeline li {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.cw-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}
.cw-dot.pass {
  border-color: #15803d;
  background: #dcfce7;
  color: #166534;
}
.cw-dot.fail {
  border-color: #b91c1c;
  background: #fee2e2;
  color: #991b1b;
}
.cw-dot.run {
  border-color: #d97706;
  background: #fef3c7;
  color: #92400e;
}
.cw-status {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--muted);
  min-width: 3.2em;
  text-align: right;
}
.cw-status.pass { color: #15803d; }
.cw-status.fail { color: #b91c1c; }
.cw-status.run { color: #d97706; }
.cw-step-sum {
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.3;
}
.cw-log {
  margin: 12px 0 0;
  padding: 10px 12px;
  max-height: 160px;
  overflow: auto;
  border-radius: 10px;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 0.78rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 1100px) {
  .therapy-bar {
    grid-template-columns: 1fr 1fr 1fr 1.1fr 1.05fr;
    gap: 6px;
  }
  .therapy-bar .btn-therapy {
    min-height: 100px;
    padding: 8px 6px;
    gap: 6px;
  }
  .therapy-item--voice .btn-therapy,
  .therapy-item--sound .btn-therapy,
  .therapy-item--course .btn-therapy {
    min-height: 70px;
  }
  .therapy-icon { font-size: 1.25rem; }
  .therapy-label strong { font-size: 0.78rem; }
  .therapy-label small { font-size: 0.68rem; }
  .therapy-label .therapy-purpose { font-size: 0.64rem; }
  .therapy-label .therapy-hint { font-size: 0.6rem; }
  .therapy-bar .custom-sound-btn,
  .voice-mode-btn,
  .course-manage-btn {
    min-height: 34px;
    height: 34px;
    max-height: 34px;
    font-size: 0.66rem;
  }
  .therapy-bar .sound-select {
    font-size: 0.72rem;
  }
}

@media (max-width: 700px) {
  .therapy-bar {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .therapy-bar .btn-therapy {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    min-height: 88px;
  }
  .therapy-item--voice .btn-therapy,
  .therapy-item--sound .btn-therapy,
  .therapy-item--course .btn-therapy {
    min-height: 64px;
  }
}

.mixer-bar {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.mixer-title {
  margin: 0 0 12px;
  font-size: 1.05rem;
  color: var(--primary);
}

/* Eine gemeinsame Spalten-Definition → alle Regler in derselben Flucht */
.mixer-grid {
  display: grid;
  grid-template-columns: minmax(12.5rem, 1.35fr) minmax(0, 1fr) 3.4em;
  gap: 14px 12px;
  align-items: center;
}

.mixer-row {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
  gap: 10px;
  align-items: center;
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

/* Fallback ohne Subgrid: gleiche template-columns pro Zeile */
@supports not (grid-template-columns: subgrid) {
  .mixer-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  .mixer-row {
    display: grid;
    grid-template-columns: minmax(12.5rem, 1.35fr) minmax(0, 1fr) 3.4em;
    grid-column: auto;
  }
}

/* Rosa Rauschen: 48/96 kHz nur im Label-Feld, Slider-Spalte bleibt frei */
.mixer-pink-label-wrap {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
}
.mixer-pink-label-wrap > label {
  white-space: nowrap;
  font-weight: 600;
  cursor: pointer;
}

/* Touch-first sliders (iPad Pro): großer Thumb + dicke Track */
.pink-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 44px;
  min-height: 48px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  accent-color: var(--primary);
}

.pink-slider:focus {
  outline: none;
}
.pink-slider:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 8px;
}

/* Track */
.pink-slider::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 70%, var(--primary) 12%);
  border: 1px solid var(--border);
}
.pink-slider::-moz-range-track {
  height: 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 70%, var(--primary) 12%);
  border: 1px solid var(--border);
}

/* Thumb — deutlich greifbar auf dem iPad */
.pink-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 32px;
  height: 32px;
  margin-top: -11px; /* (32 - 12) / 2 */
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}
.pink-slider::-moz-range-thumb {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}

.mixer-row strong {
  min-width: 0;
  width: 100%;
  text-align: right;
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
}

.mixer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
}

/* 48/96 kHz: lesbar und gut tippbar neben Rosa Rauschen */
.pink-quality {
  min-height: 40px;
  height: 40px;
  min-width: 5.75rem;
  width: auto;
  max-width: 7rem;
  padding: 4px 8px;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
  flex-shrink: 0;
  border-radius: 12px;
  border: 2px solid var(--primary);
  background: var(--surface);
  color: var(--text);
}

.pink-note {
  margin: 0;
  flex: 1 1 100%;
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 600px) {
  .mixer-grid {
    grid-template-columns: minmax(0, 1fr) 3.2em;
  }
  .mixer-row > span:first-child,
  .mixer-row .mixer-pink-label-wrap {
    grid-column: 1 / -1;
  }
  .mixer-row .pink-slider {
    grid-column: 1;
  }
  .mixer-row > strong {
    grid-column: 2;
  }
  @supports not (grid-template-columns: subgrid) {
    .mixer-row {
      grid-template-columns: minmax(0, 1fr) 3.2em;
    }
    .mixer-row > span:first-child,
    .mixer-row .mixer-pink-label-wrap {
      grid-column: 1 / -1;
    }
  }
}

.sound-select {
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface);
  min-width: 0;
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
}

/* Private custom ambient — stacked under sound dropdown (see .therapy-bar rules) */
.custom-sound-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: center;
}
.custom-sound-btn {
  min-height: 36px;
  padding: 4px 10px;
  font-size: 0.82rem;
}
.custom-sound-meta {
  color: var(--primary);
  font-size: 0.72rem;
}
.custom-sound-row .hidden,
.custom-sound-btn[hidden] {
  display: none !important;
}

/* Tabs — 6 items (Hilfe is topbar ?) */
.tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 16px;
  background: var(--surface);
  padding: 8px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
}

@media (max-width: 900px) {
  .tabs {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 520px) {
  .tabs {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 640px) {
  .tab span:last-child {
    font-size: 0.72rem;
  }
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 64px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 8px 4px;
}

.tab span:first-child { font-size: 1.35rem; }

.tab.active {
  background: var(--primary);
  color: #fff;
}

/* Main */
.main { flex: 1; }
.view[hidden] { display: none !important; }
.view { animation: fadeIn 0.2s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.view-header { margin-bottom: 16px; }
.view-sub {
  margin: 6px 0 0;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.4;
  max-width: 62ch;
}

/* Help / Q&A — sticky header+filters; scrollable list */
#view-help.view-help.active,
#view-help.view-help:not([hidden]) {
  display: flex;
  flex-direction: column;
  min-height: min(70vh, 720px);
  max-height: min(78vh, 860px);
}
.help-layout {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: inherit;
}
.help-sticky {
  flex: 0 0 auto;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg, #f4f7f8);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}
.help-view-header {
  margin-bottom: 10px;
}
.help-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 2px 28px;
  overscroll-behavior: contain;
}
.help-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}
.help-search-wrap {
  flex: 1 1 220px;
  min-width: 0;
}
.help-search {
  width: 100%;
  box-sizing: border-box;
  min-height: var(--touch, 44px);
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--surface);
  color: var(--ink, #1a2a33);
}
.help-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.18);
}
.help-depth {
  display: inline-flex;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}
.help-depth-btn {
  min-height: var(--touch, 44px);
  padding: 8px 16px;
  border: none;
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  touch-action: manipulation;
}
.help-depth-btn + .help-depth-btn {
  border-left: 2px solid var(--border);
}
.help-depth-btn.is-active {
  background: var(--primary);
  color: #fff;
}
.help-cats {
  margin-bottom: 0;
  flex-wrap: wrap;
}
.help-locale-note {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  font-size: 0.9rem;
  font-weight: 600;
}
.help-empty {
  margin: 12px 0;
  color: var(--muted);
  font-weight: 600;
}
.help-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 8px;
}
.help-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
}
.help-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.help-card-head-main {
  min-width: 0;
  flex: 1;
}
.help-card-cat {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 6px;
}
.help-card-q {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.3;
  color: var(--ink, #1a2a33);
}
/* Vorlesen: aus = grau ruhig · an = kräftig grün, klar unterscheidbar */
.help-speak-btn {
  flex-shrink: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 52px;
  min-height: 52px;
  padding: 6px 8px;
  border: 3px solid #94a3b8;
  border-radius: 14px;
  background: #f1f5f9;
  color: #475569;
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
  line-height: 1.1;
}
.help-speak-icon {
  font-size: 1.35rem;
  line-height: 1;
}
.help-speak-btn:hover,
.help-speak-btn:focus-visible {
  border-color: #64748b;
  outline: none;
}
.help-speak-btn.is-speaking {
  border-color: #15803d;
  background: #bbf7d0;
  color: #14532d;
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.35);
  animation: help-speak-pulse 1.2s ease-in-out infinite;
}
@keyframes help-speak-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.28);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(21, 128, 61, 0.18);
  }
}
.help-card-body p {
  margin: 0 0 0.75em;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.98rem;
}
.help-card-body p:last-child {
  margin-bottom: 0;
}
.view-header h2 { margin: 0 0 6px; font-size: 1.45rem; color: var(--primary); }
.view-header p { margin: 0; color: var(--muted); }

.welcome-card, .info-card, .profile-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.welcome-card h2 { margin: 0 0 8px; color: var(--primary); }
.welcome-card p { margin: 0 0 14px; color: var(--muted); }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #e8f2f6;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 1rem;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.quick-card {
  min-height: 110px;
  border: 3px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--primary);
  cursor: pointer;
  box-shadow: var(--shadow);
}

.quick-card:active { transform: scale(0.98); }
.quick-emoji { font-size: 2rem; }

.info-card h3 { margin: 0 0 10px; }
.info-card ul { margin: 0; padding-left: 1.2rem; color: var(--muted); }
.info-card li { margin-bottom: 6px; }

/* Filters */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* Games list */
.games-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 700px) {
  .games-list { grid-template-columns: 1fr 1fr; }
}

.game-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-height: 168px;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow);
  width: 100%;
}

.game-card--with-levels {
  min-height: 188px;
  padding-bottom: 12px;
}

.game-card:active { transform: scale(0.99); }

/* Head: star | small emoji | title */
.game-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.game-card-title {
  margin: 0;
  font-size: 1.12rem;
  color: var(--text);
  line-height: 1.2;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Zweit-Sprache / dual labels — recognizable at a glance in the games list */
.game-learn-lang-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  max-width: 42%;
  padding: 4px 8px 4px 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, #e8f4ff 0%, #f0e8ff 100%);
  border: 2px solid #5b7cfa;
  color: #1e3a8a;
  font-weight: 800;
  font-size: 0.72rem;
  line-height: 1.1;
  letter-spacing: 0.01em;
}
.game-learn-lang-badge-icon {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 22px;
  padding: 0 4px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #93aefc;
  font-size: 0.7rem;
  font-weight: 900;
  color: #2563eb;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.game-learn-lang-badge-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.badge-learn-lang {
  background: #e8f0ff;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
  font-weight: 800;
}
.chip--learn-lang {
  border-color: #5b7cfa;
}
.chip--learn-lang.active {
  background: #5b7cfa;
  border-color: #5b7cfa;
  color: #fff;
}
.game-card--learn-lang {
  box-shadow: 0 0 0 1px rgba(91, 124, 250, 0.18);
}
@media (max-width: 520px) {
  .game-learn-lang-badge-text {
    display: none;
  }
  .game-learn-lang-badge {
    max-width: none;
    padding: 4px 6px;
  }
}

.game-emoji {
  width: 64px; height: 64px;
  border-radius: 16px;
  background: linear-gradient(145deg, #e8f7f5, #d4eef8);
  display: grid;
  place-items: center;
  font-size: 1.9rem;
  flex-shrink: 0;
}

.game-emoji--sm {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 1.25rem;
}

.btn-star--card {
  min-width: 40px;
  min-height: 40px;
  width: 40px;
  height: 40px;
  font-size: 1.35rem;
  flex-shrink: 0;
  padding: 0;
}

/* Body: info left, large preview right */
.game-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(118px, 42%);
  gap: 12px 14px;
  align-items: stretch;
  flex: 1;
}

.game-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.game-info h3 {
  margin: 0 0 4px;
  font-size: 1.15rem;
  color: var(--text);
}

.game-info p,
.game-card-desc {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.game-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

/* Visual preview panel */
.game-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 112px;
  padding: 10px;
  border-radius: 14px;
  border: 2px solid var(--border);
  background: linear-gradient(160deg, #f4fbfa 0%, #eef6fb 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.game-preview--generic .gp-generic-emoji {
  font-size: 2.6rem;
  line-height: 1;
}

/* Sequence: 4 color dots like Simon */
.game-preview--sequence .gp-seq-row {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}
.gp-seq-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.12);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
}
.gp-seq-dot--red { background: #e74c3c; }
.gp-seq-dot--green { background: #27ae60; }
.gp-seq-dot--blue { background: #3498db; }
.gp-seq-dot--yellow { background: #f1c40f; }
.gp-seq-dot--pulse {
  box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.35), 0 2px 6px rgba(0, 0, 0, 0.15);
  transform: scale(1.12);
}
.game-preview--sequence .gp-caption {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.02em;
}

/* Memory: 2×2 tiles */
.game-preview--memory .gp-mem-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 100%;
  max-width: 120px;
}
.gp-mem-tile {
  aspect-ratio: 1;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  font-weight: 800;
  border: 2px solid var(--border);
}
.gp-mem-tile--back {
  background: linear-gradient(145deg, #5b8fa8, #3d6f88);
  color: #fff;
  font-size: 1.35rem;
}
.gp-mem-tile--open {
  background: #fff;
  color: var(--text);
}

/* Colors: swatches + label */
.game-preview--colors .gp-colors-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text);
}
.game-preview--colors .gp-colors-row {
  display: flex;
  gap: 6px;
  width: 100%;
  justify-content: center;
}
.gp-color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 2px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

/* Shared preview chips / helpers */
.gp-num-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  align-items: center;
}
.gp-chip {
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border-radius: 8px;
  background: #fff;
  border: 2px solid var(--border);
  display: inline-grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--text);
}
.gp-chip--sm { font-size: 0.72rem; min-width: auto; height: auto; padding: 4px 8px; }
.gp-chip--hi {
  border-color: var(--accent);
  background: #e8faf7;
  color: var(--primary);
}
.gp-caption {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--primary);
}
.gp-big { font-size: 1.8rem; line-height: 1; }
.gp-emoji { font-size: 1.35rem; line-height: 1; }
.gp-emoji--odd { outline: 2px solid var(--danger); border-radius: 8px; padding: 2px; }
.gp-calc-q { font-size: 1.05rem; font-weight: 800; color: var(--text); }
.gp-att-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 72px;
}
.gp-att {
  aspect-ratio: 1;
  border-radius: 8px;
  background: #dfeaf0;
  border: 2px solid var(--border);
}
.gp-att--on {
  background: #57c5b6;
  box-shadow: 0 0 0 3px rgba(87, 197, 182, 0.35);
}
.gp-clock {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid var(--primary);
  position: relative;
  background: #fff;
}
.gp-clock-hand {
  position: absolute;
  left: 50%;
  bottom: 50%;
  transform-origin: bottom center;
  background: var(--text);
  border-radius: 2px;
}
.gp-clock-hand--h { width: 3px; height: 14px; margin-left: -1.5px; transform: rotate(90deg); }
.gp-clock-hand--m { width: 2px; height: 18px; margin-left: -1px; transform: rotate(180deg); background: var(--primary); }
.gp-size-row { display: flex; align-items: flex-end; gap: 8px; }
.gp-size {
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.85;
}
.gp-size--s { width: 14px; height: 14px; }
.gp-size--m { width: 22px; height: 22px; }
.gp-size--l { width: 30px; height: 30px; }
.gp-daily {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
}
.gp-stars { font-size: 0.95rem; letter-spacing: 1px; }
.gp-maze {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  width: 72px;
}
.gp-maze-c {
  aspect-ratio: 1;
  border-radius: 4px;
  background: #e8f2f6;
  border: 1px solid var(--border);
  font-size: 0.65rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.gp-maze-w { background: #b0c4ce; }
.gp-maze-path { background: #c8f0ea; }
.gp-maze-s, .gp-maze-z { background: var(--primary); color: #fff; }
.gp-story-lines {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 70%;
}
.gp-story-lines span {
  height: 6px;
  border-radius: 3px;
  background: #c5d7e0;
}
.gp-story-lines .gp-story-short { width: 55%; }
.gp-sudo {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  width: 96px;
  background: var(--border);
  border: 2px solid var(--primary);
  border-radius: 6px;
  overflow: hidden;
}
.gp-sudo-c {
  aspect-ratio: 1;
  background: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  color: var(--text);
}
.gp-sudo-empty { background: #f0f7fa; }
.gp-sudo-vr { border-right: 2px solid var(--primary); }
.gp-sudo-hr { border-bottom: 2px solid var(--primary); }
.gp-tictac {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  width: 72px;
  background: #4a5568;
  border-radius: 6px;
  overflow: hidden;
  padding: 2px;
}
.gp-tt-c {
  aspect-ratio: 1;
  background: #f4f6f8;
  border-radius: 2px;
  position: relative;
}
.gp-tt-o::after {
  content: "";
  position: absolute;
  inset: 18%;
  border: 3px solid #e6a817;
  border-radius: 50%;
  box-sizing: border-box;
}
.gp-tt-x::before,
.gp-tt-x::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 70%;
  height: 3px;
  background: #1a56db;
  border-radius: 2px;
}
.gp-tt-x::before { transform: translate(-50%, -50%) rotate(45deg); }
.gp-tt-x::after { transform: translate(-50%, -50%) rotate(-45deg); }
.gp-tt-win { background: #fff3c4; }

.gp-pyr { display: flex; flex-direction: column; gap: 3px; align-items: center; }
.gp-pyr-row { display: flex; gap: 3px; }
.gp-pyr-c {
  min-width: 22px;
  height: 22px;
  border-radius: 5px;
  background: #fff;
  border: 1.5px solid var(--border);
  font-size: 0.68rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}

@media (max-width: 520px) {
  .game-card-body {
    grid-template-columns: minmax(0, 1fr) minmax(100px, 40%);
    gap: 10px;
  }
  .game-preview {
    min-height: 100px;
    padding: 8px;
  }
  .gp-seq-dot,
  .gp-color-swatch {
    width: 24px;
    height: 24px;
  }
}

/* ---- In-game: Sudoku 4×4 / 6×6 / 9×9 (Stufe 5 groß) ---- */
.sudoku-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  flex: 1 1 auto;
  min-height: 0;
  justify-content: center;
}
/* 9×9: möglichst viel Viewport, iPad-tauglich */
.sudoku-wrap:has(.sudoku-board--n9) {
  max-width: min(100%, 820px);
  gap: 16px;
}
.sudoku-board {
  display: grid;
  grid-template-columns: repeat(var(--sudoku-n, 4), 1fr);
  gap: 0;
  width: min(100%, 380px);
  border: 3px solid var(--primary);
  border-radius: 12px;
  overflow: hidden;
  background: var(--primary);
  box-shadow: var(--shadow);
}
.sudoku-board--n6 {
  width: min(100%, 460px);
}
/* Stufe 5: deutlich größeres Feld (Touch + Lesbarkeit) */
.sudoku-board--n9 {
  width: min(100%, min(94vw, 78vh, 720px));
  max-width: 100%;
  border-width: 4px;
  border-radius: 14px;
}
.sudoku-cell {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
  min-height: 52px;
  padding: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.sudoku-board--n6 .sudoku-cell {
  min-height: 48px;
  font-size: 1.35rem;
}
.sudoku-board--n9 .sudoku-cell {
  min-height: 0;
  min-width: 0;
  font-size: clamp(1.05rem, 2.8vw + 0.4rem, 1.75rem);
  font-weight: 800;
}
.sudoku-cell.border-r { border-right: 3px solid var(--primary); }
.sudoku-cell.border-b { border-bottom: 3px solid var(--primary); }
.sudoku-board--n9 .sudoku-cell.border-r { border-right-width: 4px; }
.sudoku-board--n9 .sudoku-cell.border-b { border-bottom-width: 4px; }
.sudoku-cell.is-given {
  background: #e8f2f6;
  color: var(--primary);
  cursor: default;
}
.sudoku-cell.is-selected {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
  z-index: 1;
}
.sudoku-board--n9 .sudoku-cell.is-selected {
  outline-width: 4px;
  outline-offset: -4px;
}
.sudoku-cell.is-conflict { background: #fdeaea; color: var(--danger); }
.sudoku-pad,
.pyramid-pad {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  width: 100%;
  max-width: 100%;
}
/* Alle Ziffern + ⌫ in einer Zeile — kein Scrollen */
.sudoku-pad {
  flex-wrap: nowrap;
  gap: 6px;
  overflow: visible;
  max-width: min(100%, 760px);
  align-items: stretch;
}
.sudoku-num,
.pyramid-num {
  min-width: 48px;
  min-height: 48px;
  font-size: 1.25rem;
  font-weight: 800;
}
.sudoku-pad .sudoku-num {
  flex: 1 1 0;
  min-width: 0;
  max-width: 72px;
  width: auto;
  height: auto;
  aspect-ratio: 1;
  min-height: 44px;
  padding: 0;
  font-size: clamp(1rem, 2.2vw, 1.45rem);
  border-radius: 12px;
}
/* 9×9: 10 Tasten (1–9 + ⌫) eng aber tippbar in einer Reihe */
.sudoku-wrap:has(.sudoku-board--n9) .sudoku-pad {
  gap: 5px;
  max-width: min(100%, 760px);
}
.sudoku-wrap:has(.sudoku-board--n9) .sudoku-num {
  max-width: 68px;
  min-height: 46px;
  font-size: clamp(1.05rem, 2vw, 1.5rem);
  border-radius: 12px;
}
.sudoku-clear,
.pyramid-clear {
  background: #f0f0f0;
}

/* Spielbereich: bei 9×9 mehr Höhe freigeben */
#view-play.is-playing .game-area:has(.sudoku-board--n9) {
  min-height: min(78vh, 820px);
  padding: 8px 10px 12px;
}
#view-play.is-playing .game-area:has(.sudoku-board--n9) .game-prompt,
#view-play.is-playing .game-area:has(.sudoku-board--n9) .pyramid-hint {
  margin-bottom: 6px;
  font-size: 0.95rem;
}

@media (min-width: 900px) {
  .sudoku-board--n9 {
    width: min(100%, min(88vw, 80vh, 760px));
  }
  .sudoku-board--n9 .sudoku-cell {
    font-size: clamp(1.25rem, 1.6vw + 0.6rem, 1.9rem);
  }
}

@media (max-width: 600px) {
  .sudoku-board--n9 {
    width: min(100%, 96vw);
  }
  .sudoku-board--n9 .sudoku-cell {
    font-size: clamp(0.95rem, 3.6vw, 1.25rem);
  }
  .sudoku-pad {
    flex-wrap: nowrap;
    gap: 4px;
  }
  .sudoku-pad .sudoku-num {
    min-height: 40px;
    max-width: none;
    font-size: clamp(0.9rem, 3.5vw, 1.15rem);
  }
}

/* ---- In-game: Zahlenpyramide ---- */
.pyramid-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}
.pyramid-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.pyramid-cell {
  min-width: 56px;
  min-height: 52px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 3px solid var(--border);
  background: #fff;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
}
.pyramid-cell.is-given {
  background: #e8f2f6;
  color: var(--primary);
  cursor: default;
  border-color: var(--primary);
}
.pyramid-cell.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(87, 197, 182, 0.3);
}
.pyramid-cell.is-wrong {
  background: #fdeaea;
  border-color: var(--danger);
  color: var(--danger);
}
.pyramid-hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
}

/* ---- In-game: Reihe bilden (Tic-Tac / Connect-k) ---- */
.tictac-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: min(100%, 720px);
  margin: 0 auto;
  position: relative;
}
.tictac-wrap--n8,
.tictac-wrap--n10 {
  max-width: min(100%, 860px);
}
.tictac-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  justify-content: flex-start;
  align-items: center;
}
.tictac-new {
  min-height: 48px;
  font-weight: 700;
}
.tictac-settings-btn {
  min-height: 48px;
  font-weight: 700;
}
.tictac-status {
  margin: 0;
  text-align: center;
  font-weight: 700;
  color: var(--text);
  min-height: 1.4em;
}
.tictac-board {
  display: grid;
  grid-template-columns: repeat(var(--tictac-n, 3), 1fr);
  gap: 0;
  width: min(100%, min(92vw, 70vh, 420px));
  border: 3px solid #4a5568;
  border-radius: 12px;
  overflow: hidden;
  background: #4a5568;
  box-shadow: var(--shadow);
  touch-action: manipulation;
}
.tictac-board--n5 { width: min(100%, min(92vw, 68vh, 480px)); }
.tictac-board--n6 { width: min(100%, min(94vw, 70vh, 520px)); }
.tictac-board--n8 { width: min(100%, min(96vw, 74vh, 640px)); }
.tictac-board--n10 { width: min(100%, min(98vw, 78vh, 720px)); }
.tictac-cell {
  aspect-ratio: 1;
  min-width: 0;
  min-height: 0;
  border: 1px solid #718096;
  background: #f4f6f8;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.tictac-cell:not(:disabled):hover {
  background: #e8eef5;
}
.tictac-cell:disabled {
  cursor: default;
}
.tictac-cell.is-win {
  background: #fff3c4;
  box-shadow: inset 0 0 0 3px #e6b800;
}
.tictac-mark {
  display: block;
  width: 72%;
  height: 72%;
  pointer-events: none;
}
/* Gold O – thick ring */
.tictac-mark--o {
  border-radius: 50%;
  border: clamp(4px, 1.4vw, 10px) solid #e6a817;
  box-sizing: border-box;
  background: transparent;
}
/* Blue X – two diagonals */
.tictac-mark--x {
  position: relative;
  width: 70%;
  height: 70%;
}
.tictac-mark--x::before,
.tictac-mark--x::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 118%;
  height: clamp(4px, 1.3vw, 10px);
  background: #1a56db;
  border-radius: 3px;
}
.tictac-mark--x::before { transform: translate(-50%, -50%) rotate(45deg); }
.tictac-mark--x::after { transform: translate(-50%, -50%) rotate(-45deg); }
.tictac-legend {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
}
/* Settings modal */
.tictac-modal {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  border-radius: 16px;
  padding: 12px;
}
.tictac-modal.is-open,
.tictac-modal:not([hidden]) {
  display: flex;
}
.tictac-modal[hidden] {
  display: none !important;
}
.tictac-modal-card {
  background: #fff;
  border-radius: 16px;
  padding: 20px 22px;
  width: min(100%, 420px);
  max-height: min(90vh, 640px);
  overflow: auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
}
.tictac-modal-title {
  margin: 0 0 14px;
  font-size: 1.25rem;
  text-align: center;
}
.tictac-modal-section {
  margin-bottom: 16px;
}
.tictac-modal-label {
  margin: 0 0 8px;
  font-weight: 800;
  border-bottom: 2px solid var(--border);
  padding-bottom: 4px;
}
.tictac-diff-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tictac-diff-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
}
.tictac-diff-item input {
  width: 20px;
  height: 20px;
  accent-color: #1a56db;
}
.tictac-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  font-weight: 600;
  cursor: pointer;
  position: relative;
}
.tictac-toggle > span:first-child {
  flex: 1;
  min-width: 0;
}
.tictac-toggle input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}
.tictac-switch {
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  transition: background 0.15s ease;
  flex-shrink: 0;
}
.tictac-switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}
.tictac-toggle input:checked + .tictac-switch {
  background: #22c55e;
}
.tictac-toggle input:checked + .tictac-switch::after {
  transform: translateX(22px);
}
.tictac-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
}
.tictac-modal-actions .btn {
  min-width: 120px;
  min-height: 48px;
  font-weight: 800;
}

#view-play.is-playing .game-area:has(.tictac-board--n8),
#view-play.is-playing .game-area:has(.tictac-board--n10) {
  min-height: min(78vh, 860px);
  padding: 8px 10px 12px;
}
#view-play.is-playing .game-area:has(.tictac-board) .game-prompt {
  margin-bottom: 6px;
  font-size: 0.95rem;
}

@media (max-width: 600px) {
  .tictac-board--n8,
  .tictac-board--n10 {
    width: min(100%, 98vw);
  }
  .tictac-mark--o {
    border-width: clamp(3px, 2.2vw, 7px);
  }
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
}

.badge-soft {
  background: #e8f2f6;
  color: var(--primary);
}

.badge-cat {
  background: #fff3d6;
  color: #8a5a00;
}

.btn-star {
  min-width: 56px;
  min-height: 56px;
  border: none;
  background: transparent;
  font-size: 1.8rem;
  cursor: pointer;
  color: #c9a227;
  line-height: 1;
}

.btn-star.is-fav { filter: none; }

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 2px dashed var(--border);
}

/* Play view — chrome compact, board gets max space while playing */
#view-play.view {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#view-play.is-playing {
  /* Use remaining viewport under therapy/nav when possible */
  max-height: none;
}

.play-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.play-header h2 {
  margin: 0;
  font-size: 1.15rem;
  text-align: center;
  flex: 1;
  color: var(--primary);
}

.play-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 6px;
  flex-shrink: 0;
}


/* Dual-language learn labels in games (P1) */
.play-learn-lang {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0 0 12px;
  padding: 0.4rem 0.65rem;
  border-radius: 12px;
  background: rgba(26, 95, 122, 0.07);
}
.play-learn-lang[hidden] {
  display: none !important;
}
.play-learn-lang-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text, #1a3a45);
}
.play-learn-lang-select {
  font-size: 1rem;
  min-height: 44px;
  padding: 0.35rem 0.65rem;
  border-radius: 10px;
  border: 1px solid #c5d4dc;
  background: #fff;
  max-width: min(100%, 220px);
}
.game-btn--dual {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  line-height: 1.25;
  min-height: 3.25rem;
}
.game-dual {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.08rem;
}
.game-dual-a {
  font-weight: 700;
  font-size: 1.05em;
}
.game-dual-b {
  font-weight: 500;
  font-size: 0.92em;
  opacity: 0.88;
  color: var(--brand, #1a5f7a);
}
.game-dual-caption {
  margin-top: 0.3rem;
  font-size: 1.05rem;
}
.game-daily-emoji {
  font-size: 1.45rem;
  line-height: 1;
}
.game-prompt--with-caption {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}
.game-btn--dual .color-swatch {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  margin: 0 auto 0.2rem;
  display: block;
}

.play-level-picker {
  margin-bottom: 8px;
  flex-shrink: 0;
}

/* During active play: shrink chrome, grow board */
#view-play.is-playing .play-header {
  margin-bottom: 4px;
}
#view-play.is-playing .play-header h2 {
  font-size: 1rem;
}
#view-play.is-playing .play-meta {
  margin-bottom: 4px;
  gap: 4px;
}
#view-play.is-playing .play-meta .badge {
  font-size: 0.75rem;
  padding: 3px 8px;
  min-height: 0;
}
#view-play.is-playing .play-level-picker {
  margin-bottom: 4px;
}
#view-play.is-playing .play-level-picker .level-chips {
  gap: 4px;
  justify-content: center;
}
#view-play.is-playing .play-level-picker .level-chip {
  min-height: 32px;
  max-width: 36px;
  min-width: 32px;
  aspect-ratio: 1;
  border-radius: 10px;
  border-width: 2px;
  padding: 0;
}
#view-play.is-playing .play-level-picker .level-chip-num {
  font-size: 0.95rem;
}
#view-play.is-playing .play-footer .btn {
  min-height: 44px;
  padding: 8px 14px;
  font-size: 0.95rem;
}
#view-play.is-playing .game-prompt.large,
#view-play.is-playing .game-prompt--compact {
  font-size: 0.95rem;
  margin: 0 0 6px;
  line-height: 1.3;
  font-weight: 600;
}

.game-area {
  background: var(--surface);
  border-radius: var(--radius);
  border: 2px solid var(--border);
  min-height: 320px;
  padding: 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
  overflow: visible;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#view-play.is-playing .game-area {
  flex: 1 1 auto;
  min-height: min(62vh, 560px);
  padding: 10px;
  margin-bottom: 8px;
}

.game-area:has(.memory-dense-xl),
.game-area:has(.memory-dense),
.game-area:has(.memory-mid) {
  padding: 8px;
  min-height: 0;
}

#view-play.is-playing .game-area:has(.memory-grid) {
  min-height: min(68vh, 640px);
}

.play-footer {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

/* Level picker – gut sichtbar & tippbar */
.level-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
}

.level-picker-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  margin-bottom: 4px;
}
.level-picker-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: 0.02em;
}
.level-picker-scale {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  line-height: 1.25;
  letter-spacing: 0.01em;
}

.level-chips {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  width: 100%;
}

.level-chip {
  flex: 1 1 0;
  min-width: 0;
  min-height: 48px;
  aspect-ratio: 1;
  max-width: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: #f4fafb;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
}

.level-chip:hover {
  border-color: var(--primary);
  background: #e8f5f3;
}

.level-chip:active {
  transform: scale(0.97);
}

.level-chip.is-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(20, 120, 130, 0.28);
}

.level-chip-num {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
}

/* Text labels removed from chips — scale under "Stufe wählen" */
.level-chip-hint {
  display: none;
}

.level-picker--sm .level-chip {
  min-height: 40px;
  max-width: 48px;
  border-radius: 12px;
  padding: 2px;
}

.level-picker--sm .level-chip-num {
  font-size: 1.15rem;
}

.level-picker--lg .level-chip {
  min-height: 56px;
  max-width: 64px;
  border-radius: 16px;
}

.level-picker--lg .level-chip-num {
  font-size: 1.55rem;
}

.level-picker--card {
  margin-top: 10px;
}

.game-card--preview .game-info {
  min-width: 0;
}

.game-card--preview .level-picker--card {
  margin-top: auto;
  padding-top: 8px;
}

.badge-level {
  background: var(--primary);
  color: #fff;
}

.complete-screen {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  max-width: 520px;
  margin: 0 auto;
}

.complete-ratio {
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  margin: 0;
}

.complete-level-label {
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  margin: 0;
}

.complete-level-hint {
  text-align: center;
  font-size: 0.95rem;
  color: var(--primary);
  font-weight: 600;
  margin: 8px 0 0;
}

.level-up-banner {
  text-align: center;
  margin: 4px 0;
  padding: 12px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #e8faf0, #d4f0ff);
  border: 2px solid #3cb371;
  color: #1a6b3c;
  font-weight: 800;
  font-size: 1.1rem;
}

.complete-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
}

.play-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

/* Generic game UI */
.game-prompt {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 18px;
  color: var(--text);
}

.game-prompt.large { font-size: 1.6rem; }

.game-grid {
  display: grid;
  gap: 12px;
  justify-content: center;
}

.game-grid.cols-2 { grid-template-columns: repeat(2, minmax(100px, 1fr)); }
.game-grid.cols-3 { grid-template-columns: repeat(3, minmax(90px, 1fr)); }
.game-grid.cols-4 { grid-template-columns: repeat(4, minmax(72px, 1fr)); }

/* Memory: adaptive columns, denser when many tiles (Stufe 5 = 20, 5×4) */
.game-grid.memory-grid {
  --memory-cols: 3;
  --memory-rows: 3;
  display: grid;
  grid-template-columns: repeat(var(--memory-cols), minmax(0, 1fr));
  grid-template-rows: repeat(var(--memory-rows), minmax(0, 1fr));
  gap: 12px;
  max-width: min(960px, 100%);
  width: 100%;
  margin: 0 auto;
}

.game-grid.memory-grid.memory-cols-3 { --memory-cols: 3; max-width: 720px; }
.game-grid.memory-grid.memory-cols-4 { --memory-cols: 4; max-width: 860px; }
.game-grid.memory-grid.memory-cols-5 { --memory-cols: 5; max-width: 980px; }

.game-btn {
  min-height: 72px;
  min-width: 72px;
  border-radius: 16px;
  border: 3px solid var(--border);
  background: #f8fbfc;
  font-size: 1.35rem;
  font-weight: 700;
  cursor: pointer;
  padding: 12px;
  transition: background 0.12s, border-color 0.12s, transform 0.1s;
}

.game-btn.memory-tile {
  /* Symbol size tracks actual tile size (few tiles → bigger pictograms) */
  container-type: size;
  container-name: memtile;
  min-height: 0;
  height: 100%;
  aspect-ratio: 5 / 4;
  width: 100%;
  border-radius: 16px;
  border-width: 3px;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Stufe 1: large friendly tiles */
.memory-grid.memory-large {
  gap: 14px;
  max-height: none;
}
.memory-grid.memory-large .game-btn.memory-tile,
.memory-grid.memory-large .game-btn.memory-blank {
  min-height: 120px;
  border-radius: 18px;
  border-width: 4px;
  padding: 6px;
}

/* Mid density — fill play area */
.memory-grid.memory-mid {
  gap: 10px;
  flex: 1 1 auto;
  height: min(58vh, 480px);
  max-height: min(62vh, 520px);
  width: 100%;
  max-width: none;
}
.memory-grid.memory-mid .game-btn.memory-tile,
.memory-grid.memory-mid .game-btn.memory-blank {
  aspect-ratio: auto;
  min-height: 0;
  height: 100%;
  padding: 4px;
}

/* Dense (16–20 tiles) — keep readable min size on iPad Pro */
.memory-grid.memory-dense {
  gap: 8px;
  flex: 1 1 auto;
  height: min(60vh, 500px);
  max-height: min(64vh, 540px);
  width: 100%;
  max-width: none;
}
.memory-grid.memory-dense .game-btn.memory-tile,
.memory-grid.memory-dense .game-btn.memory-blank {
  aspect-ratio: auto;
  border-radius: 12px;
  border-width: 3px;
  padding: 3px;
  min-height: 56px;
  height: 100%;
}

/* L5: up to 24 tiles — larger min cell than old 30-tile layout */
.memory-grid.memory-dense-xl {
  gap: 7px;
  flex: 1 1 auto;
  height: min(64vh, 560px);
  max-height: min(70vh, 620px);
  width: 100%;
  max-width: none;
}
.memory-grid.memory-dense-xl .game-btn.memory-tile,
.memory-grid.memory-dense-xl .game-btn.memory-blank {
  aspect-ratio: auto;
  border-radius: 12px;
  border-width: 2px;
  padding: 3px;
  min-height: 52px;
  height: 100%;
}

/* General game choices: care-friendly min size (iPad Pro) */
.game-grid .game-btn:not(.memory-tile) {
  min-height: 64px;
  min-width: 64px;
  font-size: clamp(1.05rem, 2.2vw, 1.4rem);
}
@media (min-width: 900px) and (orientation: landscape) {
  .game-grid .game-btn:not(.memory-tile) {
    min-height: 72px;
    min-width: 72px;
  }
}

/* Intro demos: Sudoku + Pyramid */
.demo-sudoku {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  width: 120px;
  margin: 0 auto 12px;
}
.demo-sudoku-cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid var(--primary);
  border-radius: 8px;
  font-weight: 800;
  background: #fff;
}
.demo-sudoku-cell.is-empty { color: var(--muted); background: #f0f7f8; }
.demo-sudoku-cell.is-ok { background: #dcfce7; border-color: #15803d; }
.demo-pyramid { margin: 0 auto 12px; }
.demo-pyr-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
}
.demo-pyr-cell {
  min-width: 40px;
  min-height: 40px;
  display: grid;
  place-items: center;
  border: 2px solid var(--primary);
  border-radius: 8px;
  font-weight: 800;
  background: #fff;
}
.demo-pyr-cell.is-empty { color: var(--muted); background: #f0f7f8; }
.demo-pyr-cell.is-ok { background: #dcfce7; border-color: #15803d; }

.demo-tictac {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
  width: min(180px, 48vw);
  margin: 0 auto 12px;
  background: #4a5568;
  padding: 3px;
  border-radius: 10px;
}
.demo-tt-cell {
  aspect-ratio: 1;
  background: #f4f6f8;
  border-radius: 4px;
  position: relative;
}
.demo-tt-cell.is-o::after {
  content: "";
  position: absolute;
  inset: 16%;
  border: 4px solid #e6a817;
  border-radius: 50%;
  box-sizing: border-box;
}
.demo-tt-cell.is-x::before,
.demo-tt-cell.is-x::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72%;
  height: 4px;
  background: #1a56db;
  border-radius: 2px;
}
.demo-tt-cell.is-x::before { transform: translate(-50%, -50%) rotate(45deg); }
.demo-tt-cell.is-x::after { transform: translate(-50%, -50%) rotate(-45deg); }
.demo-tt-cell.is-target { outline: 2px dashed var(--accent); outline-offset: -2px; }
.demo-tt-cell.is-ok { background: #e8f5e9; }
.demo-tt-cell.is-win { background: #fff3c4; box-shadow: inset 0 0 0 2px #e6b800; }
.intro-replay-hint {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.3;
  text-align: center;
}

/*
 * Pictograms scale with the tile (cqmin = % of smaller tile side).
 * Fallback: large vw clamp when container units unsupported.
 * ~80% of tile → big on L1, still clearly larger on L5 than fixed rem.
 */
.game-btn.memory-tile .memory-emoji {
  font-size: clamp(2.6rem, 8vw, 4.8rem);
  line-height: 1;
  display: block;
  max-width: 100%;
  max-height: 100%;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.game-btn.memory-tile .memory-back {
  font-size: clamp(2rem, 6vw, 3.2rem);
  opacity: 0.9;
  line-height: 1;
  pointer-events: none;
}

@supports (font-size: 1cqmin) {
  .game-btn.memory-tile .memory-emoji {
    /* Fill most of the tile — adapts automatically to density */
    font-size: 82cqmin;
  }
  .game-btn.memory-tile .memory-back {
    font-size: 58cqmin;
  }
  /* Few tiles: slightly more room for the glyph */
  .memory-grid.memory-large .game-btn.memory-tile .memory-emoji {
    font-size: 86cqmin;
  }
  .memory-grid.memory-large .game-btn.memory-tile .memory-back {
    font-size: 62cqmin;
  }
  /* Many tiles (L4/L5): still aggressive fill of the smaller cell */
  .memory-grid.memory-dense .game-btn.memory-tile .memory-emoji,
  .memory-grid.memory-dense-xl .game-btn.memory-tile .memory-emoji {
    font-size: 80cqmin;
  }
  .memory-grid.memory-dense .game-btn.memory-tile .memory-back,
  .memory-grid.memory-dense-xl .game-btn.memory-tile .memory-back {
    font-size: 56cqmin;
  }
}

.game-btn.memory-tile.hidden-face {
  background: linear-gradient(145deg, #1a5f7a, #134a5f);
  color: #fff;
}

.game-btn.memory-tile.revealed,
.game-btn.memory-tile.matched {
  background: #fff;
}

.game-btn.memory-blank {
  min-height: 0;
  aspect-ratio: 5 / 4;
  border: 3px dashed transparent;
  background: transparent;
  pointer-events: none;
  cursor: default;
  box-shadow: none;
}

/* Landscape / iPad: board uses most of the height */
@media (orientation: landscape) and (min-width: 700px) {
  #view-play.is-playing .game-area {
    min-height: min(72vh, 620px);
  }
  .memory-grid.memory-mid {
    height: min(68vh, 480px);
    max-height: min(72vh, 520px);
  }
  .memory-grid.memory-dense {
    height: min(70vh, 500px);
    max-height: min(74vh, 540px);
  }
  .memory-grid.memory-dense-xl {
    height: min(72vh, 520px);
    max-height: min(76vh, 560px);
    gap: 8px;
    max-width: min(1200px, 98vw);
  }
}

@media (min-width: 700px) {
  .memory-grid.memory-large .game-btn.memory-tile,
  .memory-grid.memory-large .game-btn.memory-blank {
    min-height: 150px;
  }
}

/* Sequence: big thick color buttons */
.game-grid.sequence-grid {
  max-width: 520px;
  margin: 0 auto;
  gap: 14px;
}

.game-btn.sequence-btn {
  container-type: size;
  min-height: 110px;
  border-width: 5px;
  border-radius: 20px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f4fafb;
  overflow: hidden;
}

.game-btn.sequence-btn .sequence-emoji {
  font-size: clamp(3.2rem, 12vw, 5rem);
  line-height: 1;
  display: block;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.12));
  pointer-events: none;
}

@supports (font-size: 1cqmin) {
  .game-btn.sequence-btn .sequence-emoji {
    font-size: 72cqmin;
  }
}

@media (min-width: 700px) {
  .game-btn.sequence-btn {
    min-height: 130px;
  }
}

.game-btn:active { transform: scale(0.96); }

.game-btn.correct {
  background: #d8f5e3;
  border-color: var(--success);
  color: var(--success);
}

.game-btn.wrong {
  background: #fdeaea;
  border-color: var(--danger);
  color: var(--danger);
}

.game-btn.selected {
  border-color: var(--primary);
  background: #e0f0f6;
}

.game-btn.hidden-face {
  background: var(--primary);
  color: transparent;
  font-size: 0;
}

.game-btn.revealed {
  background: #fff;
  color: var(--text);
  font-size: 1.8rem;
}

.game-btn.matched {
  opacity: 0.45;
  pointer-events: none;
  background: #d8f5e3;
  border-color: var(--success);
}

.color-swatch {
  width: 100%;
  min-height: 80px;
  border-radius: 14px;
  border: 3px solid rgba(0,0,0,0.08);
}

.feedback {
  text-align: center;
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 14px;
  min-height: 1.5em;
}

.feedback.ok { color: var(--success); }
.feedback.bad { color: var(--danger); }

.sequence-display {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 18px;
  min-height: 70px;
}

.seq-item {
  width: 80px; height: 80px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 2.4rem;
  background: #eef6f9;
  border: 4px solid var(--border);
  transition: transform 0.12s, outline 0.12s, background 0.12s;
}

.seq-item.flash {
  outline: 6px solid var(--accent);
  transform: scale(1.14);
  background: #fff8e6;
  border-color: var(--accent);
}

@media (min-width: 700px) {
  .seq-item {
    width: 96px;
    height: 96px;
    font-size: 2.9rem;
    border-width: 5px;
  }
}

/* Progress */
.progress-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
}

.stat-card .num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  display: block;
}

.stat-card .lbl {
  color: var(--muted);
  font-size: 0.9rem;
}

.progress-list { display: flex; flex-direction: column; gap: 10px; }

.progress-row {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: grid;
  gap: 8px;
}

.progress-row-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.progress-row h3 { margin: 0; font-size: 1.05rem; }

.bar {
  height: 12px;
  background: #e4eef2;
  border-radius: 999px;
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: 999px;
  min-width: 4px;
  transition: width 0.3s ease;
}

.progress-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Profile */
.input-large {
  width: 100%;
  min-height: 64px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border: 3px solid var(--border);
  margin: 8px 0 14px;
  font-size: 1.15rem;
}

.users-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: #f8fbfc;
}

.user-row.active {
  border-color: var(--accent);
  background: #e8faf7;
}

.user-row button {
  min-height: 48px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
}

/* Slim legal footer — always visible, non-intrusive */
.app-footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.78rem;
  margin: 20px 0 8px;
  padding: 10px 8px calc(10px + var(--safe-bottom, 0px));
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.app-footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 4px 2px;
}
.app-footer-link {
  background: none;
  border: none;
  color: var(--primary);
  font: inherit;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 6px 8px;
  min-height: 36px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.app-footer-link:hover,
.app-footer-link:focus-visible {
  color: var(--primary-dark, #0d5c66);
}
.app-footer-sep {
  opacity: 0.45;
  user-select: none;
}
body.is-playing .app-footer {
  display: none;
}

/* Legal document view */
.legal-body {
  max-width: 720px;
  margin: 0 auto 16px;
  padding: 4px 4px 12px;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.45;
}
.legal-body h2 {
  margin: 0 0 12px;
  color: var(--primary);
  font-size: 1.35rem;
}
.legal-body h3 {
  margin: 18px 0 8px;
  font-size: 1.05rem;
  color: var(--text);
}
.legal-body p,
.legal-body ul {
  margin: 0 0 10px;
}
.legal-body ul {
  padding-left: 1.2rem;
}
.legal-lead {
  font-weight: 600;
}
.legal-muted,
.legal-ver {
  color: var(--muted);
  font-size: 0.88rem;
}
.legal-links-block {
  list-style: none;
  padding: 0;
}
.legal-links-block a {
  color: var(--primary);
  font-weight: 700;
  display: inline-block;
  padding: 8px 0;
}
.legal-role-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.legal-contact-card {
  max-width: 520px;
  margin: 0 auto 20px;
  padding: 14px 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
}
.legal-contact-card label {
  display: block;
  margin: 10px 0 4px;
  font-weight: 600;
  font-size: 0.9rem;
}
.legal-contact-card .btn {
  margin-top: 12px;
  width: 100%;
}
/* Honeypot off-screen — bots fill it, humans never see it */
.legal-hp {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  transform: translateX(-50%) translateY(120%);
  background: var(--text);
  color: #fff;
  padding: 14px 22px;
  border-radius: 999px;
  font-weight: 600;
  z-index: 10050;
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  max-width: 90vw;
  text-align: center;
  pointer-events: none;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Sort / drop zones */
.bins {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.bin {
  min-height: 90px;
  border: 3px dashed var(--border);
  border-radius: 14px;
  padding: 10px;
  text-align: center;
  font-weight: 700;
  color: var(--muted);
}

.bin.target-active {
  border-color: var(--accent);
  background: #e8faf7;
}

.item-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 14px 0;
}

.pool-item {
  min-height: 64px;
  min-width: 64px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 3px solid var(--border);
  background: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  font-weight: 700;
}

.pool-item.used { opacity: 0.3; pointer-events: none; }

/* Timer bar for attention games */
.timer-bar {
  height: 10px;
  background: #e4eef2;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}

.timer-bar > span {
  display: block;
  height: 100%;
  background: var(--warning);
  width: 100%;
  transition: width linear;
}

/* iPad landscape / large */
@media (min-width: 900px) {
  html { font-size: 20px; }
  .game-area { min-height: 420px; padding: 28px; }
  .game-btn { min-height: 88px; font-size: 1.5rem; }
}

/* Affirmation voice samples */
.aff-voice-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 16px;
  margin: 8px 0 12px;
}

.aff-voice-select-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.aff-voice-select-wrap label {
  margin: 0;
  font-size: 0.9rem;
}

.sound-select--compact {
  min-width: 120px;
  max-width: 160px;
  width: 140px;
  padding: 8px 10px;
  min-height: 44px;
}

.input-compact {
  max-width: 120px;
}

.aff-voice-samples {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.btn-sample {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #eef7f6;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-sample:hover {
  border-color: var(--primary);
  background: #e0f3f0;
}

.btn-sample.is-playing {
  border-color: var(--accent);
  background: #fff6e0;
  box-shadow: 0 0 0 3px rgba(232, 168, 56, 0.25);
}

.btn-sample-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.btn-sample-label {
  font-weight: 700;
}

/* Affirmations */
.aff-card h3 {
  margin: 16px 0 8px;
  color: var(--primary);
  font-size: 1.1rem;
}
.aff-card h3:first-child { margin-top: 0; }
.aff-card label {
  display: block;
  font-weight: 600;
  margin: 10px 0 4px;
  color: var(--muted);
  font-size: 0.95rem;
}
.aff-themes {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 12px;
}
.aff-theme-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f8fbfc;
  cursor: pointer;
  min-height: 56px;
}
.aff-theme-row input {
  width: 22px;
  height: 22px;
  margin-top: 4px;
  flex-shrink: 0;
}
.aff-theme-row strong { display: block; font-size: 1.05rem; }
.aff-theme-row small { color: var(--muted); font-size: 0.88rem; }
.aff-textarea {
  min-height: 96px;
  resize: vertical;
  font-size: 1.05rem;
  line-height: 1.4;
}
.aff-custom-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.aff-custom-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: #fff;
}
.aff-custom-list li span { flex: 1; }
.aff-custom-list button {
  min-height: 44px;
  min-width: 44px;
  border-radius: 10px;
  border: 2px solid #f0c4c4;
  background: #fdeaea;
  color: var(--danger);
  cursor: pointer;
  font-weight: 700;
}
.aff-controls {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.aff-check {
  display: flex !important;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  min-height: 48px;
}
.aff-check input { width: 22px; height: 22px; }

.profile-name-hint {
  margin: 6px 0 14px;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.35;
}

.facility-card h3 {
  margin-top: 0;
}
.facility-session-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  border: 1px solid var(--border);
}
.facility-session-bar p {
  margin: 0;
  font-weight: 600;
}
.facility-setup h4 {
  margin: 16px 0 8px;
  font-size: 1rem;
}

.facility-client-row {
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
}
.facility-client-main {
  flex: 1 1 140px;
  min-width: 0;
}
.facility-client-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.facility-client-actions .btn-sm {
  min-height: 40px;
  padding: 6px 10px;
  font-size: 0.85rem;
}
.facility-client-actions .btn-sm.is-locked {
  border-color: #c45c26;
  color: #8a3a10;
  background: #fff5ee;
}
.badge-light-lock {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: #8a3a10;
  background: #ffe8d9;
  border-radius: 999px;
  padding: 2px 8px;
}
.facility-max-level {
  min-height: 40px;
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 4px 8px;
  font-weight: 700;
  background: var(--surface);
}
.facility-pin-wrap,
.facility-billing-wrap {
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fbfc;
}
.facility-billing-wrap label {
  display: block;
  margin-top: 10px;
  font-weight: 600;
  font-size: 0.9rem;
}
.facility-billing-invoices {
  margin: 8px 0 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
  color: var(--text-muted, #6b7280);
  list-style: disc;
}

.facility-billing-select,
.facility-billing-wrap .input-large {
  margin-top: 4px;
}
.facility-check {
  display: flex !important;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-weight: 600;
}
.facility-check input {
  width: 20px;
  height: 20px;
}
.facility-pin-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.facility-pin-row .input-large {
  flex: 1 1 120px;
  max-width: 200px;
}
.facility-activity-ul {
  margin: 0;
  padding-left: 1.2em;
  color: var(--muted);
  font-size: 0.92rem;
}
.btn-facility-end-float {
  position: fixed;
  right: 12px;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  z-index: 8500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 2px solid var(--primary);
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 6px 20px rgba(26, 95, 122, 0.35);
  touch-action: manipulation;
}
.btn-facility-end-float[hidden] {
  display: none !important;
}
body.client-mode .btn-facility-end-float:not([hidden]) {
  display: inline-flex;
}
/* Client mode: reduce accidental staff chrome */
body.client-mode #facility-setup,
body.client-mode #facility-pin-wrap,
body.client-mode #facility-roster-wrap {
  /* roster only when profile opened with PIN */
}
#btn-light.is-locked,
#btn-light:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.aff-subliminal-hint {
  margin: 6px 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #eef7f6;
  border: 1px solid #c5e4df;
  color: #1a4a55;
  font-size: 0.92rem;
  line-height: 1.4;
  font-weight: 600;
}
.aff-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.aff-api-status {
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.3em;
}
.aff-now {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
  min-height: 1.5em;
  text-align: center;
  padding: 10px;
  background: #e8f7f5;
  border-radius: var(--radius-sm);
}

/* Erickson stories */
.stories-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 12px;
}

.story-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.story-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.story-card h3 {
  margin: 0 0 4px;
  font-size: 1.2rem;
  color: var(--primary);
}

.story-card .story-conflict {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  color: #8a5a00;
  background: #fff3d6;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.story-card .story-preview {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.45;
  margin: 0 0 14px;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.story-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.story-actions .btn {
  flex: 1 1 140px;
  min-height: 56px;
  font-weight: 700;
}

.story-now-box {
  margin: 14px 0;
  padding: 14px 16px;
  background: #e8f7f5;
  border-radius: var(--radius-sm);
  border: 2px solid #c5ebe4;
  min-height: 80px;
}

.story-now-box strong {
  display: block;
  color: var(--primary);
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.story-now-text {
  margin: 0;
  color: var(--text);
  line-height: 1.5;
  font-size: 1.05rem;
}

/* Reduce motion: disable 40Hz animation if user prefers */
@media (prefers-reduced-motion: reduce) {
  .light-overlay.active {
    animation: none;
    opacity: 0.15;
  }
}

/* ===== Home hero (~2× earlier visual height ~220–280px → ~440–560px) =====
   Images are position:absolute → height from container min/max only.
   Do NOT fill remaining viewport (that became ~3–4×). */
.home-hero-layout {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 16px;
  align-items: stretch;
  height: auto;
  min-height: 0;
  max-height: min(58vh, 560px);
}

.hero-banner {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  /* ~2× old min-height 220px; capped by vh so max-height is never exceeded */
  min-height: min(440px, 48vh);
  height: 100%;
  box-shadow: var(--shadow);
  border: 2px solid var(--border);
  background: #1a5f7a;
}

.hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}

.hero-img-primary {
  opacity: 1;
  animation: heroCross 14s ease-in-out infinite;
}

.hero-img-secondary {
  opacity: 0;
  animation: heroCross 14s ease-in-out infinite reverse;
}

@keyframes heroCross {
  0%, 42% { opacity: 1; }
  50%, 92% { opacity: 0; }
  100% { opacity: 1; }
}

.hero-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 18px 14px;
  background: linear-gradient(transparent, rgba(12, 48, 62, 0.82));
  color: #fff;
  z-index: 2;
}

.hero-overlay h2 {
  margin: 0 0 4px;
  font-size: clamp(1.2rem, 2.4vw, 1.55rem);
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.hero-overlay p {
  margin: 0;
  font-size: clamp(0.9rem, 1.6vw, 1.05rem);
  opacity: 0.95;
  font-weight: 600;
}

.welcome-card--compact {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 12px;
  padding: 18px 18px 16px;
  overflow: auto;
  min-height: 0;
  height: 100%;
}

.welcome-card--compact .home-intro-short {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.4;
}

.welcome-card--compact .user-chip {
  align-self: flex-start;
}

/* Right column: useful orientation (not a second tab bar) */
.home-side-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--primary);
}
.home-orient-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.home-orient-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, var(--primary) 8%);
  font-size: 0.92rem;
  line-height: 1.35;
  color: var(--text);
  font-weight: 600;
}
.home-orient-icon {
  flex-shrink: 0;
  font-size: 1.25rem;
  line-height: 1.2;
  width: 1.5em;
  text-align: center;
}
.home-orient-list strong {
  color: var(--primary);
  font-weight: 800;
}
.home-side-tip {
  margin: auto 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 2px dashed color-mix(in srgb, var(--primary) 40%, var(--border));
  background: #f0f9fb;
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--muted);
  font-weight: 600;
}

.quick-grid--home {
  margin-bottom: 0;
  gap: 8px;
}

.quick-grid--home .quick-card {
  min-height: 72px;
  padding: 8px;
  font-size: 0.92rem;
}

.quick-grid--home .quick-emoji {
  font-size: 1.5rem;
}

@media (max-width: 820px), (orientation: portrait) {
  .home-hero-layout {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
    min-height: 0;
  }
  .hero-banner {
    /* ~2× old portrait min 180px / max 32vh */
    min-height: min(360px, 36vh);
    max-height: min(40vh, 400px);
  }
}

@media (orientation: landscape) and (min-width: 700px) {
  #view-home.view {
    overflow: hidden;
  }
  .home-hero-layout {
    /* ~2× earlier visual (~220–280) → ~440–560, not full viewport */
    max-height: min(56vh, 560px);
    min-height: 0;
    height: auto;
  }
  .hero-banner {
    min-height: min(440px, 48vh);
    height: 100%;
  }
}

@media (orientation: landscape) and (min-width: 1000px) {
  .home-hero-layout {
    max-height: min(58vh, 560px);
  }
  .hero-banner {
    min-height: min(460px, 50vh);
  }
}

/* ===== Game intro overlay (once per user, landscape, no scroll) ===== */
.game-intro {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(12, 40, 52, 0.55);
  backdrop-filter: blur(4px);
}

.game-intro.is-open,
.game-intro:not([hidden]) {
  display: flex;
}

.game-intro[hidden] {
  display: none !important;
}

.intro-card {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 0;
  width: min(920px, 96vw);
  max-height: min(88vh, 520px);
  background: var(--surface);
  border-radius: 22px;
  border: 3px solid var(--border);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.intro-left {
  padding: 18px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

.intro-emoji {
  font-size: 2.4rem;
  line-height: 1;
}

.intro-title {
  margin: 0 0 6px;
  font-size: clamp(1.25rem, 2.5vw, 1.55rem);
  color: var(--primary);
}

.intro-label {
  margin: 6px 0 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
  opacity: 0.85;
}

.intro-goal,
.intro-how {
  margin: 2px 0 0;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.intro-areas {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.intro-area-chip {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  background: #e8f5f3;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 700;
  border: 2px solid #c5ebe4;
}

.intro-once {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.intro-right {
  display: flex;
  flex-direction: column;
  background: linear-gradient(160deg, #eef8f7, #f7fbfc 55%, #fff8ef);
  border-left: 2px solid var(--border);
  min-height: 0;
}

.intro-demo {
  position: relative;
  flex: 1;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  gap: 10px;
}

.intro-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 12px 16px 14px;
  flex-wrap: wrap;
}

/* Demo primitives */
.demo-caption {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  text-align: center;
}

.demo-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
}

.demo-grid.demo-memory {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: min(220px, 100%);
}

.demo-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 14px;
  border: 3px solid var(--border);
  background: linear-gradient(145deg, #1a5f7a, #134a5f);
  color: #fff;
  font-size: 1.6rem;
  cursor: default;
  overflow: hidden;
}

.demo-tile .demo-face {
  display: none;
}

.demo-tile .demo-back {
  display: grid;
  place-items: center;
  height: 100%;
  font-weight: 800;
  opacity: 0.9;
}

.demo-tile.is-open,
.demo-tile.is-match {
  background: #fff;
  color: var(--text);
}

.demo-tile.is-open .demo-back,
.demo-tile.is-match .demo-back {
  display: none;
}

.demo-tile.is-open .demo-face,
.demo-tile.is-match .demo-face {
  display: grid;
  place-items: center;
  height: 100%;
  font-size: 1.8rem;
}

.demo-tile.is-match {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(60, 179, 113, 0.35);
}

.demo-color {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  border: 4px solid rgba(0, 0, 0, 0.08);
  background: var(--c);
  cursor: default;
}

.demo-color.is-ok,
.demo-opt.is-ok,
.demo-num.is-ok,
.demo-glow.is-ok {
  outline: 4px solid var(--success);
  transform: scale(1.06);
}

.demo-num,
.demo-opt {
  min-width: 56px;
  min-height: 56px;
  border-radius: 14px;
  border: 3px solid var(--border);
  background: #fff;
  font-size: 1.4rem;
  font-weight: 800;
  cursor: default;
  padding: 8px 12px;
}

.demo-seq-dot {
  font-size: 2.4rem;
  opacity: 0.45;
  transition: transform 0.15s, opacity 0.15s, filter 0.15s;
}

.demo-seq-dot.flash {
  opacity: 1;
  transform: scale(1.25);
  filter: drop-shadow(0 0 8px rgba(255, 200, 0, 0.7));
}

.demo-glow-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 160px;
}

.demo-glow {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  border: 3px solid var(--border);
  background: #e8f0f3;
}

.demo-glow.is-lit {
  background: #ffe08a;
  box-shadow: 0 0 16px rgba(255, 200, 50, 0.65);
}

.demo-path {
  display: flex;
  gap: 8px;
  align-items: center;
}

.demo-path-cell {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 3px solid var(--border);
  display: grid;
  place-items: center;
  font-weight: 800;
  background: #fff;
  color: var(--muted);
}

.demo-path-cell.is-lit {
  background: #d8f5e3;
  border-color: var(--success);
  color: var(--success);
}

.demo-cursor {
  position: absolute;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  border: 3px solid #fff;
  background: rgba(26, 95, 122, 0.55);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  opacity: 0;
  transition: left 0.25s ease, top 0.25s ease, transform 0.12s, opacity 0.15s;
  z-index: 5;
}

.demo-cursor.is-visible {
  opacity: 1;
}

.demo-cursor.is-click {
  transform: scale(0.75);
  background: rgba(230, 120, 40, 0.75);
}

@media (max-width: 700px), (orientation: portrait) and (max-height: 700px) {
  .intro-card {
    grid-template-columns: 1fr;
    max-height: min(92vh, 640px);
  }
  .intro-right {
    border-left: none;
    border-top: 2px solid var(--border);
  }
  .intro-demo {
    min-height: 150px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-img-primary,
  .hero-img-secondary {
    animation: none;
  }
  .hero-img-secondary {
    opacity: 0;
  }
  .demo-cursor {
    transition: none;
  }
}

/* ===== Story wizard (4-step intake) ===== */
.story-wizard-intro {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}
.story-wizard-steps {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}
.story-step-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}
.story-step-dot.is-active {
  border-color: var(--primary);
  background: #e8f4f7;
  color: var(--primary);
}
.story-step-dot.is-done {
  border-color: var(--accent, #57c5b6);
  background: #e8faf7;
  color: #134a5f;
}
.story-wizard-panel h4 {
  margin: 0 0 12px;
  color: var(--primary);
  font-size: 1.1rem;
}
.story-field-label {
  display: block;
  font-weight: 600;
  margin: 12px 0 6px;
  color: var(--muted);
}
.story-wizard-hint {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--muted);
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.chip-row--wrap { flex-wrap: wrap; }
.story-wizard-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  align-items: center;
}
.story-summary {
  background: #f0f7fa;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 12px;
  line-height: 1.45;
  font-size: 1rem;
}
.story-summary p { margin: 0 0 8px; }
.story-summary-note {
  margin-top: 10px !important;
  font-size: 0.88rem;
  color: var(--muted);
}
.story-generated {
  max-height: 50vh;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.5;
  padding: 12px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--border);
}

/* Permanently hide home "Läuft …" strip — status is on layer cards */
.session-status-chip,
#session-status-chip {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
}


/* === Variant H cutover: hide top therapy bar; mixer under Willkommen === */
.therapy-bar--hidden,
.therapy-bar[hidden],
.settings-shell--engine-only .therapy-bar {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  border: 0 !important;
  visibility: hidden !important;
  position: absolute !important;
  left: -9999px !important;
  pointer-events: none !important;
}
/* Engine-only shell: zero layout space; therapy buttons stay in DOM for JS */
.settings-shell--engine-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.br-player-bar--hidden,
.br-player-bar[hidden] {
  display: none !important;
}
.br-home-mixer {
  margin: 18px 0 8px;
  padding: 12px 14px 16px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #ddd5c8);
  border-radius: 16px;
  box-shadow: var(--shadow, 0 1px 4px rgba(0,0,0,.06));
}
.br-home-mixer .settings-toggle {
  width: 100%;
  justify-content: flex-start;
  margin-bottom: 8px;
}
.br-home-mixer .settings-panel {
  margin-top: 4px;
}
.br-home-mixer .settings-panel.is-open,
.br-home-mixer .settings-panel:not(.is-collapsed):not([hidden]) {
  display: block;
}
.br-home-mixer .mixer-bar {
  margin: 0;
  border: 0;
  box-shadow: none;
  padding: 4px 0 0;
}
.br-home-mixer .lesson-course-panel {
  margin-top: 14px;
}

/* ===== Picwords / Wordpic — dual-lang association (large) ===== */
.game-picwords-show {
  margin-bottom: 0.5rem;
}
.game-picwords-emoji {
  font-size: clamp(4.5rem, 18vw, 7rem);
  line-height: 1;
  display: block;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.12));
}
.game-picwords-caption {
  font-size: clamp(1.15rem, 3.5vw, 1.45rem);
  margin-top: 0.4rem;
}
.game-wordpic-word {
  font-size: clamp(1.35rem, 4.5vw, 1.85rem);
  font-weight: 700;
  margin: 0.4rem 0 0.8rem;
  text-align: center;
}
.game-btn--wordpick {
  min-height: 3.6rem;
  font-size: 1.05rem;
  padding: 0.65rem 0.5rem;
}
.game-btn--picpick {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  min-height: 5.5rem;
  padding: 0.5rem 0.35rem;
}
.game-picpick-emoji {
  font-size: clamp(2.4rem, 10vw, 3.4rem);
  line-height: 1;
}
.game-picpick-label {
  font-size: 0.78rem;
  line-height: 1.15;
  text-align: center;
  max-width: 100%;
}
.game-grid--words {
  gap: 0.55rem;
}
.game-grid--pics {
  gap: 0.5rem;
}
.game-grid.cols-4 {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 420px) {
  .game-grid.cols-4 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ===== Finger exercises — CSS hand animations ===== */
.finger-session {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 0.25rem 0 1rem;
}
.finger-top {
  text-align: center;
  width: 100%;
}
.finger-stage-badge {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand, #1a5f7a);
  background: rgba(26, 95, 122, 0.1);
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  margin-bottom: 0.35rem;
}
.finger-title {
  font-size: clamp(1.2rem, 4vw, 1.55rem);
  font-weight: 700;
  line-height: 1.25;
  margin: 0.15rem 0;
}
.finger-hint {
  font-size: 0.95rem;
  opacity: 0.85;
  margin-bottom: 0.25rem;
}
.finger-timer {
  font-size: clamp(1.6rem, 6vw, 2.1rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  color: var(--brand, #1a5f7a);
}
.finger-timer.is-low {
  color: #c0392b;
  animation: finger-pulse 1s ease-in-out infinite;
}
@keyframes finger-pulse {
  50% { opacity: 0.55; }
}
.finger-duration {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
}
.finger-dur-chip {
  border: 2px solid var(--border, #ddd5c8);
  background: #fff;
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}
.finger-dur-chip.is-active {
  border-color: var(--brand, #1a5f7a);
  background: rgba(26, 95, 122, 0.12);
  color: var(--brand, #1a5f7a);
}
.finger-dur-chip:disabled {
  opacity: 0.7;
  cursor: default;
}
.finger-stage {
  width: 100%;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #f7f3eb 0%, #efe8dc 100%);
  border-radius: 20px;
  border: 1px solid var(--border, #ddd5c8);
  padding: 1.25rem 0.75rem;
}
.finger-hands {
  display: flex;
  gap: 2rem;
  align-items: flex-end;
  justify-content: center;
  flex-wrap: wrap;
}
.finger-start-btn {
  width: min(100%, 280px);
  min-height: 3.2rem;
  font-size: 1.1rem;
  font-weight: 700;
}
.finger-done-note {
  font-size: 1.15rem;
  font-weight: 700;
  color: #1e7a45;
  text-align: center;
}

/* Hand figure */
.finger-hand {
  position: relative;
  width: 120px;
  height: 150px;
  transform-origin: 50% 90%;
}
.finger-hand--left {
  transform: scaleX(-1);
}
.finger-palm {
  position: absolute;
  left: 22px;
  bottom: 8px;
  width: 76px;
  height: 70px;
  background: #f0c9a0;
  border-radius: 28px 28px 22px 22px;
  border: 2px solid #d4a574;
  box-shadow: inset 0 -6px 12px rgba(0,0,0,.06);
  z-index: 1;
}
.finger {
  position: absolute;
  bottom: 68px;
  width: 16px;
  height: 52px;
  background: #f0c9a0;
  border: 2px solid #d4a574;
  border-radius: 10px 10px 6px 6px;
  transform-origin: 50% 100%;
  z-index: 2;
}
.finger-joint {
  display: block;
  position: absolute;
  left: 2px;
  right: 2px;
  top: 45%;
  height: 2px;
  background: rgba(180, 120, 70, 0.25);
  border-radius: 1px;
}
.finger-thumb {
  left: 6px;
  bottom: 42px;
  height: 40px;
  width: 18px;
  transform: rotate(-35deg);
  border-radius: 12px;
  z-index: 3;
}
.finger-index { left: 28px; height: 56px; }
.finger-middle { left: 50px; height: 62px; }
.finger-ring { left: 72px; height: 54px; }
.finger-pinky { left: 94px; height: 46px; width: 14px; }

/* --- Animations (slow, care-home friendly) --- */
.finger-hand.is-anim-rest .finger {
  animation: none;
}
.finger-hand.is-anim-fist .finger-index,
.finger-hand.is-anim-fist .finger-middle,
.finger-hand.is-anim-fist .finger-ring,
.finger-hand.is-anim-fist .finger-pinky {
  animation: finger-curl 2s ease-in-out infinite;
}
.finger-hand.is-anim-fist .finger-thumb {
  animation: finger-thumb-in 2s ease-in-out infinite;
}
@keyframes finger-curl {
  0%, 100% { transform: rotateX(0deg) scaleY(1); }
  45%, 55% { transform: rotateX(55deg) scaleY(0.55); }
}
@keyframes finger-thumb-in {
  0%, 100% { transform: rotate(-35deg); }
  45%, 55% { transform: rotate(5deg) translateX(8px); }
}

.finger-hand.is-anim-spread .finger-index { animation: finger-spread-i 2.2s ease-in-out infinite; }
.finger-hand.is-anim-spread .finger-middle { animation: finger-spread-m 2.2s ease-in-out infinite; }
.finger-hand.is-anim-spread .finger-ring { animation: finger-spread-r 2.2s ease-in-out infinite; }
.finger-hand.is-anim-spread .finger-pinky { animation: finger-spread-p 2.2s ease-in-out infinite; }
@keyframes finger-spread-i {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-6px) rotate(-8deg); }
}
@keyframes finger-spread-m {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateY(-4px); }
}
@keyframes finger-spread-r {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px) rotate(6deg); }
}
@keyframes finger-spread-p {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(10px) rotate(12deg); }
}

.finger-hand.is-anim-lift .finger-index { animation: finger-lift 2.5s ease-in-out infinite; animation-delay: 0s; }
.finger-hand.is-anim-lift .finger-middle { animation: finger-lift 2.5s ease-in-out infinite; animation-delay: 0.35s; }
.finger-hand.is-anim-lift .finger-ring { animation: finger-lift 2.5s ease-in-out infinite; animation-delay: 0.7s; }
.finger-hand.is-anim-lift .finger-pinky { animation: finger-lift 2.5s ease-in-out infinite; animation-delay: 1.05s; }
@keyframes finger-lift {
  0%, 20%, 100% { transform: translateY(0); }
  10% { transform: translateY(-14px); }
}

.finger-hand.is-anim-oppose .finger-thumb {
  animation: finger-oppose-thumb 1.5s ease-in-out infinite;
}
.finger-hand.is-anim-oppose .finger-index {
  animation: finger-oppose-tip 6s ease-in-out infinite;
}
.finger-hand.is-anim-oppose .finger-middle {
  animation: finger-oppose-tip 6s ease-in-out infinite;
  animation-delay: 1.5s;
  opacity: 0.95;
}
.finger-hand.is-anim-oppose .finger-ring {
  animation: finger-oppose-tip 6s ease-in-out infinite;
  animation-delay: 3s;
}
.finger-hand.is-anim-oppose .finger-pinky {
  animation: finger-oppose-tip 6s ease-in-out infinite;
  animation-delay: 4.5s;
}
@keyframes finger-oppose-thumb {
  0%, 100% { transform: rotate(-20deg) translate(4px, -4px); }
  50% { transform: rotate(10deg) translate(14px, -10px); }
}
@keyframes finger-oppose-tip {
  0%, 12%, 100% { transform: rotateX(0); }
  6% { transform: rotateX(40deg) scaleY(0.7); }
}

.finger-hand.is-anim-count .finger-index { animation: finger-count-up 7s steps(1) infinite; }
.finger-hand.is-anim-count .finger-middle { animation: finger-count-up 7s steps(1) infinite; animation-delay: 1.2s; }
.finger-hand.is-anim-count .finger-ring { animation: finger-count-up 7s steps(1) infinite; animation-delay: 2.4s; }
.finger-hand.is-anim-count .finger-pinky { animation: finger-count-up 7s steps(1) infinite; animation-delay: 3.6s; }
.finger-hand.is-anim-count .finger-thumb { animation: finger-count-up 7s steps(1) infinite; animation-delay: 4.8s; }
@keyframes finger-count-up {
  0% { transform: rotateX(60deg) scaleY(0.5); opacity: 0.7; }
  14%, 100% { transform: rotateX(0); opacity: 1; }
}

.finger-hand.is-anim-wave .finger-index { animation: finger-wave 1.8s ease-in-out infinite; animation-delay: 0s; }
.finger-hand.is-anim-wave .finger-middle { animation: finger-wave 1.8s ease-in-out infinite; animation-delay: 0.12s; }
.finger-hand.is-anim-wave .finger-ring { animation: finger-wave 1.8s ease-in-out infinite; animation-delay: 0.24s; }
.finger-hand.is-anim-wave .finger-pinky { animation: finger-wave 1.8s ease-in-out infinite; animation-delay: 0.36s; }
@keyframes finger-wave {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-18deg) translateY(-6px); }
}

.finger-hand.is-anim-pinch .finger-thumb,
.finger-hand.is-anim-pinch .finger-index {
  animation: finger-pinch 1.8s ease-in-out infinite;
}
.finger-hand.is-anim-pinch .finger-thumb {
  animation-name: finger-pinch-thumb;
}
@keyframes finger-pinch {
  0%, 100% { transform: rotateX(0); }
  50% { transform: rotateX(35deg) scaleY(0.75); }
}
@keyframes finger-pinch-thumb {
  0%, 100% { transform: rotate(-30deg); }
  50% { transform: rotate(5deg) translate(12px, -8px); }
}

.finger-hand.is-anim-ok .finger-thumb {
  animation: finger-ok-thumb 2s ease-in-out infinite;
}
.finger-hand.is-anim-ok .finger-index {
  animation: finger-ok-index 2s ease-in-out infinite;
}
@keyframes finger-ok-thumb {
  0%, 40%, 100% { transform: rotate(-35deg); }
  50%, 90% { transform: rotate(15deg) translate(16px, -12px); }
}
@keyframes finger-ok-index {
  0%, 40%, 100% { transform: rotateX(0); }
  50%, 90% { transform: rotateX(50deg) scaleY(0.6); }
}

.finger-hand.is-anim-circle .finger-thumb {
  animation: finger-circle 2s linear infinite;
}
@keyframes finger-circle {
  0% { transform: rotate(-40deg) translate(0, 0); }
  25% { transform: rotate(-10deg) translate(8px, -12px); }
  50% { transform: rotate(20deg) translate(14px, -4px); }
  75% { transform: rotate(-5deg) translate(6px, 4px); }
  100% { transform: rotate(-40deg) translate(0, 0); }
}

.finger-hand.is-anim-point .finger-middle,
.finger-hand.is-anim-point .finger-ring,
.finger-hand.is-anim-point .finger-pinky {
  animation: finger-curl 2s ease-in-out infinite;
}
.finger-hand.is-anim-point .finger-index {
  animation: finger-point 2s ease-in-out infinite;
}
@keyframes finger-point {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.finger-hand.is-anim-hook .finger-index,
.finger-hand.is-anim-hook .finger-middle,
.finger-hand.is-anim-hook .finger-ring,
.finger-hand.is-anim-hook .finger-pinky {
  animation: finger-hook 2.2s ease-in-out infinite;
}
@keyframes finger-hook {
  0%, 100% { transform: rotateX(20deg) scaleY(0.85); border-radius: 10px 10px 14px 14px; }
  50% { transform: rotateX(50deg) scaleY(0.55); }
}

.finger-hand.is-anim-tap .finger-index { animation: finger-tap 1.6s ease-in-out infinite; animation-delay: 0s; }
.finger-hand.is-anim-tap .finger-middle { animation: finger-tap 1.6s ease-in-out infinite; animation-delay: 0.2s; }
.finger-hand.is-anim-tap .finger-ring { animation: finger-tap 1.6s ease-in-out infinite; animation-delay: 0.4s; }
.finger-hand.is-anim-tap .finger-pinky { animation: finger-tap 1.6s ease-in-out infinite; animation-delay: 0.6s; }
@keyframes finger-tap {
  0%, 100% { transform: translateY(0); }
  30% { transform: translateY(8px); }
  50% { transform: translateY(0); }
}

.finger-hand.is-anim-scissors .finger-index,
.finger-hand.is-anim-scissors .finger-middle {
  animation: finger-scissors 1.5s ease-in-out infinite;
}
.finger-hand.is-anim-scissors .finger-middle {
  animation-delay: 0.15s;
}
.finger-hand.is-anim-scissors .finger-ring,
.finger-hand.is-anim-scissors .finger-pinky,
.finger-hand.is-anim-scissors .finger-thumb {
  animation: finger-curl 1.5s ease-in-out infinite;
  animation-fill-mode: both;
}
@keyframes finger-scissors {
  0%, 100% { transform: rotate(-8deg); }
  50% { transform: rotate(10deg) translateY(-4px); }
}

@media (prefers-reduced-motion: reduce) {
  .finger-hand .finger {
    animation-duration: 4s !important;
  }
}

/* ===== Finger exercises — realistic video clips ===== */
.finger-stage--video {
  min-height: 260px;
  padding: 0.75rem;
  background: #1a1a1a;
  border: none;
}
.finger-media {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
}
.finger-video-slot {
  flex: 1 1 200px;
  max-width: min(100%, 360px);
  border-radius: 16px;
  overflow: hidden;
  background: #111;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}
.finger-video-slot--mirror {
  transform: scaleX(-1);
}
.finger-video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #111;
}
.finger-still {
  display: block;
  width: min(100%, 320px);
  max-height: 320px;
  object-fit: contain;
  border-radius: 16px;
  margin: 0 auto;
}
.finger-controls {
  display: flex;
  gap: 0.65rem;
  justify-content: center;
  flex-wrap: wrap;
  width: 100%;
}
.finger-start-btn,
.finger-stop-btn {
  width: min(100%, 220px);
  min-height: 3.2rem;
  font-size: 1.1rem;
  font-weight: 700;
}
.finger-stop-btn {
  background: #fff;
  color: #b33;
  border: 2px solid #c44;
}
.finger-stop-btn:hover:not(:disabled) {
  background: #fdeaea;
}
.finger-stop-btn:disabled {
  opacity: 0.6;
}
.finger-done-note.is-stopped {
  color: #8a5a00;
}
@media (prefers-reduced-motion: reduce) {
  .finger-video {
    /* still play; motion is the exercise content */
  }
}

/* BR-01/02/03: files hub, settings page, user delete */

.files-list { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 4px; }

.files-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); border: 2px solid var(--border); background: #f8fbfc; }

.files-row.has-file { border-color: var(--accent); background: #eefaf6; }

.files-row-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }

.files-row-meta { color: var(--muted); font-size: 0.9rem; }

.files-row-actions, .files-actions-row, .user-row-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.user-row-meta { min-width: 0; flex: 1; }

.btn-user-delete { min-height: 48px; padding: 8px 14px; border-radius: 10px; border: 2px solid #e2a0a0; background: #fff5f5; color: #a33; cursor: pointer; font-weight: 600; }

.btn-user-delete:hover, .btn-user-delete:focus { border-color: #c44; outline: none; }

.settings-lang-select { max-width: 100%; width: 100%; }

#new-user-modal .modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

#new-user-error { color: #a33; margin-top: 6px; }

#delete-user-modal .modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
#delete-user-modal .btn-danger { min-height: 48px; }

#delete-user-message { white-space: pre-line; }


/* BR-SK-01/03/04 — KI-Kurs Texte + Live-Label + Folgemonat */
.cw-live-label {
  margin: 0.4rem 0 0.75rem;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  background: rgba(90, 140, 200, 0.12);
  border: 1px solid rgba(90, 140, 200, 0.28);
  font-size: 0.92rem;
  font-weight: 600;
}
.cw-continue-progress {
  margin: 0.5rem 0 0.75rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: rgba(60, 160, 120, 0.1);
  border: 1px solid rgba(60, 160, 120, 0.28);
}
.cw-continue-line {
  margin: 0 0 0.35rem;
}
.lesson-series-progress {
  margin: 0.35rem 0 0.5rem;
  font-size: 0.88rem;
  opacity: 0.92;
}
.lesson-text-view {
  margin: 0.5rem 0 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  max-height: 280px;
  overflow: auto;
}
.lesson-text-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
  font-size: 0.92rem;
}
.lesson-text-pending {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  opacity: 0.85;
}
.lesson-text-body {
  margin: 0;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.86rem;
  line-height: 1.45;
}
.lesson-track-list li[data-lesson-idx] {
  cursor: pointer;
}
.lesson-track-list li[data-lesson-idx]:hover {
  background: rgba(90, 140, 200, 0.12);
}
