:root {
  --bg: #0f1115; --panel: #181b22; --panel2: #20242d; --line: #2c313c;
  --text: #e8eaef; --muted: #8b93a3; --accent: #d4a24c; --live: #e5383b; --ok: #3fb950;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; color: inherit; }
button {
  background: var(--panel2); border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 14px; cursor: pointer;
}
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); color: #1a1407; border-color: var(--accent); font-weight: 600; }
button.danger { background: var(--live); border-color: var(--live); color: #fff; font-weight: 600; }
button.small { padding: 4px 9px; font-size: 13px; }
button.on { background: var(--live); border-color: var(--live); color: #fff; }
input[type=text], input[type=password], input[type=number], input[type=url], select {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%;
}
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }
h1, h2, h3 { margin: 0; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* centered card pages */
.center { min-height: 100%; display: grid; place-items: center; padding: 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: min(440px, 100%); }
.card h1 { font-size: 22px; margin-bottom: 4px; }
.card .actions { margin-top: 18px; display: flex; gap: 10px; }
.error { color: #ff7b7b; font-size: 14px; margin-top: 10px; min-height: 1em; }

/* studio layout */
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.topbar h1 { font-size: 18px; }
.topbar .spacer { flex: 1; }
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; font-size: 13px; font-weight: 700; background: var(--panel2); border: 1px solid var(--line); }
.badge.live { background: var(--live); border-color: var(--live); color: #fff; animation: pulse 1.6s infinite; }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.badge.live .dot { background: #fff; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(229,56,59,.25); } }

.studio { display: grid; grid-template-columns: 1fr 360px; gap: 14px; padding: 14px; height: calc(100% - 59px); }
.col { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.panel.grow { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.program { position: relative; background: #000; border-radius: 10px; overflow: hidden; aspect-ratio: 16/9; max-height: 52vh; }
.program canvas { width: 100%; height: 100%; display: block; }
.program .overlay { position: absolute; top: 10px; left: 10px; display: flex; gap: 8px; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
#goLive { font-size: 16px; padding: 10px 22px; }

/* mixer */
.mixer { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.strip {
  flex: 0 0 96px; background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.strip.music { border-color: #5b4a24; }
.strip .name { font-size: 12px; font-weight: 600; text-align: center; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip .faderwrap { display: flex; gap: 6px; height: 150px; align-items: stretch; }
.strip input[type=range] { writing-mode: vertical-lr; direction: rtl; width: 26px; height: 150px; accent-color: var(--accent); }
.meter { width: 8px; background: #0a0b0e; border-radius: 4px; position: relative; overflow: hidden; }
.meter > div { position: absolute; bottom: 0; left: 0; right: 0; height: 0; background: linear-gradient(to top, var(--ok) 0 65%, #e3b341 65% 85%, var(--live) 85%); transition: height 60ms linear; }
.strip .val { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.strip .btns { display: flex; gap: 4px; }
.strip button.small { padding: 3px 7px; font-size: 11px; }
.duck-tag { font-size: 10px; font-weight: 700; color: var(--accent); visibility: hidden; }
.duck-tag.show { visibility: visible; }

/* songs */
.songs { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; min-height: 60px; }
.songs li { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.songs li:hover { background: var(--panel2); }
.songs li.playing { background: #2b2414; color: var(--accent); }
.songs li .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.songs li .del { opacity: 0; }
.songs li:hover .del { opacity: 1; }
.transport { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.progress { height: 5px; background: var(--bg); border-radius: 3px; overflow: hidden; margin: 6px 0 10px; cursor: pointer; }
.progress > div { height: 100%; width: 0; background: var(--accent); }
.nowplaying { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* comments / chat */
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs button.active { border-color: var(--accent); color: var(--accent); }
.chatframe { flex: 1; border: 0; border-radius: 8px; background: #fff; min-height: 200px; width: 100%; }
.chatlog { flex: 1; overflow-y: auto; font-size: 14px; display: flex; flex-direction: column; gap: 6px; min-height: 100px; }
.chatlog .m b { color: var(--accent); }
.chatform { display: flex; gap: 6px; margin-top: 8px; }

.guestlist { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.schedule { font-size: 13px; color: var(--muted); }
.schedule b { color: var(--text); }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 24px; width: min(520px, 94vw); }
dialog::backdrop { background: rgba(0,0,0,.6); }

/* join page */
.join-stage { max-width: 960px; margin: 0 auto; padding: 16px; }
.join-stage video { width: 100%; background: #000; border-radius: 12px; aspect-ratio: 16/9; }
.selfview { width: 160px !important; aspect-ratio: 4/3 !important; border-radius: 8px !important; transform: scaleX(-1); }

/* graphics */
.studio > .col:first-child { overflow-y: auto; }
.gfx { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; max-height: 220px; overflow-y: auto; }
.thumb { position: relative; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; border: 2px solid var(--line); cursor: pointer; background: #000; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.onair { border-color: var(--live); }
.thumb.onair::after { content: 'ON AIR'; position: absolute; top: 4px; left: 4px; background: var(--live); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 6px; border-radius: 4px; }
.thumb .del { position: absolute; top: 4px; right: 4px; padding: 1px 6px; font-size: 11px; opacity: 0; }
.thumb:hover .del { opacity: 1; }
.ltlist { max-height: 160px; }
.ltlist li .t small { color: var(--muted); }
.ltlist li.onair { background: #3a1416; color: #fff; }

@media (max-width: 1000px) {
  .gfx { grid-template-columns: 1fr; }
  .studio { grid-template-columns: 1fr; height: auto; }
}

/* events editor */
#eventsEd { display: flex; flex-direction: column; gap: 10px; max-height: 280px; overflow-y: auto; }
.evrow { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; gap: 6px; }
.ev-when { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; }
.ev-when .day { margin: 0; display: inline-flex; align-items: center; gap: 2px; color: var(--text); }
.ev-when input[type=time] { width: auto; padding: 4px 6px; }
.ev-when .ev-del { margin-left: auto; }
