:root {
  --bg: #060708;
  --bg-soft: #0a0d12;
  --panel: #0e1218;
  --panel-2: #131923;
  --line: #1d2430;
  --line-soft: #161c26;
  --text: #e9eef7;
  --muted: #8d9bb0;
  --dim: #5d6a7e;
  --accent: #4f8cff;
  --accent-ink: #04101f;
  --violet: #8b5cf6;
  --ok: #34d399;
  --warn: #f5b955;
  --bad: #f87171;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'JetBrains Mono', Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(1100px 620px at 12% -8%, rgba(79, 140, 255, 0.14), transparent 62%),
    radial-gradient(880px 520px at 92% 4%, rgba(139, 92, 246, 0.12), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 0.5em;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(30px, 5vw, 54px);
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(22px, 3vw, 30px);
}

h3 {
  font-size: 17px;
}

p {
  margin: 0 0 1em;
  color: var(--muted);
}

code,
pre {
  font-family: var(--mono);
  font-size: 13px;
}

/* ---------------------------------------------------------------- chrome */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px clamp(14px, 4vw, 40px);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(6, 7, 8, 0.82);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-size: 16px;
}

.brand:hover {
  text-decoration: none;
}

.brand .dot {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: linear-gradient(140deg, var(--accent), var(--violet));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
}

.nav a {
  padding: 7px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 14px;
}

.nav a:hover {
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
}

.nav a.on {
  background: var(--panel-2);
  color: var(--text);
}

.spacer {
  flex: 1;
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn:hover {
  background: #182030;
  border-color: var(--line-2, #2a3341);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(180deg, #5b96ff, #3f7bf0);
  border-color: #2f6ae0;
  color: #fff;
}

.btn.primary:hover {
  background: linear-gradient(180deg, #6ba1ff, #4a84f5);
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  color: #ffb4b4;
  border-color: #3a1f22;
  background: #1a1114;
}

.btn.danger:hover {
  background: #241518;
}

.btn.sm {
  padding: 6px 11px;
  font-size: 13px;
  border-radius: 9px;
}

.btn.block {
  width: 100%;
}

.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}

/* ---------------------------------------------------------------- layout */
.wrap {
  width: min(1180px, 100% - 32px);
  margin: 0 auto;
  padding: 40px 0 80px;
}

.wrap.narrow {
  width: min(520px, 100% - 32px);
  padding-top: 56px;
}

.hero {
  padding: clamp(40px, 8vw, 92px) 0 24px;
  text-align: center;
}

.hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 13px;
}

.hero p.lead {
  max-width: 620px;
  margin: 0 auto 26px;
  font-size: 17px;
  color: #a9b6c9;
}

.hero-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.screen {
  position: relative;
  margin: 34px auto 0;
  width: min(980px, 100%);
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #000;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.screen iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.section {
  margin-top: 64px;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 20px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(19, 25, 35, 0.9), rgba(11, 14, 19, 0.9));
}

.card h3 {
  margin-bottom: 6px;
}

.card p {
  margin: 0;
  font-size: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 20px;
}

.panel + .panel {
  margin-top: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h3 {
  margin: 0;
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.row.between {
  justify-content: space-between;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 780px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .nav {
    display: none;
  }
}

.muted {
  color: var(--muted);
}
.dim {
  color: var(--dim);
  font-size: 13px;
}
.mono {
  font-family: var(--mono);
  font-size: 13px;
}

/* ---------------------------------------------------------------- forms */
.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--muted);
}

.input,
select,
textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #0a0d12;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  outline: none;
}

.input:focus,
select:focus,
textarea:focus {
  border-color: #34527f;
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.14);
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.form-note {
  margin-top: 12px;
  font-size: 13px;
  color: var(--dim);
}

.err {
  padding: 10px 13px;
  margin-bottom: 14px;
  border: 1px solid #40222a;
  border-radius: 10px;
  background: #1a1114;
  color: #ffb4b4;
  font-size: 13px;
}

.oknote {
  padding: 10px 13px;
  margin-bottom: 14px;
  border: 1px solid #1f3a2c;
  border-radius: 10px;
  background: #0f1a15;
  color: #a6f0c6;
  font-size: 13px;
}

/* ---------------------------------------------------------------- lists */
.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
}

.item .thumb {
  width: 76px;
  height: 43px;
  border-radius: 7px;
  background: #05070a;
  border: 1px solid var(--line);
  object-fit: cover;
  flex: none;
}

.item .meta {
  min-width: 0;
  flex: 1;
}

.item .title {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item .sub {
  font-size: 12.5px;
  color: var(--dim);
}

.item .actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #0b0f15;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.badge.ok {
  border-color: #1d4a37;
  color: #7ee2b0;
}
.badge.warn {
  border-color: #4a3a1d;
  color: #f5cf87;
}
.badge.bad {
  border-color: #4a1f24;
  color: #ff9c9c;
}
.badge.live {
  border-color: #23508f;
  color: #9dc4ff;
}

/* ---------------------------------------------------------------- drop zone */
.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 34px 20px;
  border: 1.5px dashed #26303e;
  border-radius: var(--radius);
  background: #080b10;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.drop:hover,
.drop.over {
  border-color: #3d6ea8;
  background: #0a1119;
}

.drop strong {
  font-size: 15px;
}

.drop .hint {
  font-size: 13px;
  color: var(--dim);
}

.progress {
  height: 6px;
  border-radius: 999px;
  background: #12161e;
  overflow: hidden;
  margin-top: 10px;
}

.progress > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  transition: width 0.2s;
}

/* ---------------------------------------------------------------- stage pages */
body.stage {
  overflow: hidden;
  background: #000;
}

.stage-full {
  position: fixed;
  inset: 0;
  background: #000;
}

.stage-full iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.hud {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 22px;
  display: flex;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
  z-index: 30;
  opacity: 0;
  transition: opacity 0.25s;
}

.hud.show {
  opacity: 1;
}

.hud > * {
  pointer-events: auto;
}

.hud .pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(12, 15, 20, 0.86);
  backdrop-filter: blur(10px);
  color: #dbe4f2;
  font-size: 13px;
}

.hud button.pill {
  cursor: pointer;
  font: inherit;
}

.hud button.pill:hover {
  background: rgba(28, 36, 48, 0.95);
}

.progressbar {
  position: fixed;
  left: 0;
  top: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  z-index: 31;
  transition: width 0.25s;
}

.blackout {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 50;
  display: none;
}

.blackout.on {
  display: block;
}

.newver {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 35;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid #2b4d7f;
  background: rgba(12, 20, 33, 0.95);
  font-size: 13px;
}

.newver.on {
  display: flex;
}

/* ---------------------------------------------------------------- control */
.ctrl-wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 14px 40px;
}

.ctrl-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 2px 14px;
}

.ctrl-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  padding: 16px;
  margin-bottom: 14px;
}

.ctrl-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ctrl-nav .btn {
  padding: 20px;
  font-size: 17px;
}

.notes {
  max-height: 30vh;
  overflow: auto;
  font-size: 14px;
  color: #c7d3e4;
  white-space: pre-wrap;
}

.ctrl-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ctrl-row label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  font-size: 13.5px;
  color: #c7d3e4;
}

.ctrl-row .x-val {
  color: var(--accent);
  font-family: var(--mono);
}

input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
}

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0a0e13;
  font-size: 14px;
}

.switch input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 48px;
  height: 28px;
  margin: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #1a2332;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s;
}

.switch input::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #8798b3;
  transition: transform 0.16s, background 0.16s;
}

.switch input:checked {
  border-color: rgba(79, 140, 255, 0.65);
  background: rgba(79, 140, 255, 0.32);
}

.switch input:checked::after {
  transform: translateX(20px);
  background: var(--accent);
}

.seg {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.seg button {
  flex: 1;
  min-width: 76px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #0a0e13;
  color: var(--muted);
  font: inherit;
  font-size: 13.5px;
  cursor: pointer;
}

.seg button.active,
.seg button[aria-pressed='true'] {
  border-color: #3568b8;
  background: #10203a;
  color: #fff;
}

.timer {
  font-family: var(--mono);
  font-size: 15px;
}

/* ---------------------------------------------------------------- dialogs */
.mask {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 4, 7, 0.72);
  backdrop-filter: blur(4px);
}

.dialog {
  width: min(480px, 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 20px;
}

.dialog h3 {
  margin-bottom: 12px;
}

.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.codebox {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0a0e13;
}

.codebox .code {
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: 0.16em;
  color: #fff;
}

/* ---------------------------------------------------------------- toast */
.toast-host {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(15, 20, 28, 0.96);
  color: var(--text);
  font-size: 13.5px;
  box-shadow: var(--shadow);
  animation: toast-in 0.18s ease-out;
}

.toast.bad {
  border-color: #4a1f24;
  color: #ffc0c0;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* ---------------------------------------------------------------- misc */
pre.block {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #080b10;
  overflow: auto;
  max-height: 55vh;
  color: #c7d3e4;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.kv {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 8px 14px;
  font-size: 14px;
}

.kv dt {
  color: var(--dim);
}

.kv dd {
  margin: 0;
  color: #cfdaea;
  word-break: break-all;
}

table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

table.tbl th,
table.tbl td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
}

table.tbl th {
  color: var(--dim);
  font-weight: 500;
}

.notice {
  padding: 12px 14px;
  border: 1px solid #3a3320;
  border-radius: 12px;
  background: #17130c;
  color: #f0d79a;
  font-size: 13.5px;
}

.center {
  text-align: center;
}

.qr {
  width: 180px;
  height: 180px;
  background: #fff;
  border-radius: 12px;
  padding: 8px;
}

.spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
