:root {
  --bg: #06080f;
  --panel: rgba(14, 19, 30, 0.72);
  --panel-solid: #0d121d;
  --line: rgba(148, 163, 184, 0.12);
  --line-strong: rgba(148, 163, 184, 0.2);
  --text: #eef3ff;
  --muted: #8b96ab;
  --dim: #596477;
  --accent: #67e8f9;
  --accent-rgb: 103, 232, 249;
  --font-display: "Bahnschrift", "Segoe UI Variable Display", "Segoe UI", sans-serif;
  --font-body: "Segoe UI Variable Text", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--text);
  background:
    radial-gradient(120% 90% at 50% -10%, #111a2d 0%, #080b14 48%, var(--bg) 100%);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

::selection {
  color: #041018;
  background: var(--accent);
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.5;
  animation: orbDrift 18s ease-in-out infinite alternate;
}

.orb-a {
  top: -20vh;
  left: 8vw;
  width: 38vw;
  height: 38vw;
  background: rgba(54, 103, 214, 0.18);
}

.orb-b {
  right: -6vw;
  top: 12vh;
  width: 30vw;
  height: 30vw;
  background: rgba(122, 74, 214, 0.13);
  animation-delay: -7s;
}

.orb-c {
  bottom: -22vh;
  left: 26vw;
  width: 42vw;
  height: 30vw;
  background: rgba(23, 167, 178, 0.09);
  animation-delay: -13s;
}

.grid {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  background-image:
    linear-gradient(rgba(137, 161, 199, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(137, 161, 199, 0.045) 1px, transparent 1px);
  background-size: 68px 68px;
  mask-image: radial-gradient(ellipse 85% 72% at 50% 42%, #000 10%, transparent 78%);
}

.noise {
  position: absolute;
  inset: -20%;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 220 220' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.78' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
  animation: noiseShift 0.7s steps(2) infinite;
}

@keyframes orbDrift {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to { transform: translate3d(4%, 3%, 0) scale(1.08); }
}

@keyframes noiseShift {
  0% { transform: translate(0, 0); }
  50% { transform: translate(1.2%, -0.8%); }
  100% { transform: translate(-0.6%, 1%); }
}

.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 1640px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 32px 20px;
}

/* ---------- top bar ---------- */

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  min-height: 52px;
  animation: fadeDown 0.65s 0.05s both cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  color: var(--accent);
  place-items: center;
  filter: drop-shadow(0 0 14px rgba(var(--accent-rgb), 0.1));
  transition: color 0.5s ease;
}

.brand-mark svg {
  width: 100%;
  height: 100%;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.brand-copy b {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: 0.22em;
}

.brand-copy > span {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.25em;
}

.brand-copy i {
  color: var(--dim);
  font-style: normal;
}

.top-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #a9b4c8;
  font-size: 10.5px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  white-space: nowrap;
}

.live-dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5d697d;
  box-shadow: 0 0 0 3px rgba(93, 105, 125, 0.12);
  transition: background 0.3s, box-shadow 0.3s;
}

.live-dot.is-live {
  background: #5ef2c2;
  box-shadow: 0 0 0 3px rgba(94, 242, 194, 0.12), 0 0 12px rgba(94, 242, 194, 0.65);
  animation: livePulse 2s ease-in-out infinite;
}

.live-dot.is-error {
  background: #ffb454;
  box-shadow: 0 0 0 3px rgba(255, 180, 84, 0.14);
}

@keyframes livePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.top-divider {
  width: 1px;
  height: 13px;
  margin: 0 3px;
  background: var(--line-strong);
}

.top-clock {
  color: var(--dim);
  font-size: 9.5px;
  letter-spacing: 0.06em;
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.api-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 27px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #79859a;
  background: rgba(255, 255, 255, 0.018);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.09em;
  white-space: nowrap;
}

.api-chip > span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #5ef2c2;
}

.ghost-chip > span {
  background: #ffb454;
}

.ghost-chip.has-ghosts {
  color: #f5c173;
  border-color: rgba(255, 180, 84, 0.3);
  background: rgba(255, 180, 84, 0.06);
}

/* ---------- layout / panels ---------- */

.layout {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) 378px;
  gap: 16px;
  min-height: 0;
}

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 26px;
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.026), transparent 38%),
    var(--panel);
  box-shadow:
    0 26px 70px rgba(0, 0, 0, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(22px);
}

.stage {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  padding: 22px 26px 14px;
  animation: riseIn 0.75s 0.12s both cubic-bezier(0.2, 0.7, 0.2, 1);
}

.stage::after {
  position: absolute;
  right: -10%;
  bottom: -55%;
  width: 70%;
  height: 80%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.065), transparent 65%);
  content: "";
  pointer-events: none;
  transition: background 0.6s ease;
}

.stage-head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.23em;
}

.eyebrow i {
  width: 17px;
  height: 1px;
  background: var(--accent);
  box-shadow: 0 0 7px rgba(var(--accent-rgb), 0.7);
  transition: background 0.4s;
}

.stage-title h1 {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(19px, 2vw, 27px);
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.08em;
}

.stage-title h1 #stagePlayer {
  color: var(--accent);
  text-shadow: 0 0 26px rgba(var(--accent-rgb), 0.23);
  transition: color 0.45s, text-shadow 0.45s;
}

.stage-title h1 em {
  color: var(--dim);
  font-style: normal;
  font-weight: 300;
}

.stage-title h1 .muted-title {
  color: #6c7890;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.17em;
}

.stage-metrics {
  display: flex;
  align-items: center;
  gap: 19px;
  padding-bottom: 1px;
}

.metric {
  display: flex;
  align-items: baseline;
  gap: 5px;
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.13em;
}

.metric b {
  color: #dce4f5;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
}

.metric small {
  color: var(--dim);
  font-size: 7px;
}

.signal-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 14px;
  margin-left: 2px;
}

.signal-bars i {
  display: block;
  width: 3px;
  height: 4px;
  border-radius: 1px;
  background: #4f5a6e;
  transition: background 0.25s, height 0.25s;
}

.signal-bars i:nth-child(2) { height: 6px; }
.signal-bars i:nth-child(3) { height: 9px; }
.signal-bars i:nth-child(4) { height: 12px; }

.signal-bars.is-live i {
  background: var(--accent);
  box-shadow: 0 0 5px rgba(var(--accent-rgb), 0.25);
}

.signal-bars.is-live i:nth-child(1) { opacity: 0.4; }
.signal-bars.is-live i:nth-child(2) { opacity: 0.6; }
.signal-bars.is-live i:nth-child(3) { opacity: 0.8; }

/* ---------- controller stage ---------- */

.controller-stage {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 6px 24px 4px;
}

.stage-aura {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(720px, 75%);
  height: 62%;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(var(--accent-rgb), 0.17), rgba(var(--accent-rgb), 0.03) 48%, transparent 70%);
  filter: blur(40px);
  opacity: 0.7;
  transform: translate(-50%, -48%);
  transition: background 0.55s;
  animation: auraBreath 6s ease-in-out infinite;
}

@keyframes auraBreath {
  0%, 100% { opacity: 0.52; transform: translate(-50%, -48%) scale(0.95); }
  50% { opacity: 0.82; transform: translate(-50%, -48%) scale(1.05); }
}

.stage-axis {
  position: absolute;
  z-index: 0;
  background: linear-gradient(90deg, transparent, rgba(152, 172, 205, 0.1), transparent);
}

.axis-x {
  top: 50%;
  left: 3%;
  width: 94%;
  height: 1px;
}

.axis-y {
  top: 7%;
  left: 50%;
  width: 1px;
  height: 86%;
  background: linear-gradient(180deg, transparent, rgba(152, 172, 205, 0.08), transparent);
}

.crosshair {
  position: absolute;
  z-index: 1;
  width: 11px;
  height: 11px;
  opacity: 0.32;
}

.crosshair::before,
.crosshair::after {
  position: absolute;
  background: #8fa0ba;
  content: "";
}

.crosshair::before {
  top: 5px;
  left: 0;
  width: 11px;
  height: 1px;
}

.crosshair::after {
  top: 0;
  left: 5px;
  width: 1px;
  height: 11px;
}

.ch-tl { top: 38px; left: 34px; }
.ch-br { right: 34px; bottom: 24px; }

.float-label {
  position: absolute;
  z-index: 2;
  top: 31%;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--dim);
  background: rgba(8, 11, 18, 0.62);
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.1em;
  backdrop-filter: blur(8px);
}

.float-label b {
  color: #d8e2f5;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.label-left { left: 3.2%; }
.label-right { right: 3.2%; }

.controller-wrap {
  position: relative;
  z-index: 2;
  width: min(100%, 880px);
  transform-origin: 50% 54%;
  transition: opacity 0.5s ease, filter 0.5s ease;
  animation: controllerFloat 7s ease-in-out infinite;
}

@keyframes controllerFloat {
  0%, 100% { transform: translateY(0) rotate(-0.15deg); }
  50% { transform: translateY(-7px) rotate(0.15deg); }
}

.controller-wrap.is-idle {
  opacity: 0.56;
  filter: saturate(0.4) brightness(0.88);
}

.controller-wrap.is-live {
  filter: drop-shadow(0 18px 48px rgba(0, 0, 0, 0.24));
}

.controller-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.ground-shadow {
  transition: opacity 0.5s;
}

.is-idle .ground-shadow {
  opacity: 0.18;
}

.stick-readout {
  position: absolute;
  z-index: 2;
  bottom: 3.5%;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 92px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(7, 10, 16, 0.52);
  backdrop-filter: blur(8px);
}

.readout-left { left: 2%; }
.readout-right { right: 2%; }

.readout-label {
  color: var(--dim);
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.14em;
}

.stick-readout b {
  display: flex;
  gap: 4px;
  color: #c3cfe4;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.stick-readout i {
  color: #485369;
  font-style: normal;
}

.empty-state {
  position: absolute;
  z-index: 3;
  bottom: 0;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 15px 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  background: rgba(9, 12, 20, 0.86);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
  transition: opacity 0.35s, transform 0.35s;
  white-space: nowrap;
}

.empty-state.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
}

.radar {
  position: relative;
  display: grid;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(var(--accent-rgb), 0.25);
  border-radius: 50%;
  place-items: center;
}

.radar::before,
.radar::after {
  position: absolute;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 50%;
  content: "";
  animation: radarRing 2.4s ease-out infinite;
}

.radar::before { width: 34px; height: 34px; }
.radar::after { width: 24px; height: 24px; animation-delay: 0.8s; }

.radar i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

@keyframes radarRing {
  from { opacity: 0.75; transform: scale(0.55); }
  to { opacity: 0; transform: scale(1.5); }
}

.empty-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.empty-copy b {
  color: #dbe4f4;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.empty-copy small {
  color: #6f7b91;
  font-size: 8.5px;
}

.stage-foot {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 36px;
  margin-top: 3px;
  padding-top: 11px;
  border-top: 1px solid rgba(148, 163, 184, 0.09);
}

.input-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.input-chip,
.chip-placeholder {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 21px;
  padding: 0 8px;
  border: 1px solid rgba(var(--chip-rgb, 139, 150, 171), 0.25);
  border-radius: 5px;
  color: rgb(var(--chip-rgb, 139, 150, 171));
  background: rgba(var(--chip-rgb, 139, 150, 171), 0.07);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.08em;
  animation: chipIn 0.18s ease-out both;
}

.input-chip i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 5px currentColor;
}

.chip-placeholder {
  color: var(--dim);
  border-color: var(--line);
  background: transparent;
}

@keyframes chipIn {
  from { opacity: 0; transform: translateY(4px) scale(0.94); }
  to { opacity: 1; transform: none; }
}

.stage-hint {
  flex: 0 0 auto;
  color: #596477;
  font-size: 8.5px;
  letter-spacing: 0.04em;
}

/* ---------- controller visual state ---------- */

.press-scale {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.075s ease, filter 0.14s ease;
}

.press-scale.is-pressed {
  filter: brightness(1.55) drop-shadow(0 0 7px var(--accent));
  transform: scale(0.88);
}

.trigger-cap {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.07s ease, filter 0.12s ease;
}

.trigger-cap.is-pressed {
  filter: brightness(1.25) drop-shadow(0 0 7px rgba(var(--accent-rgb), 0.35));
  transform: translateY(7px) scale(0.985);
}

.touchpad-btn.is-pressed {
  filter: brightness(1.4) drop-shadow(0 0 12px rgba(var(--accent-rgb), 0.45));
}

.touchpad-btn.is-pressed rect:first-child {
  stroke: rgba(var(--accent-rgb), 0.55);
}

.dpad-key.is-pressed path:first-child {
  fill: #353e51;
}

.shoulder-key.is-pressed path:first-child {
  fill: #2b3241;
}

.face-btn.is-pressed circle {
  stroke: rgba(var(--accent-rgb), 0.55);
}

.ps-btn.is-pressed text {
  fill: #ffffff;
  filter: drop-shadow(0 0 5px var(--accent));
}

.mute-btn.is-pressed path {
  stroke: var(--accent);
}

.stick-cap.is-pressed {
  filter: brightness(1.25) drop-shadow(0 0 8px rgba(var(--accent-rgb), 0.3));
}

.lightbar-group {
  transition: opacity 0.3s;
  animation: lightbarBreathe 3.2s ease-in-out infinite;
}

.is-idle .lightbar-group {
  opacity: 0.35;
  animation: none;
}

@keyframes lightbarBreathe {
  0%, 100% { opacity: 0.82; }
  50% { opacity: 1; }
}

/* ---------- side deck ---------- */

.deck {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  animation: riseIn 0.8s 0.2s both cubic-bezier(0.2, 0.7, 0.2, 1);
}

.devices-panel {
  padding: 18px 17px 15px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.panel-head h2 {
  margin: 0;
  color: #a6b2c7;
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 0.17em;
}

.counter {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #738097;
  background: rgba(255, 255, 255, 0.02);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.device-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.device-slot {
  --slot-color: #8a96ab;
  --slot-rgb: 138, 150, 171;
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 46px;
  gap: 11px;
  align-items: center;
  width: 100%;
  min-height: 66px;
  padding: 10px 12px 10px 11px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.095);
  border-radius: 15px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.022);
  text-align: left;
  transition: border-color 0.25s, background 0.25s, transform 0.2s, opacity 0.25s;
}

.device-slot[data-state="empty"] {
  border-style: dashed;
  opacity: 0.55;
  background: transparent;
}

.device-slot[data-state="offline"] {
  border-color: rgba(255, 180, 84, 0.2);
  background: rgba(255, 180, 84, 0.035);
}

.device-slot[data-state="connected"] {
  cursor: pointer;
}

.device-slot[data-state="connected"]:hover {
  border-color: rgba(var(--slot-rgb), 0.32);
  background: rgba(var(--slot-rgb), 0.045);
  transform: translateY(-1px);
}

.device-slot[data-state="connected"].active {
  border-color: rgba(var(--slot-rgb), 0.46);
  background:
    linear-gradient(90deg, rgba(var(--slot-rgb), 0.115), rgba(var(--slot-rgb), 0.02) 64%, transparent);
  box-shadow:
    inset 0 0 28px rgba(var(--slot-rgb), 0.035),
    0 0 0 1px rgba(var(--slot-rgb), 0.05);
}

.device-slot.active::before {
  position: absolute;
  top: 15px;
  bottom: 15px;
  left: 0;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--slot-color);
  box-shadow: 0 0 12px var(--slot-color);
  content: "";
}

.slot-badge {
  display: grid;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(var(--slot-rgb), 0.23);
  border-radius: 12px;
  color: var(--slot-color);
  background: rgba(var(--slot-rgb), 0.08);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.03em;
  place-items: center;
  transition: background 0.25s, box-shadow 0.25s;
}

.active .slot-badge {
  background: rgba(var(--slot-rgb), 0.13);
  box-shadow: 0 0 17px rgba(var(--slot-rgb), 0.15), inset 0 0 9px rgba(var(--slot-rgb), 0.08);
}

.slot-main {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.slot-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.slot-player {
  color: var(--slot-color);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.13em;
}

.slot-status {
  color: #5c687d;
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.1em;
}

.slot-status.is-now {
  color: #54d9b0;
}

.slot-status.is-lost {
  color: #e3a859;
}

.slot-name {
  overflow: hidden;
  color: #d6deee;
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-slot[data-state="empty"] .slot-name {
  color: #667287;
  font-weight: 400;
}

.slot-meta {
  overflow: hidden;
  color: #5f6b80;
  font-family: var(--font-mono);
  font-size: 7.5px;
  letter-spacing: 0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slot-visual {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--slot-color);
}

.slot-controller-icon {
  width: 42px;
  height: 28px;
  opacity: 0.36;
  transition: opacity 0.25s, filter 0.25s;
}

.active .slot-controller-icon {
  opacity: 0.9;
  filter: drop-shadow(0 0 6px rgba(var(--slot-rgb), 0.45));
}

.slot-empty-icon {
  display: grid;
  width: 23px;
  height: 23px;
  border: 1px dashed #465165;
  border-radius: 7px;
  color: #566276;
  font-size: 13px;
  font-weight: 300;
  place-items: center;
}

.slot-signal {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 15px;
}

.slot-signal i {
  width: 2px;
  height: 4px;
  border-radius: 1px;
  background: currentColor;
  opacity: 0.32;
}

.slot-signal i:nth-child(2) { height: 7px; }
.slot-signal i:nth-child(3) { height: 10px; }
.slot-signal i:nth-child(4) { height: 14px; }

.slot-signal.is-live i {
  opacity: 0.9;
  animation: signalTick 1.5s ease-in-out infinite;
}

.slot-signal.is-live i:nth-child(2) { animation-delay: 0.16s; }
.slot-signal.is-live i:nth-child(3) { animation-delay: 0.32s; }
.slot-signal.is-live i:nth-child(4) { animation-delay: 0.48s; }

@keyframes signalTick {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

.slot-signal.is-lost {
  color: #ffb454;
}

.ghost-guard {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  padding: 9px 10px;
  border: 1px solid rgba(148, 163, 184, 0.09);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.018);
  transition: border-color 0.25s, background 0.25s;
}

.ghost-guard.has-ghosts {
  border-color: rgba(255, 180, 84, 0.22);
  background: rgba(255, 180, 84, 0.035);
}

.guard-icon {
  display: grid;
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  color: #6f7d94;
  background: rgba(255, 255, 255, 0.035);
  place-items: center;
}

.ghost-guard.has-ghosts .guard-icon {
  color: #ffb454;
  background: rgba(255, 180, 84, 0.08);
}

.guard-icon svg {
  width: 14px;
  height: 14px;
}

.guard-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.guard-copy b {
  color: #8996aa;
  font-family: var(--font-mono);
  font-size: 6.5px;
  font-weight: 500;
  letter-spacing: 0.13em;
}

.guard-copy small {
  overflow: hidden;
  color: #5d697e;
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.guard-count {
  display: grid;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  color: #69768c;
  background: rgba(255, 255, 255, 0.035);
  font-family: var(--font-mono);
  font-size: 8px;
  place-items: center;
}

.ghost-guard.has-ghosts .guard-count {
  color: #ffca7a;
  background: rgba(255, 180, 84, 0.1);
}

/* ---------- input stream ---------- */

.stream-panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 220px;
  padding: 18px 17px 12px;
  overflow: hidden;
}

.clear-btn {
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #69768b;
  background: transparent;
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.11em;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.clear-btn:hover {
  color: var(--accent);
  border-color: rgba(var(--accent-rgb), 0.3);
}

.log-list {
  position: relative;
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 120px;
  overflow: hidden;
  border-top: 1px solid rgba(148, 163, 184, 0.08);
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.log-empty-state {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #4f5b6e;
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.13em;
  text-align: center;
}

.log-empty-state i {
  width: 26px;
  height: 1px;
  background: #343d4e;
}

.log-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 9px 2px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.055);
  animation: logIn 0.2s ease-out both;
}

.log-item:last-child {
  border-bottom: 0;
}

.log-player {
  display: grid;
  height: 18px;
  border: 1px solid rgba(var(--log-rgb), 0.25);
  border-radius: 4px;
  color: rgb(var(--log-rgb));
  background: rgba(var(--log-rgb), 0.07);
  font-family: var(--font-mono);
  font-size: 6.5px;
  place-items: center;
}

.log-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.log-main b {
  overflow: hidden;
  color: #d4deef;
  font-family: var(--font-mono);
  font-size: 8.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-main small {
  color: #5c687d;
  font-size: 7.5px;
  letter-spacing: 0.02em;
}

.log-time {
  color: #586479;
  font-family: var(--font-mono);
  font-size: 7px;
  font-variant-numeric: tabular-nums;
}

@keyframes logIn {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: none; }
}

.stream-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  padding-top: 10px;
  color: #5b677b;
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.12em;
}

.stream-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #4b5669;
}

.stream-dot.is-live {
  background: #5ef2c2;
  box-shadow: 0 0 7px rgba(94, 242, 194, 0.65);
}

.stream-foot .mono {
  color: #4e5a6d;
}

/* ---------- diagnostics ---------- */

.diagnostics {
  display: grid;
  grid-template-columns: repeat(4, minmax(128px, 0.7fr)) minmax(260px, 1.3fr);
  gap: 16px;
  align-items: center;
  padding: 11px 17px;
  border: 1px solid rgba(148, 163, 184, 0.085);
  border-radius: 15px;
  background: rgba(10, 14, 22, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(15px);
  animation: fadeUp 0.7s 0.32s both;
}

.diag-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding-left: 12px;
  border-left: 1px solid rgba(148, 163, 184, 0.1);
}

.diag-cell:first-child {
  padding-left: 0;
  border-left: 0;
}

.diag-cell span {
  color: #596579;
  font-family: var(--font-mono);
  font-size: 6.5px;
  letter-spacing: 0.12em;
}

.diag-cell b {
  overflow: hidden;
  color: #aab6c9;
  font-size: 9px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diag-hint {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  color: #566275;
  font-size: 8px;
  letter-spacing: 0.015em;
  text-align: right;
}

.diag-key {
  padding: 2px 4px;
  border: 1px solid rgba(148, 163, 184, 0.13);
  border-radius: 3px;
  color: #717e94;
  font-family: var(--font-mono);
  font-size: 6px;
}

/* ---------- motion ---------- */

@keyframes riseIn {
  from { opacity: 0; transform: translateY(18px) scale(0.99); }
  to { opacity: 1; transform: none; }
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ---------- responsive ---------- */

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

  .stage {
    padding-right: 18px;
    padding-left: 20px;
  }

  .controller-stage {
    padding-right: 12px;
    padding-left: 12px;
  }

  .float-label {
    display: none;
  }

  .stick-readout {
    min-width: 78px;
    padding: 6px 8px;
  }
}

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

  .deck {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .controller-stage {
    min-height: 470px;
  }

  .controller-wrap {
    width: min(100%, 760px);
  }

  .diagnostics {
    grid-template-columns: repeat(4, 1fr);
  }

  .diag-hint {
    display: none;
  }
}

@media (max-width: 760px) {
  .app {
    gap: 12px;
    padding: 14px 13px 16px;
  }

  .topbar {
    grid-template-columns: 1fr auto;
  }

  .top-status {
    display: none;
  }

  .top-actions {
    gap: 5px;
  }

  .ghost-chip {
    display: none;
  }

  .layout,
  .deck {
    gap: 12px;
  }

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

  .stage {
    padding: 17px 13px 10px;
    border-radius: 22px;
  }

  .stage-head {
    align-items: center;
  }

  .stage-title h1 {
    font-size: 18px;
  }

  .stage-title h1 .muted-title {
    display: none;
  }

  .stage-metrics {
    gap: 11px;
  }

  .metric:first-child {
    display: none;
  }

  .controller-stage {
    min-height: 350px;
    padding: 8px 0 0;
  }

  .stage-axis,
  .crosshair {
    display: none;
  }

  .stick-readout {
    bottom: 0;
    min-width: 65px;
    padding: 5px 6px;
  }

  .readout-label {
    font-size: 5.5px;
  }

  .stick-readout b {
    font-size: 7.5px;
  }

  .empty-state {
    bottom: 4px;
  }

  .empty-copy small {
    display: none;
  }

  .stage-foot {
    min-height: 30px;
    padding-top: 8px;
  }

  .stage-hint {
    display: none;
  }

  .devices-panel,
  .stream-panel {
    padding: 15px 12px 12px;
    border-radius: 20px;
  }

  .stream-panel {
    min-height: 200px;
  }

  .diagnostics {
    grid-template-columns: repeat(2, 1fr);
    gap: 11px 14px;
    padding: 11px 13px;
  }

  .diag-cell:nth-child(3) {
    padding-left: 0;
    border-left: 0;
  }

  .diag-cell:nth-child(n + 3) {
    border-top: 1px solid rgba(148, 163, 184, 0.08);
    padding-top: 8px;
  }
}

@media (max-width: 430px) {
  .brand-copy > span {
    font-size: 7.5px;
  }

  .api-chip {
    padding: 0 8px;
    font-size: 7px;
  }

  .controller-stage {
    min-height: 292px;
  }

  .float-label {
    display: none;
  }

  .empty-state {
    padding: 7px 12px 7px 8px;
  }

  .slot-name {
    font-size: 10.5px;
  }

  .device-slot {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    gap: 9px;
    padding-right: 9px;
  }

  .slot-badge {
    width: 38px;
    height: 38px;
  }

  .slot-controller-icon {
    width: 36px;
  }
}
