/* BrainSprint design system: dark gaming theme, mobile-first */
:root {
  --bg: #11111B;
  --bg-2: #1A1A2E;
  --bg-3: #232340;
  --violet: #8B5CF6;
  --lime: #A3E635;
  --cyan: #22D3EE;
  --text: #F8FAFC;
  --muted: #A1A1AA;
  --error: #F87171;
  --border: rgba(248, 250, 252, 0.09);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --glow-violet: 0 0 0 1px rgba(139, 92, 246, 0.4), 0 8px 30px rgba(139, 92, 246, 0.25);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 85% -10%, rgba(139, 92, 246, 0.16), transparent 60%),
    radial-gradient(700px 400px at -10% 20%, rgba(34, 211, 238, 0.08), transparent 60%),
    var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}
img, svg { max-width: 100%; display: block; }
a { color: var(--cyan); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: #67E8F9; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.6em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 6vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.45rem, 3.6vw, 2rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.2em; margin: 0 0 1em; }
li + li { margin-top: 0.35em; }
.small { font-size: 0.9rem; }
.muted { color: var(--muted); }
.accent { color: var(--cyan); }
.lime { color: var(--lime); }
.violet { color: var(--violet); }
.container { width: min(1120px, 100% - 40px); margin-inline: auto; }
.section { padding: clamp(48px, 8vw, 88px) 0; }
.section-alt { background: linear-gradient(180deg, transparent, rgba(26, 26, 46, 0.7), transparent); }
.eyebrow {
  display: inline-block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--lime); margin-bottom: 0.75rem;
}
.lead { font-size: clamp(1.05rem, 2.4vw, 1.2rem); color: var(--muted); max-width: 62ch; }
.gradient-text {
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--lime);
  color: #0B0B14; padding: 8px 14px; border-radius: 8px; font-weight: 700;
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; border-radius: 6px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 48px; padding: 0.75rem 1.4rem; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-2px); color: inherit; }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--violet), #6D28D9); color: #fff; box-shadow: var(--glow-violet); }
.btn-primary:hover { color: #fff; }
.btn-lime { background: var(--lime); color: #0B0B14; }
.btn-lime:hover { color: #0B0B14; box-shadow: 0 8px 26px rgba(163, 230, 53, 0.3); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--cyan); color: var(--text); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(17, 17, 27, 0.82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-wrap { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-mark { width: 36px; height: 36px; }
.brand-word { font-weight: 900; font-size: 1.35rem; letter-spacing: -0.02em; }
.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 12px; cursor: pointer;
}
.bars, .bars::before, .bars::after {
  display: block; width: 20px; height: 2px; background: var(--text); border-radius: 2px; position: relative; transition: transform 0.2s;
}
.bars::before, .bars::after { content: ""; position: absolute; left: 0; }
.bars::before { top: -6px; }
.bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .bars::after { transform: translateY(-6px) rotate(-45deg); }
.site-nav {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  background: var(--bg-2); border-bottom: 1px solid var(--border); padding: 12px 20px 20px;
  flex-direction: column; gap: 4px;
}
.site-nav.open { display: flex; }
.site-nav a { color: var(--text); text-decoration: none; padding: 12px 8px; border-radius: 10px; font-weight: 600; }
.site-nav a:hover, .site-nav a[aria-current="page"] { background: var(--bg-3); color: var(--text); }
.site-nav .nav-cta { margin-top: 8px; color: #fff; justify-content: center; }
.site-nav .nav-cta:hover { background: linear-gradient(135deg, var(--violet), #6D28D9); }
.nav-wrap { position: relative; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-2); padding: 48px 0 24px; margin-top: 40px; }
.footer-grid { display: grid; gap: 28px; grid-template-columns: 1fr; }
.footer-title { font-size: 0.95rem; color: var(--text); margin-bottom: 10px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer li + li { margin-top: 8px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--cyan); }
.footer-bottom { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); }

/* Cards */
.card {
  background: linear-gradient(180deg, var(--bg-2), rgba(26, 26, 46, 0.6));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow);
}
.card-link { display: block; text-decoration: none; color: var(--text); transition: transform 0.2s, border-color 0.2s; }
.card-link:hover { transform: translateY(-3px); border-color: rgba(139, 92, 246, 0.6); color: var(--text); }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }
.tag {
  display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  background: rgba(139, 92, 246, 0.16); color: #C4B5FD; border: 1px solid rgba(139, 92, 246, 0.35); margin-bottom: 10px;
}
.tag-lime { background: rgba(163, 230, 53, 0.12); color: var(--lime); border-color: rgba(163, 230, 53, 0.35); }
.tag-cyan { background: rgba(34, 211, 238, 0.1); color: var(--cyan); border-color: rgba(34, 211, 238, 0.35); }
.notice {
  border: 1px solid rgba(34, 211, 238, 0.35); background: rgba(34, 211, 238, 0.06);
  border-radius: var(--radius-sm); padding: 14px 16px; color: var(--text); font-size: 0.95rem;
}
.notice-warn { border-color: rgba(248, 113, 113, 0.45); background: rgba(248, 113, 113, 0.07); }
.demo-badge {
  display: inline-block; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px; background: #F59E0B22; color: #FCD34D; border: 1px solid #F59E0B66;
}

/* Hero */
.hero { padding: clamp(40px, 8vw, 90px) 0 48px; }
.hero-grid { display: grid; gap: 40px; align-items: center; grid-template-columns: 1fr; }
.hero .lead { margin-bottom: 28px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }
.hero-points { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; list-style: none; padding: 0; }
.hero-points li { margin: 0; font-size: 0.9rem; color: var(--muted); background: var(--bg-2); border: 1px solid var(--border); padding: 6px 12px; border-radius: 999px; }

/* Puzzle preview (static, interactive) */
.preview-card { position: relative; overflow: hidden; }
.preview-card::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
  background: linear-gradient(135deg, var(--violet), var(--cyan), var(--lime));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none; opacity: 0.6;
}
.preview-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font-size: 0.9rem; color: var(--muted); }
.progress { height: 10px; background: var(--bg-3); border-radius: 999px; overflow: hidden; }
.progress-fill {
  height: 100%; width: 0; border-radius: inherit;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  transition: width 0.5s cubic-bezier(.2,.8,.2,1);
}
.progress-fill.lime { background: linear-gradient(90deg, var(--cyan), var(--lime)); }

/* Question / options */
.q-text { font-size: clamp(1.15rem, 3vw, 1.4rem); font-weight: 700; margin: 18px 0 20px; }
.options { display: grid; gap: 12px; grid-template-columns: 1fr; list-style: none; padding: 0; margin: 0; }
.options li + li { margin-top: 0; }
.option {
  width: 100%; min-height: 56px; display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 12px 16px; background: var(--bg); color: var(--text); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font: inherit; font-size: 1rem; cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.option:hover { border-color: rgba(139, 92, 246, 0.6); }
.option:active { transform: scale(0.99); }
.option[aria-pressed="true"] { border-color: var(--cyan); background: rgba(34, 211, 238, 0.09); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15); }
.option-letter {
  flex: 0 0 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  font-weight: 800; background: var(--bg-3); color: var(--muted); font-size: 0.9rem;
}
.option[aria-pressed="true"] .option-letter { background: var(--cyan); color: #0B0B14; }
.option.is-correct { border-color: var(--lime); background: rgba(163, 230, 53, 0.1); }
.option.is-wrong { border-color: var(--error); background: rgba(248, 113, 113, 0.1); }
.game-controls { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 22px; }
.hint { font-size: 0.88rem; color: var(--muted); margin: 0; }
.score-big { font-size: clamp(3rem, 12vw, 5rem); font-weight: 900; line-height: 1; }
.level-chip { display: inline-block; padding: 6px 14px; border-radius: 999px; background: rgba(163, 230, 53, 0.12); color: var(--lime); font-weight: 800; border: 1px solid rgba(163, 230, 53, 0.4); }
.class-grid { display: grid; gap: 12px; grid-template-columns: repeat(2, 1fr); }
.class-btn {
  min-height: 84px; border-radius: var(--radius); border: 1.5px solid var(--border); background: var(--bg-2);
  color: var(--text); font: inherit; cursor: pointer; text-align: left; padding: 16px;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}
.class-btn:hover { border-color: var(--violet); transform: translateY(-2px); box-shadow: var(--glow-violet); }
.class-btn strong { display: block; font-size: 1.25rem; }
.class-btn span { font-size: 0.85rem; color: var(--muted); }
.review-list li { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px; list-style: none; margin: 0 0 12px; }
.review-list { padding: 0; }
.review-list .verdict { font-weight: 700; font-size: 0.9rem; }
.verdict.ok { color: var(--lime); }
.verdict.no { color: var(--error); }

/* Reward card */
.reward-card {
  position: relative; overflow: hidden; border-radius: 20px; padding: clamp(22px, 4vw, 34px);
  background: radial-gradient(500px 260px at 100% 0%, rgba(163, 230, 53, 0.18), transparent 60%),
              linear-gradient(160deg, #1E1B3A, #14142A);
  border: 1px solid rgba(163, 230, 53, 0.4); box-shadow: 0 0 40px rgba(163, 230, 53, 0.12);
}
.price-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.price-table td { padding: 10px 0; border-bottom: 1px solid var(--border); }
.price-table td:last-child { text-align: right; font-weight: 700; }
.price-table tr.final td { border-bottom: 0; font-size: 1.25rem; color: var(--lime); }
.price-table s { color: var(--muted); }

/* Leaderboard */
.tabs { display: inline-flex; gap: 6px; background: var(--bg-2); border: 1px solid var(--border); padding: 5px; border-radius: 999px; }
.tab {
  min-height: 42px; padding: 8px 16px; border-radius: 999px; border: 0; background: transparent;
  color: var(--muted); font: inherit; font-weight: 700; cursor: pointer;
}
.tab[aria-selected="true"] { background: var(--violet); color: #fff; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 20px 0; }
select {
  min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-2); color: var(--text); font: inherit;
}
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-2); }
table.board { width: 100%; border-collapse: collapse; min-width: 520px; }
table.board th, table.board td { padding: 14px 12px; text-align: left; border-bottom: 1px solid var(--border); }
table.board th { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
table.board tr:last-child td { border-bottom: 0; }
.rank { font-weight: 800; color: var(--lime); }
.empty-state { text-align: center; padding: 48px 20px; }

/* Blog */
.article { max-width: 760px; margin-inline: auto; }
.article h2 { margin-top: 1.6em; }
.article h3 { margin-top: 1.2em; }
.article ol, .article ul { margin-bottom: 1.2em; }
.breadcrumbs { font-size: 0.88rem; color: var(--muted); margin-bottom: 18px; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; }
.breadcrumbs li + li::before { content: "/"; margin-right: 6px; color: var(--border); }
.breadcrumbs li { margin: 0; }
.answer-key { background: var(--bg-2); border-left: 3px solid var(--lime); border-radius: var(--radius-sm); padding: 14px 18px; margin: 10px 0 18px; }
.byline { font-size: 0.9rem; color: var(--muted); margin-bottom: 26px; }

/* Forms (none in MVP beyond static content) */
.prose-page { max-width: 780px; margin-inline: auto; }
.prose-page h2 { margin-top: 1.5em; }

/* Steps */
.steps { counter-reset: step; list-style: none; padding: 0; display: grid; gap: 16px; }
.steps li { counter-increment: step; position: relative; padding: 20px 20px 20px 72px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); margin: 0; }
.steps li::before {
  content: counter(step); position: absolute; left: 20px; top: 20px; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 900; background: linear-gradient(135deg, var(--violet), var(--cyan)); color: #0B0B14;
}
.steps li + li { margin-top: 0; }

/* Ad slots: intentionally empty unless adsEnabled and an approved account exist */
[data-ad-slot] { display: none; }

/* Responsive */
@media (min-width: 640px) {
  .class-grid { grid-template-columns: repeat(4, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .nav-toggle { display: none; }
  .site-nav {
    display: flex; position: static; flex-direction: row; align-items: center; gap: 4px;
    background: none; border: 0; padding: 0;
  }
  .site-nav a { padding: 8px 12px; font-size: 0.95rem; }
  .site-nav .nav-cta { margin: 0 0 0 8px; padding: 10px 18px; min-height: 42px; }
  .hero-grid { grid-template-columns: 1.1fr 0.9fr; }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
  .options { grid-template-columns: 1fr 1fr; }
}

/* Motion and preference support */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
