:root {
  --bg: #0c1210;
  --bg-elev: #141c18;
  --ink: #e8f0ea;
  --muted: #8fa398;
  --line: #24302a;
  --accent: #d4a017;
  --accent-dim: #8a6a12;
  --ok: #3ecf8e;
  --warn: #e8a54b;
  --danger: #e85d5d;
  --cam-aspect: 4 / 3;
  --font-display: "Syne", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.45;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, #1a3328 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 0%, #2a2410 0%, transparent 50%),
    linear-gradient(180deg, #0e1612 0%, #0c1210 40%, #0a0f0d 100%);
}

.bg-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(rgba(232, 240, 234, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 240, 234, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 75%);
}

.top {
  padding: 1.5rem clamp(1rem, 4vw, 2.5rem) 0.5rem;
}

.brand {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.6rem, 4vw, 2.35rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.tag {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.layout {
  display: grid;
  gap: 1.75rem;
  padding: 1rem clamp(1rem, 4vw, 2.5rem) 2rem;
  max-width: 1180px;
  margin: 0 auto;
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: 1.05fr 0.95fr;
    align-items: start;
  }
}

.stage {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.cam-wrap {
  position: relative;
  aspect-ratio: var(--cam-aspect);
  border-radius: 4px;
  overflow: hidden;
  background: #050807;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

#webcam,
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

#overlay {
  pointer-events: none;
}

.cursor {
  position: absolute;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2px solid #ff3b3b;
  border-radius: 50%;
  pointer-events: none;
  z-index: 3;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  transition: transform 0.05s linear;
}

.cursor::after {
  content: "";
  position: absolute;
  inset: 7px;
  background: #ff3b3b;
  border-radius: 50%;
}

.cursor.clicking {
  transform: scale(0.72);
  border-color: var(--ok);
}

.cursor.clicking::after {
  background: var(--ok);
}

.status {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  z-index: 4;
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
  background: rgba(8, 12, 10, 0.78);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
}

.status.ok {
  color: var(--ok);
}

.status.err {
  color: var(--danger);
}

.gestures {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.gestures li span {
  display: inline-block;
  min-width: 1.1rem;
  margin-right: 0.35rem;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-display);
}

.panel h1 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  letter-spacing: -0.02em;
}

.lede {
  margin: 0 0 1.25rem;
  color: var(--muted);
  max-width: 36ch;
}

.targets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.target {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  padding: 1.1rem 0.85rem;
  text-align: left;
  cursor: pointer;
  border-radius: 3px;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    transform 0.12s ease;
}

.target:hover,
.target:focus-visible {
  outline: none;
  border-color: var(--accent-dim);
}

.target.hit {
  border-color: var(--ok);
  background: #163226;
  transform: scale(0.98);
}

.target.accent {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #1c1810, #241e12);
  border-color: var(--accent-dim);
}

.target.accent.pulse {
  animation: pulse 0.7s ease;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(212, 160, 23, 0.55);
  }
  100% {
    box-shadow: 0 0 0 18px rgba(212, 160, 23, 0);
  }
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin: 1rem 0 1.25rem;
  font-size: 0.92rem;
  color: var(--muted);
}

.meta strong {
  color: var(--ink);
  font-weight: 600;
}

.scroll-block {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.scroll-label {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.scroll-area {
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--line);
  background: #0a100d;
  border-radius: 3px;
  padding: 0.65rem 0.85rem;
  scroll-behavior: smooth;
}

.scroll-area:focus-visible {
  outline: 1px solid var(--accent-dim);
}

.scroll-area ol {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
}

.scroll-area li {
  padding: 0.35rem 0;
  border-bottom: 1px solid rgba(36, 48, 42, 0.7);
}

.scroll-area li:last-child {
  border-bottom: 0;
}

.foot {
  padding: 0 1.5rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.foot a {
  color: var(--accent);
}
