/* ---------------------------------------------------------------------
   Zaps (Kurzvideos) - Feed, Karten, Regal, Teilen-/Repost-Fenster, Studio.
   Nutzt nur die Design-Tokens aus base.css (kein eigenes Farbschema).
--------------------------------------------------------------------- */

/* ===== Feed-Seite (zaps.html) =====
   Layout nach dem Vorbild von YouTube Shorts:
   - Desktop: Player mittig im Format 9:16 (so hoch wie der Bildschirm erlaubt), Aktionsleiste
     (Like, Dislike, Kommentare, Teilen) rechts NEBEN dem Video, Hoch/Runter-Pfeile am rechten
     Bildschirmrand. Öffnet man die Kommentare, rücken Player + Leiste nach links und die
     Kommentare erscheinen daneben (kein Überdecken).
   - Handy / schmale Fenster (<= 700 px): Vollbild-Video, Leiste liegt rechts über dem Video.
   Größen berechnen sich über Container-Einheiten (cqw/cqh) des Eintrags, damit das Video bei jeder
   Fenstergröße im Format bleibt und nie verzerrt oder abgeschnitten wird.
   Die Seite selbst scrollt nie - nur .zap-feed (Scroll-Snap, ein Zap pro "Seite"). */
html:has(body.zaps-page) { overflow: hidden; }
body.zaps-page { overflow: hidden; overscroll-behavior: none; }
.zaps-page .app-body { position: fixed; inset: 0; padding-top: var(--nav-h); min-height: 0; }
.zaps-page .app-main {
  display: flex; padding: 0 76px 0 0; height: 100%; overflow: hidden; position: relative; min-width: 0;
}
#zap-root { flex: 1 1 auto; min-width: 0; height: 100%; position: relative; }

.zap-feed {
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.zap-feed::-webkit-scrollbar { display: none; }
.zap-item {
  height: 100%;
  box-sizing: border-box;
  container-type: size;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  position: relative;
}
.zap-stage {
  position: relative;
  flex: none;
  /* Höhe: so groß wie möglich (12 px Luft oben/unten), aber so, dass Video + Leiste in die Breite passen. */
  height: min(calc(100cqh - 24px), calc((100cqw - 96px) * 16 / 9), 1200px);
  aspect-ratio: 9 / 16;
  background: #000;
  border-radius: var(--radius-l);
  overflow: hidden;
  isolation: isolate;
}
.zap-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #000; cursor: pointer; }
.zap-shade-top, .zap-shade-bottom { position: absolute; left: 0; right: 0; pointer-events: none; z-index: 1; }
.zap-shade-top { top: 0; height: 90px; background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent); }
.zap-shade-bottom { bottom: 0; height: 50%; background: linear-gradient(to top, rgba(0,0,0,0.75), transparent); }

/* obere Leiste im Video: Ton | Für dich / Abos | Mehr */
.zap-topbar { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: center; gap: 6px; z-index: 3; }
.zap-topbar .btn-icon { background: rgba(0,0,0,0.45); color: #fff; width: 38px; height: 38px; flex: none; }
.zap-topbar .btn-icon:hover { background: rgba(0,0,0,0.65); }
.zap-scope { display: flex; gap: 2px; background: rgba(0,0,0,0.45); backdrop-filter: blur(8px); border-radius: var(--radius-round); padding: 3px; min-width: 0; }
.zap-scope button, .zap-scope .zap-scope-label { padding: 6px 14px; border-radius: var(--radius-round); font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.75); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.zap-scope button.active, .zap-scope .zap-scope-label { background: #fff; color: #0f0f0f; }
.zap-play-flash {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none; opacity: 0; z-index: 2;
}
.zap-play-flash .icon { width: 72px; height: 72px; color: #fff; background: rgba(0,0,0,0.45); border-radius: 50%; padding: 16px; }
.zap-play-flash.show { animation: zap-flash 0.6s var(--ease); }
@keyframes zap-flash { 0% { opacity: 0.95; transform: scale(0.9); } 100% { opacity: 0; transform: scale(1.15); } }

.zap-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,0.25); z-index: 3; }
.zap-progress-fill { height: 100%; width: 0; background: #fff; }

/* Infos unten links im Video; der Repost-Hinweis sitzt rechtsbündig darüber (nie über dem Text) */
.zap-info {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; padding: 0 14px 16px;
  display: flex; flex-direction: column; gap: 8px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.zap-owner { display: flex; align-items: center; gap: 10px; min-width: 0; }
.zap-owner .avatar { width: 36px; height: 36px; flex-shrink: 0; }
.zap-owner-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.zap-owner .btn { padding: 6px 14px; font-size: 13px; flex: none; text-shadow: none; }
.zap-caption { font-size: 14px; line-height: 1.4; max-height: 4.2em; overflow: hidden; word-break: break-word; cursor: pointer; }
.zap-caption.expanded { max-height: 30vh; overflow-y: auto; }
.zap-caption a, .zap-caption .mention, .zap-caption .rich-link { color: #9cc9ff; }
.zap-meta { font-size: 12px; color: rgba(255,255,255,0.75); }
.zap-takedown-note { background: var(--accent-wash); border: 1px solid rgba(255,59,48,0.4); color: #ff8a80; padding: 8px 10px; border-radius: var(--radius-s); font-size: 12px; text-shadow: none; }

/* Aktionsleiste rechts neben dem Video (wie bei YT Shorts) */
.zap-rail { display: flex; flex-direction: column; gap: 14px; align-self: flex-end; margin-bottom: 12px; align-items: center; flex: none; width: 64px; }
.zap-rail-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--text-primary); width: 64px; cursor: pointer; }
.zap-rail-btn .zap-rail-ic { width: 48px; height: 48px; border-radius: 50%; background: var(--bg-2); display: flex; align-items: center; justify-content: center; transition: background 0.15s var(--ease), transform 0.1s; }
.zap-rail-btn:hover .zap-rail-ic { background: var(--bg-3); }
.zap-rail-btn:active .zap-rail-ic { transform: scale(0.92); }
.zap-rail-btn .icon { width: 24px; height: 24px; }
.zap-rail-btn.active .zap-rail-ic { background: var(--text-primary); color: #0f0f0f; }
.zap-rail-btn.repost.active .zap-rail-ic { background: var(--accent); color: #fff; }
.zap-rail-btn.disabled { opacity: 0.45; }

/* Repost-Hinweis: kompakte Karte rechts unten */
.zap-repost-chip { align-self: flex-end; max-width: min(100%, 240px); }
.zap-repost-chip:empty { display: none; }
.zap-repost-card {
  background: rgba(24,24,24,0.88); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-m); padding: 9px 11px; color: #fff; font-size: 12.5px; text-shadow: none; max-width: 100%;
}
.zap-repost-head { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.zap-repost-head > .icon { width: 16px; height: 16px; color: #7ee787; flex-shrink: 0; }
.zap-repost-stack { display: flex; flex: none; }
.zap-repost-stack .avatar { width: 22px; height: 22px; border: 2px solid #181818; margin-left: -7px; }
.zap-repost-stack .avatar:first-child { margin-left: 0; }
.zap-repost-text { min-width: 0; line-height: 1.3; }
.zap-repost-note { color: rgba(255,255,255,0.85); margin-top: 4px; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.zap-repost-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; justify-content: flex-end; }
.zap-repost-actions button { font-size: 12px; padding: 5px 10px; border-radius: var(--radius-round); background: rgba(255,255,255,0.14); color: #fff; font-weight: 600; }
.zap-repost-actions button:hover { background: rgba(255,255,255,0.26); }
.zap-repost-actions button.primary { background: #fff; color: #0f0f0f; }

/* Pfeile (Desktop): am rechten Bildschirmrand, vertikal mittig */
.zap-nav { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 12px; z-index: 10; }
.zap-nav .btn-icon { background: var(--bg-2); width: 48px; height: 48px; }
.zap-nav .btn-icon:hover:not(:disabled) { background: var(--bg-3); }
.zap-nav .btn-icon:disabled { opacity: 0.35; cursor: default; }
.zap-loading { height: 100%; display: flex; align-items: center; justify-content: center; }
.zap-feed-state { height: 100%; display: flex; align-items: center; justify-content: center; }
.zap-end { height: 100%; scroll-snap-align: start; display: flex; align-items: center; justify-content: center; }

/* Kommentare: Karte rechts neben Player + Leiste (Desktop) bzw. Bottom-Sheet (Handy) */
.zap-comments-panel {
  display: none; flex: none; flex-direction: column; width: 400px; max-width: 42vw;
  margin: 12px 0 12px 8px; height: calc(100% - 24px);
  background: var(--bg-1); border: 1px solid var(--border-soft); border-radius: var(--radius-l); overflow: hidden;
}
.zap-comments-panel.open { display: flex; }
.zap-comments-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 8px 12px 18px; border-bottom: 1px solid var(--border-soft); flex: none; }
.zap-comments-head h3 { margin: 0; font-size: 16px; }
.zap-comments-body { flex: 1; overflow-y: auto; padding: 14px 16px 24px; overscroll-behavior: contain; }
#zap-comment-form-wrap { margin-bottom: 16px; }

@media (max-width: 1100px) { .zap-comments-panel { width: 340px; } }

/* ---- Handy / schmale Fenster: Vollbild wie die Shorts-Web-App ---- */
@media (max-width: 700px) {
  .zaps-page .app-main { padding: 0; margin-left: 0; }
  .zap-item { gap: 0; }
  .zap-stage { height: 100cqh; width: 100cqw; aspect-ratio: auto; border-radius: 0; }
  .zap-rail { position: absolute; right: 6px; bottom: calc(28px + env(safe-area-inset-bottom, 0px)); margin: 0; gap: 10px; z-index: 5; width: 56px; }
  .zap-rail-btn { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.7); width: 56px; }
  .zap-rail-btn .zap-rail-ic { background: rgba(0,0,0,0.4); width: 44px; height: 44px; }
  .zap-rail-btn.active .zap-rail-ic { background: #fff; }
  .zap-info { padding-right: 70px; padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
  .zap-nav { display: none; }
  .zap-comments-panel {
    position: absolute; left: 0; right: 0; bottom: 0; width: auto; max-width: none; height: 72%;
    margin: 0; border-radius: var(--radius-l) var(--radius-l) 0 0; z-index: 30; box-shadow: 0 -8px 32px rgba(0,0,0,0.5);
  }
}
@media (max-height: 520px) and (min-width: 701px) {
  /* Handy quer: so hoch wie möglich */
  .zap-stage { height: min(100cqh, calc((100cqw - 80px) * 16 / 9)); border-radius: var(--radius-m); }
  .zap-rail { gap: 8px; }
  .zap-rail-btn .zap-rail-ic { width: 40px; height: 40px; }
}

/* ===== Karten (Kanal-Tab, Regal auf der Startseite) ===== */
.zap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px 12px; }
.zap-card { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.zap-card-thumb { position: relative; aspect-ratio: 9 / 16; border-radius: var(--radius-m); overflow: hidden; background: var(--bg-1); display: block; }
.zap-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.zap-card-views { position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.7); }
.zap-card-views .icon { width: 14px; height: 14px; }
.zap-card-badge { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,0.65); color: #fff; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: var(--radius-round); }
.zap-card-title { font-size: 14px; font-weight: 500; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.zap-card-sub { font-size: 12px; color: var(--text-secondary); }
.zap-card-note { font-size: 12px; color: var(--text-secondary); border-left: 2px solid var(--border); padding-left: 8px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.zap-card-note .icon { width: 12px; height: 12px; vertical-align: -2px; margin-right: 3px; color: #7ee787; }
.zaps-shelf { grid-column: 1 / -1; padding: 12px 0 8px; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); margin: 8px 0; }
.zaps-shelf-title { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; margin: 0 0 12px; }
.zaps-shelf-title .icon { color: var(--accent); }
.zaps-shelf-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.zaps-shelf-row .zap-card { flex: 0 0 168px; scroll-snap-align: start; }
.zap-repost-hint { display: flex; align-items: center; gap: 10px; background: var(--bg-1); border: 1px solid var(--border-soft); border-radius: var(--radius-m); padding: 10px 14px; margin-bottom: 16px; font-size: 13px; color: var(--text-secondary); }
.zap-repost-hint a { color: var(--focus-ring); font-weight: 500; }

/* ===== Teilen / Repost / Repost-Kommentare (Fenster) ===== */
.zap-sheet-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
.zap-sheet-action { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 8px; border-radius: var(--radius-m); background: var(--bg-2); font-size: 13px; font-weight: 500; text-align: center; }
.zap-sheet-action:hover { background: var(--bg-3); }
.zap-sheet-action .icon { width: 24px; height: 24px; }
.zap-sheet-action.active { background: var(--accent-wash); color: #ff8a80; }
.zap-repost-form { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.zap-repost-form .hint { font-size: 12px; color: var(--text-secondary); }
.zap-repost-list { display: flex; flex-direction: column; gap: 14px; max-height: 50vh; overflow-y: auto; }
.zap-repost-row { display: flex; gap: 10px; }
.zap-repost-row .avatar { width: 36px; height: 36px; flex-shrink: 0; }
.zap-repost-row-body { min-width: 0; flex: 1; }
.zap-repost-row-name { font-weight: 600; font-size: 14px; }
.zap-repost-row-note { font-size: 13px; color: var(--text-secondary); margin: 2px 0 6px; word-break: break-word; }
.zap-rc-list { display: flex; flex-direction: column; gap: 12px; max-height: 40vh; overflow-y: auto; margin: 14px 0; }
.zap-rc { display: flex; gap: 10px; }
.zap-rc .avatar { width: 30px; height: 30px; flex-shrink: 0; }
.zap-rc-text { font-size: 13px; word-break: break-word; }
.zap-rc-name { font-weight: 600; margin-right: 6px; }
.zap-rc-time { color: var(--text-tertiary); font-size: 12px; }
.zap-rc-form { display: flex; gap: 8px; }
.zap-rc-form .input { flex: 1; }

/* ===== Studio ===== */
.zap-studio-grid { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 28px; align-items: start; max-width: 960px; }
@media (max-width: 800px) { .zap-studio-grid { grid-template-columns: 1fr; } }
.zap-phone { aspect-ratio: 9 / 16; width: 100%; max-width: 280px; border-radius: var(--radius-l); background: var(--bg-1); border: 2px dashed var(--border); display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; }
.zap-phone video { width: 100%; height: 100%; object-fit: cover; }
.zap-phone.drag { border-color: var(--focus-ring); background: rgba(75,158,255,0.06); }
.zap-limits { font-size: 12px; color: var(--text-tertiary); line-height: 1.6; }
.zap-pick { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 16px; text-align: center; color: var(--text-secondary); font-size: 14px; }
.zap-pick .icon { width: 40px; height: 40px; color: var(--text-tertiary); }
.zap-row-thumb { width: 54px; aspect-ratio: 9 / 16; border-radius: var(--radius-s); overflow: hidden; background: var(--bg-2); flex-shrink: 0; }
.zap-row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.zap-row { display: flex; align-items: center; gap: 12px; }

/* ===== Einstellungen: Repost-Sichtbarkeit ===== */
.zap-radio { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border-soft); border-radius: var(--radius-m); cursor: pointer; background: var(--bg-1); }
.zap-radio:hover { background: var(--bg-2); }
.zap-radio.selected { border-color: var(--text-secondary); background: var(--bg-2); }
.zap-radio input { margin-top: 3px; accent-color: var(--accent); }
.zap-radio-label { font-size: 14px; font-weight: 600; }
.zap-radio-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.zap-audience { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--border-soft); border-radius: var(--radius-m); }
.zap-audience-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.zap-audience-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-2); border-radius: var(--radius-round); padding: 4px 6px 4px 4px; font-size: 13px; }
.zap-audience-chip .avatar { width: 22px; height: 22px; }
.zap-audience-chip button { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-secondary); }
.zap-audience-chip button:hover { background: var(--bg-3); color: var(--text-primary); }
.zap-audience-chip button .icon { width: 14px; height: 14px; }
.zap-audience-suggest { position: relative; }
.zap-audience-suggest-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 20; background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius-m); margin-top: 4px; overflow: hidden; }
.zap-audience-suggest-list button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 12px; text-align: left; font-size: 13px; }
.zap-audience-suggest-list button:hover { background: var(--bg-2); }
.zap-audience-suggest-list .avatar { width: 24px; height: 24px; }
