/* Angles - broadcast control room theme. See docs/brandbook.md */
:root {
  --bg: #0b0d10;
  --panel: #14181d;
  --panel-2: #1b2128;
  --line: #262d36;
  --text: #e8ecf1;
  --muted: #8b96a5;
  --accent: #3da9fc;
  --live: #ff3b3b;
  --ok: #34d17a;
  --warn: #ffb020;
  --cam1: #ff5d5d;
  --cam2: #4cc9f0;
  --cam3: #7bdc6b;
  --cam4: #ffc933;
  --r: 12px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); }
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; -webkit-text-size-adjust: 100%; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; }

.bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: var(--s3) var(--s4); background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; letter-spacing: .12em; text-transform: uppercase; font-size: 1rem; text-decoration: none; color: var(--text); }
.brand::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--live); margin-right: 8px; }
main { flex: 1; padding: var(--s4); width: 100%; max-width: 1400px; margin: 0 auto; }

/* Buttons */
.btn { appearance: none; border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  font: inherit; font-weight: 600; padding: 14px 18px; min-height: 48px; border-radius: var(--r); cursor: pointer;
  touch-action: manipulation; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #041421; }
.btn.live { background: var(--live); border-color: var(--live); color: #fff; }
.btn.big { min-height: 72px; font-size: 1.3rem; width: 100%; }
.btn:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Landing */
.landing { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s5); padding: var(--s5); text-align: center; }
.landing h1 { font-size: clamp(2.6rem, 12vw, 5rem); letter-spacing: .08em; text-transform: uppercase; }
.landing p { color: var(--muted); margin: 0; }
.landing .actions { display: grid; gap: var(--s4); width: 100%; max-width: 420px; }

/* Status pill */
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line); font-size: .85rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.pill::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.pill[data-state="live"]::before { background: var(--live); box-shadow: 0 0 8px var(--live); animation: pulse 1.4s infinite; }
.pill[data-state="connecting"]::before, .pill[data-state="reconnecting"]::before { background: var(--warn); animation: pulse .8s infinite; }
.pill.ok::before { background: var(--ok); }
.pill.bad::before { background: var(--live); }
@keyframes pulse { 50% { opacity: .35; } }

/* Gate overlay */
.gate { position: fixed; inset: 0; z-index: 1000; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: var(--s4); }
.gate form { width: 100%; max-width: 360px; display: grid; gap: var(--s3); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: var(--s5); }
.gate input { font: inherit; font-size: 1.1rem; padding: 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); width: 100%; }
.gate .err { color: var(--live); min-height: 1.2em; font-size: .9rem; margin: 0; }

/* Stream page */
.picker { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); max-width: 520px; margin: var(--s5) auto; }
.picker h2 { grid-column: 1 / -1; text-align: center; }
.picker a { border-left: 8px solid var(--c); min-height: 88px; font-size: 1.3rem; }
.stage { display: grid; gap: var(--s3); max-width: 560px; margin: 0 auto; }
.cam-name { font-size: clamp(2rem, 10vw, 3rem); font-weight: 800; color: var(--c); line-height: 1; }
.preview { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--r); border: 2px solid var(--c); object-fit: cover; }
.row { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; }
.row > .btn { flex: 1; }
.toggle { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); min-height: 48px; }
.toggle input { width: 22px; height: 22px; accent-color: var(--accent); }
.toggle .pill { margin-left: auto; }
.note { color: var(--muted); font-size: .85rem; margin: 0; }

/* Producer */
.start-wrap { display: flex; justify-content: center; padding: var(--s6) 0; }
.start-wrap .btn { max-width: 360px; }
.layout { display: grid; gap: var(--s4); }
.grid { display: grid; gap: var(--s3); grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .layout.with-map { grid-template-columns: 2fr 1fr; align-items: start; } }
.tile { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--c); border-radius: var(--r); overflow: hidden; }
.tile-video { position: relative; aspect-ratio: 16 / 9; background: #000; }
.tile-video video { width: 100%; height: 100%; object-fit: contain; display: block; }
.tile-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: var(--s2); pointer-events: none; }
.cam-label { background: rgba(0,0,0,.65); color: var(--c); font-weight: 800; padding: 4px 10px; border-radius: 6px; letter-spacing: .04em; }
.badge { font-size: .75rem; font-weight: 800; padding: 4px 8px; border-radius: 6px; background: #333; color: var(--muted); letter-spacing: .08em; }
.badge.live { background: var(--live); color: #fff; }
.tile-foot { display: flex; align-items: center; gap: var(--s3); padding: var(--s2) var(--s3); font-size: .8rem; color: var(--muted); }
.tile-foot .btn { min-height: 40px; padding: 8px 14px; }
.tile-foot .meta { flex: 1; min-width: 0; display: grid; gap: 2px; font-family: var(--mono); }
.tile-foot .meta span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.map-panel summary { padding: var(--s3) var(--s4); cursor: pointer; font-weight: 700; display: flex; justify-content: space-between; }
#map { height: 360px; background: var(--panel-2); }
@media (min-width: 1100px) { #map { height: 520px; } }
.leaflet-container { font-family: var(--font); }
.legend { display: flex; gap: var(--s3); flex-wrap: wrap; padding: var(--s2) var(--s4); font-size: .8rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: var(--c); }
.legend .off { opacity: .4; }
