:root {
  --ink: #16130E;
  --ink-2: #1F1B15;
  --umber: #3A332B;
  --gold: #C2A265;
  --gold-soft: rgba(194, 162, 101, .18);
  --cream: #EDE4D3;
  --cream-dim: rgba(237, 228, 211, .62);
  --red: #D9472B;
  --ok: #8FB27A;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(ellipse at 50% -10%, #2A241C 0%, var(--ink) 55%) fixed, var(--ink);
  color: var(--cream);
  font: 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2 { font-family: var(--serif); font-weight: 500; letter-spacing: -.01em; }
.muted { color: var(--cream-dim); }
.small { font-size: 13px; }
.hint { color: var(--cream-dim); font-weight: 400; font-size: 12px; margin-left: 6px; }
.error { color: #F0A08E; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 999px; padding: 11px 20px;
  font: 600 14px var(--sans); cursor: pointer; text-decoration: none; transition: transform .08s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn-gold { background: var(--gold); color: var(--ink); }
.btn-gold:hover { background: #D1B37A; }
.btn-ghost { background: transparent; color: var(--cream); border-color: var(--umber); }
.btn-ghost:hover { border-color: var(--gold); }

input, select {
  width: 100%; background: var(--ink-2); color: var(--cream); border: 1px solid var(--umber);
  border-radius: 10px; padding: 10px 12px; font: 14px var(--sans);
}
input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
label { display: block; font-weight: 600; font-size: 13px; margin: 14px 0 6px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
label.check input { width: auto; }

.brand-row { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 17px; }
.mark-sm { width: 18px; height: 22px; }
.mark-lg { width: 46px; height: 58px; }

/* landing */
.screen { min-height: 100%; }
#landing { display: grid; place-items: center; padding: 40px 16px; }
.landing-card { width: min(640px, 100%); }
.landing-card h1 { font-size: 44px; margin: 18px 0 8px; }
.lede { font-size: 17px; color: var(--cream-dim); margin: 0 0 28px; }
.links { margin: 22px 0; padding: 18px; border: 1px solid var(--umber); border-radius: var(--radius); background: rgba(31, 27, 21, .6); }
.links label:first-child { margin-top: 0; }
.links .btn-gold { margin-top: 18px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-size: 12px; }
.takes-h { font-size: 20px; margin: 36px 0 10px; }
.takes { list-style: none; padding: 0; margin: 0; }
.takes li { padding: 12px 0; border-top: 1px solid var(--umber); font-size: 14px; }
.takes code { color: var(--gold); font-size: 12px; }
.tick { color: var(--ok); }
.cross { color: #F0A08E; }

/* green room */
#green { display: grid; place-items: center; padding: 32px 16px; }
.green-wrap { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr); gap: 32px; width: min(1080px, 100%); align-items: center; }
.green-preview { position: relative; }
.green-preview video { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: var(--radius); background: #000; transform: scaleX(-1); border: 1px solid var(--umber); }
.meter { height: 6px; border-radius: 3px; background: var(--ink-2); margin-top: 12px; overflow: hidden; }
.meter div { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), #F2D79B); transition: width .06s linear; }
.green-form h1 { font-size: 30px; margin: 14px 0 4px; }
.green-form .btn { width: 100%; margin-top: 20px; }
@media (max-width: 820px) { .green-wrap { grid-template-columns: 1fr; } }

/* studio */
#studio {
  display: grid; height: 100vh; height: 100dvh;
  grid-template-columns: minmax(0, 1fr) 260px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "top top" "stage crew" "controls controls";
}
.topbar { grid-area: top; display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; gap: 12px; }
.onair {
  display: inline-flex; align-items: center; gap: 10px; padding: 7px 16px; border-radius: 999px;
  font: 700 12px var(--sans); letter-spacing: .18em; color: rgba(237, 228, 211, .35);
  border: 1px solid var(--umber); transition: all .3s;
}
.onair .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.onair #timer { font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.onair.live { color: #fff; background: var(--red); border-color: var(--red); box-shadow: 0 0 28px rgba(217, 71, 43, .55); }
.onair.live .dot { animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.net { font-size: 12px; min-width: 120px; text-align: right; }

.stage {
  grid-area: stage; display: grid; gap: 14px; padding: 6px 14px 14px 20px;
  align-content: center; grid-template-columns: 1fr;
  overflow: auto; /* never spill over the controls, whatever the window size */
}
.stage[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stage[data-count="3"], .stage[data-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stage[data-count="5"], .stage[data-count="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile {
  --level: 0;
  position: relative; margin: 0; aspect-ratio: 16/9; border-radius: var(--radius); overflow: hidden; background: #0D0B08;
  box-shadow: 0 0 0 calc(1px + var(--level) * 3px) rgba(194, 162, 101, calc(.22 + var(--level) * .78)),
              0 0 calc(var(--level) * 34px) rgba(194, 162, 101, calc(var(--level) * .45));
  transition: box-shadow .12s;
  max-height: calc(100dvh - 190px);
  justify-self: center; width: 100%;
}
.stage[data-count="1"] .tile { width: min(100%, calc((100dvh - 190px) * 16 / 9)); }
.tile video { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile.self video { transform: scaleX(-1); }
.tile.cam-off video { visibility: hidden; }
.tile.cam-off::after {
  content: attr(data-initials); position: absolute; inset: 0; display: grid; place-items: center;
  font: 500 64px var(--serif); color: var(--gold); background: radial-gradient(circle, #2A241C, #0D0B08);
}
.tile figcaption {
  position: absolute; left: 14px; bottom: 12px; z-index: 2; display: flex; gap: 8px; align-items: center;
  padding: 6px 12px; border-radius: 999px; background: rgba(22, 19, 14, .72); backdrop-filter: blur(8px);
  font-weight: 600; font-size: 13px;
}
.tile-flags { color: var(--cream-dim); font-weight: 500; font-size: 12px; }

.crew { grid-area: crew; padding: 6px 20px 14px 6px; overflow: auto; }
.crew h2 { font-size: 16px; margin: 4px 0 10px; }
.crew ul { list-style: none; margin: 0; padding: 0; }
.crew li { padding: 10px 12px; border: 1px solid var(--umber); border-radius: 12px; margin-bottom: 8px; font-size: 13px; }
.crew li strong { display: block; }
.crew .status { color: var(--cream-dim); font-size: 12px; }
.crew .status.done { color: var(--ok); }
.crew .status.busy { color: var(--gold); }
.markers { margin-top: 16px; font-size: 12px; color: var(--cream-dim); }
.crew .quality { display: block; color: var(--cream-dim); font-size: 11px; }
.local-box { margin-top: 18px; border-top: 1px solid var(--umber); padding-top: 12px; }
.local-box h2 { font-size: 14px; margin: 0 0 8px; }
.local-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; margin-bottom: 8px; color: var(--cream-dim); }
.ctl-small { padding: 6px 12px; font-size: 12px; }

.checks { list-style: none; padding: 0; margin: 16px 0 0; font-size: 13px; }
.checks li { padding: 5px 0 5px 22px; position: relative; color: var(--cream-dim); }
.checks li::before { position: absolute; left: 0; top: 5px; font-weight: 700; }
.checks li.ok::before { content: "✓"; color: var(--ok); }
.checks li.warn::before { content: "!"; color: var(--gold); left: 4px; }
.checks li.bad::before { content: "✕"; color: #F0A08E; }

.controls { grid-area: controls; display: flex; justify-content: center; gap: 10px; padding: 14px 16px 20px; flex-wrap: wrap; position: relative; z-index: 5; }
.ctl {
  border: 1px solid var(--umber); background: var(--ink-2); color: var(--cream); border-radius: 999px;
  padding: 11px 18px; font: 600 14px var(--sans); cursor: pointer;
}
.ctl:hover:not(:disabled) { border-color: var(--gold); }
.ctl:disabled { opacity: .4; cursor: default; }
.ctl.off { background: #3A1F18; border-color: #6B3426; }
.ctl-rec { background: var(--red); border-color: var(--red); color: #fff; }
.ctl-rec.stop { background: var(--cream); color: var(--ink); border-color: var(--cream); }
.ctl-leave { color: #F0A08E; }

.countdown {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 20; pointer-events: none;
  font: 500 160px var(--serif); color: var(--gold); background: rgba(22, 19, 14, .55); text-shadow: 0 0 40px rgba(194, 162, 101, .6);
}
.upload-banner {
  position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 15;
  padding: 10px 18px; border-radius: 999px; background: var(--gold); color: var(--ink); font-weight: 600; font-size: 13px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .4); max-width: calc(100% - 32px); text-align: center;
}
.upload-banner.ok { background: var(--ok); }
.upload-banner.warn { background: #F0A08E; }

@media (max-width: 820px) {
  #studio { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) auto auto; grid-template-areas: "top" "stage" "crew" "controls"; }
  .stage { padding: 6px 16px; }
  .crew { padding: 6px 16px; max-height: 26vh; }
  .net { display: none; }
  .tile { max-height: none; }
}
@media (max-width: 560px) {
  .stage[data-count] { grid-template-columns: 1fr; }
}
