:root {
  --bg-a: #090b1a;
  --bg-b: #121633;
  --ink: #eff3ff;
  --card: #161a38;
  --accent: #ff4da6;
  --good: #38f2c7;
  --bad: #ff5a76;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  overflow: hidden;
  background:
    radial-gradient(circle at 16% 12%, #294d9f 0%, transparent 33%),
    radial-gradient(circle at 85% 82%, #822cae 0%, transparent 34%),
    radial-gradient(circle at 55% 18%, rgba(52, 219, 255, 0.16) 0%, transparent 30%),
    linear-gradient(130deg, var(--bg-a), var(--bg-b));
}

.app-shell {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
}

.hud-panel {
  position: absolute;
  z-index: 6;
  background: color-mix(in srgb, var(--card) 84%, transparent);
  border: 1px solid color-mix(in srgb, #8dd4ff 48%, transparent);
  border-radius: 16px;
  backdrop-filter: blur(8px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.35);
  animation: slide-in 480ms ease-out;
}

.top-bar {
  position: absolute;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: min(820px, calc(100% - 1.5rem));
  padding: 0.75rem 1rem;
}

.noun-center {
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 1.5rem));
  padding: 1.1rem 1.2rem 0.95rem;
  text-align: center;
}

.label {
  margin: 0;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.7;
}

#word {
  margin: 0.3rem 0 0;
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: 0.03em;
  font-size: clamp(2.1rem, 6vw, 4.2rem);
}

.stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.15rem;
  font-size: 0.9rem;
  opacity: 0.9;
}

.mode-toggle input {
  width: 1rem;
  height: 1rem;
  accent-color: #5ea8ff;
}

.mode-group {
  margin-top: 0.15rem;
}

.mode-group-label {
  margin: 0;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.82;
}

.mode-choice {
  margin-top: 0.4rem;
  display: inline-flex;
  gap: 0.34rem;
  background: rgba(11, 16, 37, 0.72);
  border: 1px solid rgba(150, 199, 255, 0.3);
  border-radius: 999px;
  padding: 0.2rem;
}

.mode-chip {
  position: relative;
}

.mode-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-chip span {
  display: inline-block;
  min-width: 86px;
  text-align: center;
  border-radius: 999px;
  padding: 0.34rem 0.72rem;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #dbe6ff;
  cursor: pointer;
}

.mode-chip input:checked + span {
  background: linear-gradient(120deg, #62dbff, #8e74ff);
  color: #0f1430;
}

.onboarding-link-wrap {
  margin: 0.46rem 0 0;
}

.onboarding-link {
  color: #97d9ff;
  font-size: 0.86rem;
  text-decoration: none;
  border-bottom: 1px solid rgba(151, 217, 255, 0.5);
}

.onboarding-link:hover {
  color: #cfeeff;
}

.control-hint {
  margin: 0.38rem 0 0;
  font-size: 0.86rem;
  opacity: 0.82;
}

.feedback {
  min-height: 1.4rem;
  margin: 0.55rem 0 0;
  font-weight: 600;
}

.primary-btn {
  text-decoration: none;
  border-radius: 10px;
  padding: 0.56rem 0.86rem;
  font-weight: 700;
  border: 0;
  background: linear-gradient(120deg, #44d7ff, #e45fff);
  color: #0f1327;
}

.gesture-status {
  margin: 0.18rem 0 0;
  font-size: 0.88rem;
  opacity: 0.82;
}

.debug-panel {
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  width: min(340px, calc(100% - 1.5rem));
  padding: 0.72rem 0.9rem;
  z-index: 9;
  animation: none;
}

.debug-title {
  margin: 0;
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.74;
}

.hidden {
  display: none;
}

.settings-btn {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid rgba(158, 206, 255, 0.45);
  background: color-mix(in srgb, #1d2750 82%, transparent);
  color: #e9f0ff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
  display: grid;
  place-items: center;
  z-index: 11;
  cursor: pointer;
}

.settings-btn:hover {
  border-color: rgba(207, 233, 255, 0.72);
}

.settings-btn svg {
  display: none;
}

.settings-btn span {
  font-size: 1.45rem;
  line-height: 1;
}

.settings-panel {
  left: 1rem;
  bottom: 4.4rem;
  width: min(360px, calc(100% - 1.5rem));
  padding: 0.85rem 0.95rem;
  z-index: 10;
}

.settings-title {
  margin: 0 0 0.25rem;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.74;
}

.settings-panel .control-hint {
  margin: 0.32rem 0 0.42rem;
}

.scene-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(70, 170, 255, 0.22), transparent 38%),
    radial-gradient(circle at 80% 82%, rgba(255, 70, 198, 0.18), transparent 36%),
    linear-gradient(180deg, rgba(7, 10, 23, 0.9), rgba(13, 14, 33, 0.94));
}

#three-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.cursor {
  position: fixed;
  width: 24px;
  height: 24px;
  margin-left: -12px;
  margin-top: -12px;
  border-radius: 999px;
  border: 2px solid #f6e4ff;
  background: rgba(201, 147, 255, 0.34);
  box-shadow: 0 0 0 10px rgba(138, 222, 255, 0.2);
  pointer-events: none;
  transition: transform 80ms linear;
  z-index: 30;
}

.cursor.hidden {
  opacity: 0;
}

.video-feed {
  position: fixed;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.tracking-feed {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: 160px;
  height: 120px;
  border-radius: 12px;
  border: 1px solid rgba(210, 173, 255, 0.44);
  background: rgba(7, 11, 25, 0.8);
  z-index: 7;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
}

.run-summary {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(4, 7, 18, 0.68);
  display: grid;
  place-items: center;
  padding: 1rem;
}

.run-summary.hidden {
  display: none;
}

.run-summary-card {
  width: min(480px, 100%);
  background: color-mix(in srgb, #1a2148 90%, transparent);
  border: 1px solid rgba(162, 211, 255, 0.42);
  border-radius: 18px;
  padding: 1.1rem 1.1rem 1rem;
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.42);
  text-align: center;
}

.run-summary-label {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  opacity: 0.78;
}

.run-summary-title {
  margin: 0.3rem 0 0.45rem;
  font-family: "Bebas Neue", sans-serif;
  letter-spacing: 0.04em;
  font-size: clamp(2rem, 5vw, 2.8rem);
}

.run-summary-stat {
  margin: 0.24rem 0;
  font-size: 1.05rem;
}

.run-summary-best {
  margin: 0.5rem 0 0;
  color: #bbe3ff;
  font-weight: 700;
}

.run-summary-btn {
  margin-top: 0.82rem;
  min-width: 180px;
  cursor: pointer;
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .top-bar {
    top: 0.6rem;
    width: calc(100% - 0.8rem);
    padding: 0.65rem 0.8rem;
  }

  .noun-center {
    top: 16%;
    width: calc(100% - 0.8rem);
    padding: 0.9rem 0.85rem;
  }

  .video-feed {
    width: 120px;
    bottom: 0.6rem;
    right: 0.6rem;
  }

  .settings-btn {
    left: 0.6rem;
    bottom: 0.6rem;
  }

  .settings-panel {
    left: 0.6rem;
    bottom: 4rem;
    width: min(340px, calc(100% - 0.8rem));
  }

  .debug-panel {
    left: 50%;
    bottom: 0.6rem;
    transform: translateX(-50%);
    width: min(340px, calc(100% - 0.8rem));
  }
}
