/* ==========================================================================
   StudyBonk Design System
   Bonk Blue #4A90E2 · Study Yellow #F5C542 · Clean White · Dark #1A1A1A
   Fonts: Baloo 2 (display) + Nunito (body), bundled locally — no CDN.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --blue: #4a90e2;
  --blue-dark: #3571b9;
  --blue-deep: #28568c;
  --blue-soft: #eaf3fc;
  --yellow: #f5c542;
  --yellow-dark: #e0ac1f;
  --yellow-soft: #fdf6df;
  --white: #ffffff;

  --bg: #f6f9fd;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-2: #f2f6fb;
  --surface-glass: rgba(255, 255, 255, 0.72);
  --text: #1e2633;
  --text-2: #4d5a6c;
  --text-3: #7b8798;
  --border: #e2e9f2;
  --border-2: #cdd8e6;

  --green: #2fb47c;
  --green-soft: #e3f6ee;
  --red: #e2574a;
  --red-soft: #fdeae8;
  --purple: #8a6cf0;
  --purple-soft: #efeafc;
  --orange: #f28c3b;

  --grad-brand: linear-gradient(135deg, #4a90e2 0%, #6fb1f5 50%, #f5c542 130%);
  --grad-blue: linear-gradient(135deg, #4a90e2, #3571b9);
  --grad-warm: linear-gradient(135deg, #f5c542, #f28c3b);
  --grad-mint: linear-gradient(135deg, #2fb47c, #4a90e2);

  --shadow-sm: 0 1px 2px rgba(30, 38, 51, 0.06), 0 2px 8px rgba(30, 38, 51, 0.06);
  --shadow-md: 0 4px 14px rgba(30, 38, 51, 0.08), 0 12px 32px rgba(30, 38, 51, 0.08);
  --shadow-lg: 0 12px 40px rgba(42, 90, 148, 0.16), 0 24px 80px rgba(42, 90, 148, 0.12);
  --shadow-glow: 0 0 0 4px rgba(74, 144, 226, 0.16);

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 32px;
  --r-full: 999px;

  --font-display: "Baloo 2", ui-rounded, -apple-system, "Segoe UI", system-ui, sans-serif;
  --font-body: "Nunito", ui-rounded, -apple-system, "Segoe UI", system-ui, sans-serif;

  --nav-h: 68px;
  --max-w: 1180px;
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
}

[data-theme="dark"] {
  --bg: #14181f;
  --bg-2: #1a1a1a;
  --surface: #1f2530;
  --surface-2: #262d3a;
  --surface-glass: rgba(26, 30, 39, 0.72);
  --text: #eef2f8;
  --text-2: #b6c2d2;
  --text-3: #8391a5;
  --border: #2c3543;
  --border-2: #3a4658;
  --blue-soft: #1d2f4a;
  --yellow-soft: #3a3116;
  --green-soft: #163528;
  --red-soft: #3d1f1c;
  --purple-soft: #2a2340;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.35), 0 12px 32px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.5), 0 24px 80px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 0 4px rgba(74, 144, 226, 0.28);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

/* Buttons must inherit text color (esp. cards/panels inside <button>) —
   otherwise dark mode renders system-black text on dark surfaces. */
button { color: inherit; font-family: inherit; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.18;
  margin: 0 0 0.5em;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); }
h2 { font-size: clamp(1.5rem, 3.2vw, 2.15rem); }
h3 { font-size: clamp(1.15rem, 2.2vw, 1.4rem); }
h4 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
ul, ol { padding-left: 1.3em; margin: 0 0 1em; }
li { margin-bottom: 0.35em; }
strong { color: var(--text); font-weight: 800; }
code, kbd {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.1em 0.4em;
}
kbd { box-shadow: 0 2px 0 var(--border-2); }

hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

::selection { background: var(--yellow); color: #1e2633; }

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

.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 2000;
  background: var(--blue); color: #fff; padding: 10px 18px;
  border-radius: var(--r-full); font-weight: 800;
}
.skip-link:focus { left: 8px; }

/* ---------- Layout ---------- */
.container { width: min(var(--max-w), 100% - 2.5rem); margin-inline: auto; }
.section { padding: clamp(3rem, 7vw, 5.5rem) 0; }
.section-sm { padding: clamp(2rem, 4vw, 3rem) 0; }
.section-head { max-width: 720px; margin: 0 auto clamp(2rem, 4vw, 3rem); text-align: center; }
.section-head p { color: var(--text-2); font-size: 1.06rem; margin-bottom: 0; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 0.8rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--blue);
  background: var(--blue-soft); border: 1px solid color-mix(in srgb, var(--blue) 25%, transparent);
  padding: 6px 14px; border-radius: var(--r-full); margin-bottom: 14px;
}
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 960px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-family: var(--font-display); font-weight: 700; font-size: 1rem;
  padding: 13px 26px; border-radius: var(--r-full);
  border: 2px solid transparent; cursor: pointer;
  text-decoration: none !important;
  transition: transform 0.18s var(--ease-pop), box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
  will-change: transform;
}
.btn:active { transform: scale(0.96); }
.btn-primary {
  background: var(--grad-blue); color: #fff;
  box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}
.btn-primary:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 10px 28px rgba(74, 144, 226, 0.5); }
.btn-yellow {
  background: var(--grad-warm); color: #4a3305;
  box-shadow: 0 6px 20px rgba(245, 197, 66, 0.45);
}
.btn-yellow:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 10px 28px rgba(245, 197, 66, 0.55); }
.btn-ghost {
  background: var(--surface); color: var(--text);
  border-color: var(--border-2);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); transform: translateY(-3px); }
.btn-sm { padding: 8px 18px; font-size: 0.92rem; }
.btn-lg { padding: 16px 34px; font-size: 1.1rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none !important; }
.btn-row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }

/* ---------- Navbar ---------- */
.nav-wrap {
  position: sticky; top: 0; z-index: 1000;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  background: var(--surface-glass);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex; align-items: center; gap: 10px;
  min-height: var(--nav-h);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 800; font-size: 1.35rem;
  color: var(--text); text-decoration: none !important;
  margin-right: auto;
}
.brand-logo { width: 38px; height: 38px; transition: transform 0.4s var(--ease-pop); }
.brand:hover .brand-logo { transform: rotate(-12deg) scale(1.12); }
.brand-name em { font-style: normal; color: var(--blue); }

.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav-links a {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-2); font-weight: 700; font-size: 0.95rem;
  padding: 9px 13px; border-radius: var(--r-full);
  text-decoration: none !important;
  transition: color 0.15s, background 0.15s;
}
.nav-links a:hover { color: var(--blue); background: var(--blue-soft); }
.nav-links a[aria-current="page"] { color: var(--blue); background: var(--blue-soft); }
.nav-badge {
  font-size: 0.66rem; font-weight: 800; letter-spacing: 0.06em;
  background: var(--grad-mint); color: #fff;
  padding: 2px 8px; border-radius: var(--r-full); text-transform: uppercase;
}

.nav-actions { display: flex; align-items: center; gap: 10px; }

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; border-radius: var(--r-full);
  background: var(--surface-2); border: 1px solid var(--border);
  cursor: pointer; color: var(--text);
  transition: transform 0.3s var(--ease-pop), border-color 0.2s;
}
.theme-toggle:hover { transform: rotate(20deg) scale(1.1); border-color: var(--yellow); }
.theme-toggle svg { width: 20px; height: 20px; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

.nav-burger {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 42px; height: 42px; border-radius: var(--r-full);
  background: var(--surface-2); border: 1px solid var(--border);
  cursor: pointer; padding: 0; align-items: center;
}
.nav-burger span {
  width: 18px; height: 2.5px; border-radius: 2px; background: var(--text);
  transition: transform 0.25s ease, opacity 0.2s;
}
.nav-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.nav-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

@media (max-width: 900px) {
  .nav-burger { display: flex; }
  .nav-links {
    position: fixed; inset: var(--nav-h) 0 auto 0; z-index: 999;
    flex-direction: column; align-items: stretch; gap: 6px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    padding: 18px 1.5rem calc(18px + env(safe-area-inset-bottom));
    box-shadow: var(--shadow-lg);
    transform: translateY(-12px); opacity: 0; visibility: hidden;
    transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s;
    max-height: calc(100dvh - var(--nav-h)); overflow-y: auto;
  }
  .nav-links.open { transform: translateY(0); opacity: 1; visibility: visible; }
  .nav-links a { padding: 13px 16px; font-size: 1.05rem; }
  .nav-cta-desktop { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: clamp(3.5rem, 8vw, 6.5rem) 0 clamp(3rem, 7vw, 5.5rem);
  background:
    radial-gradient(60% 55% at 12% 8%, rgba(74, 144, 226, 0.16), transparent 60%),
    radial-gradient(50% 45% at 90% 15%, rgba(245, 197, 66, 0.18), transparent 60%),
    radial-gradient(45% 45% at 80% 95%, rgba(138, 108, 240, 0.12), transparent 60%),
    var(--bg);
}
.hero-grid {
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 3rem; align-items: center;
}
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }
.hero h1 { margin-bottom: 0.4em; }
.hero .lead { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--text-2); max-width: 34em; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 10px; margin: 1.4rem 0 0; }
.hero-art { position: relative; display: flex; justify-content: center; }
.hero-mascot { width: min(340px, 70vw); filter: drop-shadow(0 24px 40px rgba(74, 144, 226, 0.25)); animation: floaty 5s ease-in-out infinite; }
.float-chip {
  position: absolute; display: flex; align-items: center; gap: 8px;
  background: var(--surface-glass); backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: var(--r-full);
  padding: 8px 16px; font-weight: 800; font-size: 0.9rem;
  box-shadow: var(--shadow-md); animation: floaty 6s ease-in-out infinite;
}
.float-chip small { color: var(--text-3); font-weight: 700; }
.chip-1 { top: 8%; left: 2%; animation-delay: 0.8s; }
.chip-2 { bottom: 18%; right: 0; animation-delay: 1.6s; }
.chip-3 { bottom: -4%; left: 12%; animation-delay: 2.4s; }
@media (max-width: 640px) { .float-chip { display: none; } }

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

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: clamp(1.4rem, 3vw, 2rem);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease-pop), box-shadow 0.25s ease, border-color 0.25s ease;
}
.card-hover:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-md);
  border-color: color-mix(in srgb, var(--blue) 40%, var(--border));
}
.card-glass {
  background: var(--surface-glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.card-link { text-decoration: none !important; color: inherit; display: block; height: 100%; }
.card-link h3 { color: var(--text); }
.card-link:hover h3 { color: var(--blue); }
.card-icon {
  width: 56px; height: 56px; border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; margin-bottom: 1rem;
  background: var(--blue-soft);
}
.card-icon.yellow { background: var(--yellow-soft); }
.card-icon.green { background: var(--green-soft); }
.card-icon.purple { background: var(--purple-soft); }
.card p { color: var(--text-2); margin-bottom: 0; }
.card-kicker { font-size: 0.78rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); margin-bottom: 6px; }

/* Topic cards */
.topic-card { position: relative; overflow: hidden; }
.topic-card::after {
  content: ""; position: absolute; inset: auto -30% -55% -30%; height: 70%;
  background: var(--grad-brand); opacity: 0.07; border-radius: 50%;
  transition: opacity 0.3s;
}
.topic-card:hover::after { opacity: 0.14; }
.topic-emoji { font-size: 2.2rem; line-height: 1; margin-bottom: 0.6rem; }
.topic-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1rem; }

/* ---------- Chips & badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); font-weight: 800; font-size: 0.82rem;
  padding: 6px 13px; border-radius: var(--r-full);
}
.chip-blue { background: var(--blue-soft); color: var(--blue-dark); border-color: color-mix(in srgb, var(--blue) 25%, transparent); }
.chip-yellow { background: var(--yellow-soft); color: var(--yellow-dark); border-color: color-mix(in srgb, var(--yellow) 45%, transparent); }
.chip-green { background: var(--green-soft); color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
[data-theme="dark"] .chip-blue { color: #8db9ec; }
[data-theme="dark"] .chip-yellow { color: #f2d47c; }
[data-theme="dark"] .chip-green { color: #6fd6a8; }

.tech-badges { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

/* ---------- Reminder band ---------- */
.reminders {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: center;
}
.reminder {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 0.92rem; color: var(--text-2);
  background: var(--surface); border: 1.5px dashed var(--border-2);
  padding: 9px 18px; border-radius: var(--r-full);
}

/* ---------- Feature grid ---------- */
.feature-card { text-align: left; position: relative; }
.feature-card .btn-row { margin-top: 1rem; }

/* ---------- Testimonials ---------- */
.testimonial { position: relative; }
.testimonial blockquote {
  margin: 0 0 1.2rem; font-size: 1.02rem; color: var(--text-2);
  font-style: italic; position: relative; padding-left: 1.2rem;
  border-left: 3px solid var(--yellow);
}
.testimonial-quote-mark {
  font-family: var(--font-display); font-size: 3rem; line-height: 1;
  color: var(--blue); opacity: 0.25; position: absolute; top: -12px; right: 8px;
}
.testimonial-author { display: flex; align-items: center; gap: 12px; }
.testimonial-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; background: var(--grad-brand); flex-shrink: 0;
}
.testimonial-author strong { display: block; font-size: 0.95rem; }
.testimonial-author span { font-size: 0.8rem; color: var(--text-3); }

/* ---------- Comparison ---------- */
.compare-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; align-items: stretch; }
@media (max-width: 760px) { .compare-grid { grid-template-columns: 1fr; } }
.compare-card { display: flex; flex-direction: column; }
.compare-card.highlight {
  border: 2.5px solid var(--blue);
  box-shadow: var(--shadow-lg);
  position: relative;
}
.compare-card.highlight::before {
  content: "Most loved by students";
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  background: var(--grad-warm); color: #4a3305; font-weight: 800; font-size: 0.75rem;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 16px; border-radius: var(--r-full); white-space: nowrap;
}
.compare-rows { list-style: none; margin: 1.2rem 0; padding: 0; flex: 1; }
.compare-rows li {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 2px; border-bottom: 1px dashed var(--border);
  font-size: 0.95rem;
}
.compare-rows li:last-child { border-bottom: 0; }
.compare-yes { color: var(--green); font-weight: 800; flex-shrink: 0; }
.compare-no { color: var(--red); font-weight: 800; flex-shrink: 0; }
.compare-mid { color: var(--orange); font-weight: 800; flex-shrink: 0; }
.compare-price {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; margin: 0.6rem 0 0.2rem;
}

/* ---------- FAQ / PAA ---------- */
.faq-list { display: grid; gap: 12px; max-width: 780px; margin-inline: auto; }
details.faq {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 0; overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
details.faq[open] { border-color: color-mix(in srgb, var(--blue) 45%, var(--border)); box-shadow: var(--shadow-sm); }
details.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  cursor: pointer; list-style: none; padding: 17px 20px;
  font-family: var(--font-display); font-weight: 700; font-size: 1.02rem;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after {
  content: "+"; font-size: 1.5rem; font-weight: 400; color: var(--blue);
  transition: transform 0.25s var(--ease-pop); line-height: 1;
}
details.faq[open] summary::after { transform: rotate(45deg); }
details.faq .faq-body { padding: 0 20px 18px; color: var(--text-2); }
details.faq .faq-body p:last-child { margin-bottom: 0; }

/* ---------- Trust / E-E-A-T ---------- */
.trust-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
@media (max-width: 960px) { .trust-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .trust-grid { grid-template-columns: 1fr; } }
.trust-item .card-icon { width: 48px; height: 48px; font-size: 1.4rem; border-radius: 14px; }

.byline {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 16px 20px;
}
.byline img {
  width: 60px; height: 60px; border-radius: 50%; flex-shrink: 0;
  border: 3px solid var(--yellow);
}
.byline-text strong { display: block; font-family: var(--font-display); font-size: 1.02rem; }
.byline-text span { font-size: 0.85rem; color: var(--text-3); }

.compliance-strip { font-size: 0.9rem; }
.compliance-strip ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.compliance-strip li {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-full); padding: 5px 13px; font-weight: 700;
  color: var(--text-2); font-size: 0.82rem; margin: 0;
  display: inline-flex; align-items: center; gap: 6px;
}
.compliance-strip li::before { content: "✓"; color: var(--green); font-weight: 800; }

/* ---------- Breadcrumbs ---------- */
.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.88rem; margin-bottom: 1.2rem; color: var(--text-3); }
.breadcrumb a { color: var(--text-3); font-weight: 700; }
.breadcrumb a:hover { color: var(--blue); }
.breadcrumb .sep { opacity: 0.5; }
.breadcrumb [aria-current] { color: var(--text-2); font-weight: 800; }

/* ---------- Article / lesson ---------- */
.article { max-width: 780px; }
.article h2 { margin-top: 2.2em; }
.article h3 { margin-top: 1.6em; }
.article p { color: var(--text-2); font-size: 1.03rem; }
.article ul li, .article ol li { color: var(--text-2); }
.lesson-box {
  background: var(--yellow-soft); border: 1.5px solid color-mix(in srgb, var(--yellow) 50%, transparent);
  border-radius: var(--r-md); padding: 18px 22px; margin: 1.5rem 0;
}
.lesson-box h3 { margin-top: 0; }
.example-box {
  background: var(--blue-soft); border-left: 4px solid var(--blue);
  border-radius: 0 var(--r-md) var(--r-md) 0; padding: 18px 22px; margin: 1.5rem 0;
}
.example-box .example-title {
  font-family: var(--font-display); font-weight: 800; margin-bottom: 0.4rem; color: var(--blue-dark);
}
[data-theme="dark"] .example-box .example-title { color: #8db9ec; }
.concept-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .concept-list { grid-template-columns: 1fr; } }
.concept {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 14px 18px;
}
.concept strong { display: block; font-family: var(--font-display); margin-bottom: 2px; }
.concept span { font-size: 0.92rem; color: var(--text-2); }

.toc {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 18px 22px; margin: 1.8rem 0;
}
.toc strong { font-family: var(--font-display); display: block; margin-bottom: 8px; }
.toc ul { margin: 0; padding-left: 1.1em; }

/* ---------- CTA band ---------- */
.cta-band {
  position: relative; overflow: hidden;
  background: var(--grad-brand);
  border-radius: var(--r-xl);
  padding: clamp(2.5rem, 6vw, 4rem);
  text-align: center; color: #fff;
  box-shadow: var(--shadow-lg);
}
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255, 255, 255, 0.92); font-size: 1.08rem; max-width: 34em; margin-inline: auto; }
.cta-band .btn { background: #fff; color: var(--blue-dark); }
.cta-band .btn:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--r-md); border: 1px solid var(--border); }
table.compare-table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 0.95rem; min-width: 560px; }
table.compare-table th, table.compare-table td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--border); }
table.compare-table th { font-family: var(--font-display); background: var(--surface-2); font-size: 0.92rem; }
table.compare-table tr:last-child td { border-bottom: 0; }
table.compare-table td:first-child { font-weight: 800; }

/* ---------- Creator block ---------- */
.creator-band {
  display: flex; gap: clamp(1.2rem, 3vw, 2.2rem); align-items: center; flex-wrap: wrap;
}
.creator-band img {
  width: 96px; height: 96px; border-radius: 50%; flex-shrink: 0;
  border: 4px solid var(--yellow); box-shadow: var(--shadow-md);
}
.creator-creds { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.creator-sign {
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
  color: var(--text-2); font-style: italic;
}

/* ---------- Socials ---------- */
.social-row { display: flex; gap: 12px; flex-wrap: wrap; }
.social-btn {
  display: inline-flex; align-items: center; gap: 9px;
  font-weight: 800; font-size: 0.92rem; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-full); padding: 9px 18px;
  text-decoration: none !important;
  transition: transform 0.2s var(--ease-pop), border-color 0.2s, color 0.2s;
}
.social-btn:hover { transform: translateY(-3px); border-color: var(--blue); color: var(--blue); }
.social-btn svg { width: 18px; height: 18px; }

/* ---------- Footer ---------- */
.footer {
  background: var(--bg-2); border-top: 1px solid var(--border);
  padding: clamp(2.5rem, 6vw, 4rem) 0 2rem; margin-top: 4rem;
}
.footer-grid {
  display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 2rem;
}
@media (max-width: 960px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-brand p { color: var(--text-3); font-size: 0.92rem; margin: 0.8rem 0 1.2rem; }
.footer-col h3 { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); }
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col a {
  color: var(--text-2); font-size: 0.94rem; font-weight: 600;
  display: inline-block; padding: 4px 0; text-decoration: none;
}
.footer-col a:hover { color: var(--blue); }
.footer-bottom {
  margin-top: 2.5rem; padding-top: 1.6rem; border-top: 1px solid var(--border);
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center;
  color: var(--text-3); font-size: 0.85rem;
}

/* ---------- Toasts ---------- */
.toast-zone {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 1500; display: flex; flex-direction: column; gap: 10px;
  align-items: center; pointer-events: none; width: min(420px, calc(100vw - 2rem));
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 13px 20px; font-weight: 700; font-size: 0.95rem;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.35s var(--ease-pop);
  max-width: 100%;
}
.toast.leaving { animation: toast-out 0.3s ease forwards; }
.toast-xp { border-left: 4px solid var(--yellow); }
.toast-level { border-left: 4px solid var(--purple); }
.toast-info { border-left: 4px solid var(--blue); }
.toast-good { border-left: 4px solid var(--green); }
@keyframes toast-in { from { transform: translateY(24px) scale(0.92); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(16px) scale(0.94); opacity: 0; } }

/* ---------- FAB ---------- */
.fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 1400;
  display: inline-flex; align-items: center; gap: 10px;
  background: var(--grad-blue); color: #fff;
  font-family: var(--font-display); font-weight: 700; font-size: 0.98rem;
  padding: 14px 22px; border-radius: var(--r-full);
  box-shadow: 0 10px 30px rgba(74, 144, 226, 0.5);
  text-decoration: none !important;
  transition: transform 0.25s var(--ease-pop), box-shadow 0.25s;
}
.fab:hover { transform: translateY(-4px) scale(1.05); box-shadow: 0 16px 40px rgba(74, 144, 226, 0.6); }
.fab svg { width: 22px; height: 22px; }
@media (max-width: 640px) { .fab { padding: 13px 17px; } .fab .fab-label { display: none; } }

/* ---------- Gamification widgets ---------- */
.xp-ring { position: relative; width: 130px; height: 130px; margin-inline: auto; }
.xp-ring svg { transform: rotate(-90deg); }
.xp-ring .ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 10; }
.xp-ring .ring-fg { fill: none; stroke: var(--blue); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease-pop); }
.xp-ring .ring-label {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
}
.xp-ring .ring-label strong { font-family: var(--font-display); font-size: 1.5rem; line-height: 1.1; }
.xp-ring .ring-label span { font-size: 0.72rem; color: var(--text-3); font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }

.level-bar { height: 14px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; border: 1px solid var(--border); }
.level-bar > div {
  height: 100%; background: var(--grad-brand); border-radius: var(--r-full);
  transition: width 0.8s var(--ease-pop); position: relative;
}
.streak-flame { font-size: 1.6rem; }
.streak-flame.lit { animation: flame-flicker 1.6s ease-in-out infinite; display: inline-block; }
@keyframes flame-flicker {
  0%, 100% { transform: scale(1) rotate(-2deg); }
  50% { transform: scale(1.12) rotate(3deg); }
}

.quest-list { display: grid; gap: 12px; }
.quest {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 14px 18px;
}
.quest .quest-icon { font-size: 1.5rem; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); border-radius: 12px; flex-shrink: 0; }
.quest .quest-info { flex: 1; min-width: 0; }
.quest .quest-info strong { display: block; font-size: 0.96rem; }
.quest .quest-info .level-bar { height: 8px; margin-top: 6px; }
.quest .quest-meta { font-size: 0.8rem; color: var(--text-3); font-weight: 700; }
.quest.done { border-color: color-mix(in srgb, var(--green) 50%, var(--border)); background: var(--green-soft); }
.quest.done .quest-icon { filter: grayscale(0.3); }

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 12px; }
.badge-tile {
  text-align: center; padding: 16px 10px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--border);
  transition: transform 0.25s var(--ease-pop);
}
.badge-tile:hover { transform: translateY(-4px) rotate(-1.5deg); }
.badge-tile .badge-emoji { font-size: 2rem; display: block; margin-bottom: 6px; }
.badge-tile strong { font-size: 0.82rem; display: block; font-family: var(--font-display); }
.badge-tile span { font-size: 0.7rem; color: var(--text-3); }
.badge-tile.locked { opacity: 0.38; filter: grayscale(1); }

.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 3px; overflow-x: auto; padding-bottom: 6px; }
.heatmap-cell { width: 13px; height: 13px; border-radius: 3px; background: var(--surface-2); }
.heatmap-cell[data-level="1"] { background: color-mix(in srgb, var(--blue) 30%, var(--surface-2)); }
.heatmap-cell[data-level="2"] { background: color-mix(in srgb, var(--blue) 55%, white); }
.heatmap-cell[data-level="3"] { background: var(--blue); }
.heatmap-cell[data-level="4"] { background: var(--blue-dark); }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 1rem; }
.stat-box {
  text-align: center; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 18px 12px;
}
.stat-box strong { font-family: var(--font-display); font-size: 1.7rem; display: block; color: var(--blue); }
.stat-box span { font-size: 0.8rem; color: var(--text-3); font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1600;
  background: rgba(15, 20, 30, 0.55); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 1.5rem;
  opacity: 0; visibility: hidden; transition: opacity 0.25s, visibility 0.25s;
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: var(--surface); border-radius: var(--r-lg); max-width: 440px; width: 100%;
  padding: 2.2rem; text-align: center; box-shadow: var(--shadow-lg);
  transform: scale(0.85); transition: transform 0.35s var(--ease-pop);
}
.modal-overlay.open .modal { transform: scale(1); }
.modal .modal-emoji { font-size: 3.4rem; display: block; margin-bottom: 0.6rem; animation: floaty 3s ease-in-out infinite; }

/* ---------- Flashcards ---------- */
.flashcard-stage { perspective: 1400px; max-width: 620px; margin-inline: auto; }
.flashcard {
  position: relative; width: 100%; min-height: 320px;
  transform-style: preserve-3d; cursor: pointer;
  transition: transform 0.55s var(--ease-pop);
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 2rem;
  border-radius: var(--r-xl); backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: var(--shadow-md);
}
.flashcard-front {
  background: var(--surface); border: 2px solid var(--border-2);
}
.flashcard-back {
  background: var(--grad-blue); color: #fff; transform: rotateY(180deg);
  border: 2px solid transparent;
}
.flashcard-face .face-label {
  position: absolute; top: 16px; left: 20px;
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-3);
}
.flashcard-back .face-label { color: rgba(255, 255, 255, 0.7); }
.flashcard-face .face-text {
  font-family: var(--font-display); font-size: clamp(1.15rem, 2.6vw, 1.5rem); font-weight: 700;
  line-height: 1.35; overflow: auto;
}
.flashcard-hint { text-align: center; color: var(--text-3); font-size: 0.85rem; margin-top: 12px; }
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.2rem; }

/* ---------- Quiz ---------- */
.quiz-question { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; }
.quiz-choices { display: grid; gap: 10px; margin-top: 1.2rem; }
.quiz-choice {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--surface); border: 2px solid var(--border);
  border-radius: var(--r-md); padding: 14px 18px;
  font-family: var(--font-body); font-size: 1rem; font-weight: 700; color: var(--text);
  cursor: pointer; transition: border-color 0.15s, transform 0.15s var(--ease-pop), background 0.15s;
}
.quiz-choice:hover:not(:disabled) { border-color: var(--blue); transform: translateX(4px); }
.quiz-choice .choice-letter {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); font-weight: 800; font-size: 0.85rem;
}
.quiz-choice.correct { border-color: var(--green); background: var(--green-soft); }
.quiz-choice.correct .choice-letter { background: var(--green); color: #fff; }
.quiz-choice.wrong { border-color: var(--red); background: var(--red-soft); }
.quiz-choice.wrong .choice-letter { background: var(--red); color: #fff; }
.quiz-choice:disabled { cursor: default; opacity: 0.9; }
.quiz-explain {
  background: var(--blue-soft); border-radius: var(--r-md); padding: 14px 18px;
  margin-top: 1rem; font-size: 0.95rem; color: var(--text-2);
  border-left: 4px solid var(--blue); animation: fade-up 0.3s ease;
}
.quiz-progress { display: flex; gap: 5px; margin-bottom: 1.2rem; }
.quiz-progress span { flex: 1; height: 7px; border-radius: 4px; background: var(--surface-2); }
.quiz-progress span.done { background: var(--blue); }
.quiz-progress span.current { background: var(--yellow); }

/* ---------- Focus timer ---------- */
.timer-dial { position: relative; width: 280px; height: 280px; margin-inline: auto; }
.timer-dial svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.timer-dial .dial-bg { fill: none; stroke: var(--surface-2); stroke-width: 14; }
.timer-dial .dial-fg { fill: none; stroke: var(--blue); stroke-width: 14; stroke-linecap: round; transition: stroke-dashoffset 0.5s linear, stroke 0.4s; }
.timer-dial.break .dial-fg { stroke: var(--green); }
.timer-dial .dial-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.timer-time { font-family: var(--font-display); font-size: 3.2rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.timer-mode { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-3); margin-top: 6px; }
.timer-mascot { width: 64px; margin-inline: auto; }
.timer-mascot.hyped { animation: bonk-bounce 0.6s var(--ease-pop) infinite alternate; }
@keyframes bonk-bounce { from { transform: translateY(0) rotate(-3deg); } to { transform: translateY(-12px) rotate(4deg); } }

/* ---------- Chat / AI ---------- */
.chat-window {
  display: flex; flex-direction: column; height: min(600px, 70vh);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-md);
}
.chat-log { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.chat-msg { display: flex; gap: 12px; max-width: 88%; animation: fade-up 0.3s ease; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--grad-brand); font-size: 1.2rem;
}
.chat-msg.user .chat-avatar { background: var(--surface-2); border: 1px solid var(--border); font-size: 1rem; }
.chat-bubble {
  padding: 12px 17px; border-radius: 18px; font-size: 0.98rem; line-height: 1.55;
  background: var(--surface-2); border: 1px solid var(--border);
  border-top-left-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.chat-msg.user .chat-bubble {
  background: var(--grad-blue); color: #fff; border: none; border-top-left-radius: 18px; border-top-right-radius: 6px;
}
.chat-bubble .chat-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.chat-typing { display: inline-flex; gap: 5px; padding: 6px 2px; }
.chat-typing span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--text-3);
  animation: typing-bounce 1.2s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-6px); opacity: 1; } }

.chat-input-row { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--border); background: var(--surface-2); }
.chat-input-row input, .chat-input-row textarea {
  flex: 1; font-family: var(--font-body); font-size: 1rem;
  background: var(--surface); color: var(--text);
  border: 2px solid var(--border); border-radius: var(--r-full);
  padding: 12px 20px; outline: none; transition: border-color 0.2s;
}
.chat-input-row input:focus, .chat-input-row textarea:focus { border-color: var(--blue); }
.chat-send {
  width: 50px; height: 50px; border-radius: 50%; flex-shrink: 0;
  background: var(--grad-blue); color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s var(--ease-pop);
}
.chat-send:hover { transform: scale(1.1) rotate(-8deg); }
.chat-send svg { width: 20px; height: 20px; }

.quick-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 12px; background: var(--surface-2); }
.quick-chip {
  font-size: 0.82rem; font-weight: 800; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-full); padding: 7px 14px; cursor: pointer;
  transition: border-color 0.15s, color 0.15s, transform 0.15s;
}
.quick-chip:hover { border-color: var(--blue); color: var(--blue); transform: translateY(-2px); }

.mode-switch { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-full); padding: 4px; gap: 4px; flex-wrap: wrap; }
.mode-switch button {
  border: none; background: transparent; cursor: pointer;
  font-family: var(--font-body); font-weight: 800; font-size: 0.88rem;
  color: var(--text-2); padding: 8px 18px; border-radius: var(--r-full);
  transition: background 0.2s, color 0.2s;
}
.mode-switch button.active { background: var(--surface); color: var(--blue); box-shadow: var(--shadow-sm); }

.model-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.model-card { text-align: center; cursor: pointer; position: relative; }
.model-card .model-tag { position: absolute; top: -10px; right: 14px; }
.model-card.recommended { border: 2px solid var(--blue); }
.model-card .model-emoji { font-size: 1.9rem; }
.model-card .model-ram { color: var(--text-3); font-size: 0.8rem; font-weight: 800; }

.progress-track { height: 12px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; border: 1px solid var(--border); }
.progress-track > div { height: 100%; background: var(--grad-mint); width: 0%; transition: width 0.3s ease; }

/* ---------- Motd / misc ---------- */
.kbd-hint { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; color: var(--text-3); font-size: 0.85rem; font-weight: 700; }

.confetti-canvas { position: fixed; inset: 0; pointer-events: none; z-index: 1800; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.reveal { opacity: 0; }
.reveal.visible { animation: fade-up 0.6s ease forwards; }

@keyframes pop-in {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.pop-in { animation: pop-in 0.4s var(--ease-pop); }

@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

/* ---------- 404 ---------- */
.error-hero { text-align: center; padding: clamp(4rem, 10vw, 7rem) 0; }
.error-hero .hero-mascot { margin-inline: auto; }
.error-code {
  font-family: var(--font-display); font-size: clamp(4rem, 14vw, 8rem); font-weight: 800;
  background: var(--grad-brand); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; line-height: 1;
}

/* ---------- Utilities ---------- */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; } .mt-4 { margin-top: 2.5rem; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; }
.muted { color: var(--text-2); }
.small { font-size: 0.88rem; }
.nowrap { white-space: nowrap; }

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