:root {
  --bg: #0b1020;
  --surface: #121934;
  --text: #f4f6fb;
  --muted: #c7cbe0;
  --brand: #6ee7ff;
  --brand-strong: #1fb6ff;
  --focus: #fff06e;
  --ok: #59d37f;
  --warn: #ffa726;
  --error: #ff5252;
  --shadow: 0 20px 50px rgba(0,0,0,.35);
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --font-size: 18px;
  --heading-scale: 1;
}

/* Responsive scaling for larger screens */
@media (min-width: 768px) {
  :root {
    --font-size: 20px;
    --heading-scale: 1.4;
  }
}

@media (min-width: 1024px) {
  :root {
    --heading-scale: 1.75;
  }
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #0b1020;
    --muted: #42506b;
    --brand: #0077ff;
    --brand-strong: #0056c7;
    --shadow: 0 20px 50px rgba(0,0,0,.08);
  }
}

[data-contrast="high"] {
  --bg: #000;
  --surface: #000;
  --text: #fff;
  --muted: #fff;
  --brand: #ffff00;
  --brand-strong: #ffff00;
  --focus: #ff0;
  --shadow: none;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: var(--font-size);
  line-height: 1.5;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 20% 50%, color-mix(in srgb, var(--brand) 3%, transparent) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, color-mix(in srgb, var(--brand-strong) 3%, transparent) 0%, transparent 50%),
    radial-gradient(circle at 40% 20%, color-mix(in srgb, var(--brand) 2%, transparent) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

body > * {
  position: relative;
  z-index: 1;
}

html {
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
}

.container {
  width: min(1200px, 95vw);
  margin-inline: auto;
  padding-inline: clamp(12px, 3vw, 20px);
}

@media (min-width: 768px) {
  .container {
    width: min(1200px, 92vw);
  }
}

.grid {
  display: grid;
  gap: 24px;
}

.grid-2 {
  grid-template-columns: 1.2fr 1fr;
}

@media (max-width: 960px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(140%) blur(8px);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  gap: 12px;
}

@media (min-width: 768px) {
  .nav {
    padding: 20px 0;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.9em;
}

@media (min-width: 768px) {
  .brand {
    gap: 14px;
    font-size: 1em;
  }
}

.brand svg {
  width: 36px;
  height: 36px;
}

@media (min-width: 768px) {
  .brand svg {
    width: 44px;
    height: 44px;
  }
}

.brand mark {
  background: linear-gradient(90deg, var(--brand), var(--brand-strong));
  color: #001;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: .4px;
  font-size: 0.85em;
}

@media (min-width: 768px) {
  .brand mark {
    padding: 6px 12px;
    font-size: 1em;
  }
}

.nav-ctas {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

@media (min-width: 768px) {
  .nav-ctas {
    gap: 14px;
  }
}

/* Icon-based mobile navigation */
.btn-icon {
  font-size: 1.3em;
  line-height: 1;
}

.btn-text {
  display: none;
}

/* Show text labels on larger screens */
@media (min-width: 640px) {
  .btn-icon {
    display: none;
  }
  
  .btn-text {
    display: inline;
  }
}

/* Compact mobile button sizing for icon-only buttons */
@media (max-width: 639px) {
  .nav-ctas .btn.ghost {
    min-width: 48px;
    padding: 12px 14px;
    justify-content: center;
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
  min-height: 48px;
  font-size: 0.95em;
  transition: transform 0.15s, box-shadow 0.15s;
}

@media (min-width: 768px) {
  .btn {
    padding: 16px 22px;
    min-height: 56px;
    font-size: 1em;
    gap: 10px;
  }
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--focus);
}

.btn.primary {
  background: linear-gradient(90deg, var(--brand), var(--brand-strong));
  color: #001;
}

.btn.secondary {
  background: var(--surface);
  color: var(--text);
  border-color: color-mix(in srgb, var(--text) 15%, transparent);
}

.btn.ghost {
  background: transparent;
  color: var(--text);
  border-color: color-mix(in srgb, var(--text) 20%, transparent);
}

.btn.block {
  width: 100%;
}

.btn.success {
  background: var(--ok);
  color: #001;
}

.btn.error {
  background: var(--error);
  color: #fff;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Splash */
.splash {
  min-height: 85vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 8vh 0;
  background:
    radial-gradient(800px 400px at 50% 10%, color-mix(in srgb, var(--brand) 10%, transparent), transparent 60%),
    linear-gradient(180deg, color-mix(in srgb, var(--bg) 85%, transparent), var(--bg));
}

@media (min-width: 768px) {
  .splash {
    min-height: 88vh;
    padding: 10vh 0;
    background:
      radial-gradient(1200px 600px at 50% 10%, color-mix(in srgb, var(--brand) 10%, transparent), transparent 60%),
      linear-gradient(180deg, color-mix(in srgb, var(--bg) 85%, transparent), var(--bg));
  }
}

.splash-title {
  font-size: clamp(2.5rem, 8vw, calc(56px * var(--heading-scale)));
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 8px 0 10px;
}

.splash-tagline {
  font-size: clamp(1.1rem, 4vw, calc(22px * var(--heading-scale)));
  color: color-mix(in srgb, var(--text) 88%, transparent);
  margin: 0 0 18px;
  max-width: 34ch;
  margin-inline: auto;
  padding-inline: 16px;
}

.splash-ctas {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 6px;
  padding-inline: 16px;
}

@media (min-width: 768px) {
  .splash-ctas {
    gap: 14px;
  }
}

.splash .down {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 2px solid color-mix(in srgb, var(--text) 22%, transparent);
  margin-top: 22px;
  text-decoration: none;
  font-weight: 800;
  color: var(--text);
}

/* Main Sections */
.hero {
  padding: clamp(32px, 4vw, 56px) 0;
}

h1 {
  font-size: clamp(1.8rem, 6vw, calc(44px * var(--heading-scale)));
  line-height: 1.1;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.5rem, 5vw, calc(32px * var(--heading-scale)));
  line-height: 1.2;
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

h3 {
  font-size: clamp(1.2rem, 4vw, 1.4em);
  line-height: 1.3;
}

.eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 800;
  letter-spacing: .12em;
  margin-bottom: 10px;
  font-size: 0.8em;
}

@media (min-width: 768px) {
  .eyebrow {
    font-size: 0.9em;
  }
}

.lead {
  font-size: clamp(1.1rem, 3.5vw, calc(22px * var(--heading-scale)));
  color: color-mix(in srgb, var(--text) 92%, transparent);
  margin: 10px 0 24px;
  max-width: 40ch;
}

.hero-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}

@media (min-width: 768px) {
  .hero-card {
    border-radius: var(--radius-xl);
    padding: 24px;
  }
}

.quick-cta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

@media (max-width: 720px) {
  .quick-cta {
    grid-template-columns: 1fr;
  }
}

/* Tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

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

@media (min-width: 900px) {
  .tiles {
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
  }
}

@media (min-width: 1200px) {
  .tiles {
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
  }
}

.tile {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 140px;
  transition: transform 0.2s, box-shadow 0.2s;
}

@media (min-width: 768px) {
  .tile {
    border-radius: var(--radius-lg);
    padding: 20px;
    gap: 10px;
    min-height: 150px;
  }
}

.tile:hover {
  transform: translateY(-4px);
  box-shadow: 0 25px 60px rgba(0,0,0,.4);
}

.tile h3 {
  margin: 0;
  font-size: 1.1em;
}

@media (min-width: 768px) {
  .tile h3 {
    font-size: 1.2em;
  }
}

.tile p {
  margin: 0;
  color: var(--muted);
  flex-grow: 1;
  font-size: 0.9em;
}

@media (min-width: 768px) {
  .tile p {
    font-size: 1em;
  }
}

/* Steps */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 960px) {
  .steps {
    grid-template-columns: 1fr;
  }
}

.step {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}

.step h3 {
  margin: 0 0 8px;
  font-size: 1.4em;
}

.step p {
  margin: 0;
  color: var(--muted);
}

/* Footer */
footer {
  padding: 32px 0 60px;
  color: var(--muted);
}

@media (min-width: 768px) {
  footer {
    padding: 40px 0 80px;
  }
}

footer .row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

@media (min-width: 768px) {
  footer .row {
    justify-content: space-between;
    gap: 12px;
  }
}

.links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.links a:hover,
.links a:focus-visible {
  color: var(--text);
  border-bottom-color: var(--brand);
}

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

.card {
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}

@media (min-width: 768px) {
  .card {
    border-radius: var(--radius-xl);
  }
}

.spaced {
  padding: clamp(16px, 4vw, 28px);
}

.section {
  padding: clamp(24px, 5vw, 56px) 0;
}

.center {
  text-align: center;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  font-weight: 800;
  font-size: 0.75em;
}

@media (min-width: 768px) {
  .pill {
    gap: 10px;
    padding: 10px 14px;
    font-size: 0.85em;
  }
}

:focus-visible {
  outline: 4px solid var(--focus);
  outline-offset: 2px;
  border-radius: 10px;
}

/* Game Container */
.game-container {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@media (min-width: 768px) {
  .game-container {
    gap: 24px;
  }
}

.game-board {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
  min-height: 350px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

@media (min-width: 768px) {
  .game-board {
    border-radius: var(--radius-xl);
    padding: 32px;
    min-height: 400px;
    gap: 20px;
  }
}

.game-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

@media (min-width: 640px) {
  .game-stats {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
  }
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: center;
  border: 1px solid color-mix(in srgb, var(--text) 8%, transparent);
}

@media (min-width: 768px) {
  .stat-card {
    padding: 16px;
  }
}

.stat-label {
  font-size: 0.75em;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 4px;
}

@media (min-width: 768px) {
  .stat-label {
    font-size: 0.85em;
  }
}

.stat-value {
  font-size: 1.6em;
  font-weight: 800;
  color: var(--brand);
}

@media (min-width: 768px) {
  .stat-value {
    font-size: 2em;
  }
}

.game-grid {
  display: grid;
  gap: 12px;
  margin: 16px auto;
  max-width: 100%;
}

@media (min-width: 768px) {
  .game-grid {
    gap: 16px;
    margin: 20px auto;
  }
}

.game-option {
  background: var(--surface);
  border: 3px solid color-mix(in srgb, var(--text) 15%, transparent);
  border-radius: var(--radius-md);
  padding: 16px;
  font-size: 1.3em;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  min-width: 80px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  word-break: break-word;
}

@media (min-width: 768px) {
  .game-option {
    padding: 24px;
    font-size: 1.5em;
    min-width: 100px;
    min-height: 80px;
  }
}

.game-option:hover:not(:disabled) {
  transform: scale(1.05);
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 10%, var(--surface));
}

.game-option:active:not(:disabled) {
  transform: scale(0.98);
}

.game-option:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.game-option.correct {
  background: var(--ok);
  border-color: var(--ok);
  color: #001;
}

.game-option.incorrect {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
}

.timer {
  font-size: 2em;
  font-weight: 800;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

@media (min-width: 768px) {
  .timer {
    font-size: 2.5em;
  }
}

.timer.warning {
  color: var(--warn);
  animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  border-radius: 999px;
  overflow: hidden;
  margin: 20px 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-strong));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.result-screen {
  text-align: center;
  padding: 24px 16px;
}

@media (min-width: 768px) {
  .result-screen {
    padding: 40px 20px;
  }
}

.score-display {
  font-size: 3em;
  font-weight: 800;
  color: var(--brand);
  margin: 16px 0;
}

@media (min-width: 768px) {
  .score-display {
    font-size: 4em;
    margin: 20px 0;
  }
}

.action-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

@media (min-width: 768px) {
  .action-buttons {
    gap: 12px;
    margin-top: 24px;
  }
}

/* Mobile-specific touch optimizations */
@media (max-width: 767px) {
  /* Improve tap targets for mobile */
  button, a, input, select, textarea {
    -webkit-tap-highlight-color: rgba(110, 231, 255, 0.3);
  }
  
  /* Better spacing for touch */
  .btn + .btn {
    margin-left: 0;
  }
  
  /* Prevent text selection on game elements for better tap experience */
  .game-option, .tile, .stat-card {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }
  
  /* Ensure smooth scrolling on mobile */
  body {
    -webkit-overflow-scrolling: touch;
    overflow-x: hidden;
  }
  
  /* Better touch feedback */
  .btn:active, .game-option:active, .tile:active {
    opacity: 0.9;
  }
  
  /* Optimize game board for small screens */
  #gameArea {
    width: 100%;
    max-width: 100%;
  }
  
  /* Better readability on small screens */
  p {
    line-height: 1.6;
  }
  
  /* Ensure cards don't overflow */
  .hero-card, .card {
    overflow: hidden;
  }
}

/* Landscape mobile optimization */
@media (max-width: 767px) and (orientation: landscape) {
  .splash {
    min-height: auto;
    padding: 5vh 0;
  }
  
  .game-board {
    min-height: 300px;
  }
  
  .splash-title {
    font-size: clamp(2rem, 6vw, 3rem);
  }
}

/* Very small screens */
@media (max-width: 374px) {
  :root {
    --font-size: 16px;
  }
  
  .btn {
    padding: 10px 14px;
    font-size: 0.9em;
  }
  
  .stat-value {
    font-size: 1.4em;
  }
  
  .game-option {
    padding: 12px;
    font-size: 1.1em;
  }
}

/* Large mobile/small tablet */
@media (min-width: 480px) and (max-width: 767px) {
  .tiles {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ============================================
   DESIGN POLISH & REFINEMENTS
   ============================================ */

/* Smooth animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(110, 231, 255, 0.3);
  }
  50% {
    box-shadow: 0 0 30px rgba(110, 231, 255, 0.6);
  }
}

/* Social Share Buttons - Refined */
.share-bar {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 100;
  animation: slideInRight 0.6s ease-out 0.5s backwards;
}

.share-bar .btn {
  padding: 12px;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  background: var(--surface);
  border: 2px solid color-mix(in srgb, var(--text) 15%, transparent);
}

.share-bar .btn:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 8px 24px rgba(110, 231, 255, 0.25);
  border-color: var(--brand);
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
}

.share-bar .btn:active {
  transform: translateY(-2px) scale(1.02);
}

/* Hide share buttons on mobile, show as fixed bottom bar instead */
@media (max-width: 768px) {
  .share-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    transform: none;
    flex-direction: row;
    justify-content: center;
    gap: 16px;
    padding: 12px 20px 20px;
    background: linear-gradient(to top, var(--bg), transparent);
    backdrop-filter: blur(8px);
    z-index: 50;
    animation: slideUp 0.4s ease-out;
  }
  
  .share-bar .btn {
    width: 56px;
    height: 56px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  }
  
  /* Add padding to main content to prevent overlap with share bar */
  main {
    padding-bottom: 100px !important;
  }
  
  footer {
    margin-bottom: 80px;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Interactive Demo Polish */
.instant-demo {
  animation: fadeIn 0.8s ease-out;
  position: relative;
  overflow: hidden;
}

.instant-demo::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 8%, transparent), transparent 70%);
  pointer-events: none;
}

.instant-demo .card {
  transition: all 0.3s ease;
  border: 2px solid color-mix(in srgb, var(--text) 10%, transparent);
  position: relative;
}

.instant-demo .card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  border-color: color-mix(in srgb, var(--brand) 30%, transparent);
}

#quickChallenge button {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

#quickChallenge button::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--brand) 20%, transparent);
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s;
}

#quickChallenge button:hover::before {
  width: 200%;
  height: 200%;
}

#quickChallenge button > * {
  position: relative;
  z-index: 1;
}

#quickChallenge button:active {
  transform: scale(0.95);
}

/* Comparison Section Polish */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.grid .card {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.grid .card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.3s;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 5%, transparent), transparent);
  pointer-events: none;
}

.grid .card:hover {
  transform: translateY(-6px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

.grid .card:hover::after {
  opacity: 1;
}

/* Brain Wave card special treatment */
.grid .card[style*="border: 2px solid"] {
  animation: glow 3s ease-in-out infinite;
  box-shadow: 0 8px 32px rgba(110, 231, 255, 0.2);
}

.grid .card[style*="border: 2px solid"]:hover {
  box-shadow: 0 12px 48px rgba(110, 231, 255, 0.35);
}

/* Social Proof Section */
.stats-row > div {
  transition: transform 0.3s ease;
}

.stats-row > div:hover {
  transform: scale(1.1);
}

.stats-row p:first-child {
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 4px 12px rgba(110, 231, 255, 0.3);
}

.testimonials blockquote {
  transition: all 0.3s ease;
  position: relative;
}

.testimonials blockquote:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

.testimonials blockquote::before {
  content: '"';
  position: absolute;
  top: -10px;
  left: 10px;
  font-size: 4em;
  color: var(--brand);
  opacity: 0.2;
  font-family: Georgia, serif;
  line-height: 1;
}

/* Button Enhancements */
.btn.primary {
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(110, 231, 255, 0.3);
}

.btn.primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s;
}

.btn.primary:hover::before {
  left: 100%;
}

.btn.primary:hover {
  box-shadow: 0 6px 20px rgba(110, 231, 255, 0.5);
}

.btn.secondary:hover {
  background: color-mix(in srgb, var(--brand) 8%, var(--surface));
  border-color: var(--brand);
}

.btn.ghost:hover {
  background: color-mix(in srgb, var(--text) 5%, transparent);
  border-color: var(--brand);
}

/* Tile Improvements */
.tile {
  position: relative;
  overflow: hidden;
}

.tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--brand), var(--brand-strong));
  transform: scaleX(0);
  transition: transform 0.3s ease;
  transform-origin: left;
}

.tile:hover::before {
  transform: scaleX(1);
}

/* Tile Icons */
.tile-icon {
  font-size: 2.5em;
  line-height: 1;
  margin-bottom: 12px;
  filter: grayscale(0.2) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  transition: all 0.3s ease;
}

@media (min-width: 768px) {
  .tile-icon {
    font-size: 3em;
    margin-bottom: 16px;
  }
}

.tile:hover .tile-icon {
  transform: scale(1.15) translateY(-4px);
  filter: grayscale(0) drop-shadow(0 4px 8px rgba(110, 231, 255, 0.3));
}

/* Card Improvements */
.card.spaced {
  transition: all 0.3s ease;
}

.card.spaced:hover {
  transform: translateY(-2px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
}

/* FAQ Details Enhancement */
details[open] summary span:last-child {
  transform: rotate(180deg);
}

details summary span:last-child {
  transition: transform 0.3s ease;
}

details[open] {
  animation: fadeIn 0.3s ease;
}

/* Hero Card Animation */
.hero-card {
  animation: fadeIn 0.8s ease-out 0.2s backwards;
}

/* Section Stagger Animations */
.section {
  animation: fadeIn 0.6s ease-out backwards;
}

.section:nth-of-type(1) { animation-delay: 0.1s; }
.section:nth-of-type(2) { animation-delay: 0.2s; }
.section:nth-of-type(3) { animation-delay: 0.3s; }

/* Tile Stagger */
.tile {
  animation: fadeIn 0.4s ease-out backwards;
}

.tile:nth-child(1) { animation-delay: 0.05s; }
.tile:nth-child(2) { animation-delay: 0.1s; }
.tile:nth-child(3) { animation-delay: 0.15s; }
.tile:nth-child(4) { animation-delay: 0.2s; }
.tile:nth-child(5) { animation-delay: 0.25s; }
.tile:nth-child(6) { animation-delay: 0.3s; }
.tile:nth-child(7) { animation-delay: 0.35s; }
.tile:nth-child(8) { animation-delay: 0.4s; }
.tile:nth-child(9) { animation-delay: 0.45s; }
.tile:nth-child(10) { animation-delay: 0.5s; }

/* Smooth scroll offset for fixed header */
html {
  scroll-padding-top: 80px;
}

/* Focus improvements */
*:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 8px;
  transition: outline 0.2s ease;
}

/* Link hover improvements */
a {
  transition: all 0.2s ease;
}

/* Nav improvements */
header {
  transition: all 0.3s ease;
}

header:hover {
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}

/* Splash down arrow animation */
.splash .down {
  animation: float 2s ease-in-out infinite;
  transition: all 0.2s ease;
}

.splash .down:hover {
  border-color: var(--brand);
  color: var(--brand);
  animation: none;
  transform: translateY(-4px);
}

/* Loading states */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* Toast notification enhancement */
.toast {
  animation: slideUp 0.3s ease-out;
}

/* Game option improvements */
.game-option {
  position: relative;
}

.game-option::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 10%, transparent), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.game-option:hover::after {
  opacity: 1;
}

/* Progress bar enhancement */
.progress-fill {
  background: linear-gradient(90deg, var(--brand), var(--brand-strong));
  box-shadow: 0 0 10px rgba(110, 231, 255, 0.5);
}

/* Score display enhancement */
.score-display {
  animation: fadeIn 0.6s ease-out, glow 2s ease-in-out infinite;
}

/* Share prompt styling */
.share-prompt {
  animation: fadeIn 0.5s ease-out;
}

.share-prompt button {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.share-prompt button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  html {
    scroll-behavior: auto;
  }
}

/* High contrast mode adjustments */
@media (prefers-contrast: high) {
  .btn {
    border-width: 3px;
  }
  
  .card {
    border-width: 2px;
  }
}

/* Print styles */
@media print {
  .share-bar,
  .btn,
  .nav-ctas {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
}

/* ============================================
   ENHANCED UI/UX IMPROVEMENTS
   ============================================ */

/* Typography Scale */
:root {
  --text-xs: 0.75rem;   /* 12px */
  --text-sm: 0.875rem;  /* 14px */
  --text-base: 1rem;    /* 16px */
  --text-lg: 1.125rem;  /* 18px */
  --text-xl: 1.25rem;   /* 20px */
  --text-2xl: 1.5rem;   /* 24px */
  --text-3xl: 1.875rem; /* 30px */
  --text-4xl: 2.25rem;  /* 36px */
  --text-5xl: 3rem;     /* 48px */
  
  /* Semantic Colors */
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --error: #ef4444;
  --error-light: #fee2e2;
  --info: #3b82f6;
  --info-light: #dbeafe;
  
  /* Enhanced Spacing */
  --space-1: 0.25rem;  /* 4px */
  --space-2: 0.5rem;   /* 8px */
  --space-3: 0.75rem;  /* 12px */
  --space-4: 1rem;     /* 16px */
  --space-6: 1.5rem;   /* 24px */
  --space-8: 2rem;     /* 32px */
  --space-12: 3rem;    /* 48px */
  --space-16: 4rem;    /* 64px */
}

/* Enhanced Game Option Animations */
.game-option {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.game-option:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 8px 25px rgba(110, 231, 255, 0.3);
}

.game-option:active {
  transform: translateY(0) scale(0.98);
}

/* Success Animation */
@keyframes successPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.game-option.correct {
  animation: successPulse 0.6s ease-out;
  background: var(--success);
  border-color: var(--success);
  color: #000;
}

.game-option.correct::after {
  content: '✓';
  position: absolute;
  top: 5px;
  right: 5px;
  font-size: 1.2em;
  font-weight: bold;
  color: #000;
}

/* Enhanced Feedback System */
.feedback {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  z-index: 10;
  animation: fadeIn 0.3s ease-out;
}

.feedback.correct {
  background: var(--success);
  color: #000;
}

.feedback.incorrect {
  background: var(--error);
  color: white;
}

.feedback-icon {
  font-size: 2em;
  text-align: center;
  margin-bottom: 8px;
}

.feedback-text {
  font-size: 1.1em;
  text-align: center;
}

/* Progress Ring */
.progress-ring {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto;
}

.progress-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.progress-circle {
  transition: stroke-dashoffset 0.3s ease;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.progress-number {
  display: block;
  font-size: 1.5em;
  font-weight: 800;
  color: var(--brand);
}

.progress-label {
  font-size: 0.8em;
  color: var(--muted);
}

/* Difficulty Meter */
.difficulty-meter {
  width: 100%;
  height: 8px;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0;
  position: relative;
}

.meter-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--brand-strong));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.meter-label {
  position: absolute;
  top: -20px;
  right: 0;
  font-size: 0.8em;
  color: var(--muted);
  font-weight: 600;
}

/* Onboarding Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s ease-out;
}

.modal-content {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 32px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  animation: slideInUp 0.4s ease-out;
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tour-steps {
  display: grid;
  gap: 16px;
  margin: 24px 0;
}

.tour-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: color-mix(in srgb, var(--brand) 10%, transparent);
  border-radius: var(--radius-md);
  font-size: 1.1em;
}

/* Achievement System */
.achievement {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--surface);
  border: 2px solid var(--brand);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  animation: slideInRight 0.5s ease-out;
  z-index: 1000;
  max-width: 300px;
}

.achievement-icon {
  font-size: 2em;
  margin-bottom: 8px;
}

.achievement-title {
  font-weight: 800;
  color: var(--brand);
  margin-bottom: 4px;
}

.achievement-description {
  font-size: 0.9em;
  color: var(--muted);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Enhanced Game Transitions */
.game-transition {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.game-transition.fade-out {
  opacity: 0;
  transform: translateY(20px);
}

.game-transition.fade-in {
  opacity: 1;
  transform: translateY(0);
}

/* Personalized Greeting */
.personalized-greeting {
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 800;
  margin-bottom: 16px;
}

/* Enhanced Visual Math */
.visual-math {
  font-size: 2em;
  margin: 20px 0;
  line-height: 1.5;
}

.visual-math .shape {
  display: inline-block;
  margin: 0 4px;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .modal-content {
    padding: 24px;
    margin: 20px;
  }
  
  .achievement {
    right: 10px;
    left: 10px;
    max-width: none;
  }
  
  .progress-ring {
    width: 60px;
    height: 60px;
  }
  
  .progress-number {
    font-size: 1.2em;
  }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
  .game-option,
  .feedback,
  .achievement,
  .modal-content {
    animation: none;
    transition: none;
  }
}

/* High Contrast Mode */
[data-contrast="high"] .game-option.correct::after {
  content: '✓';
  color: #000;
  font-weight: 900;
}

[data-contrast="high"] .feedback {
  border: 2px solid currentColor;
}

[data-contrast="high"] .achievement {
  border-width: 3px;
}


