/* =============================================
   BrainTrap — Base Styles & Design System
   Premium Dark Mode Quiz Platform
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;700&display=swap');

/* === Design Tokens === */
:root {
  /* Backgrounds */
  --bg:           #07070f;
  --bg-2:         #0d0d1f;
  --surface:      #10101e;
  --surface-2:    #171730;
  --surface-3:    #1f1f42;
  --surface-4:    #26264e;

  /* Brand Colors */
  --accent:       #7c3aed;
  --accent-light: #a855f7;
  --accent-dark:  #5b21b6;
  --accent-glow:  rgba(124, 58, 237, 0.35);
  --accent-glow-sm: rgba(124, 58, 237, 0.15);

  /* Feedback Colors */
  --neon:         #00e577;
  --neon-light:   #34d399;
  --neon-glow:    rgba(0, 229, 119, 0.3);
  --danger:       #ff3b5c;
  --danger-light: #ff6b85;
  --danger-glow:  rgba(255, 59, 92, 0.3);

  /* Special */
  --gold:         #fbbf24;
  --gold-glow:    rgba(251, 191, 36, 0.3);
  --teal:         #06b6d4;

  /* Text */
  --text:         #f0f0ff;
  --text-muted:   #8888b0;
  --text-dim:     #555575;

  /* Borders */
  --border:         rgba(255, 255, 255, 0.07);
  --border-2:       rgba(255, 255, 255, 0.12);
  --border-accent:  rgba(124, 58, 237, 0.4);

  /* Radius */
  --r-xs: 6px;
  --r-sm: 10px;
  --r:    16px;
  --r-lg: 24px;
  --r-xl: 32px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm:     0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow:        0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-lg:     0 24px 64px rgba(0, 0, 0, 0.6);
  --shadow-accent: 0 8px 32px rgba(124, 58, 237, 0.35);
  --shadow-neon:   0 8px 32px rgba(0, 229, 119, 0.3);
  --shadow-danger: 0 8px 32px rgba(255, 59, 92, 0.3);

  /* Typography */
  --font-primary: 'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* Transitions */
  --t-fast:   150ms cubic-bezier(0.4, 0, 0.2, 1);
  --t:        250ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow:   400ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-spring: 350ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* === Reset === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-primary);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font-family: var(--font-primary); cursor: pointer; border: none; background: none; }
img { max-width: 100%; display: block; }
input { font-family: var(--font-primary); }

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-2); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* === Background Mesh === */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(124, 58, 237, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(0, 229, 119, 0.08) 0%, transparent 60%),
    radial-gradient(ellipse 100% 100% at 50% 50%, var(--bg-2) 0%, var(--bg) 100%);
  pointer-events: none;
}

.bg-dots {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
}

/* === Layout === */
.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.container {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.container-wide {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

/* === Cards === */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
  position: relative;
  overflow: hidden;
}

.card-glass {
  background: rgba(16, 16, 30, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-2);
  border-radius: var(--r-lg);
}

.card-glow {
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* === Typography === */
.text-hero {
  font-size: clamp(2.8rem, 8vw, 4.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.text-display {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.text-xl { font-size: 1.25rem; font-weight: 600; }
.text-lg { font-size: 1.125rem; font-weight: 500; }
.text-md { font-size: 1rem; font-weight: 500; }
.text-sm { font-size: 0.875rem; font-weight: 400; }
.text-xs { font-size: 0.75rem; font-weight: 400; }

.text-muted  { color: var(--text-muted); }
.text-dim    { color: var(--text-dim); }
.text-accent { color: var(--accent-light); }
.text-neon   { color: var(--neon); }
.text-danger { color: var(--danger); }
.text-gold   { color: var(--gold); }

.font-mono { font-family: var(--font-mono); }

/* === Gradient Text === */
.gradient-text {
  background: linear-gradient(135deg, #fff 0%, var(--accent-light) 50%, var(--neon) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-text-accent {
  background: linear-gradient(135deg, var(--accent-light) 0%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* === Buttons === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--r-full);
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-primary);
  cursor: pointer;
  transition: all var(--t);
  white-space: nowrap;
  user-select: none;
  border: none;
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--t);
  background: rgba(255, 255, 255, 0.08);
}

.btn:hover::before { opacity: 1; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  color: #fff;
  box-shadow: 0 4px 24px var(--accent-glow), 0 1px 0 rgba(255,255,255,0.15) inset;
}

.btn-primary:hover {
  box-shadow: 0 8px 32px var(--accent-glow), 0 1px 0 rgba(255,255,255,0.15) inset;
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-2);
}

.btn-secondary:hover {
  background: var(--surface-3);
  border-color: var(--border-accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-neon {
  background: linear-gradient(135deg, #00c853 0%, #00e577 100%);
  color: #00150d;
  font-weight: 700;
  box-shadow: 0 4px 24px var(--neon-glow);
}

.btn-neon:hover {
  box-shadow: 0 8px 32px var(--neon-glow);
  transform: translateY(-1px);
}

.btn-lg {
  padding: 18px 36px;
  font-size: 1.125rem;
  border-radius: var(--r-full);
}

.btn-sm {
  padding: 10px 20px;
  font-size: 0.875rem;
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--r-full);
}

.btn-full { width: 100%; }

/* === Inputs === */
.input-wrap {
  position: relative;
  width: 100%;
}

.input {
  width: 100%;
  padding: 16px 20px;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font-size: 1.125rem;
  font-family: var(--font-primary);
  font-weight: 500;
  transition: all var(--t);
  outline: none;
}

.input::placeholder { color: var(--text-dim); font-weight: 400; }

.input:focus {
  border-color: var(--accent);
  background: var(--surface-3);
  box-shadow: 0 0 0 4px var(--accent-glow-sm);
}

.input-text-answer {
  padding: 18px 24px;
  font-size: 1.2rem;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  border: 2px solid var(--border-2);
  text-align: center;
  letter-spacing: 0.01em;
}

.input-text-answer:focus {
  border-color: var(--accent-light);
  box-shadow: 0 0 0 4px var(--accent-glow-sm);
}

/* === Tags / Pills === */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-full);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.pill-accent {
  background: rgba(124, 58, 237, 0.12);
  border-color: rgba(124, 58, 237, 0.25);
  color: var(--accent-light);
}

/* === Divider === */
.divider {
  width: 100%;
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

/* === Flex helpers === */
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }

/* === Spacing === */
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }

/* === Streak Display === */
.streak-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: var(--r-full);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gold);
}

.streak-fire {
  display: inline-block;
  font-size: 1.1em;
}

/* === Score Ring Container === */
.score-ring-wrap {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto;
}

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

.score-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* === Progress Dots === */
.progress-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1.5px solid var(--border-2);
  transition: all var(--t-spring);
}

.dot.active {
  background: var(--accent);
  border-color: var(--accent-light);
  box-shadow: 0 0 10px var(--accent-glow);
}

.dot.correct {
  background: var(--neon);
  border-color: var(--neon-light);
  box-shadow: 0 0 10px var(--neon-glow);
}

.dot.wrong {
  background: var(--danger);
  border-color: var(--danger-light);
  box-shadow: 0 0 10px var(--danger-glow);
}

/* === Answer Cards (Results) === */
.answer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 20px;
  transition: all var(--t);
}

.answer-card.correct-card {
  border-color: rgba(0, 229, 119, 0.3);
  background: rgba(0, 229, 119, 0.04);
}

.answer-card.wrong-card {
  border-color: rgba(255, 59, 92, 0.3);
  background: rgba(255, 59, 92, 0.04);
}

/* === Responsive === */
@media (max-width: 480px) {
  .card { padding: 20px 16px; }
  .btn-lg { padding: 16px 28px; font-size: 1rem; }
  .page { padding: 16px 12px; }
}
