:root {
  --bg: #f5f4fb; --card: #ffffff; --ink: #17142e; --mut: #6b6785; --line: #e3e0f0;
  --acc: #6c4cf5; --acc2: #ff4f8b; --ok: #12a36b; --warn: #d98a00; --bad: #d93a3a;
  --screen: #0e0c1f; --r: 16px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e0c1f; --card: #1a1733; --ink: #efedfb; --mut: #a19dbe; --line: #2d2950; --acc: #8b70ff; --screen: #000; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
a { color: var(--acc); }
h1 { font-size: clamp(26px, 6vw, 40px); line-height: 1.15; margin: 8px 0 10px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px 40px; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 750; font-size: 19px; }
.brand svg { width: 32px; height: 32px; }
.roominfo { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px;
  padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; min-height: 36px; display: inline-flex; align-items: center; gap: 6px; }
.chip.dot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--mut); }
.chip.dot.on::before { background: var(--ok); }
.chip.dot.off::before { background: var(--bad); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 14px 0; }
.hero { padding: 18px 0 4px; }
.hero p { color: var(--mut); font-size: 17px; margin: 0; }
.btn { border: 0; background: var(--acc); color: #fff; font: inherit; font-weight: 650; border-radius: 12px;
  padding: 10px 16px; min-height: 44px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { filter: brightness(1.07); }
.btn.big { width: 100%; font-size: 18px; min-height: 54px; }
.btn.ghost { background: transparent; color: var(--acc); border: 1.5px solid var(--acc); }
.btn svg { width: 24px; height: 24px; }
.link { background: none; border: 0; color: var(--acc); font: inherit; font-size: 14px; cursor: pointer; padding: 6px; }
.right { float: right; }
.row { display: flex; gap: 8px; align-items: center; }
.row.gap { flex-wrap: wrap; margin-top: 12px; }
.wrap-row { flex-wrap: wrap; }
.wrap-row input { flex: 1 1 260px; }
input:not([type]), input[type=text] { font: inherit; padding: 10px 12px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--bg); color: var(--ink); min-height: 44px; width: 100%; min-width: 0; }
input:focus-visible, button:focus-visible { outline: 3px solid color-mix(in srgb, var(--acc) 55%, transparent); outline-offset: 2px; }
.or { text-align: center; color: var(--mut); margin: 14px 0; font-size: 14px; position: relative; }
.or::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--line); }
.or span { background: var(--card); padding: 0 10px; position: relative; }
.muted { color: var(--mut); }
.small { font-size: 13px; }
.how ol { padding-left: 20px; margin: 0 0 10px; }
.how li { margin: 6px 0; }

.screen { position: relative; aspect-ratio: 16 / 9; background: var(--screen); border-radius: 12px; overflow: hidden; }
.screen.small { aspect-ratio: auto; height: 200px; width: 200px; margin: 0 auto; }
.screen iframe, .screen video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.idle { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: #fff; }
.idle p { margin: 2px; }
.now { margin-top: 12px; }
.now .title { font-weight: 700; font-size: 18px; overflow-wrap: anywhere; }
.now .sub { color: var(--mut); font-size: 14px; }
.bar { display: flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; font-size: 14px; color: var(--mut); margin-top: 8px; }
.bar input { flex: 1; accent-color: var(--acc); }
.controls { display: flex; justify-content: center; gap: 18px; margin: 6px 0; }
.icon { width: 52px; height: 52px; border-radius: 50%; border: 0; background: transparent; color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.icon svg { width: 30px; height: 30px; }
.icon.main { width: 64px; height: 64px; background: var(--acc); color: #fff; }
.icon.main svg { width: 36px; height: 36px; }
.icon:disabled { opacity: .4; cursor: default; }
.syncline { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill { font-size: 13px; padding: 4px 10px; border-radius: 999px; background: color-mix(in srgb, var(--mut) 18%, transparent); color: var(--mut); font-variant-numeric: tabular-nums; }
.pill.ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 20%, transparent); color: var(--warn); }
.pill.bad { background: color-mix(in srgb, var(--bad) 18%, transparent); color: var(--bad); }

.note { background: color-mix(in srgb, var(--warn) 15%, transparent); border-radius: 10px; padding: 8px 12px; font-size: 14px; margin: 10px 0 0; }
.qh { margin-top: 16px; }
.queue { list-style: none; padding: 0; margin: 0; }
.queue li { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.queue li + li { border-top: 1px solid var(--line); }
.queue li.cur { background: color-mix(in srgb, var(--acc) 13%, transparent); }
.queue img { width: 64px; height: 36px; object-fit: cover; border-radius: 6px; background: var(--line); flex: none; }
.queue .qt { flex: 1; min-width: 0; cursor: pointer; font-size: 15px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.queue button { background: none; border: 0; color: var(--mut); cursor: pointer; font-size: 18px; width: 36px; height: 36px; border-radius: 50%; }
.queue button:hover { background: var(--line); }
.queue .empty { color: var(--mut); font-size: 14px; }

.field { display: block; margin: 10px 0; font-weight: 600; font-size: 15px; }
.field input { margin-top: 6px; font-weight: 400; }
.field input[type=range] { width: 100%; accent-color: var(--acc); }
.field output { float: right; font-weight: 500; color: var(--acc); font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 10px; align-items: center; margin: 10px 0; min-height: 32px; }
.check input { width: 20px; height: 20px; accent-color: var(--acc); }

.unlock { position: fixed; inset: 0; z-index: 20; display: grid; place-content: center; text-align: center; padding: 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(6px); }
.unlock .btn { width: auto; padding: 14px 28px; }
.pulse { animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--acc) 50%, transparent); } 50% { box-shadow: 0 0 0 14px transparent; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

dialog { border: 1px solid var(--line); border-radius: var(--r); background: var(--card); color: var(--ink); max-width: min(420px, calc(100vw - 32px)); width: 100%; }
dialog::backdrop { background: rgb(0 0 0 / .5); }
.qr { background: #fff; border-radius: 12px; padding: 10px; width: min(260px, 100%); margin: 8px auto 12px; }
.qr svg { display: block; width: 100%; height: auto; }
.devs { list-style: none; padding: 0; margin: 0 0 10px; }
.devs li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.devs .me { font-weight: 700; }
.foot { text-align: center; font-size: 13px; }
