/* Hamburg-Live – Design-Tokens (dSolve brand-*/ink-*), Light + Dark,
 * Layout für Übersicht, Einzelansicht, Vollbild und Bilderrahmen. */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-2: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #ebeef2;
  --surface-3: #d3dae3;
  --border: #d3dae3;
  --text: #1f2733;
  --text-2: #4d5d75;
  --text-3: #61748d;
  --primary: #1f63b0;
  --primary-hover: #1a4f8f;
  --on-primary: #ffffff;
  --primary-container: #d9eafb;
  --on-primary-container: #143456;
  --live: #1b7f4b;
  --live-bg: #e2f5ea;
  --warn: #8a4a0c;
  --warn-bg: #fdefdc;
  --err: #b3261e;
  --err-bg: #fbe9e7;
  --stage: #0a1524;
  --focus: #2f7fd1;
  --shadow: 0 1px 2px rgba(15, 20, 28, 0.08), 0 4px 12px rgba(15, 20, 28, 0.06);
  --shadow-lg: 0 8px 24px rgba(15, 20, 28, 0.16);
  --radius: 16px;
  --radius-sm: 10px;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a1524;
  --bg-2: #0f1c2e;
  --surface: #14233a;
  --surface-2: #1c2f4a;
  --surface-3: #2a3f5e;
  --border: #2a3f5e;
  --text: #ebeef2;
  --text-2: #b7c2d1;
  --text-3: #8fa0b5;
  --primary: #87baee;
  --primary-hover: #b7d6f6;
  --on-primary: #0a2540;
  --primary-container: #1a4f8f;
  --on-primary-container: #d9eafb;
  --live: #7ad19a;
  --live-bg: #163a27;
  --warn: #ffd9b3;
  --warn-bg: #4a2f10;
  --err: #ffb4ab;
  --err-bg: #4a1d1a;
  --stage: #000000;
  --focus: #87baee;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%;
  font-family: "Inter Variable", Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px; line-height: 1.5; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--primary); }
code, kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.9em; background: var(--surface-2); padding: 0.05em 0.4em; border-radius: 5px; }
kbd { border: 1px solid var(--border); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.hide-sm { display: none; }
@media (min-width: 640px) { .hide-sm { display: inline; } }

/* ───── Header ───── */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); padding-top: env(safe-area-inset-top); }
.top-inner { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 0.4rem; padding: 0.5rem 1rem; min-height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-weight: 700; color: var(--text); text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, #2f7fd1, #0a2540); display: inline-block; position: relative; }
.brand-mark::after { content: ""; position: absolute; left: 5px; right: 5px; bottom: 7px; height: 3px; border-radius: 2px; background: #87baee; box-shadow: 0 -5px 0 #b7d6f6; }
.brand-text { white-space: nowrap; }
@media (max-width: 640px) { .brand-compact .brand-text { display: none; } }
.top-title { font-size: 1.05rem; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }
.offline-banner { display: none; align-items: center; justify-content: center; gap: 0.4rem; background: var(--err-bg); color: var(--err); font-size: 0.9rem; padding: 0.4rem 1rem; }
.is-offline .offline-banner { display: flex; }

/* ───── Buttons ───── */
.btn, .btn-icon, .chip-btn, .input { font: inherit; color: inherit; min-height: 44px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; padding: 0.5rem 1rem; border-radius: 999px; border: 1px solid transparent; background: var(--surface-2); color: var(--text); font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--surface-3); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-tonal { background: var(--primary-container); color: var(--on-primary-container); }
.btn-ghost { background: transparent; border-color: currentColor; }
.btn-small { min-height: 40px; padding: 0.4rem 0.9rem; font-size: 0.9rem; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; border: none; background: transparent; color: inherit; cursor: pointer; text-decoration: none; }
.btn-icon:hover { background: var(--surface-2); }
.btn-icon[aria-pressed="true"] { background: var(--primary-container); color: var(--on-primary-container); }
.btn-icon:disabled { opacity: 0.35; cursor: default; }
.input { padding: 0.4rem 0.6rem; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); width: 6rem; }

/* ───── Übersicht ───── */
.container { max-width: 1200px; margin: 0 auto; padding: 1rem; }
.hero { padding: 0.75rem 0 0.25rem; }
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
.lead { color: var(--text-2); font-size: 1.05rem; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin: 0.5rem 0; }
.chips { display: flex; gap: 0.4rem; overflow-x: auto; scrollbar-width: none; flex: 1; padding: 0.2rem 0; }
.chips::-webkit-scrollbar { display: none; }
.chip-btn { flex: 0 0 auto; padding: 0.35rem 0.9rem; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; min-height: 40px; }
.chip-btn[aria-pressed="true"] { background: var(--primary-container); color: var(--on-primary-container); border-color: transparent; }
.switch { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--text-2); cursor: pointer; min-height: 44px; }
.switch input { width: 20px; height: 20px; accent-color: var(--primary); }
.count { color: var(--text-3); font-size: 0.9rem; margin: 0 0 0.6rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.card-media { position: relative; aspect-ratio: 16 / 9; background: var(--stage); }
.card-media .player { position: absolute; inset: 0; }
.card-media .player-status { z-index: 4; } /* Status-Aktionen über dem Karten-Link */
.card-link { position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; text-decoration: none; color: #fff; }
.poster-link { background-size: cover; background-position: center; background-color: var(--stage); }
.play-badge { width: 64px; height: 64px; border-radius: 50%; background: rgba(10, 21, 36, 0.7); display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow-lg); }
.card-body { padding: 0.7rem 0.9rem 0.9rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.card-title { font-size: 1.05rem; margin: 0; }
.card-title a { color: inherit; text-decoration: none; }
.card-title a:hover { color: var(--primary); }
.card-sub { color: var(--text-3); font-size: 0.85rem; margin: 0.2rem 0 0; }
.note { font-size: 0.9rem; color: var(--text-2); display: flex; align-items: center; gap: 0.3rem; margin-top: 1rem; }
.note.warn { color: var(--warn); }
.empty { text-align: center; padding: 3rem 1rem; color: var(--text-2); }
.empty h2 { color: var(--text); }
.errors { text-align: left; color: var(--err); background: var(--err-bg); padding: 0.75rem 1rem 0.75rem 2rem; border-radius: var(--radius-sm); }

/* ───── Status-Chips ───── */
.chip { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.75rem; font-weight: 600; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.chip i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip.st-live { background: var(--live-bg); color: var(--live); }
.chip.st-live i { animation: pulse 1.6s infinite; }
.chip.st-error { background: var(--err-bg); color: var(--err); }
.chip.st-loading, .chip.st-blocked { background: var(--warn-bg); color: var(--warn); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ───── Player ───── */
.player { position: relative; width: 100%; height: 100%; background: var(--stage); color: #fff; overflow: hidden; }
.player-stage { position: absolute; inset: 0; }
.player-stage > * { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.poster { background-size: cover; background-position: center; filter: brightness(0.6); }
.yt-target { z-index: 1; }
.cam-image { object-fit: contain; }
.cam-video { object-fit: contain; background: #000; }
.player-status { position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.player-status:empty { display: none; }
.player-status > * { pointer-events: auto; }
.status-card { max-width: min(90%, 420px); background: rgba(10, 21, 36, 0.86); color: #fff; border-radius: var(--radius); padding: 1rem 1.2rem; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; backdrop-filter: blur(6px); }
.status-card p { color: #d3dae3; font-size: 0.9rem; margin: 0; }
.status-card strong { font-size: 1rem; }
.status-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 0.4rem; }
.status-card .btn { background: #fff; color: #0a2540; }
.status-card .btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.6); }
.status-loading { flex-direction: row; gap: 0.7rem; padding: 0.7rem 1rem; font-size: 0.9rem; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.3); border-top-color: #fff; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tap-overlay { width: 100%; height: 100%; background: rgba(10, 21, 36, 0.45); color: #fff; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; font: inherit; font-weight: 600; cursor: pointer; }
.player-youtube[data-status="live"] .poster, .player-youtube[data-status="paused"] .poster { display: none; }

/* ───── Einzelansicht ───── */
.detail { display: grid; gap: 1.25rem; }
@media (min-width: 1000px) { .detail { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; } }
.stage { position: relative; background: var(--stage); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-lg); aspect-ratio: 16 / 9; }
.player-mount { position: absolute; inset: 0; }
.bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.6rem; padding-bottom: calc(0.4rem + env(safe-area-inset-bottom)); background: linear-gradient(to top, rgba(10, 21, 36, 0.85), rgba(10, 21, 36, 0)); color: #fff; transition: opacity 0.3s, transform 0.3s; }
.bar .btn-icon:hover { background: rgba(255, 255, 255, 0.15); }
.bar .btn-icon[aria-pressed="true"] { background: rgba(255, 255, 255, 0.25); color: #fff; }
.bar-left { display: flex; align-items: center; gap: 0.6rem; min-width: 0; flex: 1; }
.bar-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.bar-title strong { font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-title span { font-size: 0.75rem; color: #b7c2d1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-right { display: flex; align-items: center; gap: 0.1rem; }
.bar .chip-slot .chip { background: rgba(255, 255, 255, 0.15); color: #fff; }
.bar .chip-slot .chip.st-live { background: rgba(27, 127, 75, 0.7); }
.bar .chip-slot .chip.st-error { background: rgba(179, 38, 30, 0.75); }
@media (max-width: 640px) {
  .bar-title span, .chip-slot { display: none; }
  .stage:not(.stage-full) .bar { position: static; background: var(--surface-2); color: var(--text); flex-wrap: wrap; justify-content: center; }
  .stage:not(.stage-full) { aspect-ratio: auto; display: flex; flex-direction: column; }
  .stage:not(.stage-full) .player-mount { position: relative; aspect-ratio: 16 / 9; }
  .stage:not(.stage-full) .bar .btn-icon:hover { background: var(--surface-3); }
  .stage:not(.stage-full) .bar-title strong { color: var(--text); }
  .stage:not(.stage-full) .bar-left { flex-basis: 100%; justify-content: center; }
}
.info { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; }
.info .sub { color: var(--text-3); margin-top: -0.3rem; }
.info .desc { font-size: 1.02rem; }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 0.8rem; margin: 0.8rem 0; font-size: 0.9rem; }
.meta dt { color: var(--text-3); }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.meta a { display: inline-flex; align-items: center; gap: 0.2rem; }
.others h3 { font-size: 0.95rem; margin-top: 1rem; }
.others-list { display: flex; flex-wrap: wrap; gap: 0.4rem; justify-content: flex-start; }
.other { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.4rem 0.8rem; border-radius: 999px; background: var(--surface-2); color: var(--text); text-decoration: none; font-size: 0.9rem; min-height: 40px; }
.other:hover { background: var(--surface-3); }
.empty .others-list { justify-content: center; margin: 0.75rem 0 1rem; }

/* ───── Vollbild & Bilderrahmen ───── */
.view-cam.is-full { position: fixed; inset: 0; background: #000; z-index: 50; }
.stage-full { position: absolute; inset: 0; border-radius: 0; box-shadow: none; aspect-ratio: auto; background: #000; cursor: default; }
.stage-full.idle { cursor: none; }
.stage-full.idle .bar { opacity: 0; transform: translateY(8px); pointer-events: none; }
.stage-full .bar { padding-left: max(0.6rem, env(safe-area-inset-left)); padding-right: max(0.6rem, env(safe-area-inset-right)); }
@media (max-width: 640px) {
  .stage-full .bar { flex-wrap: wrap; row-gap: 0; }
  .stage-full .bar-left { flex-basis: 100%; justify-content: flex-start; }
  .stage-full .bar-title span { display: block; }
  .stage-full .chip-slot { display: inline-flex; }
  .stage-full .clock { font-size: 1.3rem; margin-right: auto; }
  .stage-full .bar-right { margin-left: auto; }
}
.clock { font-size: clamp(1.4rem, 3vw, 2.2rem); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); padding: 0 0.5rem; }
.progress { position: absolute; left: 0; right: 0; top: 0; height: 3px; z-index: 6; background: rgba(255, 255, 255, 0.12); }
.progress i { display: block; height: 100%; width: 0; background: #87baee; transition: width 0.25s linear; }
.is-frame .bar-title strong { font-size: 1.05rem; }
.is-frame .stage-full.idle .progress { opacity: 0.6; }
.stage-full .status-card { max-width: min(80%, 520px); }

/* ───── Info-Seite ───── */
.prose { max-width: 760px; }
.prose h3 { margin-top: 1.5rem; font-size: 1.05rem; }
.prose ul { padding-left: 1.3rem; }
.prose li { margin-bottom: 0.3rem; }

@media (prefers-reduced-motion: reduce) {
  .chip.st-live i { animation: none; }
  .bar { transition: none; }
}

/* Site footer: static, outside #app; gone in fullscreen and picture-frame mode. */
.site-foot { max-width: 1200px; margin: 0 auto; padding: 1rem; font-size: 0.8rem; color: var(--text-3); text-align: center; }
.site-foot a { color: var(--text-3); }
#app:has(.is-full) ~ .site-foot, #app:has(.is-frame) ~ .site-foot { display: none; }
