/* ═══════════════════════════════════════════════════════════
   Meisterpult — Spielleiter-Kommandozentrale
   Livery: das Regelwerk färbt das Pult.
   ═══════════════════════════════════════════════════════════ */

:root {
  --ink:      #191411;   /* geölte Eiche, dunkel */
  --ink-2:    #211a15;
  --panel:    #262019;
  --panel-2:  #2e2720;
  --line:     #3d342a;
  --line-soft:#332b22;
  --text:     #e9dec7;   /* warmes Pergamentweiß */
  --muted:    #a5947c;
  --dim:      #7d6f5c;

  /* Pergament-Inseln (Statblocks) */
  --parch:     #ece1c8;
  --parch-2:   #e2d4b4;
  --parch-ink: #2b2117;
  --parch-dim: #6b5c48;

  --font-display: 'Cinzel', 'Trajan Pro', 'Times New Roman', serif;
  --font-body: 'Alegreya Sans', 'Segoe UI', system-ui, sans-serif;
  --font-book: 'Alegreya', Georgia, 'Times New Roman', serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', monospace;

  --deck-h: 58px;
  /* Platz, den die Regieleiste unten belegt. Bewusst exakt --deck-h:
     env(safe-area-inset-bottom) war hier kurz eingerechnet und hat die Leiste
     am Handy von 58 auf 92px aufgebläht (Gestenleiste 34px) — sie soll schmal
     bleiben, also NICHT wieder addieren. */
  --deck-total: var(--deck-h);
  --radius: 10px;
}

/* Livree: Pathfinder = Glut-Karmesin, D&D = Drachengold */
html[data-system="pf2e"] {
  --accent:      #d1483a;
  --accent-soft: #e4746359;
  --accent-deep: #7e2a20;
  --accent-text: #ff9c8a;
  --livery-glow: rgba(209, 72, 58, .14);
}
html[data-system="dnd"] {
  --accent:      #c69a2e;
  --accent-soft: #e0b95359;
  --accent-deep: #7a5c14;
  --accent-text: #ecc96a;
  --livery-glow: rgba(198, 154, 46, .13);
}
/* Daggerheart = Dämmerviolett */
html[data-system="dh"] {
  --accent:      #8b6fd8;
  --accent-soft: #a58ae659;
  --accent-deep: #4c3a86;
  --accent-text: #bfa8f2;
  --livery-glow: rgba(139, 111, 216, .14);
}

/* Sichtbarkeit je Regelwerk: .only-dh nur bei Daggerheart, .dh-hide dort ausgeblendet */
html:not([data-system="dh"]) .only-dh { display: none !important; }
html[data-system="dh"] .dh-hide { display: none !important; }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  /* Gescrollt wird ausschließlich in .main. Ohne das kann der Body am Handy
     um die Höhe der ein-/ausfahrenden Adressleiste verrutschen — dann „endet“
     die Seite sichtbar über dem unteren Rand. */
  overflow: hidden;
  background:
    radial-gradient(1100px 500px at 18% -10%, var(--livery-glow), transparent 60%),
    radial-gradient(900px 600px at 110% 110%, rgba(0,0,0,.5), transparent 55%),
    var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.45;
  transition: background .5s ease;
}

::selection { background: var(--accent-deep); color: #fff; }

h1, h2, h3 { margin: 0; font-weight: 600; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
code { font-family: var(--font-mono); font-size: .85em; background: var(--ink-2); padding: 1px 5px; border-radius: 4px; }
a { color: var(--accent-text); }

/* ── Grundgerüst ─────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 228px 1fr;
  /* Genau eine Zeile, die nicht über die Fensterhöhe hinauswachsen darf: sonst
     schiebt die intrinsische Höhe der Seitenleiste Gerüst und Scrollende unter
     die fix positionierte Regieleiste. */
  grid-template-rows: minmax(0, 1fr);
  height: calc(100vh - var(--deck-total));
  height: calc(100dvh - var(--deck-total));   /* dvh folgt der Adressleiste am Handy */
}
.main {
  min-height: 0;
  overflow-y: auto;
  padding: 26px 30px 40px;
  scrollbar-color: var(--line) transparent;
}

/* ── Seitenleiste ────────────────────────────── */
.sidebar {
  display: flex; flex-direction: column;
  /* Passt die Leiste nicht in die Höhe (kleines Handy, große Systemschrift),
     scrollt sie in sich statt das ganze Gerüst nach unten zu schieben. */
  min-height: 0; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--ink-2), var(--ink) 70%);
  padding: 18px 12px 12px;
  gap: 16px;
}
/* Alles außer der Navigationsliste behält seine Höhe — geschrumpft (und notfalls
   gescrollt) wird nur die Liste, sonst schneidet die Livree-Umschaltung ab. */
.sidebar > :not(.nav-list) { flex-shrink: 0; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.brand-mark {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 22px; font-weight: 700;
  color: var(--parch);
  background: linear-gradient(160deg, var(--accent-deep), var(--ink-2));
  border: 1px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 0 18px var(--livery-glow), inset 0 0 8px rgba(0,0,0,.5);
  transition: border-color .4s, box-shadow .4s;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-family: var(--font-display); font-size: 17px; letter-spacing: .06em; }
.brand-sub { font-size: 11px; color: var(--dim); letter-spacing: .04em; }

.system-switch {
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden;
}
/* Drei Regelwerke: der dritte Knopf bekommt die volle Breite darunter */
.system-switch .sys-btn:nth-child(3) { grid-column: 1 / -1; border-top: 1px solid var(--line); }
.sys-btn {
  padding: 8px 4px;
  background: transparent; border: 0;
  color: var(--dim); font-size: 12.5px; font-weight: 600;
  letter-spacing: .02em;
  transition: color .25s, background .25s;
}
.sys-btn.active {
  background: linear-gradient(180deg, var(--accent-deep), transparent 220%);
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}
/* Lange Bezeichnung am Desktop, Kurzform in der schmalen Icon-Leiste */
.sys-short { display: none; }

.nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-btn {
  width: 100%; display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  background: transparent; border: 0; border-radius: 8px;
  color: var(--muted); font-size: 14.5px; font-weight: 500;
  text-align: left;
  transition: background .18s, color .18s;
}
.nav-btn:hover { background: var(--panel); color: var(--text); }
.nav-btn.active {
  background: linear-gradient(90deg, var(--accent-deep), var(--panel) 130%);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-ico { width: 20px; text-align: center; opacity: .85; font-size: 15px; 
font-family: "Segoe UI Symbol", "Arial", sans-serif;
}

.home-btn {
  text-decoration: none;
  border: 1px solid var(--line-soft);
  justify-content: flex-start;
}
.home-btn:hover { border-color: var(--accent-deep); }

.sidebar-foot { display: flex; align-items: center; gap: 8px; padding: 6px 8px 2px; }
.net-dot { width: 8px; height: 8px; border-radius: 50%; background: #4caf6e; flex: none; }
.net-dot.off { background: #b3462e; }
.foot-note { font-size: 10.5px; color: var(--dim); }

/* ── Reiter & Karten ─────────────────────────── */
.tab { display: none; animation: tabin .25s ease; }
.tab.active { display: block; }
@keyframes tabin { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .tab { animation: none; }
  * { transition-duration: .01ms !important; }
}

/* Rechts Platz lassen: dort sitzt der Vollbild-Knopf über dem Inhalt */
.tab-head { margin-bottom: 20px; padding-right: 34px; }
.tab-head h1 {
  font-family: var(--font-display);
  font-size: 26px; letter-spacing: .05em;
  color: var(--text);
}
.tab-head h1::after {
  content: ""; display: block; width: 64px; height: 2px; margin-top: 8px;
  background: linear-gradient(90deg, var(--accent), transparent);
}
.tab-sub { margin: 8px 0 0; color: var(--muted); font-size: 14px; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1.2fr 1fr 1fr; }
@media (max-width: 1100px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
/* Musik-Reiter: Spieler und YouTube stehen nebeneinander, sobald das Raster
   zwei Spalten hat. Ohne align-items:start zöge die hohe YouTube-Karte die
   kurze Spieler-Karte auf ihre Höhe und ließe darunter eine leere Fläche. */
.musik-top { align-items: start; }

.card {
  background: linear-gradient(180deg, var(--panel), var(--ink-2) 160%);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.card.slim { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 12px 18px; }
.card-title {
  font-family: var(--font-display);
  font-size: 14px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent-text);
  margin-bottom: 12px;
}

/* ── Bedienelemente ──────────────────────────── */
.input {
  background: var(--ink-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 7px;
  padding: 8px 11px;
  min-width: 0;
}
.input:focus, .btn:focus-visible, .nav-btn:focus-visible, .sys-btn:focus-visible,
.deck-btn:focus-visible, .subtab-btn:focus-visible, .sound-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.input::placeholder { color: var(--dim); }
textarea.notes {
  width: 100%; min-height: 220px; resize: vertical;
  background: var(--ink-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px;
  font-family: var(--font-book); font-size: 15px; line-height: 1.55;
}

.btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 8px 13px;
  border-radius: 7px;
  font-size: 13.5px; font-weight: 600;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--line-soft); border-color: var(--accent-deep); }
.btn:active { transform: translateY(1px); }
.btn-accent { background: var(--accent-deep); border-color: var(--accent); }
.btn-accent:hover { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--dim); }
.btn-ghost:hover { color: var(--text); background: var(--panel-2); }
.btn.big { font-size: 17px; padding: 8px 18px; }
.file-btn { display: inline-block; }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.dim { color: var(--dim); font-size: 12.5px; }
.pad-note { margin-top: 14px; }
.empty { padding: 40px 24px; text-align: center; color: var(--muted); }
.hint summary { cursor: pointer; color: var(--accent-text); font-size: 13.5px; margin-top: 4px; }
.hint ul { margin: 8px 0 4px; padding-left: 18px; color: var(--muted); font-size: 13.5px; }
.hint li { margin-bottom: 6px; }

/* ── Statblocks ──────────────────────────────── */
.sb-layout {
  display: grid; grid-template-columns: 340px 1fr; gap: 18px;
  align-items: start;
}
@media (max-width: 1100px) { .sb-layout { grid-template-columns: 1fr; } }
.search-row { display: flex; gap: 8px; }
.search-row .input { flex: 1; }
.sb-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.filter-chip {
  background: var(--ink-2); border: 1px solid var(--line);
  color: var(--muted); border-radius: 20px; padding: 3px 12px; font-size: 12.5px;
}
.filter-chip.active { border-color: var(--accent); color: var(--accent-text); }

/* Statblock-Filterzeile: CR-Bereich (von–bis) und Sortierung */
.sb-filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; width: 100%; margin-top: 2px; }
.sb-fl { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); }
.sb-fl-dash { color: var(--dim); }
.sb-mini {
  background: var(--ink-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 7px; padding: 3px 6px; font-size: 12.5px; font-family: inherit;
}
.sb-mini:focus { border-color: var(--accent); outline: none; }
.filter-chip.sb-reset { margin-left: 2px; }

.sb-results { margin-top: 12px; display: flex; flex-direction: column; gap: 4px; max-height: calc(100vh - 300px); overflow-y: auto; }
.sb-group-label { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); margin: 10px 2px 4px; }
.sb-result {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; text-align: left;
  background: var(--panel); border: 1px solid var(--line-soft);
  color: var(--text); border-radius: 8px; padding: 8px 12px;
  transition: border-color .15s, background .15s;
}
.sb-result:hover { border-color: var(--accent-deep); background: var(--panel-2); }
.sb-result.active { border-color: var(--accent); }
.sb-result .lvl {
  font-family: var(--font-mono); font-size: 12px; color: var(--accent-text);
  flex: none;
}
.sb-result .src { font-size: 10.5px; color: var(--dim); display: block; }

.sb-detail-col { position: sticky; top: 0; }
.sb-detail { min-height: 300px; }
.sb-actions-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }

/* Pergament-Insel: der gedruckte Statblock auf dem Pult */
.statblock {
  background:
    radial-gradient(140% 100% at 50% 0%, var(--parch), var(--parch-2)),
    var(--parch);
  color: var(--parch-ink);
  font-family: var(--font-book);
  border-radius: 6px;
  border: 1px solid #b8a687;
  box-shadow: 0 6px 24px rgba(0,0,0,.45), inset 0 0 40px rgba(120,90,40,.09);
  padding: 20px 24px;
  max-width: 860px;
}
.statblock h2 {
  font-family: var(--font-display);
  font-size: 21px; color: var(--accent-deep);
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
}
.statblock h2 .sb-lvl { font-family: var(--font-book); font-size: 15px; font-weight: 700; white-space: nowrap; }
.statblock .sb-meta { font-style: italic; color: var(--parch-dim); margin: 2px 0 8px; }
.statblock hr { border: 0; border-top: 2px solid var(--accent-deep); opacity: .55; margin: 8px 0; }
.statblock p { margin: 5px 0; }
.statblock .prop b { color: var(--accent-deep); }
.statblock .trait-row { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0; }
.trait {
  background: var(--accent-deep); color: #f4e9d0;
  font-family: var(--font-body); font-size: 11px; font-weight: 700;
  letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 8px; border: 1px solid #00000033;
}
.trait.rarity-uncommon { background: #98513d; }
.trait.rarity-rare { background: #002664; }
.trait.rarity-unique { background: #54166e; }
.trait.size-tag { background: #3f5d41; }
.statblock .abil-grid {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px;
  text-align: center; margin: 10px 0;
  font-family: var(--font-mono); font-size: 13px;
}
.statblock .abil-grid .lab { font-family: var(--font-body); font-weight: 700; font-size: 11px; color: var(--accent-deep); }
.statblock h3 {
  font-family: var(--font-body); font-size: 12px; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent-deep);
  border-bottom: 1px solid #b8a687; padding-bottom: 3px; margin: 14px 0 6px;
}
.statblock .action-glyph { font-family: var(--font-body); font-weight: 700; color: var(--accent-deep); letter-spacing: -1px; }
.statblock details.flavor summary { cursor: pointer; color: var(--parch-dim); font-style: italic; }
.statblock .sb-src { margin-top: 12px; font-size: 12px; color: var(--parch-dim); }
.sb-loading { padding: 30px; text-align: center; color: var(--muted); }
.spin { display: inline-block; animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.recent-list { display: flex; flex-direction: column; gap: 4px; }
.recent-list .btn { text-align: left; }

/* ── Initiative ──────────────────────────────── */
.init-layout { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .init-layout { grid-template-columns: 1fr; } }
.init-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.init-form #init-name { grid-column: 1 / -1; }
.init-form button { grid-column: 1 / -1; }
.init-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.init-list { display: flex; flex-direction: column; gap: 8px; }
.init-row {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 4px 14px;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-left: 4px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  align-items: center;
}
.init-row.active-turn {
  border-left-color: var(--accent);
  background: linear-gradient(90deg, var(--accent-deep) -60%, var(--panel) 30%);
  box-shadow: 0 0 14px var(--livery-glow);
}
.init-row.dead { opacity: .45; }
.init-val-wrap { display: flex; flex-direction: column; align-items: center; gap: 3px; grid-row: 1 / 3; }
.init-total {
  font-family: var(--font-mono); font-size: 21px; font-weight: 600;
  color: var(--accent-text); line-height: 1;
}
.init-roll-line { display: flex; align-items: center; gap: 3px; }
.init-roll-input {
  width: 44px;
  font-family: var(--font-mono); font-size: 12.5px; text-align: center;
  color: var(--text);
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 6px;
  padding: 2px 1px;
}
.init-roll-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
/* Keine Hoch/Runter-Pfeile — Eingabe per Tastatur reicht */
.init-roll-input, .dmg-input { -moz-appearance: textfield; appearance: textfield; }
.init-roll-input::-webkit-outer-spin-button, .init-roll-input::-webkit-inner-spin-button,
.dmg-input::-webkit-outer-spin-button, .dmg-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.init-mod-label { font-size: 11px; color: var(--dim); font-family: var(--font-mono); }
.init-name-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.init-name-line .name { font-weight: 700; font-size: 16px; }
.kind-badge { font-size: 10px; font-weight: 700; letter-spacing: .06em; padding: 1px 7px; border-radius: 9px; border: 1px solid var(--line); color: var(--muted); }
.kind-badge.pc { color: #8fc7ff; border-color: #35597c; }
.init-sub { grid-column: 2; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.hp-pill { font-family: var(--font-mono); background: var(--ink-2); padding: 2px 9px; border-radius: 12px; border: 1px solid var(--line); }
.hp-pill.hurt { color: #e8b04b; }
.hp-pill.bloodied { color: #e2604a; }
.init-row-actions { grid-row: 1 / 3; grid-column: 3; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.dmg-input { width: 66px; }
.action-pips { display: flex; gap: 4px; }
.pip {
  width: 18px; height: 18px; border-radius: 4px;
  border: 1px solid var(--accent-deep); background: transparent; color: transparent;
  padding: 0; font-size: 10px;
}
.pip.used { background: var(--accent-deep); }
.cond-chip {
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 1px 8px; font-size: 11.5px; color: var(--accent-text);
}
.cond-chip button { background: none; border: 0; color: var(--dim); padding: 0 0 0 4px; }
.icon-btn { background: transparent; border: 0; color: var(--dim); font-size: 15px; padding: 2px 6px; border-radius: 5px; }
.icon-btn:hover { color: var(--text); background: var(--panel-2); }

/* ── Reaction & Legendary Actions ── */
.r-pip {
  width: auto; min-width: 19px; padding: 0 4px; line-height: 16px;
  color: var(--accent-text); font-size: 10.5px; font-weight: 700;
}
.r-pip.used { background: var(--accent-deep); color: var(--dim); text-decoration: line-through; }
.la-wrap { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--dim); }
.la-pip { color: var(--accent); font-size: 9px; border-color: var(--accent-deep); }
.la-pip.used { color: var(--line); background: transparent; }
.la-max { width: 34px; padding: 1px 4px; font-size: 11px; text-align: center; }
.la-on { color: var(--accent); }

/* ── Handsortierung: ▲▼ an der Initiative-Spalte ──────────────────────────
   Am Rand der eigenen Gleichstandsgruppe sind die Knöpfe deaktiviert und
   sichtbar abgeblendet — statt wirkungslos zu klicken. */
.ord-btns { display: flex; gap: 2px; }
.ord-btn { font-size: 10px; line-height: 1; padding: 2px 5px; }
.ord-btn:disabled { opacity: .25; cursor: default; }
.ord-btn:disabled:hover { background: transparent; color: var(--dim); }

/* ── Teilnehmer bearbeiten (Overlay) ──────────────────────────────────────
   Endet oben an der fixen Regieleiste (bottom: var(--deck-total)), damit
   der Editor nie darunter verschwindet. */
.init-edit[hidden] { display: none !important; }
.init-edit {
  position: fixed; left: 0; right: 0; top: 0; bottom: var(--deck-total);
  z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, .55);
}
.init-edit-box {
  width: min(460px, 100%);
  max-height: 100%;
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--accent-deep);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .6);
}
.init-edit-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft);
}
.init-edit-head .card-title { min-width: 0; overflow-wrap: anywhere; }
.init-edit-body { padding: 14px 16px; overflow-y: auto; display: grid; gap: 12px; align-content: start; }
.init-edit-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--line-soft);
}
.init-edit-foot .btn { min-height: 38px; }
.ed-field { display: grid; gap: 4px; min-width: 0; }
.ed-field > span { font-size: 12px; color: var(--dim); letter-spacing: .04em; }
.ed-field .input { width: 100%; font-size: 16px; }   /* 16px: sonst zoomt iOS beim Antippen hinein */
.ed-hint { font-size: 11.5px; color: var(--dim); font-style: normal; }
.ed-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ed-la { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.ed-la .ed-field .input { width: 84px; }
.ed-check { display: flex; align-items: center; gap: 9px; font-size: 14px; min-height: 34px; }
.ed-check input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }

.filter-sep { flex-basis: 100%; height: 0; }

/* ── Daggerheart: HP/Stress-Kästchen, Schwellen, Spotlight ── */
.slot-row { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--dim); }
.slot-pip {
  width: 14px; height: 14px; border-radius: 3px; padding: 0;
  border: 1px solid var(--line); background: transparent; color: transparent; font-size: 8px;
}
.slot-pip.hp { border-color: #8a4a3a; }
.slot-pip.hp.marked { background: #b3503c; border-color: #b3503c; }
.slot-pip.stress { border-color: #8a7a3a; }
.slot-pip.stress.marked { background: #c0a23c; border-color: #c0a23c; }
.thr-badge {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--accent-text);
  border: 1px solid var(--accent-deep); border-radius: 6px; padding: 1px 6px;
}
.spot-btn { font-size: 15px; color: var(--dim); background: transparent; border: 0; padding: 2px 5px; border-radius: 5px; }
.spot-btn:hover { color: var(--text); background: var(--panel-2); }
.spot-btn.on { color: var(--accent-text); text-shadow: 0 0 8px var(--accent-soft); }
.dh-type-badge {
  font-size: 11px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 10px; padding: 1px 7px; white-space: nowrap;
}

/* Duality & Fear in der Regieleiste */
#deck-dh { flex-shrink: 0; }
#deck-dh .deck-label, #deck-duality, #deck-duality-result { white-space: nowrap; flex-shrink: 0; max-width: none; }
#deck-duality-result.dual-hope { color: #e8c95a; }
#deck-duality-result.dual-fear { color: #b48ef0; }
#deck-duality-result.dual-crit { color: #7fd88f; }
/* Breit genug für den längsten Endtext („24 · Crit!“) — so wandert beim
   Rattern nichts in der Leiste. */
#deck-duality-result { min-width: 108px; }
#deck-duality-result.dual-rolling { color: var(--muted); }
.dual-die-hope { color: #e8c95a; }
.dual-die-fear { color: #b48ef0; }
.fear-btn { padding: 5px 8px; }
#fear-val { min-width: 24px; text-align: center; }
#fear-val.fear-max { color: #e2604a; }

/* ── Übersicht: Gruppe (PCs) ── */
.ov-pc-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 3px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.ov-pc-row:last-child { border-bottom: 0; }
.ov-pc-name { font-weight: 600; }
.ov-pc-vals { margin-left: auto; color: var(--muted); font-family: var(--font-mono); font-size: 12px; }

/* ── Soundboard ──────────────────────────────── */
.audio-controls { margin-bottom: 18px; }
/* Lautstärkeregler: spürbar breiter als die früheren 150px und wachsend —
   der Regler nimmt sich den Platz, der in seiner Karte übrig ist (flex: 1),
   bleibt aber in einer Zeile (die Beschriftung bricht nicht um) und ragt
   dank max-width/min-width nie aus der Karte. */
.vol-label {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--muted);
  min-width: 0;
}
/* ACHTUNG: die Zeile steht einmal in einem Zeilen- und einmal in einem
   Spalten-Layout. flex-basis wirkt auf die HAUPTACHSE — in der Spalte des
   Spielers ist das die HÖHE, ein gemeinsames `flex: 1 1 260px` hat die Zeile
   dort 260px hoch gemacht. Deshalb je Container getrennt: */
.audio-controls .vol-label { flex: 1 1 260px; max-width: 520px; }   /* Zeile: in die Breite wachsen */
.player .vol-label { flex: 0 0 auto; width: 100%; max-width: 520px; }  /* Spalte: volle Breite, Höhe vom Inhalt */
.vol-label > span.vol-cap { flex: none; white-space: nowrap; }
/* Am Handy die Kurzform der Beschriftung — derselbe Kniff wie bei den
   Regelwerk-Knöpfen (.sys-full/.sys-short); so bleibt der Regler in einer
   Zeile und bekommt trotzdem den ganzen Rest der Karte. */
.vol-short { display: none; }
input[type="range"] { accent-color: var(--accent); width: 150px; max-width: 100%; }
.vol-label input[type="range"] { flex: 1 1 auto; width: auto; min-width: 160px; height: 22px; }
.sound-cat { margin-bottom: 20px; }
.sound-cat h2 {
  font-family: var(--font-display); font-size: 13px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 10px;
}
.sound-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.sound-btn {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 9px;
  padding: 13px 10px;
  font-size: 13.5px; font-weight: 600;
  text-align: center;
  transition: border-color .15s, background .15s, box-shadow .2s;
}
.sound-btn:hover { border-color: var(--accent-deep); }
.sound-btn.playing {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--accent-deep), var(--panel) 140%);
  box-shadow: 0 0 12px var(--livery-glow);
}
.sound-btn .loop-mark { position: absolute; top: 4px; right: 7px; font-size: 10px; color: var(--dim); }
.sound-btn.playing .loop-mark { color: var(--accent-text); }

/* ── Musik ───────────────────────────────────── */
.player { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.player-now { font-family: var(--font-book); font-size: 17px; font-style: italic; color: var(--accent-text); min-height: 24px; }
.player-btns { display: flex; gap: 8px; align-items: center; }
#music-loop.active { border-color: var(--accent); color: var(--accent-text); }
.music-list { display: flex; flex-direction: column; gap: 4px; }
.music-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 12px; border-radius: 7px;
  background: var(--panel); border: 1px solid var(--line-soft);
}
.music-row.current { border-color: var(--accent); }
.music-row .title { flex: 1; text-align: left; background: none; border: 0; color: var(--text); font-size: 14px; padding: 0; }
.music-row .title:hover { color: var(--accent-text); }
.music-row .mood { font-size: 11px; color: var(--dim); }
.stack-form { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.tta-list { max-height: 420px; overflow-y: auto; }
.badge-local {
  font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--accent-text); border: 1px solid var(--accent-deep);
  border-radius: 9px; padding: 1px 7px; flex: none;
}
.stream-links { display: flex; flex-direction: column; gap: 8px; }
.stream-links a { font-size: 14px; }
.stream-links .note { font-size: 12px; color: var(--dim); display: block; }

/* ── Tabletop-Audio: Genre-Chips, Tags & Treffer ── */
.tta-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.genre-chip {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 999px; padding: 5px 13px; font-size: 12.5px; font-weight: 600;
  white-space: nowrap;
}
.genre-chip:hover { border-color: var(--accent-deep); color: var(--text); }
.genre-chip.active { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
/* Trefferzeilen des Katalogs: Titelzeile oben, Tags klein darunter —
   wie die Quellenzeile (.src) in den Statblock-Treffern. */
.tta-list .music-row { flex-wrap: wrap; }
.tta-row-main { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; }
.tta-row-main .title { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.tta-tags { display: flex; flex-wrap: wrap; gap: 4px; width: 100%; margin-top: 2px; }
.tag-chip {
  background: none; border: 0; padding: 0 4px 0 0;
  font-size: 10.5px; color: var(--dim); cursor: pointer;
}
.tag-chip:hover { color: var(--accent-text); text-decoration: underline; }
.tta-genre { font-size: 10.5px; color: var(--dim); flex: none; }

/* ── YouTube ── */
.yt-row-main { display: flex; align-items: center; gap: 8px; width: 100%; min-width: 0; }
/* ── Die ganze Zeile trägt den Tipp ──
   Nicht nur der Titel, sondern jede Stelle der Zeile, die kein Knopf ist:
   Kennzeile, Zwischenraum, Rand. Damit auch der Rand dazugehört, wandert die
   Polsterung von .music-row auf .yt-row-main — die Fläche mit dem Merkmal
   deckt so die ganze sichtbare Zeile ab. Die aufgeklappte Liste darunter
   bringt ihre eigene Polsterung mit und gehört ausdrücklich nicht dazu. */
#yt-list .music-row { padding: 0; }
#yt-list .yt-row-main { padding: 7px 12px; }
#yt-list .music-row .title {
  align-self: stretch; display: flex; align-items: center;
  min-height: 28px;
}
/* Der Hinweis gilt der ganzen Fläche, nicht nur dem Titelkasten. Fährt man
   dagegen über einen der drei Knöpfe, tritt er zurück — dort passiert etwas
   anderes. (Ohne :has()-Unterstützung leuchtet die Zeile eben mit; das ist
   der harmlosere Ausfall.) */
.yt-row-main[data-yt-play]:hover { background: var(--panel-2); border-radius: 7px; }
.yt-row-main[data-yt-play]:has(.icon-btn:hover) { background: none; }
.yt-note { font-size: 12px; color: var(--dim); margin: 8px 0 0; }
/* Bühne des YouTube-Players. Eingeklappt bleibt sie ein schmaler Streifen —
   bewusst NICHT display:none und nicht 0×0: mehrere Browser halten die
   Wiedergabe an, sobald der Player ausgeblendet wird. */
.yt-stage {
  margin-top: 10px; border: 1px solid var(--line-soft); border-radius: 8px;
  overflow: hidden; background: #000; width: 100%; max-width: 420px;
}
/* Eingeklappt: nur noch ein 6px-Streifen. Der Player darunter bleibt in
   voller Größe gerendert und wird lediglich abgeschnitten. */
.yt-stage.collapsed { height: 6px; }
.yt-stage iframe, .yt-stage > div { width: 100%; aspect-ratio: 16 / 9; border: 0; display: block; }
/* Platzhalter, solange noch kein Player läuft — YT.Player ersetzt das
   Element beim ersten Abspielen vollständig. */
#yt-player { display: flex; align-items: center; justify-content: center; text-align: center; }
.yt-ph { color: var(--dim); font-size: 12px; padding: 0 12px; }
.yt-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
/* Die beiden Übergang-Knöpfe und ihre Anzeige gehören zusammen und brechen
   als Einheit um — getrennt stünde „−1 s“ sonst ohne Bezug in der Zeile. */
.yt-trim { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.yt-trim .btn { padding: 5px 9px; }
.yt-trim-val { font-variant-numeric: tabular-nums; }
.yt-trim-val.active { border-color: var(--accent); color: var(--accent-text); }
.yt-trim .btn[disabled] { opacity: .45; }
.yt-search-results { margin-top: 10px; max-height: 260px; overflow-y: auto; }
.yt-key-hint { font-size: 12px; color: var(--dim); margin-top: 6px; }
.yt-key-hint code { font-size: 11.5px; }

/* ── Abschnitte (Kapitel) bzw. Playlist-Stücke ──
   Die Liste sitzt als Akkordeon IN ihrer Zeile in #yt-list, direkt unter dem
   Titel. Damit die Fläche eine eigene Zeile bekommt statt neben .yt-row-main
   gequetscht zu werden, darf die Zeile umbrechen — auf jeder Breite, nicht
   erst am Handy. */
#yt-list .music-row { flex-wrap: wrap; }
/* Der Aufklapppfeil: schmaler als die übrigen Zeilenknöpfe, weil ▸/▾ kaum
   Platz braucht — und zurückhaltend gefärbt, er ist kein Befehl. */
.yt-sec-caret { color: var(--dim); font-size: 11px; }
.yt-sec-caret[aria-expanded="true"] { color: var(--accent-text); }
/* Die aufgeklappte Fläche. Volle Zeilenbreite, abgesetzt durch eine
   Trennlinie statt durch einen zweiten Rahmen — ein Kasten im Kasten würde
   die Liste zerfasern. Der Rollbereich steckt in .yt-sec-list. */
.yt-sec-panel {
  width: 100%; min-width: 0;
  padding: 8px 12px 10px; border-top: 1px solid var(--line-soft);
}
.yt-sec-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.yt-sec-tools .input { flex: 1 1 auto; min-width: 0; max-width: 260px; }
.yt-sec-note { font-size: 12px; color: var(--dim); margin: 8px 0 0; overflow-wrap: anywhere; }
.yt-sec-hint { font-size: 12px; color: var(--dim); margin: 6px 0 0; }
/* 260px Deckel mit eigenem Rollbalken: die Hollow-Knight-Zeile hat 42
   Abschnitte — ungedeckelt würde eine einzige Zeile die Karte sprengen. */
.yt-sec-list {
  display: flex; flex-direction: column; gap: 3px;
  margin-top: 8px; max-height: 260px; overflow-y: auto; min-width: 0;
}
.yt-sec { display: flex; align-items: center; gap: 6px; min-width: 0; }
/* Die Sprungfläche nimmt die ganze Restbreite — der ＋-Knopf bleibt rechts. */
.yt-sec-jump {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: 6px;
  color: var(--text); font-size: 13px; padding: 6px 10px; min-height: 34px;
}
.yt-sec-jump:hover { border-color: var(--accent-deep); color: var(--accent-text); }
.yt-sec-t {
  flex: none; font-family: var(--font-mono); font-size: 11.5px;
  color: var(--dim); min-width: 48px;
}
/* Lange Kapitelnamen dürfen die Zeile nicht zur Wand machen: höchstens zwei
   Zeilen, der Rest steht im Tooltip. */
.yt-sec-n {
  flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; overflow: hidden;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2;
}
/* Bei Playlists steht links die laufende Nummer statt einer Zeitmarke —
   rechtsbündig und schmaler, damit „7.“ und „12.“ untereinander stehen. */
.yt-sec-list.trk .yt-sec-t { min-width: 30px; text-align: right; }
.yt-sec.current .yt-sec-jump { border-color: var(--accent); background: var(--accent-soft); }
.yt-sec.current .yt-sec-t { color: var(--accent-text); }
.yt-sec-take { flex: none; }
.yt-sec-manual { margin-top: 10px; }
.yt-sec-manual > summary { font-size: 12.5px; color: var(--muted); cursor: pointer; }
.yt-sec-manual > summary:hover { color: var(--accent-text); }
.yt-sec-manual .dim { font-size: 12px; margin: 6px 0; }
.yt-sec-manual textarea {
  width: 100%; min-height: 110px; margin-top: 6px;
  font-family: var(--font-mono); font-size: 12px;
}

/* ── Karten ──────────────────────────────────── */
.maps-layout { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .maps-layout { grid-template-columns: 1fr; } }
.map-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.map-row { display: flex; align-items: center; gap: 6px; }
.map-row .btn { flex: 1; text-align: left; }
.map-row .btn.current { border-color: var(--accent); color: var(--accent-text); }
.maps-viewer { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.maps-viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 0 4px; }
.map-frame-wrap { height: calc(100vh - 250px); min-height: 380px; background: #000; border-radius: 6px; overflow: hidden; }
.map-frame-wrap iframe { width: 100%; height: 100%; border: 0; }
.map-frame-wrap .map-img { width: 100%; height: 100%; object-fit: contain; display: block; }

/* ── Loot & Shops ────────────────────────────── */
.subtabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid var(--line-soft); }
.subtab-btn {
  background: transparent; border: 0; color: var(--muted);
  padding: 9px 16px; font-size: 14px; font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.subtab-btn.active { color: var(--accent-text); border-bottom-color: var(--accent); }
.subtab-panel { display: none; }
.subtab-panel.active { display: block; }
.loot-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.loot-controls label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.loot-result { max-width: 760px; }
.loot-result .statblock h2 { font-size: 18px; }
.coin { font-family: var(--font-mono); font-weight: 600; }
.shop-table-wrap { overflow-x: auto; margin-top: 4px; }
table.shop { width: 100%; border-collapse: collapse; font-size: 14px; }
table.shop th {
  text-align: left; font-family: var(--font-body); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .08em; color: var(--dim);
  padding: 7px 10px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--ink);
}
table.shop td { padding: 6px 10px; border-bottom: 1px solid var(--line-soft); }
table.shop tr:hover td { background: var(--panel); }
table.shop .price { font-family: var(--font-mono); color: var(--accent-text); white-space: nowrap; }
table.shop .lvl-cell { font-family: var(--font-mono); text-align: center; }

/* PF2e-Schatz-Tabelle */
table.ref { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.ref th { text-align: left; color: var(--dim); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; padding: 4px 8px; border-bottom: 1px solid var(--line); }
table.ref td { padding: 4px 8px; border-bottom: 1px solid var(--line-soft); }
table.ref tr.hl td { background: var(--accent-deep); color: #fff; border-radius: 4px; }

/* ── WLED ────────────────────────────────────── */
.scene-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.scene-btn {
  border: 1px solid var(--line); border-radius: 9px;
  padding: 14px 10px; font-weight: 700; font-size: 13.5px;
  color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.7);
  background: var(--panel);
}
.scene-btn:hover { filter: brightness(1.2); }
.wled-devices { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.wled-dev {
  background: var(--panel); border: 1px solid var(--line-soft); border-radius: 9px;
  padding: 12px 14px;
}
.wled-dev-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.wled-dev-head .name { font-weight: 700; flex: 1; }
.wled-dev-head .ip { font-family: var(--font-mono); font-size: 12px; color: var(--dim); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--dim); flex: none; }
.status-dot.on { background: #4caf6e; box-shadow: 0 0 6px #4caf6e88; }
.status-dot.err { background: #b3462e; }
.wled-dev-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.swatch-row { display: flex; gap: 6px; }
.swatch { width: 24px; height: 24px; border-radius: 6px; border: 1px solid #00000066; padding: 0; }
.swatch:hover { transform: scale(1.12); }

/* ── Encounters ──────────────────────────────── */
.enc-layout { display: grid; grid-template-columns: 340px 1fr; gap: 18px; align-items: start; }
@media (max-width: 1100px) { .enc-layout { grid-template-columns: 1fr; } }
.enc-head-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.enc-head-row .input { flex: 1; font-weight: 700; }
.enc-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.enc-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: 8px; padding: 7px 10px;
}
.enc-count { width: 56px; text-align: center; font-family: var(--font-mono); }
.enc-row-name { font-weight: 600; flex: 1; }
.enc-row-stats { font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }
.enc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.enc-diff {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.enc-size { width: 58px; text-align: center; padding: 4px 6px; }
.diff-badge {
  font-weight: 700; font-size: 12.5px; letter-spacing: .04em;
  padding: 4px 14px; border-radius: 14px; border: 1px solid #00000055;
  color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5);
}
.diff-none { background: var(--panel-2); color: var(--dim); text-shadow: none; }
.diff-green { background: #3f7a4c; }
.diff-yellow { background: #a8862a; }
.diff-orange { background: #b35c26; }
.diff-red { background: #a52a22; }
.enc-diff-detail { margin: 0 0 10px; font-size: 12px; }
.map-row .btn.current { border-color: var(--accent); color: var(--accent-text); }
.party-table .input { width: 100%; min-width: 60px; padding: 4px 8px; font-size: 13.5px; }
.party-table td:first-child .input { min-width: 130px; }

/* Zahlenfelder ohne Spinner-Pfeile */
.no-spin { -moz-appearance: textfield; appearance: textfield; }
.no-spin::-webkit-outer-spin-button, .no-spin::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ── Initiative: Laden & Live-Statblock ──────── */
.init-load-row { display: flex; gap: 8px; }
.init-load-row select { flex: 1; }
.init-main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.init-statblock .statblock { max-width: none; }
.init-name-line .name.has-sb { cursor: pointer; text-decoration: underline dotted var(--accent-deep); text-underline-offset: 3px; }
.init-name-line .name.has-sb:hover { color: var(--accent-text); }

/* ── Regel-Schnellsuche ──────────────────────── */
.rules-search-wrap { padding: 0 2px; }
.rules-search-wrap .input { width: 100%; font-size: 13px; }
.rules-panel[hidden] { display: none !important; }
.rules-panel {
  position: fixed; left: 240px; top: 18px; z-index: 80;
  width: min(860px, calc(100vw - 260px));
  max-height: calc(100vh - var(--deck-total) - 40px);
  max-height: calc(100dvh - var(--deck-total) - 40px);
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--accent-deep);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0,0,0,.6);
}
/* (Mobil-Anpassungen der Regel-Schnellsuche: siehe „Schmale Fenster“ am Dateiende —
   sie müssen NACH den Basisregeln stehen, sonst überstimmt die Basis das Grid.) */
.rules-panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; border-bottom: 1px solid var(--line-soft);
}
.rules-panel-body {
  display: grid; grid-template-columns: 320px 1fr; gap: 0;
  overflow: hidden; flex: 1; min-height: 240px;
}
.rules-filters { padding: 8px 16px 0; margin-top: 0; border-bottom: 0; }
.rules-filters .filter-chip { padding: 3px 10px; }
/* Trefferspalte ist schmal: Name einzeilig, Kategorie + Kurzmeta darunter,
   bei Bedarf mit Auslassungspunkten abgeschnitten. */
.rules-list .sb-result > span { min-width: 0; flex: 1; }
.rules-list .sb-result .src,
.rules-list .sb-result > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rules-list { padding: 10px; overflow-y: auto; border-right: 1px solid var(--line-soft); margin: 0; max-height: none; }
.rules-detail { padding: 14px 18px; overflow-y: auto; }
.rules-title { font-family: var(--font-display); font-size: 17px; color: var(--accent-text); margin-bottom: 10px; display: flex; gap: 10px; align-items: center; }
.rules-meta { font-size: 12.5px; margin: -4px 0 10px; }
/* Fußzeile der Trefferliste: Absprung ins Nachschlagewerk, eigener Eintrag */
.rules-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 10px 4px 2px; margin-top: 6px;
  border-top: 1px solid var(--line-soft); font-size: 12.5px;
}
.rules-foot .btn { padding: 4px 10px; font-size: 12.5px; }
/* Editor für eigene Einträge */
.own-form { display: flex; flex-direction: column; gap: 8px; }
.own-form .input { width: 100%; }
.own-text { min-height: 180px; resize: vertical; font-family: var(--font-mono); font-size: 13px; line-height: 1.5; }
.own-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.own-hint { font-size: 12px; margin: 0; }
.rules-text { font-family: var(--font-book); font-size: 15px; line-height: 1.55; }
.rules-text table { border-collapse: collapse; margin: 8px 0; }
.rules-text td, .rules-text th { border: 1px solid var(--line); padding: 3px 8px; font-size: 13px; }
.rules-text hr { border: 0; border-top: 1px solid var(--line); }

/* ── Regieleiste ─────────────────────────────── */
.deck {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--deck-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 18px;
  background: linear-gradient(180deg, var(--ink-2), #120e0b);
  border-top: 1px solid var(--line);
  box-shadow: 0 -6px 20px rgba(0,0,0,.45);
  z-index: 50;
}
.deck-group { display: flex; align-items: center; gap: 7px; min-width: 0; }
.deck-dice { flex-shrink: 0; }
.deck-music { min-width: 120px; }
.deck-init { margin-left: auto; }
.deck-btn {
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 6px;
  padding: 5px 10px; font-size: 12.5px; font-weight: 600;
}
.deck-btn:hover { border-color: var(--accent-deep); }
.deck-label { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.deck-input { width: 76px; background: var(--ink); border: 1px solid var(--line); color: var(--text); border-radius: 6px; padding: 5px 8px; font-family: var(--font-mono); font-size: 12.5px; }

/* ── Rundentracker-Chips in der Regieleiste ──
   Eine Zeile, die bei vielen Chips horizontal scrollt, statt in die
   Nachbargruppen oder nach oben aus der Leiste zu wachsen. */
.deck-timers {
  flex: 0 1 auto; min-width: 0; max-width: 38vw;
  flex-wrap: nowrap; gap: 6px;
  overflow-x: auto; overflow-y: hidden;
  padding: 6px 2px;
  scrollbar-width: thin; scrollbar-color: var(--accent-deep) transparent;
}
.deck-timers::-webkit-scrollbar { height: 5px; }
.deck-timers::-webkit-scrollbar-thumb { background: var(--accent-deep); border-radius: 3px; }
.deck-timers:empty { display: none; }
.timer-chip {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--line); border-radius: 8px; padding: 2px 6px;
  background: var(--ink); font-size: 12px; color: var(--muted);
}
.timer-chip .icon-btn { font-size: 12px; padding: 0 3px; }
.timer-label { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.timer-chip .timer-left { width: 44px; text-align: center; padding: 2px 4px; }
.timer-chip .timer-name-input { width: 110px; padding: 2px 6px; }
.timer-chip.expired { border-color: #e2604a; }
.timer-chip.expired .timer-label, .timer-chip.expired .timer-left { color: #e2604a; }
.timer-chip.expired { animation: timerPulse 1.2s ease-in-out infinite; }
@keyframes timerPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(226, 96, 74, 0); }
  50% { box-shadow: 0 0 8px 1px rgba(226, 96, 74, .55); }
}
.deck-result {
  font-family: var(--font-mono); font-size: 15px; font-weight: 600;
  color: var(--accent-text); min-width: 70px; cursor: pointer;
  padding: 3px 8px; border-radius: 6px;
  /* Feste Ziffernbreite + Mindestbreite: die wechselnden Zahlen der
     Würfelanimation dürfen die Nachbarknöpfe nicht verschieben. */
  flex-shrink: 0; text-align: center;
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1;
  white-space: nowrap;
}
.deck-result:hover { background: var(--panel-2); }

/* ── Würfelanimation in der Regieleiste ──
   Rattern (rolling) und kurzes Aufblitzen in der Regelwerksfarbe beim
   Einrasten. Nur Anzeige — das Ergebnis steht logisch längst fest. */
.deck-result.rolling { color: var(--muted); }
.deck-result.roll-flash { animation: deckRollFlash .45s ease-out; }
@keyframes deckRollFlash {
  0%   { background: var(--accent-soft); box-shadow: 0 0 10px 1px var(--accent-soft); text-shadow: 0 0 8px var(--accent); }
  100% { background: transparent; box-shadow: 0 0 0 0 transparent; text-shadow: none; }
}
/* Würfelton-Schalter: aus = abgeblendet */
#deck-dice-sound { min-width: 34px; text-align: center; padding: 5px 7px; line-height: 1.25; }
#deck-dice-sound.off { opacity: .45; color: var(--muted); }
@media (prefers-reduced-motion: reduce) {
  .deck-result.roll-flash { animation: none; }
}
.dice-history {
  position: fixed; bottom: calc(var(--deck-total) + 8px); right: 220px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 9px; padding: 10px 14px; z-index: 60;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--muted);
  max-width: 320px; box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.dice-history div b { color: var(--accent-text); }

/* ── Vollbild-Knopf (rechte obere Ecke) ──────── */
/* z-index bewusst unter dem Regel-Overlay (80) und dem Toast — der Knopf soll
   nie über einem geöffneten Panel liegen. */
.fs-btn {
  position: fixed; top: 10px; right: 14px; z-index: 55;
  width: 34px; height: 34px; padding: 0;
  display: grid; place-items: center;
  background: var(--panel); border: 1px solid var(--line);
  color: var(--muted); border-radius: 8px;
  opacity: .55;
  transition: opacity .18s, border-color .18s, color .18s;
}
.fs-btn:hover, .fs-btn:focus-visible { opacity: 1; border-color: var(--accent-deep); color: var(--accent-text); }
.fs-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
/* Ausklappen-Symbol im Normalzustand, Einklappen-Symbol im Vollbild */
.fs-btn .fs-ico-off { display: none; }
.fs-btn.on .fs-ico-on { display: none; }
.fs-btn.on .fs-ico-off { display: inline; }
.fs-btn.on { opacity: .85; color: var(--accent-text); border-color: var(--accent-deep); }

/* ── Toast ───────────────────────────────────── */
.toast {
  position: fixed; bottom: calc(var(--deck-total) + 14px); left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--panel-2); border: 1px solid var(--accent-deep);
  color: var(--text); border-radius: 8px; padding: 9px 18px; font-size: 13.5px;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
  z-index: 100; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Schmale Fenster ─────────────────────────── */
@media (max-width: 760px) {
  .layout { grid-template-columns: 64px 1fr; }
  .brand-text, .foot-note, .nav-lab { display: none; }
  /* Die Icon-Leiste etwas dichter setzen, damit brand → nav → Online-Punkt in
     die Fensterhöhe passen und unten nichts an der Regieleiste abgeschnitten wird. */
  .sidebar { gap: 10px; padding: 12px 10px 8px; }
  .nav-btn { justify-content: center; padding: 10px 0; }
  .nav-ico { width: auto; }
  /* Regelwerk-Knöpfe: Kurzformen (PF2e/D&D/DH) untereinander, damit in der
     64px-Leiste nichts abgeschnitten wird */
  .system-switch { grid-template-columns: 1fr; }
  .system-switch .sys-btn:nth-child(3) { grid-column: auto; border-top: 0; }
  .system-switch .sys-btn + .sys-btn { border-top: 1px solid var(--line); }
  .sys-btn { padding: 9px 2px; font-size: 12px; }
  .sys-full { display: none; }
  .sys-short { display: inline; }
  /* Etwas mehr Luft unten, damit der letzte Inhalt nicht an der Regieleiste klebt */
  .main { padding: 18px 14px 52px; }
  /* Regieleiste: als Streifen seitlich scrollen — nichts darf mehr unter seine
     Mindestbreite gequetscht werden, sonst überlappen die Knöpfe. */
  .deck {
    gap: 10px; padding: 0 10px;
    overflow-x: auto; overflow-y: hidden;
    scrollbar-width: thin; scrollbar-color: var(--accent-deep) transparent;
    -webkit-overflow-scrolling: touch;
  }
  .deck::-webkit-scrollbar { height: 5px; }
  .deck::-webkit-scrollbar-thumb { background: var(--accent-deep); border-radius: 3px; }
  .deck-group { flex-shrink: 0; }
  .deck-music { min-width: 0; }
  .deck-label { max-width: 110px; }
  .deck-input { width: 60px; }
  .deck-timers { max-width: none; overflow-x: visible; }
  .deck-init { margin-left: 0; }

  /* Regel-Schnellsuche: Panel füllt den Schirm, Liste und Regeltext übereinander
     statt nebeneinander — sonst ragt der Text rechts aus dem Bild. */
  .rules-search-wrap .input:focus {
    position: fixed; left: 72px; right: 8px; top: 8px; width: auto;
    z-index: 95; font-size: 16px;   /* 16px verhindert den Auto-Zoom von iOS */
  }
  .rules-panel {
    left: 8px; right: 8px; width: auto; top: 52px;
    height: calc(100vh - var(--deck-total) - 64px);
    height: calc(100dvh - var(--deck-total) - 64px);
    max-height: none;
  }
  .rules-panel-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 2fr) minmax(0, 3fr);
    min-height: 0;
  }
  .rules-list { border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .rules-detail { padding: 12px 14px; }
  .rules-filters { padding: 6px 10px 0; gap: 5px; }
  /* Eigener-Eintrag-Editor: 16px gegen den iOS-Zoom, Zielflächen fürs Antippen */
  .own-form .input, .own-text { font-size: 16px; }
  .own-actions .btn { min-height: 34px; }

  /* Vollbild-Knopf: größere Zielfläche für den Finger, dauerhaft sichtbar
     (ohne Mauszeiger gibt es kein :hover, das ihn aufhellen könnte) */
  .fs-btn { top: 8px; right: 8px; width: 38px; height: 38px; opacity: .8; }
  .fs-btn svg { width: 20px; height: 20px; }
  .tab-head { padding-right: 42px; }

  /* Statblock-Filter: Auswahlfelder mit 16px, sonst zoomt iOS beim Antippen.
     Der Zurücksetzen-Chip rutscht in die Zeile statt nach rechts außen. */
  .sb-mini { font-size: 16px; padding: 5px 6px; }
  .sb-filter-row { gap: 8px; }

  /* ── Initiative-Zeilen: am Handy stapeln statt überlaufen ──────────────
     Ursache des Fehlers: .init-row ist ein Raster „72px 1fr auto“. Die
     mittlere Spalte (1fr) hat als automatisches Minimum ihren min-content —
     also das längste unteilbare Stück (ein langer Name, bei Daggerheart die
     komplette, nicht umbrechende Kästchenreihe). Die dritte Spalte (auto)
     erbt die feste Breite des HP-Feldes. In Summe wurden die Spalten breiter
     als die Box, und HP-Feld, −, ＋, ☆ und ✕ standen rechts außerhalb.
     Mobil daher: zwei Spalten, mittlere als minmax(0, 1fr) — damit sie
     schrumpfen DARF —, Zustände und Bedienleiste jeweils über die volle
     Breite in eigene Rasterzeilen. */
  .init-row {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px 10px;
    padding: 10px 10px;
  }
  .init-val-wrap { grid-row: 1; grid-column: 1; }
  .init-name-line { grid-row: 1; grid-column: 2; min-width: 0; }
  .init-sub { grid-row: 2; grid-column: 1 / -1; min-width: 0; }
  /* Bedienleiste als eigenes 3-spaltiges Raster über die volle Breite:
     [HP-Feld] [−] [＋] / [🕐] [☆] [✕] — bricht immer gleich um statt
     unberechenbar zu fließen, und jede Fläche wird so von selbst groß genug. */
  .init-row-actions {
    grid-row: 3; grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--line-soft);
  }
  /* Lange Namen dürfen notfalls im Wort brechen, sonst sprengen sie die Spalte */
  .init-name-line .name { min-width: 0; overflow-wrap: anywhere; }
  /* Kästchen- und Legendary-Reihen umbrechen lassen (waren inline-flex ohne Umbruch) */
  .slot-row, .la-wrap, .action-pips { flex-wrap: wrap; }
  .init-sub .dim { min-width: 0; overflow-wrap: anywhere; }

  /* Fingerfreundliche Zielflächen (≥ 34px) für die Bedienleiste der Zeile */
  .init-row-actions .btn,
  .init-row-actions .icon-btn {
    min-width: 34px; min-height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 4px 8px;
  }
  .init-row-actions .dmg-input {
    width: auto; min-height: 34px;
    font-size: 16px;   /* 16px verhindert den Auto-Zoom von iOS */
    padding: 5px 8px;
  }
  .spot-btn { min-width: 34px; min-height: 34px; font-size: 19px; }
  /* Würfelwurf-Feld: 16px gegen den iOS-Zoom, dafür etwas breiter */
  .init-roll-input { width: 52px; font-size: 16px; padding: 4px 2px; }
  /* Das Zustands-Auswahlfeld trägt ein Inline-style aus initiative.js —
     nur mit !important auf 16px zu bekommen (sonst zoomt iOS hinein). */
  .init-sub select.input {
    font-size: 16px !important;
    padding: 5px 8px !important;
    min-height: 34px; max-width: 100%;
  }
  /* Kästchen und Pips etwas größer — mit dem Finger sonst kaum zu treffen */
  .slot-row { gap: 4px; }
  .slot-pip { width: 22px; height: 22px; border-radius: 5px; }
  .pip { width: 24px; height: 24px; }
  .la-pip { font-size: 11px; }
  .r-pip { min-width: 26px; height: 24px; line-height: 22px; font-size: 12px; }
  .cond-chip { padding: 3px 10px; font-size: 12.5px; }
  .cond-chip button { padding: 0 0 0 8px; font-size: 13px; }

  /* Die Spalten des Initiative-Reiters dürfen schrumpfen. Mit „1fr“ war ihr
     Minimum der min-content des Formularrasters — die Karte wurde damit
     breiter als das Fenster und schob die Kampfzeilen bei 320/360px nach
     rechts aus dem Bild. Derselbe minmax(0, 1fr)-Kniff wie bei .init-row. */
  .init-layout { grid-template-columns: minmax(0, 1fr); }
  .init-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

  /* Handsortier-Pfeile: fingerfreundliche Zielflächen (≥ 34px). Sie sitzen
     in der linken Spalte (auto-breit) — die Bedienleiste rechts bleibt damit
     ihr bewährtes 3×2-Raster, nichts ragt heraus. */
  .ord-btns { gap: 4px; }
  .init-val-wrap .ord-btn {
    min-width: 34px; min-height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0; font-size: 12px;
  }

  /* Bearbeiten-Overlay: fast volle Breite, oben andocken (sonst schiebt die
     eingeblendete Tastatur den Inhalt aus dem Bild) — und nie unter der
     Regieleiste, dafür sorgt bottom: var(--deck-total) an .init-edit. */
  .init-edit { padding: 12px 10px; align-items: flex-start; }
  .init-edit-box { width: 100%; }
  .init-edit-head { padding: 10px 12px; }
  .init-edit-head .icon-btn {
    min-width: 34px; min-height: 34px;
    display: inline-flex; align-items: center; justify-content: center; padding: 0;
  }
  .init-edit-body { padding: 12px; gap: 10px; }
  .init-edit-foot { padding: 10px 12px; }
  .init-edit-foot .btn { flex: 1; min-height: 42px; }
  .ed-row { gap: 10px; }
  .ed-la { gap: 10px; }
  .ed-la .ed-field .input { width: 92px; }

  /* ── Lautstärkeregler am Handy ──
     Der Regler nimmt die ganze Restbreite der Karte, die Beschriftung bleibt
     daneben stehen (kein Umbruch). 34px Höhe, damit der Daumen trifft. */
  .vol-label { gap: 8px; }
  .audio-controls .vol-label { flex: 1 1 100%; max-width: 100%; }
  .player .vol-label { max-width: 100%; }
  .vol-full { display: none; }
  .vol-short { display: inline; }
  .vol-label input[type="range"] { min-width: 90px; height: 34px; }
  .audio-controls.card.slim { gap: 10px; }

  /* Genre-Chips und Tag-Klicks: fingerfreundlich (≥ 34px) */
  .genre-chip { min-height: 34px; padding: 6px 14px; }
  .tag-chip { min-height: 28px; padding: 3px 6px 3px 0; font-size: 11.5px; }

  /* Musik-Suchfelder mit 16px, sonst zoomt iOS beim Antippen hinein */
  #tta-q, #yt-q, #yt-add-url, #yt-add-name, #yt-api-key, #yt-io,
  #yt-sec-q, #yt-sec-manual {
    font-size: 16px; min-height: 34px;
  }
  /* Der YouTube-Player darf die Karte nicht sprengen */
  .yt-stage { max-width: 100%; }
  .yt-bar .btn { min-height: 34px; }
  /* Am Handy bricht die Leiste leicht um — die Übergang-Gruppe bleibt
     zusammen und darf dafür die ganze Breite nehmen. */
  .yt-trim { flex: 1 1 100%; }
  .yt-trim .btn { flex: 1 1 auto; min-width: 0; }

  /* ── Abschnitte am Handy ──
     Suchfeld über die ganze Breite, Knopf darunter; Zielflächen ≥ 34px. */
  .yt-sec-tools .input { max-width: 100%; flex: 1 1 100%; }
  .yt-sec-tools .btn { min-height: 34px; flex: 1 1 auto; }
  .yt-sec-list { max-height: 50vh; }
  .yt-sec-jump { min-height: 38px; }
  .yt-sec-take { min-width: 34px; min-height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
  .yt-sec-manual .btn { min-height: 34px; }

  /* ── YouTube-Zeile am Handy ──
     Zwei Zeilen: der Titel für sich, darunter Kennzeile UND ▸/✎/✕ gemeinsam.
     Ohne den Umbruch schieben die Knöpfe auf schmalen Geräten (ab ~320 px)
     rechts aus der Karte heraus, weil .music-row .title zwar flex:1 hat, aber
     kein min-width:0. (Der Umbruch der ZEILE selbst steht oben — die
     aufgeklappte Fläche braucht ihn auf jeder Breite.) */
  .yt-row-main { flex-wrap: wrap; }
  /* Am Handy hat der Titel eine ganze Zeile für sich — dann auch mit
     fingerfreundlicher Höhe. */
  .yt-row-main .title { flex: 1 1 100%; min-width: 0; overflow-wrap: anywhere; }
  #yt-list .music-row .title { min-height: 34px; }
  /* Die Kennzeile („Playlist · 3 Stücke · Server“) darf beliebig schrumpfen
     und wird notfalls abgeschnitten — der volle Text steht im title.
     Entscheidend ist die Basis 0: Flexbox bricht die Zeile nach der
     GEWÜNSCHTEN Breite um, nicht nach der geschrumpften. Mit Basis auto
     verlangte die Kennzeile ihre volle Textbreite, und die Knöpfe rutschten
     in eine dritte Zeile — genau der Fehler, der hier behoben ist. */
  .yt-row-main .mood {
    flex: 1 1 0; min-width: 0;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  /* Die Knöpfe behalten ihre Zielfläche und weichen nie: lieber wird die
     Kennzeile kürzer. */
  .yt-row-main .icon-btn {
    flex: none; min-width: 34px; min-height: 34px;
    display: inline-flex; align-items: center; justify-content: center; padding: 0;
  }
  .yt-row-main .input { flex: 1 1 100%; min-width: 0; }
}
