/* ========================================================================
   mobile-polish.css — Wahren Playbook
   Geteilter Layer für: (1) warm-goldigen Lesemodus + (2) Mobile-Ergonomie
   Eingebunden via <link rel="stylesheet" href="mobile-polish.css">
   Lesemodus aktiviert sich nur, wenn data-theme NICHT "light" ist.
   ======================================================================== */

/* ===== 1. Zwei Modi: warm (Default) ↔ dunkel (= Stadion-Original) =====
   - Default ohne data-brightness: WARM (aufgepumpt, satte Akzentfarben)
   - data-brightness="dunkel": kein Override → file-eigene Stadion-Werte
   - Selektor :not([data-theme="light"]) statt [data-theme="dark"], damit
     auch Files OHNE data-theme-Attribut (Hub, gegner-scout etc.) erfasst werden.
   Light-Theme bleibt komplett separat unangetastet.
*/

/* --- WARM (NEUER STANDARD): warm-goldig "Stadionlicht bei Nacht", aufgepumpt --- */
html:not([data-theme="light"]):not([data-brightness="dunkel"]) {
  --bg: #2e2519;
  --bg2: #3a2e1f;
  --bg3: #4a3a25;
  --surface: rgba(255, 200, 100, .065);
  --surface2: rgba(255, 200, 100, .11);
  --surface3: rgba(255, 200, 100, .17);
  --border: rgba(255, 200, 100, .16);
  --glass-border: rgba(255, 200, 100, .18);
  --text: #ece0c8;
  --text2: #d4be99;
  --bright: #fff5d8;
  --text-bright: #fff5d8;
  --gold: #ffc44d;
  --gold-soft: #ffd166;
  --gold-dim: rgba(255, 196, 77, .16);
  --gold-glow: rgba(255, 196, 77, .45);
  --green: #5dd66f;
  --green-dim: rgba(93, 214, 111, .14);
  --red: #ff5757;
  --red-dim: rgba(255, 87, 87, .14);
  --blue: #4fc3f7;
  --blue-dim: rgba(79, 195, 247, .14);
  --orange: #ffa630;
  --orange-dim: rgba(255, 166, 48, .14);
  --purple: #c77dff;
  --purple-dim: rgba(199, 125, 255, .14);
  --nav-bg: rgba(46, 37, 25, .94);
}

html:not([data-theme="light"]):not([data-brightness="dunkel"]) body {
  background:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(255, 196, 77, .14), transparent 55%),
    radial-gradient(ellipse 100% 60% at 50% 100%, rgba(60, 30, 0, .35), transparent 60%),
    var(--bg);
}

html:not([data-theme="light"]):not([data-brightness="dunkel"]) .card,
html:not([data-theme="light"]):not([data-brightness="dunkel"]) .box,
html:not([data-theme="light"]):not([data-brightness="dunkel"]) .gc,
html:not([data-theme="light"]):not([data-brightness="dunkel"]) .tc,
html:not([data-theme="light"]):not([data-brightness="dunkel"]) .notfall,
html:not([data-theme="light"]):not([data-brightness="dunkel"]) .zone-info {
  box-shadow:
    0 1px 0 rgba(255, 220, 140, .06) inset,
    0 0 0 1px rgba(255, 196, 77, .04);
}

/* ===== 2. Helligkeits-Toggle (Nav-inline + Floating-Fallback) ===== */
.read-mode-btn,
.read-mode-floating {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--gold, rgba(255, 196, 77, .4));
  background: var(--gold-dim, rgba(255, 196, 77, .12));
  color: var(--gold, #ffc44d);
  font-size: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--gold-glow, rgba(255, 196, 77, .2)) inset;
  transition: color .2s, border-color .2s, background .2s, transform .2s, box-shadow .2s;
  touch-action: manipulation;
}

.read-mode-btn:hover,
.read-mode-floating:hover {
  background: var(--gold, #ffc44d);
  color: var(--bg, #2e2519);
  transform: scale(1.05);
  box-shadow: 0 0 14px var(--gold-glow, rgba(255, 196, 77, .5));
}

.read-mode-floating {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: 12px;
  z-index: 160;
  width: 48px;
  height: 48px;
  font-size: 20px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: rmAttract 2.4s ease-out 1.5s 2 both;
}

@keyframes rmAttract {
  0%   { box-shadow: 0 0 0 0 var(--gold-glow, rgba(255, 196, 77, .55)); }
  60%  { box-shadow: 0 0 0 14px rgba(255, 196, 77, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 196, 77, 0); }
}

/* ===== 3. Mobile-Ergonomie (≤560px ODER Touch-Pointer) ===== */
@media (max-width: 560px), (pointer: coarse) {
  body { font-size: 16px; }

  /* --- Hero (alle Seiten mit .hero) --- */
  .hero { padding: 30px 18px 20px; }
  .hero h1 { letter-spacing: 0; line-height: .98; }
  .hero h1 .l2 { letter-spacing: 0; }
  .hero-sub,
  .hero .tag { font-size: 14px; line-height: 1.5; }
  .hero .sub { letter-spacing: 1.2px; line-height: 1.35; }
  .hero-stats { gap: 18px; margin-top: 16px; }
  .hs-lbl { letter-spacing: 1.4px; }

  /* Atmosphärische Effekte runterfahren auf Handy */
  .floodlight,
  .fog-pulse,
  .particles,
  .stars { opacity: .45; }

  /* --- Bottom-Nav (Daumen-Reichweite) --- */
  .nav {
    top: auto;
    bottom: 0;
    border-top: 1px solid var(--glass-border, var(--border, rgba(255, 255, 255, .1)));
    border-bottom: 0;
  }

  .nav-row {
    align-items: stretch;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    gap: 4px;
  }

  .nav-row::-webkit-scrollbar { display: none; }
  .nav-home { display: none; }

  .nav-tab {
    flex: 0 0 70px;
    min-height: 56px;
    padding: 7px 2px 5px;
    border-bottom-width: 0;
    border-top: 3px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  .nav-tab.on {
    border-bottom-color: transparent;
    border-top-color: var(--gold, var(--green, #4caf50));
  }

  .nav-tab .ico { font-size: 17px; margin-bottom: 2px; }
  .nav-tab .lbl { font-size: 9px; letter-spacing: 0; line-height: 1.15; }

  .search-btn,
  .theme-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    margin: auto 0;
    font-size: 17px;
  }

  .read-mode-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    margin: auto 0 auto 4px;
    font-size: 19px;
  }

  /* --- Content-Wrap mit Bottom-Nav-Padding --- */
  .wrap {
    padding-left: 12px;
    padding-right: 12px;
    padding-bottom: calc(94px + env(safe-area-inset-bottom));
  }

  .app-back {
    height: 44px;
    background: linear-gradient(180deg, var(--bg), rgba(0, 0, 0, 0));
    right: 0;
  }

  /* --- Pills / Section-Tabs --- */
  .pills {
    top: 0;
    margin-left: -12px;
    margin-right: -12px;
    padding: 10px 12px;
    background: linear-gradient(180deg, var(--bg), rgba(0, 0, 0, 0));
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
  }

  .pill {
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 8px 14px;
  }

  /* --- Cards / Boxen --- */
  .card,
  .reality-box,
  .notfall,
  .mantra,
  .pitch,
  .pitch-animated,
  .pitch-quiz,
  .drag-pitch {
    border-radius: 12px;
  }

  .card,
  .reality-box,
  .notfall,
  .mantra {
    padding: 16px;
    margin-bottom: 12px;
  }

  .notfall-body { font-size: 18px; }

  .g2,
  .g3 { gap: 10px; }

  /* --- Tabellen scrollbar statt abgeschnitten --- */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--glass-border, var(--border, rgba(255, 255, 255, .1)));
    border-radius: 10px;
  }

  th,
  td { min-width: 138px; }

  /* --- Pitch / Position-Wahl (Hub) --- */
  .pitch-wrap { padding: 0 12px; max-width: 430px; }
  .pitch { box-shadow: 0 0 48px rgba(20, 82, 42, .22), 0 8px 36px rgba(0, 0, 0, .42); }

  .pos { min-width: 64px; min-height: 58px; touch-action: manipulation; }
  .pos-dot { width: 54px; height: 54px; }
  .pos-label { font-size: 10px; letter-spacing: .4px; color: rgba(255, 255, 255, .6); }

  /* --- Section-Heads --- */
  .section-head { padding: 38px 0 18px; }
  .section-title { letter-spacing: 0; }

  /* --- Suche --- */
  .search-input { min-height: 48px; font-size: 16px; }
  .search-clear { width: 34px; height: 34px; }

  /* --- Hub-spezifisch: Heute / Rings / Guide-/Tool-Grid --- */
  .heute-row { scroll-padding-left: 20px; margin-top: 16px; }
  .heute-row > .heute-tile { min-height: 68px; }

  .rings-row { gap: 14px; max-width: 360px; }
  .ring-svg { width: 70px; height: 70px; }
  .ring-center { font-size: 16px; }

  .guide-grid { gap: 10px; }
  .gc { min-height: 66px; padding: 14px 16px; }
  .gc-name { font-size: 14px; }
  .gc-desc { font-size: 12px; }

  .tool-grid { gap: 10px; }
  .tc { min-height: 112px; padding: 18px 12px; }

  /* --- Touch-Targets für interaktive Elemente --- */
  .q-opt,
  .quiz-mode-btn,
  .zone,
  .lesson-done-btn,
  .extra-time-btn,
  .press-btn,
  .st-card-btn,
  .st-cta {
    min-height: 48px;
    touch-action: manipulation;
  }

  /* --- Floating-Buttons über Bottom-Nav --- */
  .scroll-top,
  .btt {
    bottom: calc(82px + env(safe-area-inset-bottom));
    right: 14px;
  }

  /* --- Flow-Pfeile etwas kleiner --- */
  .flow { font-size: 11px; }
}

/* ===== 4. Sehr schmale Geräte (≤380px) ===== */
@media (max-width: 380px) {
  .nav-tab { flex-basis: 64px; }
  .nav-tab .lbl { font-size: 8px; }
  .search-btn,
  .theme-btn { width: 42px; height: 42px; min-width: 42px; }
  .read-mode-btn { width: 46px; height: 46px; min-width: 46px; font-size: 18px; }
  .hero-stats { gap: 12px; }
  .hs-val { font-size: 24px; }
  .hs-lbl { font-size: 7px; }
  .rings-row { display: grid; grid-template-columns: 1fr 1fr; }
}
