:root {
  --background: 160 10% 4%;
  --foreground: 0 0% 95%;
  --card: 160 8% 8%;
  --card-foreground: 0 0% 95%;
  --primary: 82 85% 55%;
  --primary-foreground: 160 10% 4%;
  --secondary: 160 8% 14%;
  --secondary-foreground: 0 0% 85%;
  --muted: 160 6% 12%;
  --muted-foreground: 160 5% 50%;
  --accent: 174 72% 46%;
  --destructive: 0 84.2% 60.2%;
  --border: 160 8% 16%;
  --radius: 0.75rem;
  --font-display: "Space Grotesk", sans-serif;
  --font-body: Inter, sans-serif;
  --gradient-hero: linear-gradient(135deg, hsl(82 85% 55% / 0.15), hsl(174 72% 46% / 0.08), transparent);
  --gradient-glow: radial-gradient(ellipse at center, hsl(82 85% 55% / 0.12), transparent 70%);
  --gradient-card: linear-gradient(160deg, hsl(160 8% 12%), hsl(160 8% 6%));
  --shadow-neon: 0 0 40px hsl(82 85% 55% / 0.15), 0 0 80px hsl(82 85% 55% / 0.05);
  --shadow-card: 0 8px 32px hsl(0 0% 0% / 0.4);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  border-color: hsl(var(--border));
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  margin: 0;
  line-height: 1.15;
}

p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.muted {
  color: hsl(var(--muted-foreground));
}

.text-gradient {
  background-image: linear-gradient(135deg, hsl(82 85% 55%), hsl(174 72% 56%));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.bg-hero-gradient { background: var(--gradient-hero); }
.bg-glow { background: var(--gradient-glow); }
.bg-card-gradient { background: var(--gradient-card); }
.shadow-neon { box-shadow: var(--shadow-neon); }
.shadow-card { box-shadow: var(--shadow-card); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  border-radius: 0.75rem;
  padding: 0.85rem 2rem;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn--primary {
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
}

.btn--primary:hover:not(:disabled) {
  box-shadow: var(--shadow-neon);
  transform: scale(1.02);
}

.btn--secondary {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border-color: hsl(var(--border));
}

.btn--secondary:hover:not(:disabled) {
  border-color: hsl(var(--primary) / 0.4);
}

.btn--sm {
  min-height: 2.25rem;
  padding: 0.5rem 1.25rem;
  border-radius: 0.5rem;
}

.btn--block {
  width: 100%;
}

/* Nav */
.nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  border-bottom: 1px solid hsl(var(--border) / 0.5);
  background: hsl(var(--background) / 0.8);
  backdrop-filter: blur(20px);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 4rem;
}

.nav__brand {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: hsl(var(--primary));
}

.nav__links {
  display: none;
  align-items: center;
  gap: 2rem;
}

.nav__link {
  font-size: 0.875rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  transition: color 0.2s ease;
}

.nav__link:hover,
.nav__link.is-active {
  color: hsl(var(--primary));
}

.nav__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  background: transparent;
  color: hsl(var(--foreground));
  cursor: pointer;
}

.nav__toggle-bars,
.nav__toggle-bars::before,
.nav__toggle-bars::after {
  display: block;
  width: 1.25rem;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav__toggle-bars::before,
.nav__toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav__toggle-bars::before { top: -6px; }
.nav__toggle-bars::after { top: 6px; }

.nav.is-open .nav__toggle-bars {
  background: transparent;
}

.nav.is-open .nav__toggle-bars::before {
  top: 0;
  transform: rotate(45deg);
}

.nav.is-open .nav__toggle-bars::after {
  top: 0;
  transform: rotate(-45deg);
}

.nav__mobile {
  border-top: 1px solid hsl(var(--border) / 0.5);
  background: hsl(var(--background) / 0.95);
  backdrop-filter: blur(20px);
}

.nav__mobile[hidden] {
  display: none;
}

.nav__mobile-inner {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
}

@media (min-width: 768px) {
  .nav__links { display: flex; }
  .nav__toggle { display: none; }
  .nav__mobile { display: none !important; }
}

/* Footer */
.site-footer {
  border-top: 1px solid hsl(var(--border) / 0.5);
  background: hsl(var(--card) / 0.5);
}

.footer-grid {
  display: grid;
  gap: 2rem;
  padding: 3rem 0;
}

.footer-blurb {
  margin-top: 0.75rem;
  max-width: 18rem;
  font-size: 0.875rem;
  line-height: 1.6;
}

.footer-heading {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.footer-links a {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: hsl(var(--primary));
}

.footer-copy {
  border-top: 1px solid hsl(var(--border) / 0.5);
  padding: 1.5rem 0;
  text-align: center;
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

@media (min-width: 768px) {
  .footer-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Motion */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }

.hero-enter {
  animation: fade-up 0.6s ease both;
}

.hero-enter-1 { animation-delay: 0.05s; }
.hero-enter-2 { animation-delay: 0.15s; }
.hero-enter-3 { animation-delay: 0.25s; }
.hero-enter-4 { animation-delay: 0.35s; }

.animate-pulse-glow {
  animation: pulse-glow 3s ease-in-out infinite;
}

/* Home */
.hero {
  position: relative;
  overflow: hidden;
  padding-top: 4rem;
}

.hero__glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 800px;
  height: 800px;
  transform: translate(-50%, -50%);
  opacity: 0.4;
  pointer-events: none;
}

.hero__grid {
  display: grid;
  gap: 3rem;
  align-items: center;
  padding: 6rem 0;
}

.eyebrow {
  display: inline-block;
  border: 1px solid hsl(var(--primary) / 0.3);
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
  border-radius: 999px;
  padding: 0.35rem 1rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.04em;
}

.hero h1 {
  font-size: clamp(2.75rem, 7vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.hero__copy {
  font-size: 1.125rem;
  max-width: 28rem;
  line-height: 1.7;
  color: hsl(var(--muted-foreground));
}

.hero__actions,
.cta__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.hero__media {
  position: relative;
}

.hero__media::before,
.feature-media::before {
  content: "";
  position: absolute;
  inset: -1rem;
  border-radius: 1.5rem;
  background: hsl(var(--primary) / 0.05);
  filter: blur(24px);
}

.hero__media img,
.feature-media img {
  position: relative;
  width: 100%;
  border-radius: 1rem;
  box-shadow: var(--shadow-card);
  object-fit: cover;
}

.hero__media img {
  aspect-ratio: 16 / 10;
  border-radius: 1rem;
}

.feature-media img {
  aspect-ratio: 1;
}

.section {
  padding: 6rem 0;
}

.section--border {
  border-top: 1px solid hsl(var(--border) / 0.5);
}

.section-head {
  text-align: center;
  margin-bottom: 4rem;
}

.section-head h2 {
  font-size: clamp(1.875rem, 4vw, 3rem);
  font-weight: 700;
}

.section-head p {
  margin: 1rem auto 0;
  max-width: 28rem;
  color: hsl(var(--muted-foreground));
}

.feature-row {
  display: grid;
  gap: 3rem;
  align-items: center;
  margin-bottom: 5rem;
}

.feature-row:last-child {
  margin-bottom: 0;
}

.feature-copy {
  display: grid;
  gap: 1.25rem;
}

.icon-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  background: hsl(var(--primary) / 0.1);
  color: hsl(var(--primary));
}

.icon-box--sm {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.5rem;
  margin-bottom: 1.25rem;
}

.feature-copy h3 {
  font-size: clamp(1.5rem, 3vw, 1.875rem);
  font-weight: 700;
}

.feature-copy p {
  max-width: 28rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.7;
}

.highlights {
  display: grid;
  gap: 2rem;
  max-width: 48rem;
  margin-inline: auto;
}

.highlight-card {
  border-radius: 1rem;
  border: 1px solid hsl(var(--border) / 0.5);
  background: var(--gradient-card);
  box-shadow: var(--shadow-card);
  padding: 2rem;
  transition: border-color 0.2s ease;
}

.highlight-card:hover {
  border-color: hsl(var(--primary) / 0.3);
}

.highlight-card h4 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.highlight-card p {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.6;
}

.cta-panel {
  position: relative;
  overflow: hidden;
  border-radius: 1.5rem;
  border: 1px solid hsl(var(--border) / 0.5);
  background: var(--gradient-card);
  text-align: center;
  padding: 5rem 2rem;
}

.cta-panel__glow {
  position: absolute;
  inset: 0;
  opacity: 0.3;
  pointer-events: none;
}

.cta-panel h2 {
  position: relative;
  font-size: clamp(1.875rem, 4vw, 3rem);
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.cta-panel p {
  position: relative;
  max-width: 28rem;
  margin: 0 auto 2rem;
  color: hsl(var(--muted-foreground));
}

.cta__actions {
  position: relative;
  justify-content: center;
}

@media (min-width: 768px) {
  .hero__grid {
    grid-template-columns: 1fr 1fr;
    padding: 9rem 0;
  }

  .feature-row {
    grid-template-columns: 1fr 1fr;
  }

  .feature-row--reverse .feature-copy {
    order: 2;
  }

  .feature-row--reverse .feature-media {
    order: 1;
  }

  .highlights {
    grid-template-columns: 1fr 1fr;
  }
}

/* Legal / support pages */
.page {
  padding: 6rem 0 4rem;
}

.page__narrow {
  max-width: 48rem;
}

.page h1 {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.page__meta {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  margin-bottom: 2.5rem;
}

.prose {
  display: grid;
  gap: 2rem;
}

.prose h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.prose h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.prose p,
.prose li {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.7;
}

.prose strong {
  color: hsl(var(--foreground));
  font-weight: 600;
}

.prose a {
  color: hsl(var(--primary));
}

.prose a:hover {
  text-decoration: underline;
}

.prose ul {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.5rem;
}

.support-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 4rem;
}

.support-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  border-radius: 0.75rem;
  border: 1px solid hsl(var(--border) / 0.5);
  background: var(--gradient-card);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
  transition: border-color 0.2s ease;
}

a.support-card:hover {
  border-color: hsl(var(--primary) / 0.3);
}

.support-card h3 {
  font-size: 0.875rem;
  font-weight: 600;
}

.support-card p {
  font-size: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.faq-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.faq-head h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.faq-list {
  display: grid;
  gap: 1rem;
}

.faq-item {
  border-radius: 0.75rem;
  border: 1px solid hsl(var(--border) / 0.5);
  background: hsl(var(--card) / 0.5);
  padding: 1.5rem;
}

.faq-item h3 {
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.faq-item p {
  font-size: 0.875rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.7;
}

@media (min-width: 640px) {
  .support-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* Play page */
.play-page {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.play-panel {
  width: 100%;
  max-width: 28rem;
  text-align: center;
}

.play-brand {
  margin-bottom: 0.75rem;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: hsl(var(--primary));
}

.play-panel h1 {
  font-size: 1.875rem;
  font-weight: 700;
}

.play-panel .lead {
  margin-top: 1rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.7;
}

.play-input {
  margin-top: 2rem;
  width: 100%;
  border-radius: 0.75rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: hsl(var(--foreground));
  padding: 1.25rem 1rem;
  text-align: center;
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 600;
  letter-spacing: 0.4em;
  outline: none;
}

.play-input:focus {
  border-color: hsl(var(--primary));
}

.play-error {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: hsl(var(--destructive));
}

.play-panel .btn {
  margin-top: 1.5rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 1.25rem;
  height: 1.25rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon--lg {
  width: 1.5rem;
  height: 1.5rem;
}

/* Web games lobby / phone controller */
.games-panel {
  max-width: 40rem;
}

.game-grid {
  display: grid;
  gap: 0.75rem;
  margin-top: 1.75rem;
  text-align: left;
}

.game-card {
  display: grid;
  gap: 0.35rem;
  width: 100%;
  padding: 1rem 1.1rem;
  border-radius: 0.9rem;
  border: 1px solid hsl(var(--border));
  background: hsl(var(--card));
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.game-card:hover {
  border-color: hsl(var(--primary) / 0.55);
  transform: translateY(-1px);
}

.game-card__title {
  font-family: var(--font-display);
  font-weight: 600;
  color: hsl(var(--primary));
}

.game-card__blurb {
  font-size: 0.9rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.45;
}

.games-solo-note {
  margin-top: 1.25rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.games-solo-note a {
  color: hsl(var(--accent));
  text-decoration: underline;
}

.games-panel--pair {
  max-width: 44rem;
}

.pair-layout {
  margin-top: 1.5rem;
  display: grid;
  gap: 1.5rem;
  justify-items: center;
}

@media (min-width: 720px) {
  .pair-layout {
    grid-template-columns: auto 1fr;
    align-items: center;
    text-align: left;
  }
}

.qr-wrap {
  display: grid;
  gap: 0.65rem;
  justify-items: center;
}

.qr-box {
  width: 240px;
  height: 240px;
  border-radius: 1rem;
  background: #f4f7f5;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 12px;
  border: 1px solid hsl(var(--border));
  box-shadow: 0 10px 30px hsl(0 0% 0% / 0.25);
}

.qr-box img,
.qr-box canvas,
.qr-box table,
.qr-box svg {
  display: block;
  width: 216px !important;
  height: 216px !important;
  max-width: 100%;
}

.qr-caption {
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
}

.qr-missing {
  margin: 0;
  padding: 12px;
  text-align: center;
  color: #0b0c1a;
  font: 600 13px/1.4 var(--font-body);
}

.pair-game {
  font-family: var(--font-display);
  font-weight: 600;
  color: hsl(var(--primary));
}

.pair-or {
  margin-top: 0.85rem;
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
}

.pair-code {
  margin-top: 0.25rem;
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: 0.28em;
}

.pair-link {
  margin-top: 0.35rem;
  font-size: 0.85rem;
}

.pair-link a {
  color: hsl(var(--accent));
  text-decoration: underline;
}

.pair-status {
  margin-top: 0.75rem;
  color: hsl(var(--muted-foreground));
}

.pair-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.controller-panel {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #07080f;
  color: #f4f7f5;
}

.controller-top {
  padding: max(0.85rem, env(safe-area-inset-top)) 1rem 0.5rem;
  text-align: center;
}

.controller-game {
  font-family: var(--font-display);
  font-weight: 600;
  color: #33e6b0;
}

.tracker-status {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  color: rgba(244, 247, 245, 0.65);
}

.controller-stage {
  position: relative;
  flex: 1;
  margin: 0.5rem 0.75rem;
  border-radius: 1rem;
  overflow: hidden;
  background: #10131f;
  border: 1px solid rgba(51, 230, 176, 0.25);
}

.controller-stage video,
.controller-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.controller-stage canvas {
  transform: none;
  pointer-events: none;
}

.pose-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(7, 8, 15, 0.72);
  backdrop-filter: blur(6px);
  transition: opacity 0.25s ease;
}

.pose-loading.is-done {
  opacity: 0;
  pointer-events: none;
}

.pose-loading.is-dim {
  background: rgba(7, 8, 15, 0.35);
  backdrop-filter: blur(2px);
}

.pose-loading.is-dim .pose-loading__card {
  transform: scale(0.96);
  opacity: 0.95;
}

.pose-loading__card {
  width: min(22rem, 100%);
  text-align: center;
}

.pose-loading__title {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #33e6b0;
}

.pose-loading__msg {
  margin-top: 0.55rem;
  font-size: 0.92rem;
  color: rgba(244, 247, 245, 0.82);
  min-height: 1.35em;
}

.pose-loading__bar {
  margin: 1rem auto 0;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.pose-loading__bar span {
  display: block;
  height: 100%;
  width: 4%;
  border-radius: inherit;
  background: linear-gradient(90deg, #33e6b0, #2ec4b6);
  transition: width 0.2s ease;
}

.pose-loading__note {
  margin-top: 0.7rem;
  font-size: 0.75rem;
  color: rgba(244, 247, 245, 0.5);
}

.controller-hint {
  padding: 0.75rem 1rem max(1rem, env(safe-area-inset-bottom));
  text-align: center;
  color: rgba(244, 247, 245, 0.7);
  font-size: 0.9rem;
}

.touch-fallback {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 1rem;
  background: linear-gradient(to top, rgba(7, 8, 15, 0.85), transparent 55%);
}

.touch-pad {
  display: grid;
  grid-template-columns: repeat(3, minmax(4.5rem, 1fr));
  gap: 0.55rem;
  width: min(22rem, 100%);
}

.touch-pad button {
  border: 1px solid rgba(51, 230, 176, 0.35);
  background: rgba(11, 12, 26, 0.9);
  color: #33e6b0;
  border-radius: 0.85rem;
  padding: 0.9rem 0.5rem;
  font-weight: 700;
}

.touch-pad button[data-act="action"] {
  grid-column: 2;
}

.touch-pad button[data-act="up"] {
  grid-column: 2;
}

.touch-pad button[data-act="down"] {
  grid-column: 2;
}
