*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0a0a0a;
  --surface:   #141414;
  --surface-2: #1e1e1e;
  --border:    #2a2a2a;
  --text:      #f1f1f1;
  --muted:     #6b7280;
  --dim:       #333;
  --green:     #00ff00;
  --accent:    #6ee7b7;
  --red:       #f87171;
  --radius:    10px;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, monospace;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* ── Nav ────────────────────────────────────────────────────────────────────── */
.nav {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(10,10,10,.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav-brand { font-size: 14px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.nav-right  { display: flex; align-items: center; gap: 12px; }

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239,68,68,.12);
  color: var(--red);
  border: 1px solid rgba(239,68,68,.25);
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.badge-live .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--red);
  animation: pulse 1.3s infinite;
}
.badge-offline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.04);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── Player ─────────────────────────────────────────────────────────────────── */
.player-wrap { position: relative; width: 100%; background: #000; }
.player-wrap::before { content: ''; display: block; padding-bottom: 56.25%; }

.player-wrap > * {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

video { object-fit: contain; background: #000; }

.green-screen {
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: #000;
  font-family: monospace;
}
.green-screen .gs-label {
  font-size: clamp(14px, 2vw, 22px);
  font-weight: 900;
  letter-spacing: 4px;
  text-transform: uppercase;
  opacity: .55;
}
.green-screen .gs-sub {
  font-size: clamp(11px, 1.2vw, 14px);
  opacity: .4;
}

.offline-screen {
  background: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  color: var(--muted);
  font-family: monospace;
}
.offline-screen .ol-icon  { font-size: 36px; }
.offline-screen .ol-label { font-size: 13px; letter-spacing: 2px; text-transform: uppercase; }

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, transform .1s;
  text-decoration: none;
}
.btn:hover  { opacity: .85; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }

.btn-primary  { background: var(--accent); color: #000; }
.btn-ghost    { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-danger   { background: rgba(239,68,68,.12); color: var(--red); border: 1px solid rgba(239,68,68,.2); }
.btn-sm       { padding: 6px 12px; font-size: 12px; }

/* ── Admin layout ───────────────────────────────────────────────────────────── */
.container { max-width: 780px; margin: 0 auto; padding: 0 20px; }

.admin-wrap {
  min-height: calc(100vh - 52px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

/* ── Login card ─────────────────────────────────────────────────────────────── */
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  width: 100%;
  max-width: 360px;
}
.login-card h1 { font-size: 18px; font-weight: 700; margin-bottom: 6px; }
.login-card p  { font-size: 13px; color: var(--muted); margin-bottom: 24px; }

.input-wrap { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.input-label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; }
.input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  width: 100%;
  outline: none;
  transition: border-color .15s;
  font-family: inherit;
}
.input:focus { border-color: var(--accent); }
.input.error { border-color: var(--red); }

.error-msg { font-size: 12px; color: var(--red); margin-top: 4px; min-height: 16px; }

/* ── Dashboard ──────────────────────────────────────────────────────────────── */
.dashboard { width: 100%; max-width: 700px; display: flex; flex-direction: column; gap: 20px; }

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.dash-title { font-size: 18px; font-weight: 700; }

.section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.config-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 16px;
}
.field-row:last-child { margin-bottom: 0; }

.field-label { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }

.field-value-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-value {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 12px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
}

.field-value.secret {
  filter: blur(6px);
  cursor: pointer;
  transition: filter .2s;
}
.field-value.secret.revealed { filter: none; }

/* ── FFmpeg block ───────────────────────────────────────────────────────────── */
.code-block {
  background: #0d0d0d;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 12px;
  color: #a5f3c0;
  white-space: pre;
  overflow-x: auto;
  line-height: 1.7;
}

/* ── Status row ─────────────────────────────────────────────────────────────── */
.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--muted);
}
.status-row .label { font-weight: 600; color: var(--text); }

/* ── Copy toast ─────────────────────────────────────────────────────────────── */
.copy-toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--accent);
  z-index: 99;
  pointer-events: none;
  animation: fadein .15s ease;
}
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } }

/* ── Spinner ────────────────────────────────────────────────────────────────── */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .5s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 480px) {
  .login-card  { padding: 24px 20px; }
  .config-card { padding: 16px; }
  .code-block  { font-size: 11px; }
}
