:root {
  color-scheme: dark;
  --bg: #02040a;
  --panel: rgba(5, 9, 20, 0.78);
  --panel-strong: rgba(5, 9, 20, 0.92);
  --line: rgba(255, 255, 255, 0.16);
  --line-strong: rgba(124, 244, 255, 0.38);
  --text: rgba(255, 255, 255, 0.93);
  --muted: rgba(220, 235, 255, 0.62);
  --accent: #7cf4ff;
  --accent-2: #d977ff;
  --warn: #ffbf69;
  --ok: #7cffb2;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
}

body {
  color: var(--text);
}

#stage,
#webcam {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
}

#stage {
  z-index: 0;
  background: radial-gradient(circle at 50% 50%, #10172b 0%, #02040a 68%);
}

#webcam {
  z-index: -1;
  opacity: 0;
  pointer-events: none;
  object-fit: cover;
  transform: scaleX(-1);
}

.stage-glass,
.scanline {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.stage-glass {
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.58), inset 0 0 0 1px rgba(124, 244, 255, 0.05);
}

.scanline {
  opacity: 0.08;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0, rgba(255, 255, 255, 0.035) 1px, transparent 1px, transparent 5px);
  mix-blend-mode: screen;
}

.control-panel {
  position: fixed;
  left: 24px;
  top: 24px;
  width: min(430px, calc(100vw - 48px));
  z-index: 10;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(124, 244, 255, 0.08), rgba(217, 119, 255, 0.04)),
    var(--panel);
  backdrop-filter: blur(8px) saturate(112%);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: transform 220ms ease, opacity 220ms ease;
}

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

.eyebrow {
  margin: 0 0 7px;
  color: var(--accent);
  letter-spacing: 0.2em;
  font-size: 11px;
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: 25px;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.subtitle {
  margin: 8px 0 0;
  color: rgba(220, 235, 255, 0.58);
  font-size: 12px;
  line-height: 1.45;
}

.pose-dot {
  width: 13px;
  height: 13px;
  margin-top: 4px;
  border-radius: 999px;
  display: inline-block;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.055);
  flex: 0 0 auto;
}

.pose-dot.active {
  background: var(--ok);
  box-shadow: 0 0 0 7px rgba(124, 255, 178, 0.12), 0 0 28px rgba(124, 255, 178, 0.8);
}

.pose-dot.warn {
  background: var(--warn);
  box-shadow: 0 0 0 7px rgba(255, 191, 105, 0.1), 0 0 24px rgba(255, 191, 105, 0.65);
}

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

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

select,
button {
  width: 100%;
  min-height: 39px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text);
  background: rgba(255, 255, 255, 0.075);
  outline: none;
  font: inherit;
}

select {
  padding: 0 34px 0 12px;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(255, 255, 255, 0.82) 50%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.82) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 18px,
    calc(100% - 13px) 18px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

button {
  cursor: pointer;
  padding: 0 12px;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: rgba(124, 244, 255, 0.62);
  background: rgba(255, 255, 255, 0.12);
}

button:active {
  transform: translateY(0);
}

button.primary {
  background: linear-gradient(135deg, rgba(124, 244, 255, 0.95), rgba(217, 119, 255, 0.92));
  border-color: transparent;
  color: #06101a;
  font-weight: 850;
}

button[aria-pressed="true"] {
  border-color: rgba(124, 244, 255, 0.72);
  background: rgba(124, 244, 255, 0.14);
}

button:disabled,
select:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

.button-row {
  display: grid;
  grid-template-columns: 1.2fr 0.68fr 0.68fr 0.68fr 0.82fr;
  gap: 8px;
  margin-top: 12px;
}

.status {
  margin: 14px 0 0;
  min-height: 36px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.live-hud {
  position: fixed;
  right: 24px;
  top: 24px;
  z-index: 8;
  display: flex;
  gap: 10px;
  pointer-events: none;
  transition: transform 220ms ease, opacity 220ms ease;
}

.hud-card {
  min-width: 68px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 16px;
  background: rgba(2, 6, 14, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.hud-card span {
  display: block;
  color: rgba(220, 235, 255, 0.54);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hud-card strong {
  display: block;
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.94);
  font-size: 17px;
  line-height: 1;
}

.energy-panel {
  position: fixed;
  left: 24px;
  bottom: 22px;
  z-index: 8;
  width: 245px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  pointer-events: none;
  transition: transform 220ms ease, opacity 220ms ease;
}

.energy-panel i {
  --energy: 0.04;
  display: block;
  height: 5px;
  margin-top: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.energy-panel i::before {
  content: "";
  display: block;
  width: calc(var(--energy) * 100%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 22px rgba(124, 244, 255, 0.8);
  transition: width 120ms linear;
}

.stage-caption {
  position: fixed;
  right: 24px;
  bottom: 22px;
  z-index: 8;
  display: flex;
  gap: 14px;
  align-items: center;
  color: rgba(255, 255, 255, 0.54);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  transition: transform 220ms ease, opacity 220ms ease;
}

.stage-caption span + span {
  text-transform: none;
  letter-spacing: 0.04em;
}

body.ui-hidden .control-panel {
  transform: translateX(calc(-100% - 28px));
  opacity: 0;
  pointer-events: none;
}

body.ui-hidden .live-hud {
  transform: translateY(-24px);
  opacity: 0.25;
}

body.ui-hidden .energy-panel,
body.ui-hidden .stage-caption {
  transform: translateY(18px);
  opacity: 0.12;
}

@media (max-width: 880px) {
  .live-hud {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 80px;
    justify-content: flex-end;
  }

  .energy-panel {
    display: none;
  }
}

@media (max-width: 760px) {
  .control-panel {
    left: 12px;
    top: 12px;
    width: calc(100vw - 24px);
    padding: 14px;
  }

  .control-grid,
  .button-row {
    grid-template-columns: 1fr 1fr;
  }

  .stage-caption {
    right: 14px;
    bottom: 12px;
    left: 14px;
    justify-content: space-between;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .control-grid,
  .button-row {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 21px;
  }

  .live-hud {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
