/* ==========================================================================
   Pathanto site design system
   Loaded last in header.php so it wins over the legacy stylesheets,
   Bootstrap 4 and Tailwind utilities.
   ========================================================================== */

:root {
  --brand: #4f46e5;
  --brand-strong: #4338ca;
  --brand-soft: #eef2ff;
  --brand-border: #c7d2fe;
  --brand-solid: #4f46e5;
  --brand-solid-hover: #4338ca;
  --header-bg: rgba(255, 255, 255, 0.96);
  --question-bg: #fef2f2;
  --question-ink: #b91c1c;
  --accent: #db2777;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --surface: #ffffff;
  --page: #f8fafc;
  --success: #15803d;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.16);
  --header-h: 64px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (max-width: 1023px) {
  :root { --header-h: 108px; }
}

/* ---------- Base ---------- */

html {
  height: auto;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
  font-family: var(--font) !important;
  color: var(--ink-2);
  background: var(--page);
  height: auto !important;
  min-height: 100vh;
  margin: 0;
  padding: 0 !important;
  /* `clip` (unlike `hidden`) keeps position: sticky working */
  overflow-x: clip !important;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font);
  letter-spacing: -0.01em;
}

a { color: var(--brand); }
a:hover { color: var(--brand-strong); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 2000;
  background: var(--surface);
  color: var(--brand);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* Legacy navigation fragments still printed by every chapter page */
li.navItem.more-topic,
body > .dropbtn,
.pane2 {
  display: none !important;
}

/* ---------- Buttons ---------- */

.site-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none !important;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.site-btn--primary { background: var(--brand-solid); color: #fff !important; border: 1px solid var(--brand-solid); }
.site-btn--primary:hover { background: var(--brand-solid-hover); }
.site-btn--ghost { background: var(--surface); color: var(--ink) !important; border: 1px solid var(--line); }
.site-btn--ghost:hover { border-color: var(--brand-border); color: var(--brand) !important; }

.site-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  flex-shrink: 0;
}
.site-icon-btn:hover { color: var(--brand); border-color: var(--brand-border); }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--header-bg);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
}

.site-header__bar {
  max-width: 1320px;
  margin: 0 auto;
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--ink) !important;
  text-decoration: none !important;
  flex-shrink: 0;
}
.site-brand img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.site-nav__item { position: relative; }

.site-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2) !important;
  font: 500 0.92rem/1 var(--font);
  text-decoration: none !important;
  white-space: nowrap;
  cursor: pointer;
}
.site-nav__link:hover,
.site-dropdown.is-open > .site-nav__link { background: var(--line-soft); color: var(--ink) !important; }
.site-nav__link.is-active { color: var(--brand) !important; font-weight: 600; }

.site-dropdown__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  display: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  z-index: 1010;
}
.site-dropdown.is-open > .site-dropdown__panel { display: grid; }
/* hover bridge so the menu does not close while moving the pointer down */
.site-dropdown__panel::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -10px;
  height: 10px;
}

.site-dropdown__panel--classes {
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 4px;
  width: max-content;
}
.site-class-col { display: flex; flex-direction: column; padding: 8px; }
.site-class-col__title {
  font-weight: 700;
  color: var(--ink) !important;
  padding: 6px 8px;
  border-radius: 8px;
  text-decoration: none !important;
}
.site-class-col__link {
  color: var(--ink-2) !important;
  font-size: 0.9rem;
  padding: 6px 8px;
  border-radius: 8px;
  text-decoration: none !important;
}
.site-class-col__title:hover,
.site-class-col__link:hover { background: var(--brand-soft); color: var(--brand) !important; }

.site-dropdown__panel--list {
  min-width: 220px;
  gap: 2px;
}
.site-dropdown__panel--list a {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--ink-2) !important;
  font-size: 0.92rem;
  text-decoration: none !important;
}
.site-dropdown__panel--list a:hover { background: var(--brand-soft); color: var(--brand) !important; }

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.site-menu-btn { display: none; }

.site-subbar {
  display: none;
  gap: 8px;
  padding: 0 16px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.site-subbar::-webkit-scrollbar { display: none; }

.site-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2) !important;
  font: 500 0.85rem/1 var(--font);
  text-decoration: none !important;
  cursor: pointer;
}
.site-chip.is-active { border-color: var(--brand-border); background: var(--brand-soft); color: var(--brand) !important; }
.site-chip--strong { background: var(--ink); border-color: var(--ink); color: #fff !important; }
.site-chip[hidden] { display: none; }

@media (max-width: 1180px) {
  .site-header__bar { gap: 12px; }
  .site-nav__link { padding: 0 9px; }
}

@media (max-width: 1023px) {
  .site-header__bar { height: 56px; padding: 0 16px; }
  .site-nav,
  .site-hide-mobile { display: none !important; }
  .site-menu-btn { display: inline-flex; }
  .site-subbar { display: flex; }
}

/* ---------- Mobile drawer ---------- */

.site-drawer,
.site-search {
  position: fixed;
  inset: 0;
  z-index: 1100;
  visibility: hidden;
  pointer-events: none;
}
.site-drawer.is-open,
.site-search.is-open {
  visibility: visible;
  pointer-events: auto;
}

.site-drawer__backdrop,
.site-search__backdrop,
.site-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  opacity: 0;
  transition: opacity 0.2s;
}
.is-open > .site-drawer__backdrop,
.is-open > .site-search__backdrop { opacity: 1; }

.site-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(360px, 88vw);
  background: var(--surface);
  overflow-y: auto;
  padding: 16px 20px 32px;
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.site-drawer.is-open .site-drawer__panel { transform: none; }

.site-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.site-drawer__title { font-weight: 700; font-size: 1.1rem; color: var(--ink); }

.site-drawer__account {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}

.site-drawer__label {
  margin: 20px 0 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.site-drawer__class { border-bottom: 1px solid var(--line-soft); }
.site-drawer__class summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}
.site-drawer__class summary::-webkit-details-marker { display: none; }
.site-drawer__class[open] summary svg { transform: rotate(180deg); }
.site-drawer__class > div { display: flex; flex-direction: column; padding: 0 0 10px 8px; }
.site-drawer__class > div a,
.site-drawer__links a {
  padding: 9px 8px;
  border-radius: 8px;
  color: var(--ink-2) !important;
  text-decoration: none !important;
}
.site-drawer__class > div a:hover,
.site-drawer__links a:hover { background: var(--brand-soft); color: var(--brand) !important; }
.site-drawer__links { display: flex; flex-direction: column; }

/* ---------- Search ---------- */

.site-search__panel {
  position: relative;
  width: min(640px, calc(100vw - 32px));
  margin: 10vh auto 0;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateY(-8px);
  opacity: 0;
  transition: transform 0.2s, opacity 0.2s;
}
.site-search.is-open .site-search__panel { transform: none; opacity: 1; }

.site-search__field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.site-search__field input {
  flex: 1;
  height: 56px;
  border: 0;
  outline: none;
  font: 400 1rem var(--font);
  color: var(--ink);
  background: transparent;
}
.site-search__esc {
  border: 1px solid var(--line);
  background: var(--line-soft);
  border-radius: 6px;
  font-size: 0.75rem;
  padding: 2px 8px;
  color: var(--muted);
  cursor: pointer;
}

.site-search__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
}
.site-search__chips[hidden] { display: none; }
.site-search__chips button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.85rem;
  color: var(--ink-2);
  cursor: pointer;
}
.site-search__chips button:hover { border-color: var(--brand-border); color: var(--brand); }

.site-search__results {
  max-height: min(60vh, 480px);
  overflow-y: auto;
}
.site-search__result {
  display: block;
  padding: 12px 16px;
  border-top: 1px solid var(--line-soft);
  text-decoration: none !important;
}
.site-search__result:hover,
.site-search__result:focus { background: var(--brand-soft); outline: none; }
.site-search__result-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 4px;
  padding: 1px 6px;
  margin-bottom: 4px;
}
.site-search__result-title { display: block; font-weight: 600; color: var(--ink); }
.site-search__result-desc { display: block; font-size: 0.85rem; color: var(--muted); }
.site-search__empty { padding: 20px 16px; color: var(--muted); font-size: 0.9rem; }

body.site-lock { overflow: hidden !important; }

/* ==========================================================================
   Chapter / solution pages
   Legacy markup: body > .row > .col-lg-2 (#side) | .col-lg-7 | .col-lg-3
   ========================================================================== */

body > .row:has(> .col-lg-7) {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 300px;
  gap: 28px;
  max-width: 1320px;
  margin: 0 auto !important;
  padding: 24px 24px 0;
  align-items: start;
}
body > .row:has(> .col-lg-7) > [class*="col-"] {
  max-width: none !important;
  width: auto !important;
  flex: none !important;
  padding: 0 !important;
  min-width: 0;
}
body > .row:has(> .col-lg-7) > .col-lg-2:empty,
body > .row:has(> .col-lg-7) > .col-lg-3:empty { min-height: 1px; }

#side {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  margin: 0 !important;
}

@media (max-width: 1199px) {
  body > .row:has(> .col-lg-7) {
    grid-template-columns: minmax(0, 1fr) 280px;
  }
  body > .row:has(> .col-lg-7) > .col-lg-7 { grid-column: 1; grid-row: 1 / span 2; }
  body > .row:has(> .col-lg-7) > .col-lg-3 { grid-column: 2; grid-row: 1; }
  body > .row:has(> .col-lg-7) > .col-lg-2 { grid-column: 2; grid-row: 2; }
  #side { position: static; }
}

@media (max-width: 860px) {
  body > .row:has(> .col-lg-7) {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 16px 16px 0;
  }
  body > .row:has(> .col-lg-7) > .col-lg-7,
  body > .row:has(> .col-lg-7) > .col-lg-3,
  body > .row:has(> .col-lg-7) > .col-lg-2 { grid-column: 1; grid-row: auto; }
  body > .row:has(> .col-lg-7) > .col-lg-7 { order: 1; }
  body > .row:has(> .col-lg-7) > .col-lg-3 { order: 2; }
  body > .row:has(> .col-lg-7) > .col-lg-2 { order: 3; }
}

.row > .col-lg-7 { padding-top: 0 !important; }

/* Page heading block used by every solution page */
.col-lg-7 > section.mb-5:first-of-type,
.col-lg-7 section.mb-5.space-y-2 {
  margin-bottom: 20px !important;
}
.col-lg-7 section.mb-5 > .inline-flex.rounded-full:first-child {
  background: var(--brand-soft) !important;
  color: var(--brand-strong) !important;
  letter-spacing: 0.08em !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  padding: 4px 10px !important;
}
.col-lg-7 section.mb-5 > p.text-sky-600 {
  display: inline-block;
  color: var(--brand) !important;
  background: var(--surface);
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  padding: 2px 12px;
}
.col-lg-7 section.mb-5 > span.block.h-1 { display: none !important; }
.col-lg-7 h1 {
  font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem) !important;
  line-height: 1.25 !important;
  font-weight: 800 !important;
  color: var(--ink) !important;
  margin: 8px 0 !important;
}

/* Main content card */
.col-lg-7 > .bg-white {
  border-radius: var(--radius-lg) !important;
  border: 1px solid var(--line) !important;
  box-shadow: var(--shadow-sm);
  padding: 28px !important;
}
@media (max-width: 640px) {
  .col-lg-7 > .bg-white { padding: 14px !important; border-radius: var(--radius) !important; }
}

/* Solution images */
.mathsPageImg {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
}
.mathsPageImg + br { display: none; }

/* Exercise switcher */
.exercise-links {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px !important;
  margin: 0 0 24px !important;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--line-soft);
}
.exercise-links:last-of-type { border-bottom: 0; padding-bottom: 0; }
.exercise-links > a,
.exercise-links > .is-current {
  display: inline-flex !important;
  align-items: center;
  height: 36px;
  padding: 0 14px !important;
  border-radius: 999px !important;
  border: 1px solid var(--line) !important;
  background: var(--surface);
  color: var(--ink-2) !important;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none !important;
}
.exercise-links > a:hover { border-color: var(--brand-border) !important; color: var(--brand) !important; background: var(--brand-soft) !important; }
.exercise-links > .is-current { background: var(--brand-solid); border-color: var(--brand-solid) !important; color: #fff !important; }

/* Previous / next exercise (inserted by site.js) */
.ex-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 24px 0;
}
.ex-pager a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  text-decoration: none !important;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ex-pager a:hover { border-color: var(--brand-border); box-shadow: var(--shadow); }
.ex-pager__dir { font-size: 0.78rem; color: var(--muted); font-weight: 500; }
.ex-pager__name { font-weight: 700; color: var(--ink); }
.ex-pager__next { grid-column: 2; text-align: right; }

/* Text-based solutions (Class 6/7 maths, science chapters) */
.col-lg-7 h5.question,
.col-lg-7 .question {
  display: inline-block;
  margin: 24px 0 8px;
  padding: 2px 10px;
  border-radius: 6px;
  background: var(--question-bg);
  color: var(--question-ink) !important;
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: capitalize;
}
.col-lg-7 .answer { color: var(--success) !important; font-weight: 700; }
.col-lg-7 > .bg-white p,
.col-lg-7 > .bg-white li { font-size: 1rem; color: var(--ink-2); }
.col-lg-7 table { max-width: 100%; }
.col-lg-7 .table-responsive,
.col-lg-7 table { display: block; overflow-x: auto; }

/* Right rail chapter list */
.topic {
  background: var(--surface);
  border: 1px solid var(--line) !important;
  border-radius: var(--radius-lg) !important;
  padding: 16px 12px !important;
  margin: 0 0 20px !important;
  box-shadow: var(--shadow-sm);
}
.topic::before {
  content: "Chapters";
  display: block;
  padding: 0 8px 10px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
  font-weight: 700;
  color: var(--ink);
}
.topic .chapters,
.panel .chapters { margin: 0 !important; }
.topic .chapters a,
.panel .chapters a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--ink-2) !important;
  text-decoration: none !important;
}
.topic .chapters a:hover,
.panel .chapters a:hover { background: var(--line-soft); color: var(--brand) !important; }
.topic .chapters a.is-current,
.panel .chapters a.is-current {
  background: var(--brand-soft);
  color: var(--brand) !important;
  font-weight: 600;
}

/* Left rail cards */
#side .rounded-\[24px\] {
  border-radius: var(--radius-lg) !important;
  border-color: var(--line) !important;
  background: var(--surface) !important;
}

/* Mobile "Chapters" bottom sheet: reuses the legacy .panel markup */
.panel { display: none; }
body.chapters-open .panel {
  display: block !important;
  position: fixed !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  top: auto !important;
  width: 100% !important;
  max-height: 80vh !important;
  margin: 0 !important;
  padding: 0 12px 24px !important;
  overflow-y: auto;
  background: var(--surface) !important;
  color: var(--ink-2) !important;
  border-radius: 20px 20px 0 0 !important;
  box-shadow: var(--shadow-lg) !important;
  z-index: 1101 !important;
}
body.chapters-open .panel::before {
  content: "Chapters";
  position: sticky;
  top: 0;
  display: block;
  padding: 18px 10px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 6px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
}
.site-sheet-backdrop { position: fixed; z-index: 1100; display: none; }
body.chapters-open .site-sheet-backdrop { display: block; opacity: 1; }

/* Comment box row printed after the content */
.jumbotron {
  background: var(--surface) !important;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg) !important;
  padding: 24px !important;
  box-shadow: var(--shadow-sm);
}

/* Ad slots: keep space but blend with the page */
.top-add-container,
.body-add-container { margin: 16px 0 !important; }

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  margin-top: 64px;
  background: #0b1120;
  color: #cbd5e1;
  font-size: 0.92rem;
}
.site-footer a { color: #cbd5e1 !important; text-decoration: none !important; }
.site-footer a:hover { color: #fff !important; }

.site-footer__inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 48px 24px 32px;
  display: grid;
  grid-template-columns: 1.4fr repeat(4, 1fr);
  gap: 32px;
}
.site-footer__brand p { color: #94a3b8; margin: 12px 0 0; max-width: 300px; line-height: 1.6; }
.site-footer__logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: #fff !important; }
.site-footer__logo img { width: 36px; height: 36px; border-radius: 10px; }
.site-footer h3 {
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin: 0 0 14px;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.site-footer__bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.site-footer__bottom > div {
  max-width: 1320px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  color: #64748b;
  font-size: 0.85rem;
}

@media (max-width: 960px) {
  .site-footer__inner { grid-template-columns: 1fr 1fr; }
  .site-footer__brand { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .site-footer__inner { padding: 36px 16px 24px; gap: 28px; }
}

/* ==========================================================================
   Home page (/index.php)
   ========================================================================== */

.hp { background: var(--surface); }
.hp h1, .hp h2, .hp h3 { margin: 0; color: var(--ink); }
.hp p { margin: 0; }
.hp a { text-decoration: none !important; }

.hp-wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .hp-wrap { padding: 0 16px; } }

.hp-tone-blue   { --tone: #2563eb; --tone-soft: #eff6ff; --tone-line: #bfdbfe; }
.hp-tone-violet { --tone: #7c3aed; --tone-soft: #f5f3ff; --tone-line: #ddd6fe; }
.hp-tone-teal   { --tone: #0d9488; --tone-soft: #f0fdfa; --tone-line: #99f6e4; }
.hp-tone-amber  { --tone: #d97706; --tone-soft: #fffbeb; --tone-line: #fde68a; }
.hp-tone-rose   { --tone: #e11d48; --tone-soft: #fff1f2; --tone-line: #fecdd3; }
.hp-tone-sky    { --tone: #0284c7; --tone-soft: #f0f9ff; --tone-line: #bae6fd; }

.hp-notfound {
  margin: 20px 0 0;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid #fde68a;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.92rem;
}

/* Hero */
.hp-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(244, 114, 182, 0.35), transparent 60%),
    radial-gradient(700px 400px at 0% 110%, rgba(56, 189, 248, 0.3), transparent 60%),
    linear-gradient(135deg, #1e1b4b 0%, #3730a3 50%, #6d28d9 100%);
  color: #e0e7ff;
}
.hp-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent 80%);
  pointer-events: none;
}
.hp-hero__grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
  padding-top: 72px;
  padding-bottom: 80px;
}
.hp-hero__eyebrow {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 20px;
}
.hp-hero h1 {
  color: #fff;
  font-size: clamp(2rem, 1.3rem + 2.8vw, 3.4rem);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.025em;
}
.hp-hero h1 span {
  background: linear-gradient(90deg, #fde68a, #f9a8d4);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hp-hero__lead {
  margin-top: 18px !important;
  max-width: 560px;
  font-size: 1.1rem;
  line-height: 1.6;
  color: #c7d2fe;
}
.hp-hero__search {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 560px;
  height: 56px;
  margin-top: 28px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  color: var(--muted);
  font: 400 0.98rem var(--font);
  text-align: left;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.3);
  cursor: text;
}
.hp-hero__search svg { color: var(--brand); flex-shrink: 0; }
.hp-hero__search span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hp-hero__classes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}
.hp-hero__classes > span { font-size: 0.88rem; color: #c7d2fe; margin-right: 4px; }
.hp-hero__classes a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #fff !important;
  font-weight: 700;
  transition: background 0.15s, transform 0.15s;
}
.hp-hero__classes a:hover { background: #fff; color: var(--brand-strong) !important; transform: translateY(-2px); }

/* Hero illustration: a sample solution card */
.hp-hero__art { position: relative; padding: 24px 12px; }
.hp-sheet {
  background: #fff;
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.35);
  transform: rotate(-1.5deg);
  color: var(--ink-2);
}
.hp-sheet__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.hp-sheet__tag { font-size: 0.75rem; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 4px 10px; border-radius: 999px; }
.hp-sheet__ex { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.hp-sheet__q { font-size: 0.98rem; color: var(--ink) !important; margin-bottom: 14px !important; line-height: 1.5; }
.hp-sheet__step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--page);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.98rem;
  color: var(--ink);
  margin-top: 8px;
}
.hp-sheet__step span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font: 700 0.72rem var(--font);
  flex-shrink: 0;
}
.hp-sheet__step--ans { background: #f0fdf4; color: var(--success); font-weight: 700; }
.hp-sheet__step--ans span { background: #dcfce7; color: var(--success); }
.hp-float {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.25);
}
.hp-float--mcq { top: -4px; right: 0; color: #b45309; }
.hp-float--notes { bottom: -6px; left: -6px; color: var(--success); }

@media (max-width: 900px) {
  .hp-hero__grid { grid-template-columns: 1fr; gap: 32px; padding-top: 44px; padding-bottom: 56px; }
  .hp-hero__art { max-width: 460px; }
}
@media (max-width: 640px) {
  .hp-hero__art { display: none; }
  .hp-hero__lead { font-size: 1rem; }
}

/* Sections */
.hp-section { padding: 72px 0; }
.hp-section--tint { background: var(--page); }
@media (max-width: 640px) { .hp-section { padding: 48px 0; } }

.hp-head { margin-bottom: 32px; }
.hp-head h2 { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); font-weight: 800; letter-spacing: -0.02em; }
.hp-head p { margin-top: 8px !important; color: var(--muted); font-size: 1.02rem; }
.hp-head--row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* Class cards */
.hp-classes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.hp-class {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.hp-class:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--tone-line); }
.hp-class__main {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px;
  background: linear-gradient(160deg, var(--tone-soft), var(--surface) 70%);
}
.hp-class__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--tone);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 10px;
}
.hp-class__label { font-size: 1.2rem; font-weight: 800; color: var(--ink); }
.hp-class__more { font-size: 0.85rem; font-weight: 600; color: var(--tone); }
.hp-class__subjects {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line-soft);
}
.hp-class__subjects a {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--tone-soft);
  color: var(--tone) !important;
  font-size: 0.8rem;
  font-weight: 600;
}
.hp-class__subjects a:hover { background: var(--tone); color: #fff !important; }
@media (max-width: 1024px) { .hp-classes { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) {
  .hp-classes { grid-template-columns: 1fr 1fr; gap: 12px; }
  .hp-class__main { padding: 16px; }
  .hp-class__subjects { padding: 12px 16px 14px; }
}

/* Resources */
.hp-resources { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.hp-resource {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.hp-resource:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--tone-line); }
.hp-resource__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--tone-soft);
  color: var(--tone);
  margin-bottom: 6px;
}
.hp-resource__title { font-size: 1.1rem; font-weight: 700; color: var(--ink); }
.hp-resource__body { color: var(--muted); font-size: 0.95rem; line-height: 1.55; flex: 1; }
.hp-resource__go { margin-top: 6px; font-size: 0.9rem; font-weight: 600; color: var(--tone); }
@media (max-width: 900px) { .hp-resources { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .hp-resources { grid-template-columns: 1fr; } .hp-resource { padding: 20px; } }

.hp-ad { margin-top: 24px; margin-bottom: 0; }

/* Steps */
.hp-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  counter-reset: none;
}
.hp-step {
  position: relative;
  padding: 28px 24px 24px;
  border-radius: var(--radius-lg);
  background: var(--page);
  border: 1px solid var(--line);
}
.hp-step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand-solid);
  color: #fff;
  font-weight: 800;
  margin-bottom: 14px;
}
.hp-step h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.hp-step p { color: var(--muted); font-size: 0.95rem; line-height: 1.55; }
@media (max-width: 760px) { .hp-steps { grid-template-columns: 1fr; } }

/* Recommended book */
.hp-book {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border-radius: var(--radius-lg);
  border: 1px solid #fde68a;
  background: linear-gradient(90deg, #fffbeb, #fff);
}
.hp-book__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #fef3c7;
  color: #b45309;
  flex-shrink: 0;
}
.hp-book__text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.hp-book__eyebrow { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #b45309; }
.hp-book__title { font-weight: 700; color: var(--ink); }
.hp-book__cta {
  flex-shrink: 0;
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 600;
}
@media (max-width: 560px) {
  .hp-book { flex-wrap: wrap; }
  .hp-book__cta { width: 100%; text-align: center; }
}

/* Blog */
.hp-blog { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.hp-post {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.hp-post:hover { box-shadow: var(--shadow); border-color: var(--brand-border); }
.hp-post__tag { align-self: flex-start; font-size: 0.75rem; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 3px 10px; border-radius: 999px; }
.hp-post h3 { font-size: 1.12rem; font-weight: 700; line-height: 1.35; }
.hp-post p { color: var(--muted); font-size: 0.95rem; line-height: 1.55; flex: 1; }
.hp-post__go { font-size: 0.9rem; font-weight: 600; color: var(--brand); }
@media (max-width: 760px) { .hp-blog { grid-template-columns: 1fr; } }

/* FAQ */
.hp-faq { max-width: 820px; }
.hp-faq .hp-head { text-align: center; }
.hp-faq__list { display: grid; gap: 10px; }
.hp-faq__item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 0 20px;
}
.hp-faq__item summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px 0;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
}
.hp-faq__item summary::-webkit-details-marker { display: none; }
.hp-faq__item summary::after {
  content: "+";
  font-size: 1.4rem;
  font-weight: 400;
  line-height: 1;
  color: var(--brand);
  flex-shrink: 0;
}
.hp-faq__item[open] summary::after { content: "−"; }
.hp-faq__item p { padding: 0 0 18px; color: var(--muted); line-height: 1.6; }

/* Call to action */
.hp-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin: 72px 0 24px;
  padding: 40px;
  border-radius: 20px;
  background:
    radial-gradient(500px 200px at 100% 0%, rgba(244, 114, 182, 0.35), transparent 60%),
    linear-gradient(135deg, #3730a3, #6d28d9);
  color: #e0e7ff;
}
.hp-cta h2 { color: #fff !important; font-size: clamp(1.4rem, 1.1rem + 1vw, 1.9rem); font-weight: 800; }
.hp-cta p { margin-top: 8px !important; max-width: 520px; color: #c7d2fe; }
.hp-cta__actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hp-btn {
  display: inline-flex;
  align-items: center;
  height: 48px;
  padding: 0 22px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
}
.hp-btn--light { background: #fff; color: var(--brand-strong) !important; }
.hp-btn--light:hover { background: #eef2ff; }
.hp-btn--outline { border: 1px solid rgba(255, 255, 255, 0.4); color: #fff !important; }
.hp-btn--outline:hover { background: rgba(255, 255, 255, 0.1); }
@media (max-width: 640px) {
  .hp-cta { padding: 28px 20px; margin-top: 48px; }
  .hp-cta__actions, .hp-btn { width: 100%; justify-content: center; }
}

/* Other tools strip */
.hp-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px dashed var(--line);
  color: var(--muted) !important;
  font-size: 0.9rem;
}
.hp-tools b { color: var(--ink); }
.hp-tools__go { font-weight: 600; color: var(--brand); }
.hp + .site-footer { margin-top: 48px; }

/* Legacy styles.css pads <main> and every .row by 50px to clear the old fixed header.
   The new header is sticky and takes its own space, so remove that offset. */
body > main { padding-top: 0 !important; }
body > .row:has(> .col-lg-7) { padding-top: 24px !important; }
@media (max-width: 860px) {
  body > .row:has(> .col-lg-7) { padding-top: 16px !important; }
}
/* Let hero columns shrink below the search placeholder's one-line width */
.hp-hero__grid > * { min-width: 0; }

/* ==========================================================================
   Motion
   ========================================================================== */

/* Banner: slowly flowing colours */
.hp-hero {
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(244, 114, 182, 0.35), transparent 60%),
    radial-gradient(700px 400px at 0% 110%, rgba(56, 189, 248, 0.3), transparent 60%),
    linear-gradient(120deg, #1e1b4b, #3730a3, #6d28d9, #be185d, #4338ca, #1e1b4b);
  background-size: auto, auto, 400% 400%;
  animation: hp-flow 18s ease-in-out infinite alternate;
}
@keyframes hp-flow {
  0%   { background-position: 0 0, 0 0, 0% 50%; }
  100% { background-position: 0 0, 0 0, 100% 50%; }
}

/* Soft glowing orbs drifting behind the banner content */
.hp-hero::before {
  content: "";
  position: absolute;
  width: 520px;
  height: 520px;
  right: -120px;
  top: -160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(250, 204, 21, 0.22), transparent 65%);
  animation: hp-drift 14s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes hp-drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-140px, 90px) scale(1.15); }
}

/* Shimmering highlight word */
.hp-hero h1 span {
  background: linear-gradient(90deg, #fde68a, #f9a8d4, #a5b4fc, #fde68a);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: hp-shimmer 6s linear infinite;
}
@keyframes hp-shimmer {
  to { background-position: 300% 0; }
}

/* Hero entrance */
.hp-hero__copy > * {
  opacity: 0;
  animation: hp-rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.hp-hero__copy > :nth-child(1) { animation-delay: 0.05s; }
.hp-hero__copy > :nth-child(2) { animation-delay: 0.15s; }
.hp-hero__copy > :nth-child(3) { animation-delay: 0.25s; }
.hp-hero__copy > :nth-child(4) { animation-delay: 0.35s; }
.hp-hero__copy > :nth-child(5) { animation-delay: 0.45s; }
/* Transform-only: any opacity animation on this wrapper leaves the floating
   card unpainted in Chrome, so the card slides in without fading */
.hp-hero__art { animation: hp-slide 0.9s 0.2s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes hp-slide {
  from { transform: translateY(40px); }
  to   { transform: none; }
}

@keyframes hp-rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: none; }
}

/* Floating sample card and badges */
.hp-sheet { animation: hp-float 6s ease-in-out infinite; }
.hp-float--mcq { animation: hp-bob 5s ease-in-out infinite; }
.hp-float--notes { animation: hp-bob 5s 1.2s ease-in-out infinite; }
@keyframes hp-float {
  0%, 100% { transform: rotate(-1.5deg) translateY(0); }
  50%      { transform: rotate(-0.5deg) translateY(-10px); }
}
@keyframes hp-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

/* Search bar and buttons */
.hp-hero__search { transition: transform 0.2s, box-shadow 0.2s; }
.hp-hero__search:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(15, 23, 42, 0.38); }
.site-btn, .hp-btn, .hp-book__cta { transition: transform 0.15s, background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s; }
.site-btn:hover, .hp-btn:hover, .hp-book:hover .hp-book__cta { transform: translateY(-1px); }
.hp-resource__icon, .hp-class__num { transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1); }
.hp-resource:hover .hp-resource__icon,
.hp-class:hover .hp-class__num { transform: scale(1.1) rotate(-4deg); }
.hp-resource__go, .hp-class__more, .hp-post__go { transition: letter-spacing 0.2s, padding 0.2s; }
.hp-resource:hover .hp-resource__go,
.hp-class:hover .hp-class__more,
.hp-post:hover .hp-post__go { padding-left: 4px; }
.hp-cta { background-size: auto, 200% 200%; animation: hp-flow-cta 12s ease-in-out infinite alternate; }
@keyframes hp-flow-cta {
  from { background-position: 0 0, 0% 50%; }
  to   { background-position: 0 0, 100% 50%; }
}
.hp-cta { background-image: radial-gradient(500px 200px at 100% 0%, rgba(244, 114, 182, 0.35), transparent 60%), linear-gradient(135deg, #3730a3, #6d28d9, #be185d); }

/* Scroll reveal (site.js adds .reveal only when JavaScript runs) */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--reveal-delay, 0s);
}
.reveal.is-visible { opacity: 1; transform: none; }
/* keep the hover lift working once revealed */
.reveal.is-visible.hp-class:hover,
.reveal.is-visible.hp-resource:hover { transform: translateY(-3px); transition-delay: 0s; }

/* Smooth scrolling and FAQ answer fade */
html { scroll-behavior: smooth; }
.hp-faq__item[open] p { animation: hp-rise 0.35s ease-out; }

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

/* ==========================================================================
   Dark theme
   <html data-theme="dark"> is set before first paint by the inline script in
   header.php (saved choice, otherwise the device setting).
   ========================================================================== */

/* Sun / moon toggle */
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.theme-toggle svg { transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.theme-toggle:hover svg { transform: rotate(-20deg); }

/* Smooth colour change when switching (class added briefly by site.js) */
html.theme-switching,
html.theme-switching *,
html.theme-switching *::before,
html.theme-switching *::after {
  transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease, fill 0.35s ease !important;
}

[data-theme="dark"] {
  color-scheme: dark;
  --brand: #818cf8;
  --brand-strong: #a5b4fc;
  --brand-soft: rgba(99, 102, 241, 0.16);
  --brand-border: rgba(129, 140, 248, 0.45);
  --brand-solid: #6366f1;
  --brand-solid-hover: #4f46e5;
  --ink: #f1f5f9;
  --ink-2: #cbd5e1;
  --muted: #94a3b8;
  --line: #263248;
  --line-soft: #1b2539;
  --surface: #111a2e;
  --page: #0a1020;
  --success: #4ade80;
  --header-bg: rgba(10, 16, 32, 0.92);
  --question-bg: rgba(248, 113, 113, 0.14);
  --question-ink: #fca5a5;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 48px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] body { background: var(--page) !important; color: var(--ink-2); }

/* Home page tones become translucent tints on dark surfaces */
[data-theme="dark"] .hp-tone-blue   { --tone: #60a5fa; --tone-soft: rgba(59, 130, 246, 0.14);  --tone-line: rgba(96, 165, 250, 0.45); }
[data-theme="dark"] .hp-tone-violet { --tone: #a78bfa; --tone-soft: rgba(139, 92, 246, 0.14); --tone-line: rgba(167, 139, 250, 0.45); }
[data-theme="dark"] .hp-tone-teal   { --tone: #2dd4bf; --tone-soft: rgba(20, 184, 166, 0.14);  --tone-line: rgba(45, 212, 191, 0.45); }
[data-theme="dark"] .hp-tone-amber  { --tone: #fbbf24; --tone-soft: rgba(245, 158, 11, 0.14);  --tone-line: rgba(251, 191, 36, 0.45); }
[data-theme="dark"] .hp-tone-rose   { --tone: #fb7185; --tone-soft: rgba(244, 63, 94, 0.14);   --tone-line: rgba(251, 113, 133, 0.45); }
[data-theme="dark"] .hp-tone-sky    { --tone: #38bdf8; --tone-soft: rgba(14, 165, 233, 0.14);  --tone-line: rgba(56, 189, 248, 0.45); }
[data-theme="dark"] .hp-class__num { color: #0a1020; }
[data-theme="dark"] .hp-class__subjects a:hover { color: #0a1020 !important; }

[data-theme="dark"] .hp-hero {
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(244, 114, 182, 0.22), transparent 60%),
    radial-gradient(700px 400px at 0% 110%, rgba(56, 189, 248, 0.18), transparent 60%),
    linear-gradient(120deg, #0f0c2e, #1e1b5e, #3b1a78, #6b1245, #26236f, #0f0c2e);
  background-size: auto, auto, 400% 400%;
}
[data-theme="dark"] .hp-sheet,
[data-theme="dark"] .hp-float { background: #16203a; color: var(--ink); }
[data-theme="dark"] .hp-sheet__step { background: #0f1830; }
[data-theme="dark"] .hp-sheet__step--ans { background: rgba(34, 197, 94, 0.14); }
[data-theme="dark"] .hp-sheet__step--ans span { background: rgba(34, 197, 94, 0.25); }
[data-theme="dark"] .hp-float--mcq { color: #fbbf24; }
[data-theme="dark"] .hp-book { border-color: rgba(251, 191, 36, 0.35); background: linear-gradient(90deg, rgba(245, 158, 11, 0.12), var(--surface)); }
[data-theme="dark"] .hp-book__icon { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
[data-theme="dark"] .hp-book__eyebrow { color: #fbbf24; }
[data-theme="dark"] .hp-book__cta { background: var(--brand-solid); }
[data-theme="dark"] .hp-notfound { background: rgba(245, 158, 11, 0.12); border-color: rgba(251, 191, 36, 0.35); color: #fcd34d; }
[data-theme="dark"] .hp-cta {
  background-image:
    radial-gradient(500px 200px at 100% 0%, rgba(244, 114, 182, 0.25), transparent 60%),
    linear-gradient(135deg, #1e1b5e, #3b1a78, #6b1245);
}
[data-theme="dark"] .hp-btn--light { background: #f1f5f9; color: #1e1b5e !important; }

[data-theme="dark"] .site-footer { background: #060a16; border-top: 1px solid var(--line-soft); }
[data-theme="dark"] .site-chip--strong { background: var(--brand-solid); border-color: var(--brand-solid); }
[data-theme="dark"] .mathsPageImg { filter: brightness(0.92); border-color: var(--line); }

/* ---- Legacy Tailwind utilities used across older pages ---- */
[data-theme="dark"] .bg-white,
[data-theme="dark"] [class~="bg-white/90"],
[data-theme="dark"] [class~="bg-white/80"],
[data-theme="dark"] [class~="bg-white/70"] { background-color: var(--surface) !important; }
[data-theme="dark"] .bg-slate-50,
[data-theme="dark"] [class~="bg-slate-50/70"],
[data-theme="dark"] [class~="bg-slate-50/60"],
[data-theme="dark"] .bg-gray-50,
[data-theme="dark"] .bg-slate-100 { background-color: var(--page) !important; }
[data-theme="dark"] .bg-sky-50,
[data-theme="dark"] .bg-indigo-50,
[data-theme="dark"] .bg-blue-50 { background-color: var(--brand-soft) !important; }
[data-theme="dark"] .text-slate-900,
[data-theme="dark"] .text-slate-800,
[data-theme="dark"] .text-gray-900,
[data-theme="dark"] .text-gray-800 { color: var(--ink) !important; }
[data-theme="dark"] .text-slate-700,
[data-theme="dark"] .text-slate-600,
[data-theme="dark"] .text-gray-700,
[data-theme="dark"] .text-gray-600 { color: var(--ink-2) !important; }
[data-theme="dark"] .text-slate-500,
[data-theme="dark"] .text-slate-400,
[data-theme="dark"] .text-gray-500 { color: var(--muted) !important; }
[data-theme="dark"] .text-sky-600,
[data-theme="dark"] .text-sky-700,
[data-theme="dark"] .text-sky-800,
[data-theme="dark"] .text-blue-600 { color: #7dd3fc !important; }
[data-theme="dark"] .border-slate-100,
[data-theme="dark"] .border-slate-200,
[data-theme="dark"] .border-indigo-50,
[data-theme="dark"] .border-sky-100,
[data-theme="dark"] .border-sky-200,
[data-theme="dark"] .border-gray-200 { border-color: var(--line) !important; }
/* light gradient section backgrounds (from-sky-50 / via-white / to-white) */
[data-theme="dark"] [class*="from-sky-50"],
[data-theme="dark"] [class*="from-slate-50"],
[data-theme="dark"] [class*="to-white"] { background-image: none !important; background-color: var(--page) !important; }

/* ---- Bootstrap and old stylesheet pieces ---- */
[data-theme="dark"] .card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .list-group-item { background-color: var(--surface); color: var(--ink-2); border-color: var(--line); }
[data-theme="dark"] .table,
[data-theme="dark"] table { color: var(--ink-2); border-color: var(--line); }
[data-theme="dark"] .table td,
[data-theme="dark"] .table th,
[data-theme="dark"] td,
[data-theme="dark"] th { border-color: var(--line) !important; }
[data-theme="dark"] input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
[data-theme="dark"] textarea,
[data-theme="dark"] select,
[data-theme="dark"] .form-control {
  background-color: var(--page) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}
[data-theme="dark"] ::placeholder { color: var(--muted) !important; }
[data-theme="dark"] .hp-hero__search { background: #16203a; color: var(--muted); }
[data-theme="dark"] .chapters a,
[data-theme="dark"] .col-lg-7 p,
[data-theme="dark"] .col-lg-7 li { color: var(--ink-2); }
[data-theme="dark"] .col-lg-7 h1,
[data-theme="dark"] .col-lg-7 h2,
[data-theme="dark"] .col-lg-7 h3,
[data-theme="dark"] .col-lg-7 h4 { color: var(--ink) !important; }

/* Login / register pages (auth.css uses fixed light colours) */
[data-theme="dark"] .auth-page { background: var(--page) !important; }
[data-theme="dark"] .auth-container,
[data-theme="dark"] .auth-card { background: var(--surface) !important; border-color: var(--line) !important; box-shadow: var(--shadow-lg) !important; }
[data-theme="dark"] .auth-container h1,
[data-theme="dark"] .auth-card__title { color: var(--ink) !important; }
[data-theme="dark"] .auth-card__subtitle,
[data-theme="dark"] .auth-container p { color: var(--muted) !important; }
[data-theme="dark"] .auth-container label,
[data-theme="dark"] .auth-form__label { color: var(--ink-2) !important; }
[data-theme="dark"] .auth-container a { color: var(--brand) !important; }
[data-theme="dark"] .auth-card__message--error { background: var(--question-bg) !important; color: var(--question-ink) !important; }

/* Home: popular chapters */
.hp-popular {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.hp-popular__group {
  padding: 20px 22px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
}
.hp-popular__group h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px !important;
}
.hp-popular__group ul { list-style: none; margin: 0; padding: 0; }
.hp-popular__group li + li { border-top: 1px solid var(--line-soft); }
.hp-popular__group a {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 0;
  color: var(--ink-2) !important;
  font-size: 0.92rem;
}
.hp-popular__group a::after { content: "→"; color: var(--muted); transition: transform 0.15s; }
.hp-popular__group a:hover { color: var(--brand) !important; }
.hp-popular__group a:hover::after { color: var(--brand); transform: translateX(3px); }
@media (max-width: 960px) { .hp-popular { grid-template-columns: 1fr 1fr; } }
@media (max-width: 600px) { .hp-popular { grid-template-columns: 1fr; } }

/* Home: about copy */
.hp-about__body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 48px;
}
.hp-about h3 {
  font-size: 1.12rem;
  font-weight: 700;
  margin: 24px 0 8px !important;
}
.hp-about__body > div > h3:first-child { margin-top: 0 !important; }
.hp-about p,
.hp-about__list li { color: var(--ink-2); font-size: 0.98rem; line-height: 1.75; }
.hp-about a { color: var(--brand); text-decoration: underline !important; text-decoration-color: var(--brand-border); text-underline-offset: 3px; }
.hp-about a:hover { text-decoration-color: currentColor; }
.hp-about__list { margin: 0; padding-left: 20px; }
.hp-about__list li + li { margin-top: 6px; }
.hp-about__list b { color: var(--ink); }
@media (max-width: 860px) { .hp-about__body { grid-template-columns: 1fr; } }

.hp-about p + p { margin-top: 12px !important; }

/* ==========================================================================
   Class hub pages (class6.php … class10.php)
   ========================================================================== */

.cp { background: var(--page); }
.cp h1, .cp h2, .cp h3 { margin: 0; color: var(--ink); }
.cp p { margin: 0; }
.cp a { text-decoration: none !important; }
.cp-wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .cp-wrap { padding: 0 16px; } }

.cp-tone-blue  { --tone: #2563eb; --tone-soft: #eff6ff; --tone-line: #bfdbfe; }
.cp-tone-teal  { --tone: #0d9488; --tone-soft: #f0fdfa; --tone-line: #99f6e4; }
.cp-tone-amber { --tone: #d97706; --tone-soft: #fffbeb; --tone-line: #fde68a; }
[data-theme="dark"] .cp-tone-blue  { --tone: #60a5fa; --tone-soft: rgba(59, 130, 246, 0.14); --tone-line: rgba(96, 165, 250, 0.45); }
[data-theme="dark"] .cp-tone-teal  { --tone: #2dd4bf; --tone-soft: rgba(20, 184, 166, 0.14); --tone-line: rgba(45, 212, 191, 0.45); }
[data-theme="dark"] .cp-tone-amber { --tone: #fbbf24; --tone-soft: rgba(245, 158, 11, 0.14); --tone-line: rgba(251, 191, 36, 0.45); }

/* Hero: compact so chapters appear above the fold */
.cp-hero {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 28px 0 32px;
}
.cp-crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 14px;
}
.cp-crumbs a { color: var(--muted) !important; }
.cp-crumbs a:hover { color: var(--brand) !important; }
.cp-crumbs [aria-current] { color: var(--ink); font-weight: 600; }
.cp-hero h1 {
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.cp-hero__intro { margin-top: 10px !important; max-width: 720px; font-size: 1.05rem; color: var(--muted); line-height: 1.6; }
.cp-hero__jump { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.cp-jump {
  display: flex;
  flex-direction: column;
  min-width: 150px;
  padding: 12px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--tone-line);
  background: var(--tone-soft);
  transition: transform 0.15s, box-shadow 0.15s;
}
.cp-jump:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.cp-jump__name { font-weight: 700; color: var(--tone); }
.cp-jump__count { font-size: 0.82rem; color: var(--muted); }
@media (max-width: 480px) { .cp-jump { flex: 1 1 40%; min-width: 0; } }

/* Ad slots: labelled, height reserved so the page does not jump when ads load */
.cp-ad { margin: 24px 0; text-align: center; }
.cp-ad__label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.cp-ad--banner ins { min-height: 90px; }
.cp-ad--inline ins { min-height: 120px; }
.cp-ad--side { margin: 0 0 16px; }
.cp-ad--side ins { min-height: 250px; }

/* Main layout: chapters + sticky study sidebar */
.cp-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 32px;
  align-items: start;
  padding-bottom: 24px;
}
.cp-main { min-width: 0; }
.cp-side__sticky { position: sticky; top: calc(var(--header-h) + 16px); display: grid; gap: 16px; }
@media (max-width: 1023px) {
  .cp-layout { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .cp-side__sticky { position: static; }
}

/* Subject chapter lists */
.cp-subject {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 8px;
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.cp-subject__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}
.cp-subject__head h2 { font-size: clamp(1.2rem, 1rem + 0.8vw, 1.5rem); font-weight: 800; }
.cp-subject__head p { margin-top: 4px !important; color: var(--muted); font-size: 0.92rem; }
.cp-subject__hub { font-size: 0.9rem; font-weight: 600; color: var(--tone) !important; }

.cp-chapters {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.cp-chapters a {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
}
.cp-chapters a:hover { border-color: var(--tone-line); background: var(--tone-soft); transform: translateX(2px); }
.cp-chapter__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--tone-soft);
  color: var(--tone);
  font-weight: 800;
}
.cp-chapter__text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.cp-chapter__label { font-size: 0.75rem; font-weight: 600; color: var(--muted); }
.cp-chapter__title { font-weight: 600; color: var(--ink); line-height: 1.35; }
.cp-chapter__go { flex-shrink: 0; color: var(--muted); transition: color 0.15s, transform 0.15s; }
.cp-chapters a:hover .cp-chapter__go { color: var(--tone); transform: translateX(2px); }
@media (max-width: 720px) {
  .cp-chapters { grid-template-columns: 1fr; }
  .cp-subject { padding: 16px; }
}

/* Study copy + FAQ */
.cp-about,
.cp-faq {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-top: 8px;
}
.cp-faq { margin-top: 16px; display: grid; gap: 10px; }
.cp-about h2,
.cp-faq h2 { font-size: 1.3rem; font-weight: 800; margin-bottom: 12px !important; }
.cp-about p { color: var(--ink-2); line-height: 1.75; }
.cp-about p + p { margin-top: 12px !important; }
@media (max-width: 640px) { .cp-about, .cp-faq { padding: 18px; } }

/* Sidebar cards */
.cp-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
}
.cp-card__title { font-size: 1rem; font-weight: 700; margin-bottom: 8px !important; }
.cp-card > a {
  padding: 9px 10px;
  margin: 0 -10px;
  border-radius: 8px;
  color: var(--ink-2) !important;
  font-size: 0.92rem;
}
.cp-card > a:hover { background: var(--brand-soft); color: var(--brand) !important; }
.cp-card__classes { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.cp-card__classes a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  color: var(--ink-2) !important;
  font-weight: 700;
}
.cp-card__classes a:hover { border-color: var(--brand-border); color: var(--brand) !important; }
.cp-card__classes a.is-current { background: var(--brand-solid); border-color: var(--brand-solid); color: #fff !important; }
@media (max-width: 1023px) { .cp-side { margin-top: 16px; } }
@media (max-width: 640px) {
  .cp-hero { padding: 16px 0 18px; }
  .cp-crumbs { margin-bottom: 8px; font-size: 0.8rem; }
  .cp-hero__intro { font-size: 0.95rem; margin-top: 6px !important; }
  .cp-hero__jump { flex-wrap: nowrap; gap: 8px; margin-top: 14px; }
  .cp-jump { flex: 1 1 0; min-width: 0; padding: 8px 10px; }
  .cp-jump__name { font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .cp-jump__count { font-size: 0.75rem; }
  .cp-ad { margin: 14px 0; }
}

/* Class page subject tabs: sticky under the header so switching is always one tap away */
.cp-tabs {
  position: sticky;
  top: var(--header-h);
  z-index: 20;
  display: flex;
  gap: 8px;
  padding: 10px 0;
  margin-top: 8px;
  background: var(--page);
}
.cp-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font: 700 1rem var(--font);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.cp-tab:hover { border-color: var(--tone-line); color: var(--tone); }
.cp-tab[aria-selected="true"] {
  background: var(--tone);
  border-color: var(--tone);
  color: #fff;
  box-shadow: var(--shadow);
}
[data-theme="dark"] .cp-tab[aria-selected="true"] { color: #0a1020; }
.cp-tab__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--tone-soft);
  color: var(--tone);
  font-size: 0.78rem;
}
.cp-tab[aria-selected="true"] .cp-tab__count { background: rgba(255, 255, 255, 0.25); color: inherit; }
.cp-tabs + .cp-subject { margin-top: 0; }
.cp-subject[hidden] { display: none; }
@media (min-width: 721px) { .cp-tab { flex: 0 0 auto; min-width: 180px; } }
.cp-tone-violet { --tone: #7c3aed; --tone-soft: #f5f3ff; --tone-line: #ddd6fe; }
[data-theme="dark"] .cp-tone-violet { --tone: #a78bfa; --tone-soft: rgba(139, 92, 246, 0.14); --tone-line: rgba(167, 139, 250, 0.45); }
/* Three tabs on phones: tighter so they fit one row */
@media (max-width: 480px) {
  .cp-tab { padding: 0 8px; font-size: 0.88rem; gap: 6px; }
  .cp-tab__count { min-width: 22px; padding: 0 5px; }
}
@media (max-width: 640px) {
  .cp-hero__jump:has(> :nth-child(4)) { flex-wrap: wrap; }
  .cp-hero__jump:has(> :nth-child(4)) > .cp-jump { flex: 1 1 calc(50% - 4px); }
}

/* Side rail ads: only on screens wide enough for a 160px ad beside the content */
.cp-rail { display: none; }
@media (min-width: 1400px) {
  .cp-railwrap {
    display: grid;
    grid-template-columns: minmax(184px, 1fr) minmax(0, 1240px) minmax(184px, 1fr);
    align-items: start;
  }
  .cp-railwrap > .cp-wrap { width: 100%; }
  .cp-rail { display: block; height: 100%; }
  .cp-rail--left { justify-self: end; padding-right: 8px; }
  .cp-rail--right { justify-self: start; padding-left: 8px; }
  .cp-rail__sticky {
    position: sticky;
    top: calc(var(--header-h) + 16px);
    width: 160px;
    text-align: center;
  }
  .cp-rail__ad { min-height: 600px; }
}

/* Sidebar: full height of the row so the lower ad can stick beside the study guide and FAQ */
.cp-side { align-self: stretch; display: flex; flex-direction: column; gap: 16px; }
.cp-side__top { display: grid; gap: 16px; }
.cp-side__sticky { position: sticky; top: calc(var(--header-h) + 16px); display: block; }
.cp-side__sticky .cp-ad--side ins { min-height: 600px; }
@media (max-width: 1023px) {
  .cp-side__sticky { display: none; }
}

/* ==========================================================================
   Solution pages on wide screens: use the full width and fill the long side
   columns with one sticky ad each (added by site.js)
   ========================================================================== */
@media (min-width: 1200px) {
  body > .row:has(> .col-lg-7) {
    max-width: 1560px;
    grid-template-columns: 260px minmax(0, 1fr) 320px;
  }
  body > .row:has(> .col-lg-7) > .col-lg-2,
  body > .row:has(> .col-lg-7) > .col-lg-3 {
    align-self: stretch;
    display: flex;
    flex-direction: column;
  }
  /* The left cards scroll normally; the sticky ad below them follows the reader */
  body > .row[data-sticky-ads] #side { position: static; }
  .sol-sticky-ad {
    position: sticky;
    top: calc(var(--header-h) + 16px);
    margin-top: 16px;
    text-align: center;
  }
  .sol-sticky-ad ins { min-height: 600px; }
}

/* ==========================================================================
   NCERT Solutions hub (ncert-solution.php): every chapter, class-wise tabs
   ========================================================================== */
.ns-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.ns-col {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface);
}
.ns-col h3 {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--tone) !important;
  padding-bottom: 10px;
  margin-bottom: 6px !important;
  border-bottom: 1px solid var(--line-soft);
}
.ns-col h3 span { font-size: 0.78rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.ns-list { list-style: none; margin: 0; padding: 0; flex: 1; }
.ns-list a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 8px;
  margin: 0 -8px;
  border-radius: 8px;
  color: var(--ink-2) !important;
  font-size: 0.92rem;
  line-height: 1.4;
}
.ns-list a:hover { background: var(--tone-soft); color: var(--tone) !important; }
.ns-list__num {
  flex-shrink: 0;
  min-width: 22px;
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--tone);
  text-align: right;
}
.ns-col__all {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--tone) !important;
}
.cp-about h3 { font-size: 1.08rem; font-weight: 700; margin: 20px 0 6px !important; color: var(--ink); }
.cp-about a { color: var(--brand) !important; text-decoration: underline !important; text-decoration-color: var(--brand-border) !important; text-underline-offset: 3px; }
/* Five class tabs: allow wrapping into a compact grid on phones */
@media (max-width: 640px) {
  .cp-tabs:has(> :nth-child(5)) { flex-wrap: wrap; }
  .cp-tabs:has(> :nth-child(5)) > .cp-tab { flex: 1 1 calc(33% - 8px); height: 42px; }
}
/* Four or more tabs share the row evenly instead of using the fixed desktop width */
@media (min-width: 721px) {
  .cp-tabs:has(> :nth-child(4)) > .cp-tab { flex: 1 1 0; min-width: 0; padding: 0 10px; }
}

/* Subject pages: chapter cards with a one-line summary */
.cp-chapters--detailed a { align-items: flex-start; }
.cp-chapters--detailed .cp-chapter__num { margin-top: 2px; }
.cp-chapter__summary {
  margin-top: 4px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
}
.cp-chapters--detailed .cp-chapter__go { margin-top: 10px; }

/* Class Science MCQ pages */
.mcq-start {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--tone-soft);
  color: var(--tone);
  font-size: 0.82rem;
  font-weight: 700;
  transition: background-color 0.15s, color 0.15s;
}
.cp-chapters a:hover .mcq-start { background: var(--tone); color: #fff; }
[data-theme="dark"] .cp-chapters a:hover .mcq-start { color: #0a1020; }
.mcq-empty { color: var(--muted); padding: 8px 0; }

/* Home: Science MCQ cards */
.hp-section--mcq { padding-top: 0; }
.hp-mcqs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.hp-mcq {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-lg);
  border: 1px solid #fde68a;
  background: linear-gradient(160deg, #fffbeb, var(--surface) 75%);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.hp-mcq:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: #f59e0b; }
.hp-mcq__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #fef3c7;
  color: #b45309;
}
.hp-mcq__text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.hp-mcq__title { font-weight: 700; color: var(--ink); line-height: 1.3; }
.hp-mcq__sub { font-size: 0.8rem; color: var(--muted); }
.hp-mcq__go { color: #b45309; font-weight: 700; transition: transform 0.15s; }
.hp-mcq:hover .hp-mcq__go { transform: translateX(3px); }
[data-theme="dark"] .hp-mcq { border-color: rgba(251, 191, 36, 0.35); background: linear-gradient(160deg, rgba(245, 158, 11, 0.12), var(--surface) 75%); }
[data-theme="dark"] .hp-mcq__icon { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
[data-theme="dark"] .hp-mcq__go { color: #fbbf24; }
@media (max-width: 1100px) { .hp-mcqs { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .hp-mcqs { grid-template-columns: 1fr 1fr; } .hp-mcq { padding: 12px; gap: 10px; } .hp-mcq__go { display: none; } }
@media (max-width: 380px) { .hp-mcqs { grid-template-columns: 1fr; } }

/* Question bank */
.qb-search {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 640px;
  height: 52px;
  margin-top: 20px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}
.qb-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.qb-search input { flex: 1; min-width: 0; height: 100%; border: 0 !important; outline: none; background: transparent !important; font: 400 1rem var(--font); color: var(--ink) !important; box-shadow: none !important; }
.qb-subjects { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.qb-subject { padding: 4px 10px; border-radius: 999px; background: var(--line-soft); color: var(--ink-2); font-size: 0.82rem; }
.qb-subject b { color: var(--brand); margin-left: 2px; }
.qb-list { list-style: none; margin: 0; padding: 0; counter-reset: qb; }
.qb-list li + li { border-top: 1px solid var(--line-soft); }
.qb-list a { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 4px; color: var(--ink) !important; }
.qb-list a:hover .qb-list__q { color: var(--brand); }
.qb-list__q { font-weight: 600; line-height: 1.5; }
.qb-list__tag { flex-shrink: 0; font-size: 0.75rem; color: var(--muted); background: var(--line-soft); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.qb-empty { padding: 24px 4px; color: var(--muted); }
.qb-pages { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.qb-pages button {
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-weight: 600;
  cursor: pointer;
}
.qb-pages button:hover { border-color: var(--brand-border); color: var(--brand); }
.qb-pages button.is-current { background: var(--brand-solid); border-color: var(--brand-solid); color: #fff; }
@media (max-width: 640px) { .qb-list__tag { display: none; } }
/* Compact pager */
.qb-pages { align-items: center; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.qb-pages button:disabled { opacity: 0.4; cursor: default; }
.qb-pages button.is-current { cursor: default; }
.qb-pages__step { padding: 0 14px !important; }
.qb-pages__gap { min-width: 20px; text-align: center; color: var(--muted); }
.qb-pages__info { margin-left: auto; font-size: 0.85rem; color: var(--muted); }
@media (max-width: 480px) {
  .qb-pages { gap: 4px; }
  .qb-pages button { min-width: 34px; height: 34px; padding: 0 8px; }
  .qb-pages__step span { display: none; }
  .qb-pages__info { width: 100%; margin: 6px 0 0; text-align: center; }
}

/* Question bank: search + subject filters live inside the results card */
.qb-tools { padding-bottom: 16px; margin-bottom: 4px; border-bottom: 1px solid var(--line-soft); }
.qb-card .qb-search { max-width: none; margin-top: 0; }
.qb-card .qb-subjects { margin-top: 12px; }
button.qb-subject {
  border: 1px solid transparent;
  cursor: pointer;
  font: 500 0.82rem var(--font);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
button.qb-subject:hover { border-color: var(--brand-border); color: var(--brand); }
button.qb-subject.is-active { background: var(--brand-solid); border-color: var(--brand-solid); color: #fff; }
button.qb-subject.is-active b { color: rgba(255, 255, 255, 0.85); }
.qb-head { margin-top: 12px; }
.qb-empty p { margin: 0 0 12px !important; color: var(--ink-2); }
.qb-suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.qb-suggest button {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font: 500 0.85rem var(--font);
  cursor: pointer;
}
.qb-suggest button:hover { border-color: var(--brand-border); color: var(--brand); }
.qb-suggest [data-suggest-all] { border-color: var(--brand-border); color: var(--brand); }
/* Keep the search field one colour in dark mode (the generic dark input rule adds its own background) */
[data-theme="dark"] .qb-search { background: var(--page); }
[data-theme="dark"] .qb-search input { background: transparent !important; border: 0 !important; }
@media (max-width: 640px) {
  .qb-card .qb-subjects { flex-wrap: nowrap; overflow-x: auto; margin-right: -16px; padding-right: 16px; scrollbar-width: none; }
  .qb-card .qb-subjects::-webkit-scrollbar { display: none; }
  button.qb-subject { flex-shrink: 0; }
}
button.qb-subject.is-active b { color: #fff !important; opacity: 0.85; }
/* Question bank: the generic dark input rule is very specific, so target the field by id */
[data-theme="dark"] #qbSearch { background: transparent !important; border: 0 !important; box-shadow: none !important; }
#qbSearch::-webkit-search-cancel-button { cursor: pointer; }
.qb-card .qb-tools { margin-bottom: 8px; }
.qb-card .qb-head { margin-top: 16px; }
/* Search card starts right under the page heading */
.qb-card { margin-top: 24px; }
/* When no banner sits under the hero, give the whole layout (card, sidebar, rails) the same top gap */
.cp-hero + .cp-railwrap { padding-top: 24px; }
.cp-hero + .cp-railwrap .qb-card { margin-top: 0; }

/* Pages without a hero band: title lives inside the first card */
.cp--compact > .cp-railwrap { padding-top: 24px; }
.qb-intro { margin-bottom: 16px; }
.qb-intro .cp-crumbs { margin-bottom: 8px; }
.qb-intro h1 { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; margin: 0; }
.qb-intro p { margin-top: 6px !important; color: var(--muted); font-size: 0.95rem; }
@media (max-width: 860px) { .cp--compact > .cp-railwrap { padding-top: 16px; } }
.cp--compact .qb-card { margin-top: 0; }
/* Question bank: results heading is a small label, not a second page title */
.qb-head { padding-bottom: 10px; margin-bottom: 4px; }
.qb-head h2 { font-size: 1.05rem !important; font-weight: 700; }
.qb-head p { margin-top: 2px !important; font-size: 0.85rem; }

/* Question answer page */
.qa-label {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand) !important;
}
.qa-label--answer { color: var(--success) !important; margin: 0 0 8px !important; }
.qa-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.qa-tags span { padding: 2px 10px; border-radius: 999px; background: var(--line-soft); color: var(--muted); font-size: 0.78rem; }
.qa-answer {
  margin-top: 4px;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  border-left: 4px solid var(--success);
  background: var(--page);
}
.qa-answer__body,
.qa-answer__body p,
.qa-answer__body li { color: var(--ink-2); font-size: 1.02rem; line-height: 1.75; }
.qa-answer__body p + p { margin-top: 10px !important; }
.qa-answer__body ul,
.qa-answer__body ol { padding-left: 22px; margin: 8px 0; }
.qa-answer__body strong,
.qa-answer__body b { color: var(--ink); }
.qa-answer__body img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.qa-answer__body table { display: block; max-width: 100%; overflow-x: auto; }
.qa-tip { margin-top: 14px !important; font-size: 0.9rem; color: var(--muted); }
.qa-tip b { color: var(--ink-2); }

/* Answer page: student's own answer + blurred correct answer */
.qa-mine { margin: 4px 0 14px; }
.qa-mine textarea {
  display: block;
  width: 100%;
  min-height: 110px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: 400 1rem/1.6 var(--font);
  resize: vertical;
}
.qa-mine textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.qa-mine__hint { margin-top: 6px !important; font-size: 0.8rem; color: var(--muted); }
.qa-answer { position: relative; overflow: hidden; }
.qa-answer.is-hidden .qa-answer__body { filter: blur(7px); user-select: none; pointer-events: none; }
.qa-reveal {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -20%);
  padding: 10px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--brand-solid);
  color: #fff;
  font: 700 0.95rem var(--font);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.qa-reveal:hover { background: var(--brand-solid-hover); }
.qa-answer:not(.is-hidden) .qa-answer__body { animation: hp-fade 0.4s ease; }

/* Answer page: related questions sit in the sidebar on desktop, under the answer on phones */
.qa-related-side > a:not(.qa-related-side__all) {
  font-size: 0.9rem;
  line-height: 1.45;
  border-top: 1px solid var(--line-soft);
  border-radius: 0;
  padding: 10px;
}
.qa-related-side > .cp-card__title + a { border-top: 0; }
.qa-related-side__all { margin-top: 6px !important; font-weight: 600; color: var(--brand) !important; }
@media (min-width: 1024px) { .qa-related-main { display: none; } }
@media (max-width: 1023px) { .qa-related-side { display: none; } }

/* Answer page: Keep practising (left) | answer | related (right) */
.cp--compact > .qa-wrap { padding-top: 24px; }
.cp-layout--qa > .cp-main { grid-column: 1; grid-row: 1 / span 2; }
.cp-layout--qa > .cp-side { grid-column: 2; grid-row: 1; }
.cp-layout--qa > .qa-left { grid-column: 2; grid-row: 2; }
.qa-left__sticky { display: none; }
@media (min-width: 1200px) {
  .cp-layout--qa {
    max-width: 1440px;
    grid-template-columns: 240px minmax(0, 1fr) 300px;
  }
  .cp-layout--qa > .qa-left { grid-column: 1; grid-row: 1 / span 2; align-self: stretch; display: flex; flex-direction: column; gap: 16px; }
  .cp-layout--qa > .cp-main { grid-column: 2; }
  .cp-layout--qa > .cp-side { grid-column: 3; grid-row: 1 / span 2; }
  .qa-left__sticky { display: block; position: sticky; top: calc(var(--header-h) + 16px); text-align: center; }
  .qa-left__sticky ins { min-height: 600px; }
}
@media (max-width: 1023px) {
  .cp-layout--qa > .cp-main,
  .cp-layout--qa > .cp-side,
  .cp-layout--qa > .qa-left { grid-column: 1; grid-row: auto; }
  .cp-layout--qa > .qa-left { margin-top: 16px; }
}
@media (max-width: 1023px) {
  .cp-layout--qa > .cp-main { order: 1; }
  .cp-layout--qa > .cp-side { order: 2; }
  .cp-layout--qa > .qa-left { order: 3; }
}

/* ==========================================================================
   Class Maths worksheet pages
   ========================================================================== */
.ws-tools { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding-bottom: 16px; border-bottom: 1px solid var(--line-soft); }
.ws-mode,
.ws-levels { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--line-soft); }
.ws-mode button,
.ws-levels button {
  padding: 7px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font: 600 0.85rem var(--font);
  cursor: pointer;
}
.ws-mode button.is-active,
.ws-levels button.is-active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }
.ws-topics { list-style: none; margin: 0; padding: 0; }
.ws-topic { padding: 18px 0; border-bottom: 1px solid var(--line-soft); scroll-margin-top: calc(var(--header-h) + 16px); }
.ws-topic:last-child { border-bottom: 0; padding-bottom: 0; }
.ws-topic__head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.ws-topic__head h2 { font-size: 1.05rem !important; font-weight: 700; margin: 6px 0 0 !important; }
.ws-topic__head p { margin-top: 2px !important; font-size: 0.88rem; color: var(--muted); }
.ws-topic--exam .cp-chapter__num { background: #fef3c7; color: #b45309; }
[data-theme="dark"] .ws-topic--exam .cp-chapter__num { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
.ws-row { display: flex; align-items: center; gap: 12px; margin: 8px 0 0 52px; }
.ws-row[hidden] { display: none; }
.ws-row__label { flex-shrink: 0; width: 64px; font-size: 0.78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.ws-row[data-level="BASE"] .ws-row__label { color: #15803d; }
.ws-row[data-level="STANDARD"] .ws-row__label { color: #b45309; }
.ws-row[data-level="HARD"] .ws-row__label { color: #b91c1c; }
[data-theme="dark"] .ws-row[data-level="BASE"] .ws-row__label { color: #4ade80; }
[data-theme="dark"] .ws-row[data-level="STANDARD"] .ws-row__label { color: #fbbf24; }
[data-theme="dark"] .ws-row[data-level="HARD"] .ws-row__label { color: #f87171; }
.ws-versions { display: flex; flex-wrap: wrap; gap: 6px; }
.ws-v {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2) !important;
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none !important;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.ws-v:hover { background: var(--brand-solid); border-color: var(--brand-solid); color: #fff !important; }
.ws-classes { grid-template-columns: repeat(5, 1fr) !important; }
@media (max-width: 640px) {
  .ws-row { margin-left: 0; flex-direction: column; align-items: flex-start; gap: 6px; }
  .ws-row__label { width: auto; }
  .ws-v { min-width: 40px; height: 40px; }
}
/* Worksheet buttons look like PDF files */
.ws-hint { margin: 12px 0 0 !important; font-size: 0.85rem; color: var(--muted); }
.ws-v { gap: 5px; padding: 0 10px; }
.ws-v__icon { color: #dc2626; flex-shrink: 0; }
[data-theme="dark"] .ws-v__icon { color: #f87171; }
.ws-v:hover .ws-v__icon { color: #fff; }
.ws-row { align-items: flex-start; }
.ws-row__label { width: 88px; padding-top: 9px; line-height: 1.2; }
.ws-row__label small { display: block; margin-top: 2px; font-size: 0.7rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--muted); }
@media (max-width: 640px) {
  .ws-row__label { padding-top: 0; }
  .ws-row__label small { display: inline; margin-left: 4px; }
  .ws-versions { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); width: 100%; }
}

/* ==========================================================================
   MCQ quiz page
   ========================================================================== */
.quiz-chapters > a { display: flex !important; gap: 10px; align-items: baseline; font-size: 0.88rem !important; line-height: 1.35; }
.quiz-chapters__no { flex-shrink: 0; min-width: 18px; font-weight: 700; color: var(--muted); text-align: right; }
.quiz-chapters > a.is-current { background: var(--brand-soft); color: var(--brand) !important; font-weight: 600; }
.quiz-chapters > a.is-current .quiz-chapters__no { color: var(--brand); }
.quiz-chapters__all { margin-top: 6px; font-weight: 600; color: var(--brand) !important; }
.quiz-progress-bar { height: 6px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.quiz-progress-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #f59e0b, #db2777); transition: width 0.3s ease; }
.quiz-step { margin: 10px 0 4px !important; font-size: 0.82rem; font-weight: 600; color: var(--muted); }
.quiz-q { border: 0; margin: 0; padding: 0; min-width: 0; }
.quiz-q[hidden] { display: none; }
.quiz-q__text { float: left; width: 100%; padding: 0; margin: 4px 0 16px; font-size: 1.15rem; font-weight: 700; color: var(--ink); line-height: 1.5; }
.quiz-q__no { color: var(--brand); margin-right: 2px; }
.quiz-options { clear: both; display: grid; gap: 10px; }
.quiz-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
  margin: 0;
}
.quiz-opt:hover { border-color: var(--brand-border); transform: translateX(2px); }
.quiz-opt input { position: absolute; opacity: 0; pointer-events: none; }
.quiz-opt__key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--line-soft);
  color: var(--ink-2);
  font-weight: 700;
  font-size: 0.85rem;
}
.quiz-opt__text { color: var(--ink); font-size: 1rem; line-height: 1.45; }
.quiz-opt:has(input:checked) { border-color: var(--brand-solid); background: var(--brand-soft); }
.quiz-opt:has(input:checked) .quiz-opt__key { background: var(--brand-solid); color: #fff; }
.quiz-opt:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.quiz-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 20px; }
.quiz-nav [hidden] { display: none; }
.quiz-nav .site-btn:disabled { opacity: 0.45; cursor: default; }
.quiz-result { text-align: center; padding: 12px 0 4px; }
.quiz-score { display: flex; justify-content: center; align-items: baseline; gap: 12px; }
.quiz-score__num { font-size: 2.6rem; font-weight: 800; color: var(--ink); letter-spacing: -0.02em; }
.quiz-score__pct { font-size: 1.1rem; font-weight: 700; color: #b45309; }
.quiz-result.is-good .quiz-score__pct { color: var(--success); }
.quiz-result__msg { margin: 6px 0 16px !important; color: var(--ink-2); }
.quiz-result__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.quiz-result__actions [hidden] { display: none; }
.quiz-result__login { margin-top: 14px !important; font-size: 0.88rem; color: var(--muted); }
.quiz-review { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 14px; }
.quiz-review__item { padding: 16px; border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius); }
.quiz-review__item.is-correct { border-left-color: var(--success); }
.quiz-review__item.is-wrong { border-left-color: #dc2626; }
.quiz-review__item.is-not-answered { border-left-color: var(--muted); }
.quiz-review__q { margin: 0 0 10px !important; font-weight: 700; color: var(--ink); line-height: 1.5; }
.quiz-review__status { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; font-size: 0.72rem; background: var(--line-soft); color: var(--muted); vertical-align: middle; }
.is-correct .quiz-review__status { background: #dcfce7; color: #15803d; }
.is-wrong .quiz-review__status { background: #fee2e2; color: #b91c1c; }
.quiz-review__opts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.quiz-review__opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink-2); }
.quiz-review__opt .quiz-opt__key { width: 26px; height: 26px; font-size: 0.78rem; }
.quiz-review__opt.is-answer { background: #f0fdf4; color: #14532d; font-weight: 600; }
.quiz-review__opt.is-answer .quiz-opt__key { background: #16a34a; color: #fff; }
.quiz-review__opt.is-picked { background: #fef2f2; color: #7f1d1d; }
.quiz-review__opt.is-picked .quiz-opt__key { background: #dc2626; color: #fff; }
.quiz-review__tag { margin-left: auto; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
[data-theme="dark"] .quiz-review__opt.is-answer { background: rgba(34, 197, 94, 0.14); color: #bbf7d0; }
[data-theme="dark"] .quiz-review__opt.is-picked { background: rgba(239, 68, 68, 0.14); color: #fecaca; }
[data-theme="dark"] .is-correct .quiz-review__status { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
[data-theme="dark"] .is-wrong .quiz-review__status { background: rgba(239, 68, 68, 0.18); color: #f87171; }
.quiz-jump__hint { margin: -2px 0 10px !important; font-size: 0.8rem; color: var(--muted); }
.quiz-jump { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.quiz-jump button {
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font: 600 0.85rem var(--font);
  cursor: pointer;
}
.quiz-jump button.is-answered { background: var(--brand-soft); border-color: var(--brand-border); color: var(--brand); }
.quiz-jump button.is-current { outline: 2px solid var(--brand); outline-offset: 1px; }
.quiz-jump button.is-correct { background: #16a34a; border-color: #16a34a; color: #fff; }
.quiz-jump button.is-wrong { background: #dc2626; border-color: #dc2626; color: #fff; }
.quiz-pdf-btn { width: 100%; }
.quiz-about b, .quiz-about strong { color: var(--ink); }
@media (max-width: 640px) {
  .quiz-q__text { font-size: 1.05rem; }
  .quiz-score__num { font-size: 2.2rem; }
  .quiz-result__actions .site-btn { flex: 1 1 100%; }
}
/* quize.css styles an old .quiz-result box with large text; reset it for the new results panel */
.quiz-card .quiz-result {
  font-size: 1rem;
  font-weight: 400;
  background: none;
  border: 0;
  box-shadow: none;
  color: inherit;
  margin: 0;
  border-radius: 0;
}
.quiz-card .quiz-result__msg { font-size: 1rem; font-weight: 500; line-height: 1.5; }
/* Quiz: unanswered questions the student has already passed */
.quiz-jump button.is-skipped { border: 2px dashed #f59e0b; color: #b45309; }
[data-theme="dark"] .quiz-jump button.is-skipped { color: #fbbf24; }
.quiz-nav { flex-wrap: wrap; }
.quiz-nav #quizSubmit:disabled { opacity: 0.55; cursor: not-allowed; }
/* Quiz page: long chapter lists scroll inside their card so the left column does not outgrow the quiz */
@media (min-width: 1200px) {
  .quiz-chapters { max-height: 430px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
  .quiz-chapters .cp-card__title { position: sticky; top: -18px; margin: -18px -18px 8px !important; padding: 18px 18px 8px; background: var(--surface); z-index: 1; }
}
/* Quiz: chapter picker at the top on phones/tablets; the long list stays on desktop only */
.quiz-chapter-pick { display: none; }
@media (max-width: 1199px) {
  .quiz-chapter-pick {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 0 12px;
    height: 46px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--page);
  }
  .quiz-chapter-pick span { flex-shrink: 0; font-size: 0.8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
  .quiz-chapter-pick select {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: 0 !important;
    background: transparent !important;
    color: var(--ink) !important;
    font: 600 0.95rem var(--font);
    outline: none;
    box-shadow: none !important;
    text-overflow: ellipsis;
  }
  .cp-layout--qa .quiz-chapters { display: none; }
}

/* Chapter summary page */
.sum-chapters__book { margin: 10px 0 4px !important; padding: 0 2px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.sum-chapters .cp-card__title + .sum-chapters__book { margin-top: 0 !important; }
.sum-lang { display: inline-flex; margin-top: 14px; padding: 3px; border-radius: 10px; background: var(--line-soft); }
.sum-lang a { padding: 7px 16px; border-radius: 8px; color: var(--ink-2) !important; font-weight: 600; font-size: 0.9rem; }
.sum-lang a.is-active { background: var(--surface); color: var(--tone) !important; box-shadow: var(--shadow-sm); }
.sum-body { margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.sum-body p,
.sum-body li { font-size: 1.06rem; line-height: 1.85; color: var(--ink-2); }
.sum-body p + p { margin-top: 16px !important; }
.sum-body p:first-child::first-letter { font-size: 2.6em; font-weight: 800; float: left; line-height: 0.9; margin: 6px 8px 0 0; color: var(--tone); }
.sum-body[lang="hi"] p:first-child::first-letter { font-size: inherit; float: none; margin: 0; color: inherit; font-weight: inherit; }
.sum-body[lang="hi"] p,
.sum-body[lang="hi"] li { font-size: 1.1rem; line-height: 2; }
.sum-body h2, .sum-body h3 { margin: 22px 0 8px !important; font-size: 1.15rem; }
.sum-pager { margin: 24px 0 0; }
@media (max-width: 640px) {
  .sum-body p, .sum-body li { font-size: 1rem; line-height: 1.8; }
}

/* Class 10 Science notes pages */
.notes-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.notes-links a {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--tone-line);
  background: var(--tone-soft);
  color: var(--tone) !important;
  font-size: 0.88rem;
  font-weight: 600;
}
.notes-links a:hover { background: var(--tone); color: #fff !important; }
.notes-body { margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.notes-body p,
.notes-body li,
.notes-body td { font-size: 1.02rem; line-height: 1.8; color: var(--ink-2); }
.notes-body p + p { margin-top: 12px !important; }
/* Legacy notes use <b style="color:#6f4a8e"> as headings: give them the theme colour */
.notes-body b[style],
.notes-body strong[style] { color: var(--tone) !important; font-weight: 700; }
.notes-body img { display: block; max-width: 100%; height: auto; margin: 12px auto; border-radius: var(--radius-sm); background: #fff; }
.notes-body table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 14px 0; }
.notes-body th,
.notes-body td { border: 1px solid var(--line) !important; padding: 8px 10px; vertical-align: top; }
.notes-body th { background: var(--line-soft); color: var(--ink); }
.notes-body sub, .notes-body sup { font-size: 0.75em; }
/* Banner at the very top of a column: no extra gap above it */
.cp-main > .cp-ad--banner:first-child { margin-top: 0 !important; }

/* ==========================================================================
   Solution pages: same layout as the Class 10 notes pages
   chapters (left) | title + solution in one card (middle) | practice + ads (right)
   ========================================================================== */
@media (min-width: 1200px) {
  body > .row:has(> .col-lg-7) { grid-template-columns: 290px minmax(0, 1fr) 260px; }
  body > .row:has(> .col-lg-7) > .col-lg-3 { grid-column: 1; grid-row: 1; }
  body > .row:has(> .col-lg-7) > .col-lg-7 { grid-column: 2; grid-row: 1; }
  body > .row:has(> .col-lg-7) > .col-lg-2 { grid-column: 3; grid-row: 1; }
  /* Long chapter lists scroll inside their card so the left column stays short */
  body > .row:has(> .col-lg-7) > .col-lg-3 .topic,
  body > .row:has(> .col-lg-7) > .col-lg-3 > [class*="rounded-[24px]"] {
    max-height: 460px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
  }
}

/* Title block and solution card join into one card */
body > .row > .col-lg-7 > section.mb-5 {
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 24px 28px 4px;
  margin-bottom: 0 !important;
}
body > .row > .col-lg-7 > section.mb-5 + .bg-white {
  border-top: 0 !important;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important;
  padding-top: 12px !important;
}
body > .row > .col-lg-7 > .top-add-container:first-child { margin-top: 0 !important; }
@media (max-width: 640px) {
  body > .row > .col-lg-7 > section.mb-5 { padding: 16px 14px 2px; border-radius: var(--radius) var(--radius) 0 0; }
  body > .row > .col-lg-7 > section.mb-5 + .bg-white { border-radius: 0 0 var(--radius) var(--radius) !important; }
}
/* Class 9/10 "Chapter shortcuts" cards look and behave like the other chapter lists */
.sol-shortcuts { background: var(--surface) !important; border: 1px solid var(--line) !important; border-radius: var(--radius-lg) !important; padding: 16px 12px !important; box-shadow: var(--shadow-sm); }
.sol-shortcuts h4 { padding: 0 8px 10px; margin: 0 0 6px !important; border-bottom: 1px solid var(--line-soft); font-size: 1rem !important; font-weight: 700 !important; color: var(--ink) !important; }
.sol-shortcuts ul { margin: 0 !important; padding: 0; list-style: none; }
.sol-shortcuts li { margin: 0 !important; }
.sol-shortcuts a {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.9rem !important;
  font-weight: 400 !important;
  line-height: 1.35;
  color: var(--ink-2) !important;
  text-decoration: none !important;
}
.sol-shortcuts a:hover { background: var(--line-soft); color: var(--brand) !important; }
.sol-shortcuts a.is-current { background: var(--brand-soft); color: var(--brand) !important; font-weight: 600 !important; }
@media (min-width: 1200px) {
  .sol-shortcuts { max-height: 460px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
}
/* Keep the list heading visible while the chapter list scrolls inside its card */
@media (min-width: 1200px) {
  body > .row > .col-lg-3 .topic::before,
  .sol-shortcuts h4 {
    position: sticky;
    top: -16px;
    z-index: 1;
    margin-top: -16px !important;
    padding-top: 16px;
    background: var(--surface);
  }
}

/* Solution pages: the page title is the only big heading; any heading inside the
   solution content (e.g. a closing paragraph marked up as h1) reads as normal text */
body > .row > .col-lg-7 > .bg-white h1 {
  font-size: 1.05rem !important;
  font-weight: 600 !important;
  line-height: 1.7 !important;
  letter-spacing: 0 !important;
  margin: 16px 0 !important;
}
.col-lg-7 .bottom-description {
  margin-top: 24px !important;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--page);
  border: 1px solid var(--line);
  font-size: 0.98rem !important;
  font-weight: 400 !important;
  line-height: 1.7 !important;
  color: var(--ink-2) !important;
}

/* ==========================================================================
   Class 10 Science important / extra question pages
   ========================================================================== */
/* Chapter menu (left): same look as the other chapter lists */
.test-menu { margin: 0 0 20px !important; padding: 0 !important; border-radius: 0 !important; box-shadow: none !important; }
.test-menu .chapter-menu { background: var(--surface) !important; border: 1px solid var(--line); border-radius: var(--radius-lg) !important; padding: 16px 12px !important; box-shadow: var(--shadow-sm) !important; }
.test-menu .chapter-menu__title { padding: 0 8px 10px; margin: 0 0 6px !important; border-bottom: 1px solid var(--line-soft); font-size: 1rem !important; color: var(--ink) !important; }
.test-menu .chapter-menu__subtitle { display: none; }
.test-menu .chapter-menu__list { gap: 0 !important; }
.test-menu .chapter-pill {
  display: flex !important;
  justify-content: flex-start !important;
  align-items: baseline !important;
  gap: 8px;
  padding: 8px 10px !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
  box-shadow: none !important;
  transform: none !important;
  color: var(--ink-2) !important;
  font-weight: 400 !important;
  font-size: 0.9rem !important;
  line-height: 1.35;
}
.test-menu .chapter-pill span { flex-shrink: 0; min-width: 44px; color: var(--muted) !important; font-weight: 700 !important; font-size: 0.78rem !important; }
.test-menu .chapter-pill:hover { background: var(--line-soft) !important; color: var(--brand) !important; }
.test-menu .chapter-pill.is-current { background: var(--brand-soft) !important; color: var(--brand) !important; font-weight: 600 !important; }
@media (min-width: 1200px) {
  .test-menu .chapter-menu { max-height: 520px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
}
@media (max-width: 860px) { .test-menu { display: none; } }

/* Questions card (middle) */
body > .row > .col-lg-7 > .container {
  max-width: none;
  padding: 26px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
body > .row > .col-lg-7 > .container > hr { border-color: var(--line-soft); margin: 14px 0; }
.ws-q-title,
body > .row > .col-lg-7 > .container > h1:first-of-type {
  text-align: left !important;
  font-size: clamp(1.4rem, 1.1rem + 1.2vw, 1.9rem) !important;
  font-weight: 800 !important;
  line-height: 1.25 !important;
  color: var(--ink) !important;
  margin: 0 0 6px !important;
}
body > .row > .col-lg-7 > .container p { font-size: 1rem; line-height: 1.75; color: var(--ink-2); margin: 0 0 14px; }
body > .row > .col-lg-7 > .container h4.question {
  display: inline-block;
  margin: 22px 0 6px !important;
  padding: 2px 10px;
  border-radius: 6px;
  background: var(--question-bg);
  color: var(--question-ink) !important;
  font-size: 0.8rem !important;
  font-weight: 700;
}
body > .row > .col-lg-7 > .container h3.important-question { font-size: 1.05rem !important; font-weight: 700 !important; line-height: 1.55; color: var(--ink) !important; margin: 0 0 8px !important; }
body > .row > .col-lg-7 > .container h4.answer { margin: 10px 0 4px !important; font-size: 0.85rem !important; font-weight: 700; color: var(--success) !important; text-transform: uppercase; letter-spacing: 0.04em; }
body > .row > .col-lg-7 > .container .important-answer {
  padding: 12px 14px;
  border-left: 3px solid var(--success);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--page);
}
body > .row > .col-lg-7 > .container img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
@media (max-width: 640px) {
  body > .row > .col-lg-7 > .container { padding: 16px 14px; border-radius: var(--radius); }
}

/* ==========================================================================
   PDF store
   ========================================================================== */
.store-hero__grid { display: grid; gap: 28px; align-items: center; }
@media (min-width: 900px) { .store-hero__grid { grid-template-columns: minmax(0, 1fr) 320px; } }
.store-trust { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; list-style: none; }
.store-trust li { padding: 6px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 0.85rem; font-weight: 600; }
.store-trust li::before { content: "✓ "; }
.store-hero__card { padding: 24px; border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-md, var(--shadow-sm)); }
.store-hero__from { display: block; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.store-hero__price { display: block; margin: 2px 0 8px; font-size: 2.6rem; line-height: 1; font-weight: 800; color: var(--ink); }
.store-hero__card p { margin: 0 0 16px; color: var(--ink-2); font-size: 0.95rem; }

.store-section { padding-top: 36px; }
.store-head { margin-bottom: 18px; }
.store-head h2 { margin: 0 0 4px; font-size: 1.5rem; font-weight: 800; color: var(--ink); }
.store-head p { margin: 0; color: var(--muted); }

.store-btn { display: inline-flex; align-items: center; justify-content: center; padding: 10px 18px; border-radius: 999px; border: 1px solid transparent; font-weight: 700; font-size: 0.92rem; text-decoration: none !important; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.store-btn:hover { transform: translateY(-1px); }
.store-btn--primary { width: 100%; background: var(--brand-solid); color: #fff !important; }
.store-btn--ghost { border-color: var(--line); background: var(--surface); color: var(--ink) !important; }
.store-btn--ghost:hover { border-color: var(--brand); color: var(--brand) !important; }
.store-btn--wa { background: #16a34a; color: #fff !important; }
.store-btn--wa:hover { background: #15803d; }

.store-grid { display: grid; gap: 20px; }
@media (min-width: 820px) { .store-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.store-card { display: flex; flex-direction: column; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease; }
.store-card:hover { transform: translateY(-4px); border-color: var(--brand); }
.store-card__top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.store-card__tag { padding: 3px 10px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.store-card__save { padding: 3px 10px; border-radius: 999px; background: rgba(22, 163, 74, .12); color: #16a34a; font-size: 0.75rem; font-weight: 700; }
.store-card h3 { margin: 0; font-size: 1.25rem; font-weight: 800; line-height: 1.3; }
.store-card h3 a { color: var(--ink) !important; text-decoration: none !important; }
.store-card h3 a:hover { color: var(--brand) !important; }
.store-card__sub { margin: 2px 0 0; color: var(--brand); font-weight: 600; }
.store-card__desc { margin: 10px 0 0; color: var(--ink-2); font-size: 0.95rem; line-height: 1.6; }
.store-card__list { display: grid; gap: 6px; margin: 16px 0 0; padding: 0; list-style: none; }
.store-card__list li { position: relative; padding-left: 22px; color: var(--ink-2); font-size: 0.9rem; line-height: 1.45; }
.store-card__list li::before { content: "✓"; position: absolute; left: 0; color: #16a34a; font-weight: 800; }
.store-card__meta { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 !important; padding-top: 14px; color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.store-card__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.store-card__list + .store-card__foot, .store-card__meta + .store-card__foot { margin-top: 18px; }
.store-card__price { margin: 0; font-size: 1.8rem; font-weight: 800; color: var(--ink); }
.store-card__price s { margin-right: 6px; color: var(--muted); font-size: 1rem; font-weight: 600; }
.store-card__actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 480px) { .store-card { padding: 18px; } .store-card__actions, .store-card__actions .store-btn { width: 100%; } }

/* PDF pack detail page */
.store-hero--slim h1 { margin-top: 10px; }
.store-hero__sub { color: var(--brand); }
.store-btn--block { width: 100%; padding: 13px 18px; }
.store-detail { display: grid; gap: 24px; align-items: start; padding-top: 28px; }
@media (min-width: 1000px) { .store-detail { grid-template-columns: minmax(0, 1fr) 380px; } }
.store-preview { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.store-preview__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.store-preview__bar h2 { margin: 0; font-size: 1.1rem; font-weight: 800; color: var(--ink); }
.store-preview__bar p { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }
.store-preview__frame { display: block; width: 100%; height: 760px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
@media (max-width: 640px) { .store-preview__frame { height: 520px; } .store-preview__bar .store-btn { width: 100%; } }
@media (min-width: 1000px) { .store-buy { position: sticky; top: 84px; } }
.store-buy__card:hover { transform: none; border-color: var(--line); }
.store-buy__title { margin: 0; font-size: 1.3rem; font-weight: 800; color: var(--ink); line-height: 1.3; }
.store-buy__price { margin: 12px 0 14px !important; font-size: 2.2rem; }
.store-buy__note { margin: 10px 0 0; color: var(--muted); font-size: 0.88rem; line-height: 1.55; }
.store-buy__h { margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--line-soft); font-size: 0.95rem; font-weight: 800; color: var(--ink); }
.store-buy .store-card__list { margin-top: 10px; }
.store-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 10px 0 0; font-size: 0.88rem; }
.store-facts dt { color: var(--muted); font-weight: 600; }
.store-facts dd { margin: 0; color: var(--ink-2); }
.store-steps .hp-step p { margin-top: 10px; }
.store-two { display: grid; gap: 20px; }
@media (min-width: 900px) { .store-two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.store-two .cp-about { margin: 0; }
.store-two .store-card__list li { font-size: 0.98rem; }
.store-note { padding: 12px 14px; margin-top: 10px; border-radius: var(--radius-sm); background: var(--page); border-left: 3px solid var(--brand); }
.store-note h3 { margin: 0; font-size: 0.95rem; font-weight: 700; color: var(--ink); }
.store-note p { margin: 4px 0 0 !important; font-size: 0.9rem; color: var(--ink-2); }
.store-mini { gap: 6px; text-decoration: none !important; }
.store-mini .store-card__tag { align-self: flex-start; }
.store-mini strong { font-size: 1.1rem; color: var(--ink); }
.store-mini__price { margin-top: 6px; color: var(--brand); font-weight: 700; font-size: 0.9rem; }
.store-steps { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
@media (min-width: 1000px) { .store-steps { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; } }
@media (max-width: 520px) { .store-steps { grid-template-columns: 1fr !important; } }
.store-note h3 { margin: 0 !important; }
.cp-railwrap > .store-body { min-width: 0; width: 100%; }

/* ==========================================================================
   Blog listing
   ========================================================================== */
.blog-body { padding-top: 8px; padding-bottom: 32px; }
.blog-grid { display: grid; gap: 22px; margin-top: 8px; }
@media (min-width: 640px) { .blog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .blog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.blog-grid__ad { grid-column: 1 / -1; }
.blog-grid__ad .cp-ad { margin: 0; }
.blog-card { position: relative; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease; }
.blog-card:hover { transform: translateY(-4px); border-color: var(--brand); }
.blog-card__img { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--line-soft); }
.blog-card__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.blog-card:hover .blog-card__img img { transform: scale(1.04); }
.blog-card__body { display: flex; flex: 1; flex-direction: column; gap: 8px; padding: 18px 20px 20px; }
.blog-card time { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.blog-card h2 { margin: 0; font-size: 1.08rem; font-weight: 800; line-height: 1.4; }
.blog-card h2 a { color: var(--ink) !important; text-decoration: none !important; }
/* whole card is clickable through the title link */
.blog-card h2 a::after { content: ""; position: absolute; inset: 0; }
.blog-card:hover h2 a { color: var(--brand) !important; }
.blog-card p { margin: 0; color: var(--ink-2); font-size: 0.92rem; line-height: 1.6; }
.blog-card__more { margin-top: auto; padding-top: 6px; color: var(--brand); font-weight: 700; font-size: 0.9rem; }
.blog-pager { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: 28px 0 8px; }
.blog-pager a, .blog-pager span { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink) !important; font-weight: 600; text-decoration: none !important; }
.blog-pager a:hover { border-color: var(--brand); color: var(--brand) !important; }
.blog-pager .is-current { background: var(--brand-solid); border-color: var(--brand-solid); color: #fff !important; }
.blog-pager .blog-pager__gap { border: 0; background: none; min-width: 20px; padding: 0; color: var(--muted) !important; }
.blog-empty { text-align: center; }
.blog-body > .cp-about { margin-top: 8px; }
.blog-card__tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; aspect-ratio: 16 / 7; color: #fff; text-decoration: none !important; }
.blog-card__tile svg { opacity: .9; transition: transform .3s ease; }
.blog-card:hover .blog-card__tile svg { transform: scale(1.1) rotate(-4deg); }
.blog-card__tile span { font-size: 0.78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .9; }
.blog-card__tile--0 { background: linear-gradient(135deg, #6366f1, #a855f7); }
.blog-card__tile--1 { background: linear-gradient(135deg, #0ea5e9, #6366f1); }
.blog-card__tile--2 { background: linear-gradient(135deg, #10b981, #0ea5e9); }
.blog-card__tile--3 { background: linear-gradient(135deg, #f59e0b, #ef4444); }
.blog-card__tile--4 { background: linear-gradient(135deg, #ec4899, #8b5cf6); }

/* ==========================================================================
   Blog article
   ========================================================================== */
.blog-post__head h1 { max-width: 900px; }
.blog-post__meta { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 10px 0 0; color: var(--muted); font-size: 0.92rem; font-weight: 600; }
.blog-post__layout { display: grid; gap: 28px; align-items: start; padding-top: 8px; padding-bottom: 32px; }
@media (min-width: 1024px) { .blog-post__layout { grid-template-columns: minmax(0, 1fr) 300px; } }
.blog-post__main { min-width: 0; }
.blog-post__card { padding: 32px 36px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
@media (max-width: 640px) { .blog-post__card { padding: 20px 16px; border-radius: var(--radius); } }
.blog-prose { max-width: 720px; color: var(--ink-2); font-size: 1.06rem; line-height: 1.8; }
.blog-prose > *:first-child { margin-top: 0; }
.blog-prose p { margin: 0 0 1.1em; }
.blog-prose h2, .blog-prose h3, .blog-prose h4 { scroll-margin-top: 90px; margin: 1.8em 0 0.6em; color: var(--ink) !important; font-weight: 800; line-height: 1.3; }
.blog-prose h2 { font-size: 1.5rem; }
.blog-prose h3 { font-size: 1.25rem; }
.blog-prose h4 { font-size: 1.08rem; }
.blog-prose a { color: var(--brand); text-decoration: underline; text-underline-offset: 2px; }
.blog-prose ul, .blog-prose ol { margin: 0 0 1.1em; padding-left: 1.4em; }
.blog-prose ul { list-style: disc; }
.blog-prose ol { list-style: decimal; }
.blog-prose li { margin: 0.3em 0; }
.blog-prose figure { margin: 1.5em 0; }
.blog-prose img { display: block; max-width: 100%; height: auto; border-radius: var(--radius); }
.blog-prose figcaption { margin-top: 6px; color: var(--muted); font-size: 0.85rem; text-align: center; }
.blog-prose blockquote { margin: 1.5em 0; padding: 12px 18px; border-left: 4px solid var(--brand); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--brand-soft); color: var(--ink); }
.blog-prose table { width: 100%; margin: 1.5em 0; border-collapse: collapse; font-size: 0.95rem; }
.blog-prose th, .blog-prose td { padding: 8px 10px; border: 1px solid var(--line); text-align: left; }
.blog-prose iframe { max-width: 100%; }
.blog-prose .cp-ad { margin: 1.6em 0; }
.blog-post__share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 0.9rem; font-weight: 600; }
.blog-post__share a, .blog-post__share button { padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink) !important; font: 600 0.85rem var(--font); text-decoration: none !important; cursor: pointer; }
.blog-post__share a:hover, .blog-post__share button:hover { border-color: var(--brand); color: var(--brand) !important; }
.blog-post__related { margin-top: 8px; }
.blog-post__related > h2 { margin: 0 0 14px; font-size: 1.35rem; font-weight: 800; color: var(--ink); }
.blog-grid--related { margin-top: 0; }
@media (min-width: 1024px) { .blog-grid--related { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.blog-card h3 { margin: 0; font-size: 1rem; font-weight: 800; line-height: 1.4; }
.blog-card h3 a { color: var(--ink) !important; text-decoration: none !important; }
.blog-card h3 a::after { content: ""; position: absolute; inset: 0; }
.blog-card:hover h3 a { color: var(--brand) !important; }
@media (min-width: 1024px) { .blog-post__sticky { position: sticky; top: calc(var(--header-h) + 16px); } }
.blog-post__sticky > * + * { margin-top: 16px; }
.blog-toc { max-height: 50vh; overflow-y: auto; scrollbar-width: thin; }
.blog-toc a { display: flex !important; gap: 10px; align-items: baseline; padding: 7px 8px !important; border-radius: 8px; font-size: 0.88rem; line-height: 1.4; }
.blog-toc a span { flex-shrink: 0; min-width: 18px; color: var(--muted); font-weight: 700; font-size: 0.78rem; }
.blog-toc a.is-current { background: var(--brand-soft); color: var(--brand) !important; font-weight: 600; }
@media (max-width: 1023px) { .blog-toc { display: none; } }

/* ==========================================================================
   Leaderboard
   ========================================================================== */
.lb-hero { display: grid; gap: 28px; align-items: center; }
@media (min-width: 900px) { .lb-hero { grid-template-columns: minmax(0, 1fr) 340px; } }
.lb-hero__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.lb-btn { width: auto; padding-left: 22px; padding-right: 22px; }
.lb-me { padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); color: var(--ink); }
.lb-me__label { display: block; color: var(--muted); font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.lb-me__value { display: block; margin: 4px 0 6px; font-size: 2.4rem; line-height: 1; font-weight: 800; }
.lb-me p { margin: 8px 0 0; color: var(--ink-2); font-size: 0.92rem; }
.lb-me a { display: inline-block; margin-top: 10px; color: var(--brand); font-weight: 700; font-size: 0.92rem; }
.lb-rules { margin: 10px 0 0; padding: 0; list-style: none; }
.lb-rules li { padding: 6px 0; color: var(--ink-2); }
.lb-rules b { display: inline-block; min-width: 42px; color: #16a34a; }

.lb-body { padding-bottom: 32px; }
.lb-card { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
@media (max-width: 640px) { .lb-card { padding: 16px; } }
.lb-card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.lb-card__head h2 { margin: 0; font-size: 1.35rem; font-weight: 800; color: var(--ink); }
.lb-tabs { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--line-soft); }
.lb-tabs a { padding: 7px 16px; border-radius: 999px; color: var(--ink-2) !important; font-weight: 600; font-size: 0.9rem; text-decoration: none !important; }
.lb-tabs a.is-active { background: var(--surface); color: var(--brand) !important; box-shadow: var(--shadow-sm); }

.lb-avatar { display: inline-flex; align-items: center; justify-content: center; width: 56px; height: 56px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 800; font-size: 1.3rem; flex-shrink: 0; }
.lb-avatar--sm { width: 36px; height: 36px; font-size: 0.95rem; }

.lb-podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; margin: 0 0 18px; padding: 0; list-style: none; }
.lb-podium__item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 10px 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--page); text-align: center; }
.lb-podium__item strong { max-width: 100%; overflow: hidden; color: var(--ink); font-size: 1rem; text-overflow: ellipsis; white-space: nowrap; }
.lb-podium__pts { color: var(--brand); font-weight: 800; }
.lb-podium__medal { position: absolute; top: -16px; font-size: 1.9rem !important; line-height: 1 !important; }
/* champion in the middle and a little taller */
.lb-podium__item--1 { order: 2; padding-top: 34px; padding-bottom: 26px; border-color: #f59e0b; background: linear-gradient(180deg, rgba(245, 158, 11, .14), var(--page)); }
.lb-podium__item--1 .lb-avatar { width: 68px; height: 68px; background: #f59e0b; color: #fff; }
.lb-podium__item--2 { order: 1; }
.lb-podium__item--3 { order: 3; }
.lb-podium__item.is-me { box-shadow: 0 0 0 2px var(--brand); }
@media (max-width: 480px) {
  .lb-podium { gap: 8px; }
  .lb-podium__item { padding: 20px 6px 14px; }
  .lb-podium__item .lb-avatar { width: 44px; height: 44px; font-size: 1.05rem; }
  .lb-podium__item--1 .lb-avatar { width: 52px; height: 52px; }
  .lb-podium__item strong { font-size: 0.85rem; }
  .lb-podium__pts { font-size: 0.85rem; }
}

.lb-list { margin: 0; padding: 0; list-style: none; }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-top: 1px solid var(--line-soft); border-radius: 10px; }
.lb-row.is-me { background: var(--brand-soft); }
.lb-row__rank { width: 28px; flex-shrink: 0; color: var(--muted); font-weight: 800; text-align: center; }
.lb-row__info { flex: 1; min-width: 0; }
.lb-row__name { display: block; overflow: hidden; color: var(--ink); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.lb-row__name em { color: var(--brand); font-style: normal; font-size: 0.85rem; }
.lb-row__bar { display: block; height: 6px; margin-top: 6px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.lb-row__bar span { display: block; height: 100%; border-radius: inherit; background: var(--brand-solid); }
.lb-row__pts { flex-shrink: 0; color: var(--ink); font-weight: 700; font-size: 0.92rem; }
.lb-empty { padding: 24px 8px; text-align: center; color: var(--ink-2); }
.lb-body > .cp-about { margin-top: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ==========================================================================
   Student dashboard
   ========================================================================== */
.db-hero { padding-bottom: 28px; }
.db-hero__top { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 20px; }
.db-hero__avatar { width: 60px; height: 60px; font-size: 1.5rem; background: var(--brand-solid); color: #fff; }
.db-hero__text { flex: 1; min-width: 220px; }
.db-hero__text h1 { margin: 0 !important; font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem) !important; }
.db-hero__text p { margin: 4px 0 0; color: var(--muted); font-weight: 500; }
.db-hero__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.db-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 22px 0 0; padding: 0; list-style: none; }
@media (max-width: 720px) { .db-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.db-stats li { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.db-stats__icon { position: absolute; top: 14px; right: 16px; font-size: 1.25rem !important; line-height: 1; }
.db-stats strong { color: var(--ink); font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.db-stats strong small { color: var(--muted); font-size: 1rem; font-weight: 700; }
.db-stats li > span:not(.db-stats__icon):not(.db-stats__bar) { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.db-stats__bar { display: block; height: 6px; margin-top: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.db-stats__bar span { display: block; height: 100%; border-radius: inherit; background: #16a34a; }

.db-body { padding-bottom: 36px; }
.db-grid { display: grid; gap: 24px; align-items: start; }
@media (min-width: 1024px) { .db-grid { grid-template-columns: minmax(0, 1fr) 320px; } }
.db-main { display: grid; gap: 20px; min-width: 0; }
.db-side { display: grid; gap: 16px; }
@media (min-width: 1024px) { .db-side { position: sticky; top: calc(var(--header-h) + 16px); } }
.db-card { padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
@media (max-width: 640px) { .db-card { padding: 16px; } }
.db-card__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: 14px; }
.db-card__head h2 { margin: 0; color: var(--ink); font-size: 1.15rem; font-weight: 800; }
.db-card__hint { color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.db-card__link { color: var(--brand) !important; font-size: 0.88rem; font-weight: 700; text-decoration: none !important; }
.db-empty { margin: 8px 0 0; color: var(--muted); font-size: 0.92rem; }

.db-plan { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.db-task { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--page); transition: opacity .2s ease, background .2s ease; }
.db-task__check { flex-shrink: 0; width: 24px; height: 24px; padding: 0; border: 2px solid var(--line); border-radius: 50%; background: var(--surface); cursor: pointer; transition: background .15s ease, border-color .15s ease; }
.db-task__check:hover { border-color: #16a34a; }
.db-task.is-done .db-task__check { border-color: #16a34a; background: #16a34a url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 14px no-repeat; }
.db-task__text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.db-task__text strong { color: var(--ink); font-weight: 700; }
.db-task__text span { color: var(--muted); font-size: 0.85rem; }
.db-task.is-done .db-task__text strong { text-decoration: line-through; color: var(--muted); }
.db-task__link { flex-shrink: 0; color: var(--brand) !important; font-weight: 700; font-size: 0.88rem; text-decoration: none !important; }
.db-task__remove { flex-shrink: 0; width: 28px; height: 28px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 1.2rem; line-height: 1; cursor: pointer; }
.db-task__remove:hover { background: var(--line-soft); color: var(--ink); }
.db-add { display: flex; gap: 8px; margin-top: 12px; }
.db-add input, .db-goal input { flex: 1; min-width: 0; height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: 500 0.92rem var(--font); }
.db-add input:focus, .db-goal input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.db-add button, .db-goal button { flex-shrink: 0; height: 42px; padding: 0 18px; border: 0; border-radius: 999px; background: var(--brand-solid); color: #fff; font: 700 0.9rem var(--font); cursor: pointer; }

.db-chart { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; height: 170px; align-items: end; }
.db-chart__col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.db-chart__val { min-height: 1em; color: var(--ink-2); font-size: 0.8rem; font-weight: 700; }
.db-chart__bar { display: block; width: 100%; max-width: 44px; border-radius: 8px 8px 4px 4px; background: var(--brand-soft); transition: height .5s ease; }
.db-chart__col.is-today .db-chart__bar { background: var(--brand-solid); }
.db-chart__label { color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.db-chart__col.is-today .db-chart__label { color: var(--brand); font-weight: 800; }

.db-recs { display: grid; gap: 10px; }
@media (min-width: 640px) { .db-recs { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.db-rec { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--page); text-decoration: none !important; transition: border-color .15s ease, transform .15s ease; }
.db-rec:hover { border-color: var(--brand); transform: translateY(-2px); }
.db-rec__meta { color: var(--brand); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.db-rec__title { color: var(--ink); font-weight: 600; line-height: 1.45; }

.db-list { margin: 0; padding: 0; list-style: none; }
.db-list li { display: flex; align-items: baseline; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.db-list li:first-child { border-top: 0; padding-top: 0; }
.db-list a { flex: 1; min-width: 0; color: var(--ink) !important; font-weight: 500; text-decoration: none !important; }
.db-list a:hover { color: var(--brand) !important; }
.db-list__time { flex-shrink: 0; color: var(--muted); font-size: 0.8rem; }
.db-dot { flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%; transform: translateY(-1px); }
.db-dot.is-ok { background: #16a34a; }
.db-dot.is-miss { background: #f59e0b; }

.db-weak { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.db-weak li { display: grid; grid-template-columns: minmax(0, 1fr) 90px; gap: 4px 12px; align-items: center; }
.db-weak__name { color: var(--ink); font-weight: 600; }
.db-weak__pct { grid-row: span 2; color: var(--ink); font-weight: 800; text-align: right; }
.db-weak__pct small { color: var(--muted); font-weight: 600; }
.db-weak__bar { height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.db-weak__bar span { display: block; height: 100%; border-radius: inherit; background: #f59e0b; }

.db-goal label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.db-goal__row { display: flex; gap: 8px; }
.db-goal p { margin: 10px 0 0; color: var(--muted); font-size: 0.85rem; }
.db-badges ul { margin: 0; padding: 0; list-style: none; }
.db-badges li { display: grid; grid-template-columns: auto 1fr; gap: 0 10px; padding: 8px 0; }
.db-badges li span { grid-row: span 2; font-size: 1.5rem !important; }
.db-badges li strong { color: var(--ink); }
.db-badges li small { color: var(--muted); }
.db-badges p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.db-side .cp-ad { margin: 0; }

/* Dashboard charts — one brand hue; sequential steps chosen separately for light and dark */
:root { --cal-0: #eef0f6; --cal-1: #c7d2fe; --cal-2: #818cf8; --cal-3: #4f46e5; --cal-4: #312e81; --chart-good: #15803d; --chart-review: #d97706; }
[data-theme="dark"] { --cal-0: #1e2538; --cal-1: #312e81; --cal-2: #4f46e5; --cal-3: #818cf8; --cal-4: #c7d2fe; --chart-good: #4ade80; --chart-review: #fbbf24; }

.db-tip { position: fixed; z-index: 1000; max-width: 240px; padding: 6px 10px; border-radius: 8px; background: var(--ink); color: var(--surface); font-size: 0.8rem; font-weight: 600; line-height: 1.35; pointer-events: none; box-shadow: var(--shadow-sm); }

.db-insights ul { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.db-insight { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--radius); background: var(--page); border-left: 3px solid var(--line); color: var(--ink-2); line-height: 1.5; }
.db-insight b { color: var(--ink); }
.db-insight a { color: var(--brand); font-weight: 700; }
.db-insight--good { border-left-color: var(--chart-good); }
.db-insight--warn { border-left-color: var(--chart-review); }
.db-insight--neutral { border-left-color: var(--brand); }
.db-insight__icon { flex-shrink: 0; font-size: 1.15rem !important; line-height: 1.3; }

.db-streak__nums, .db-perf__nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.db-streak__nums div, .db-perf__nums div { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: var(--radius); background: var(--page); }
.db-streak__nums strong, .db-perf__nums strong { color: var(--ink); font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.db-streak__nums span, .db-perf__nums span { color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.db-streak__nums div span { order: 2; }
.db-perf__nums em { color: var(--muted); font-size: 0.78rem; font-style: normal; font-weight: 600; }
.db-perf__nums em.is-up { color: var(--chart-good); }
.db-perf__nums em.is-down { color: var(--chart-review); }
@media (max-width: 480px) {
  .db-streak__nums, .db-perf__nums { gap: 6px; }
  .db-streak__nums div, .db-perf__nums div { padding: 10px; }
  .db-streak__nums strong, .db-perf__nums strong { font-size: 1.2rem; }
}

/* streak calendar */
.db-cal-wrap { overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.db-cal { display: grid; grid-template-columns: 30px 1fr; grid-template-rows: auto 1fr; gap: 4px 6px; min-width: 330px; max-width: 560px; }
.db-cal__months { grid-column: 2; display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 3px; color: var(--muted); font-size: 0.72rem; font-weight: 600; }
.db-cal__months span { white-space: nowrap; overflow: visible; }
.db-cal__days { display: grid; grid-template-rows: repeat(7, minmax(0, 1fr)); gap: 3px; color: var(--muted); font-size: 0.7rem; font-weight: 600; }
.db-cal__days span { display: flex; align-items: center; }
.db-cal__grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, minmax(0, 1fr)); grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 3px; }
.db-cal__cell { display: block; aspect-ratio: 1; border-radius: 4px; background: var(--cal-0); }
.db-cal__cell.l1 { background: var(--cal-1); }
.db-cal__cell.l2 { background: var(--cal-2); }
.db-cal__cell.l3 { background: var(--cal-3); }
.db-cal__cell.l4 { background: var(--cal-4); }
.db-cal__cell.is-future { background: transparent; }
.db-cal__grid .db-cal__cell:not(.is-future):hover { outline: 2px solid var(--ink); outline-offset: 1px; }
.db-cal__legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 10px; color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.db-cal__legend .db-cal__cell { width: 12px; height: 12px; border-radius: 3px; }

/* weekly accuracy line */
.db-line { padding: 6px 4px 0 38px; }
.db-line__plot { position: relative; height: 170px; }
.db-line__plot svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.db-line__path { fill: none; stroke: var(--brand-solid); stroke-width: 2px; stroke-linejoin: round; stroke-linecap: round; }
.db-line__grid { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--line); }
.db-line__grid b { position: absolute; right: calc(100% + 8px); top: -0.6em; color: var(--muted); font-size: 0.72rem; font-weight: 600; white-space: nowrap; }
.db-line__dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--brand-solid); box-shadow: 0 0 0 2px var(--surface); cursor: pointer; }
.db-line__dot::after { content: ""; position: absolute; inset: -10px; }
.db-line__dot.is-now { width: 12px; height: 12px; margin: -6px 0 0 -6px; }
.db-line__dot:hover, .db-line__dot:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand-solid); }
.db-line__x { position: relative; height: 1.4em; margin-top: 10px; }
.db-line__x span { position: absolute; transform: translateX(-50%); color: var(--muted); font-size: 0.72rem; font-weight: 600; white-space: nowrap; }
.db-line__x span:nth-child(1) { left: 0%; } .db-line__x span:nth-child(2) { left: 14.29%; } .db-line__x span:nth-child(3) { left: 28.57%; } .db-line__x span:nth-child(4) { left: 42.86%; }
.db-line__x span:nth-child(5) { left: 57.14%; } .db-line__x span:nth-child(6) { left: 71.43%; } .db-line__x span:nth-child(7) { left: 85.71%; } .db-line__x span:nth-child(8) { left: 100%; transform: translateX(-80%); }
@media (max-width: 520px) { .db-line__x span:nth-child(even):not(:last-child) { display: none; } }

/* correct vs review split */
.db-split { margin-top: 22px; }
.db-split__bar { display: flex; gap: 2px; height: 12px; }
.db-split__bar span { min-width: 4px; }
.db-split__ok { border-radius: 4px 0 0 4px; background: var(--chart-good); }
.db-split__miss { border-radius: 0 4px 4px 0; background: var(--chart-review); }
.db-split__legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; color: var(--ink-2); font-size: 0.85rem; }
.db-split__legend b { color: var(--ink); }
.db-split__key { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }
.db-split__key--ok { background: var(--chart-good); }
.db-split__key--miss { background: var(--chart-review); }

/* 30-day activity bars */
.db-bars { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); gap: 2px; height: 150px; align-items: end; border-bottom: 1px solid var(--line); }
.db-bars__col { display: flex; align-items: flex-end; height: 100%; cursor: pointer; }
.db-bars__bar { display: block; width: 100%; border-radius: 4px 4px 0 0; background: var(--cal-2); transition: height .5s ease; }
.db-bars__col.is-today .db-bars__bar { background: var(--brand-solid); }
.db-bars__col:hover .db-bars__bar { background: var(--cal-3); }
.db-bars__x { display: flex; justify-content: space-between; margin-top: 6px; color: var(--muted); font-size: 0.72rem; font-weight: 600; }


/* ==========================================================================
   Dashboard app layout: dark sidebar + top bar + card grid
   ========================================================================== */
body:has(.db-app) .site-header,
body:has(.db-app) .site-footer,
body:has(.db-app) .site-subbar { display: none !important; }
body:has(.db-app) { background: var(--page); }
:root { --db-side: 248px; --db-top: 68px; --db-side-bg: #0f172a; --db-side-ink: #cbd5e1; --db-side-muted: #64748b; --db-side-hover: rgba(255, 255, 255, .06); --db-side-active: rgba(99, 102, 241, .22); }
[data-theme="dark"] { --db-side-bg: #0b1020; --db-side-hover: rgba(255, 255, 255, .05); }

.db-app { min-height: 100vh; }
.db-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; display: flex; flex-direction: column; width: var(--db-side); padding: 18px 14px; background: var(--db-side-bg); color: var(--db-side-ink); overflow-y: auto; scrollbar-width: thin; }
.db-sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 20px; color: #fff !important; font-size: 1.15rem; font-weight: 800; text-decoration: none !important; }
.db-sidebar__brand img { border-radius: 8px; }
.db-nav { flex: 1; }
.db-nav__label { margin: 14px 10px 6px; color: var(--db-side-muted); font-size: 0.7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.db-nav__group { display: grid; gap: 2px; }
.db-nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--db-side-ink) !important; font-size: 0.9rem; font-weight: 600; text-decoration: none !important; transition: background .15s ease, color .15s ease; }
.db-nav a svg { flex-shrink: 0; color: var(--db-side-muted); transition: color .15s ease; }
.db-nav a:hover { background: var(--db-side-hover); color: #fff !important; }
.db-nav a:hover svg { color: #fff; }
.db-nav a.is-current { background: var(--db-side-active); color: #fff !important; box-shadow: inset 3px 0 0 #818cf8; }
.db-nav a.is-current svg { color: #a5b4fc; }
.db-sidebar__user { display: flex; align-items: center; gap: 10px; margin-top: 16px; padding: 12px; border-radius: 12px; background: var(--db-side-hover); }
.db-sidebar__user > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.db-sidebar__user strong { overflow: hidden; color: #fff; font-size: 0.88rem; text-overflow: ellipsis; white-space: nowrap; }
.db-sidebar__user small { color: var(--db-side-muted); font-size: 0.75rem; }
.db-sidebar .lb-avatar { background: #4f46e5; color: #fff; }

.db-app__main { min-width: 0; margin-left: var(--db-side); }
.db-topbar { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 14px; min-height: var(--db-top); padding: 10px 28px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); }
.db-topbar__title { flex: 1; min-width: 0; }
.db-topbar__title h1 { margin: 0 !important; color: var(--ink) !important; font-size: 1.2rem !important; font-weight: 800 !important; line-height: 1.3 !important; }
.db-topbar__title p { margin: 0; overflow: hidden; color: var(--muted); font-size: 0.82rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.db-topbar__actions { display: flex; align-items: center; gap: 8px; }
.db-topbar__cta { width: auto; padding: 9px 18px; }
.db-topbar__avatar { text-decoration: none !important; }
.db-icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink-2); cursor: pointer; }
.db-icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.db-topbar__menu { display: none; }
.db-ico-sun { display: none; }
[data-theme="dark"] .db-ico-sun { display: block; }
[data-theme="dark"] .db-ico-moon { display: none; }

.db-app__content { padding: 24px 28px 40px; }
.db-app__content #overview, .db-dash > * { scroll-margin-top: calc(var(--db-top) + 16px); }
.db-app__content .db-stats { margin-top: 0; }
.db-app__content > .cp-ad { margin: 20px 0; }
.db-dash { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); grid-auto-flow: dense; gap: 20px; align-items: start; }
.db-dash > * { grid-column: span 12; min-width: 0; margin: 0 !important; }
.db-dash .cp-card { height: auto; }
.db-dash > div > .cp-ad { margin: 0; }
@media (min-width: 1100px) {
  .db-span-3 { grid-column: span 3 !important; }
  .db-span-4 { grid-column: span 4 !important; }
  .db-span-5 { grid-column: span 5 !important; }
  .db-span-6 { grid-column: span 6 !important; }
  .db-span-7 { grid-column: span 7 !important; }
  .db-span-8 { grid-column: span 8 !important; }
}
@media (min-width: 760px) and (max-width: 1099px) {
  .db-span-3, .db-span-4, .db-span-5, .db-span-6 { grid-column: span 6 !important; }
}

/* Small screens: sidebar becomes a slide-in drawer */
@media (max-width: 1023px) {
  .db-sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .db-app.is-menu-open .db-sidebar { transform: none; }
  .db-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(15, 23, 42, .5); }
  .db-app__main { margin-left: 0; }
  .db-topbar { padding: 10px 16px; }
  .db-topbar__menu { display: inline-flex; }
  .db-app__content { padding: 16px 16px 32px; }
}
@media (max-width: 560px) {
  .db-topbar__cta { display: none; }
  .db-topbar__title h1 { font-size: 1.05rem !important; }
  .db-dash { gap: 14px; }
}
html:has(.db-app) { scroll-padding-top: calc(var(--db-top) + 12px); }
.db-app main.db-app__content { padding-top: 24px !important; }
@media (max-width: 1023px) { .db-app main.db-app__content { padding-top: 16px !important; } }

/* Dashboard tabs */
.db-tab__head { margin: 4px 0 16px; }
.db-tab__head h2 { margin: 0; color: var(--ink); font-size: 1.35rem; font-weight: 800; }
.db-tab__head p { margin: 2px 0 0; color: var(--muted); font-size: 0.9rem; }
.db-tab:not([hidden]) { animation: db-tab-in .25s ease; }
@keyframes db-tab-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .db-tab:not([hidden]) { animation: none; } }
.db-app__content > .cp-ad { margin: 0 0 20px; }
.db-bottom-ad { margin-top: 24px; }
.db-bottom-ad .cp-ad { margin: 0; }

/* Dashboard: right ad column, compact top banner, bottom ad row */
.db-app__body { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; }
.db-rail { display: none; }
@media (min-width: 1280px) {
  .db-app__body { grid-template-columns: minmax(0, 1fr) 160px; gap: 20px; padding-right: 20px; }
  .db-app__content { padding-right: 0; }
  .db-rail { display: grid; gap: 20px; padding-top: 24px; }
  .db-rail .cp-ad { margin: 0; text-align: center; }
  .db-rail__sticky { position: sticky; top: calc(var(--db-top) + 16px); }
  .db-top-ad { display: none; }
}
.db-top-ad { margin: 0 0 18px !important; }
.db-ad-row { display: grid; gap: 16px; margin-top: 28px; }
.db-ad-row .cp-ad { margin: 0; min-width: 0; }
.db-ad-row__wide { display: none; }
@media (min-width: 900px) {
  .db-ad-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .db-ad-row__wide { display: block; }
}

/* Dashboard icons (SVG, replace emoji) */
.db-stats__icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; font-size: 0 !important; }
.db-stats__icon--points { background: rgba(245, 158, 11, .14); color: #d97706; }
.db-stats__icon--streak { background: rgba(239, 68, 68, .12); color: #dc2626; }
.db-stats__icon--today { background: var(--brand-soft); color: var(--brand); }
.db-stats__icon--accuracy { background: rgba(22, 163, 74, .12); color: var(--chart-good); }
[data-theme="dark"] .db-stats__icon--points { color: #fbbf24; }
[data-theme="dark"] .db-stats__icon--streak { color: #f87171; }
.db-insight__icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--surface); color: var(--brand); font-size: 0 !important; box-shadow: var(--shadow-sm); }
.db-insight--good .db-insight__icon { color: var(--chart-good); }
.db-insight--warn .db-insight__icon { color: var(--chart-review); }
.db-insight { align-items: center; }
.db-badges__icon { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: rgba(245, 158, 11, .14); color: #d97706; font-size: 0 !important; }
[data-theme="dark"] .db-badges__icon { color: #fbbf24; }

/* Dashboard day-by-day table */
.db-days-wrap { overflow-x: auto; }
.db-days { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.db-days th { padding: 8px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.78rem; font-weight: 700; text-align: left; text-transform: uppercase; letter-spacing: .04em; }
.db-days td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); color: var(--ink); white-space: nowrap; }
.db-days td small { color: var(--muted); }
.db-days tbody tr:hover { background: var(--page); }
.db-days td:last-child { color: var(--chart-good); font-weight: 700; }
.db-days__today { margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 0.72rem; font-weight: 700; }

/* ==========================================================================
   Profile page (inside the account layout)
   ========================================================================== */
.pf-hero { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 24px; }
.pf-hero__avatar { width: 76px; height: 76px; font-size: 2rem; background: var(--brand-solid); color: #fff; }
.pf-hero__info { flex: 1; min-width: 220px; }
.pf-hero__info h2 { margin: 0; color: var(--ink); font-size: 1.45rem; font-weight: 800; }
.pf-hero__info p { display: flex; align-items: center; gap: 6px; margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; word-break: break-all; }
.pf-hero__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pf-hero__chips span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: 0.82rem; font-weight: 700; }
.pf-hero__stats { display: flex; gap: 10px; margin: 0; padding: 0; list-style: none; }
.pf-hero__stats li { display: flex; flex-direction: column; min-width: 92px; padding: 12px 16px; border-radius: var(--radius); background: var(--page); text-align: center; }
.pf-hero__stats strong { color: var(--ink); font-size: 1.4rem; font-weight: 800; }
.pf-hero__stats span { color: var(--muted); font-size: 0.78rem; font-weight: 600; }
@media (max-width: 640px) { .pf-hero__stats { width: 100%; } .pf-hero__stats li { flex: 1; min-width: 0; padding: 10px 8px; } }

.pf-form { display: grid; gap: 16px; }
.pf-field { display: grid; gap: 6px; }
.pf-field label { color: var(--ink); font-size: 0.88rem; font-weight: 700; }
.pf-field input, .pf-field select { height: 44px; padding: 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: 500 0.95rem var(--font); }
.pf-field input:focus, .pf-field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.pf-field input[readonly] { background: var(--page); color: var(--muted); cursor: not-allowed; }
.pf-field small { color: var(--muted); font-size: 0.8rem; }
.pf-grid-2 { display: grid; gap: 16px; }
@media (min-width: 640px) { .pf-grid-2 { grid-template-columns: 1fr 1fr; } }
.pf-check { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 0.88rem; font-weight: 600; cursor: pointer; }
.pf-check input { width: 16px; height: 16px; accent-color: var(--brand-solid); }
.pf-actions { display: flex; justify-content: flex-end; }
.pf-btn { height: 44px; padding: 0 22px; border: 0; border-radius: 999px; background: var(--brand-solid); color: #fff; font: 700 0.92rem var(--font); cursor: pointer; transition: transform .15s ease; }
.pf-btn:hover { transform: translateY(-1px); }
.pf-alert { margin-bottom: 14px; padding: 10px 14px; border-radius: 10px; font-size: 0.9rem; font-weight: 600; }
.pf-alert--success { background: rgba(22, 163, 74, .12); color: var(--chart-good); }
.pf-alert--error { background: rgba(220, 38, 38, .12); color: #dc2626; }
[data-theme="dark"] .pf-alert--error { color: #f87171; }

.pf-goal-quick { display: flex; gap: 8px; }
.pf-goal-quick button { flex: 1; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink-2); font: 700 0.9rem var(--font); cursor: pointer; }
.pf-goal-quick button:hover { border-color: var(--brand); color: var(--brand); }
.pf-goal-quick button.is-active { border-color: var(--brand-solid); background: var(--brand-soft); color: var(--brand); }

.pf-theme { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pf-theme label { cursor: pointer; }
.pf-theme input { position: absolute; opacity: 0; pointer-events: none; }
.pf-theme span { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 8px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-2); font-size: 0.88rem; font-weight: 700; transition: border-color .15s ease, background .15s ease; }
.pf-theme input:checked + span { border-color: var(--brand-solid); background: var(--brand-soft); color: var(--brand); }
.pf-theme input:focus-visible + span { box-shadow: 0 0 0 3px var(--brand-soft); }
.pf-note { margin: 10px 0 0; color: var(--muted); font-size: 0.82rem; }
.pf-account { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.pf-account .store-btn { width: auto; }
.pf-logout { color: #dc2626 !important; gap: 6px; }
.pf-logout:hover { border-color: #dc2626 !important; }
.pf-ad { display: block; }

/* Streak: month calendar with month filter */
.db-month__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 14px; }
.db-month__nav { display: flex; align-items: center; gap: 6px; }
.db-month__nav .db-icon-btn { width: 36px; height: 36px; font-size: 1.2rem; line-height: 1; }
.db-month__nav .db-icon-btn:disabled { opacity: .35; cursor: default; border-color: var(--line); color: var(--ink-2); }
.db-month__nav select { height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: 700 0.9rem var(--font); cursor: pointer; }
.db-month__sum { flex: 1; margin: 0; color: var(--muted); font-size: 0.88rem; font-weight: 600; }
.db-month__jump { padding: 7px 14px; border: 1px solid var(--brand); border-radius: 999px; background: var(--brand-soft); color: var(--brand); font: 700 0.82rem var(--font); cursor: pointer; }
.db-month__head, .db-month__grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.db-month__head { margin-bottom: 6px; }
.db-month__head span { color: var(--muted); font-size: 0.75rem; font-weight: 700; text-align: center; text-transform: uppercase; letter-spacing: .04em; }
.db-month__cell { position: relative; display: flex; flex-direction: column; justify-content: space-between; min-height: 64px; padding: 8px 10px; border-radius: 10px; aspect-ratio: auto !important; }
.db-month__cell b { color: var(--ink-2); font-size: 0.85rem; font-weight: 700; }
.db-month__cell small { align-self: flex-end; font-size: 0.75rem; font-weight: 800; }
.db-month__cell.l1 b, .db-month__cell.l1 small { color: var(--ink); }
.db-month__cell.l2 b, .db-month__cell.l2 small, .db-month__cell.l3 b, .db-month__cell.l3 small, .db-month__cell.l4 b, .db-month__cell.l4 small { color: #fff; }
[data-theme="dark"] .db-month__cell.l4 b, [data-theme="dark"] .db-month__cell.l4 small { color: #1e1b4b; }
.db-month__cell.is-blank { background: transparent; }
.db-month__cell.is-future { opacity: .45; }
.db-month__cell.is-today { box-shadow: inset 0 0 0 2px var(--brand-solid); }
.db-month__cell:not(.is-blank):not(.is-future):hover { outline: 2px solid var(--ink); outline-offset: 1px; }
@media (max-width: 640px) {
  .db-month__head, .db-month__grid { gap: 4px; }
  .db-month__cell { min-height: 44px; padding: 5px 6px; border-radius: 8px; }
  .db-month__cell b { font-size: 0.75rem; }
  .db-month__cell small { font-size: 0.62rem; }
  .db-month__sum { flex-basis: 100%; order: 3; }
}

/* Streak: week strip + 14-day tracker (same style as the standup tracker) */
:root { --st-done: #10b981; --st-low: #f59e0b; --st-missed-bg: rgba(239, 68, 68, .14); --st-missed-ring: rgba(239, 68, 68, .35); }
.st-week { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px 32px; }
.st-week__days { display: flex; gap: 10px; }
.st-week__day { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.st-week__name { color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.st-week__day.is-today .st-week__name { color: var(--ink); font-weight: 800; }
.st-dot { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 0.8rem; font-weight: 700; font-variant-numeric: tabular-nums; cursor: default; }
.st-dot--done { border-color: var(--st-done); background: var(--st-done); color: #fff; }
.st-dot--low { border-color: var(--st-low); background: var(--st-low); color: #fff; }
.st-dot--missed { border-style: dashed; }
.st-dot--today { border: 2px solid var(--brand-solid); color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.st-dot--future { opacity: .45; }
.st-week__stats { display: flex; flex-wrap: wrap; gap: 14px 32px; }
.st-stat { display: flex; flex-direction: column; }
.st-stat span { color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.st-stat strong { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); font-size: 1.6rem; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.st-stat small { color: var(--muted); font-size: 0.78rem; }
.st-stat__flame svg { color: var(--muted); }
.st-stat__flame.is-on svg { color: #f97316; }
@media (max-width: 520px) {
  .st-week__days { gap: 4px; width: 100%; justify-content: space-between; }
  .st-dot { width: 36px; height: 36px; }
}

.st-track__head { align-items: center; }
.st-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 0.8rem; font-weight: 600; }
.st-legend span { display: inline-flex; align-items: center; gap: 6px; }
.st-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.st-key--done { background: var(--st-done); }
.st-key--low { background: var(--st-low); }
.st-key--missed { background: var(--st-missed-bg); box-shadow: inset 0 0 0 1px var(--st-missed-ring); }
.st-track-wrap { overflow-x: auto; padding-bottom: 4px; }
.st-track { display: grid; grid-template-columns: repeat(14, minmax(26px, 1fr)) minmax(110px, auto); gap: 6px 4px; align-items: center; min-width: 560px; }
.st-track__label { display: flex; flex-direction: column; align-items: center; color: var(--muted); font-size: 0.78rem; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.st-track__label small { font-size: 0.66rem; }
.st-track__label.is-today { color: var(--ink); font-weight: 800; }
.st-track__label--end { align-items: flex-end; justify-content: flex-end; }
.st-cell { display: block; width: 100%; max-width: 40px; height: 30px; margin: 0 auto; border-radius: 7px; background: var(--line-soft); transition: transform .15s ease; }
.st-cell--done { background: var(--st-done); }
.st-cell--low { background: var(--st-low); }
.st-cell--missed { background: var(--st-missed-bg); box-shadow: inset 0 0 0 1px var(--st-missed-ring); }
.st-cell--done:hover, .st-cell--low:hover { transform: scale(1.1); }
.st-cell.is-today { box-shadow: 0 0 0 2px var(--ink); }
.st-rate { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.st-rate__bar { width: 56px; height: 6px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.st-rate__fill { display: block; height: 100%; border-radius: inherit; }
.st-rate__fill--good { background: var(--st-done); }
.st-rate__fill--mid { background: var(--st-low); }
.st-rate__fill--low { background: #ef4444; }
.st-rate b { color: var(--ink); font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.db-card { min-width: 0; }

/* Practice tracker with range + period filter */
.st-tracker__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 14px; }
.st-seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--line-soft); }
.st-seg button { padding: 6px 14px; border: 0; border-radius: 8px; background: transparent; color: var(--ink-2); font: 700 0.85rem var(--font); cursor: pointer; }
.st-seg button.is-active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow-sm); }
.st-tracker__nav { display: flex; align-items: center; gap: 8px; }
.st-tracker__nav .db-icon-btn { width: 34px; height: 34px; font-size: 1.15rem; line-height: 1; }
.st-tracker__nav .db-icon-btn:disabled { opacity: .35; cursor: default; border-color: var(--line); color: var(--ink-2); }
.st-tracker__period { min-width: 150px; color: var(--ink); font-size: 0.9rem; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }
.st-tracker__grid { display: grid; gap: 6px; }
.st-tracker__grid--14 { grid-template-columns: repeat(14, minmax(0, 1fr)); }
.st-tracker__grid--30 { grid-template-columns: repeat(15, minmax(0, 1fr)); }
.st-tracker__grid--90 { grid-template-columns: repeat(15, minmax(0, 1fr)); gap: 4px; }
.st-tracker__grid .st-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; max-width: none; height: 46px; margin: 0; color: var(--muted); cursor: default; }
.st-tracker__grid--90 .st-cell { height: 32px; border-radius: 6px; }
.st-cell b { font-size: 0.78rem; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.st-tracker__grid--90 .st-cell b { font-size: 0.66rem; }
.st-cell small { font-size: 0.62rem; font-weight: 700; opacity: .8; }
.st-cell--done, .st-cell--low { color: #fff !important; }
.st-cell--missed { color: #ef4444 !important; }
[data-theme="dark"] .st-cell--missed { color: #f87171 !important; }
.st-cell--before { background: transparent; box-shadow: inset 0 0 0 1px var(--line-soft); opacity: .5; }
.st-cell--future { opacity: .4; }
.st-cell--today { box-shadow: inset 0 0 0 2px var(--brand-solid); color: var(--brand) !important; }
.st-tracker__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line-soft); }
.st-tracker__sum { margin: 0; color: var(--muted); font-size: 0.88rem; font-weight: 600; }
.st-tracker__sum b { color: var(--ink); }
.st-tracker__sum b.is-missed { color: #ef4444; }
[data-theme="dark"] .st-tracker__sum b.is-missed { color: #f87171; }
@media (max-width: 720px) {
  .st-tracker__grid--14, .st-tracker__grid--30 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .st-tracker__grid--90 { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .st-tracker__grid .st-cell { height: 40px; }
  .st-tracker__grid--90 .st-cell b { font-size: 0.6rem; }
  .st-tracker__period { min-width: 0; flex: 1; }
  .st-tracker__nav { width: 100%; }
}

.st-tracker__grid--90 .st-cell b { font-size: 0.7rem; }
@media (max-width: 720px) { .st-tracker__grid--90 .st-cell b { font-size: 0.62rem; } }
.st-cell b, .st-cell small { color: inherit !important; }
/* old-style.css forces every <b> purple; inside the dashboard/profile bold text keeps its own colour */
.db-app b { color: inherit !important; }
.db-app .st-tracker__sum b { color: var(--ink) !important; }
.db-app .st-tracker__sum b.is-missed { color: #ef4444 !important; }
[data-theme="dark"] .db-app .st-tracker__sum b.is-missed { color: #f87171 !important; }
.db-app .db-insight b, .db-app .db-split__legend b, .db-app .st-rate b { color: var(--ink) !important; }

/* ==========================================================================
   Performance charts: donuts, column bars, horizontal bars
   Categorical slots validated (light #fff / dark #111a2e): blue, orange, aqua
   ========================================================================== */
:root { --ch-1: #2a78d6; --ch-2: #eb6834; --ch-3: #1baf7a; --ch-4: #6250d6; }
[data-theme="dark"] { --ch-1: #3987e5; --ch-2: #d95926; --ch-3: #199e70; --ch-4: #9085e9; }
.ch-s1 { --c: var(--ch-1); } .ch-s2 { --c: var(--ch-2); } .ch-s3 { --c: var(--ch-3); } .ch-s4 { --c: var(--ch-4); }
.ch-good { --c: var(--chart-good); } .ch-review { --c: var(--chart-review); }

.ch-donut { position: relative; width: 190px; max-width: 70%; margin: 4px auto 16px; }
.ch-donut__svg { display: block; width: 100%; height: auto; transform: none; }
.ch-donut__track { fill: none; stroke: var(--line-soft); stroke-width: 5.5; }
.ch-donut__slice { fill: none; stroke: var(--c); stroke-width: 5.5; cursor: pointer; transition: stroke-width .15s ease; }
.ch-donut__slice:hover { stroke-width: 7; }
.ch-donut__center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.ch-donut__center strong { color: var(--ink); font-size: 1.6rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ch-donut__center span { color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.ch-legend { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ch-legend li { display: grid; grid-template-columns: auto 1fr auto 44px; align-items: center; gap: 10px; color: var(--ink-2); font-size: 0.88rem; }
.ch-legend small { color: var(--muted); }
.ch-legend b { color: var(--ink) !important; font-variant-numeric: tabular-nums; }
.ch-legend em { color: var(--muted); font-style: normal; font-size: 0.82rem; text-align: right; font-variant-numeric: tabular-nums; }
.ch-key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--c); }

.ch-cols { display: grid; grid-template-columns: repeat(var(--cols, 7), minmax(0, 1fr)); gap: 6px; height: 190px; align-items: end; border-bottom: 1px solid var(--line); }
.ch-cols--week { --cols: 7; }
.ch-cols__col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; min-width: 0; cursor: default; }
.ch-cols__col[hidden] { display: none; }
.ch-cols__val { min-height: 1em; color: var(--ink-2); font-size: 0.75rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ch-cols__bar { display: block; width: 100%; max-width: 46px; border-radius: 4px 4px 0 0; background: var(--brand-solid); transition: height .4s ease; }
.ch-cols--week .ch-cols__bar { background: var(--cal-2); }
.ch-cols--week .ch-cols__bar.is-top { background: var(--brand-solid); }
.ch-cols__col:hover .ch-cols__bar { filter: brightness(1.15); }
.ch-cols__label { display: flex; flex-direction: column; align-items: center; height: 30px; margin-bottom: -34px; color: var(--muted); font-size: 0.72rem; font-weight: 600; line-height: 1.2; }
.ch-cols__label small { font-size: 0.64rem; opacity: .8; }
.ch-cols { margin-bottom: 38px; }
.ch-month-seg button { padding: 5px 10px; font-size: 0.78rem; }

.ch-hbars { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.ch-hbars li { display: grid; grid-template-columns: minmax(90px, 34%) 1fr 48px; align-items: center; gap: 12px; cursor: default; }
.ch-hbars__name { overflow: hidden; color: var(--ink); font-size: 0.88rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ch-hbars__track { height: 10px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.ch-hbars__bar { display: block; height: 100%; border-radius: 999px; background: var(--brand-solid); }
.ch-hbars__bar.is-low { background: var(--chart-review); }
.ch-hbars__val { color: var(--ink); font-size: 0.88rem; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .ch-cols { height: 160px; gap: 3px; }
  .ch-cols__val { font-size: 0.62rem; }
  .ch-cols__label { font-size: 0.62rem; }
}

/* bar height = share of the plot area left after the value label, so tall bars never push their date label down */
.ch-cols__bar { height: calc((100% - 22px) * var(--h, 0)); }
.db-bottom-banner { margin: 28px 0 0 !important; }
/* An ad (or any wide content) can never make the account pages wider than the screen */
.db-app__main { min-width: 0; max-width: 100%; overflow-x: clip; }
@media (min-width: 1024px) { .db-app__main { max-width: calc(100vw - var(--db-side)); } }
.db-app__body > *, .db-app__content { min-width: 0; }
.db-app .cp-ad { max-width: 100%; overflow: hidden; }

/* Sidebar edge + slimmer top bar with breadcrumb and status chips */
.db-sidebar { border-right: 1px solid rgba(148, 163, 184, .16); }
[data-theme="dark"] .db-sidebar { border-right-color: rgba(148, 163, 184, .12); }
:root { --db-top: 60px; }
.db-topbar { min-height: var(--db-top); padding: 8px 28px; gap: 16px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--page) 86%, transparent); box-shadow: none; }
.db-crumbs { display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0; font-size: 0.95rem; }
.db-crumbs__root { color: var(--muted); font-weight: 600; }
.db-crumbs__sep { color: var(--muted); opacity: .6; }
.db-crumbs__page { overflow: hidden; color: var(--ink); font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.db-topbar__actions { gap: 10px; }
.db-chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
.db-chip b { color: var(--ink); font-weight: 800; font-variant-numeric: tabular-nums; }
.db-chip svg { color: var(--muted); }
.db-chip--streak svg { color: #f97316; }
.db-chip--good svg { color: var(--chart-good); }
.db-topbar__cta { height: 36px; padding: 0 16px; font-size: 0.88rem; }
.db-topbar .db-icon-btn { width: 36px; height: 36px; }
.db-topbar__user { display: inline-flex; align-items: center; gap: 10px; padding: 3px 12px 3px 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); text-decoration: none !important; transition: border-color .15s ease; }
.db-topbar__user:hover { border-color: var(--brand); }
.db-topbar__user .lb-avatar { width: 30px; height: 30px; font-size: 0.85rem; background: var(--brand-solid); color: #fff; }
.db-topbar__name { display: flex; flex-direction: column; line-height: 1.15; }
.db-topbar__name strong { color: var(--ink); font-size: 0.85rem; }
.db-topbar__name small { color: var(--muted); font-size: 0.72rem; }
@media (max-width: 1279px) { .db-chip span { display: none; } }
@media (max-width: 1023px) { .db-topbar { padding: 8px 16px; } .db-topbar__name { display: none; } .db-topbar__user { padding: 3px; } }
@media (max-width: 720px) { .db-chip { display: none; } }
@media (max-width: 560px) { .db-crumbs__root, .db-crumbs__sep { display: none; } }

/* Overview number cards: mini charts */
.db-stats li { padding-bottom: 14px; }
.db-stats__cap { margin-top: 6px; color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.db-stats__cap a { color: var(--brand); }
.db-spark { position: relative; height: 34px; margin-top: 10px; }
.db-spark svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.db-spark__line { fill: none; stroke: var(--c); stroke-width: 2px; stroke-linejoin: round; stroke-linecap: round; }
.db-spark__area { fill: var(--c); opacity: .12; }
.db-spark--points { --c: #d97706; }
.db-spark--accuracy { --c: var(--chart-good); }
[data-theme="dark"] .db-spark--points { --c: #fbbf24; }
.db-spark__dot { position: absolute; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; cursor: pointer; }
.db-spark__dot::after { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--c); opacity: 0; transition: opacity .15s ease; }
.db-spark__dot:hover::after, .db-spark__dot.is-last::after { opacity: 1; }
.db-spark__dot.is-last::after { box-shadow: 0 0 0 2px var(--surface); }

.db-mini-week { display: flex; justify-content: space-between; gap: 4px; margin-top: 10px; }
.db-mini-week__day { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; cursor: default; }
.db-mini-week__day i { display: block; width: 100%; max-width: 18px; height: 18px; border-radius: 5px; background: var(--line-soft); }
.db-mini-week__day b { color: var(--muted); font-size: 0.62rem; font-weight: 700; }
.db-mini-week__day--done i { background: var(--st-done); }
.db-mini-week__day--low i { background: var(--st-low); }
.db-mini-week__day--missed i { background: var(--st-missed-bg); box-shadow: inset 0 0 0 1px var(--st-missed-ring); }
.db-mini-week__day--today i { box-shadow: inset 0 0 0 2px var(--brand-solid); background: transparent; }
.db-mini-week__day--today b { color: var(--brand); }
.db-mini-week__day--future i { opacity: .45; }

.db-stats__ring-tile { position: relative; }
.db-ring { position: absolute; right: 16px; bottom: 14px; width: 54px; height: 54px; cursor: default; }
.db-ring svg { width: 100%; height: 100%; }
.db-ring__track { fill: none; stroke: var(--line-soft); stroke-width: 4; }
.db-ring__fill { fill: none; stroke: var(--brand-solid); stroke-width: 4; stroke-linecap: round; transition: stroke-dasharray .5s ease; }
.db-ring.is-done .db-ring__fill { stroke: var(--chart-good); }
.db-ring span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--ink); font-size: 0.72rem; font-weight: 800; }
.db-stats__ring-tile .db-stats__cap { margin-top: auto; padding-top: 34px; }
.db-stats__ring-tile .db-stats__icon { right: 16px; }
.db-spark--empty { border-bottom: 2px dashed var(--line); height: 20px; margin-bottom: 14px; }

/* Dashboard leaderboard tab */
.db-board .lb-podium { margin-top: 18px; }
.db-medal { position: absolute; top: -14px; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; color: #fff; box-shadow: 0 0 0 3px var(--surface); }
.db-medal--1 { background: #f59e0b; }
.db-medal--2 { background: #94a3b8; }
.db-medal--3 { background: #c2703d; }
.db-myrank__row { padding: 4px 0 14px; }
.db-myrank__big { display: flex; flex-direction: column; padding: 16px 18px; border-radius: var(--radius); background: var(--brand-soft); }
.db-myrank__big span { color: var(--brand); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.db-myrank__big strong { color: var(--ink); font-size: 2.4rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.db-myrank__big small { color: var(--ink-2); font-size: 0.85rem; font-weight: 600; }
.db-myrank__next { margin: 12px 0 0; color: var(--ink-2); font-size: 0.9rem; line-height: 1.5; }
.db-myrank__h { margin: 6px 0 4px; padding-top: 14px; border-top: 1px solid var(--line-soft); color: var(--ink); font-size: 0.95rem; font-weight: 800; }
.db-myrank .lb-rules li { padding: 4px 0; font-size: 0.9rem; }
.db-myrank__cta { width: 100%; margin-top: 14px; }

/* Overview: top 5 leaders with progress bars */
.db-top5__list { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.db-top5__row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 10px; cursor: default; }
.db-top5__row.is-me { background: var(--brand-soft); }
.db-top5__rank { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--line-soft); color: var(--ink-2); font-size: 0.82rem; font-weight: 800; }
.db-top5__rank--1 { background: #f59e0b; color: #fff; }
.db-top5__rank--2 { background: #94a3b8; color: #fff; }
.db-top5__rank--3 { background: #c2703d; color: #fff; }
.db-top5__body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.db-top5__name { overflow: hidden; color: var(--ink); font-size: 0.9rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.db-top5__name em { color: var(--brand); font-style: normal; font-size: 0.8rem; }
.db-top5__track { height: 8px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.db-top5__bar { display: block; height: 100%; width: var(--w); border-radius: inherit; background: var(--brand-solid); animation: db-grow .8s ease-out both; }
.db-top5__row:first-child .db-top5__bar { background: #f59e0b; }
.db-top5__row.is-me .db-top5__bar { background: var(--chart-good); }
@keyframes db-grow { from { width: 0; } to { width: var(--w); } }
@media (prefers-reduced-motion: reduce) { .db-top5__bar { animation: none; } }
.db-top5__pts { color: var(--ink); font-size: 0.92rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.db-top5__pts small { color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.db-top5__me { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line-soft); color: var(--ink-2); font-size: 0.88rem; }
.db-top5__me b { color: var(--ink) !important; }

/* Practice tab: self-check question cards */
.db-q-intro { margin: -4px 0 14px; color: var(--muted); font-size: 0.88rem; }
.db-q-intro b { color: var(--ink) !important; }
.db-qs { display: grid; gap: 12px; }
@media (min-width: 900px) { .db-qs { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
.db-q { padding: 16px 18px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--page); transition: border-color .2s ease; }
.db-q.is-correct { border-color: var(--chart-good); }
.db-q.is-review { border-color: var(--chart-review); }
.db-q__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.db-q__badge { padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 800; }
.db-q.is-correct .db-q__badge { background: rgba(22, 163, 74, .14); color: var(--chart-good); }
.db-q.is-review .db-q__badge { background: rgba(217, 119, 6, .14); color: var(--chart-review); }
.db-q__text { margin: 8px 0 12px; color: var(--ink); font-weight: 600; line-height: 1.5; }
.db-q__actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.db-q__open { height: 36px; padding: 0 18px; font-size: 0.85rem; }
.db-q__panel { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.db-q__reveal { width: 100%; height: 40px; border: 1px dashed var(--brand); border-radius: 10px; background: var(--brand-soft); color: var(--brand); font: 700 0.88rem var(--font); cursor: pointer; }
.db-q__answer { padding: 12px 14px; border-left: 3px solid var(--chart-good); border-radius: 0 10px 10px 0; background: var(--surface); color: var(--ink-2); font-size: 0.92rem; line-height: 1.65; overflow-x: auto; }
.db-q__answer img { max-width: 100%; height: auto; }
.db-q__answer p { margin: 0 0 8px; }
.db-q__form { display: grid; gap: 10px; margin-top: 12px; }
.db-q__form fieldset { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; }
.db-q__form legend { width: 100%; margin-bottom: 6px; color: var(--ink); font-size: 0.85rem; font-weight: 700; }
.db-q__choice { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font-size: 0.85rem; font-weight: 700; cursor: pointer; }
.db-q__choice input { accent-color: var(--brand-solid); }
.db-q__choice--ok:has(input:checked) { border-color: var(--chart-good); color: var(--chart-good); background: rgba(22, 163, 74, .08); }
.db-q__choice--miss:has(input:checked) { border-color: var(--chart-review); color: var(--chart-review); background: rgba(217, 119, 6, .08); }
.db-q__form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: 500 0.88rem var(--font); resize: vertical; }
.db-q__form textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.db-q__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.db-q__foot .pf-btn { height: 38px; padding: 0 20px; }
.db-q__foot .pf-btn:disabled { opacity: .6; cursor: default; transform: none; }
.db-q__status { margin: 0; font-size: 0.85rem; font-weight: 600; }
.db-q__status.is-success { color: var(--chart-good); }
.db-q__status.is-error { color: #dc2626; }
[data-theme="dark"] .db-q__status.is-error { color: #f87171; }
.db-q__choice input[type="radio"] { -webkit-appearance: radio; appearance: radio; width: 16px; height: 16px; margin: 0; background: none; border: 0; box-shadow: none; }

/* Practice tab: session, today stats, MCQ chapters */
.db-session__stage { min-height: 220px; }
.db-session__start { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 18px; border-radius: var(--radius); background: linear-gradient(135deg, var(--brand-soft), transparent); }
.db-session__lead { margin: 0; color: var(--ink); font-size: 1.05rem; font-weight: 700; }
.db-session__how { margin: 0; color: var(--ink-2); font-size: 0.9rem; }
.db-session__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.db-session__chips span { padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); font-size: 0.78rem; font-weight: 700; }
.db-session__go { height: 44px; padding: 0 26px; }
.db-session__progress { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; color: var(--muted); font-size: 0.85rem; font-weight: 700; }
.db-session__dots { display: flex; gap: 6px; }
.db-session__dots i { display: block; width: 28px; height: 6px; border-radius: 999px; background: var(--line-soft); }
.db-session__dots i.is-now { background: var(--brand-solid); }
.db-session__dots i.is-ok { background: var(--chart-good); }
.db-session__dots i.is-miss { background: var(--chart-review); }
.db-session__q { margin: 8px 0 16px; color: var(--ink); font-size: 1.15rem; font-weight: 700; line-height: 1.5; white-space: pre-line; }
.db-session__stage .db-q__answer { margin-bottom: 14px; }
.db-session__marks { display: flex; flex-wrap: wrap; gap: 8px; }
.db-session__mark { flex: 1; min-width: 180px; height: 46px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font: 700 0.92rem var(--font); cursor: pointer; transition: transform .15s ease, background .15s ease; }
.db-session__mark:hover:not(:disabled) { transform: translateY(-1px); }
.db-session__mark--ok { border-color: var(--chart-good); color: var(--chart-good); }
.db-session__mark--ok:hover:not(:disabled) { background: rgba(22, 163, 74, .08); }
.db-session__mark--miss { border-color: var(--chart-review); color: var(--chart-review); }
.db-session__mark--miss:hover:not(:disabled) { background: rgba(217, 119, 6, .08); }
.db-session__mark:disabled { opacity: .5; cursor: default; }
.db-session__stage .db-q__status { min-height: 1.2em; margin-top: 10px; }
.db-q__status.is-review { color: var(--chart-review); }
.db-session__next { height: 42px; padding: 0 22px; margin-top: 8px; }
.db-session__full { display: inline-block; margin-top: 12px; margin-left: 12px; }
.db-session__summary { text-align: center; }
.db-session__score { margin: 4px 0 0; color: var(--ink); font-size: 3rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.db-session__summary .db-session__lead { margin-top: 6px; }
.db-session__pts { display: inline-block; margin: 10px 0 0; padding: 4px 12px; border-radius: 999px; background: rgba(245, 158, 11, .14); color: #d97706; font-weight: 800; }
[data-theme="dark"] .db-session__pts { color: #fbbf24; }
.db-session__list { display: grid; gap: 6px; margin: 16px 0; padding: 0; list-style: none; text-align: left; }
.db-session__list li { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; border-radius: 10px; background: var(--page); }
.db-session__list a { color: var(--ink) !important; font-size: 0.9rem; text-decoration: none !important; }
.db-session__icon { font-weight: 800; }
.db-session__list li.is-ok .db-session__icon { color: var(--chart-good); }
.db-session__list li.is-miss .db-session__icon { color: var(--chart-review); }
.db-session__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.db-session__actions .pf-btn, .db-session__actions .store-btn { height: 42px; width: auto; }

.db-today__stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.db-today__stats li { display: flex; flex-direction: column; padding: 12px; border-radius: var(--radius); background: var(--page); text-align: center; }
.db-today__stats strong { color: var(--ink); font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.db-today__stats span { color: var(--muted); font-size: 0.75rem; font-weight: 600; }
.db-today__goal { margin-top: 16px; }
.db-today__goal-head { display: flex; justify-content: space-between; margin-bottom: 6px; color: var(--muted); font-size: 0.85rem; font-weight: 600; }
.db-today__goal-head b { color: var(--ink); }
.db-today__tip { margin: 14px 0 0; color: var(--muted); font-size: 0.85rem; line-height: 1.5; }
.db-today__tip a { color: var(--brand); font-weight: 700; }
.db-mistakes__btn { height: 34px; padding: 0 14px; font-size: 0.82rem; }

.db-mcq { display: grid; gap: 4px; max-height: 360px; margin: 0; padding: 0 4px 0 0; overflow-y: auto; list-style: none; scrollbar-width: thin; }
.db-mcq a { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--ink) !important; text-decoration: none !important; }
.db-mcq a:hover { background: var(--brand-soft); }
.db-mcq__no { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); font-size: 0.8rem; font-weight: 800; }
.db-mcq__name { overflow: hidden; font-size: 0.88rem; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.db-mcq__count { color: var(--muted); font-size: 0.75rem; font-weight: 700; }
.db-session__stage .db-q__answer { max-height: 320px; overflow-y: auto; scrollbar-width: thin; }

/* Dashboard built-in viewer */
.db-viewer { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.db-viewer[hidden] { display: none; }
.db-viewer__bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--page); }
.db-viewer__back { flex-shrink: 0; height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: 700 0.85rem var(--font); cursor: pointer; }
.db-viewer__back:hover { border-color: var(--brand); color: var(--brand); }
.db-viewer__title { flex: 1; min-width: 0; overflow: hidden; color: var(--ink); font-size: 0.92rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.db-viewer__out { flex-shrink: 0; color: var(--brand) !important; font-size: 0.82rem; font-weight: 700; text-decoration: none !important; }
.db-viewer__loading { padding: 10px 16px; color: var(--muted); font-size: 0.85rem; }
.db-viewer__loading[hidden] { display: none; }
.db-viewer__frame { display: block; width: 100%; height: calc(100vh - var(--db-top) - 120px); min-height: 520px; border: 0; background: var(--page); }
.db-app.is-viewing .db-top-ad, .db-app.is-viewing .db-bottom-banner { display: none !important; }
@media (max-width: 640px) {
  .db-viewer__out { display: none; }
  .db-viewer__frame { height: calc(100vh - var(--db-top) - 90px); min-height: 420px; }
}

/* Pages shown inside the viewer (?embed=1): no site chrome or ads */
.is-embed .site-header, .is-embed .site-footer, .is-embed .site-subbar,
.is-embed .cp-ad, .is-embed .cp-rail, .is-embed ins.adsbygoogle,
.is-embed .top-add-container, .is-embed .ads { display: none !important; }
.is-embed .cp-railwrap { display: block !important; }
body.is-embed { padding-top: 0 !important; }

/* Viewer blends into the dashboard: no frame look; height follows the embedded page */
.db-viewer { border: 0; border-radius: 0; background: transparent; box-shadow: none; overflow: visible; }
.db-viewer__bar { padding: 0 0 14px; border-bottom: 0; background: transparent; }
.db-viewer__frame { height: calc(100vh - var(--db-top) - 120px); min-height: 400px; background: transparent; }
.db-viewer__loading { padding: 4px 0 10px; }
/* inside the viewer the page sits flush with the dashboard (no extra outer gap) */
.is-embed { background: var(--page); }
.is-embed > main:first-of-type, .is-embed main.cp { padding-top: 0 !important; }
.is-embed .cp-wrap, .is-embed .qa-wrap { padding-left: 0 !important; padding-right: 0 !important; max-width: none !important; }

/* Inside the viewer the embedded page never scrolls by itself; the dashboard scrolls instead */
html:has(body.is-embed), body.is-embed { height: auto !important; min-height: 0 !important; overflow: hidden !important; }
.db-viewer__frame { overflow: hidden; }

/* Breadcrumb while a page is open in the viewer: Dashboard › Practice › <page> */
.db-crumbs__page.is-link { color: var(--brand); font-weight: 700; cursor: pointer; }
.db-crumbs__page.is-link:hover { text-decoration: underline; }
.db-crumbs__extra { overflow: hidden; color: var(--ink); font-weight: 800; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.db-crumbs__extra[hidden], .db-crumbs__sep[hidden] { display: none; }
.db-app.is-viewing .db-crumbs__page { flex-shrink: 0; }
.db-viewer { padding-top: 4px; }
@media (max-width: 560px) {
  .db-app.is-viewing .db-crumbs__extra, .db-app.is-viewing [data-db-crumb-extra-sep] { display: none; }
  .db-app.is-viewing .db-crumbs__page.is-link::before { content: "‹ "; }
}

/* Practice: everything for the class */
.db-material__tabs { display: flex; gap: 6px; margin-bottom: 14px; padding-bottom: 2px; overflow-x: auto; scrollbar-width: none; }
.db-material__tabs::-webkit-scrollbar { display: none; }
.db-material__tabs button { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: 700 0.85rem var(--font); cursor: pointer; white-space: nowrap; }
.db-material__tabs button b { padding: 1px 7px; border-radius: 999px; background: var(--line-soft); color: var(--muted); font-size: 0.72rem; }
.db-material__tabs button:hover { border-color: var(--brand); color: var(--brand); }
.db-material__tabs button.is-active { border-color: var(--brand-solid); background: var(--brand-solid); color: #fff; }
.db-material__tabs button.is-active b { background: rgba(255, 255, 255, .22); color: #fff; }
.db-material__group { margin: 14px 0 6px; color: var(--ink); font-size: 0.92rem; font-weight: 800; }
.db-material__group:first-child { margin-top: 0; }
.db-material__group small { color: var(--muted); font-weight: 600; }
.db-material__list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
@media (min-width: 900px) { .db-material__list { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; } }
.db-material__list a { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--ink) !important; text-decoration: none !important; }
.db-material__list a:hover { background: var(--brand-soft); }
.db-material__list .db-mcq__no { width: auto; min-width: 28px; padding: 0 6px; font-size: 0.72rem; }

/* ==========================================================================
   Admin portal (uses the dashboard shell: .db-app + .adm)
   ========================================================================== */
.adm-body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--font); }
.adm-badge { margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: #4f46e5; color: #fff; font-size: 0.65rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; vertical-align: middle; }
.adm-viewsite { width: auto; height: 36px; padding: 0 14px; font-size: 0.85rem; }
.adm { padding-bottom: 48px; }
.adm h1 { margin: 0; color: var(--ink); font-size: 1.5rem; font-weight: 800; }
.adm h2 { margin: 0; color: var(--ink); font-size: 1.1rem; font-weight: 800; }
.adm h3 { color: var(--ink); }
.adm a { color: var(--brand); }
.adm .text-muted { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.adm-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.adm-btn, .adm .admin-form button, .adm form > button[type="submit"] { display: inline-flex; align-items: center; justify-content: center; height: 40px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--brand-solid); color: #fff !important; font: 700 0.9rem var(--font); text-decoration: none !important; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.adm-btn:hover, .adm .admin-form button:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(79, 70, 229, .25); }
.adm-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 20px; padding: 0; list-style: none; }
@media (max-width: 720px) { .adm-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.adm-stats li { display: flex; flex-direction: column; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.adm-stats strong { color: var(--ink); font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.adm-stats span { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.adm-stats li.is-warn strong { color: var(--chart-review); }

.adm .admin-section { margin: 0 0 20px; padding: 22px 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
@media (max-width: 640px) { .adm .admin-section { padding: 16px; } }
.adm .section-heading, .adm .stacked { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: 14px; }
.adm .stacked { flex-direction: column; align-items: flex-start; }
.adm .admin-grid { display: grid; gap: 20px; }
.adm .admin-form { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.adm .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; align-items: end; }
.adm .admin-form label { display: flex; flex-direction: column; gap: 6px; color: var(--ink); font-size: 0.85rem; font-weight: 700; }
.adm .admin-form input, .adm .admin-form select, .adm .admin-form textarea, .adm input[type="text"], .adm input[type="file"], .adm select, .adm textarea {
  width: 100%; box-sizing: border-box; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--page); color: var(--ink); font: 500 0.92rem var(--font);
}
.adm textarea { min-height: 120px; resize: vertical; line-height: 1.6; }
.adm input:focus, .adm select:focus, .adm textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.adm input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; accent-color: var(--brand-solid); }

.adm table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.adm thead th { position: sticky; top: 0; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 0.75rem; font-weight: 700; text-align: left; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.adm tbody td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); color: var(--ink-2); vertical-align: middle; }
.adm tbody tr:hover { background: var(--page); }
.adm tbody td:nth-child(6) { color: var(--ink); font-weight: 600; }
.adm .pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; }
.adm .pill.success { background: rgba(22, 163, 74, .12); color: var(--chart-good); }
.adm .pill.muted { background: rgba(217, 119, 6, .12); color: var(--chart-review); }
.adm .admin-actions { display: flex; flex-wrap: wrap; gap: 6px; font-size: 0.82rem; }
.adm .admin-actions a, .adm .admin-actions button { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink-2) !important; font: 700 0.8rem var(--font); text-decoration: none !important; cursor: pointer; }
.adm .admin-actions a:hover { border-color: var(--brand); color: var(--brand) !important; }
.adm .admin-actions button.danger { border-color: rgba(220, 38, 38, .35); background: rgba(220, 38, 38, .08); color: #dc2626 !important; }
[data-theme="dark"] .adm .admin-actions button.danger { color: #f87171 !important; }
.adm .admin-actions button.danger:hover { background: rgba(220, 38, 38, .16); }
.adm .admin-flash { margin-bottom: 16px; padding: 12px 16px; border: 1px solid rgba(22, 163, 74, .3); border-radius: 10px; background: rgba(22, 163, 74, .1); color: var(--chart-good); font-size: 0.9rem; font-weight: 600; }
.adm .admin-flash.error { border-color: rgba(220, 38, 38, .3); background: rgba(220, 38, 38, .1); color: #dc2626; }
[data-theme="dark"] .adm .admin-flash.error { color: #f87171; }
.adm-app .db-topbar { background: color-mix(in srgb, var(--page) 86%, transparent); }
/* admin pages don't load the legacy CSS, so set box sizing here (keeps the sidebar 248px and the content padding) */
.adm-body *, .adm-body *::before, .adm-body *::after { box-sizing: border-box; }
.adm .admin-form > button, .adm .admin-form > div > button { align-self: flex-start; }
.adm td .admin-actions { flex-wrap: nowrap; }
.adm .admin-section > div[style*="overflow-x"] { margin: 0 -8px; padding: 0 8px; }
