:root {
  color-scheme: dark;
  --bg: #080b0d;
  --panel: #11171a;
  --panel-2: #171e22;
  --line: #273238;
  --text: #f4f6f7;
  --muted: #91a0a8;
  --accent: #3478f6;
  --accent-2: #63a0ff;
  --green: #35c76f;
  --danger: #ee5b5b;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--text); background: radial-gradient(circle at 80% -10%, #102b56 0, transparent 28%), var(--bg); }
button, input, select { font: inherit; }
button { cursor: pointer; }
.muted { color: var(--muted); }
.eyebrow, .section-label { margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.topbar { height: 72px; padding: 0 max(24px, 4vw); display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); background: rgb(8 11 13 / 88%); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; font-weight: 800; }
.brand-mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff; font-weight: 900; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.user-pill { max-width: 150px; overflow: hidden; text-overflow: ellipsis; padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: #b9c8d0; font-size: 12px; font-weight: 800; }
.connection-pill { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 800; }
.connection-pill i { width: 8px; height: 8px; border-radius: 50%; background: #66737a; }
.connection-pill.connected i { background: var(--green); box-shadow: 0 0 10px rgb(53 199 111 / 65%); }
.icon-button, .close-button { border: 0; color: var(--muted); background: transparent; padding: 10px; border-radius: 10px; }
.icon-button:hover, .close-button:hover { color: var(--text); background: var(--panel-2); }
.shell { width: min(1400px, 92vw); margin: 0 auto; padding: 54px 0 70px; }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 36px; }
.hero h1 { margin: 0; font-size: clamp(38px, 6vw, 72px); letter-spacing: -.055em; }
.hero p.muted { max-width: 680px; }
.button { border: 1px solid transparent; border-radius: 14px; min-height: 48px; padding: 0 22px; color: var(--text); font-weight: 850; }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary, .wake-button { color: #fff; background: var(--accent); }
.button.primary:hover, .wake-button:hover { background: var(--accent-2); }
.button.secondary { border-color: var(--line); background: var(--panel-2); }
.button.danger { border-color: #6e3434; color: #ffb4b4; background: #2a1718; }
.wake-button { min-width: 220px; }
.power-icon { margin-right: 9px; }
.notice { margin: -12px 0 22px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.notice.error { color: #ffb4b4; border-color: #6e3434; }
.dashboard { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(320px, .75fr); gap: 22px; align-items: start; }
.panel { border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(145deg, var(--panel), #0d1215); overflow: hidden; }
.preview-card { padding: 24px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.panel-heading.compact { margin-bottom: 12px; }
.panel-heading h2 { margin: 0 0 20px; font-size: 25px; }
.preview-frame { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden; border: 1px solid #2c383e; border-radius: 16px; background: #030506; }
.preview-frame img { width: 100%; height: 100%; object-fit: contain; }
.preview-empty { display: grid; justify-items: center; gap: 14px; color: var(--muted); text-align: center; padding: 25px; }
.preview-symbol { color: var(--accent); font-size: 42px; }
.live-badge { position: absolute; left: 14px; top: 14px; padding: 7px 10px; border-radius: 8px; background: #e94444; color: white; font-size: 11px; font-weight: 900; letter-spacing: .12em; }
.control-column { display: grid; gap: 22px; }
.stream-card, .scenes-card { padding: 24px; }
.stream-status { display: flex; align-items: center; gap: 13px; margin: 24px 0; }
.stream-dot { width: 13px; height: 13px; border-radius: 50%; background: #66737a; }
.stream-card.live .stream-dot { background: #e94444; box-shadow: 0 0 14px rgb(233 68 68 / 70%); }
.stream-status div { display: grid; gap: 3px; }
.stream-status small { color: var(--muted); font-variant-numeric: tabular-nums; }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.count { display: grid; place-items: center; min-width: 28px; height: 28px; border-radius: 9px; color: #8bb8ff; background: #112445; font-weight: 800; }
.scene-list { display: grid; gap: 8px; max-height: 410px; overflow-y: auto; }
.scene-button { display: flex; justify-content: space-between; width: 100%; padding: 15px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: var(--panel-2); text-align: left; }
.scene-button:hover { border-color: #3768ad; }
.scene-button.active { border-color: var(--accent); background: #10284d; }
.scene-button.active::after { content: "PROGRAM"; color: var(--accent); font-size: 10px; font-weight: 900; }
dialog { width: min(680px, calc(100vw - 28px)); max-height: 90vh; padding: 0; border: 1px solid var(--line); border-radius: 24px; color: var(--text); background: var(--panel); box-shadow: 0 26px 90px #000; }
dialog::backdrop { background: rgb(0 0 0 / 70%); backdrop-filter: blur(5px); }
.settings-form { padding: 26px; overflow-y: auto; max-height: 90vh; }
.dialog-heading { display: flex; justify-content: space-between; align-items: start; }
.dialog-heading h2 { margin: 0 0 20px; }
.close-button { font-size: 26px; }
fieldset { margin: 0 0 18px; padding: 18px; border: 1px solid var(--line); border-radius: 16px; }
legend { color: var(--accent); font-weight: 850; padding: 0 7px; }
label { display: grid; gap: 7px; margin-bottom: 14px; color: #c7d0d4; font-size: 13px; font-weight: 700; }
label:last-child { margin-bottom: 0; }
label small { color: var(--muted); font-weight: 400; }
input, select { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 11px; padding: 0 13px; color: var(--text); background: #0b1012; outline: none; }
input:focus, select:focus { border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: 1fr 130px; gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.login-page { display: grid; place-items: center; padding: 22px; }
.login-card { width: min(430px, 100%); padding: 34px; border: 1px solid var(--line); border-radius: 24px; background: var(--panel); }
.login-card h1 { margin: 10px 0; font-size: 34px; }
.login-form { margin-top: 26px; }
.login-form .button { width: 100%; }
.login-footer { margin: 24px 0 0; color: var(--muted); font-size: 12px; }
.error-message { padding: 11px; border-radius: 10px; color: #ffb4b4; background: #2a1718; }
.user-list { display: grid; gap: 9px; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: #0b1012; }
.user-row div { display: grid; gap: 3px; min-width: 0; }
.user-row strong { overflow: hidden; text-overflow: ellipsis; }
.user-row small { color: var(--accent-2); }
.compact-button { min-height: 36px; padding: 0 14px; border-radius: 10px; }
@media (max-width: 880px) {
  .dashboard { grid-template-columns: 1fr; }
  .hero { align-items: stretch; flex-direction: column; }
  .wake-button { width: 100%; }
  .connection-pill span { display: none; }
  .user-pill { display: none; }
  .topbar { padding: 0 14px; }
  .top-actions { gap: 2px; }
}
@media (max-width: 520px) {
  .shell { width: min(94vw, 1400px); padding-top: 32px; }
  .brand > span:last-child { display: none; }
  .form-grid, .button-row { grid-template-columns: 1fr; }
  .preview-card, .stream-card, .scenes-card { padding: 17px; border-radius: 18px; }
}
