:root {
  color-scheme: dark;
  --bg: #0f1416;
  --surface: #131a1d;
  --panel: rgba(20, 28, 31, 0.9);
  --panel-strong: rgba(25, 35, 39, 0.96);
  --text: #f4f7f7;
  --muted: #aeb8b8;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);
  --accent: #74d9de;
  --accent-strong: #d7b98c;
  --accent-soft: rgba(116, 217, 222, 0.18);
  --ok: #4de8a1;
  --warn: #ffd37c;
  --danger: #ff5b67;
  --blue: #7fb6ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  --radius-xl: 32px;
  --radius-lg: 22px;
  --radius-md: 16px;
  font-family: Inter, Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(116, 217, 222, 0.2), transparent 34rem),
    radial-gradient(circle at 82% 10%, rgba(215, 185, 140, 0.16), transparent 28rem),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    var(--bg);
  background-size: auto, auto, 54px 54px, 54px 54px;
  color: var(--text);
}

body[data-locked="true"] {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  min-height: 48px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(30, 40, 44, 0.96), rgba(18, 25, 28, 0.96));
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.24);
  transition: border-color 140ms ease, background-color 140ms ease, transform 80ms ease, box-shadow 140ms ease;
}

button:hover {
  border-color: rgba(116, 217, 222, 0.5);
  box-shadow:
    inset 0 -2px 0 rgba(0, 0, 0, 0.24),
    0 0 0 1px rgba(116, 217, 222, 0.12);
}

button:active {
  transform: translateY(1px);
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  min-height: 48px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(11, 16, 18, 0.9);
  outline: none;
  backdrop-filter: blur(12px);
}

input:focus {
  border-color: var(--accent);
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  min-height: 46px;
  padding: 0 12px;
  color: var(--text);
  background: rgba(11, 16, 18, 0.9);
  outline: none;
  backdrop-filter: blur(12px);
}

select:focus {
  border-color: var(--accent);
}

.sensitive-field {
  position: relative;
}

.sensitive-field input {
  padding-right: 118px;
}

.reveal-button {
  position: absolute;
  top: 50%;
  right: 8px;
  min-height: 34px;
  padding: 0 12px;
  transform: translateY(-50%);
  border-radius: 999px;
  font-size: 0.72rem;
  line-height: 1;
  white-space: nowrap;
}

.shell {
  width: min(1180px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

.auth-shell {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at top left, rgba(116, 217, 222, 0.16), transparent 28rem),
    radial-gradient(circle at 80% 10%, rgba(215, 185, 140, 0.14), transparent 24rem),
    rgba(7, 10, 11, 0.94);
  backdrop-filter: blur(10px);
}

.auth-shell[hidden] {
  display: none;
}

.auth-card {
  width: min(520px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-xl);
  padding: 28px;
  background: linear-gradient(180deg, rgba(24, 33, 36, 0.96), rgba(11, 17, 19, 0.96));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-lockup {
  margin-bottom: 18px;
}

.auth-copy,
.auth-error {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 700;
}

.auth-copy {
  color: #dfe6da;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.auth-error {
  margin-top: 14px;
  color: #ff8f8f;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(15, 20, 22, 0.82);
  margin-bottom: 16px;
  backdrop-filter: blur(18px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
}

.brand-logo {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 10px 26px rgba(116, 217, 222, 0.16));
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.7rem, 4vw, 3rem);
  line-height: 0.92;
  text-transform: none;
}

h2 {
  font-size: 1rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 132px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(17, 24, 27, 0.88);
  font-weight: 800;
  text-transform: uppercase;
}

.topbar-status {
  display: grid;
  grid-template-columns: auto auto auto auto auto;
  align-items: stretch;
  gap: 10px;
  flex: 0 0 auto;
}

.online-users {
  display: flex;
  align-items: center;
  gap: 5px;
  grid-column: 1 / -1;
  min-width: 0;
  max-width: none;
  padding-left: 8px;
}

.online-users[hidden] {
  display: none;
}

.online-user-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.online-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 125px;
  border: 1px solid rgba(77, 232, 161, 0.3);
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(14, 39, 29, 0.72);
  font-size: 0.7rem;
}

.online-user-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.online-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 9px rgba(77, 232, 161, 0.9);
}

.topbar-bitrate {
  position: relative;
  display: grid;
  align-content: center;
  gap: 3px;
  min-width: 178px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px 9px 34px;
  background: rgba(17, 24, 27, 0.88);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.topbar-bitrate::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: var(--danger);
  box-shadow: 0 0 14px rgba(255, 91, 103, 0.86);
}

.topbar-bitrate span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.topbar-bitrate strong {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 950;
  line-height: 1.05;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar-bitrate[data-state="offline"] {
  border-color: rgba(255, 91, 103, 0.62);
  background: rgba(42, 16, 20, 0.78);
  box-shadow: 0 0 0 1px rgba(255, 91, 103, 0.12);
}

.topbar-bitrate[data-state="offline"] strong {
  color: #ff7580;
  animation: brbPulse 850ms ease-in-out infinite;
}

.topbar-bitrate[data-state="low"] {
  border-color: rgba(255, 211, 124, 0.68);
  background: rgba(44, 34, 14, 0.78);
  box-shadow: 0 0 0 1px rgba(255, 211, 124, 0.12);
}

.topbar-bitrate[data-state="low"]::before {
  background: var(--warn);
  box-shadow: 0 0 14px rgba(255, 211, 124, 0.88);
}

.topbar-bitrate[data-state="low"] strong {
  color: var(--warn);
}

.topbar-bitrate[data-state="ok"] {
  border-color: rgba(77, 232, 161, 0.62);
  background: rgba(14, 39, 29, 0.78);
  box-shadow: 0 0 0 1px rgba(77, 232, 161, 0.12);
}

.topbar-bitrate[data-state="ok"]::before {
  background: var(--ok);
  box-shadow: 0 0 14px rgba(77, 232, 161, 0.88);
}

.topbar-bitrate[data-state="ok"] strong {
  color: var(--ok);
}

@keyframes brbPulse {
  0%,
  100% {
    opacity: 1;
    text-shadow: 0 0 11px rgba(255, 91, 103, 0.72);
  }

  50% {
    opacity: 0.36;
    text-shadow: none;
  }
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 18px currentColor;
}

.status-pill[data-state="connecting"] .dot,
.status-pill[data-state="waiting"] .dot {
  background: var(--warn);
}

.status-pill[data-state="connected"] .dot {
  background: var(--ok);
}

.setup,
.metrics,
.panel-grid {
  display: grid;
  gap: 12px;
}

.module-block,
.module-panel {
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(15, 20, 22, 0.66);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.module-panel {
  margin: 0;
}

.module-panel[data-disabled="true"] {
  opacity: 0.48;
}

.module-panel[data-disabled="true"] .module-summary {
  color: var(--muted);
}

.module-panel[data-disabled="true"] .panel {
  pointer-events: none;
}

.module-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 900;
  text-transform: uppercase;
  user-select: none;
}

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

details:not([open]) > :not(.module-summary) {
  display: none !important;
}

.module-summary::after {
  content: "\f282";
  font-family: "bootstrap-icons";
  font-size: 0.92rem;
  color: var(--accent);
  transition: transform 140ms ease;
}

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

details[data-fixed-open] > .module-summary {
  cursor: default;
  pointer-events: none;
}

details[data-fixed-open] > .module-summary::after {
  display: none;
}

.module-block > .setup,
.module-block > .metrics,
.module-block > .delivery,
.module-block > .controls,
.module-panel > .panel {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.module-block > .delivery {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  border-radius: 0;
}

.setup {
  grid-template-columns: 1.35fr 1fr 0.8fr auto auto;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: rgba(15, 20, 22, 0.78);
  backdrop-filter: blur(18px);
}

.setup-mode {
  grid-column: 1 / -1;
  display: inline-flex;
  gap: 8px;
  margin-bottom: 2px;
}

.mode-chip {
  min-height: 38px;
  min-width: 122px;
  padding: 0 14px;
  font-size: 0.84rem;
  font-weight: 800;
  text-transform: uppercase;
}

.mode-chip[data-active="true"] {
  color: #061012;
  border-color: rgba(116, 217, 222, 0.72);
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
}

.direct-only[hidden] {
  display: none;
}

.backup-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.backup-note {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
  font-weight: 700;
}

.setup-hint {
  margin: -2px 0 14px;
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.92rem;
  font-weight: 600;
}

.setup-hint code {
  color: var(--accent);
}

label span {
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
  text-transform: uppercase;
}

.secondary {
  min-width: 150px;
  border-color: rgba(116, 217, 222, 0.4);
  color: #081315;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  font-weight: 900;
  text-transform: uppercase;
}

.metrics {
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  padding: 0 16px 16px;
  align-items: stretch;
}

.delivery {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgba(116, 217, 222, 0.34);
  border-left: 6px solid var(--accent);
  border-radius: var(--radius-lg);
  margin-bottom: 14px;
  padding: 12px 14px;
  color: #061012;
  background: linear-gradient(135deg, rgba(116, 217, 222, 0.96), rgba(215, 185, 140, 0.96));
  box-shadow: var(--shadow);
}

.delivery strong,
.delivery span {
  display: block;
}

.delivery strong {
  font-size: 0.98rem;
  font-weight: 950;
  text-transform: uppercase;
}

.delivery span {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.9rem;
  font-weight: 800;
  text-align: right;
}

.delivery[data-state="ready"] {
  border-color: rgba(53, 240, 128, 0.55);
  border-left-color: var(--ok);
  color: #031007;
  background: linear-gradient(135deg, #7cf6bf, var(--ok));
}

.metrics article,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(23, 31, 34, 0.94), rgba(12, 18, 20, 0.96));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.metrics article {
  min-height: 84px;
  padding: 11px 12px;
  border-left: 4px solid rgba(116, 217, 222, 0.88);
}

.metrics span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metrics strong {
  display: block;
  overflow: hidden;
  font-size: 0.8rem;
  line-height: 1.1;
  text-transform: uppercase;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.metric-primary,
.metric-secondary {
  display: block;
  width: 100%;
}

.metric-primary {
  font-size: 0.8rem;
  font-weight: 900;
  line-height: 1.05;
}

.metric-secondary {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1.08;
  text-transform: none;
  white-space: pre-line;
}

.metric-relay strong {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  font-size: 0.8rem;
  line-height: 1.1;
}

#networkState,
#djiState,
#relayState {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  text-overflow: clip;
  font-size: 0.72rem;
}

#djiState .metric-primary {
  font-size: 0.74rem;
}

#djiState .metric-secondary {
  font-size: 0.6rem;
}

#bitrateState .metric-secondary {
  margin-top: 8px;
}

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
  padding: 0 16px 16px;
}

.controls-primary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.controls-primary .command {
  min-height: 148px;
  font-size: 1.45rem;
}

.controls-primary .icon {
  width: 64px;
  height: 42px;
}

.controls-primary .icon i {
  font-size: 1.18rem;
}

.controls-primary .command-audio,
.controls-primary .command-stream,
.controls-primary .command-select {
  font-size: 1rem;
}

.controls-primary .audio-select-wrap span {
  font-size: 0.78rem;
}

.srt-priority-editor {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(12, 18, 20, 0.78);
}

.srt-priority-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.srt-priority-head strong {
  font-size: 0.94rem;
  text-transform: uppercase;
}

.srt-priority-head span,
.srt-priority-label span,
.srt-priority-slider span,
.srt-priority-empty {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.srt-priority-list {
  display: grid;
  gap: 8px;
}

.srt-priority-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 64px minmax(170px, 2fr);
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(8, 13, 15, 0.74);
}

.srt-priority-row[data-enabled="false"] {
  opacity: 0.62;
}

.srt-priority-label {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.srt-priority-label strong {
  overflow: hidden;
  font-size: 0.92rem;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.srt-priority-toggle {
  min-height: 36px;
  border-radius: 10px;
  font-size: 0.76rem;
  font-weight: 900;
}

.srt-priority-toggle[data-active="true"] {
  border-color: rgba(77, 232, 161, 0.72);
  background: linear-gradient(180deg, rgba(78, 225, 157, 0.94), rgba(41, 154, 106, 0.94));
  color: #04140d;
}

.srt-priority-slider {
  display: grid;
  gap: 4px;
}

.srt-priority-slider input {
  width: 100%;
  min-height: 28px;
  padding: 0;
}

.controls-extra {
  grid-template-columns: repeat(auto-fit, minmax(124px, 1fr));
}

.command {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  min-height: 116px;
  border-color: rgba(255, 255, 255, 0.12);
  font-size: 1.2rem;
  font-weight: 900;
  text-transform: uppercase;
  background: linear-gradient(180deg, rgba(29, 38, 42, 0.96), rgba(17, 24, 27, 0.98));
}

.command-audio {
  gap: 8px;
  padding: 10px 12px 12px;
}

.command-stream {
  gap: 8px;
  padding: 10px 12px 12px;
}

.command-select {
  gap: 8px;
  padding: 10px 12px 12px;
}

.audio-select-wrap {
  display: grid;
  gap: 6px;
  width: 100%;
}

.audio-select-wrap span {
  display: block;
  margin: 0;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1.05;
  text-transform: uppercase;
  text-align: center;
}

.audio-select-wrap select {
  min-height: 36px;
  padding: 0 10px;
  border-color: rgba(116, 217, 222, 0.28);
  background: rgba(10, 15, 17, 0.96);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: none;
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}

.icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 34px;
  border-radius: 10px;
  color: #071113;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
}

.icon i {
  font-size: 1rem;
  line-height: 1;
}

.command.live {
  border-color: rgba(116, 217, 222, 0.56);
  background:
    linear-gradient(135deg, rgba(116, 217, 222, 0.98), rgba(215, 185, 140, 0.98)),
    var(--accent);
  color: #081315;
}

.command.live .icon {
  color: #f6ffff;
  background: rgba(7, 16, 18, 0.92);
}

.command.live[data-live="true"] {
  animation: live-pulse 1.1s steps(2, end) infinite;
  box-shadow:
    inset 0 -2px 0 rgba(0, 0, 0, 0.25),
    0 0 0 1px rgba(255, 230, 0, 0.18),
    0 0 22px rgba(255, 56, 56, 0.45);
}

.command.live[data-live="true"] .icon {
  animation: live-badge 1.1s steps(2, end) infinite;
}

.command.danger {
  border-color: rgba(255, 91, 103, 0.6);
  background: linear-gradient(180deg, #ff7078, var(--danger));
  color: #170203;
}

@keyframes live-pulse {
  0%,
  49% {
    border-color: rgba(255, 230, 0, 0.82);
    background:
      linear-gradient(180deg, rgba(255, 230, 0, 0.98), rgba(255, 191, 0, 0.98)),
      var(--accent);
    color: #050505;
  }

  50%,
  100% {
    border-color: rgba(255, 76, 76, 0.95);
    background: linear-gradient(180deg, #ff6464, #ff2d2d);
    color: #ffffff;
  }
}

@keyframes live-badge {
  0%,
  49% {
    color: #ffe600;
    background: #050505;
  }

  50%,
  100% {
    color: #fff6f6;
    background: #8a0000;
  }
}

.command.danger .icon {
  color: #ffeef0;
  background: rgba(23, 2, 3, 0.88);
}

.command[data-muted="true"] {
  border-color: rgba(255, 140, 86, 0.75);
  background: linear-gradient(180deg, rgba(255, 178, 120, 0.96), rgba(255, 106, 67, 0.96));
  color: #1d0904;
  animation: mute-pulse 1.4s ease-in-out infinite;
  box-shadow:
    inset 0 -2px 0 rgba(85, 19, 4, 0.26),
    0 0 0 1px rgba(255, 140, 86, 0.14),
    0 0 24px rgba(255, 120, 72, 0.28);
}

.command[data-muted="true"] .icon {
  color: #fff3eb;
  background: rgba(58, 17, 8, 0.92);
  animation: mute-badge 1.4s ease-in-out infinite;
}

.command[data-active="true"] {
  border-color: rgba(77, 232, 161, 0.78);
  background: linear-gradient(180deg, rgba(78, 225, 157, 0.96), rgba(41, 154, 106, 0.96));
  color: #04140d;
  box-shadow:
    inset 0 -2px 0 rgba(3, 43, 25, 0.26),
    0 0 0 1px rgba(77, 232, 161, 0.16),
    0 0 20px rgba(77, 232, 161, 0.24);
}

.command[data-active="true"] .icon {
  color: #eafff5;
  background: rgba(4, 36, 22, 0.92);
}

@keyframes mute-pulse {
  0%,
  100% {
    border-color: rgba(255, 140, 86, 0.75);
    background: linear-gradient(180deg, rgba(255, 178, 120, 0.96), rgba(255, 106, 67, 0.96));
    box-shadow:
      inset 0 -2px 0 rgba(85, 19, 4, 0.26),
      0 0 0 1px rgba(255, 140, 86, 0.14),
      0 0 20px rgba(255, 120, 72, 0.22);
  }

  50% {
    border-color: rgba(255, 196, 140, 0.95);
    background: linear-gradient(180deg, rgba(255, 198, 143, 0.98), rgba(255, 126, 78, 0.98));
    box-shadow:
      inset 0 -2px 0 rgba(85, 19, 4, 0.26),
      0 0 0 1px rgba(255, 171, 116, 0.18),
      0 0 30px rgba(255, 146, 97, 0.34);
  }
}

@keyframes mute-badge {
  0%,
  100% {
    background: rgba(58, 17, 8, 0.92);
  }

  50% {
    background: rgba(109, 35, 14, 0.96);
  }
}

.panel-grid {
  grid-template-columns: 1.05fr 1fr 1fr;
}

.panel {
  padding: 16px;
  position: relative;
  overflow: hidden;
}

.panel[hidden] {
  display: none;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, rgba(116, 217, 222, 0.88), rgba(215, 185, 140, 0.18), transparent);
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  text-transform: uppercase;
}

.panel-inline-actions {
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 12px;
}

.ghost {
  min-height: 36px;
  padding: 0 12px;
  color: var(--accent);
  background: transparent;
  border-color: rgba(116, 217, 222, 0.28);
  font-weight: 800;
}

.icon-ghost {
  width: 42px;
  min-width: 42px;
  padding: 0;
}

.icon-ghost i {
  font-size: 1rem;
  line-height: 1;
}

.ghost.small {
  min-width: 88px;
  min-height: 48px;
}

.scene-list,
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.scene-item {
  position: relative;
  min-width: 0;
}

.scene-item .scene-switch-button {
  position: relative;
  width: 100%;
  padding: 8px 8px 8px 48px;
}

.scene-button-label {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-item .scene-button-edit {
  position: absolute;
  z-index: 2;
  bottom: 8px;
  left: 8px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: var(--accent);
  background: rgba(5, 14, 16, 0.82);
  border: 1px solid rgba(116, 217, 222, 0.32);
  cursor: pointer;
}

.scene-item .scene-button-edit:hover {
  color: #061114;
  background: var(--accent);
}

.preview-panel {
  display: grid;
  gap: 12px;
}

.preview-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px solid rgba(116, 217, 222, 0.22);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(8, 12, 14, 0.88);
}

#previewImage {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.preview-empty {
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  text-align: center;
}

.preview-meta {
  margin: 0;
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
}

.scene-list button,
.quick-grid button {
  min-height: 76px;
  padding: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.scene-list button[data-active="true"] {
  color: #fff4f4;
  border-color: rgba(255, 91, 103, 0.7);
  background: linear-gradient(180deg, #ff7780, #da313f);
  box-shadow:
    inset 0 -2px 0 rgba(86, 0, 0, 0.42),
    0 0 0 1px rgba(255, 86, 86, 0.15);
}

.scene-list button[data-active="true"]:hover {
  border-color: rgba(255, 120, 120, 0.95);
}

.bitrate-grid button {
  background: rgba(116, 217, 222, 0.08);
  border-color: rgba(116, 217, 222, 0.26);
}

.bitrate-grid button[data-active="true"] {
  color: #061114;
  border-color: rgba(116, 217, 222, 0.74);
  background: linear-gradient(135deg, #9fe9ec, #7fb6ff);
  box-shadow:
    inset 0 -2px 0 rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(116, 217, 222, 0.14);
}

.switcher-panel {
  display: grid;
  gap: 12px;
}

.switcher-select-wrap {
  display: grid;
  gap: 6px;
}

.switcher-select-wrap span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.toggle-switcher {
  min-height: 76px;
  border-color: rgba(116, 217, 222, 0.34);
  background: rgba(116, 217, 222, 0.08);
  font-size: 1.1rem;
  font-weight: 900;
  text-transform: uppercase;
}

.toggle-switcher[data-state="on"] {
  color: #031007;
  border-color: rgba(53, 240, 128, 0.6);
  background: linear-gradient(180deg, #4cff93, var(--ok));
}

.toggle-switcher[data-state="off"] {
  color: var(--text);
  background: rgba(255, 56, 56, 0.14);
  border-color: rgba(255, 56, 56, 0.42);
}

.toggle-switcher:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.switcher-name {
  margin: 0;
  color: var(--muted);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
}

.detail-panel {
  display: grid;
  gap: 14px;
}

.detail-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.detail-list div {
  display: grid;
  gap: 6px;
}

.detail-list dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-list dd {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

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

.state-flags {
  gap: 6px;
}

.state-raw-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.state-row {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
}

.state-key,
.state-value {
  min-width: 0;
  line-height: 1.35;
}

.state-key {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  word-break: break-word;
}

.state-value {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.76rem;
  font-weight: 700;
  word-break: break-word;
}

.state-actions {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.state-toggle {
  min-height: 30px;
  min-width: 54px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.state-toggle[data-active="true"] {
  color: #031007;
  border-color: rgba(53, 240, 128, 0.52);
  background: rgba(53, 240, 128, 0.22);
}

.state-toggle[data-tone="off"][data-active="true"] {
  color: #fff4f4;
  border-color: rgba(255, 86, 86, 0.58);
  background: rgba(255, 56, 56, 0.22);
}

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

.device-list {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

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

.device-chip {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 30px;
  border: 1px solid rgba(116, 217, 222, 0.24);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--text);
  background: rgba(116, 217, 222, 0.09);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.backup-list {
  display: grid;
  gap: 10px;
}

.backup-item {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.backup-meta {
  display: grid;
  gap: 4px;
}

.backup-name {
  font-size: 0.82rem;
  font-weight: 900;
  color: var(--text);
  word-break: break-word;
}

.backup-subline {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.backup-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.backup-empty {
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 14px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.dji-device-card {
  display: grid;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(116, 217, 222, 0.18);
  border-radius: 16px;
  background: rgba(116, 217, 222, 0.06);
}

.dji-device-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.dji-device-name {
  font-size: 0.86rem;
  font-weight: 900;
}

.dji-device-battery {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.dji-device-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.dji-device-actions button {
  min-height: 34px;
  padding: 0 8px;
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
}

.dji-device-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.network-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid rgba(127, 182, 255, 0.28);
  border-radius: 999px;
  padding: 0 10px;
  color: #dcecff;
  background: rgba(127, 182, 255, 0.12);
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
}

.state-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid rgba(116, 217, 222, 0.2);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--text);
  background: rgba(116, 217, 222, 0.08);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.state-chip[data-state="on"] {
  color: #031007;
  border-color: rgba(53, 240, 128, 0.48);
  background: rgba(53, 240, 128, 0.22);
}

.state-chip[data-state="off"] {
  border-color: rgba(255, 56, 56, 0.38);
  background: rgba(255, 56, 56, 0.14);
}

#djiList,
#networkList,
#relaySourcesList {
  gap: 6px;
}

input[type="range"] {
  width: 100%;
  min-height: 42px;
  padding: 0;
  accent-color: var(--accent);
  background: transparent;
}

.log-panel,
.log-panel-wrap {
  grid-column: span 3;
}

ol {
  display: grid;
  gap: 8px;
  max-height: 220px;
  margin: 0;
  padding: 0;
  overflow: auto;
  list-style: none;
  color: #cad7d7;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.88rem;
}

#log li,
#auditLog li {
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
}

#auditLog {
  max-height: 440px;
}

.audit-log-title {
  margin-top: 8px;
}

#auditLogStatus {
  color: var(--cyan);
  font-size: 0.78rem;
}

#auditLogStatus[data-error="true"],
#auditLog li[data-outcome="forbidden"],
#auditLog li[data-outcome="upstream_not_ready"],
#auditLog li[data-outcome="no_streamer_connected"] {
  color: #ff9ba5;
}

dialog {
  width: min(420px, calc(100% - 30px));
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0;
  color: var(--text);
  background: rgba(17, 24, 27, 0.96);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

dialog form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 0;
  padding: 0;
}

menu button {
  padding: 0 16px;
}

@media (max-width: 1100px) {
  .topbar {
    flex-wrap: wrap;
  }

  .topbar-status {
    width: 100%;
  }

}

@media (max-width: 820px) {
  .setup,
  .controls,
  .panel-grid {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .controls-primary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .command {
    min-height: 106px;
  }

  .controls-primary .command {
    min-height: 124px;
  }

  .srt-priority-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .srt-priority-toggle {
    width: 100%;
  }

  .log-panel,
  .log-panel-wrap {
    grid-column: auto;
  }

  .delivery {
    align-items: flex-start;
    flex-direction: column;
  }

  .delivery span {
    text-align: left;
  }

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

  .state-row {
    grid-template-columns: 1fr;
  }

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

  .backup-actions {
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    border-radius: var(--radius-lg);
  }

  .topbar-status {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .online-users {
    grid-column: 1;
    width: 100%;
    max-width: none;
  }

  .topbar-bitrate,
  .status-pill {
    width: 100%;
  }

  .brand-lockup {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .controls,
  .scene-list,
  .quick-grid {
    grid-template-columns: 1fr;
  }
}

/* -------------------------------------------------------
   Deutliche Aktiv-Anzeige für Moblin Panel
------------------------------------------------------- */

/* Aktive Szenenbuttons */
#sceneList button {
  position: relative;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, background .15s ease;
}

#sceneList button[data-active="true"] {
  background: linear-gradient(135deg, rgba(0, 255, 170, 0.28), rgba(0, 170, 255, 0.22)) !important;
  border: 2px solid #00ffaa !important;
  box-shadow:
    0 0 0 3px rgba(0, 255, 170, 0.18),
    0 0 18px rgba(0, 255, 170, 0.45) !important;
  color: #ffffff !important;
  font-weight: 900 !important;
  transform: translateY(-1px);
}

#sceneList button[data-active="true"]::after {
  content: "AKTIV";
  position: absolute;
  top: -8px;
  right: -8px;
  padding: 3px 7px;
  border-radius: 999px;
  background: #00ffaa;
  color: #03110c;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .04em;
  box-shadow: 0 0 12px rgba(0, 255, 170, .7);
}

/* Auto Scene Switcher aktiv deutlicher */
#autoSwitcherButton[data-state="on"] {
  background: linear-gradient(135deg, rgba(0, 255, 170, .35), rgba(0, 170, 255, .22)) !important;
  border: 2px solid #00ffaa !important;
  color: #ffffff !important;
  font-weight: 900 !important;
  box-shadow:
    0 0 0 3px rgba(0, 255, 170, .16),
    0 0 18px rgba(0, 255, 170, .38) !important;
}

#autoSwitcherButton[data-state="off"] {
  opacity: .78;
}

/* Dropdown sichtbar markieren, wenn Auto-Switcher aktiv ist */
body[data-auto-switcher-active="true"] #switcherSelect {
  border: 2px solid #00ffaa !important;
  box-shadow: 0 0 0 3px rgba(0, 255, 170, .16) !important;
  font-weight: 800;
}

body[data-auto-switcher-active="true"] #switcherName::before {
  content: "● ";
  color: #00ffaa;
  text-shadow: 0 0 8px rgba(0, 255, 170, .8);
}

/* Status-Kacheln etwas klarer */
#sceneState,
#relayState,
#switcherState,
#bitrateState {
  font-weight: 900;
}

body[data-auto-switcher-active="true"] #switcherState {
  color: #00ffaa;
  text-shadow: 0 0 8px rgba(0, 255, 170, .55);
}

body[data-live="true"] #relayState {
  color: #ff4d6d;
  text-shadow: 0 0 10px rgba(255, 77, 109, .65);
}

[hidden] {
  display: none !important;
}

.quick-nav {
  position: sticky;
  top: max(8px, env(safe-area-inset-top));
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0 20px;
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 16px;
  background: rgba(10, 17, 18, .92);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .25);
  backdrop-filter: blur(16px);
}

body[data-role="moderator"] .quick-nav {
  grid-template-columns: minmax(0, 1fr);
}

body[data-role="observer"] .quick-nav {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

body[data-role="admin"] .quick-nav {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.quick-nav button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 46px;
  padding: 9px 10px;
  border-radius: 11px;
  white-space: nowrap;
}

.quick-nav button[data-active="true"] {
  color: #04110d;
  border-color: #00ffaa;
  background: #00ffaa;
  box-shadow: 0 0 16px rgba(0, 255, 170, .3);
  font-weight: 900;
}

.page-host,
.page-view {
  display: grid;
  gap: 18px;
}

.page-view {
  min-height: 40vh;
  animation: page-enter .18s ease-out;
}

.page-view > details {
  margin: 0;
}

@keyframes page-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.user-pill {
  display: grid;
  gap: 2px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
  text-align: right;
}

.user-pill span {
  color: var(--muted);
  font-size: 12px;
}

.user-form,
.user-card-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.user-form {
  margin: 12px 0 18px;
}

.user-form > button {
  align-self: end;
}

.user-list {
  display: grid;
  gap: 12px;
}

.user-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 14px;
  background: rgba(0, 0, 0, .15);
}

.user-enabled {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}

.user-enabled input {
  width: auto;
}

.danger {
  color: #ff8ca1 !important;
  border-color: rgba(255, 77, 109, .45) !important;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed !important;
  opacity: .42 !important;
}

@media (max-width: 720px) {
  .quick-nav {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }

  .quick-nav::-webkit-scrollbar {
    display: none;
  }

  .quick-nav button {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

  .user-form,
  .user-card-fields {
    grid-template-columns: 1fr;
  }
}
