:root {
  --accent: #0b5cff;
  --bg: #0f1218;
  --panel: #171c26;
  --panel-2: #1f2633;
  --line: #2a3242;
  --text: #e8ecf3;
  --muted: #98a2b8;
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.container { max-width: 1180px; margin: 0 auto; padding: 20px 16px; }

/* Top nav */
.nav { display: flex; align-items: center; gap: 18px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.nav .brand { font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.nav .brand img { height: 26px; }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; }
.nav a.active, .nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.nav .spacer { flex: 1; }
.nav form { margin: 0; }

/* Layout bits */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat { background: var(--panel-2); border-radius: 10px; padding: 12px 14px; }
.stat .v { font-size: 1.7rem; font-weight: 700; }
.stat .l { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.right { margin-left: auto; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
tr:hover td { background: rgba(255,255,255,.02); }
.table-wrap { overflow-x: auto; }

/* Forms */
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=password], input[type=url], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; padding: 9px 11px; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font: inherit;
}
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.field { margin-bottom: 14px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: .95rem; }
.check input { width: auto; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(1.15); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn.sm { padding: 4px 9px; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: default; }
form.inline { display: inline; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; background: var(--panel-2); color: var(--muted); }
.badge.live { background: var(--bad); color: #fff; }
.badge.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.2s infinite; }
.badge.scheduled { background: #1d4ed8; color: #fff; }
.badge.ended { background: var(--panel-2); color: var(--muted); }
.badge.skipped, .badge.cancelled { background: rgba(245,158,11,.12); color: var(--warn); }
.badge.ok { background: rgba(34,197,94,.15); color: var(--ok); }
.badge.warn { background: rgba(245,158,11,.15); color: var(--warn); }
.badge.bad { background: rgba(239,68,68,.15); color: var(--bad); }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .3 } }

.notice { padding: 10px 14px; border-radius: 8px; background: rgba(11,92,255,.12); border: 1px solid rgba(11,92,255,.35); margin-bottom: 14px; }
.notice.error { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.4); }

/* Copy boxes */
.copy { display: flex; gap: 6px; align-items: stretch; }
.copy input { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
pre.code { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; overflow-x: auto; font-size: .8rem; white-space: pre-wrap; word-break: break-all; }

/* Player */
.player-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; }
.player-wrap video { width: 100%; height: 100%; display: block; background: #000; }
.player-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: #fff; background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,.85)); padding: 20px; }
.player-overlay.hidden { display: none; }
.player-overlay h2 { font-size: clamp(1.1rem, 3vw, 1.8rem); }
.countdown { display: flex; gap: 14px; margin: 12px 0; }
.countdown div { min-width: 64px; }
.countdown .n { font-size: clamp(1.6rem, 5vw, 2.6rem); font-weight: 700; font-variant-numeric: tabular-nums; }
.countdown .l { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; opacity: .75; }
.live-pill { position: absolute; top: 12px; left: 12px; z-index: 2; }
.player-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .35; }

/* Cards of broadcasts / recordings */
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.tile .thumb { aspect-ratio: 16/9; background: var(--panel-2) center/cover no-repeat; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.tile .body { padding: 12px 14px; }
.tile .body h3 { margin-bottom: 4px; }
.tile a { color: var(--text); }

/* Embed body */
body.embed { background: #000; }
body.embed .player-wrap { border-radius: 0; height: 100vh; aspect-ratio: auto; }

/* Login */
.login { max-width: 380px; margin: 10vh auto; }

@media (max-width: 640px) {
  .container { padding: 14px 12px; }
  th, td { padding: 7px 6px; font-size: .9rem; }
  .nav { gap: 6px; }
}

/* Language switcher */
.langbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0; }
.langbar .pill { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: .9rem; }
.langbar .pill.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.langbar .pill:hover { text-decoration: none; filter: brightness(1.15); }
.langbar .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); margin-left: 4px; }
body.embed .langbar { position: absolute; top: 10px; right: 10px; z-index: 3; margin: 0; }
body.embed .langbar .muted { display: none; }
body.embed .langbar .pill { background: rgba(0,0,0,.6); border-color: rgba(255,255,255,.25); font-size: .8rem; padding: 3px 9px; }

/* Simulated live: library, schedule */
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); transition: border-color .15s, background .15s; }
.drop.over { border-color: var(--accent); background: rgba(11,92,255,.06); color: var(--text); }
.drop input[type=file] { display: none; }
.uploads { margin-top: 12px; display: grid; gap: 8px; text-align: left; }
.upl { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; font-size: .9rem; }
.bar { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.thumb-sm { width: 112px; aspect-ratio: 16/9; object-fit: cover; border-radius: 6px; display: block; background: var(--panel-2); }
.langs { display: flex; gap: 4px; flex-wrap: wrap; }
.day { margin-bottom: 14px; }
.day h3 { color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.slot { display: grid; grid-template-columns: 92px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--panel-2); margin-bottom: 6px; }
.slot .t { font-variant-numeric: tabular-nums; font-weight: 600; }
.slot.lose { opacity: .55; }
.slot.lose .t { text-decoration: line-through; }
.dist { font-size: .72rem; }
.days-pick { display: flex; gap: 6px; flex-wrap: wrap; }
.days-pick label { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--text); cursor: pointer; margin: 0; }
.days-pick input { width: auto; margin: 0; }
.days-pick label:has(input:checked) { background: var(--accent); border-color: var(--accent); color: #fff; }
.choice { display: grid; gap: 8px; }
.choice label { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--text); cursor: pointer; margin: 0; font-size: .95rem; }
.choice label:has(input:checked) { border-color: var(--accent); background: rgba(11,92,255,.08); }
.choice input { width: auto; margin-top: 3px; }
.choice small { display: block; color: var(--muted); }
.summary { padding: 10px 12px; border-radius: 8px; background: var(--panel-2); margin-bottom: 14px; }
.lines { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.lines td { font-size: .85rem; vertical-align: top; }
.lines td.rtl { direction: rtl; text-align: right; }
video.preview { width: 100%; border-radius: 8px; background: #000; display: block; }
