/* ========== GLOBAL ========== */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: #0a0a0a;
  color: #fff;
}

/* ========== TOP BAR ========== */
.appbar {
  position: sticky;
  top: 0;
  background: #111;
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #222;
}
.appbar h1 { margin: 0; font-size: 18px; }
.tabs button {
  padding: 8px 10px;
  border: 1px solid #333;
  background: #161616;
  color: #ddd;
  border-radius: 8px;
  cursor: pointer;
}
.tabs button.active { background: #222; color: #fff; border-color: #444; }
.spacer { flex: 1; }

/* ========== LAYOUT ========== */
.content { max-width: 1100px; margin: 24px auto; padding: 0 16px; }
.tab { display: none; }
.tab.active { display: block; }

.player video {
  width: 100%;
  background: #000;
  border-radius: 10px;
}

/* ========== LISTS ETC. ========== */
.row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
button {
  padding: 8px 12px;
  border: 1px solid #333;
  background: #1b1b1b;
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  touch-action: manipulation;
}
button:hover { background: #232323; }
.muted { color: #aaa; }

#catalog .cat {
  border: 1px solid #222;
  border-radius: 10px;
  margin: 12px 0;
  padding: 12px;
  background: #111;
}
#catalog .cat h3 { margin: 0 0 8px 0; }
#catalog .vid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px dashed #222;
  padding: 8px 0;
}
#catalog .vid:first-child { border-top: 0; }

/* =====================================================
   NORMALMODUS: Nur EIN Button unter dem Video (Vollbild)
   ===================================================== */
.controls-row { display: flex; justify-content: center; margin-top: 16px; }
.controls-row button {
  -webkit-appearance: none; appearance: none;
  padding: 14px 26px; border-radius: 10px;
  border: 1px solid #333; background: #1b1b1b; color: #fff;
  font-size: 18px; line-height: 1; min-width: 140px;
}

/* Play/Stop nicht mehr vorhanden */
.controls { display: none !important; }

/* =====================================================
   PSEUDO-VOLLBILD iPhone-optimiert
   ===================================================== */
body.immersive {
  margin: 0;
  overflow: hidden;
  background: #000;
  padding: env(safe-area-inset-top)
           env(safe-area-inset-right)
           env(safe-area-inset-bottom)
           env(safe-area-inset-left);
}
body.immersive .appbar { display: none; }
body.immersive .content { padding: 0; max-width: none; margin: 0; }

/* VIDEO sauber zentriert */
body.immersive .player {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 9999;
  display: grid;
  place-items: start center;
}
body.immersive #playerEl {
  width: 100vw;
  height: 100svh;
  max-width: 100vw;
  max-height: 100svh;
  object-fit: contain;
  background: #000;
  margin-top: -210px; /* historisch – unten neutralisiert */
}

/* =====================================================
   VOLL-BILDSCHIRM LEISTE (unten)
   ===================================================== */
.fsbar { display: none; }
body.immersive .fsbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center; align-items: center; gap: 12px;
  padding: 10px env(safe-area-inset-right)
          calc(14px + env(safe-area-inset-bottom))
          env(safe-area-inset-left);
  background: rgba(0,0,0,0.35); backdrop-filter: blur(2px);
  z-index: 10000;
}
body.immersive .fsbar button {
  -webkit-appearance: none; appearance: none;
  height: 54px; padding: 0 18px; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px; border: 1px solid #333; background: #1b1b1b; color: #fff;
}
body.immersive #fsPlay { width: 72px; padding: 0; font-size: 24px; }

/* ============================
   KALIBRIERUNG – Overlay & Offsets
   ============================ */

/* CSS-Variablen für Versatz (durch JS gesetzt) */
:root {
  --video-offset-x: 0px;
  --video-offset-y: 0px;
}

/* Versatz auf beide Videoelemente anwenden (active + standby) */
body.immersive #playerEl,
body.immersive .player video[style*="position: absolute"], 
body.immersive #posCalImage {
  transform: translate(var(--video-offset-x), var(--video-offset-y));
  will-change: transform;
}

/* Neutralisiert die alte negative Verschiebung bei aktivem transform */
@supports (transform: translate(0)) {
  body.immersive #playerEl { margin-top: 0 !important; }
}

/* Overlay */
#calOverlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 100000;
  display: none;

  /* 🔒 WICHTIG: Scroll & Browser-Gesten blockieren */
  overscroll-behavior: none;
  touch-action: none;
}
#calOverlay.active { display: block; }
#calOverlay .cal-wrap { position: absolute; inset: 0; }

/* Crosshair */
#calOverlay .crosshair {
  position: absolute;
  left: 50%; top: 50%;
  width: 0; height: 0;
  transform: translate(-50%, -50%);
}
#calOverlay .crosshair::before,
#calOverlay .crosshair::after {
  content: ""; position: absolute; background: var(--accent); opacity: .9;
}
#calOverlay .crosshair::before { width: 2px; height: 52vh; left: -1px; top: -26vh; } /* vertikal */
#calOverlay .crosshair::after  { height: 2px; width: 52vw; top: -1px; left: -26vw; } /* horizontal */

/* HUD (nur Reset + Speichern) */
#calOverlay .hud {
  position: absolute; left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  display: flex; gap: 10px; align-items: center;
  background: transparent;
  border: none;
  padding: 0; color: #fff; font-size: 14px;
  backdrop-filter: blur(4px);
}
#calOverlay .hud button {
  -webkit-appearance: none; appearance: none;
  min-width: 44px; height: 44px; padding: 0 12px;
  border-radius: 10px; border: 1px solid #444;
  background: #1b1b1b; color: #fff; font-size: 16px;
}
#calOverlay .badge {
  padding: 6px 10px; border: 1px solid #444; border-radius: 8px; background: #111;
}

/* Speichern-Feedback: Puls am Fadenkreuz */
#calOverlay .pulse {
  position: absolute; left: 50%; top: 50%;
  width: 24px; height: 24px; border: 2px solid var(--accent); border-radius: 999px;
  transform: translate(-50%, -50%) scale(0.5);
  opacity: 0.9; pointer-events: none; animation: calPulseOut 700ms ease-out forwards;
}
@keyframes calPulseOut {
  0%   { opacity: 0.9; transform: translate(-50%, -50%) scale(0.5); }
  70%  { opacity: 0.25; transform: translate(-50%, -50%) scale(3.0); }
  100% { opacity: 0;    transform: translate(-50%, -50%) scale(3.6); }
}

/* Speichern-Feedback: Häkchen über der HUD */
#calOverlay .checkmark {
  position: absolute;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  font-size: 32px;
  color: var(--accent);
  opacity: 0;
  pointer-events: none;
  animation: checkPop 900ms ease-out forwards;
}
@keyframes checkPop {
  0%   { transform: translateX(-50%) scale(0.6); opacity: 0; }
  20%  { transform: translateX(-50%) scale(1.15); opacity: 1; }
  70%  { transform: translateX(-50%) scale(1.00); opacity: 1; }
  100% { transform: translateX(-50%) scale(0.8); opacity: 0; }
}

/* =====================================================
   MOBILE UI POLISH (Add-on) – unten in styles.css einfügen
   ===================================================== */

/* 1) Design-Tokens: zentrale Farben/Abstände (leichter später anzupassen) */
:root{
  --bg: #0a0a0a;
  --surface: #111;
  --surface2: #161616;
  --border: #262626;
  --text: #ffffff;
  --muted: #b8b8b8;

  --accent: rgb(var(--accent-rgb));
  --accent-rgb: 204, 152, 45; /* #CC982D */

  --r: 12px;
  --r2: 14px;

  --pad: 14px; /* mobile Grundpadding */
  --btnH: 46px; /* fingerfreundlich */
}

/* 2) Mobile-Viewport & generelles Tuning */
html { -webkit-text-size-adjust: 100%; }
body{
  background: var(--bg);
  color: var(--text);
}
.muted{ color: var(--muted); }

/* 3) Topbar: besser für Smartphones (Tabs horizontal scrollbar) */
.appbar{
  padding: 10px var(--pad);
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(17,17,17,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.appbar h1{
  font-size: 16px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

/* Tabs: als “Pills”, scrollen wenn zu eng */
.tabs{
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar{ display:none; }
.tabs button{
  height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: #dcdcdc;
  white-space: nowrap;
}
.tabs button.active{
  background: rgba(var(--accent-rgb),0.14);
  border-color: rgba(var(--accent-rgb),0.35);
  color: var(--text);
}

/* 4) Content: auf Handy weniger “Desktop-Luft” */
.content{
  margin: 14px auto;
  padding: 0 var(--pad);
  max-width: 720px; /* reicht, ist aber mobiler */
}

/* 5) Video-Container: schöner Rahmen & stabil auf Mobile */
.player video{
  border-radius: var(--r2);
  background: #000;
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
}

/* 6) Standard-Buttons: konsistent & touch-friendly */
button{
  min-height: var(--btnH);
  padding: 0 14px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: #1b1b1b;
}
button:active{ transform: translateY(1px); }

/* 7) Unter dem Video: Controls klarer & mobil “sticky” am unteren Rand */
.controls-row{
  position: sticky;
  bottom: 10px;
  z-index: 5;
  margin-top: 14px;
  padding: 10px;
  border-radius: var(--r2);
  background: rgba(17,17,17,0.72);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  gap: 10px;
}
.controls-row button{
  height: 50px;
  font-size: 16px;
  min-width: 0;
}

/* Vollbild = “Primary”, CAL = “Secondary” (nur Styling über ID, kein HTML ändern) */
#toggleFS{
  background: rgba(var(--accent-rgb),0.16);
  border-color: rgba(var(--accent-rgb),0.35);
}
#openSizeCal{
  padding: 0 14px;
  opacity: 0.95;
}

/* 8) Datei-Picker: weniger “roh” */
.row label{
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 12px;
  border-radius: var(--r2);
  border: 1px solid var(--border);
  background: var(--surface);
}
input[type="file"]{
  max-width: 100%;
}

/* 9) Hint-Box (dein <details class="hint-box">): endlich hübsch */
.hint-box{
  margin-top: 14px;
  border-radius: var(--r2);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 10px 12px;
}
.hint-box summary{
  cursor: pointer;
  font-size: 14px;
}
.hint-box p, .hint-box ol{
  margin: 10px 0 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

/* 10) Katalog/Playlist: bessere Listen-Optik */
#catalog .cat{
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r2);
}
#catalog .vid{
  gap: 10px;
}
#catalog .vid > div:first-child{
  color: #eaeaea;
  font-size: 14px;
}
#catalog .vid button{
  height: 44px;
  font-size: 14px;
  padding: 0 12px;
}

#playlistList{
  padding-left: 18px;
}
#playlistList li{
  padding: 10px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.10);
}
#playlistList li:last-child{ border-bottom: none; }

/* 12) Kleiner Mobile-Fix: sehr kleine Geräte */
@media (max-width: 360px){
  .appbar h1{ display:none; } /* mehr Platz für Tabs */
  .content{ padding: 0 12px; }
}

/* =========================
   CAL/Size & Pos. Button – Tool-Style
   ========================= */
/* Size-Button*/
#openSizeCal{
  height: 44px;
  min-width: 44px;
  padding: 0 12px;
  font-size: 14px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb),0.35);
  border: 1px solid rgba(var(--accent-rgb),0.35);
  color: #fff;

  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Pos-Button wie Size-Button */
#openPosCal{
  height: 44px;
  min-width: 44px;
  padding: 0 12px;
  font-size: 14px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb),0.35);
  border: 1px solid rgba(var(--accent-rgb),0.35);
  color: #fff;

  display: inline-flex;
  align-items: center;
  justify-content: center;
}


/* =========================
   Katalog Buttons – Playlist primär
   ========================= */
#catalog .vid .btn-primary{
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 14px;

  background: rgba(var(--accent-rgb),0.22);
  border: 1px solid rgba(var(--accent-rgb),0.45);
  color: #fff;
}
#catalog .vid .btn-primary:active{
  background: rgba(var(--accent-rgb),0.32);
}

#catalog .vid .btn-secondary{
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 13px;

  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  opacity: 0.85;
}

/* =========================
   Playlist Aktionen
   ========================= */
#playlistList li{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.pl-number{
  color: var(--accent); /* dein Gelb */
  margin-right: 6px;
}
#playlistList li span:first-child{
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#playlistList li span:last-child button{
  height: 36px;
  min-width: 36px;
  padding: 0;
  border-radius: 10px;
  font-size: 16px;
}

/* =====================================================
   Schritt 3: Vollbild-Leiste (fsbar) – Mobile polish
   ===================================================== */
body.immersive .fsbar{
  gap: 10px;
  padding: 10px 12px calc(14px + env(safe-area-inset-bottom));
  background: rgba(0,0,0,0.28);
  border-top: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Alle Buttons: gleich groß, fingerfreundlich, weniger “Block” */
body.immersive .fsbar button{
  height: 52px;
  min-width: 52px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(27,27,27,0.72);
  color: #fff;
  box-shadow: 0 8px 22px rgba(0,0,0,0.28);
}

/* Prev/Next etwas kompakter, nicht so wichtig wie Play */
body.immersive #fsPrev,
body.immersive #fsNext{
  min-width: 52px;
  padding: 0 12px;
  opacity: 0.92;
}

/* Play/Pause als Hauptaktion */
body.immersive #fsPlay{
  font-size: 24px;

  /* gleiche Größe wie andere Buttons */
  width: auto;
  min-width: 52px;
  padding: 0 14px;

  /* Gelbe Farbe bleibt */
  background: rgba(var(--accent-rgb),0.22);
  border-color: rgba(var(--accent-rgb),0.45);
}


/* Close: klar erkennbar, aber nicht “Alarmrot” */
body.immersive #fsClose{
  min-width: 52px;
  padding: 0 12px;
  opacity: 0.85;
}

/* Touch-Feedback */
body.immersive .fsbar button:active{
  transform: translateY(1px);
  background: rgba(255,255,255,0.10);
}
body.immersive #fsPlay:active{
  background: rgba(var(--accent-rgb),0.30);
}

/* =====================================================
   Intro-Hinweise (pro App-Start) – Overlay unter Splash
   ===================================================== */
#introOverlay{
  position: fixed;
  inset: 0;
  z-index: 96000;           /* unter #appSplash (zuvor 90000), über der App */
  display: flex;            /* ist "bereit" unter dem Splash */
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: #0a0a0a;
}
#introOverlay.hidden{ display: none; }

.intro-card{
  width: min(520px, 100%);
  background: #111;
  border: 1px solid #262626;
  border-radius: 16px;
  padding: 18px 16px 14px 16px;
  color: #fff;
  box-shadow: 0 20px 55px rgba(0,0,0,0.65);
}
.intro-head{
  display: flex;
  align-items: center;      /* bleibt */
  gap: 10px;
  margin-bottom: 12px;

  min-height: 44px;         /* NEW: sorgt für saubere Mittel-Ausrichtung */
}
#openSizeCal{
  align-self: center;       /* NEW: zwingt den Button mittig im Row-Layout */
}
.intro-icon{
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(var(--accent-rgb),0.12);
  border: 1px solid rgba(var(--accent-rgb),0.25);
}
.intro-card h2{ margin: 0; font-size: 18px; }

.intro-text{
  color: #cfcfcf;
  font-size: 14px;
  line-height: 1.45;
}
.intro-text p{ margin: 0 0 19px 0; }
.intro-sub{ color: #a9a9a9; font-size: 13px; }

#introAccept{
  width: 100%;
  height: 50px;
  margin-top: 8px;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb),0.45);
  background: rgba(var(--accent-rgb),0.22);
  color: #fff;
  font-size: 16px;
}
#introAccept:active{
  background: rgba(var(--accent-rgb),0.32);
  transform: translateY(1px);
}

.intro-foot{
  margin-top: 10px;
  font-size: 12px;
  color: #9a9a9a;
  text-align: center;
}

/* =====================================================
   Größen-Kalibrierung UI (Buttons über Slider) + Animation
   ===================================================== */
#sizeCalOverlay{
  position: fixed;
  inset: 0;

  /* dunkler + stärkerer Blur */
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  z-index: 100000;
}

/* Linie: jetzt ohne Inline-Styles */
#sizeLine{
  position: absolute;
  left: 50%;
  top: calc(20% - 30px);
  height: 4px;
  width: 200px;
  transform: translateX(-50%);
  background: rgb(var(--accent-rgb));
  border-radius: 2px;
}

/* Buttons über dem Slider */
#sizeCalOverlay .size-actions{
  position: absolute;
  left: 50%;
  bottom: calc(115px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);

  display: flex;
  gap: 30px;                 /* Abstand zwischen Abbrechen & Speichern */
  justify-content: center;   /* NICHT mehr auseinanderziehen */

  width: auto;
  max-width: 360px;          /* rückt von den Seiten weg */
}
#sizeCalOverlay .size-actions button{
  height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid #444;
  background: #1b1b1b;
  color: #fff;
  font-size: 15px;
  min-width: 140px;
}

/* Primär: Speichern (Größenkalibrierung) — wie Positionskalibrierung */
#sizeCalOverlay #sizeSave{
  background: rgba(var(--accent-rgb),0.22) !important;
  border: 1px solid rgba(var(--accent-rgb),0.45) !important;
  color: #fff;
}

/* Slider-Zeile (unter den Buttons) */
#sizeCalOverlay .size-tools{
  position: absolute;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px)); /* unterhalb size-actions */
  transform: translateX(-50%);

  width: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;

  background: rgba(0,0,0,.65);
  border: 1px solid #333;
  border-radius: 14px;
  padding: 10px 14px;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
#sizeSlider{
  width: 180px;   /* oder 200px – nach Geschmack */
}

/* Plus / Minus Buttons */
#sizeMinus,
#sizePlus{
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb),0.45);
  background: rgba(var(--accent-rgb),0.22);
  color: #fff;
  font-size: 22px;

  display: flex;
  align-items: center;
  justify-content: center;

  line-height: 1;        /* WICHTIG */
  padding: 0;            /* WICHTIG */
  font-weight: 500;      /* optional, macht es ruhiger */
}
#sizeMinus:active,
#sizePlus:active{
  background: rgba(var(--accent-rgb),0.32);
  transform: translateY(1px);
}

/* Hinweis oben */
#sizeCalOverlay .size-hint{
  position: absolute;
  left: 50%;
  top: 20%;
  transform: translateX(-50%);
  color: #fff;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(var(--accent-rgb),0.45);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 15px;

  width: min(330px, calc(100vw - 48px));
  text-align: center;
}

/* Speichern-Feedback auch hier (wie Positionskalibrierung) */
#sizeCalOverlay .pulse{
  position: absolute; left: 50%; top: 50%;
  width: 24px; height: 24px; border: 2px solid var(--accent); border-radius: 999px;
  transform: translate(-50%, -50%) scale(0.5);
  opacity: 0.9; pointer-events: none; animation: calPulseOut 700ms ease-out forwards;
}
#sizeCalOverlay .checkmark{
  position: absolute;
  left: 50%;
  bottom: calc(140px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  font-size: 32px;
  color: var(--accent);
  opacity: 0;
  pointer-events: none;
  animation: checkPop 900ms ease-out forwards;
}

/* KATALOG: Buttons immer nebeneinander (auch auf Smartphone, auch bei "Eigene Bilder") */
#catalog .vid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
#catalog .vid > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#catalog .vid > div:last-child {
  flex: 0 0 auto;
  display: inline-flex;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
}
#catalog .vid > div:last-child button { flex: 0 0 auto; }

.beta-tag {
  font-size: 0.75em;
  font-weight: 400;
  opacity: 0.7;
  margin-left: 6px;
}

/* =========================
   Playlist: Vollbild-Button wie Accent + etwas kleiner
   ========================= */
#playlistTab #playPlaylist{
  background: rgba(var(--accent-rgb),0.22);
  border: 1px solid rgba(var(--accent-rgb),0.45);
  color: #fff;
  min-width: 100px; /* bewusst etwas kleiner */
}
#playlistTab #playPlaylist:active{
  background: rgba(var(--accent-rgb),0.32);
  transform: translateY(1px);
}
#quickPlaylist{
  width: 100%;
  margin: 10px 0 8px;
}
#quickPlaylist {
  background: rgba(var(--accent-rgb),0.32);   /* dein bestehender Gelbton */
  color: #fff;
  border: 1px solid rgba(var(--accent-rgb),0.45);
}
/* =========================
   AUTH SCREENS: FULLSCREEN GATE
   ========================= */
.screen{
  position: fixed;
  inset: 0;
  z-index: 95000;                 /* über App, unter Splash(99999) */
  display: grid;
  place-items: center;
  padding: 18px;
  background: #0a0a0a;
}

.screen[hidden]{ display: none !important; }

.auth-card{
  width: min(520px, 100%);
  background: #111;
  border: 1px solid #262626;
  border-radius: 16px;
  padding: 18px 16px 14px;
  box-shadow: 0 20px 55px rgba(0,0,0,0.65);
}

.field{
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.field span{ font-size: 13px; color: #b8b8b8; }

.field input{
  height: 46px;
  border-radius: 12px;
  border: 1px solid #2a2a2a;
  background: #0f0f0f;
  color: #fff;
  padding: 0 12px;
  font-size: 16px;
}

.unlock-box{
  margin-top: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid #262626;
  background: #0f0f0f;
}

.unlock-icon{
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(var(--accent-rgb),0.12);
  border: 1px solid rgba(var(--accent-rgb),0.25);
}

/* =========================
   GENERIC OVERLAY (Impressum / Datenschutz)
   ========================= */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 98000; /* unter Splash, über App */
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 16px;
}

.overlay.hidden {
  display: none;
}

/* Karte */
.overlay-card {
  width: min(520px, 100%);
  max-height: calc(100svh - 32px);

  background: #111;
  border: 1px solid #262626;
  border-radius: 16px;

  display: flex;
  flex-direction: column;

  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
}

/* Kopfzeile */
.overlay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;

  padding: 14px 16px;
  border-bottom: 1px solid #262626;
}

.overlay-head h2 {
  margin: 0;
  font-size: 18px;
}

/* Inhalt */
.overlay-body {
  padding: 14px 16px;
  overflow-y: auto;

  font-size: 14px;
  line-height: 1.45;
  color: #e0e0e0;
}

.overlay-body p,
.overlay-body ul {
  margin-top: 0;
}

/* Footer */
.overlay-actions {
  padding: 12px 16px;
  border-top: 1px solid #262626;
  display: flex;
  justify-content: center;
}

.overlay-actions button {
  min-width: 120px;
  height: 44px;
  border-radius: 999px;

  background: rgba(var(--accent-rgb),0.22);
  border: 1px solid rgba(var(--accent-rgb),0.45);
  color: #fff;
}

/* App-Scroll sperren, wenn Overlay offen */
body.overlay-open {
  overflow: hidden;
  touch-action: none;
}

.overlay-close{
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  max-width: 32px;
  max-height: 32px;

  padding: 0;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 50% !important; /* überschreibt globale Button-Styles */
  line-height: 1;
  font-size: 18px;

  flex: 0 0 auto;
}

/* Sprache-Button */
.btn-sprache {
  display: flex;
  align-items: center;     /* vertikal perfekt mittig */
  justify-content: center; /* horizontal mittig */
  gap: 8px;

  height: var(--btnH);
  padding: 0 14px;
  position: relative;
}

/* Haupttext */
.btn-sprache .btn-center {
  position: static;   /* WICHTIG */
  transform: none;
  line-height: 1;
  margin: 0;
  padding: 0;
}

/* coming soon */
.btn-sprache .beta-tag {
  position: static;   /* WICHTIG */
  transform: none;
  font-size: 12px;
  opacity: 0.6;
  line-height: 1;
  margin: 0;
  padding: 0;
}

/* Zusatztext: leicht rechts neben dem Zentrum */
.btn-sprache .beta-tag {
  position: absolute;
  left: 50%;
  transform: translateX(calc(-50% + 70px)); /* Abstand fein steuerbar */
  font-size: 12px;
  opacity: 0.6;
  white-space: nowrap;
  pointer-events: none;
}

/* Scenario A: NFC required */
.nfc-required-card{
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  background: linear-gradient(
    180deg,
    rgba(255, 235, 160, 0.55),
    rgba(255, 255, 255, 0.92)
  );
}

.nfc-required-card h2{
  margin-bottom: 4px;
}

/* ================================
   Anmeldeseite A – NFC erforderlich
   ================================ */

#screen-nfc-required {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent; /* schwarzer Hintergrund bleibt */
}

#screen-nfc-required .auth-card,
#screen-nfc-required .nfc-required-card {
  background: rgba(var(--accent-rgb), 0.22);
  border: 1px solid rgba(var(--accent-rgb), 0.45);
  color: #fff;

  border-radius: 18px;
  padding: 22px 26px;
  min-width: 260px;
  max-width: 90vw;

  box-shadow:
    0 10px 30px rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,255,255,0.15);
}

/* Titel */
#screen-nfc-required h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: #fff;
}

/* Beschreibungstext */
#screen-nfc-required p,
#screen-nfc-required .muted {
  margin-top: 8px;
  font-size: 0.95rem;
  line-height: 1.4;
  color: rgba(255,255,255,0.85);
}

/* =========================================
   Szenario A: NFC Required → App komplett ausblenden
   ========================================= */

body.nfc-required-active .appbar,
body.nfc-required-active main.content {
  display: none !important;
}


/* =========================
   Timer Aussehen
   ========================= */
.access-badge {
  margin-left: 8px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  background: rgba(var(--accent-rgb), 0.22);
  border: 1px solid rgba(var(--accent-rgb),0.45);
  border-radius: 999px;
  white-space: nowrap;
  align-self: center;
}

/* Variante 1: CAL-Hinweis bleibt unter Playlist und über To-dos */
.home-info-block{
  position: relative;
  margin-top: 14px;
}

.home-info-block .cal-hint{
  position: relative;   /* statt sticky */
  top: auto;            /* optional: sicherheitshalber */
  z-index: auto;        /* optional */
  margin-bottom: 14px;
}

.home-info-block .controls-row{
  position: relative;   /* überschreibt sticky bottom */
  bottom: auto;
}

/* Topbar muss immer über dem Content liegen, verhindert das der Player drüber scrollt */
.appbar{
  z-index: 20000;
}

/* Pos.-Button im Vollbild: Optik wie "Size" */
body.immersive #fsPos{
  height: 44px;
  min-width: 44px;
  padding: 0 12px;
  font-size: 14px;
  border-radius: 999px;

  background: rgba(var(--accent-rgb),0.35);
  border: 1px solid rgba(var(--accent-rgb),0.35);
  color: #fff;

  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Touch-Feedback wie bei deinen anderen Buttons */
body.immersive #fsPos:active{
  background: rgba(var(--accent-rgb),0.45);
  transform: translateY(1px);
}


/* Layout innerhalb des bestehenden Rahmens */
.controls-row.cal-hint{
  display: flex;
  align-items: center;      /* Text vertikal mittig */
  gap: 20px;
}

.cal-buttons{
  display: flex;
  flex-direction: column;   /* Size über Pos */
  gap: 20px;
}

.cal-text{
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
}

/* Positionskalibrierung: fsbar-Button im Vollbild ausblenden. 
Falls er wieder angezeigt werden soll, diese Zeile auskommentieren 
oder löschen!!! */
/*body.immersive #fsPos{
  display: none !important;
}
*/

/* Home: Cal-Hint darf NICHT sticky sein (sonst wandert er in den Player) */
.controls-row.cal-hint{
  position: relative !important;
  bottom: auto !important;
  top: auto !important;
  z-index: auto !important;
}

/* Allgemeine Icon-Größe für Fließtext */
.icon {
  font-size: 22px;
  display: inline-block;
}

/* =========================================
   POS-Kalibrierung: Reset/Speichern wie Size-Buttons
   ========================================= */

/* HUD-Container optisch etwas "leichter" (optional, kann bleiben) */
#calOverlay .hud{
  gap: 30px;                 /* wie size-actions */
  border-radius: 14px;       /* näher am Size-Look */
  padding: 10px 14px;        /* etwas ruhiger */
}

/* Buttons wie in der Größenkalibrierung */
#calOverlay .hud button{
  height: 44px;
  min-width: 140px;
  padding: 0 14px;

  border-radius: 999px;      /* pillenform */
  border: 1px solid #444;
  background: #1b1b1b;
  color: #fff;

  font-size: 15px;
}

/* Optional: "Speichern" als Primary wie #sizeSave */
#calOverlay #calSave{
  background: rgba(var(--accent-rgb),0.22);
  border-color: rgba(var(--accent-rgb),0.45);
}

.appbar h1{
  display: none;
}

/* Home: Kalibrierungsblock komplett ausblenden (Buttons + Text + Rahmen) */
#player #homeCalBlock{
  display: none !important;
}

/* Neuer Tab: Kalibrierungs-Buttons optisch wie deine Tool-Buttons */
#calTab .btn-cal{
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb),0.35);
  background: rgba(var(--accent-rgb),0.22);
  color: #fff;
}
#calTab .btn-cal:active{
  background: rgba(var(--accent-rgb),0.32);
  transform: translateY(1px);
}

/* Home: CAL-Block ausblenden (weil er im Home-Tab liegt) */
/* Home: Kalibrierungs-Hinweis + Buttons ausblenden (bleibt im DOM) */
/* Wenn SIe wieder da sein sollen, dann diese Zeilen Außklamern */
#player .controls-row.cal-hint{
  display: none !important;
}

/* Playlist: "Go Playlist" ausblenden, aber Funktion behalten */
#playlistTab #playPlaylist{
  display: none !important;
}

/* Damit "Playlist leeren" links sitzt (Row bleibt normal) */
#playlistTab .row{
  justify-content: flex-start;
}

/* Home: Content ohne vertikale Margins */
#player.tab.active{
  padding-bottom: 0;
}

body:not(.immersive) .content{
  margin-bottom: 0;
}


/* ===== FINAL OVERRIDES (wins) ===== */
/* Final: Appbar soll immer über dem Content liegen */
.appbar { z-index: 20000; }

/* Final: Title in Topbar ausblenden */
.appbar h1 { display: none !important; }

/* Final: Sticky-Controls nur im Home-Player (nicht global) */
#player .controls-row { 
  position: sticky;
  bottom: 10px;
}

/* Final: Aber der Cal-Hint im Home darf NICHT sticky sein */
#player .controls-row.cal-hint {
  position: relative !important;
  bottom: auto !important;
}

/* Final: Size/Pos Buttons als einheitliche Tool-Buttons */
#openSizeCal, #openPosCal {
  height: 44px;
  min-width: 44px;
  padding: 0 12px;
  font-size: 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  background: rgba(var(--accent-rgb),0.35);
  border: 1px solid rgba(var(--accent-rgb),0.35);
  color: #fff;
}

/* Final: Intro-Header darf den Size-Button mittig zwingen */
#introOverlay #openSizeCal { align-self: center; }



/* =========================
   Home: Player ausblenden (nur wenn NICHT immersive)
   ========================= */
body:not(.immersive) #player .player {
  display: none;
}

/* Sicherheit: Im immersive-Modus immer sichtbar */
body.immersive #player .player {
  display: grid;
}

/* =========================================
   Größenkalibrierung: iPhone Deckel entfernen
   ========================================= */

/* Wenn physicalBox aktiv ist, darf das Video
   nicht durch max-width / max-height begrenzt werden */
body.immersive #physicalBox video {
  max-width: none !important;
  max-height: none !important;
}

/* =========================
   Home Startbild
   ========================= */

.home-start {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-top: 40px;
}

.home-logo {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

/* =====================================
   HERO STARTSCREEN (Home)
   ===================================== */

body:not(.immersive) #player.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.hero-start {
  width: 100%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 40px;
  margin-top: 40px;
}

.hero-image {
  width: 80vw;
  max-width: 420px;
  aspect-ratio: 1 / 1;
  background-image: url('/media/Tomte black.PNG');
  background-size: cover;
  background-position: center;
  border-radius: 30px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.35);
}

.hero-button {
  padding: 16px 32px;
  font-size: 18px;
  border-radius: 16px;
}

/* =========================
   IMMERSIVE: Home-Hero IMMER ausblenden
   (damit er nicht durch CalOverlay durchscheint)
   ========================= */
body.immersive .home-start,
body.immersive .hero-start,
body.immersive .home-logo,
body.immersive .hero-image,
body.immersive #quickPlaylist{
  display: none !important;
}

/* =========================
   Kalibrierungs-Tab Layout
   ========================= */

#calTab .cal-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-top: 20px;
}

#calTab .cal-card {
  border: 1px solid rgba(255,255,255,0.25); /* weißer Rahmen */
  background: #111; /* dunkler Hintergrund, nicht gelb */
  border-radius: 16px;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

#calTab .cal-desc {
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
  margin: 0;
}

/* Button wieder volle Breite wie vorher */
#calTab .btn-cal {
  width: 100%;
  height: 44px;
  border-radius: 999px;

  background: rgba(var(--accent-rgb),0.22);
  border: 1px solid rgba(var(--accent-rgb),0.45);
  color: #fff;
}

.hero-image {
  border: 4px solid rgba(var(--accent-rgb),0.45);
  background-color: var(--bg);
  /*background-color: var(--surface);  dieses schwarz ist das etwas schwächere schwarz*/
}

/* =========================
   Playlist: Dauer-Anzeige (nicht klickbar)
   ========================= */

/* Row: Dauer links, Clear rechts */
#playlistTab .playlist-actions{
  width: 100%;
  justify-content: space-between;
  align-items: center;
}

/* Dauer-Button: gelber Rand + gelblicher Hintergrund (wie gewünscht) */
#playlistDuration.btn-duration{
  border: 1px solid rgba(var(--accent-rgb),0.45);
  background: rgba(var(--accent-rgb),0.22);
  color: #fff;
  min-width: 120px;
  justify-content: center;
  opacity: 1;                 /* wichtig gegen disabled-grau */
  cursor: default;
}

/* Disabled soll NICHT grau/transparent werden */
#playlistDuration.btn-duration:disabled{
  opacity: 1 !important;
  filter: none !important;
}

/* Optional: keine "pressed" Animation bei disabled */
#playlistDuration.btn-duration:active{
  transform: none !important;
}

/* Intro darf absolut nichts blockieren wenn hidden */
#introOverlay.hidden {
  display: none !important;
  pointer-events: none !important;
}

/* Nur wenn sichtbar darf es klicken */
#introOverlay {
  pointer-events: auto;
}

/* =========================================
   Guide Accordion (Klapptexte)
   ========================================= */
.guide-accordion{
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-item{
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 16px;
  background: #111;
  overflow: hidden;
}

.guide-item summary{
  list-style: none;
  cursor: pointer;
  padding: 14px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  user-select: none;
}

.guide-item summary::-webkit-details-marker{
  display: none;
}

/* Pfeil rechts */
.guide-item summary::after{
  content: "▾";
  margin-left: auto;
  opacity: 0.75;
  transition: transform .2s ease;
}

.guide-item[open] summary::after{
  transform: rotate(180deg);
}

.g-ico{
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(var(--accent-rgb),0.16);
  border: 1px solid rgba(var(--accent-rgb),0.28);
}

.guide-body{
  border-top: 1px solid rgba(255,255,255,0.10);
  padding: 12px 14px 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.guide-body ol{
  margin: 0;
  padding-left: 18px;
}

.guide-body li{
  margin: 8px 0;
}