/* Xiaoyou LED control console */

:root {
  --bg: #070a0f;
  --panel: #0d121a;
  --panel-2: #111823;
  --panel-3: #0a0f17;
  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eef2f7;
  --muted: #8b98aa;
  --accent: #f5b301;
  --accent-soft: rgba(245, 179, 1, 0.14);
  --accent-ink: #171006;
  --green: #54e08a;
  --red: #ff6b6b;
  --blue: #6fb3ff;
  --radius: 16px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(ellipse at 12% -8%, rgba(38, 70, 112, 0.26), transparent 46%),
    radial-gradient(ellipse at 92% 104%, rgba(110, 66, 22, 0.16), transparent 44%),
    var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", "Source Han Sans SC", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

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

a:hover {
  text-decoration: underline;
}

[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------------ */
/* Buttons and primitives                                              */
/* ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, filter 0.15s;
}

.btn:hover {
  border-color: var(--line-strong);
  background: #182231;
  text-decoration: none;
}

.btn.ghost {
  background: transparent;
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.055);
}

.btn.primary {
  border-color: transparent;
  background: linear-gradient(160deg, #ffd76a, #f5b301 60%, #e0a000);
  color: var(--accent-ink);
}

.btn.primary:hover {
  filter: brightness(1.06);
  background: linear-gradient(160deg, #ffd76a, #f5b301 60%, #e0a000);
}

.btn.danger {
  border-color: rgba(255, 107, 107, 0.3);
  color: #ffb3b3;
}

.btn.small {
  height: 27px;
  padding: 0 9px;
  font-size: 12px;
}

.btn.full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.brand-mark {
  display: inline-block;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: linear-gradient(135deg, #ffd76a, #f5b301 55%, #a87300);
  box-shadow: 0 0 24px rgba(245, 179, 1, 0.35);
  transform: rotate(45deg);
}

/* ------------------------------------------------------------------ */
/* Boot and login                                                      */
/* ------------------------------------------------------------------ */

.boot {
  display: grid;
  place-items: center;
  min-height: 100vh;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.1em;
}

.login-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(390px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 140px), var(--panel);
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.login-card h1 {
  margin: 6px 0 0;
  font-size: 26px;
  letter-spacing: -0.01em;
}

.login-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.login-error {
  min-height: 18px;
  color: #ff9b9b;
  font-size: 12px;
}

.login-display {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* App shell                                                           */
/* ------------------------------------------------------------------ */

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 26px;
  height: 64px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 10, 15, 0.88);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
}

.brand-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.brand-sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.top-status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(84, 224, 138, 0.12), 0 0 14px rgba(84, 224, 138, 0.65);
}

.dot.offline {
  background: #ffb347;
  box-shadow: 0 0 0 4px rgba(255, 179, 71, 0.12), 0 0 14px rgba(255, 179, 71, 0.6);
}

.rev {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
}

.top-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 396px;
  gap: 18px;
  align-items: start;
  padding: 18px 24px 30px;
}

.pane {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 140px), var(--panel);
}

.pane-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.pane-head h1,
.pane-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.pane-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.pane-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.side-pane {
  position: sticky;
  top: 82px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 100px);
}

.side-foot {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.menu-wrap {
  position: relative;
}

.menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  min-width: 150px;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #121a26;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
}

.menu button {
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.menu button:hover {
  background: rgba(245, 179, 1, 0.12);
  color: #ffd97a;
}

/* ------------------------------------------------------------------ */
/* Output preview strip                                                */
/* ------------------------------------------------------------------ */

.output-strip {
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #080c12;
}

.output-strip-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
}

.output-strip-head a {
  font-size: 11px;
}

.output-strip-body {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px;
}

.output-wall {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(620px, 100%);
  aspect-ratio: 16 / 9;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: #000;
}

.output-cell {
  position: relative;
  overflow: hidden;
  min-width: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  background: #000;
}

.output-cell:last-child {
  border-right: 0;
}

.output-cell > .led-stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
}

.output-strip-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.output-strip-info p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.output-strip-info .hint {
  color: rgba(245, 179, 1, 0.75);
  font-size: 11px;
  letter-spacing: 0.14em;
}

/* ------------------------------------------------------------------ */
/* Screens                                                             */
/* ------------------------------------------------------------------ */

.link-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.link-group-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border: 1px solid rgba(111, 179, 255, 0.28);
  border-radius: 999px;
  background: rgba(111, 179, 255, 0.08);
  color: #b7d9ff;
  font-size: 11px;
}

.link-group-chip button {
  padding: 0;
  border: 0;
  background: transparent;
  color: #dfeeff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.screens {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.screen-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-3);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.screen-card.is-selected {
  border-color: rgba(245, 179, 1, 0.72);
  box-shadow: 0 0 0 2px rgba(245, 179, 1, 0.16);
}

.screen-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
}

.screen-num {
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.screen-name-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
}

.screen-name-input:hover {
  background: rgba(255, 255, 255, 0.04);
}

.screen-name-input:focus {
  outline: none;
  border-color: rgba(245, 179, 1, 0.5);
  background: #0d131c;
}

.link-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 4px 2px 8px;
  border: 1px solid rgba(111, 179, 255, 0.26);
  border-radius: 999px;
  background: rgba(111, 179, 255, 0.1);
  color: #a9d4ff;
  font-size: 10px;
  white-space: nowrap;
}

.link-chip button {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #eaf5ff;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
}

.screen-preview {
  position: relative;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  background: #000;
  cursor: pointer;
}

.screen-stage-host {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.screen-stage-host > .led-stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
}

.preview-badge {
  position: absolute;
  right: 8px;
  top: 8px;
  z-index: 2;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.56);
  color: rgba(255, 255, 255, 0.62);
  font-size: 9px;
  letter-spacing: 0.1em;
  pointer-events: none;
}

.preview-hover {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  background: rgba(4, 7, 11, 0.52);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s;
}

.screen-preview:hover .preview-hover {
  opacity: 1;
}

.preview-hover span {
  padding: 6px 13px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  font-size: 12px;
  font-weight: 600;
}

.preview-hover .hover-link {
  display: none;
}

body.link-mode .preview-hover .hover-default {
  display: none;
}

body.link-mode .preview-hover .hover-link {
  display: inline;
}

body.link-mode .screen-preview {
  cursor: crosshair;
}

.screen-card.is-selected .preview-hover {
  opacity: 1;
  background: rgba(245, 179, 1, 0.2);
}

.screen-scene-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}

.screen-scene-name {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-nav {
  display: flex;
  flex: 0 0 auto;
  gap: 4px;
}

.playlist {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.playlist::-webkit-scrollbar {
  height: 5px;
}

.playlist::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.scene-pill {
  flex: 0 0 auto;
  max-width: 170px;
  overflow: hidden;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #111823;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.scene-pill:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.scene-pill.active {
  border-color: rgba(245, 179, 1, 0.5);
  background: var(--accent-soft);
  color: #ffd97a;
}

.screen-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
}

.pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.pick input {
  accent-color: var(--accent);
}

.pick input:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.screen-hint {
  color: rgba(255, 255, 255, 0.3);
}

/* ------------------------------------------------------------------ */
/* Scene library                                                       */
/* ------------------------------------------------------------------ */

.scene-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  margin: 0 -6px;
  padding: 0 6px 10px;
  max-height: calc(100vh - 360px);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.scene-item {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 8px 10px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-3);
  cursor: pointer;
  transition: border-color 0.14s, background 0.14s;
}

.scene-item:hover {
  border-color: var(--line-strong);
  background: #0c121b;
}

.scene-item.is-on-air {
  border-color: rgba(245, 179, 1, 0.36);
}

.scene-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  background-color: #05070b;
  background-position: center;
  background-size: cover;
}

.thumb-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 20% 15%, rgba(40, 78, 122, 0.5), transparent 55%),
    linear-gradient(145deg, #0c1724, #04070c);
  color: rgba(255, 255, 255, 0.58);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.thumb-label.web {
  background: linear-gradient(145deg, #1b1a2c, #07060e);
  color: #c7bcff;
}

.thumb-bar {
  position: absolute;
  right: 4px;
  bottom: 4px;
  left: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 13px;
  padding: 0 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.72);
  color: rgba(255, 255, 255, 0.86);
  font-size: 7px;
  font-weight: 700;
}

.scene-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.scene-name {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.tag.live {
  background: rgba(84, 224, 138, 0.1);
  color: #8ff0b5;
}

.tag.live.error {
  background: rgba(255, 107, 107, 0.12);
  color: #ffabab;
}

.tag.onair {
  background: var(--accent-soft);
  color: #ffd97a;
}

.scene-actions {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.scene-actions .apply {
  display: flex;
  gap: 3px;
  margin-left: auto;
}

.scene-actions .apply button {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #111823;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.scene-actions .apply button:hover {
  border-color: rgba(245, 179, 1, 0.5);
  color: var(--accent);
}

.scene-actions .apply button.active {
  border-color: rgba(245, 179, 1, 0.6);
  background: var(--accent-soft);
  color: #ffd97a;
}

/* ------------------------------------------------------------------ */
/* Drawer                                                              */
/* ------------------------------------------------------------------ */

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(2px);
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  display: flex;
  flex-direction: column;
  width: min(570px, 100vw);
  border-left: 1px solid var(--line);
  background: #0b1018;
  box-shadow: -34px 0 90px rgba(0, 0, 0, 0.55);
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex: 0 0 auto;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.drawer-kicker {
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.drawer-head h2 {
  margin: 4px 0 0;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 16px 20px 96px;
}

.drawer-foot {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: rgba(11, 16, 24, 0.94);
  backdrop-filter: blur(8px);
}

.section {
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-3);
}

.section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}

.section > summary::-webkit-details-marker {
  display: none;
}

.section > summary::after {
  content: "▾";
  color: var(--muted);
  font-size: 10px;
  transition: transform 0.15s;
}

.section[open] > summary::after {
  transform: rotate(180deg);
}

.section[open] > summary {
  border-bottom: 1px solid var(--line);
}

.section-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-grid .span2 {
  grid-column: 1 / -1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.field > span {
  letter-spacing: 0.04em;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field input[type="url"],
.field select,
.field textarea {
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  background: #080c12;
  color: var(--text);
  font-size: 13px;
}

.field textarea {
  height: auto;
  min-height: 62px;
  padding: 8px 10px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(245, 179, 1, 0.52);
}

.field input[type="color"] {
  width: 100%;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #080c12;
  cursor: pointer;
}

.hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.switch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

.switch input {
  accent-color: var(--accent);
}

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

.upload-btn {
  position: relative;
  overflow: hidden;
}

.upload-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.image-preview {
  position: relative;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: #05070b;
  background-position: center;
  background-size: cover;
}

.image-preview .empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.32);
  font-size: 11px;
  letter-spacing: 0.08em;
}

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

.range-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.range-row output {
  width: 38px;
  color: var(--text);
  font-size: 12px;
  text-align: right;
}

/* ------------------------------------------------------------------ */
/* Scoreboard operations                                               */
/* ------------------------------------------------------------------ */

.ops-teams {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.ops-team {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #080c12;
}

.ops-team-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.ops-team-name b {
  overflow: hidden;
  max-width: 110px;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ops-score {
  margin: 2px 0 8px;
  font-size: 36px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.ops-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.ops-btn {
  min-width: 38px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #121a26;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.ops-btn:hover {
  border-color: var(--line-strong);
  background: #1a2432;
}

.ops-btn.minus {
  color: #ffb3b3;
}

.ops-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
}

.mini {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.mini .ops-btn {
  min-width: 24px;
  height: 24px;
  padding: 0 5px;
  font-size: 11px;
}

.ops-clock {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #080c12;
}

.ops-clock .clock {
  min-width: 88px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

.ops-clock .clock.running {
  color: var(--green);
}

.clock-input {
  width: 74px;
  height: 30px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: #0d131c;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

.period-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.lock-note {
  padding: 9px 11px;
  border: 1px solid rgba(245, 179, 1, 0.28);
  border-radius: 9px;
  background: rgba(245, 179, 1, 0.07);
  color: #ffd97a;
  font-size: 11px;
  line-height: 1.55;
}

.live-status {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #080c12;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.live-status.ok {
  border-color: rgba(84, 224, 138, 0.28);
  color: #9ff0bd;
}

.live-status.error {
  border-color: rgba(255, 107, 107, 0.3);
  color: #ffb3b3;
}

.readonly-note {
  color: rgba(255, 255, 255, 0.34);
  font-size: 10px;
}

.live-result {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #080c12;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
  white-space: pre-line;
}

/* ------------------------------------------------------------------ */
/* Link bar                                                            */
/* ------------------------------------------------------------------ */

.link-bar {
  position: fixed;
  bottom: 22px;
  left: 50%;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid rgba(245, 179, 1, 0.32);
  border-radius: 14px;
  background: rgba(17, 24, 36, 0.97);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  font-size: 13px;
  transform: translateX(-50%);
}

/* ------------------------------------------------------------------ */
/* Modals                                                              */
/* ------------------------------------------------------------------ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(3px);
}

.modal-card {
  width: min(570px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 17px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.settings-card .form-grid {
  padding: 18px;
}

.settings-links {
  padding: 0 18px 16px;
}

.settings-links-head {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.copy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.copy-row code {
  color: rgba(255, 255, 255, 0.7);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
}

.picker-card {
  width: min(520px, 100%);
}

.picker-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
}

.picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.picker-item:hover {
  background: #121a26;
}

.picker-item .scene-thumb {
  width: 76px;
  flex: 0 0 76px;
}

.picker-item .p-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.picker-item .p-name {
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-item .p-sub {
  color: var(--muted);
  font-size: 10px;
}

/* ------------------------------------------------------------------ */
/* Toast                                                               */
/* ------------------------------------------------------------------ */

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  z-index: 80;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #121a26;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  font-size: 13px;
  transform: translateX(-50%);
}

.toast.error {
  border-color: rgba(255, 107, 107, 0.36);
  color: #ffb3b3;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 1180px) {
  .main {
    grid-template-columns: minmax(0, 1fr) 350px;
  }

  .output-strip-body {
    gap: 14px;
  }
}

@media (max-width: 980px) {
  .main {
    grid-template-columns: 1fr;
  }

  .side-pane {
    position: static;
    max-height: none;
  }

  .scene-list {
    max-height: none;
  }

  .screens {
    grid-template-columns: 1fr;
  }

  .top-actions .btn:nth-child(2) {
    display: none;
  }
}

@media (max-width: 720px) {
  .topbar {
    gap: 12px;
    padding: 0 14px;
  }

  .brand-sub,
  .top-status .rev {
    display: none;
  }

  .main {
    padding: 12px;
  }

  .pane {
    padding: 14px;
    border-radius: 14px;
  }

  .pane-head {
    flex-direction: column;
  }

  .pane-actions {
    justify-content: flex-start;
  }

  .output-strip-body {
    flex-direction: column;
    align-items: stretch;
  }

  .output-wall {
    width: 100%;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .drawer {
    width: 100vw;
  }

  .ops-teams {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------------ */
/* Additions                                                           */
/* ------------------------------------------------------------------ */

.no-scroll {
  overflow: hidden;
}

.thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.output-wall.layout-columns {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: minmax(0, 1fr);
}

.output-wall.layout-rows {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: repeat(4, minmax(0, 1fr));
}

.output-wall.layout-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
}

.screen-stage-host {
  z-index: 0;
  pointer-events: none;
}

.output-cell {
  z-index: 0;
  pointer-events: none;
}

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

.ops-btn.active {
  border-color: rgba(245, 179, 1, 0.6);
  background: var(--accent-soft);
  color: #ffd97a;
}

.settings-card .settings-links + .modal-foot {
  margin-top: 4px;
}