/* ==========================================================================
   ГДЗ — design system
   Colours sampled directly from the approved mockup.
   ========================================================================== */

/* Allow smooth theme fades: custom props are not interpolable unless registered */
@property --bg { syntax: "<color>"; inherits: true; initial-value: #eeeeee; }
@property --surface { syntax: "<color>"; inherits: true; initial-value: #ffffff; }
@property --card { syntax: "<color>"; inherits: true; initial-value: #f7f7f7; }
@property --line { syntax: "<color>"; inherits: true; initial-value: #e6e6ea; }
@property --ink { syntax: "<color>"; inherits: true; initial-value: #242c40; }
@property --ink-2 { syntax: "<color>"; inherits: true; initial-value: #545b6b; }
@property --ink-3 { syntax: "<color>"; inherits: true; initial-value: #8b91a0; }
@property --purple { syntax: "<color>"; inherits: true; initial-value: #594299; }
@property --accent { syntax: "<color>"; inherits: true; initial-value: #6c4fd0; }
@property --accent-2 { syntax: "<color>"; inherits: true; initial-value: #8e76d5; }
@property --accent-soft { syntax: "<color>"; inherits: true; initial-value: #ece4f8; }
@property --input-bg { syntax: "<color>"; inherits: true; initial-value: #ffffff; }
@property --seo-bg { syntax: "<color>"; inherits: true; initial-value: #f0f0fa; }
@property --hero-plate { syntax: "<color>"; inherits: true; initial-value: #f4efff; }
@property --header-link-bg { syntax: "<color>"; inherits: true; initial-value: #e8e1f6; }
@property --header-link-ink { syntax: "<color>"; inherits: true; initial-value: #3a3358; }
@property --header-link-bg-hover { syntax: "<color>"; inherits: true; initial-value: #ddd4f2; }
@property --header-link-bg-active { syntax: "<color>"; inherits: true; initial-value: #d4c8f0; }
@property --header-link-ink-active { syntax: "<color>"; inherits: true; initial-value: #2f2850; }
@property --chip-bg { syntax: "<color>"; inherits: true; initial-value: #ffffff; }
@property --chip-ink { syntax: "<color>"; inherits: true; initial-value: #545b6b; }

:root {
  --bg: #eeeeee;
  --surface: #ffffff;
  --card: #f7f7f7;
  --line: #e6e6ea;

  --ink: #242c40;
  --ink-2: #545b6b;
  --ink-3: #8b91a0;

  --purple: #594299;
  --accent: #6c4fd0;
  --accent-2: #8e76d5;
  --accent-soft: #ece4f8;

  --seo-bg: #f0f0fa;
  --footer-a: #6b41c2;
  --footer-b: #ac41c2;

  --r-lg: 18px;
  --r-md: 14px;
  --r-sm: 10px;

  --shadow: 0 1px 2px rgba(36, 44, 64, .04);
  --input-bg: #ffffff;
  --hero-bg: linear-gradient(103deg, #f9f6ff 0%, #f4efff 42%, #ece0fd 100%);
  --hero-plate: #f4efff;
  --header-link-bg: #e8e1f6;
  --header-link-ink: #3a3358;
  --header-link-bg-hover: #ddd4f2;
  --header-link-bg-active: #d4c8f0;
  --header-link-ink-active: #2f2850;
  --scroll-track: #ebe7f3;
  --scroll-thumb: #b5a6d8;
  --scroll-thumb-hover: #8e76d5;
  --msg-user-bg: #e4def4;
  --msg-user-ink: #242c40;
  --msg-error-bg: #fdecec;
  --msg-error-ink: #b03636;
  --task-ready-bg: #ece4f8;
  --task-ready-ink: #594299;
  --task-ready-border: #d4c8ef;
  --chip-bg: #ffffff;
  --chip-ink: #545b6b;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121018;
  --surface: #1c1a24;
  --card: #23202c;
  --line: #2f2b3a;
  --ink: #eceaf3;
  --ink-2: #b8b4c4;
  --ink-3: #8d889c;
  --purple: #cbbfff;
  --accent: #d7c9ff;
  --accent-2: #b9a4f0;
  --accent-soft: #2a2438;
  --seo-bg: #1a1722;
  --footer-a: #4a2d86;
  --footer-b: #6b2d86;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --input-bg: #16141c;
  --hero-bg: linear-gradient(103deg, #221e2c 0%, #2a2438 42%, #322a48 100%);
  --hero-plate: #221e2c;
  --header-link-bg: #2a2438;
  --header-link-ink: #d7c9ff;
  --header-link-bg-hover: #322a48;
  --header-link-bg-active: #3d2e6b;
  --header-link-ink-active: #ffffff;
  --scroll-track: #1a1722;
  --scroll-thumb: #5a4d7a;
  --scroll-thumb-hover: #8e76d5;
  --msg-user-bg: #3d2e6b;
  --msg-user-ink: #ffffff;
  --msg-error-bg: #3a1c1c;
  --msg-error-ink: #ff9c9c;
  --task-ready-bg: #2a2438;
  --task-ready-ink: #d7c9ff;
  --task-ready-border: #4a3d6e;
  --chip-bg: #3a3448;
  --chip-ink: #f3f0fa;
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    color-scheme: dark;
    --bg: #121018;
    --surface: #1c1a24;
    --card: #23202c;
    --line: #2f2b3a;
    --ink: #eceaf3;
    --ink-2: #b8b4c4;
    --ink-3: #8d889c;
    --purple: #cbbfff;
    --accent: #d7c9ff;
    --accent-2: #b9a4f0;
    --accent-soft: #2a2438;
    --seo-bg: #1a1722;
    --footer-a: #4a2d86;
    --footer-b: #6b2d86;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --input-bg: #16141c;
    --hero-bg: linear-gradient(103deg, #221e2c 0%, #2a2438 42%, #322a48 100%);
    --hero-plate: #221e2c;
    --header-link-bg: #2a2438;
    --header-link-ink: #d7c9ff;
    --header-link-bg-hover: #322a48;
    --header-link-bg-active: #3d2e6b;
    --header-link-ink-active: #ffffff;
    --scroll-track: #1a1722;
    --scroll-thumb: #5a4d7a;
    --scroll-thumb-hover: #8e76d5;
    --msg-user-bg: #3d2e6b;
    --msg-user-ink: #ffffff;
    --msg-error-bg: #3a1c1c;
    --msg-error-ink: #ff9c9c;
    --task-ready-bg: #2a2438;
    --task-ready-ink: #d7c9ff;
    --task-ready-border: #4a3d6e;
    --chip-bg: #3a3448;
    --chip-ink: #f3f0fa;
  }
}

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

html {
  /* Slightly larger UI — feels like browser zoom ~110% on hub and satellites. */
  zoom: 1.1;
}

html.theme-animated {
  /* Single clock for the whole UI: only tokens on <html> animate */
  transition:
    --bg .45s ease,
    --surface .45s ease,
    --card .45s ease,
    --line .45s ease,
    --ink .45s ease,
    --ink-2 .45s ease,
    --ink-3 .45s ease,
    --purple .45s ease,
    --accent .45s ease,
    --accent-2 .45s ease,
    --accent-soft .45s ease,
    --input-bg .45s ease,
    --seo-bg .45s ease,
    --hero-plate .45s ease,
    --header-link-bg .45s ease,
    --header-link-ink .45s ease,
    --header-link-bg-hover .45s ease,
    --header-link-bg-active .45s ease,
    --header-link-ink-active .45s ease,
    --chip-bg .45s ease,
    --chip-ink .45s ease !important;
}
html.theme-animated .hero__cover {
  transition: opacity .45s ease !important;
}
/* Kill local color/bg transitions so they don't lag behind the token clock */
html.theme-animated .chip,
html.theme-animated .search,
html.theme-animated .search__input {
  transition: none !important;
}
html[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] { color-scheme: dark; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 16px 36px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.surface {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 10px 20px 22px;
}

.empty {
  color: var(--ink-3);
  font-size: 14px;
  padding: 24px 0;
}

/* ---------------------------------------------------------------- header */

.site-header {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 28px;
}

.site-header__nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.site-header__link {
  font-size: 12px;
  font-weight: 600;
  color: var(--header-link-ink);
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--header-link-bg);
}

.site-header__link:hover { color: var(--purple); background: var(--header-link-bg-hover); }
.site-header__link.is-active { background: var(--header-link-bg-active); color: var(--header-link-ink-active); }

.site-header__search {
  flex: 1;
  display: flex;
  justify-content: center;
  max-width: 420px;
  margin: 0 auto;
}

.site-header__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.site-header__menu { position: relative; }

.burger {
  display: flex;
  width: 30px;
  height: 30px;
  min-width: 30px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  align-items: center;
  flex: 0 0 30px;
}

.burger span {
  display: block;
  width: 17px;
  height: 1.7px;
  border-radius: 2px;
  background: var(--purple);
}

.theme-toggle {
  position: relative;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--purple);
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  line-height: 0;
  overflow: hidden;
  box-sizing: border-box;
}

.theme-toggle svg {
  grid-area: 1 / 1;
  width: 16px;
  height: 16px;
  display: block;
  position: static;
  transform: none;
  margin: 0;
}

.theme-toggle .theme-toggle__sun { visibility: hidden; }
.theme-toggle .theme-toggle__moon { visibility: visible; }

html[data-theme="dark"] .theme-toggle .theme-toggle__sun,
html[data-resolved="dark"] .theme-toggle .theme-toggle__sun { visibility: visible; }
html[data-theme="dark"] .theme-toggle .theme-toggle__moon,
html[data-resolved="dark"] .theme-toggle .theme-toggle__moon { visibility: hidden; }

html[data-theme="light"] .theme-toggle .theme-toggle__sun,
html[data-resolved="light"] .theme-toggle .theme-toggle__sun { visibility: hidden; }
html[data-theme="light"] .theme-toggle .theme-toggle__moon,
html[data-resolved="light"] .theme-toggle .theme-toggle__moon { visibility: visible; }

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .theme-toggle .theme-toggle__sun { visibility: visible; }
  html[data-theme="auto"] .theme-toggle .theme-toggle__moon { visibility: hidden; }
}

.mobile-search { display: none; }

/* ---------------------------------------------------------------- search */

.search {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 34px;
  border: 1.5px solid #9074d4;
  border-radius: 9px;
  /* Paint on the shell — native <input type=search> ignores/lags CSS bg under color-scheme */
  background: var(--input-bg);
  transition: border-color .15s, box-shadow .15s;
}

.search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 79, 208, .12);
}

.search__icon {
  position: absolute;
  left: 12px;
  width: 15px;
  height: 15px;
  color: var(--ink-3);
  pointer-events: none;
  z-index: 1;
}

.search__input {
  width: 100%;
  height: 100%;
  padding: 0 14px 0 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-size: 12px;
  color: var(--ink);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.search__input::placeholder { color: var(--ink-3); }
.search__input::-webkit-search-cancel-button { -webkit-appearance: none; }

.search__suggest {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: 0 10px 30px rgba(36, 44, 64, .12);
  overflow: hidden;
  max-height: 320px;
  overflow-y: auto;
}

.search__suggest a {
  display: block;
  padding: 9px 14px;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}

.search__suggest a:last-child { border-bottom: 0; }
.search__suggest a:hover { background: var(--card); }
.search__suggest small { display: block; color: var(--ink-3); font-size: 11px; }

/* ------------------------------------------------------------------ hero */

.hero {
  position: relative;
  margin-top: 10px;
  border-radius: var(--r-md);
  background-color: var(--hero-plate);
  padding: 34px 36px 30px;
  overflow: hidden;
  /* Fixed height (no vw) — avoids plate jump if scrollbar/gutter flickers on theme swap */
  height: 420px;
  min-height: 420px;
  display: flex;
  align-items: center;
}

.hero__covers {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.hero__cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  opacity: 0;
  transition: opacity .45s ease;
}

.hero__cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  /* Anchors the prop cluster (bottom-right), not the empty fabric center */
  object-position: right center;
}

.hero__cover--light {
  opacity: 1;
}

/* Subject satellites only: light desk twin needs a nudge to match dark crop */
.page-home--subject .hero__cover--light img {
  transform: translateX(3px);
}

html[data-resolved="dark"] .hero__cover--light { opacity: 0; }
html[data-resolved="dark"] .hero__cover--dark { opacity: 1; }

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  transition: opacity .45s ease;
}

.hero::before {
  background: linear-gradient(
    100deg,
    rgba(249, 246, 255, .88) 0%,
    rgba(249, 246, 255, .72) 34%,
    rgba(249, 246, 255, .18) 58%,
    rgba(249, 246, 255, 0) 72%
  );
  opacity: 1;
}

.hero::after {
  background: linear-gradient(
    100deg,
    rgba(34, 30, 44, .92) 0%,
    rgba(34, 30, 44, .78) 34%,
    rgba(34, 30, 44, .22) 58%,
    rgba(34, 30, 44, 0) 72%
  );
  opacity: 0;
}

html[data-resolved="dark"] .hero::before { opacity: 0; }
html[data-resolved="dark"] .hero::after { opacity: 1; }

.hero__text {
  position: relative;
  z-index: 2;
  max-width: 470px;
}

.hero__title {
  margin: 0 0 12px;
  font-size: 30px;
  line-height: 1.24;
  font-weight: 700;
  letter-spacing: -.2px;
  color: var(--purple);
}

.hero__lead {
  margin: 0 0 20px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-2);
}

.hero__search { max-width: 400px; }

.empty-panel {
  grid-column: 1 / -1;
  padding: 30px 32px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: linear-gradient(103deg, #fbf8ff 0%, #f4efff 100%);
}

.empty-panel__title {
  margin: 0 0 8px;
  font-size: 20px;
  color: var(--purple);
}

.empty-panel__text {
  margin: 0;
  max-width: 620px;
  color: var(--ink-2);
}

/* -------------------------------------------------------- subject cards */

.subjects {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.page-home--subject .subjects {
  grid-template-columns: minmax(0, 1fr);
  max-width: 520px;
}

.subject-card {
  position: relative;
  background: var(--card);
  border-radius: var(--r-md);
  padding: 20px 22px 18px;
  min-height: 118px;
  overflow: hidden;
}

.subject-card__title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 17px;
  font-weight: 600;
  color: var(--purple);
  margin-bottom: 14px;
}

.subject-card__title:hover { color: var(--accent); }
.subject-card__chev { color: var(--ink-3); font-weight: 400; }

.subject-card__grades {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  max-width: calc(100% - 78px);
}

.subject-card__icon {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 62px;
  height: 62px;
  object-fit: contain;
  background: transparent !important;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 25px;
  padding: 0 6px;
  border-radius: 7px;
  background: var(--chip-bg);
  border: 0;
  font-size: 11px;
  color: var(--chip-ink);
  white-space: nowrap;
  transition: color .15s, background .15s;
}

.chip:hover { background: var(--accent-soft); color: var(--accent); }

/* ---------------------------------------------------------------- layout */

.layout {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  margin-top: 10px;
}

.layout__main { flex: 1; min-width: 0; }

.sidebar {
  width: 210px;
  flex: 0 0 210px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 8px;
}

.sidebar__list,
.sidebar__sub { list-style: none; margin: 0; padding: 0; }

.sidebar__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border: 0;
  background: none;
  border-radius: 7px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
}

.sidebar__toggle:hover { background: var(--card); }
.sidebar__chevron { color: var(--ink-3); transition: transform .28s ease; flex: none; }
.sidebar__item.is-open > .sidebar__toggle { color: var(--ink); font-weight: 500; }
.sidebar__item.is-open > .sidebar__toggle .sidebar__chevron { transform: rotate(180deg); }

.sidebar__sub {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .32s ease;
}

.sidebar__item.is-open > .sidebar__sub { grid-template-rows: 1fr; }

.sidebar__sub-inner {
  overflow: hidden;
  min-height: 0;
  list-style: none;
  margin: 0;
  padding: 0 0 6px 12px;
}

.sidebar__sub a {
  display: block;
  padding: 5px 9px;
  font-size: 11.5px;
  color: var(--ink-2);
  border-radius: 6px;
}

.sidebar__sub a:hover { color: var(--accent); background: var(--card); }
.sidebar__sub a.is-active { color: var(--accent); font-weight: 500; }

.sidebar__empty {
  padding: 10px 8px;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1.5;
}

/* ----------------------------------------------------------- breadcrumbs */

.crumbs { margin: 18px 0 4px; }

.crumbs__list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  font-size: 11px;
  color: var(--ink-3);
}

.crumbs__item + .crumbs__item::before {
  content: "・";
  margin-right: 6px;
  color: var(--ink-3);
}

.crumbs__item a:hover { color: var(--accent); }
.crumbs__current { color: var(--ink); font-weight: 500; }

.page-title {
  margin: 10px 0 18px;
  font-size: 21px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--ink);
}

.page-title--task { font-size: 19px; }

.error-page {
  padding: 12px 0 4px;
}

.error-page__card {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  min-height: 320px;
  border-radius: var(--r-lg);
  background-color: #f4efff;
  background-image: url("../img/hero-bg-light.8072620b59d8.png");
  background-image: image-set(
    url("../img/hero-bg-light.2ac1041c1113.webp") type("image/webp"),
    url("../img/hero-bg-light.8072620b59d8.png") type("image/png")
  );
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  padding: 34px 36px;
}

.error-page__card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(
    100deg,
    rgba(249, 246, 255, .9) 0%,
    rgba(249, 246, 255, .7) 40%,
    rgba(249, 246, 255, .15) 65%,
    transparent 80%
  );
}

.error-page__content {
  position: relative;
  z-index: 1;
  max-width: 520px;
}

.error-page__eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
}

.error-page__title {
  margin: 0 0 12px;
  font-size: 34px;
  line-height: 1.15;
  color: var(--purple);
}

.error-page__text {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
}

.error-page__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.error-page__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid rgba(108, 79, 208, .18);
  color: var(--purple);
  font-weight: 600;
}

.error-page__btn--primary {
  background: var(--purple);
  border-color: var(--purple);
  color: #fff;
}

.error-page__art {
  display: none;
}

/* ------------------------------------------------------------ book cards */

.book-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.book-card {
  display: flex;
  gap: 14px;
  background: var(--card);
  border-radius: var(--r-md);
  padding: 14px;
  transition: box-shadow .16s, transform .16s;
}

.book-card:hover {
  box-shadow: 0 6px 20px rgba(36, 44, 64, .08);
  transform: translateY(-1px);
}

.book-card--wide { margin-bottom: 18px; }
.book-card--wide:hover { box-shadow: none; transform: none; }

.book-card__cover {
  flex: 0 0 78px;
  width: 78px;
  height: 104px;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(140deg, #cfa6e6, #8f6fd6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-card__cover img { width: 100%; height: 100%; object-fit: cover; }

.book-card__placeholder {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
}

.book-card__meta {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink-2);
  min-width: 0;
}

.book-card__meta > div { display: flex; gap: 5px; }
.book-card__meta dt { color: var(--ink-3); flex: none; }
.book-card__meta dd { margin: 0; color: var(--ink); font-weight: 500; min-width: 0; }

/* ----------------------------------------------------------------- tasks */

.sitemap-group { margin-bottom: 22px; }
.sitemap-group .tasks__title a:hover { color: var(--accent); }

.tasks { margin-top: 22px; }

.tasks__title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
}

.tasks__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap: 6px;
}

.tasks__button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 6px;
  border-radius: 7px;
  background: var(--card);
  border: 1px solid transparent;
  font-size: 12px;
  color: var(--ink-2);
  transition: border-color .14s, color .14s, background .14s;
}

.tasks__button.has-scan {
  background: var(--task-ready-bg);
  border-color: var(--task-ready-border);
  color: var(--task-ready-ink);
  font-weight: 600;
}

.tasks__button:hover {
  border-color: var(--accent-2);
  color: var(--accent);
  background: var(--input-bg);
}

.tasks__button.has-scan:hover {
  background: var(--task-ready-bg);
  border-color: var(--accent-2);
  color: var(--accent);
}

.dev-ingest {
  margin: 16px 0 4px;
  padding: 12px 14px;
  border: 1px dashed #cfc4ea;
  border-radius: 10px;
  background: #f7f4fc;
}

.dev-ingest__note {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.45;
}

.dev-ingest__note code {
  font-size: 11px;
  background: #fff;
  padding: 1px 5px;
  border-radius: 4px;
}

.dev-ingest__btn {
  border: 0;
  border-radius: 8px;
  background: var(--purple);
  color: #fff;
  padding: 7px 12px;
  cursor: pointer;
}

.dev-ingest__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.dev-ingest__btn--stop { background: #8a4a4a; }

.dev-ingest__btn:disabled { opacity: .55; cursor: default; }

.dev-ingest__bar {
  margin-top: 10px;
  height: 8px;
  border-radius: 99px;
  background: #e7e0f4;
  overflow: hidden;
}

.dev-ingest__bar-fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: var(--purple);
  transition: width .25s ease;
}

.dev-ingest__status {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--ink-2);
}

/* ------------------------------------------------------------- condition */

.condition {
  background: var(--card);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.condition__title {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.condition--in-tab {
  background: none;
  padding: 4px 0 12px;
  margin: 0;
}

.condition__text { margin: 0; font-size: 13px; color: var(--ink); white-space: pre-wrap; }

.condition--about .condition__text {
  line-height: 1.55;
  color: var(--ink-2);
}

/* -------------------------------------------------------------- solution */

.solution {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}

.solution__tabs {
  display: flex;
  gap: 4px;
  padding: 0 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.solution__tab {
  position: relative;
  padding: 12px 10px 10px;
  border: 0;
  background: none;
  font-size: 12px;
  color: var(--ink-3);
  cursor: pointer;
  white-space: nowrap;
}

.solution__tab::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: transparent;
}

.solution__tab.is-active { color: var(--ink); font-weight: 500; }
.solution__tab.is-active::after { background: var(--accent-2); }

.solution__panel { padding: 18px 20px 4px; }
.solution__panel[hidden] { display: none; }

.step {
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.step__badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 600;
  margin-bottom: 10px;
}

.step__body {
  margin: 0;
  max-width: 62ch;
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
}

.step__note {
  margin: 0 0 8px;
  color: var(--ink-3);
  font-size: 13px;
  font-style: italic;
}

.step__text {
  margin: 0 0 8px;
}

.step__text:last-child,
.step__formula:last-child,
.step__note:last-child {
  margin-bottom: 0;
}

.step__formula {
  margin: 8px 0;
  padding: 8px 12px;
  background: var(--accent-soft);
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13.5px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.solution__answer {
  margin: 4px 0 18px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--accent-soft);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
}

.teacher-cta {
  padding: 8px 0 18px;
}

.teacher-cta__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: #7b41c2;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(123, 65, 194, .28);
}

.teacher-cta__btn:hover { background: #6935ad; }
.teacher-cta__btn:disabled { opacity: .5; cursor: default; box-shadow: none; }

.teacher-cta__status.is-error { color: #b03636; }

html[data-theme="dark"] .teacher-cta__btn,
html[data-resolved="dark"] .teacher-cta__btn {
  background: #9b6dff;
}

.step__body .katex-display {
  margin: 0.45em 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.scan { margin: 0 0 18px; }

.scan__open {
  display: block;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.scan img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: #fff;
}

.scan figcaption {
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-3);
}

.pager {
  display: flex;
  gap: 10px;
  padding: 6px 20px 18px;
}

.pager__btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--ink-2);
  transition: background .14s, color .14s, border-color .14s;
}

.pager__btn:hover:not(.is-disabled) { background: var(--accent-soft); color: var(--accent); }
.pager__btn.is-disabled { opacity: .45; cursor: default; }
.pager__btn span { color: var(--ink-3); }

/* ------------------------------------------------------------- assistant */

.assistant {
  margin-top: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px 18px 14px;
}

.assistant__head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--purple);
  margin-bottom: 14px;
}

.assistant__spark { color: var(--accent); flex: none; }

.assistant__log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 12px;
  scroll-behavior: smooth;
}

.msg {
  max-width: 82%;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg--bot {
  align-self: flex-start;
  background: var(--accent-soft);
  color: var(--ink);
}

.msg--bot .katex {
  font-size: 1.05em;
}

.msg--bot .katex-display {
  margin: 0.55em 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.msg--user {
  align-self: flex-end;
  background: var(--msg-user-bg);
  color: var(--msg-user-ink);
}

.msg--streaming .msg__caret {
  display: inline-block;
  width: 2px;
  height: 0.95em;
  margin-left: 1px;
  vertical-align: -0.1em;
  background: var(--accent);
  animation: caret 0.85s step-end infinite;
}

@keyframes caret {
  50% { opacity: 0; }
}

.msg--error { align-self: flex-start; background: var(--msg-error-bg); color: var(--msg-error-ink); }

.msg.msg--status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  align-self: flex-start;
  background: transparent;
  color: var(--ink-3);
  font-style: normal;
  padding: 4px 2px;
}

.spin {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  flex-shrink: 0;
  animation: gdz-spin 0.7s linear infinite;
}

@keyframes gdz-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .spin {
    animation: none;
    border-right-color: currentColor;
    opacity: 0.45;
  }
}

.teacher-cta__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--ink-3);
}

.msg--typing { display: flex; gap: 4px; align-items: center; align-self: flex-start; }

.msg--typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-2);
  animation: dot 1.1s infinite ease-in-out;
}

.msg--typing i:nth-child(2) { animation-delay: .18s; }
.msg--typing i:nth-child(3) { animation-delay: .36s; }

@keyframes dot {
  0%, 60%, 100% { opacity: .28; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

.assistant__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}

.assistant__chip {
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 11px;
  color: var(--ink-2);
  cursor: pointer;
  transition: border-color .14s, color .14s, background .14s;
}

.assistant__chip:hover { border-color: var(--accent-2); color: var(--accent); }

.assistant__form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 6px 4px 16px;
}

.assistant__input {
  flex: 1;
  border: 0;
  background: none;
  outline: none;
  height: 34px;
  font-size: 12px;
  color: var(--ink);
  min-width: 0;
}

.assistant__input::placeholder { color: var(--ink-3); }

.assistant__send {
  flex: none;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #7b41c2;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .14s, transform .14s;
  box-shadow: 0 2px 8px rgba(123, 65, 194, .35);
}

.assistant__send:hover { background: #6935ad; }
.assistant__send:disabled { opacity: .45; cursor: default; box-shadow: none; }

.assistant__note {
  margin: 9px 0 0;
  font-size: 10.5px;
  color: var(--ink-3);
}

/* --------------------------------------------------------------- tiles */

.subject-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}

.subject-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--card);
  font-size: 13px;
  transition: background .14s, color .14s;
}

.subject-tile:hover { background: var(--accent-soft); color: var(--accent); }
.subject-tile__count { font-size: 11px; color: var(--ink-3); }

.authors { list-style: none; margin: 0; padding: 0; }

.authors__item {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}

.authors__name { font-weight: 600; min-width: 200px; }
.authors__books { color: var(--ink-2); }
.authors__books a:hover { color: var(--accent); }

.prose { font-size: 13.5px; line-height: 1.7; color: var(--ink-2); max-width: 760px; }
.prose p { margin: 0 0 14px; }
.prose a { color: var(--accent); }

/* ------------------------------------------------------------------- seo */

.seo {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 16px;
}

.seo__inner {
  background: var(--seo-bg);
  border-radius: var(--r-md);
  padding: 22px 26px;
}

.seo__title {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 700;
  color: var(--purple);
}

.seo__text {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-2);
}

.seo__text:last-child { margin-bottom: 0; }

.seo__faq {
  margin: 4px 0 8px;
  display: grid;
  gap: 12px;
}

.seo__faq-q {
  margin: 0 0 6px;
  font-size: 14.5px;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.45;
}

.seo__math {
  overflow-x: auto;
}

.seo__math .katex {
  font-size: 1.08em;
}

.seo__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 14px;
}

.seo__link {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--purple);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.seo__link:hover {
  filter: brightness(1.08);
}

/* ---------------------------------------------------------- site rail */

.site-rail {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 18px 20px 16px;
}

.site-rail__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.site-rail__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--purple);
}

.site-rail__nav {
  display: flex;
  gap: 6px;
}

.site-rail__btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink-2);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.site-rail__btn:hover {
  color: var(--ink);
  background: var(--accent-soft);
}

.site-rail__btn:disabled {
  opacity: .35;
  cursor: default;
}

.site-rail__track {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.site-rail__track::-webkit-scrollbar { display: none; }

.site-rail__card {
  flex: 0 0 92px;
  width: 92px;
  scroll-snap-align: start;
  text-align: center;
  color: var(--ink);
}

.site-rail__card:hover .site-rail__name { color: var(--accent); }

.site-rail__cover {
  display: block;
  width: 92px;
  height: 122px;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(140deg, #cfa6e6, #8f6fd6);
  box-shadow: 0 4px 12px rgba(36, 44, 64, .1);
}

.site-rail__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.site-rail__cover--hub {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  padding: 10px;
}

.site-rail__name {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
}

/* ---------------------------------------------------------------- footer */

.footer {
  position: relative;
  border-radius: var(--r-lg);
  background: #8b3fc4;
  padding: 32px 36px 34px;
  overflow: hidden;
  min-height: 268px;
  color: #fff;
}

.footer__body { position: relative; z-index: 2; max-width: 42%; }

.footer__title {
  margin: 0 0 20px;
  font-size: 22px;
  line-height: 1.3;
  font-weight: 700;
}

.footer__links { list-style: none; margin: 0; padding: 0; }

.footer__links li { margin-bottom: 11px; }

.footer__links a {
  font-size: 13px;
  color: rgba(255, 255, 255, .94);
  transition: color .14s;
}

.footer__links a:hover { color: #fff; text-decoration: underline; }

.footer__art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 82% center;
  z-index: 1;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, transparent 28%, #000 58%, #000 100%);
  mask-image: linear-gradient(90deg, transparent 0%, transparent 28%, #000 58%, #000 100%);
}

html[data-theme="dark"] .footer,
html[data-resolved="dark"] .footer {
  background: #5c2d86;
}

/* ---------------------------------------------------------- mobile menu */

/* ---------------------------------------------------------- header menu */

.mobile-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 92;
  width: 300px;
  max-height: min(72vh, 560px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 36px rgba(36, 44, 64, .14);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-6px);
  transform-origin: top right;
  transition: opacity .22s ease, transform .22s ease, visibility .22s;
}

.mobile-menu.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: none;
}

.mobile-menu[hidden] { display: block; }

.mobile-menu__inner {
  width: 100%;
  padding: 6px 10px 10px;
}

.mobile-menu__head { display: none; }

.mobile-menu__home {
  font-size: 13px;
  color: var(--ink-2);
  padding: 5px 10px;
  border-radius: 7px;
  background: var(--card);
}

.mobile-menu__close {
  border: 0;
  background: none;
  padding: 4px;
  color: var(--ink-2);
  cursor: pointer;
}

.mobile-menu__list { list-style: none; margin: 0; padding: 0; }

.mobile-menu__toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 4px;
  border: 0;
  background: none;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
  text-align: left;
}

.mobile-menu__chevron { color: var(--ink-3); transition: transform .28s ease; flex: none; }
.mobile-menu__item.is-open > .mobile-menu__toggle { color: var(--ink); }
.mobile-menu__item.is-open > .mobile-menu__toggle .mobile-menu__chevron { transform: rotate(180deg); }

.mobile-menu__sub {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .32s ease;
}

.mobile-menu__item.is-open > .mobile-menu__sub { grid-template-rows: 1fr; }

.mobile-menu__sub-inner {
  overflow: hidden;
  min-height: 0;
  list-style: none;
  margin: 0;
  padding: 0 0 8px 12px;
}

.mobile-menu__sub a {
  display: block;
  padding: 7px 2px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.mobile-menu__backdrop {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 91;
  background: transparent;
}

.mobile-menu__backdrop[hidden] { display: none; }

.mobile-menu__empty {
  margin: 16px 0 0;
  color: var(--ink-3);
  font-size: 13px;
}

body.menu-open { overflow: visible; }

/* ----------------------------------------------------------- responsive */

@media (max-width: 1000px) {
  .sidebar { display: none; }
}

@media (max-width: 860px) {
  .subjects { grid-template-columns: 1fr; }
  .book-grid { grid-template-columns: 1fr; }
  .footer__body { max-width: 100%; }
  .footer {
    min-height: 480px;
    padding: 28px 22px 210px;
    background: #8b3fc4;
  }
  .footer__title { margin-bottom: 22px; font-size: 20px; }
  .footer__links li { margin-bottom: 15px; }
  .footer__art {
    position: absolute;
    inset: auto 0 0 0;
    width: 100%;
    height: 48%;
    max-width: none;
    margin: 0;
    object-fit: cover;
    object-position: center bottom;
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 32%, #000 100%);
    mask-image: linear-gradient(180deg, transparent 0%, #000 32%, #000 100%);
  }
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .footer {
    background: linear-gradient(180deg, #5a2a86 0%, #7a34a0 52%, #8d4aad 100%);
  }
}

@media (max-width: 700px) {
  .page { padding: 10px 10px 24px; gap: 10px; overflow-x: hidden; }
  .surface { padding: 12px 14px 18px; border-radius: 16px; overflow-x: hidden; }

  .site-header { min-height: 28px; }
  .site-header__link--desk { display: none; }
  .site-header__search { display: none; }
  .mobile-search { display: block; margin: 14px 0 8px; }

  .mobile-menu {
    position: fixed;
    inset: 0;
    width: auto;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    flex-direction: column;
  }
  .mobile-menu[hidden] { display: flex; }
  .mobile-menu__inner {
    max-width: 420px;
    margin: 0 auto;
    padding: 16px 20px 40px;
  }
  .mobile-menu__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
  }
  .mobile-menu__backdrop { display: none; }
  body.menu-open { overflow: hidden; }

  .hero {
    margin-top: 8px;
    padding: 18px 16px 20px;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    width: 100%;
    max-width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 1023 / 1537;
    border-radius: var(--r-md);
    text-align: left;
  }
  .hero__text {
    max-width: 100%;
    width: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
  .hero__title {
    font-size: 21px;
    text-align: left;
  }
  .hero__lead {
    font-size: 11.5px;
    margin-bottom: 14px;
    text-align: left;
  }
  .hero__search {
    max-width: 100%;
    width: 100%;
    margin-bottom: 0;
  }
  .hero__cover img {
    display: block;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center bottom;
  }
  .page-home--subject .hero__cover--light img {
    transform: none;
  }
  .hero__covers {
    position: absolute;
    inset: 0;
    height: auto;
    margin: 0;
    overflow: hidden;
  }
  .hero::before {
    background: linear-gradient(
      180deg,
      rgba(249, 246, 255, .88) 0%,
      rgba(249, 246, 255, .42) 38%,
      rgba(249, 246, 255, 0) 62%
    );
  }
  .hero::after {
    background: linear-gradient(
      180deg,
      rgba(34, 30, 44, .88) 0%,
      rgba(34, 30, 44, .4) 38%,
      rgba(34, 30, 44, 0) 62%
    );
  }

  .subjects { padding: 0; gap: 10px; }
  .empty-panel { padding: 22px 18px; }
  .empty-panel__title { font-size: 18px; }
  .subject-card__title { font-size: 14px; margin-bottom: 12px; color: var(--ink); }
  .subject-card__icon { width: 44px; height: 44px; top: 14px; right: 14px; }
  .subject-card__grades { max-width: calc(100% - 56px); gap: 6px; }
  .chip { height: 26px; font-size: 11px; }

  .page-title, .page-title--task { font-size: 17px; margin: 10px 0 14px; }
  .crumbs { margin-top: 16px; }
  .crumbs__list { font-size: 10.5px; }
  .error-page__card { padding: 24px 18px; min-height: 280px; flex-direction: column; align-items: stretch; }
  .error-page__title { font-size: 24px; }

  .page-title--task + .book-card--wide { display: none; }

  .book-card { padding: 12px; }
  .book-card__cover { flex-basis: 66px; width: 66px; height: 88px; }

  .solution__panel { padding: 14px 14px 4px; }
  .solution__tabs { padding: 0 10px; }
  .pager { padding: 4px 14px 14px; flex-direction: row; }
  .pager__btn { font-size: 11px; }

  .assistant { padding: 14px; }
  .assistant__form { padding: 4px 4px 4px 12px; }
  .assistant__input { font-size: 12px; }
  .msg { max-width: 90%; }

  .seo { padding: 0; background: none; }
  .seo__inner { padding: 18px 16px; }
  .seo__title { font-size: 16px; }
  .seo__text { font-size: 13.5px; }

  .footer { padding: 28px 20px 220px; }
  .footer__title { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

html[data-theme="dark"] .assistant__send,
html[data-resolved="dark"] .assistant__send {
  background: #9b6dff;
  box-shadow: 0 2px 10px rgba(155, 109, 255, .4);
}

html[data-theme="dark"] .assistant__send:hover,
html[data-resolved="dark"] .assistant__send:hover {
  background: #b18bff;
}

html[data-theme="dark"] .cookie-banner__btn:not(.cookie-banner__btn--ghost),
html[data-resolved="dark"] .cookie-banner__btn:not(.cookie-banner__btn--ghost) {
  background: #9b6dff;
}

html[data-theme="dark"] .cookie-banner__btn:not(.cookie-banner__btn--ghost):hover,
html[data-resolved="dark"] .cookie-banner__btn:not(.cookie-banner__btn--ghost):hover {
  background: #b18bff;
}

html[data-theme="dark"] .cookie-banner__btn--ghost,
html[data-resolved="dark"] .cookie-banner__btn--ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--line);
  box-shadow: none;
}

html[data-theme="dark"] .cookie-banner__btn--ghost:hover,
html[data-resolved="dark"] .cookie-banner__btn--ghost:hover {
  background: var(--card);
  color: var(--ink);
}

html[data-theme="dark"] .search__suggest,
html[data-theme="dark"] .empty-panel,
html[data-theme="dark"] .book-card,
html[data-theme="dark"] .tasks__button,
html[data-theme="dark"] .solution__panel,
html[data-theme="dark"] .assistant,
html[data-theme="dark"] .assistant__form,
html[data-theme="dark"] .mobile-menu,
html[data-theme="dark"] .sidebar {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

html[data-theme="dark"] .subject-card,
html[data-theme="dark"] .assistant__chip,
html[data-theme="dark"] .pager__btn,
html[data-theme="dark"] .seo__link {
  background: var(--card);
  border-color: var(--line);
  color: var(--ink-2);
}

html[data-theme="dark"] .subject-card__title,
html[data-theme="dark"] .seo__link,
html[data-theme="dark"] .assistant__head {
  color: var(--purple);
}

html[data-theme="dark"] .empty-panel {
  background-color: var(--hero-plate);
}

html[data-theme="dark"] .error-page__card {
  background-color: #221e2c;
  background-image: url("../img/hero-bg-dark.8186d976731b.png");
  background-image: image-set(
    url("../img/hero-bg-dark.defeb4bf829d.webp") type("image/webp"),
    url("../img/hero-bg-dark.8186d976731b.png") type("image/png")
  );
  background-repeat: no-repeat;
  background-position: center center;
  background-size: cover;
  border-color: var(--line);
  color: var(--ink);
}

html[data-theme="dark"] .error-page__card::before {
  background: linear-gradient(
    100deg,
    rgba(34, 30, 44, .92) 0%,
    rgba(34, 30, 44, .75) 40%,
    rgba(34, 30, 44, .18) 65%,
    transparent 80%
  );
}

html[data-theme="dark"] .error-page__eyebrow,
html[data-resolved="dark"] .error-page__eyebrow {
  color: var(--accent-2);
}

html[data-theme="dark"] .error-page__text,
html[data-resolved="dark"] .error-page__text {
  color: var(--ink-2);
}

html[data-theme="dark"] .error-page__btn,
html[data-resolved="dark"] .error-page__btn {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
}

html[data-theme="dark"] .error-page__btn:hover,
html[data-resolved="dark"] .error-page__btn:hover {
  background: var(--header-link-bg-hover);
  border-color: var(--line);
  color: #fff;
}

html[data-theme="dark"] .error-page__btn--primary,
html[data-resolved="dark"] .error-page__btn--primary {
  background: #9b6dff;
  border-color: #9b6dff;
  color: #fff;
}

html[data-theme="dark"] .error-page__btn--primary:hover,
html[data-resolved="dark"] .error-page__btn--primary:hover {
  background: #b18bff;
  border-color: #b18bff;
  color: #fff;
}

html[data-theme="dark"] .error-page__art {
  display: none;
}

html[data-theme="dark"] .search__suggest a:hover,
html[data-theme="dark"] .chip:hover,
html[data-theme="dark"] .assistant__chip:hover,
html[data-theme="dark"] .tasks__button.has-scan,
html[data-resolved="dark"] .tasks__button.has-scan,
html[data-theme="dark"] .msg--bot,
html[data-theme="dark"] .seo__link:hover {
  background: var(--task-ready-bg);
  border-color: var(--task-ready-border);
  color: var(--task-ready-ink);
}

html[data-theme="dark"] .msg--user,
html[data-resolved="dark"] .msg--user {
  background: var(--msg-user-bg);
  color: var(--msg-user-ink);
}

html[data-theme="dark"] .msg--error,
html[data-resolved="dark"] .msg--error {
  background: var(--msg-error-bg);
  color: var(--msg-error-ink);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .search__suggest,
  html[data-theme="auto"] .empty-panel,
  html[data-theme="auto"] .book-card,
  html[data-theme="auto"] .tasks__button,
  html[data-theme="auto"] .solution__panel,
  html[data-theme="auto"] .assistant,
  html[data-theme="auto"] .assistant__form,
  html[data-theme="auto"] .mobile-menu,
  html[data-theme="auto"] .sidebar {
    background: var(--surface);
    border-color: var(--line);
    color: var(--ink);
  }

  html[data-theme="auto"] .tasks__button.has-scan {
    background: var(--task-ready-bg);
    border-color: var(--task-ready-border);
    color: var(--task-ready-ink);
  }

  html[data-theme="auto"] .subject-card,
  html[data-theme="auto"] .assistant__chip,
  html[data-theme="auto"] .pager__btn,
  html[data-theme="auto"] .seo__link {
    background: var(--card);
    border-color: var(--line);
    color: var(--ink-2);
  }

  html[data-theme="auto"] .subject-card__title,
  html[data-theme="auto"] .seo__link,
  html[data-theme="auto"] .assistant__head {
    color: var(--purple);
  }

  html[data-theme="auto"] .hero,
  html[data-theme="auto"] .empty-panel {
    background-color: #221e2c;
  }

  html[data-theme="auto"] .error-page__card {
    background-color: #221e2c;
    background-image: url("../img/hero-bg-dark.8186d976731b.png");
  background-image: image-set(
    url("../img/hero-bg-dark.defeb4bf829d.webp") type("image/webp"),
    url("../img/hero-bg-dark.8186d976731b.png") type("image/png")
  );
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    border-color: var(--line);
    color: var(--ink);
  }

  html[data-theme="auto"] .error-page__card::before {
    background: linear-gradient(
      100deg,
      rgba(34, 30, 44, .92) 0%,
      rgba(34, 30, 44, .75) 40%,
      rgba(34, 30, 44, .18) 65%,
      transparent 80%
    );
  }

  html[data-theme="auto"] .error-page__eyebrow {
    color: var(--accent-2);
  }

  html[data-theme="auto"] .error-page__text {
    color: var(--ink-2);
  }

  html[data-theme="auto"] .error-page__btn {
    background: var(--card);
    border: 1px solid var(--line);
    color: var(--ink);
  }

  html[data-theme="auto"] .error-page__btn:hover {
    background: var(--header-link-bg-hover);
    border-color: var(--line);
    color: #fff;
  }

  html[data-theme="auto"] .error-page__btn--primary {
    background: #9b6dff;
    border-color: #9b6dff;
    color: #fff;
  }

  html[data-theme="auto"] .error-page__btn--primary:hover {
    background: #b18bff;
    border-color: #b18bff;
    color: #fff;
  }

  html[data-theme="auto"] .error-page__art {
    display: none;
  }

  html[data-theme="auto"] .footer__art {
    mix-blend-mode: normal;
    opacity: .95;
  }
}

/* ----------------------------------------------------------- scrollbars */
/* Chromium ignores ::-webkit-scrollbar if scrollbar-width/color are set. */

html {
  scrollbar-gutter: stable;
}

::-webkit-scrollbar,
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track,
*::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb,
*::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 999px;
  border: 2px solid var(--scroll-track);
}

::-webkit-scrollbar-thumb:hover,
*::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
}

@supports not selector(::-webkit-scrollbar) {
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--scroll-thumb) var(--scroll-track);
  }
}

/* ------------------------------------------------------------- lightbox */

.zoom-open { overflow: hidden; }

.zoom {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  background: rgba(12, 10, 18, .88);
}

.zoom[hidden] { display: none !important; }

.zoom__stage {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  touch-action: none;
}

.zoom__stage.is-dragging { cursor: grabbing; }

.zoom__img {
  max-width: 100%;
  max-height: 100%;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
  border-radius: 6px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, .35);
}

.zoom__bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px 18px;
}

.zoom__btn {
  min-width: 44px;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: #2a2438;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.zoom__btn:hover { background: #3d2e6b; }

/* --------------------------------------------------------- cookie banner */

.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  max-width: 720px;
  margin: 0 auto;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px rgba(36, 44, 64, .16);
}

.cookie-banner[hidden] {
  display: none !important;
}

.cookie-banner__text {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-2);
}

.cookie-banner__text a {
  color: var(--purple);
  text-decoration: underline;
}

.cookie-banner__actions {
  display: flex;
  flex: none;
  gap: 8px;
}

.cookie-banner__btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  background: #7b41c2;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(123, 65, 194, .28);
}

.cookie-banner__btn:hover {
  background: #6935ad;
}

.cookie-banner__btn--ghost {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--line);
  box-shadow: none;
  font-weight: 600;
}

.cookie-banner__btn--ghost:hover {
  background: var(--card);
  color: var(--ink);
}

.book-card__cover-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.prose h2 {
  margin: 22px 0 8px;
  font-size: 16px;
  color: var(--ink);
}

.prose ul {
  margin: 0 0 12px;
  padding-left: 18px;
}

@media (max-width: 700px) {
  .cookie-banner {
    flex-direction: column;
    align-items: stretch;
    left: 12px;
    right: 12px;
    bottom: 12px;
    gap: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    max-width: none;
  }
  .cookie-banner__text {
    font-size: 11.5px;
    line-height: 1.35;
  }
  .cookie-banner__actions {
    width: 100%;
    gap: 6px;
  }
  .cookie-banner__btn {
    flex: 1;
    padding: 8px 10px;
    font-size: 12.5px;
    border-radius: 8px;
  }
  .site-rail {
    padding: 14px 14px 12px;
    border-radius: 16px;
  }
  .site-rail__card,
  .site-rail__cover {
    flex-basis: 78px;
    width: 78px;
  }
  .site-rail__cover { height: 104px; }
}
