/* [Member 3 - Interface, Testing & Docs] look of the two RustCast screens (watch + publish). */
:root {
  color-scheme: light;
  --page: #f9f9f9;
  --surface: #ffffff;
  --text: #191919;
  --text-2: #666666;
  --border: rgba(11, 11, 11, 0.10);
  --grid: #e7e7e7;
  --axis: #c2c2c2;
  --hover: rgba(11, 11, 11, 0.05);
  --series-1: #257de0;
  --wash: rgba(37, 125, 224, 0.10);
  --accent: #2370cd;
  --accent-hover: #1b64be;
  --good: #0aac23;
  --warning: #fbb315;
  --critical: #dc3c3d;
  --on-air: #c62828; /* white text on it: 5.6:1 */
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.10);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0b0b0b;
    --surface: #191919;
    --text: #efefef;
    --text-2: #9c9c9c;
    --border: rgba(255, 255, 255, 0.10);
    --grid: #303030;
    --axis: #474747;
    --hover: rgba(255, 255, 255, 0.06);
    --series-1: #338ced;
    --wash: rgba(51, 140, 237, 0.12);
    --shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--page); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 18px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
code { font: 13px ui-monospace, "Cascadia Mono", Consolas, monospace; }
a { color: var(--accent); }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand .page-name { color: var(--text-2); font-weight: 400; }
.pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 3px 11px; white-space: nowrap;
  border: 1px solid var(--border); border-radius: 999px; color: var(--text-2); font-size: 13px;
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--axis); }
.pill.live { color: var(--text); }
.pill.live .dot { background: var(--good); box-shadow: 0 0 0 3px rgba(10, 172, 35, 0.22); }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.muted { color: var(--text-2); }

/* ---------- layout ---------- */
main {
  max-width: 1280px; margin: 0 auto; padding: 20px 24px 40px;
  display: grid; gap: 16px; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start;
}
.wide { grid-column: 1 / -1; }
.col { display: grid; gap: 16px; align-content: start; min-width: 0; }
.card, .tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.card { padding: 16px; min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.sub { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }

.banner {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--warning); border-radius: 10px;
}
.banner p { margin: 0; overflow-wrap: anywhere; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tile { padding: 14px 16px; }
.tile .label { color: var(--text-2); font-size: 13px; }
.tile .value { font-size: 30px; font-weight: 600; line-height: 1.25; margin-top: 2px; }
.tile .unit { font-size: 14px; font-weight: 400; color: var(--text-2); }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 500; padding: 7px 14px; border-radius: 8px; cursor: pointer; text-decoration: none;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.danger { background: var(--on-air); border-color: var(--on-air); color: #fff; }
.btn.big { padding: 10px 22px; font-size: 15px; }
.btn.small { padding: 3px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
select, input[type="password"] {
  flex: 1; min-width: 0; font: inherit; padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.login input[type="password"] { flex: 0 1 320px; }
label.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13px; }
:focus-visible { outline: 2px solid var(--series-1); outline-offset: 2px; }

/* source picker: three buttons in one row */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--hover); border-radius: 10px; margin-bottom: 12px; }
.tab {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 500; padding: 8px 10px; border: 0; border-radius: 7px; cursor: pointer;
  background: transparent; color: var(--text-2);
}
.tab svg { width: 18px; height: 18px; }
.tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }
.tab:disabled { cursor: not-allowed; opacity: 0.5; }

/* ---------- video screens ---------- */
.screen { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 8px; overflow: hidden; }
.screen video { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.screen-msg {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 24px;
  text-align: center; color: #d0d0d0; background: rgba(0, 0, 0, 0.55);
}
.on-air {
  position: absolute; top: 12px; left: 12px; padding: 3px 10px; border-radius: 6px;
  background: var(--on-air); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
}
.urls { margin: 12px 0 0; display: grid; gap: 6px; color: var(--text-2); font-size: 13px; }
.urls div { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.urls code { color: var(--text); }

/* ---------- controls ---------- */
.step { padding: 14px 0; border-top: 1px solid var(--grid); }
.step:first-of-type { border-top: 0; padding-top: 0; }
.step .hint, .hint { margin: 2px 0 10px; color: var(--text-2); font-size: 13px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.status { margin: 8px 0 0; font-size: 13px; color: var(--text-2); min-height: 1.45em; overflow-wrap: anywhere; }
.go-live { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--grid); }
.go-live .status { margin: 0; flex: 1; min-width: 200px; }
progress { width: 160px; }

/* ---------- chart ---------- */
.chart { position: relative; height: 180px; touch-action: none; border-radius: 4px; }
.chart svg { display: block; width: 100%; height: 180px; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .base { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--text-2); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.chart .area { fill: var(--wash); }
.chart .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.chart .cross { stroke: var(--axis); stroke-width: 1; }
.chart-empty { position: absolute; inset: 0 0 24px 52px; display: grid; place-items: center; pointer-events: none; }
.chart-empty span { padding: 2px 10px; background: var(--surface); color: var(--text-2); font-size: 13px; }
.tip {
  position: absolute; top: 8px; pointer-events: none; padding: 6px 10px; border-radius: 8px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 12.5px;
}
.tip strong { display: block; font-size: 14px; }
.tip .key { display: inline-block; width: 12px; height: 2px; margin-right: 6px; vertical-align: middle; background: var(--series-1); border-radius: 1px; }
.tip span { color: var(--text-2); }
details { margin-top: 10px; font-size: 13px; color: var(--text-2); }
summary { cursor: pointer; width: max-content; }
.table-wrap { max-height: 200px; overflow-y: auto; margin-top: 8px; }
table { border-collapse: collapse; font-variant-numeric: tabular-nums; color: var(--text); }
th, td { padding: 3px 18px 3px 0; text-align: right; border-bottom: 1px solid var(--grid); }
th { color: var(--text-2); font-weight: 500; }

/* ---------- event log ---------- */
.log { list-style: none; margin: 0; padding: 0; height: 236px; overflow-y: auto; font-size: 13px; }
.log li { display: grid; grid-template-columns: max-content 14px minmax(0, 1fr); gap: 8px; align-items: baseline; padding: 5px 2px; border-top: 1px solid var(--grid); }
.log li:first-child { border-top: 0; }
.log li > span:last-child { overflow-wrap: anywhere; }
.log time { color: var(--text-2); font-variant-numeric: tabular-nums; }
.log .empty { display: block; color: var(--text-2); border: 0; }
.ico { text-align: center; font-size: 11px; color: var(--axis); }
.ico::before { content: "\25CF"; }                                  /* dot: information */
.ico.good { color: var(--good); }
.ico.warn { color: var(--warning); } .ico.warn::before { content: "\25B2"; } /* triangle: viewer dropped */
.ico.bad { color: var(--critical); } .ico.bad::before { content: "\2715"; }  /* cross: error */

/* ---------- watch screen ---------- */
.watch-main { display: block; max-width: 1200px; }
.watch-main .screen { border-radius: 12px; }
.watch-info { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-top: 14px; }
.unmute {
  position: absolute; left: 16px; bottom: 56px; z-index: 2; font: inherit; font-weight: 500; cursor: pointer;
  padding: 8px 14px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, 0.92); color: #191919;
}

/* ---------- messages ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 20; max-width: min(560px, 90vw);
  padding: 10px 16px; border-radius: 10px; background: var(--text); color: var(--surface); box-shadow: var(--shadow);
}
.offline {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 24px;
  background: rgba(0, 0, 0, 0.55);
}
.offline-box { max-width: 420px; padding: 24px; border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.offline-box p { margin: 8px 0 0; color: var(--text-2); }

@media (max-width: 900px) {
  main { grid-template-columns: minmax(0, 1fr); padding: 16px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top { padding: 12px 16px; }
  /* one column: broadcast, viewers, chart, recording, log */
  .col { display: contents; }
  .broadcast-card { order: 1; } .viewers-card { order: 2; } .chart-card { order: 3; } .recording-card { order: 4; } .log-card { order: 5; }
}
