/* ============================================================
   CircuitQuest — single-hue lime design system
   Accent: #81f700 only. Neutrals: warm gray-greens.
   ============================================================ */

/* ---------- Fonts (bundled locally) ---------- */
@font-face {
  font-family: 'Quicksand';
  src: url('../fonts/Quicksand-var.woff2') format('woff2');
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cascadia Mono Local';
  src: url('../fonts/JetBrainsMono-var.woff2') format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Cascadia Mono Local';
  src: url('../fonts/JetBrainsMono-italic.woff2') format('woff2');
  font-weight: 100 800;
  font-style: italic;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --lime: #81f700;
  --lime-strong: #81f700;
  --lime-deep: #4f9c00;
  --lime-soft: color-mix(in srgb, #81f700 14%, transparent);
  --lime-softer: color-mix(in srgb, #81f700 8%, transparent);
  --lime-mid: color-mix(in srgb, #81f700 32%, transparent);
  --lime-bright: #b6ff5e;

  --bg: #f7fbf1;
  --surface: #ffffff;
  --surface-2: #fbfdf7;
  --ink: #16220f;
  --muted: #61735a;
  --line: #e2ecd6;
  --line-strong: #cfdfbc;

  --dark: #0a120a;
  --dark-2: #0e1a0c;

  --warn-bg: color-mix(in srgb, #64755c 10%, transparent);
  --warn-ink: #4d5c46;

  --shadow-card: 0 1px 2px rgba(22, 34, 15, 0.05), 0 10px 30px rgba(22, 34, 15, 0.07);
  --shadow-lift: 0 2px 4px rgba(22, 34, 15, 0.06), 0 16px 40px rgba(22, 34, 15, 0.11);
  --shadow-lime: 0 6px 18px rgba(129, 247, 0, 0.35);
  --shadow-lime-big: 0 10px 34px rgba(129, 247, 0, 0.45);

  --r-card: 16px;
  --r-pill: 999px;

  --font-ui: 'Quicksand', 'Trebuchet MS', sans-serif;
  --font-mono: 'Cascadia Mono Local', 'Cascadia Mono', 'JetBrains Mono', ui-monospace, Consolas, monospace;
}

html[data-theme='dark'] {
  --bg: #060c06;
  --surface: #0a120a;
  --surface-2: #0d170b;
  --ink: #ecf6df;
  --muted: #9aab8e;
  --line: #1c2b19;
  --line-strong: #2a3d25;
  --warn-bg: color-mix(in srgb, #9aab8e 12%, transparent);
  --warn-ink: #aebb9f;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 12px 34px rgba(0, 0, 0, 0.45);
  --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.5), 0 18px 44px rgba(0, 0, 0, 0.55);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-weight: 500;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  min-height: 100vh;
}
img, svg { max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
::selection { background: color-mix(in srgb, var(--lime) 40%, transparent); color: var(--ink); }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; border-radius: 6px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--lime) 26%, transparent);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: color-mix(in srgb, var(--lime) 55%, transparent); background-clip: content-box; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num, .tabular { font-variant-numeric: tabular-nums; }

/* ---------- Ambient background ---------- */
.ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.ambient .dotgrid {
  position: absolute; inset: 0;
  background: radial-gradient(color-mix(in srgb, var(--lime) 16%, transparent) 1px, transparent 1.5px) 0 0 / 26px 26px;
  opacity: 0.5;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,0.7), rgba(0,0,0,0.15) 55%, transparent);
}
.orb {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, var(--lime) 0%, transparent 70%);
  filter: blur(70px); opacity: 0.13;
  animation: orbDrift 26s ease-in-out infinite alternate;
}
.orb-a { width: 44vw; height: 44vw; top: -12vw; left: -10vw; }
.orb-b { width: 34vw; height: 34vw; top: 34vh; right: -12vw; animation-duration: 32s; animation-delay: -6s; }
.orb-c { width: 30vw; height: 30vw; bottom: -14vw; left: 22vw; animation-duration: 38s; animation-delay: -14s; opacity: 0.10; }
@keyframes orbDrift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(4vw, 3vh) scale(1.08); }
  100% { transform: translate(-3vw, -2vh) scale(0.96); }
}

/* ---------- Splash ---------- */
#splash {
  position: fixed; inset: 0; z-index: 200;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: opacity 0.4s ease, transform 0.4s ease, filter 0.4s ease;
}
#splash.hide { opacity: 0; transform: scale(1.12); filter: blur(8px); pointer-events: none; }
#splash.gone { display: none; }
.splash-inner { text-align: center; animation: splashPop 0.7s cubic-bezier(0.22, 1.4, 0.36, 1) both; }
.splash-logo { position: relative; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 18px; }
.splash-ring {
  position: absolute; width: 150px; height: 150px; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--lime) 55%, transparent);
  animation: ringPulse 1.6s ease-out infinite;
}
.splash-mark {
  width: 92px; height: 92px; border-radius: 24px;
  background: linear-gradient(135deg, #4f9c00, var(--lime));
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lime-big), inset 0 2px 0 rgba(255,255,255,0.35);
  animation: splashZoom 0.8s cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
.splash-mark svg { width: 52px; height: 52px; }
.splash-badge {
  position: absolute; bottom: -14px; right: -58px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 5px 10px; border-radius: var(--r-pill);
  box-shadow: var(--shadow-card);
  animation: floatBadge 3s ease-in-out infinite;
}
.splash-title { font-size: 26px; font-weight: 700; margin-bottom: 16px; }
.splash-bar {
  width: 210px; height: 6px; margin: 0 auto; border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--lime) 14%, transparent); overflow: hidden;
  position: relative;
}
.splash-bar span {
  position: absolute; inset: 0; border-radius: inherit;
  background: linear-gradient(90deg, #4f9c00, var(--lime), #d8ffb0);
  transform-origin: left;
  animation: sweep 1.9s cubic-bezier(0.4, 0, 0.2, 1) both;
  box-shadow: 0 0 12px rgba(129, 247, 0, 0.5);
}
@keyframes sweep { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes splashPop { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes splashZoom { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes ringPulse {
  0% { transform: scale(0.82); opacity: 0.9; }
  100% { transform: scale(1.25); opacity: 0; }
}
@keyframes floatBadge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
body.splash-lock { overflow: hidden; }

/* ---------- App shell ---------- */
.app { position: relative; z-index: 1; max-width: 1080px; margin: 0 auto; padding: 0 18px 70px; }
.app > * { animation: routeIn 0.42s cubic-bezier(0.16, 1, 0.3, 1) backwards; }
@keyframes routeIn { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: translateY(0); } }

/* reveal with stagger — fill-mode BACKWARDS so finished transforms never
   create a containing block that breaks position:fixed children */
.reveal { animation: riseIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards; animation-delay: var(--d, 0s); }
@keyframes riseIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Floating pill navbar ---------- */
.navwrap {
  position: sticky; top: 14px; z-index: 100;
  max-width: 1080px; margin: 0 auto; padding: 0 18px;
}
.pillnav {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-card), inset 0 1px 0 color-mix(in srgb, var(--lime) 30%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, #4f9c00, var(--lime));
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lime), inset 0 1px 0 rgba(255,255,255,0.4);
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-name { font-weight: 700; font-size: 16.5px; letter-spacing: -0.01em; white-space: nowrap; }

.navlinks { display: flex; align-items: center; gap: 2px; margin: 0 auto; }
.navlink {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 12px; border-radius: var(--r-pill);
  font-weight: 600; font-size: 13.5px; color: var(--muted);
  border: 1px solid transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
  white-space: nowrap;
}
.navlink-ic { display: inline-flex; width: 15px; height: 15px; }
.navlink-ic svg { width: 15px; height: 15px; }
.navlink:hover { background: var(--lime-softer); color: var(--ink); }
.navlink:active { transform: scale(0.96); }
.navlink.active {
  background: var(--lime-soft); border-color: color-mix(in srgb, var(--lime) 55%, transparent);
  color: var(--ink);
}

.nav-right { margin-left: auto; flex: none; display: flex; align-items: center; gap: 8px; }
.progress-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 11px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface-2);
  font-weight: 700; font-size: 12.5px;
  transition: border-color 0.2s, transform 0.15s;
}
.progress-pill:hover { border-color: var(--lime); transform: translateY(-1px); }
.pp-ic { display: inline-flex; width: 13px; height: 13px; color: var(--lime-deep); }
html[data-theme='dark'] .pp-ic { color: var(--lime); }
.pp-ic svg { width: 13px; height: 13px; }
.pp-num { min-width: 30px; text-align: right; font-variant-numeric: tabular-nums; }
.pp-bar {
  width: 44px; height: 6px; border-radius: var(--r-pill); overflow: hidden;
  background: color-mix(in srgb, var(--lime) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--lime) 22%, transparent);
}
.pp-fill {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, #4f9c00, var(--lime), #d8ffb0);
  box-shadow: 0 0 10px rgba(129, 247, 0, 0.5);
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

.iconbtn {
  width: 36px; height: 36px; border-radius: 12px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
  transition: transform 0.15s, border-color 0.2s, color 0.2s, background 0.2s;
}
.iconbtn svg { width: 17px; height: 17px; }
.iconbtn:hover { transform: translateY(-1px); border-color: var(--lime); color: var(--lime-deep); background: var(--lime-softer); }
html[data-theme='dark'] .iconbtn:hover { color: var(--lime); }
.iconbtn:active { transform: scale(0.92); }

.burger { display: none; }

@media (max-width: 1200px) {
  .navlink { padding: 7px 9px; font-size: 12.5px; gap: 5px; }
  .brand-name { font-size: 15px; }
}
@media (max-width: 1060px) {
  .navlinks { display: none; }
  .burger { display: inline-flex; }
}
@media (max-width: 480px) {
  .brand-name { display: none; }
  .pp-bar { display: none; }
  .navwrap { padding: 0 12px; }
  .app { padding: 0 12px 60px; }
}

/* ---------- Drawer (mobile-only surface) ---------- */
.drawer-root { display: none !important; }
@media (max-width: 1060px) {
  .drawer-root { display: block !important; }
}
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 140;
  background: color-mix(in srgb, #16220f 38%, transparent);
  backdrop-filter: blur(3px);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}
.drawer-backdrop.open { opacity: 1; visibility: visible; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 141;
  width: min(330px, 88vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 50px rgba(10, 18, 10, 0.22);
  transform: translateX(105%);
  visibility: hidden;
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), visibility 0.32s;
  display: flex; flex-direction: column;
  padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
  overflow-y: auto;
}
.drawer.open { transform: translateX(0); visibility: visible; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.drawer-title { font-size: 16px; font-weight: 700; }
.drawer-close { border: none; background: transparent; color: var(--muted); width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; }
.drawer-close:hover { background: var(--lime-softer); color: var(--ink); }
.drawer-close svg { width: 17px; height: 17px; }
.drawer-section { margin-bottom: 6px; }
.drawer-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 14px;
  font-weight: 600; font-size: 14px; color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.drawer-link:hover { background: var(--lime-softer); color: var(--ink); }
.drawer-link.active { background: var(--lime-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--lime) 45%, transparent); }
.dl-ic {
  width: 30px; height: 30px; border-radius: 10px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--lime-soft); color: var(--lime-deep);
  border: 1px solid color-mix(in srgb, var(--lime) 30%, transparent);
}
html[data-theme='dark'] .dl-ic { color: var(--lime); }
.dl-ic svg { width: 15px; height: 15px; }
.acc-toggle {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 14px; border: none; background: transparent;
  font-weight: 600; font-size: 14px; color: var(--ink);
}
.acc-toggle:hover { background: var(--lime-softer); }
.acc-chev { margin-left: auto; display: inline-flex; transition: transform 0.25s; color: var(--muted); }
.acc-chev svg { width: 14px; height: 14px; }
.acc-toggle.open .acc-chev { transform: rotate(90deg); }
.acc-list { overflow: hidden; max-height: 0; transition: max-height 0.3s ease; }
.acc-list.open { max-height: 620px; }
.acc-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 12px 8px 18px; border-radius: 12px;
  font-size: 13px; font-weight: 600; color: var(--muted);
}
.acc-item:hover { background: var(--lime-softer); color: var(--ink); }
.acc-item.active { color: var(--ink); }
.acc-item.done .acc-name { color: var(--lime-deep); }
html[data-theme='dark'] .acc-item.done .acc-name { color: var(--lime-bright); }
.acc-num {
  width: 22px; height: 22px; border-radius: 50%; flex: none;
  background: var(--lime-soft); color: var(--lime-deep);
  border: 1px solid color-mix(in srgb, var(--lime) 40%, transparent);
  font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  font-variant-numeric: tabular-nums;
}
.acc-item.done .acc-num { background: var(--lime); color: #16220f; border-color: transparent; animation: popIn 0.3s ease; }
.acc-name { flex: 1; }
.drawer-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.df-label { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.df-label b { font-variant-numeric: tabular-nums; }
@keyframes popIn { 0% { transform: scale(0.4); } 70% { transform: scale(1.18); } 100% { transform: scale(1); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--r-pill);
  font-weight: 700; font-size: 14.5px; border: 1px solid transparent;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, #5fb100, var(--lime) 55%, #c9ff97);
  color: #12260a;
  box-shadow: var(--shadow-lime), inset 0 1px 0 rgba(255,255,255,0.4);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-lime-big), inset 0 1px 0 rgba(255,255,255,0.4); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover { transform: translateY(-1px); border-color: var(--lime); background: var(--lime-softer); }
/* the hero panel is always dark — keep ghost text light in BOTH themes */
.hero .btn-ghost { color: #ecf6df; border-color: rgba(129, 247, 0, 0.4); }
.hero .btn-ghost:hover { background: rgba(129, 247, 0, 0.12); border-color: var(--lime); color: #eaffdc; }
.btn-small { padding: 8px 14px; font-size: 13px; }
.btn-danger { background: transparent; border-color: var(--line-strong); color: var(--warn-ink); }
.btn-danger:hover { border-color: var(--muted); background: var(--warn-bg); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: 28px;
  background: radial-gradient(rgba(129, 247, 0, 0.13) 1px, transparent 1.5px) 0 0 / 24px 24px, var(--dark);
  color: #f2fbe6;
  padding: clamp(30px, 6vw, 64px) clamp(22px, 5vw, 56px);
  box-shadow: 0 24px 60px rgba(10, 18, 10, 0.35);
  margin-top: 18px;
}
.hero-blob { position: absolute; border-radius: 50%; filter: blur(64px); opacity: 0.5; pointer-events: none; }
.hb-a { width: 300px; height: 300px; background: radial-gradient(circle, rgba(129,247,0,0.5), transparent 70%); top: -80px; right: -60px; animation: orbDrift 20s ease-in-out infinite alternate; }
.hb-b { width: 240px; height: 240px; background: radial-gradient(circle, rgba(129,247,0,0.34), transparent 70%); bottom: -100px; left: 18%; animation: orbDrift 26s ease-in-out infinite alternate-reverse; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 7px;
  background: color-mix(in srgb, var(--lime) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--lime) 45%, transparent);
  color: var(--lime-bright);
  font-size: 11.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  padding: 6px 12px; border-radius: var(--r-pill); margin-bottom: 18px;
}
.hero-badge svg { width: 12px; height: 12px; }
.hero-title { font-size: clamp(32px, 6.2vw, 52px); color: #ffffff; max-width: 700px; }
.hero-title .lime { color: var(--lime); }
.hero-p { color: #b9c8ad; font-size: clamp(14.5px, 2vw, 16.5px); max-width: 560px; margin-top: 14px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: clamp(22px, 5vw, 54px); margin-top: 34px; padding-top: 22px; border-top: 1px solid rgba(129, 247, 0, 0.18); }
.stat-num { font-size: clamp(24px, 4vw, 34px); font-weight: 700; color: var(--lime); font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-label { font-size: 11.5px; color: #93a487; letter-spacing: 0.07em; text-transform: uppercase; margin-top: 4px; font-weight: 600; }

/* ---------- Sections, cards, grids ---------- */
.section { margin-top: 46px; }
.sec-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.sec-dash {
  width: 26px; height: 4px; border-radius: var(--r-pill); flex: none;
  background: linear-gradient(90deg, #4f9c00, var(--lime));
  box-shadow: 0 0 10px rgba(129, 247, 0, 0.6);
}
.sec-head h2 { font-size: 25px; }
.sec-sub { color: var(--muted); font-size: 14.5px; margin: 4px 0 20px; max-width: 640px; }

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 22px;
  box-shadow: var(--shadow-card);
}
.card::before {
  content: ""; position: absolute; top: -1px; left: 12%; right: 12%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(129, 247, 0, 0.6), transparent);
}
.card.clickable { transition: transform 0.2s, box-shadow 0.25s, border-color 0.2s; cursor: pointer; display: block; }
.card.clickable:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--lime) 60%, transparent); }

.tile-ic {
  width: 42px; height: 42px; border-radius: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, color-mix(in srgb, var(--lime) 85%, transparent), var(--lime));
  color: #12260a;
  box-shadow: var(--shadow-lime), inset 0 1px 0 rgba(255,255,255,0.35);
  margin-bottom: 14px;
}
.tile-ic svg { width: 20px; height: 20px; }
.tile-ic.soft {
  background: var(--lime-soft); color: var(--lime-deep);
  box-shadow: none; border: 1px solid color-mix(in srgb, var(--lime) 35%, transparent);
}
html[data-theme='dark'] .tile-ic.soft { color: var(--lime-bright); }
.tile h3 { font-size: 16.5px; margin-bottom: 6px; }
.tile p { color: var(--muted); font-size: 13.5px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--lime-soft); border: 1px solid color-mix(in srgb, var(--lime) 40%, transparent);
  color: var(--lime-deep); border-radius: var(--r-pill);
  padding: 4px 11px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.07em; text-transform: uppercase;
}
html[data-theme='dark'] .chip { color: var(--lime-bright); }
.chip svg { width: 11px; height: 11px; }
.chip.neutral { background: var(--warn-bg); border-color: var(--line-strong); color: var(--warn-ink); }

/* ---------- Chapter cards ---------- */
.ch-card { padding: 24px; }
.ch-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.ch-num {
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  color: var(--lime-deep); background: var(--lime-soft);
  border: 1px solid color-mix(in srgb, var(--lime) 35%, transparent);
  padding: 4px 10px; border-radius: var(--r-pill); font-variant-numeric: tabular-nums;
}
html[data-theme='dark'] .ch-num { color: var(--lime-bright); }
.ch-lessons { margin: 14px 0 0; padding: 14px 0 0; border-top: 1px dashed var(--line-strong); }
.ch-mini { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.ch-mini b { color: var(--ink); font-variant-numeric: tabular-nums; }
.mini-bar { height: 6px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--lime) 12%, transparent); border: 1px solid color-mix(in srgb, var(--lime) 18%, transparent); overflow: hidden; margin-top: 8px; }
.mini-fill { display: block; height: 100%; background: linear-gradient(90deg, #4f9c00, var(--lime)); box-shadow: 0 0 8px rgba(129,247,0,0.45); transition: width 0.7s ease; }

/* ---------- Lesson layout ---------- */
.lesson-layout { display: grid; grid-template-columns: 250px 1fr; gap: 22px; margin-top: 22px; align-items: start; }
@media (max-width: 860px) { .lesson-layout { grid-template-columns: 1fr; } }
.rail { position: sticky; top: 86px; }
@media (max-width: 860px) { .rail { position: static; } }
.rail-card { padding: 14px; }
.rail-title { font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); padding: 4px 8px 10px; }
.rail-link {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 12px;
  font-size: 13px; font-weight: 600; color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.rail-link:hover { background: var(--lime-softer); color: var(--ink); }
.rail-link.active { background: var(--lime-soft); color: var(--ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--lime) 45%, transparent); }
.rail-num {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--lime-soft); color: var(--lime-deep);
  border: 1px solid color-mix(in srgb, var(--lime) 35%, transparent);
}
html[data-theme='dark'] .rail-num { color: var(--lime-bright); }
.rail-link.done .rail-num { background: var(--lime); color: #16220f; border-color: transparent; }
.rail-link.done .rail-name { text-decoration: none; }
.rail-name { flex: 1; line-height: 1.3; }
.rail-check { width: 14px; height: 14px; flex: none; color: var(--lime-deep); }
html[data-theme='dark'] .rail-check { color: var(--lime); }
.rail-check svg { width: 14px; height: 14px; }

.lesson-head { margin-bottom: 8px; }
.lesson-kicker { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.lesson-title { font-size: clamp(24px, 4vw, 31px); }
.lesson-sub { color: var(--muted); margin-top: 8px; font-size: 15px; max-width: 660px; }

/* ---------- Content blocks ---------- */
.bigidea {
  display: flex; gap: 14px; align-items: flex-start;
  background: linear-gradient(135deg, var(--lime-softer), transparent 60%), var(--surface-2);
  border: 1px solid color-mix(in srgb, var(--lime) 30%, transparent);
  border-radius: var(--r-card); padding: 18px 20px; margin: 18px 0;
  box-shadow: var(--shadow-card);
}
.bigidea .tile-ic { margin: 0; width: 38px; height: 38px; }
.bigidea p { font-size: 15.5px; font-weight: 600; }
.bigidea .bi-h { font-size: 11px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--lime-deep); font-weight: 700; margin-bottom: 3px; }
html[data-theme='dark'] .bigidea .bi-h { color: var(--lime-bright); }

.block-p { margin: 12px 0; font-size: 14.8px; color: var(--ink); }
.block-p b { color: var(--ink); }
.block-p .hl { background: linear-gradient(transparent 55%, var(--lime-soft) 55%); font-weight: 700; padding: 0 2px; }
.block-p code { font-family: var(--font-mono); font-size: 12.8px; background: var(--lime-softer); border: 1px solid color-mix(in srgb, var(--lime) 22%, transparent); padding: 1px 6px; border-radius: 7px; }

.block-h { display: flex; align-items: center; gap: 11px; margin: 30px 0 6px; }
.block-h .sec-dash { width: 22px; }
.block-h h3 { font-size: 19.5px; }

.steps { margin: 14px 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.step-item { display: flex; gap: 12px; align-items: flex-start; }
.step-num {
  width: 26px; height: 26px; border-radius: 50%; flex: none; margin-top: 1px;
  background: linear-gradient(135deg, #5fb100, var(--lime));
  color: #12260a; font-size: 12.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(129, 247, 0, 0.4);
  font-variant-numeric: tabular-nums;
}
.step-item p { font-size: 14.5px; }

.formula-card {
  background: var(--surface-2);
  border-radius: var(--r-card);
  border: 1px solid var(--line);
  padding: 8px 18px;
  margin: 14px 0;
  box-shadow: var(--shadow-card);
  overflow-x: auto;
}
html[data-theme='dark'] .formula-card {
  background: var(--dark);
  border-color: rgba(129, 247, 0, 0.22);
  box-shadow: 0 14px 34px rgba(10, 18, 10, 0.28), inset 0 1px 0 rgba(129,247,0,0.18);
}
.f-row { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px dashed var(--line-strong); flex-wrap: wrap; }
html[data-theme='dark'] .f-row { border-bottom-color: rgba(129, 247, 0, 0.14); }
.f-row:last-child { border-bottom: none; }
.f-main { font-family: var(--font-mono); font-size: 16.5px; color: var(--ink); font-weight: 600; white-space: nowrap; }
html[data-theme='dark'] .f-main { color: #eaffdc; }
.f-main sub, .f-main sup { font-size: 0.66em; }
.f-main .frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.15; font-size: 0.82em; margin: 0 2px; }
.f-main .frac > span:first-child { border-bottom: 1.4px solid currentColor; padding: 0 4px; }
.f-main .lm { color: var(--lime-deep); }
html[data-theme='dark'] .f-main .lm { color: var(--lime-bright); }
.sqrt { display: inline-flex; align-items: stretch; line-height: 1.15; }
.sqrt .rad { border-top: 1.4px solid currentColor; padding: 0 3px; margin-left: -1px; }
.f-note { font-size: 12.8px; color: var(--muted); font-weight: 600; }
.f-note b { color: var(--ink); }
html[data-theme='dark'] .f-note { color: #93a487; }
html[data-theme='dark'] .f-note b { color: #cdf7a4; }

/* fraction (light contexts too) */
.frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.12; font-size: 0.86em; margin: 0 2px; }
.frac > span:first-child { border-bottom: 1.4px solid currentColor; padding: 0 4px; }

.callout {
  display: flex; gap: 13px; align-items: flex-start;
  border-radius: var(--r-card); padding: 16px 18px; margin: 14px 0;
  border: 1px solid var(--line); background: var(--surface-2);
}
.callout.tip { background: var(--lime-softer); border-color: color-mix(in srgb, var(--lime) 35%, transparent); }
.callout.warn { background: var(--warn-bg); border-color: var(--line-strong); }
.callout.exam { background: var(--lime-softer); border-color: color-mix(in srgb, var(--lime) 35%, transparent); }
.co-ic {
  width: 32px; height: 32px; border-radius: 11px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--lime-soft); color: var(--lime-deep);
  border: 1px solid color-mix(in srgb, var(--lime) 38%, transparent);
}
html[data-theme='dark'] .co-ic { color: var(--lime-bright); }
.callout.warn .co-ic { background: var(--surface); color: var(--warn-ink); border-color: var(--line-strong); }
.co-ic svg { width: 16px; height: 16px; }
.co-body h4 { font-size: 14.5px; margin-bottom: 3px; }
.co-body p { font-size: 13.8px; color: var(--muted); }
.co-body p b { color: var(--ink); }

/* worked examples */
.example-card { margin: 16px 0; overflow: hidden; }
.ex-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.ex-head h4 { font-size: 15.5px; flex: 1; min-width: 160px; }
.ex-given { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.given-chip {
  font-family: var(--font-mono); font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line);
  padding: 5px 11px; border-radius: var(--r-pill); color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ex-steps { margin: 10px 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.ex-steps .step-item p { font-size: 14px; }
.ex-math {
  font-family: var(--font-mono); font-size: 14.2px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 14px; margin: 4px 0 4px 38px;
  overflow-x: auto; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ex-answer {
  display: flex; align-items: center; gap: 10px;
  margin: 12px 0 0; padding: 12px 16px;
  border-radius: 12px;
  background: var(--lime-soft); border: 1px solid color-mix(in srgb, var(--lime) 45%, transparent);
  font-family: var(--font-mono); font-weight: 700; font-size: 14.5px;
  font-variant-numeric: tabular-nums;
  overflow-x: auto; white-space: nowrap;
}
.ex-answer .fa-ic { display: inline-flex; color: var(--lime-deep); flex: none; }
html[data-theme='dark'] .ex-answer .fa-ic { color: var(--lime-bright); }
.fa-ic svg { width: 15px; height: 15px; }
.ex-note { font-size: 12.8px; color: var(--muted); margin-top: 8px; font-family: var(--font-ui); font-weight: 500; }

/* remember list */
.points { display: grid; gap: 9px; margin: 14px 0; }
.point { display: flex; gap: 11px; align-items: flex-start; }
.pt-dot {
  width: 20px; height: 20px; border-radius: 50%; flex: none; margin-top: 2px;
  border: 2px solid var(--lime);
  display: inline-flex; align-items: center; justify-content: center;
  color: transparent; position: relative;
}
.point.on .pt-dot { background: linear-gradient(135deg, #5fb100, var(--lime)); border-color: transparent; color: #12260a; }
.point.on .pt-dot::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--lime) 55%, transparent); animation: ringPulse 1.2s ease-out 1; }
.pt-dot svg { width: 11px; height: 11px; }
.point p { font-size: 14.3px; }
.point.on p { color: var(--ink); font-weight: 600; }

/* compare two columns */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
@media (max-width: 640px) { .compare { grid-template-columns: 1fr; } }
.cmp-col { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface-2); padding: 16px; }
.cmp-col h4 { font-size: 14.5px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.cmp-col ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.cmp-col li { font-size: 13.5px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }
.cmp-col li svg { width: 13px; height: 13px; flex: none; margin-top: 3px; color: var(--lime-deep); }
html[data-theme='dark'] .cmp-col li svg { color: var(--lime); }

/* ---------- Diagrams ---------- */
.diagram-card { margin: 16px 0; padding: 16px 16px 10px; }
.dg-svg { display: block; width: 100%; height: auto; border-radius: 12px; }
.dg-caption { text-align: center; font-size: 12.8px; color: var(--muted); font-weight: 600; padding: 8px 4px 4px; }
.dg-caption b { color: var(--ink); }

/* ---------- Tables ---------- */
.tbl-wrap {
  border: 1px solid var(--line); border-radius: var(--r-card);
  overflow-x: auto; background: var(--surface);
  box-shadow: var(--shadow-card); margin: 14px 0;
}
table.cq { width: 100%; border-collapse: collapse; min-width: 460px; font-size: 13.8px; }
table.cq th {
  background: var(--lime-soft); color: var(--ink);
  text-align: left; font-weight: 700; font-size: 12.5px;
  letter-spacing: 0.03em; padding: 11px 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--lime) 35%, transparent);
  white-space: nowrap;
}
table.cq td { padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--ink); vertical-align: top; }
table.cq tr:last-child td { border-bottom: none; }
table.cq tbody tr { transition: background 0.15s; }
table.cq tbody tr:hover { background: var(--lime-softer); }
table.cq td.n { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.cq td .nullchip { display: inline-block; background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--line-strong); font-size: 10.5px; padding: 1px 8px; border-radius: var(--r-pill); letter-spacing: 0.06em; }
table.cq td.hl-cell { background: var(--lime-soft); }
.tbl-caption { font-size: 12.3px; color: var(--muted); padding: 8px 14px 12px; font-weight: 600; }

/* ---------- Quiz ---------- */
.quiz-card { margin: 22px 0; }
.qz-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.qz-head h3 { font-size: 19px; flex: 1; min-width: 180px; }
.q-item { padding: 18px 0 4px; border-top: 1px dashed var(--line-strong); margin-top: 12px; }
.q-item:first-of-type { border-top: none; }
.q-text { font-size: 15px; font-weight: 700; margin-bottom: 12px; display: flex; gap: 10px; }
.q-num {
  font-family: var(--font-mono); flex: none; font-size: 12px; font-weight: 600;
  color: var(--lime-deep); background: var(--lime-soft);
  border: 1px solid color-mix(in srgb, var(--lime) 35%, transparent);
  border-radius: var(--r-pill); padding: 2px 9px; height: fit-content; margin-top: 1px;
}
html[data-theme='dark'] .q-num { color: var(--lime-bright); }
.q-opts { display: grid; gap: 9px; grid-template-columns: repeat(2, 1fr); }
@media (max-width: 640px) { .q-opts { grid-template-columns: 1fr; } }
.q-opt {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 12px 15px; border-radius: 14px;
  border: 1.5px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: 13.8px; color: var(--ink);
  font-family: inherit; line-height: 1.4;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.q-opt:hover:not(:disabled) { border-color: var(--lime); background: var(--lime-softer); transform: translateY(-1px); }
.q-opt:disabled { cursor: default; }
.q-opt .qo-key {
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 700;
  width: 22px; height: 22px; border-radius: 8px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 1px solid var(--line);
}
.q-opt.correct { background: var(--lime-soft); border-color: var(--lime); box-shadow: 0 0 0 1px var(--lime), 0 6px 16px rgba(129,247,0,0.25); animation: popIn 0.32s ease; }
.q-opt.correct .qo-key { background: var(--lime); color: #12260a; border-color: transparent; }
.q-opt.wrong { background: var(--warn-bg); border-color: var(--line-strong); color: var(--warn-ink); }
.q-opt.wrong .qo-key { background: var(--surface); }
.q-opt.dim { opacity: 0.55; }
.qo-check { margin-left: auto; display: inline-flex; flex: none; }
.qo-check svg { width: 15px; height: 15px; }
.q-opt.correct .qo-check { color: var(--lime-deep); }
html[data-theme='dark'] .q-opt.correct .qo-check { color: var(--lime-bright); }
.q-opt.wrong .qo-check { color: var(--warn-ink); }
.q-explain {
  margin-top: 10px;
  border-left: 3px solid var(--lime);
  background: var(--lime-softer);
  border-radius: 10px; padding: 11px 14px;
  font-size: 13.5px; color: var(--ink);
  animation: riseIn 0.35s ease backwards;
}
.q-explain b { font-weight: 700; }
.q-explain.no { border-color: var(--line-strong); background: var(--warn-bg); }
.qz-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.qz-score { font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; }
.qz-best { font-size: 12.5px; color: var(--muted); font-weight: 600; }

/* ---------- Widgets ---------- */
.widget-card { margin: 18px 0; overflow: hidden; }
.w-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.w-head h4 { font-size: 15.5px; flex: 1; min-width: 150px; }
.w-body { display: grid; gap: 14px; }
.w-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.w-slider { display: flex; align-items: center; gap: 9px; font-size: 12.5px; font-weight: 700; }
.w-slider label { white-space: nowrap; color: var(--muted); }
.w-slider .w-val { font-family: var(--font-mono); min-width: 54px; color: var(--ink); font-variant-numeric: tabular-nums; }
input[type='range'] {
  -webkit-appearance: none; appearance: none; width: 130px; height: 5px; border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--lime) var(--pct, 50%), var(--line) var(--pct, 50%));
  outline-offset: 4px;
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none; width: 17px; height: 17px; border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--lime);
  box-shadow: 0 0 8px rgba(129, 247, 0, 0.6); cursor: pointer;
}
input[type='range']::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--lime); box-shadow: 0 0 8px rgba(129,247,0,0.6); cursor: pointer; }
.w-readout {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.ro-chip {
  font-family: var(--font-mono); font-size: 12.3px; font-weight: 600;
  background: var(--dark); color: #cdf7a4; border-radius: var(--r-pill);
  padding: 5px 12px; border: 1px solid rgba(129,247,0,0.25);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ro-chip .lm { color: var(--lime-bright); }
.w-canvas { background: var(--dark); border-radius: 14px; border: 1px solid rgba(129,247,0,0.2); padding: 8px; overflow: hidden; }
.w-canvas svg { display: block; width: 100%; height: auto; }
.w-note { font-size: 13px; color: var(--muted); font-weight: 600; }
.badge-case {
  font-family: var(--font-mono); font-size: 12px; font-weight: 700; letter-spacing: 0.05em;
  border-radius: var(--r-pill); padding: 5px 13px;
  background: var(--lime-soft); border: 1px solid color-mix(in srgb, var(--lime) 50%, transparent);
  color: var(--lime-deep); text-transform: uppercase;
}
html[data-theme='dark'] .badge-case { color: var(--lime-bright); }

/* ---------- Checkbox (mark as learned) ---------- */
.learn-row {
  display: flex; align-items: center; gap: 13px;
  margin: 26px 0 6px; padding: 16px 18px;
  border-radius: var(--r-card);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
}
.cbox {
  appearance: none; -webkit-appearance: none;
  width: 22px; height: 22px; margin: 0; flex: none;
  border-radius: 7px; border: 2px solid var(--line-strong);
  background: var(--surface); cursor: pointer;
  position: relative; transition: all 0.2s;
}
.cbox:hover { box-shadow: 0 0 0 4px var(--lime-softer); border-color: var(--lime); }
.cbox:checked {
  background: linear-gradient(135deg, #5fb100, var(--lime));
  border-color: transparent;
  box-shadow: 0 0 12px rgba(129, 247, 0, 0.55);
  animation: popIn 0.3s ease;
}
.cbox:checked::after {
  content: ""; position: absolute; left: 5px; top: 1px;
  width: 6px; height: 11px;
  border: solid #12260a; border-width: 0 2.4px 2.4px 0;
  transform: rotate(42deg);
}
.learn-row label { font-weight: 700; font-size: 14.5px; cursor: pointer; transition: color 0.2s; }
.learn-row input:checked + label { color: var(--lime-deep); }
html[data-theme='dark'] .learn-row input:checked + label { color: var(--lime-bright); }

.lesson-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; flex-wrap: wrap; }

/* ---------- Floating action button ---------- */
.fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, #5fb100, var(--lime));
  color: #12260a; border: none;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lime-big);
  transition: transform 0.15s;
}
.fab svg { width: 22px; height: 22px; }
.fab:hover { transform: translateY(-2px); }
.fab:active { transform: scale(0.94); }
.fab::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--lime) 60%, transparent); animation: ringPulse 2.4s ease-out infinite; pointer-events: none; }
@media (max-width: 640px) { .fab { right: 14px; bottom: 14px; width: 48px; height: 48px; } }

/* ---------- Donut ---------- */
.donut-wrap { position: relative; display: inline-flex; }
.donut-wrap svg { transition: filter 0.3s; }
.donut-wrap:hover svg { filter: drop-shadow(0 0 14px rgba(129, 247, 0, 0.75)); }
.donut-val { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.donut-val .dv { font-size: 21px; }
.donut-val .dl { font-size: 9.5px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }

/* ---------- Page head (non-home pages) ---------- */
.page-head { margin-top: 26px; }
.page-kicker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.page-title { font-size: clamp(26px, 4.6vw, 36px); }
.page-sub { color: var(--muted); margin-top: 8px; font-size: 15px; max-width: 700px; }

/* ---------- Settings ---------- */
.settings-grid { display: grid; gap: 16px; margin-top: 20px; }
.set-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.set-row .grow { flex: 1; min-width: 220px; }
.set-row h4 { font-size: 15px; margin-bottom: 3px; }
.set-row p { font-size: 13px; color: var(--muted); }
.set-ic {
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--lime-soft); color: var(--lime-deep);
  border: 1px solid color-mix(in srgb, var(--lime) 32%, transparent);
}
html[data-theme='dark'] .set-ic { color: var(--lime-bright); }
.set-ic svg { width: 18px; height: 18px; }
.set-card + .set-card { margin-top: 14px; }
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--dark); color: #eaffdc; font-weight: 700; font-size: 13.5px;
  border: 1px solid rgba(129, 247, 0, 0.4); border-radius: var(--r-pill);
  padding: 11px 20px; z-index: 160; box-shadow: 0 12px 34px rgba(10,18,10,0.35);
  display: flex; gap: 9px; align-items: center;
  animation: toastIn 0.3s ease;
}
.toast svg { width: 15px; height: 15px; color: var(--lime); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast.out { opacity: 0; transition: opacity 0.4s; }

/* ---------- Cheatsheet ---------- */
.cheat-group { margin-top: 30px; }

/* ---------- Footer ---------- */
.foot { position: relative; z-index: 1; }
.foot-inner {
  max-width: 1080px; margin: 0 auto; padding: 22px 18px 34px;
  color: var(--muted); font-size: 12.8px; font-weight: 600;
  border-top: 1px solid var(--line);
}
.foot-lime { color: var(--lime-deep); font-weight: 700; }
html[data-theme='dark'] .foot-lime { color: var(--lime-bright); }

/* ---------- Progress bars (generic) ---------- */
.bar-track {
  height: 10px; border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--lime) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--lime) 20%, transparent);
  position: relative; overflow: hidden;
  background-image: repeating-linear-gradient(90deg, color-mix(in srgb, var(--lime) 7%, transparent) 0 2px, transparent 2px 10%);
}
.bar-fill {
  display: block; height: 100%; border-radius: inherit; position: relative;
  background: linear-gradient(90deg, #4f9c00, var(--lime) 55%, #d8ffb0);
  box-shadow: 0 0 12px rgba(129, 247, 0, 0.5);
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.bar-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,0.5) 50%, transparent 70%);
  background-size: 200% 100%;
  animation: shimmer 2.6s linear infinite;
}
@keyframes shimmer { from { background-position: 180% 0; } to { background-position: -80% 0; } }

/* ---------- SVG diagram shared styles ---------- */
.dg-svg .wire { stroke: var(--ink); stroke-width: 2.2; fill: none; stroke-linecap: round; }
.dg-svg .wire-lm { stroke: var(--lime-deep); stroke-width: 2.2; fill: none; stroke-linecap: round; }
html[data-theme='dark'] .dg-svg .wire { stroke: #cfe0bd; }
.dg-svg .lab { font-family: var(--font-mono); font-size: 12.5px; fill: var(--ink); font-weight: 600; }
.dg-svg .lab-mut { font-family: var(--font-mono); font-size: 11px; fill: var(--muted); }
.dg-svg .charge { fill: var(--lime-deep); }
html[data-theme='dark'] .dg-svg .charge { fill: var(--lime-bright); }
.dg-svg .plate { fill: var(--lime-deep); }
html[data-theme='dark'] .dg-svg .plate { fill: var(--lime); }
.dg-svg .sw-blob { opacity: 0.35; fill: var(--lime); }
@keyframes dashMove { to { stroke-dashoffset: -28; } }
.dg-svg .flow { stroke-dasharray: 6 8; animation: dashMove 1.1s linear infinite; }
@keyframes glowPulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.85; } }
.dg-svg .pulse { animation: glowPulse 2.2s ease-in-out infinite; }

/* ---------- Reduced motion: kill EVERYTHING ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
    scroll-behavior: auto !important;
  }
}
