:root {
  --bg: #0a0c10;
  --panel: #11141b;
  --line: #232936;
  --txt: #dfe7f3;
  --dim: #8b94a7;
  --accent: #a78bfa;
  --accent2: #4ade80;
  --gold: #fbbf24;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--txt);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
  min-height: 100vh;
}
.topbar {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(10,12,16,.92);
  backdrop-filter: blur(8px);
  z-index: 10;
}
.brand { font-weight: 800; letter-spacing: 2px; font-size: 20px; }
.brand::first-letter { color: var(--gold); }
.tagline { color: var(--dim); font-size: 14px; letter-spacing: 1px; }
main { max-width: 980px; margin: 0 auto; padding: 24px 20px 60px; }
.hero { text-align: center; margin: 28px 0 20px; }
.hero h1 { font-size: clamp(28px, 5vw, 44px); letter-spacing: -1px; }
.hero .sub { color: var(--dim); margin-top: 10px; max-width: 640px; margin-left: auto; margin-right: auto; }
.controls { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.btn {
  background: var(--panel);
  color: var(--txt);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 15px;
  cursor: pointer;
  transition: all .15s;
}
.btn:hover:not(:disabled) { border-color: var(--accent); transform: translateY(-1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: #0a0c10; font-weight: 700; border-color: var(--accent); }
.btn.toggle.on { border-color: var(--accent2); color: var(--accent2); }
.status {
  margin-top: 16px;
  padding: 12px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: inline-block;
  font-size: 14px;
  color: var(--dim);
}
.stage-wrap { margin: 24px 0; }
.stage {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
  aspect-ratio: 16/9;
  max-height: 560px;
}
.stage video, .stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.diag {
  position: absolute;
  bottom: 12px;
  left: 14px;
  display: flex;
  gap: 10px;
  font-size: 13px;
  background: rgba(0,0,0,.65);
  padding: 6px 12px;
  border-radius: 8px;
}
.diag .ok { color: var(--accent2); }
.diag .bad { color: #f87171; }
.fps {
  position: absolute;
  top: 12px;
  right: 14px;
  background: rgba(0,0,0,.6);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--accent2);
  font-variant-numeric: tabular-nums;
}
.gesture-badge {
  position: absolute;
  top: 12px;
  left: 14px;
  background: rgba(10,12,16,.82);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 10px 16px;
  text-align: center;
  box-shadow: 0 0 24px rgba(167,139,250,.35);
  transition: opacity .2s;
}
.gesture-badge.hidden { opacity: 0; pointer-events: none; }
.badge-emoji { font-size: 38px; line-height: 1; }
.badge-name { font-weight: 700; margin-top: 4px; }
.badge-conf { color: var(--accent2); font-size: 14px; font-weight: 700; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 24px;
}
.panel h2 { font-size: 15px; letter-spacing: 2px; text-transform: uppercase; color: var(--dim); margin: 14px 0 10px; }
.panel h2:first-child { margin-top: 0; }
.current { font-size: 18px; min-height: 40px; }
.current .cur-emoji { font-size: 30px; vertical-align: middle; }
.current .none, .history .none { color: var(--dim); }
.history { display: flex; flex-wrap: wrap; gap: 8px; }
.hitem {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 14px;
}
.hitem small { color: var(--dim); }
.grid-section { margin: 32px 0; }
.grid-section h2, .how h2 { font-size: 20px; margin-bottom: 16px; }
.gesture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.gcard {
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 14px;
  padding: 16px 10px;
  text-align: center;
  transition: all .15s;
}
.gcard .g-emoji { font-size: 36px; }
.gcard .g-name { font-size: 13px; color: var(--dim); margin-top: 6px; }
.gcard .g-conf { font-size: 13px; color: var(--accent2); font-weight: 700; min-height: 20px; }
.gcard.active {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(167,139,250,.4);
  transform: scale(1.04);
}
.gcard.active .g-name { color: var(--txt); }
.how {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
}
.how ol, .how ul { margin: 0 0 20px 22px; }
.how li { margin-bottom: 8px; color: var(--dim); }
.how li b, .how p b { color: var(--txt); }
.how p { color: var(--dim); }
footer {
  text-align: center;
  padding: 28px 20px;
  border-top: 1px solid var(--line);
  color: var(--dim);
  font-size: 14px;
}
.foot-links { margin-top: 8px; }
.foot-links a { color: var(--accent); text-decoration: none; }
@media (max-width: 640px) {
  .gesture-grid { grid-template-columns: repeat(3, 1fr); }
  .topbar { padding: 12px 16px; }
}
