:root {
  color-scheme: dark;
  --bg: #070b0d;
  --panel: rgba(13, 21, 24, 0.84);
  --text: #f3f7f8;
  --muted: #a9b7bc;
  --line: rgba(118, 219, 202, 0.28);
  --accent: #67d3c0;
  --accent-strong: #91efd9;
  --warn: #ffba77;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

button {
  font: inherit;
}

.demo-shell {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 8px;
  height: 100vh;
  min-height: 100vh;
  padding: 8px;
  background:
    radial-gradient(circle at 76% 18%, rgba(103, 211, 192, 0.14), transparent 28%),
    linear-gradient(135deg, #071012 0%, #0e171a 58%, #080b0c 100%);
}

.stage {
  display: grid;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #050607;
}

.camera-frame {
  position: relative;
  align-self: center;
  justify-self: center;
  width: min(100%, calc((100vh - 220px) * var(--camera-ratio, 1.7778)));
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: var(--camera-aspect, 16 / 9);
  overflow: hidden;
  border-radius: 8px;
  background: #050607;
}

video,
.tracking-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

video {
  object-fit: contain;
  opacity: 0;
}

.tracking-canvas {
  background: #050607;
  pointer-events: auto;
  touch-action: none;
}

.demo-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(12px);
}

.instruction-card {
  display: grid;
  grid-template-columns: minmax(12rem, 0.8fr) minmax(0, 1.7fr);
  gap: 12px;
  align-items: center;
}

.instruction-lede {
  display: grid;
  gap: 4px;
}

.instruction-card h2,
.instruction-card p,
.gesture-map,
.gesture-map dd,
.status {
  margin: 0;
}

.instruction-card h2 {
  font-size: clamp(1rem, 2vw, 1.22rem);
  line-height: 1.1;
}

.instruction-card p {
  color: rgba(243, 247, 248, 0.82);
  font-size: 0.94rem;
  line-height: 1.35;
}

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

.gesture-map div {
  min-height: 4.25rem;
  padding: 8px 10px;
  border: 1px solid rgba(103, 211, 192, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.035);
}

.gesture-map dt {
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 780;
  letter-spacing: 0;
  text-transform: uppercase;
}

.gesture-map dd {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.24;
}

#cameraToggle {
  min-width: 9.25rem;
  min-height: 42px;
  padding: 0 1rem;
  border: 1px solid rgba(103, 211, 192, 0.55);
  border-radius: 6px;
  color: #06100e;
  background: var(--accent);
  cursor: pointer;
  font-weight: 740;
  transition: transform 140ms ease, background 140ms ease;
}

#cameraToggle:hover {
  transform: translateY(-1px);
  background: var(--accent-strong);
}

#cameraToggle[aria-pressed="true"] {
  color: var(--text);
  background: rgba(103, 211, 192, 0.16);
}

.status {
  display: none;
}

.status.is-warning {
  display: block;
  color: var(--warn);
  font-size: 0.88rem;
  line-height: 1.35;
}

.hidden-control {
  display: none;
}

@media (max-width: 700px) {
  .demo-shell {
    height: auto;
    min-height: 100vh;
    padding: 6px;
  }

  .stage {
    min-height: 50vh;
  }

  .camera-frame {
    width: 100%;
  }

  .demo-controls,
  .instruction-card,
  .gesture-map {
    grid-template-columns: 1fr;
  }
}
