/* ============ NCERTverse - green & white theme (v2 polish) ============ */

:root {
  --green: #16a34a;
  --green-strong: #15803d;
  --green-dark: #14532d;
  --green-ink: #0f3d22;
  --green-light: #dcfce7;
  --green-softer: #f0fdf4;
  --green-border: #bbf7d0;
  --accent: #f59e0b;
  --text: #111827;
  --muted: #6b7280;
  --card: #ffffff;
  --bg: #f7fdf9;
  --hairline: #e5e7eb;
  --shadow-sm: 0 1px 2px rgba(15, 61, 34, 0.06);
  --shadow-md: 0 6px 20px -6px rgba(15, 61, 34, 0.14);
  --radius: 14px;
  --radius-sm: 10px;
  --maxw: 1100px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --green: #4ade80;
    --green-strong: #22c55e;
    --green-dark: #86efac;
    --green-ink: #bbf7d0;
    --green-light: #14361f;
    --green-softer: #0e2415;
    --green-border: #1f4d2e;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --card: #101b13;
    --bg: #0a120c;
    --hairline: #1f2f23;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px -6px rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme="dark"] {
    --green: #4ade80;
    --green-strong: #22c55e;
    --green-dark: #86efac;
    --green-ink: #bbf7d0;
    --green-light: #14361f;
    --green-softer: #0e2415;
    --green-border: #1f4d2e;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --card: #101b13;
    --bg: #0a120c;
    --hairline: #1f2f23;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px -6px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--green); color: #fff; }

a { color: var(--green-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 2px;
  border-radius: 6px;
}

h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -0.01em; }

/* ---------- Header ---------- */
.site-header {
  background: var(--card);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--hairline);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.logo {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--green-ink);
  white-space: nowrap;
}
.logo span { color: var(--green-strong); }
.logo:hover { text-decoration: none; }

.header-search { flex: 1; max-width: 380px; margin-left: auto; }
.header-search input {
  width: 100%;
  padding: 9px 16px;
  border: 1.5px solid var(--green-border);
  border-radius: 999px;
  font-size: 0.95rem;
  background: var(--card);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.header-search input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 18%, transparent);
}

.main-nav { display: flex; gap: 4px; }
.main-nav a {
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.main-nav a:hover { color: var(--green-ink); background: var(--green-light); text-decoration: none; }

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
}
.hamburger:hover { background: var(--green-light); }
.hamburger span {
  display: block;
  width: 22px;
  height: 2.5px;
  background: var(--green-ink);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

/* ---------- Page layout ---------- */
.page { max-width: var(--maxw); margin: 0 auto; padding: 28px 16px 56px; min-height: 60vh; }

/* ---------- Breadcrumbs ---------- */
.breadcrumbs { font-size: 0.88rem; color: var(--muted); margin-bottom: 20px; }
.breadcrumbs a { color: var(--green-strong); font-weight: 500; }
.breadcrumbs .sep { margin: 0 6px; color: var(--green-border); }

/* ---------- Home hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(600px 240px at 85% -20%, rgba(255, 255, 255, 0.22), transparent 60%),
    radial-gradient(420px 200px at 8% 115%, rgba(255, 255, 255, 0.12), transparent 60%),
    linear-gradient(135deg, #16a34a 0%, #15803d 55%, #14532d 100%);
  color: #fff;
  border-radius: 20px;
  padding: 56px 32px;
  text-align: center;
  margin-bottom: 36px;
  box-shadow: var(--shadow-md);
}
.hero h1 {
  font-size: clamp(1.7rem, 4.5vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.hero p { font-size: 1.08rem; opacity: 0.95; max-width: 560px; margin: 0 auto; }

.section-title {
  font-size: 1.35rem;
  font-weight: 750;
  color: var(--green-ink);
  margin: 32px 0 16px;
  letter-spacing: -0.01em;
}

/* ---------- Cards ---------- */
.class-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.class-card {
  background: var(--card);
  border: 1.5px solid var(--green-border);
  border-radius: var(--radius);
  padding: 30px 24px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.class-card:hover {
  border-color: var(--green);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.class-card h3 { color: var(--green-ink); font-size: 1.35rem; font-weight: 800; margin-bottom: 6px; }
.class-card p { color: var(--muted); font-size: 0.93rem; }

.card-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.mini-card {
  background: var(--card);
  border: 1.5px solid var(--green-border);
  border-radius: var(--radius);
  padding: 18px;
  display: block;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.mini-card:hover {
  border-color: var(--green);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.mini-card .kicker { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.mini-card h4 { color: var(--green-ink); font-size: 1.05rem; margin-top: 6px; }

/* ---------- Subject cards ---------- */
.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.subject-card {
  background: var(--card);
  border: 1.5px solid var(--green-border);
  border-radius: var(--radius);
  padding: 24px;
  display: block;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.subject-card:hover {
  border-color: var(--green);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  text-decoration: none;
}
.subject-card h3 { color: var(--green-ink); font-size: 1.2rem; margin-bottom: 4px; }
.subject-card p { color: var(--muted); font-size: 0.92rem; }

/* ---------- Chapter list ---------- */
.chapter-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.chapter-item {
  background: var(--card);
  border: 1.5px solid var(--green-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, transform 0.15s;
}
a.chapter-item { color: var(--text); }
a.chapter-item:hover { border-color: var(--green); transform: translateX(3px); text-decoration: none; }
.chapter-item .num {
  background: var(--green-light);
  color: var(--green-ink);
  font-weight: 700;
  border-radius: 10px;
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
}
.chapter-item .name { font-weight: 600; }

.badge {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.available { background: var(--green-strong); color: #fff; }
.badge.coming { background: var(--hairline); color: var(--muted); }

/* ---------- Chapter page ---------- */
.chapter-layout { display: grid; grid-template-columns: 1fr 270px; gap: 32px; align-items: start; }

article > h1 { font-size: clamp(1.6rem, 3.5vw, 2.1rem); font-weight: 800; color: var(--text); }

.chapter-intro {
  background: linear-gradient(135deg, var(--green-light), var(--green-softer));
  border: 1px solid var(--green-border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 16px 0 24px;
}
.chapter-note { font-size: 0.85rem; color: var(--muted); font-style: italic; margin-bottom: 22px; }

.topic-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 30px; }
.topic-chip {
  background: var(--card);
  border: 1.5px solid var(--green-border);
  color: var(--green-ink);
  border-radius: 999px;
  padding: 6px 15px;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s;
}
.topic-chip:hover { background: var(--green-light); border-color: var(--green); }

/* ---------- Problem cards ---------- */
.problem {
  background: var(--card);
  border: 1.5px solid var(--green-border);
  border-radius: var(--radius);
  padding: 22px 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.problem h3 {
  color: var(--green-ink);
  font-size: 1.08rem;
  font-weight: 750;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--hairline);
}
.problem .given {
  background: var(--green-softer);
  border-left: 4px solid var(--green);
  padding: 10px 14px;
  font-size: 0.93rem;
  margin-bottom: 14px;
  border-radius: 0 8px 8px 0;
}
.problem ol {
  margin: 0 0 14px;
  font-size: 0.96rem;
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.problem ol li {
  counter-increment: step;
  position: relative;
  padding-left: 36px;
}
.problem ol li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--green-light);
  color: var(--green-ink);
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.problem .answer {
  background: linear-gradient(135deg, var(--green-light), var(--green-softer));
  border: 1px solid var(--green-border);
  color: var(--green-ink);
  font-weight: 700;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.97rem;
  position: relative;
  padding-left: 42px;
}
.problem .answer::before {
  content: "\2713";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--green-strong);
  color: #fff;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Sidebar ---------- */
.chapter-sidebar {
  background: var(--card);
  border: 1.5px solid var(--green-border);
  border-radius: var(--radius);
  padding: 18px;
  position: sticky;
  top: 84px;
  box-shadow: var(--shadow-sm);
}
.chapter-sidebar h4 { color: var(--green-ink); margin-bottom: 12px; font-size: 1rem; }
.chapter-sidebar ul { list-style: none; }
.chapter-sidebar li { margin-bottom: 2px; }
.chapter-sidebar a {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--text);
  transition: background 0.15s;
}
.chapter-sidebar a:hover { background: var(--green-light); text-decoration: none; }
.chapter-sidebar a.current { background: var(--green-strong); color: #fff; font-weight: 600; }
.chapter-sidebar .soon { color: var(--muted); padding: 7px 10px; font-size: 0.88rem; display: block; }

/* ---------- Prev / Next ---------- */
.prev-next { display: flex; justify-content: space-between; gap: 14px; margin-top: 32px; }
.prev-next a {
  border: 1.5px solid var(--green-border);
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 0.92rem;
  font-weight: 600;
  max-width: 48%;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, transform 0.15s;
}
.prev-next a:hover { border-color: var(--green); transform: translateY(-2px); text-decoration: none; }
.prev-next .next { margin-left: auto; text-align: right; }
.prev-next .dir { display: block; font-size: 0.75rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }

.coming-soon-box {
  background: var(--card);
  border: 2px dashed var(--green-border);
  border-radius: var(--radius);
  padding: 44px 24px;
  text-align: center;
  color: var(--muted);
}
.coming-soon-box h2 { color: var(--green-ink); margin-bottom: 8px; }

/* ---------- Search page ---------- */
.search-big input {
  width: 100%;
  padding: 14px 18px;
  font-size: 1.05rem;
  background: var(--card);
  color: var(--text);
  border: 2px solid var(--green-border);
  border-radius: var(--radius);
  outline: none;
  margin: 12px 0 24px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-big input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 18%, transparent);
}
.search-result {
  background: var(--card);
  border: 1.5px solid var(--green-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 12px;
  display: block;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, transform 0.15s;
}
.search-result:hover { border-color: var(--green); transform: translateX(3px); text-decoration: none; }
.search-result .path { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.search-result .title { font-weight: 700; color: var(--green-ink); }
.search-result .match-q { display: block; font-size: 0.86rem; color: var(--muted); margin-top: 4px; }
.search-result .badge { float: right; }
.search-empty { color: var(--muted); }

/* ---------- Static pages ---------- */
.static-page { max-width: 720px; }
.static-page h1 { color: var(--green-ink); margin-bottom: 16px; }
.static-page p { margin-bottom: 12px; }

/* ---------- Footer ---------- */
.site-footer {
  background: linear-gradient(135deg, #14532d, #0f3d22);
  color: #fff;
  margin-top: 48px;
}
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 30px 16px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.footer-inner p { font-size: 0.88rem; opacity: 0.85; margin-top: 4px; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; }
.footer-nav a { color: #fff; font-size: 0.92rem; opacity: 0.9; }
.footer-nav a:hover { opacity: 1; color: var(--green-border); }

/* ---------- Mobile (phone) ---------- */
@media (max-width: 768px) {
  .header-inner { flex-wrap: wrap; }
  .header-search { order: 3; max-width: none; flex-basis: 100%; }
  .hamburger { display: flex; margin-left: auto; }

  .main-nav {
    flex-basis: 100%;
    flex-direction: column;
    gap: 0;
    order: 4;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.25s ease, opacity 0.2s ease, margin-top 0.25s ease;
    margin-top: 0;
  }
  .main-nav.open {
    max-height: 320px;
    opacity: 1;
    margin-top: 10px;
    border-top: 1px solid var(--hairline);
  }
  .main-nav a { padding: 13px 6px; border-bottom: 1px solid var(--green-softer); border-radius: 0; }
  .main-nav a:hover { background: none; color: var(--green-strong); }

  .hero { padding: 36px 20px; border-radius: 16px; }
  .class-grid { grid-template-columns: 1fr; }

  .chapter-layout { grid-template-columns: 1fr; }
  .chapter-sidebar { position: static; order: 2; }

  .problem { padding: 18px 16px; }

  .prev-next { flex-direction: column; }
  .prev-next a { max-width: none; }
  .prev-next .next { margin-left: 0; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* Logo mark */
.logo { display: inline-flex; align-items: center; gap: 0.5rem; }
.logo-mark { width: 30px; height: 30px; border-radius: 50%; display: block; }

/* Question type labels (MCQ, marks, JEE level) */
.q-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #e2f5e9;
  color: #1b7a43;
  border: 1px solid #b7e4c7;
  vertical-align: middle;
  margin-left: 0.4rem;
  white-space: nowrap;
}
:root[data-theme="dark"] .q-label { background: #123324; color: #7fd6a4; border-color: #1e4d33; }

/* ---- Dark mode: toggle + dark-specific tweaks ---- */
:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }

.theme-toggle {
  width: 40px; height: 40px; flex: none;
  border: 1.5px solid var(--green-border);
  background: var(--card);
  color: var(--text);
  border-radius: 50%;
  font-size: 1.1rem; line-height: 1;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.theme-toggle:hover { background: var(--green-light); border-color: var(--green); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .q-label { background: #123324; color: #7fd6a4; border-color: #1e4d33; }
}

/* ---- Search: grouped results ---- */
.search-count { color: var(--muted); font-size: 0.9rem; margin: 6px 0 14px; }
.search-group { margin-bottom: 22px; }
.search-group-title { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--green-strong); margin: 0 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--green-border); }
.search-result { display: block; }
.search-result mark { background: color-mix(in srgb, var(--accent) 35%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.match-topics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.match-topics .chip { font-size: 0.78rem; padding: 2px 9px; border-radius: 999px; background: var(--green-light); color: var(--green-ink); border: 1px solid var(--green-border); }
@media (max-width: 760px) {
  .theme-toggle { margin-left: auto; }
  .hamburger { margin-left: 0; }
}

.theme-toggle svg { display: block; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
}

/* ================= Animated icons (SVG, subtle) ================= */
.ico { display: inline-block; flex: none; color: var(--green-strong); }
.title-ico { width: 1.15em; height: 1.15em; margin-right: 0.45em; vertical-align: -0.18em; }
.kick-ico { width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; }
.h1-ico { display: flex; align-items: center; gap: 12px; }
.h1-svg { width: 1.1em; height: 1.1em; color: var(--green-strong); }

.card-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 14px; margin-bottom: 10px;
  background: var(--green-light); border: 1px solid var(--green-border);
}
.card-ico .ico { width: 26px; height: 26px; }

.hero-icons { display: flex; justify-content: center; gap: 14px; margin-bottom: 14px; }
.hero-icons .hi {
  width: 54px; height: 54px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.28);
  animation: ncv-float 4.2s ease-in-out infinite;
}
.hero-icons .hi .ico { width: 30px; height: 30px; color: #fff; }
.hero-icons .hi2 { animation-delay: -1.4s; }
.hero-icons .hi3 { animation-delay: -2.8s; }

.ico .nucleus { fill: var(--accent); stroke: none; }
.hero-icons .nucleus { fill: #fde68a; }
.ico .bubble { fill: var(--accent); }

@keyframes ncv-float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes ncv-spin { to { transform: rotate(360deg); } }
@keyframes ncv-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.12); } }
@keyframes ncv-wiggle { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); } }
@keyframes ncv-bubble { 0% { transform: translateY(0); opacity: 1; } 100% { transform: translateY(-5px); opacity: 0; } }
@keyframes ncv-twinkle { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

.ico-physics { animation: ncv-spin 14s linear infinite; }
.ico-spark .twinkle { animation: ncv-twinkle 2.4s ease-in-out infinite; }
.ico-chemistry .bubble { animation: ncv-bubble 2.2s ease-in infinite; transform-box: fill-box; }
.ico-chemistry .b2 { animation-delay: -1.1s; }
.ico-maths .sigma { transform-origin: center; transform-box: fill-box; }

.class-card:hover .card-ico .ico-book,
.subject-card:hover .card-ico .ico-maths,
.section-title:hover .title-ico { animation: ncv-pulse 0.9s ease-in-out infinite; }
.class-card:hover .card-ico .ico-book { animation: ncv-wiggle 0.7s ease-in-out; }
.subject-card:hover .card-ico .ico-physics { animation-duration: 2.5s; }
.subject-card:hover .card-ico .ico-chemistry { animation: ncv-wiggle 0.7s ease-in-out infinite; }
.mini-card:hover .kick-ico { animation: ncv-pulse 0.8s ease-in-out infinite; }
.subject-card:hover, .class-card:hover { text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  .ico, .ico *, .hero-icons .hi { animation: none !important; transition: none !important; }
}

/* ---- No blue tap flash on mobile; keep keyboard focus ring ---- */
* { -webkit-tap-highlight-color: transparent; }
a, button, input, summary, [role="button"] { touch-action: manipulation; }
a:focus:not(:focus-visible), button:focus:not(:focus-visible), summary:focus:not(:focus-visible), [tabindex]:focus:not(:focus-visible) { outline: none; box-shadow: none; }
button, .class-card, .subject-card, .mini-card, .chapter-item, .main-nav a, .footer-nav a, .search-result, .theme-toggle, .hamburger, .logo {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
a:active, button:active { outline: none; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 2px solid var(--green); outline-offset: 2px; border-radius: 6px;
}

/* ---------- smooth motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  @keyframes ncv-page-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
  #app.page-enter { animation: ncv-page-in .35s cubic-bezier(.22,.61,.36,1) both; }
  .rv { opacity: 0; transform: translateY(16px); transition: opacity .5s cubic-bezier(.22,.61,.36,1), transform .5s cubic-bezier(.22,.61,.36,1); transition-delay: calc(var(--i, 0) * 45ms); will-change: opacity, transform; }
  .rv.rv-in { opacity: 1; transform: none; }
  .class-card, .subject-card, .mini-card, .search-result, .chapter-item, .prev-next a, .problem { transition: transform .2s cubic-bezier(.22,.61,.36,1), box-shadow .2s ease, border-color .2s ease, background-color .2s ease; }
  .rv.rv-in.class-card, .rv.rv-in.subject-card, .rv.rv-in.mini-card, .rv.rv-in.search-result, .rv.rv-in.prev-next a { transition-delay: 0s; }
  .class-card:hover, .subject-card:hover, .mini-card:hover { transform: translateY(-3px); }
  .search-result:hover, .prev-next a:hover { transform: translateX(3px); }
  .class-card:active, .subject-card:active, .mini-card:active, .search-result:active, .prev-next a:active, button:active { transform: scale(.97); transition-duration: .08s; }
  .theme-toggle:active, .hamburger:active { transform: scale(.9); }
  .theme-toggle, .hamburger { transition: transform .2s ease, background-color .2s ease; }
  html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after { transition: background-color .4s ease, color .4s ease, border-color .4s ease, box-shadow .4s ease, fill .4s ease, stroke .4s ease !important; }
  .ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .18; transform: scale(0); animation: ncv-ripple .55s ease-out forwards; pointer-events: none; }
  @keyframes ncv-ripple { to { transform: scale(1); opacity: 0; } }
  html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) { .ripple { display: none; } .rv { opacity: 1; transform: none; } }

/* ---------- collapsible solutions ---------- */
.sol { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows .35s cubic-bezier(.22,.61,.36,1), visibility 0s linear .35s; }
.sol-in { overflow: hidden; min-height: 0; opacity: 0; transition: opacity .3s ease; }
.problem.sol-open .sol { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows .35s cubic-bezier(.22,.61,.36,1), visibility 0s; }
.problem.sol-open .sol-in { opacity: 1; }
.sol-btn, .sol-all { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 8px 14px; font: inherit; font-size: .9rem; font-weight: 700; color: var(--green-ink); background: var(--green-light); border: 1px solid var(--hairline); border-radius: 999px; cursor: pointer; position: relative; overflow: hidden; }
.sol-btn:hover, .sol-all:hover { background: var(--green-softer); }
.sol-chev { transition: transform .3s ease; }
.problem.sol-open .sol-chev { transform: rotate(180deg); }
.sol-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.sol-bar .sol-all { margin-top: 0; }
@media (prefers-reduced-motion: reduce) { .sol, .sol-in, .sol-chev { transition: none !important; } }
@media print { .sol { visibility: visible; grid-template-rows: 1fr; } .sol-in { opacity: 1; } .sol-btn, .sol-bar { display: none; } }

/* ---------- math notation ---------- */
sup, sub { font-size: .72em; line-height: 0; position: relative; vertical-align: baseline; }
sup { top: -.5em; }
sub { top: .28em; }
.mf-frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; text-align: center; margin: 0 .15em; line-height: 1.15; font-size: .95em; }
.mf-frac .mf-n { padding: 0 .25em .06em; border-bottom: 1.5px solid currentColor; }
.mf-frac .mf-d { padding: .06em .25em 0; }
.mf-rad { white-space: nowrap; }
.mf-rin { border-top: 1.5px solid currentColor; padding: 0 .12em; margin-left: .04em; }
.mf-int { display: inline-flex; align-items: center; font-size: 1.25em; line-height: 1; vertical-align: middle; }
.mf-lim { display: inline-flex; flex-direction: column; justify-content: space-between; font-size: .5em; line-height: 1.1; margin-left: .1em; align-self: stretch; }
.mf-lim2 { white-space: nowrap; }
.mf-mat { display: inline-grid; gap: .15em .9em; vertical-align: middle; padding: .1em .6em; margin: 0 .15em; border-left: 2px solid currentColor; border-right: 2px solid currentColor; border-radius: 6px; text-align: center; line-height: 1.3; }
.mf-c { white-space: nowrap; }

/* ---------- levels, chips, concepts, pagination, offline ---------- */
.lv { display: inline-block; font-size: .68rem; font-weight: 800; letter-spacing: .02em; padding: 2px 8px; border-radius: 999px; vertical-align: middle; margin-left: 4px; white-space: nowrap; background: var(--green-light); color: var(--green-ink); border: 1px solid var(--hairline); }
.lv-basic { background: #ecfdf5; color: #047857; }
.lv-ncert { background: #eff6ff; color: #1d4ed8; }
.lv-jee-main { background: #fff7ed; color: #c2410c; }
.lv-jee-advanced { background: #fef2f2; color: #b91c1c; }
.lv-neet { background: #faf5ff; color: #7e22ce; }
.lv-exam { background: var(--green-light); color: var(--green-ink); margin: 0 6px 0 0; }
:root[data-theme="dark"] .lv-basic { background: #0f2a1f; color: #6ee7b7; }
:root[data-theme="dark"] .lv-ncert { background: #10213f; color: #93c5fd; }
:root[data-theme="dark"] .lv-jee-main { background: #3a1e0c; color: #fdba74; }
:root[data-theme="dark"] .lv-jee-advanced { background: #3b1212; color: #fca5a5; }
:root[data-theme="dark"] .lv-neet { background: #2a1740; color: #d8b4fe; }
.q-count { color: var(--muted); font-weight: 600; margin: -4px 0 12px; }
.lv-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.lv-chip { font: inherit; font-size: .88rem; font-weight: 700; padding: 7px 13px; border-radius: 999px; cursor: pointer; background: var(--card); color: var(--green-ink); border: 1px solid var(--hairline); transition: transform .15s ease, background-color .2s ease; }
.lv-chip b { font-weight: 800; opacity: .7; margin-left: 3px; }
.lv-chip.on { background: var(--green); background: var(--green-strong, #15803d); color: #fff; border-color: transparent; }
.q-more { text-align: center; margin: 18px 0 6px; min-height: 48px; }
.load-more { font: inherit; font-weight: 700; padding: 11px 22px; border-radius: 999px; cursor: pointer; background: var(--green-light); color: var(--green-ink); border: 1px solid var(--hairline); }
.q-end { color: var(--muted); font-size: .9rem; }
.chapter-load { padding: 28px 8px; color: var(--muted); font-weight: 600; }
.spin-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--green-ink); border-right-color: transparent; vertical-align: -1px; margin-right: 6px; animation: ncv-spin2 .8s linear infinite; }
@keyframes ncv-spin2 { to { transform: rotate(360deg); } }
.qn { margin-left: auto; margin-right: 8px; font-size: .78rem; font-weight: 700; color: var(--muted); white-space: nowrap; }
/* concepts */
.concept { background: var(--card); border: 1px solid var(--hairline); border-radius: 14px; margin: 10px 0; overflow: hidden; }
.c-btn { width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; font: inherit; font-weight: 800; color: var(--green-ink); background: transparent; border: 0; padding: 14px 14px; cursor: pointer; position: relative; overflow: hidden; }
.c-num { flex: none; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; background: var(--green-light); }
.c-title { flex: 1; }
.concept.c-open .sol-chev { transform: rotate(180deg); }
.c-body { display: grid; grid-template-rows: 0fr; visibility: hidden; transition: grid-template-rows .35s cubic-bezier(.22,.61,.36,1), visibility 0s linear .35s; }
.concept.c-open .c-body { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows .35s cubic-bezier(.22,.61,.36,1), visibility 0s; }
.c-in { overflow: hidden; min-height: 0; padding: 0 16px; }
.concept.c-open .c-in { padding-bottom: 14px; }
.c-in p { margin: 8px 0; }
.c-box { margin: 12px 0; padding: 10px 14px; border-radius: 12px; background: var(--green-light); border: 1px solid var(--hairline); }
.c-box h4 { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--green-ink); margin-bottom: 6px; }
.c-box ul, .c-box ol { margin: 4px 0 2px 20px; }
.c-box li { margin: 4px 0; }
.c-formula { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 5px 0; }
.c-formula .fl { font-weight: 700; }
.c-formula .fx { font-size: 1.05em; font-weight: 700; }
.c-formula .fn { color: var(--muted); font-size: .88rem; }
.c-warn { background: #fff7ed; border-color: #fed7aa; }
:root[data-theme="dark"] .c-warn { background: #2a1a0c; border-color: #5a3512; }
/* offline */
.off-bar { height: 10px; border-radius: 999px; background: var(--green-light); overflow: hidden; margin: 10px 0 14px; }
.off-bar span { display: block; height: 100%; width: 100%; background: var(--green-strong, #15803d); transform-origin: left; transform: scaleX(0); transition: transform .3s ease; border-radius: 999px; }
@media (prefers-reduced-motion: reduce) { .c-body, .spin-dot, .off-bar span { transition: none !important; animation: none !important; } }
@media print { .c-body { visibility: visible; grid-template-rows: 1fr; } .c-btn svg { display: none; } }

/* chapter row layout: fixed columns, nothing overflows */
.chapter-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; column-gap: 12px; row-gap: 6px; }
.chapter-item .name { min-width: 0; overflow-wrap: anywhere; line-height: 1.35; }
.chapter-item .meta { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.chapter-item .meta .qn { margin: 0; min-width: 48px; text-align: right; }
.chapter-item .meta .badge { margin: 0; min-width: 96px; text-align: center; }
@media (max-width: 440px) {
  .chapter-item { grid-template-columns: 36px minmax(0, 1fr); padding: 12px 14px; }
  .chapter-item .meta { grid-column: 2; justify-content: space-between; }
  .chapter-item .meta .qn { text-align: left; }
  .chapter-item .meta .badge { min-width: 0; }
}

/* question diagrams: inline SVG on a fixed light "paper" card so any palette stays readable in dark mode */
.diagram { margin: 12px 0; padding: 10px; border: 1px solid #cfe6d7; border-radius: var(--radius-sm); background: #fbfdfb; color: #1b2a22; text-align: center; }
.diagram svg { display: block; width: 100%; max-width: 480px; height: auto; margin: 0 auto; overflow: visible; }
.diagram svg text { font-family: inherit; }
.diagram figcaption { margin-top: 6px; font-size: .85rem; color: #4b5d53; }
.diagram .d-line { stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.diagram .d-dash { stroke: currentColor; fill: none; stroke-width: 1.2; stroke-dasharray: 5 4; }
.diagram .d-thick { stroke: currentColor; fill: none; stroke-width: 2.6; stroke-linecap: round; }
.diagram .d-fill { fill: currentColor; stroke: none; }
.diagram .d-soft { fill: #dcfce7; stroke: currentColor; stroke-width: 1.4; }
.diagram .d-accent { stroke: #15803d; fill: none; stroke-width: 2.2; stroke-linecap: round; }
.diagram .d-accent-fill { fill: #15803d; stroke: none; }
.diagram .d-muted { stroke: #6b7c72; fill: none; stroke-width: 1.2; }
.diagram text.d-muted { fill: #6b7c72; stroke: none; }

/* ---------- Scientific calculator ---------- */
.calc-note { color: var(--muted); margin: 6px 0 14px; max-width: 60ch; }
.calc { max-width: 440px; margin: 0 auto 28px; padding: 14px; background: var(--card); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: var(--shadow-md); }
.calc-screen { background: var(--green-softer); border: 1px solid var(--green-border); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px; }
.calc-input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 1.25rem; text-align: right; font-variant-numeric: tabular-nums; }
.calc-input:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; border-radius: 4px; }
.calc-result { min-height: 2.1rem; text-align: right; font-size: 1.5rem; font-weight: 700; color: var(--muted); overflow-x: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.calc-result.calc-final { color: var(--green-ink); }
.calc-result.calc-err { color: #dc2626; font-size: 1rem; line-height: 2.1rem; }
.calc-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.calc-key { min-height: 46px; padding: 0; font: inherit; font-size: 1rem; font-weight: 600; color: var(--text); background: var(--green-softer); border: 1px solid var(--hairline); border-radius: var(--radius-sm); cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.calc-key:hover { background: var(--green-light); }
.calc-key:active { transform: scale(.96); }
.calc-key:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.calc-num { background: var(--card); font-size: 1.1rem; }
.calc-op { color: var(--green-ink); background: var(--green-light); font-size: 1.15rem; }
.calc-sp { color: var(--green-ink); background: var(--green-light); }
.calc-eq { color: #fff; background: var(--green-strong); border-color: var(--green-strong); font-size: 1.2rem; }
.calc-eq:hover { background: var(--green); }
.calc-hist { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.calc-hitem { text-align: right; font: inherit; font-size: .9rem; color: var(--muted); background: transparent; border: 0; border-bottom: 1px dashed var(--hairline); padding: 4px 2px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calc-hitem:hover { color: var(--green-ink); }
.calc-promo { display: flex; align-items: center; gap: 12px; margin: 18px 0 6px; padding: 14px 16px; background: var(--green-light); border: 1px solid var(--green-border); border-radius: var(--radius); color: var(--green-ink); text-decoration: none; }
.calc-promo:hover { border-color: var(--green); }
.calc-promo span { line-height: 1.4; font-size: .95rem; }
@media (max-width: 380px) { .calc { padding: 10px; } .calc-keys { gap: 6px; } .calc-key { font-size: .92rem; } }
