:root {
  --bg: #14161a;
  --panel: #1d2026;
  --panel2: #262a32;
  --line: #333844;
  --text: #e7e9ee;
  --muted: #9aa1ad;
  --accent: #d8ab5e;
  --accent2: #6fb2c9;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: system-ui, sans-serif; background: var(--bg); color: var(--text);
  line-height: 1.5;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---- Header mit Hub-Knopf ---- */
header {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px 8px;
}
.titles { min-width: 0; }
h1 { margin: 0; font-size: 1.5rem; }
.sub { color: var(--muted); margin: 3px 0 0; font-size: .9rem; }
.hubbtn {
  display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto;
  height: 40px; padding: 0 15px; border-radius: 999px;
  background: var(--panel2); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; font-weight: 600; font-size: .92rem; white-space: nowrap;
}
.hubbtn:hover, .hubbtn:active { border-color: var(--accent); }

main {
  display: grid; grid-template-columns: 360px 1fr; gap: 20px;
  padding: 16px 20px 40px; align-items: start;
}
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
h2 { margin: 0 0 14px; font-size: 1.1rem; }

/* ---- Formular ---- */
form { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; }
.row label { flex: 1; min-width: 0; }
label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: var(--muted); }
input, select, textarea {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
  padding: 11px 12px; color: var(--text);
  font-size: 16px;                 /* 16px verhindert Auto-Zoom auf iOS beim Fokus */
  width: 100%;
  font-family: inherit;
}
textarea { resize: vertical; min-height: 150px; line-height: 1.5; }
button {
  background: var(--accent); color: #1a1204; border: 0; border-radius: 8px;
  padding: 12px 16px; font-weight: 600; cursor: pointer; font-size: .95rem;
  min-height: 44px;                /* fingerfreundlich */
}
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); font-weight: 500; }
button:hover { filter: brightness(1.08); }

/* ---- Ideen-Generator ---- */
.vorschlag { display: flex; flex-direction: column; gap: 10px; }
#vpanel.hidden { display: none; }   /* id-Spezifitaet schlagen (wie beim Modal) */
#vpanel { display: flex; flex-direction: column; gap: 10px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.vcard {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; margin-top: 8px; cursor: pointer;
}
.vcard:hover { border-color: var(--accent); }
.vcard b { color: var(--accent); }
.vcard p { margin: 6px 0 6px; font-size: .88rem; }
.vcard .pick { color: var(--accent2); font-size: .8rem; font-weight: 600; }

/* ---- Song-Analyse ---- */
#song-up-wrap input[type=file] { font-size: .85rem; padding: 8px; }
.analyse {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; margin-top: 8px;
}
.a-kopf { font-weight: 600; color: var(--accent); }
.a-thema { font-size: .85rem; color: var(--muted); margin: 4px 0; }
.a-timeline { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; }
.a-timeline .seg {
  font-size: .68rem; padding: 2px 7px; border-radius: 20px;
  background: #2f3540; border: 1px solid var(--line); white-space: nowrap;
}
.a-timeline .e-hoch { border-color: var(--accent); color: var(--accent); }
.a-timeline .e-mittel { border-color: var(--accent2); }
.a-hint { font-size: .72rem; color: var(--muted); margin-top: 6px; }
#brief-song-box { margin-top: 8px; }
.shot-row .szeit {
  display: inline-block; background: #2f3540; color: var(--accent2);
  font-size: .72rem; font-weight: 600; padding: 1px 8px; border-radius: 20px; margin-right: 4px;
}

/* ---- Ordner-Filter + Spot-Gruppen ---- */
.ordnerleiste { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.ochip {
  background: var(--panel2); color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 13px; min-height: 0;
  font-size: .82rem; font-weight: 500;
}
.ochip span { color: var(--muted); opacity: .7; font-size: .75rem; margin-left: 3px; }
.ochip.on { background: var(--accent); color: #1a1204; border-color: var(--accent); font-weight: 600; }
.ochip.on span { color: #1a1204; opacity: .65; }
.spotgruppe { margin-bottom: 20px; }
.spothead {
  margin: 0 0 8px; font-size: .84rem; font-weight: 700; color: var(--accent);
  letter-spacing: .04em; text-transform: uppercase;
  border-bottom: 1px solid var(--line); padding-bottom: 5px;
}
.kpfad { color: var(--muted); font-size: .74rem; margin-bottom: 3px; }
.ochip.alle-auf { margin-left: auto; }          /* Aufklapp-Schalter rechts absetzen */
/* Ausgeklappte Idee: groesser und heller — 3-5 Saetze muessen lesbar sein, nicht Kleingedrucktes. */
.vtext.auf {
  display: block; margin-top: 6px;
  color: var(--text); font-size: .92rem; line-height: 1.6;
  white-space: pre-wrap;            /* BRAUCHT:/PLAN B: stehen auf eigenen Zeilen */
}

/* ---- Ideen-Karten ---- */
.card {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px;
}
.card h3 { margin: 0 0 4px; font-size: 1rem; }
.card .meta { color: var(--muted); font-size: .8rem; }
.card .tag { display: inline-block; background: #2f3540; border-radius: 20px; padding: 2px 10px; font-size: .72rem; margin-right: 6px; }
.card-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Detail / Brief (Modal) ---- */
/* WICHTIG: #detail.hidden muss die #detail-Regel schlagen (hoehere Spezifitaet),
   sonst bleibt das Overlay sichtbar und faengt alle Klicks ab. */
.hidden { display: none; }
#detail.hidden { display: none; }
#detail {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex;
  justify-content: center; align-items: flex-start; overflow-y: auto;
  padding: 30px 16px; z-index: 10;
  -webkit-overflow-scrolling: touch;
}
.sheet {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  max-width: 900px; width: 100%; padding: 24px 28px;
}
.sheet h2 { font-size: 1.4rem; }
.sheet section { margin-bottom: 22px; }
.sheet h4 { margin: 0 0 6px; color: var(--accent2); text-transform: uppercase; letter-spacing: .04em; font-size: .78rem; }
.close { float: right; margin: -4px -8px 0 8px; }

/* ---- Storyboard ---- */
.sb-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.sb-head h4 { margin: 0; }
.sb-head button { min-height: 38px; padding: 8px 12px; font-size: .82rem; }
.storyboard { display: flex; flex-wrap: wrap; gap: 12px; }
.frame { width: 150px; }
.frame > svg { display: block; width: 100%; height: 90px; background: #0e1013; border-radius: 6px; border: 1px solid var(--line); }
.imgwrap { position: relative; }
.imgwrap img { display: block; width: 100%; height: 90px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #0e1013; }
.move-ov {
  position: absolute; top: 4px; left: 4px; width: 40px; height: 24px;
  background: rgba(14,16,19,.6); border-radius: 4px; padding: 1px;
}
.frame .fl { font-size: .72rem; margin-top: 4px; }
.frame .fl b { color: var(--text); }
.frame .fm { color: var(--muted); font-size: .68rem; }

.shot-row { border-bottom: 1px solid var(--line); padding: 8px 0; font-size: .88rem; }
.shot-row .k { color: var(--accent2); font-weight: 600; }
.drehgruppe { background: var(--panel2); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.spinner { color: var(--muted); }

/* ---- Tablet / stapeln ---- */
@media (max-width: 760px) {
  main { grid-template-columns: 1fr; }
}

/* ---- Handy ---- */
@media (max-width: 520px) {
  header { padding: 12px 14px 6px; gap: 10px; }
  h1 { font-size: 1.25rem; }
  .sub { font-size: .82rem; }
  main { padding: 12px 14px 32px; gap: 14px; }
  .panel { padding: 15px 15px; border-radius: 10px; }
  .row { flex-direction: column; gap: 12px; }   /* Eingaben untereinander */
  .card-actions button { flex: 1; }              /* Knöpfe volle Breite */

  /* Modal als Sheet, fast Vollbild. WICHTIG: align-items NICHT stretch — sonst wird
     .sheet auf Viewport-Hoehe fixiert und laengerer Inhalt quillt OHNE Hintergrund raus
     (grauer Kasten hoert mittendrin auf). flex-start + min-height:100% deckt alles ab. */
  #detail { padding: 0; align-items: flex-start; }
  .sheet {
    border-radius: 16px 16px 0 0; min-height: 100%;
    padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
  }
  .sheet h2 { font-size: 1.25rem; }
  .frame { width: calc(50% - 6px); }             /* 2 Storyboard-Kästchen pro Reihe */
}

.shot-row .praxis { color: var(--accent2); font-size: .82rem; margin-top: 4px; }
.drehliste { margin: 6px 0; padding-left: 20px; font-size: .88rem; }

.sl-shot { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .92rem; cursor: pointer; }
.sl-shot input { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.sl-shot span:first-of-type { flex: 1; }
.sl-shot:has(input:checked) span:first-of-type { opacity: .45; text-decoration: line-through; }
.sl-shot.muss { font-weight: 600; }
.mussbadge { flex: none; font-size: .68rem; padding: 2px 6px; border-radius: 6px; background: var(--accent2); color: #111; }
.sl-zaehler { color: var(--muted); font-weight: 400; font-size: .8rem; }
