:root {
  color-scheme: dark;
  --bg: #071019;
  --panel: rgba(8, 16, 26, 0.82);
  --panel-border: rgba(255, 255, 255, 0.1);
  --text: #f3f4f6;
  --muted: #9fb2c8;
  --accent: #ff7a18;
  --accent-alt: #13d7b6;
  --danger: #ff5470;
  --shadow: 0 30px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Avenir Next Condensed", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255, 122, 24, 0.25), transparent 30%),
    radial-gradient(circle at bottom, rgba(19, 215, 182, 0.18), transparent 35%),
    linear-gradient(160deg, #071019 0%, #10213a 45%, #06111b 100%);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 340px;
  min-height: 100vh;
}

.stage {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent 35%),
    rgba(0, 0, 0, 0.35);
}

.camera-feed {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.05) contrast(1.05);
}

.camera-feed.mirrored {
  transform: scaleX(-1);
}

.hidden-canvas {
  display: none;
}

.dance-zone {
  position: absolute;
  left: 50%;
  top: 62%;
  width: 30%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
}

.zone-mask {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  box-shadow: 0 0 0 9999px rgba(3, 8, 14, 0.96);
  pointer-events: none;
}

.zone-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 6px solid rgba(255, 122, 24, 0.95);
  border-radius: 999px;
  box-shadow:
    0 0 0 10px rgba(255, 122, 24, 0.15),
    0 0 30px rgba(255, 122, 24, 0.55),
    inset 0 0 35px rgba(255, 122, 24, 0.2);
  animation: pulse 2s infinite;
}

.zone-label {
  position: absolute;
  left: 50%;
  top: calc(100% + 16px);
  transform: translateX(-50%);
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: rgba(7, 16, 25, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chrome {
  position: absolute;
  left: 24px;
  right: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  z-index: 2;
}

.chrome-top {
  top: 24px;
}

.chrome-bottom {
  bottom: 24px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.brand-block h1,
.brand-block p {
  margin: 0;
}

.eyebrow {
  color: var(--accent-alt);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.8rem;
  margin-bottom: 0.4rem;
}

.brand-block h1 {
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 0.95;
}

.status-badge,
.stat-card,
.hint-panel,
.control-panel,
.overlay-content {
  backdrop-filter: blur(22px);
}

.status-badge {
  padding: 0.85rem 1.1rem;
  border-radius: 999px;
  background: rgba(7, 16, 25, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-weight: 700;
}

.status-badge.idle {
  color: var(--muted);
}

.status-badge.watch {
  color: #ffe082;
}

.status-badge.live {
  color: var(--accent-alt);
}

.status-badge.cooldown {
  color: #9ad1ff;
}

.stat-card {
  min-width: 120px;
  padding: 1rem 1.1rem;
  border-radius: 22px;
  background: rgba(7, 16, 25, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
}

.stat-card-wide {
  min-width: 220px;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 0.45rem;
}

.stat-card strong {
  font-size: 1.6rem;
}

.hint-panel {
  position: absolute;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 1rem 1.1rem;
  border-radius: 22px;
  background: rgba(7, 16, 25, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.12);
  z-index: 2;
}

.hint-panel p {
  margin: 0 0 0.6rem;
  color: var(--muted);
}

.hint-panel p:last-child {
  margin-bottom: 0;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  background: rgba(4, 11, 19, 0.88);
  border-left: 1px solid var(--panel-border);
}

.panel-block {
  padding: 18px;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
}

.panel-block h2 {
  margin-top: 0;
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

.panel-block label {
  display: block;
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toggle-label input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
}

.panel-block span {
  display: block;
  margin-top: 0.35rem;
  color: var(--text);
  font-weight: 700;
}

.debug-readout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 0.5rem;
}

.debug-item {
  padding: 0.8rem;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.debug-label {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.debug-item strong {
  font-size: 1.1rem;
}

input[type="range"] {
  width: 100%;
  margin-top: 0.5rem;
  accent-color: var(--accent);
}

.camera-select {
  width: 100%;
  margin-top: 0.5rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 0.8rem 0.9rem;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

button {
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 0.95rem 1rem;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button + button {
  margin-top: 0.75rem;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent) 0%, #ffd24d 100%);
  color: #071019;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.danger-button {
  color: #ffd2db;
}

.trigger-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 250ms ease, visibility 250ms ease;
  z-index: 3;
}

.trigger-overlay.active {
  opacity: 1;
  visibility: visible;
}

.overlay-grid {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.04) 0,
      rgba(255, 255, 255, 0.04) 1px,
      transparent 1px,
      transparent 40px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.04) 0,
      rgba(255, 255, 255, 0.04) 1px,
      transparent 1px,
      transparent 40px
    ),
    radial-gradient(circle, rgba(255, 122, 24, 0.48), rgba(19, 215, 182, 0.22), rgba(7, 16, 25, 0.9));
  animation: shimmer 4s linear infinite;
}

.overlay-content {
  position: relative;
  width: min(720px, calc(100% - 48px));
  padding: 3rem;
  text-align: center;
  border-radius: 32px;
  background: rgba(7, 16, 25, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
}

.overlay-kicker {
  margin: 0 0 0.75rem;
  color: #ffe082;
  text-transform: uppercase;
  letter-spacing: 0.22em;
}

.overlay-content h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 0.9;
}

.overlay-content p {
  margin: 0;
  color: #d7e3f0;
  font-size: 1.1rem;
}

body.kiosk-mode .control-panel {
  display: none;
}

body.kiosk-mode .app-shell {
  grid-template-columns: 1fr;
}

body.kiosk-mode .hint-panel {
  opacity: 0;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.03);
  }
}

@keyframes shimmer {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2%);
  }
  100% {
    transform: translateY(0);
  }
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .control-panel {
    border-left: 0;
    border-top: 1px solid var(--panel-border);
  }
}
