/* ico-stream — broadcast-monitor dark theme.
   Personality lives in the monospace timecodes/tokens/labels, not in chrome. */
:root {
  --bg: #0E1116;
  --surface: #161B22;
  --raised: #1E242E;
  --hairline: #2A313C;
  --text: #E7EAF0;
  --muted: #9AA3B2;
  --faint: #5E6675;
  --rec: #FF453A;
  --amber: #F5A623;
  --intact: #34D399;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, system-ui, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", "Roboto Mono", ui-monospace, Menlo, Consolas, monospace;

  --r: 10px;
  --r-sm: 7px;
  --maxw: 1280px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

.mono { font-family: var(--mono); }
.label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---- Top bar ---------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 22px;
  height: 56px; padding: 0 20px;
  background: rgba(14,17,22,0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
}
.brand {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-weight: 600; font-size: 15px;
  letter-spacing: 0.02em; white-space: nowrap;
}
.brand .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--rec); box-shadow: 0 0 0 0 rgba(255,69,58,0.5);
  animation: pulse 2.4s infinite;
}
.brand b { color: var(--text); }
.brand .slash { color: var(--faint); }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  padding: 7px 12px; border-radius: var(--r-sm);
  color: var(--muted); font-weight: 500; font-size: 14px;
}
.nav a:hover { color: var(--text); background: var(--raised); }
.nav a.active { color: var(--text); background: var(--raised); }
.spacer { flex: 1; }
.usermenu { display: flex; align-items: center; gap: 12px; }
.usermenu .who { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.usermenu .who b { color: var(--text); }

/* ---- Layout ----------------------------------------------------------- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 28px 20px 80px; }
.page-head { display: flex; align-items: baseline; gap: 16px; margin: 4px 0 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.page-head .sub { color: var(--muted); font-size: 14px; }

/* ---- Buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 9px 16px; border-radius: var(--r-sm); border: 1px solid var(--hairline);
  background: var(--raised); color: var(--text); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: border-color .15s, background .15s, transform .05s;
}
.btn:hover { border-color: #3a4250; background: #232a35; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--amber); color: #1a1300; border-color: var(--amber); font-weight: 600; }
.btn-primary:hover { background: #ffb733; border-color: #ffb733; }
.btn-ghost { background: transparent; }
.btn-danger { color: #ff7b72; }
.btn-danger:hover { border-color: #ff7b72; background: rgba(255,69,58,0.08); }
.btn-sm { padding: 6px 11px; font-size: 13px; }

/* ---- Cards grid ------------------------------------------------------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(248px, 1fr)); gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r); overflow: hidden; transition: border-color .15s, transform .08s;
}
.card:hover { border-color: #3a4250; transform: translateY(-2px); }
.thumb {
  position: relative; aspect-ratio: 16/9; background: #0a0d12;
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--hairline); overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .placeholder { color: var(--faint); font-family: var(--mono); font-size: 12px; letter-spacing: .12em; }
.thumb .badge-dur {
  position: absolute; right: 7px; bottom: 7px;
  font-family: var(--mono); font-size: 11px; padding: 2px 6px; border-radius: 4px;
  background: rgba(0,0,0,0.78); color: #fff;
}
.card .meta { padding: 11px 13px 13px; }
.card .meta .t { font-weight: 600; font-size: 14px; line-height: 1.35; margin-bottom: 4px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta .m { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* LIVE badge */
.live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .1em;
  color: #fff; background: var(--rec); padding: 3px 8px; border-radius: 4px;
}
.live-badge .d { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse-w 1.6s infinite; }
.thumb .live-badge { position: absolute; left: 7px; top: 7px; }

/* ---- Tabs ------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--hairline); margin-bottom: 22px; }
.tabs a {
  padding: 10px 16px; color: var(--muted); font-weight: 500; font-size: 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--amber); }

/* ---- Forms ------------------------------------------------------------ */
.auth { max-width: 380px; margin: 8vh auto 0; }
.auth .card-body { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r); padding: 28px; }
.auth h1 { font-size: 20px; margin: 0 0 4px; }
.auth .sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; }
input[type=text], input[type=password] {
  width: 100%; padding: 10px 12px; border-radius: var(--r-sm);
  background: var(--bg); border: 1px solid var(--hairline); color: var(--text);
  font-size: 14px; font-family: var(--sans);
}
input:focus { outline: none; border-color: var(--amber); }
.field .label { margin-bottom: 6px; }
.error { color: #ff7b72; font-size: 13px; margin-bottom: 14px; background: rgba(255,69,58,0.08);
  border: 1px solid rgba(255,69,58,0.3); padding: 9px 12px; border-radius: var(--r-sm); }
.muted-link { color: var(--muted); font-size: 13px; }
.muted-link a { color: var(--amber); }
form.inline { display: flex; gap: 10px; align-items: flex-end; }

/* ---- Token / code box ------------------------------------------------- */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; align-items: center; }
.kv .label { align-self: center; }
.codebox {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--hairline); border-radius: var(--r-sm);
  padding: 9px 12px; font-family: var(--mono); font-size: 13px; color: var(--text);
  word-break: break-all;
}
.codebox .v { flex: 1; }
.copy { cursor: pointer; color: var(--muted); border: 1px solid var(--hairline); background: var(--raised);
  border-radius: 5px; padding: 3px 8px; font-family: var(--mono); font-size: 11px; }
.copy:hover { color: var(--text); }
.copy.ok { color: var(--intact); border-color: var(--intact); }

.panel { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r); padding: 20px; }
.panel + .panel { margin-top: 18px; }
.panel h2 { font-size: 16px; margin: 0 0 14px; }

/* ---- Empty state ------------------------------------------------------ */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .label { display: block; margin-bottom: 10px; }

/* ---- Tables (admin) --------------------------------------------------- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--hairline); font-size: 14px; }
th { color: var(--faint); font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 600; }
tbody tr:hover { background: var(--surface); }
td .mono { font-size: 13px; }

/* ---- Landing ---------------------------------------------------------- */
.hero { max-width: 720px; margin: 14vh auto 0; text-align: center; padding: 0 20px; }
.hero .tally {
  display: inline-flex; align-items: center; gap: 10px; font-family: var(--mono);
  font-size: 12px; letter-spacing: .18em; color: var(--muted); margin-bottom: 22px;
  border: 1px solid var(--hairline); border-radius: 999px; padding: 6px 14px;
}
.hero .tally .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rec); animation: pulse 2.4s infinite; }
.hero h1 { font-size: 40px; line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 16px; }
.hero h1 .am { color: var(--amber); }
.hero p { color: var(--muted); font-size: 17px; max-width: 540px; margin: 0 auto 28px; }
.hero .cta { display: flex; gap: 12px; justify-content: center; }
.ribbon {
  margin: 46px auto 0; max-width: 560px; height: 8px; border-radius: 4px;
  background: repeating-linear-gradient(90deg, var(--intact) 0 6px, #1c3b30 6px 7px);
  opacity: .55;
}
.ribbon-cap { font-family: var(--mono); font-size: 11px; color: var(--faint); letter-spacing: .12em; margin-top: 8px; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(255,69,58,0.5); }
  70% { box-shadow: 0 0 0 7px rgba(255,69,58,0); }
  100% { box-shadow: 0 0 0 0 rgba(255,69,58,0); }
}
@keyframes pulse-w {
  0%,100% { opacity: 1; } 50% { opacity: .35; }
}
@media (prefers-reduced-motion: reduce) {
  .brand .dot, .hero .tally .dot, .live-badge .d { animation: none; }
}

@media (max-width: 640px) {
  .topbar { gap: 12px; padding: 0 14px; }
  .nav a { padding: 7px 9px; }
  .usermenu .who { display: none; }
  .hero h1 { font-size: 30px; }
}

/* ====================== Player ======================================== */
.player { background: #000; border: 1px solid var(--hairline); border-radius: var(--r); overflow: hidden; }
.video-shell { position: relative; background: #000; aspect-ratio: 16/9; }
.video-shell .vid { width: 100%; height: 100%; display: block; background: #000; }
.video-shell .big-play {
  position: absolute; inset: 0; margin: auto; width: 72px; height: 72px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: rgba(0,0,0,0.55); border-radius: 50%; border: 1px solid rgba(255,255,255,0.18);
}
.video-shell .big-play svg { width: 30px; height: 30px; fill: #fff; margin-left: 3px; }
.video-shell .big-play[hidden] { display: none; }
.video-shell .buffering {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.18); border-top-color: var(--amber);
  animation: spin .8s linear infinite;
}
.video-shell .buffering[hidden] { display: none; }
@keyframes spin { to { transform: translate(-50%,-50%) rotate(360deg); } }

.controls { background: var(--surface); padding: 10px 12px 11px; }

/* Integrity DVR scrubber — the signature element */
.scrubber { position: relative; height: 16px; cursor: pointer; display: flex; align-items: center; }
.scrubber .track { position: absolute; left: 0; right: 0; height: 5px; border-radius: 3px; background: var(--hairline); overflow: hidden; }
.scrubber .buffered { position: absolute; left: 0; height: 100%; background: #39424f; width: 0; }
.scrubber .played { position: absolute; left: 0; height: 100%; background: var(--amber); width: 0; }
.scrubber .knob {
  position: absolute; width: 13px; height: 13px; border-radius: 50%; background: #fff;
  transform: translateX(-50%); box-shadow: 0 1px 3px rgba(0,0,0,.6); left: 0; opacity: 0; transition: opacity .12s;
}
.scrubber:hover .knob { opacity: 1; }
.scrubber .liveedge { position: absolute; right: 0; width: 3px; height: 12px; background: var(--rec); border-radius: 2px; }
.scrubber.vod .liveedge { display: none; }

.ctl-row { display: flex; align-items: center; gap: 6px; margin-top: 9px; }
.ctl-row button {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--text); cursor: pointer;
  width: 34px; height: 32px; border-radius: 6px;
}
.ctl-row button:hover { background: var(--raised); }
.ctl-row button svg { width: 18px; height: 18px; fill: currentColor; }
.ctl-row .time { font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin-left: 6px; white-space: nowrap; }
.ctl-row .time .cur { color: var(--text); }
.ctl-row .c-live {
  width: auto; padding: 0 10px; gap: 6px; font-family: var(--mono); font-size: 11px;
  font-weight: 700; letter-spacing: .08em; color: var(--faint);
}
.ctl-row .c-live .d { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.ctl-row .c-live.at-live { color: #fff; }
.ctl-row .c-live.at-live .d { background: var(--rec); animation: pulse-w 1.6s infinite; }
.ctl-row .sp { flex: 1; }

/* speed */
.speed { display: flex; align-items: center; gap: 8px; padding: 0 6px; }
.speed .sp-range { width: 116px; accent-color: var(--amber); }
.speed .sp-val { font-family: var(--mono); font-size: 12.5px; color: var(--text); min-width: 42px; text-align: center; }
.speed button { width: 26px; height: 26px; border: 1px solid var(--hairline); border-radius: 6px; background: var(--raised); font-size: 15px; }

.intact-line { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-family: var(--mono); font-size: 11.5px; color: var(--faint); letter-spacing: .04em; }
.intact-line .ok { color: var(--intact); }
.intact-line .ok svg { width: 13px; height: 13px; fill: var(--intact); vertical-align: -2px; margin-right: 3px; }

@media (max-width: 640px) {
  .speed .sp-range { width: 70px; }
  .ctl-row .time { margin-left: 2px; font-size: 11.5px; }
}

/* ====================== Video.js theme override ======================= */
.player-wrap { border: 1px solid var(--hairline); border-radius: var(--r); overflow: hidden; background: #000; }
.video-js { font-family: var(--sans); border-radius: var(--r); overflow: hidden; }
.video-js .vjs-play-progress,
.video-js .vjs-volume-level { background-color: var(--amber); }
.video-js .vjs-play-progress::before { color: var(--amber); }
.video-js .vjs-load-progress { background: rgba(255,255,255,0.18); }
.video-js .vjs-load-progress div { background: rgba(255,255,255,0.28); }
.video-js .vjs-big-play-button {
  width: 76px; height: 76px; line-height: 76px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.25); background-color: rgba(0,0,0,0.5);
  top: 50%; left: 50%; transform: translate(-50%,-50%); margin: 0;
}
.video-js:hover .vjs-big-play-button,
.video-js .vjs-big-play-button:focus { background-color: var(--amber); color: #1a1300; border-color: var(--amber); }
.video-js .vjs-control-bar { background-color: rgba(14,17,22,0.78); }
.vjs-live .vjs-live-display { color: var(--rec); font-weight: 700; }
.video-js .vjs-playback-rate .vjs-playback-rate-value { font-family: var(--mono); }
