/* ==========================================================================
   Класно — main stylesheet
   Themes are token sets on <html data-theme="…">; components only use tokens.
   ========================================================================== */

/* ---------- themes ---------- */
:root, [data-theme="nich"] {
  color-scheme: dark;
  --bg: #1f1e22; --bg-2: #252328; --surface: #2c2a2f; --surface-2: #353238; --surface-3: #3e3a41;
  --line: #444148; --line-strong: #5a5560; --ink: #f4eff3; --ink-soft: #ddd6dc; --muted: #b2adb5;
  --accent: #e77f9f; --accent-2: #f39ab4; --accent-soft: #44323a; --on-accent: #231a1f;
  --mint: #7fd8b5; --mint-soft: #2f4238; --gold: #f3c35b; --gold-soft: #47402d; --rose: #f19ab3; --danger: #ff7b8a; --danger-soft: #4a2a30;
  --glow-a: rgba(232, 121, 154, .16); --glow-b: rgba(150, 120, 230, .1); --glow-c: rgba(127, 216, 181, .08);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .25); --shadow: 0 18px 50px rgba(0, 0, 0, .34); --shadow-lg: 0 30px 80px rgba(0, 0, 0, .45);
  --header-bg: rgba(31, 30, 34, .78); --cover-bg: #343137; --hero-blob: radial-gradient(circle at 40% 40%, #3a343e, #2a272e 65%, #3c3037);
}
[data-theme="den"], [data-theme="auto"] {
  color-scheme: light;
  --bg: #f8f8fd; --bg-2: #f1f0f9; --surface: #ffffff; --surface-2: #f6f5fc; --surface-3: #eeecf8;
  --line: #e7e5f1; --line-strong: #d3cfe6; --ink: #272541; --ink-soft: #3d3a5c; --muted: #6f6d88;
  --accent: #7666e8; --accent-2: #584ac4; --accent-soft: #eeebff; --on-accent: #ffffff;
  --mint: #2f9f7f; --mint-soft: #e2f7ef; --gold: #c58a12; --gold-soft: #fff4d6; --rose: #e0628e; --danger: #d63a52; --danger-soft: #ffe8ec;
  --glow-a: rgba(167, 152, 255, .28); --glow-b: rgba(188, 244, 226, .3); --glow-c: rgba(255, 210, 180, .22);
  --shadow-sm: 0 2px 8px rgba(54, 46, 112, .06); --shadow: 0 18px 50px rgba(66, 57, 115, .1); --shadow-lg: 0 30px 80px rgba(46, 38, 110, .18);
  --header-bg: rgba(248, 248, 253, .8); --cover-bg: #ebe8f7; --hero-blob: linear-gradient(145deg, #e6e1ff, #f3edff 53%, #d9f6ed);
}
@media (prefers-color-scheme: dark) {
  [data-theme="auto"] {
    color-scheme: dark;
    --bg: #1f1e22; --bg-2: #252328; --surface: #2c2a2f; --surface-2: #353238; --surface-3: #3e3a41;
    --line: #444148; --line-strong: #5a5560; --ink: #f4eff3; --ink-soft: #ddd6dc; --muted: #b2adb5;
    --accent: #e77f9f; --accent-2: #f39ab4; --accent-soft: #44323a; --on-accent: #231a1f;
    --mint: #7fd8b5; --mint-soft: #2f4238; --gold: #f3c35b; --gold-soft: #47402d; --rose: #f19ab3; --danger: #ff7b8a; --danger-soft: #4a2a30;
    --glow-a: rgba(232, 121, 154, .16); --glow-b: rgba(150, 120, 230, .1); --glow-c: rgba(127, 216, 181, .08);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, .25); --shadow: 0 18px 50px rgba(0, 0, 0, .34); --shadow-lg: 0 30px 80px rgba(0, 0, 0, .45);
    --header-bg: rgba(31, 30, 34, .78); --cover-bg: #343137; --hero-blob: radial-gradient(circle at 40% 40%, #3a343e, #2a272e 65%, #3c3037);
  }
}
[data-theme="okean"] {
  color-scheme: dark;
  --bg: #0b1724; --bg-2: #0f1f30; --surface: #13263a; --surface-2: #183049; --surface-3: #1e3a56;
  --line: #24425f; --line-strong: #31587c; --ink: #e8f3ff; --ink-soft: #cfe2f5; --muted: #9db4cb;
  --accent: #3ccfcf; --accent-2: #7ae6e3; --accent-soft: #143f4c; --on-accent: #062226;
  --mint: #6ee7b7; --mint-soft: #123d35; --gold: #ffd166; --gold-soft: #3a3622; --rose: #ff8fab; --danger: #ff7b8a; --danger-soft: #45222c;
  --glow-a: rgba(60, 207, 207, .14); --glow-b: rgba(70, 120, 255, .14); --glow-c: rgba(110, 231, 183, .07);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .3); --shadow: 0 18px 50px rgba(0, 8, 20, .45); --shadow-lg: 0 30px 80px rgba(0, 8, 20, .55);
  --header-bg: rgba(11, 23, 36, .78); --cover-bg: #183049; --hero-blob: radial-gradient(circle at 40% 40%, #1d4060, #112538 65%, #12384a);
}
[data-theme="lis"] {
  color-scheme: dark;
  --bg: #121d17; --bg-2: #16241c; --surface: #1b2b22; --surface-2: #213429; --surface-3: #283e31;
  --line: #2e4637; --line-strong: #3d5c48; --ink: #ecf6ee; --ink-soft: #d3e6d7; --muted: #a5bfac;
  --accent: #8bd977; --accent-2: #b2ec9f; --accent-soft: #24412b; --on-accent: #0d1d0f;
  --mint: #74d6b0; --mint-soft: #1f3d33; --gold: #f2cf63; --gold-soft: #3c3a23; --rose: #f3a3a3; --danger: #ff8f8f; --danger-soft: #462727;
  --glow-a: rgba(139, 217, 119, .12); --glow-b: rgba(116, 214, 176, .09); --glow-c: rgba(242, 207, 99, .06);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .3); --shadow: 0 18px 50px rgba(0, 10, 4, .42); --shadow-lg: 0 30px 80px rgba(0, 10, 4, .5);
  --header-bg: rgba(18, 29, 23, .8); --cover-bg: #213429; --hero-blob: radial-gradient(circle at 40% 40%, #2a4a35, #18281f 65%, #24402c);
}
[data-theme="kosmos"] {
  color-scheme: dark;
  --bg: #0d0a1c; --bg-2: #120e26; --surface: #19142f; --surface-2: #211a3d; --surface-3: #2a2149;
  --line: #31285a; --line-strong: #463a7c; --ink: #f0ecff; --ink-soft: #dcd5ff; --muted: #aaa2d0;
  --accent: #a689ff; --accent-2: #c6b3ff; --accent-soft: #2e2457; --on-accent: #150f2c;
  --mint: #6ef0d0; --mint-soft: #193c43; --gold: #ffd479; --gold-soft: #3b3326; --rose: #ff9ad5; --danger: #ff7b9c; --danger-soft: #45213a;
  --glow-a: rgba(166, 137, 255, .2); --glow-b: rgba(255, 120, 200, .1); --glow-c: rgba(110, 240, 208, .08);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, .4); --shadow: 0 18px 50px rgba(5, 0, 20, .55); --shadow-lg: 0 30px 80px rgba(5, 0, 20, .65);
  --header-bg: rgba(13, 10, 28, .74); --cover-bg: #211a3d; --hero-blob: radial-gradient(circle at 40% 40%, #3b2d74, #1a1434 65%, #3a2050);
}
[data-theme="zakhid"] {
  color-scheme: light;
  --bg: #fff6ef; --bg-2: #fff0e5; --surface: #ffffff; --surface-2: #fff6f0; --surface-3: #ffeadc;
  --line: #f6dfcf; --line-strong: #ecc6ab; --ink: #3b2316; --ink-soft: #57382a; --muted: #8b6a59;
  --accent: #ee6c3e; --accent-2: #c94f22; --accent-soft: #ffe4d6; --on-accent: #ffffff;
  --mint: #2a9a75; --mint-soft: #dcf5ea; --gold: #c98400; --gold-soft: #fff1cc; --rose: #e0567d; --danger: #cf3048; --danger-soft: #ffe5e8;
  --glow-a: rgba(255, 170, 120, .32); --glow-b: rgba(255, 210, 120, .26); --glow-c: rgba(255, 140, 170, .16);
  --shadow-sm: 0 2px 8px rgba(120, 60, 20, .07); --shadow: 0 18px 50px rgba(140, 70, 30, .12); --shadow-lg: 0 30px 80px rgba(140, 70, 30, .2);
  --header-bg: rgba(255, 246, 239, .82); --cover-bg: #ffe9dc; --hero-blob: linear-gradient(145deg, #ffd9c2, #fff0e0 53%, #ffe1ea);
}
[data-theme="sakura"] {
  color-scheme: light;
  --bg: #fff5f8; --bg-2: #ffeef3; --surface: #ffffff; --surface-2: #fff5f8; --surface-3: #ffe8ef;
  --line: #f8dde6; --line-strong: #eebfd0; --ink: #3a2030; --ink-soft: #56344a; --muted: #8e6a7d;
  --accent: #df4f86; --accent-2: #b8346a; --accent-soft: #ffe1ec; --on-accent: #ffffff;
  --mint: #2f9a86; --mint-soft: #ddf5ef; --gold: #c48a12; --gold-soft: #fff1d3; --rose: #df4f86; --danger: #cc2f4c; --danger-soft: #ffe5ea;
  --glow-a: rgba(255, 160, 195, .32); --glow-b: rgba(200, 170, 255, .22); --glow-c: rgba(160, 230, 210, .2);
  --shadow-sm: 0 2px 8px rgba(120, 30, 70, .06); --shadow: 0 18px 50px rgba(150, 40, 90, .1); --shadow-lg: 0 30px 80px rgba(150, 40, 90, .18);
  --header-bg: rgba(255, 245, 248, .82); --cover-bg: #ffe6ee; --hero-blob: linear-gradient(145deg, #ffd5e4, #fff0f5 53%, #e8e0ff);
}
[data-theme="papir"] {
  color-scheme: light;
  --bg: #f4ecd8; --bg-2: #efe4cb; --surface: #fbf6e9; --surface-2: #f6efdc; --surface-3: #efe3c6;
  --line: #e2d4b2; --line-strong: #cfbb8e; --ink: #3a3024; --ink-soft: #4f4434; --muted: #776851;
  --accent: #a8641f; --accent-2: #834a12; --accent-soft: #efdcb8; --on-accent: #fffaf0;
  --mint: #4b8a5e; --mint-soft: #e2ecd3; --gold: #a87a10; --gold-soft: #f3e3b5; --rose: #b5506a; --danger: #b03a3a; --danger-soft: #f6dcd2;
  --glow-a: rgba(220, 180, 110, .25); --glow-b: rgba(180, 150, 100, .16); --glow-c: rgba(150, 180, 120, .14);
  --shadow-sm: 0 2px 8px rgba(80, 60, 20, .07); --shadow: 0 18px 50px rgba(90, 65, 25, .12); --shadow-lg: 0 30px 80px rgba(90, 65, 25, .2);
  --header-bg: rgba(244, 236, 216, .86); --cover-bg: #ecdfc0; --hero-blob: linear-gradient(145deg, #ecd9b0, #f8f0dc 53%, #dfe8cc);
}
[data-theme="kontrast"] {
  color-scheme: dark;
  --bg: #000000; --bg-2: #050505; --surface: #0b0b0b; --surface-2: #141414; --surface-3: #1e1e1e;
  --line: #8a8a8a; --line-strong: #ffffff; --ink: #ffffff; --ink-soft: #ffffff; --muted: #e6e6e6;
  --accent: #ffd400; --accent-2: #ffe866; --accent-soft: #2b2500; --on-accent: #000000;
  --mint: #4dffb8; --mint-soft: #00321f; --gold: #ffd400; --gold-soft: #2b2500; --rose: #ff9ec4; --danger: #ff6b6b; --danger-soft: #3a0000;
  --glow-a: transparent; --glow-b: transparent; --glow-c: transparent;
  --shadow-sm: none; --shadow: none; --shadow-lg: 0 0 0 2px #ffffff;
  --header-bg: #000000; --cover-bg: #141414; --hero-blob: #0b0b0b;
}
[data-theme="kontrast"] a:not(.button):not(.book-card-link):not(.brand):not(.subject-option):not(.grade-chip):not(.task-tile):not(.subject-tile):not(.grade-tile):not(.chip):not(.tag) { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- base ---------- */
:root { --radius: 18px; --radius-sm: 12px; --wrap: 1200px; --header-h: 72px; --ease-out: cubic-bezier(.2, .7, .2, 1); --spring: cubic-bezier(.34, 1.56, .64, 1); }
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-width: 320px; min-height: 100vh; overflow-x: hidden;
  font: 400 15px/1.6 'Onest', 'Segoe UI', system-ui, sans-serif; color: var(--ink); background: var(--bg);
  transition: background-color .35s ease, color .35s ease;
}
h1, h2, h3, h4 { font-family: 'Manrope', 'Onest', sans-serif; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.02em; }
p { margin: 0 0 1em; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.wrap { width: min(var(--wrap), calc(100% - 48px)); margin-inline: auto; position: relative; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-weight: 700; transition: top .2s; }
.skip-link:focus { top: 12px; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
main { display: block; outline: none; }
kbd { display: inline-block; font: 600 11px/1 'Onest', sans-serif; color: var(--muted); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 4px 6px; background: var(--surface-2); white-space: nowrap; }
code { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: .92em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px; }

/* ---------- animated background ---------- */
.bg-decor { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(40px); opacity: .9; animation: drift 26s ease-in-out infinite alternate; }
.blob--1 { width: 520px; height: 520px; right: -160px; top: -80px; background: radial-gradient(circle, var(--glow-a), transparent 70%); }
.blob--2 { width: 600px; height: 600px; left: -260px; top: 40%; background: radial-gradient(circle, var(--glow-b), transparent 70%); animation-duration: 32s; animation-delay: -8s; }
.blob--3 { width: 420px; height: 420px; right: 10%; bottom: -200px; background: radial-gradient(circle, var(--glow-c), transparent 70%); animation-duration: 38s; animation-delay: -14s; }
.stars { position: absolute; inset: 0; display: none; opacity: .8;
  background-image: radial-gradient(1.5px 1.5px at 20px 30px, #fff, transparent), radial-gradient(1px 1px at 120px 80px, #fff, transparent),
    radial-gradient(1.5px 1.5px at 200px 160px, #d9ccff, transparent), radial-gradient(1px 1px at 280px 40px, #fff, transparent),
    radial-gradient(1px 1px at 330px 210px, #ffd6f0, transparent), radial-gradient(2px 2px at 60px 240px, #fff, transparent);
  background-size: 360px 280px; animation: twinkle 6s ease-in-out infinite alternate; }
[data-theme="kosmos"] .stars { display: block; }
@keyframes drift { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-40px, 30px) scale(1.08); } 100% { transform: translate(30px, -20px) scale(.96); } }
@keyframes twinkle { from { opacity: .35; } to { opacity: .9; } }

.top-progress { position: fixed; z-index: 60; left: 0; top: 0; height: 3px; width: 0; background: linear-gradient(90deg, var(--accent), var(--mint), var(--gold)); box-shadow: 0 0 12px var(--accent); transition: width .25s ease, opacity .4s ease; opacity: 0; }
.top-progress.is-loading { opacity: 1; }

.site-banner { position: relative; z-index: 31; text-align: center; padding: 9px 16px; font-size: 14px; font-weight: 600; color: var(--on-accent); background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.site-banner span { display: inline-block; animation: spin-slow 6s linear infinite; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 30; height: var(--header-h); background: var(--header-bg); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid transparent; transition: border-color .3s, box-shadow .3s, height .3s; }
.site-header.is-scrolled { border-bottom-color: var(--line); box-shadow: var(--shadow-sm); }
.header-inner { width: min(1260px, calc(100% - 40px)); height: 100%; margin: 0 auto; display: flex; align-items: center; gap: 20px; }
.brand { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; position: relative; color: var(--on-accent); background: var(--accent); border-radius: 12px 12px 12px 4px; font: 800 22px/1 'Manrope', sans-serif; transform: rotate(-6deg); box-shadow: 0 7px 16px color-mix(in srgb, var(--accent) 35%, transparent); transition: transform .4s var(--spring); }
.brand:hover .brand-mark { transform: rotate(6deg) scale(1.06); }
.brand-mark > span { transform: rotate(6deg); }
.brand-mark i { position: absolute; font-size: 12px; font-style: normal; color: var(--gold); top: -6px; right: -7px; animation: sparkle 3s ease-in-out infinite; }
.brand-word { font: 800 23px/1 'Manrope', sans-serif; letter-spacing: -1.2px; color: var(--ink); }
.brand-word > span { color: var(--accent); }
.main-nav { display: flex; align-items: center; gap: 6px; margin-left: 18px; }
.main-nav > a, .nav-grades-toggle { position: relative; white-space: nowrap; padding: 9px 13px; border-radius: 10px; font-size: 14.5px; font-weight: 600; color: var(--ink-soft); background: none; border: 0; transition: color .2s, background .2s; }
.main-nav > a:hover, .nav-grades-toggle:hover, .main-nav > a.is-current { color: var(--accent-2); background: var(--accent-soft); }
.nav-grades { position: relative; }
.grades-menu { position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%); display: grid; grid-template-columns: repeat(4, 64px); gap: 6px; padding: 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: pop-in .22s var(--ease-out) both; }
.grades-menu a { display: grid; place-items: center; height: 58px; border-radius: 12px; font: 800 20px/1 'Manrope', sans-serif; color: var(--ink); background: var(--surface-2); transition: transform .2s var(--spring), background .2s, color .2s; }
.grades-menu a small { font: 600 10px/1 'Onest', sans-serif; color: var(--muted); }
.grades-menu a:hover { transform: translateY(-3px); background: var(--accent); color: var(--on-accent); }
.grades-menu a:hover small { color: inherit; }
.header-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 42px; height: 42px; padding: 0 11px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 19px; transition: transform .25s var(--spring), box-shadow .2s, background .2s, border-color .2s; }
.icon-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); border-color: var(--line-strong); }
.icon-btn--ghost { border-color: transparent; background: transparent; }
.saved-count { font-size: 12px; font-weight: 800; color: var(--muted); }
.saved-count.bump { animation: bump .5s var(--spring); }
.search-open span { transform: rotate(-20deg); display: inline-block; font-size: 22px; }
.theme-open span { display: inline-block; transition: transform .5s var(--spring); }
.theme-open:hover span { transform: rotate(180deg); }
.menu-toggle { display: none; flex-direction: column; gap: 4px; }
.menu-toggle span { display: block; height: 2px; width: 18px; background: var(--ink); border-radius: 2px; transition: transform .25s, opacity .25s; }
.menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(3px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3px) rotate(-45deg); }

.theme-panel { position: absolute; right: max(20px, calc((100vw - 1260px) / 2)); top: calc(100% + 8px); width: min(380px, calc(100vw - 32px)); padding: 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); animation: pop-in .25s var(--ease-out) both; transform-origin: top right; }
.theme-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font: 800 17px 'Manrope', sans-serif; }
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.theme-option { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface-2); text-align: left; transition: border-color .2s, transform .2s var(--spring), background .2s; }
.theme-option:hover { transform: translateY(-2px); border-color: var(--line-strong); }
.theme-option.is-active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.theme-option b { display: block; font-size: 13.5px; line-height: 1.2; }
.theme-option small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.theme-swatch { flex: none; width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--a) 50%, var(--b) 50%); border: 2px solid var(--line-strong); }
.switch-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 14px; font-weight: 600; cursor: pointer; user-select: none; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 42px; height: 24px; flex: none; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line-strong); transition: background .25s; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--ink); transition: transform .3s var(--spring); }
.switch-row input:checked + .switch { background: var(--accent); border-color: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(18px); background: var(--on-accent); }
.switch-row input:focus-visible + .switch { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- buttons, tags, chips ---------- */
.button { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 13px; border: 1px solid transparent; font-size: 14.5px; font-weight: 700; line-height: 1.2; white-space: nowrap; transition: transform .25s var(--spring), box-shadow .2s, background .2s, color .2s, border-color .2s; }
.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(0) scale(.98); }
.button--primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 30%, transparent); }
.button--primary:hover { background: var(--accent-2); box-shadow: 0 12px 26px color-mix(in srgb, var(--accent) 40%, transparent); }
.button--light { background: var(--surface); color: var(--accent-2); border-color: var(--line); }
.button--light:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.button--outline { border-color: rgba(255, 255, 255, .6); color: #fff; background: rgba(255, 255, 255, .1); }
.button--outline:hover { background: #fff; color: #3b2a63; }
.button--danger { background: var(--danger); color: #fff; }
.button--small { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.button--wide { width: 100%; }
.button[aria-pressed="true"] { color: var(--rose); border-color: color-mix(in srgb, var(--rose) 50%, var(--line)); }
.ripple { position: absolute; border-radius: 50%; transform: scale(0); background: currentColor; opacity: .25; pointer-events: none; animation: ripple .6s ease-out forwards; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent-2); font-weight: 700; font-size: 14px; text-decoration: underline; text-decoration-color: transparent; text-underline-offset: 3px; transition: text-decoration-color .2s; }
.link-btn:hover { text-decoration-color: currentColor; }
.text-link { color: var(--accent-2); font-weight: 700; font-size: 14.5px; transition: letter-spacing .2s; }
.text-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 8px; font-size: 12px; font-weight: 700; color: var(--ink-soft); background: var(--surface-2); border: 1px solid var(--line); white-space: nowrap; }
a.tag:hover { border-color: var(--accent); color: var(--accent-2); }
.tag--grade { color: var(--accent-2); background: var(--accent-soft); border-color: transparent; }
.tag--nush { color: var(--mint); background: var(--mint-soft); border-color: transparent; }
.tag--year { color: var(--muted); }
.pill { display: inline-flex; align-items: center; padding: 5px 11px; border-radius: 99px; font-size: 13px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft); }
.pill--accent { background: var(--accent-soft); color: var(--accent-2); border-color: transparent; }
.pill--soft { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.pill--hot { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.pill--link:hover { border-color: var(--accent); color: var(--accent-2); }
.chip { display: inline-flex; padding: 7px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 700; color: var(--ink-soft); background: var(--surface); border: 1px solid var(--line); white-space: nowrap; transition: transform .2s var(--spring), border-color .2s, color .2s; }
.chip:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent-2); }

/* ---------- headings ---------- */
.section-kicker, .eyebrow { text-transform: uppercase; letter-spacing: 1.5px; color: var(--accent-2); font-size: 12px; font-weight: 800; margin-bottom: 10px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.section-heading h1, .section-heading h2 { font-size: clamp(30px, 4.2vw, 44px); letter-spacing: -1.6px; margin: 0 0 8px; }
.heading-dot { color: var(--accent); }
.section-subtitle { margin: 0; color: var(--muted); font-size: 15.5px; max-width: 640px; }
.page-top { padding-top: 22px; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 18px; font-size: 13.5px; color: var(--muted); }
.breadcrumbs a { color: var(--accent-2); font-weight: 600; }
.breadcrumbs a:hover { text-decoration: underline; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1.08fr .92fr; gap: 28px; align-items: center; min-height: 560px; padding: 30px 0 30px; }
.hero-copy { position: relative; z-index: 2; animation: rise-in .8s var(--ease-out) both; }
.eyebrow { display: inline-flex; align-items: center; gap: 9px; background: var(--accent-soft); border-radius: 99px; padding: 8px 14px; margin: 0; }
.eyebrow-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px color-mix(in srgb, var(--mint) 25%, transparent); animation: pulse 2s ease-in-out infinite; }
.hero h1 { margin: 22px 0 16px; font: 800 clamp(40px, 5.6vw, 70px)/1 'Manrope', sans-serif; letter-spacing: -.055em; }
.hero-accent { position: relative; display: inline-block; color: var(--accent); white-space: nowrap; }
.hero-accent::after { content: ''; position: absolute; z-index: -1; left: -2%; right: -3%; bottom: .04em; height: .3em; border-radius: 40% 60% 50% 50%; background: color-mix(in srgb, var(--accent) 28%, transparent); transform-origin: left; animation: underline-grow 1s .5s var(--ease-out) both; }
.hero-lede { font-size: 17px; line-height: 1.65; color: var(--muted); max-width: 520px; margin-bottom: 24px; }
.hero-search { width: min(540px, 100%); min-height: 60px; display: flex; align-items: center; padding: 6px 7px 6px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); transition: box-shadow .25s, transform .25s, border-color .25s; }
.hero-search:focus-within { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 14px 36px color-mix(in srgb, var(--accent) 22%, transparent); }
.hero-search .search-icon, .catalog-search .search-icon, .search-dialog-form .search-icon { font-size: 26px; line-height: 1; color: var(--muted); transform: rotate(-20deg); margin-right: 8px; }
.hero-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; }
.hero-search input::placeholder { color: var(--muted); opacity: .8; }
.hero-search button { border: 0; border-radius: 13px; padding: 13px 18px; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 15px; transition: background .2s, transform .25s var(--spring); }
.hero-search button:hover { background: var(--accent-2); transform: translateY(-1px); }
.hero-search--page { margin: 0 0 30px; }
.hero-hint { margin: 12px 0 0 4px; font-size: 13.5px; color: var(--muted); }
.hero-hint > span { color: var(--gold); }
.hero-stats { display: flex; flex-wrap: wrap; gap: 10px 28px; margin: 28px 0 0; padding: 0; }
.hero-stats div { display: flex; flex-direction: column-reverse; }
.hero-stats dd { margin: 0; font: 800 28px/1 'Manrope', sans-serif; letter-spacing: -1px; color: var(--ink); font-variant-numeric: tabular-nums; }
.hero-stats dt { font-size: 13px; color: var(--muted); margin-top: 4px; }
.hero-art { position: relative; height: 480px; display: grid; place-items: center; animation: art-enter 1s .15s var(--ease-out) both; }
.hero-art::before { content: ''; position: absolute; width: 360px; height: 360px; border-radius: 44% 56% 49% 51% / 52% 43% 57% 48%; background: var(--hero-blob); animation: blob-morph 9s ease-in-out infinite alternate; }
.art-orbit { position: absolute; border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); border-radius: 50%; }
.art-orbit--one { width: 420px; height: 420px; animation: orbit 40s linear infinite; }
.art-orbit--two { width: 330px; height: 330px; border-style: dashed; animation: orbit 30s linear infinite reverse; }
.art-orbit--one::after { content: ''; position: absolute; top: 50%; left: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 14px var(--gold); }
.hero-books { position: relative; width: 320px; height: 360px; transition: transform .3s ease-out; }
.hero-book { position: absolute; width: 190px; aspect-ratio: 5 / 7; border-radius: 8px 16px 16px 8px; overflow: hidden; box-shadow: 10px 18px 34px rgba(0, 0, 0, .3); border: 3px solid rgba(255, 255, 255, .7); background: var(--cover-bg); }
.hero-book img, .hero-book .cover-fallback { width: 100%; height: 100%; object-fit: cover; }
.hero-book--1 { left: 10px; top: 40px; transform: rotate(-12deg); animation: float-a 6s ease-in-out infinite; }
.hero-book--2 { right: 0; top: 20px; transform: rotate(10deg); animation: float-b 7s ease-in-out infinite; }
.hero-book--3 { left: 64px; top: 70px; z-index: 2; transform: rotate(-2deg); animation: float-c 5s ease-in-out infinite; }
.floating-note { position: absolute; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 11px 15px 11px 11px; border-radius: 16px; background: color-mix(in srgb, var(--surface) 94%, transparent); border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--muted); font-size: 12.5px; line-height: 1.35; animation: note-float 4.5s ease-in-out infinite; }
.floating-note b { font-size: 13.5px; color: var(--ink); }
.note--top { top: 54px; right: 0; rotate: 4deg; }
.note--bottom { bottom: 58px; left: 0; rotate: -5deg; animation-delay: 1.4s; }
.note-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; font-size: 18px; }
.note-icon--yellow { color: var(--gold); background: var(--gold-soft); }
.note-icon--pink { color: var(--rose); background: var(--accent-soft); }
.art-spark { position: absolute; color: var(--gold); font-size: 28px; animation: sparkle 3s ease-in-out infinite; }
.art-spark--one { right: 30px; top: 170px; }
.art-spark--two { left: 40px; top: 110px; color: var(--mint); font-size: 34px; animation-delay: .9s; }
.art-pencil { position: absolute; right: 54px; bottom: 70px; z-index: 3; color: #ff987f; font-size: 46px; animation: pencil-bob 4s ease-in-out infinite; }
.art-flower { position: absolute; left: 50px; bottom: 120px; color: var(--rose); font-size: 30px; animation: spin-slow 19s linear infinite; }

/* grades strip */
.grades-strip { display: grid; grid-template-columns: repeat(11, minmax(0, 1fr)); gap: 10px; margin-bottom: 26px; }
.grade-tile { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; padding: 14px 6px 12px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); text-align: center; transition: transform .3s var(--spring), border-color .2s, box-shadow .2s; }
.grade-tile::before { content: ''; position: absolute; inset: 0; background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%); opacity: 0; transition: opacity .3s; }
.grade-tile:hover { transform: translateY(-5px) rotate(-1.5deg); border-color: var(--accent); box-shadow: var(--shadow); }
.grade-tile:hover::before { opacity: 1; }
.grade-tile b { position: relative; font: 800 30px/1 'Manrope', sans-serif; color: var(--ink); }
.grade-tile span { position: relative; font-size: 12px; font-weight: 700; color: var(--accent-2); }
.grade-tile small { position: relative; font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ---------- catalog ---------- */
.catalog-section { padding: 34px 0 70px; }
.catalog-filters { display: grid; gap: 14px; margin-bottom: 22px; }
.grade-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.filter-label { font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.grade-list { display: flex; gap: 7px; flex-wrap: wrap; }
.grade-chip { display: inline-grid; place-items: center; min-width: 42px; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 800; font-size: 14.5px; color: var(--ink-soft); transition: transform .25s var(--spring), background .2s, color .2s, border-color .2s, box-shadow .2s; }
.grade-chip:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent-2); }
.grade-chip.is-active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 6px 14px color-mix(in srgb, var(--accent) 35%, transparent); }
.catalog-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.catalog-search { display: flex; align-items: center; gap: 4px; flex: 1 1 280px; max-width: 460px; min-height: 46px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); transition: border-color .2s, box-shadow .2s; }
.catalog-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.catalog-search .search-icon { font-size: 22px; }
.catalog-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 15px; }
.segmented { display: inline-flex; padding: 4px; gap: 2px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--line); }
.segment { position: relative; cursor: pointer; }
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment span { display: block; padding: 8px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 700; color: var(--muted); transition: background .2s, color .2s, box-shadow .2s; }
.segment.is-active span, .segment input:checked + span { background: var(--surface); color: var(--accent-2); box-shadow: var(--shadow-sm); }
.segment input:focus-visible + span { outline: 3px solid var(--accent); }
.select-wrap select { min-height: 46px; padding: 0 36px 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23999' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 14px center; appearance: none; font-size: 14px; font-weight: 600; cursor: pointer; }
.check-chip { position: relative; cursor: pointer; }
.check-chip input { position: absolute; opacity: 0; pointer-events: none; }
.check-chip span { display: inline-flex; align-items: center; gap: 7px; min-height: 46px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 700; color: var(--ink-soft); transition: all .2s; }
.check-chip span::before { content: '✓'; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--line-strong); font-size: 12px; color: transparent; transition: all .2s; }
.check-chip input:checked + span { border-color: var(--mint); color: var(--mint); background: var(--mint-soft); }
.check-chip input:checked + span::before { background: var(--mint); border-color: var(--mint); color: var(--surface); }
.check-chip input:focus-visible + span { outline: 3px solid var(--accent); }
.catalog-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 24px; align-items: start; }
.catalog-main { min-width: 0; }
.result-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; color: var(--muted); font-size: 14.5px; }
.result-line b { color: var(--ink); font-size: 17px; font-variant-numeric: tabular-nums; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 16px; transition: opacity .25s; }
.book-grid.is-loading { opacity: .45; pointer-events: none; }
.book-grid--compact { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }

.book-card { position: relative; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); transition: transform .35s var(--ease-out), box-shadow .3s, border-color .3s; transform-style: preserve-3d; }
.book-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); border-color: color-mix(in srgb, hsl(var(--hue) 70% 60%) 55%, var(--line)); }
.book-card-link { display: flex; flex-direction: column; height: 100%; border-radius: inherit; }
.book-card-link:focus-visible { outline-offset: -3px; }
.book-card-cover { position: relative; aspect-ratio: 5 / 6.4; margin: 10px 10px 0; border-radius: 12px; overflow: hidden; background: var(--cover-bg); }
.book-card-cover .cover-img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease-out), opacity .5s; }
.book-card:hover .cover-img { transform: scale(1.06); }
.cover-img.is-loading { opacity: 0; }
.cover-shine { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .35) 45%, transparent 60%); transform: translateX(-120%); }
.book-card:hover .cover-shine, .book-hero-cover:hover .cover-shine { animation: shine .9s ease; }
.cover-fallback { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; padding: 14px; color: #fff; text-align: left;
  background: radial-gradient(circle at 80% 15%, hsl(var(--hue) 85% 72% / .9), transparent 45%), linear-gradient(150deg, hsl(var(--hue) 62% 58%), hsl(calc(var(--hue) + 30) 55% 38%)); position: relative; overflow: hidden; }
.cover-fallback::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 9px; background: rgba(0, 0, 0, .18); border-right: 1px solid rgba(255, 255, 255, .25); }
.cover-fallback-icon { position: absolute; top: 12px; left: 20px; font-size: 34px; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .2)); }
.cover-fallback b { font: 800 16px/1.15 'Manrope', sans-serif; text-shadow: 0 1px 6px rgba(0, 0, 0, .25); }
.cover-fallback i { font-style: normal; font-size: 12px; font-weight: 700; opacity: .9; }
.book-card-body { display: flex; flex-direction: column; flex: 1; gap: 6px; padding: 12px 14px 14px; }
.book-card h3 { margin: 2px 0 0; font-size: 16px; line-height: 1.25; letter-spacing: -.3px; }
.book-card-authors { margin: 0; font-size: 13px; line-height: 1.4; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-card-note { margin: 0; font-size: 12px; color: var(--gold); font-weight: 600; }
.book-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); }
.availability { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.availability i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
.availability.is-ready { color: var(--mint); }
.availability.is-ready i { background: var(--mint); box-shadow: 0 0 0 3px var(--mint-soft); animation: pulse 2.4s ease-in-out infinite; }
.card-open { font-size: 12px; font-weight: 800; color: var(--accent-2); white-space: nowrap; }
.card-open span { display: inline-block; transition: transform .25s var(--spring); }
.book-card:hover .card-open span { transform: translateX(4px); }
.bookmark-btn { position: absolute; z-index: 2; top: 18px; right: 18px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; border: 0; color: #fff; background: rgba(20, 16, 30, .45); backdrop-filter: blur(6px); font-size: 18px; transition: transform .3s var(--spring), background .2s, color .2s; }
.bookmark-btn:hover { transform: scale(1.12); }
.bookmark-btn[aria-pressed="true"] { color: #fff; background: var(--rose); }
.bookmark-btn.pop { animation: heart-pop .5s var(--spring); }

.skeleton-card { min-height: 330px; border-radius: var(--radius); background: linear-gradient(100deg, var(--surface) 40%, var(--surface-2) 50%, var(--surface) 60%) var(--surface); background-size: 200% 100%; border: 1px solid var(--line); animation: shimmer 1.4s linear infinite; }
.empty-state { text-align: center; padding: 50px 18px; border-radius: var(--radius); border: 1.5px dashed var(--line-strong); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.empty-illustration { display: inline-grid; place-items: center; width: 64px; height: 64px; margin-bottom: 12px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); font-size: 34px; animation: wobble 3s ease-in-out infinite; }
.empty-state h3 { font-size: 20px; margin-bottom: 6px; }
.empty-state p { color: var(--muted); margin-bottom: 16px; }
.load-more-row { text-align: center; margin-top: 26px; }
html:not(.js) .load-more-row { display: none; }
html.js .js-hidden-pagination { display: none; }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 26px; }
.page-num { display: inline-grid; place-items: center; min-width: 40px; height: 40px; padding: 0 10px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 14px; }
.page-num.is-current { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
a.page-num:hover { border-color: var(--accent); color: var(--accent-2); }
.page-gap { align-self: center; color: var(--muted); }

.subject-sidebar { position: sticky; top: calc(var(--header-h) + 14px); max-height: calc(100vh - var(--header-h) - 28px); overflow: auto; overscroll-behavior: contain; padding: 18px 12px 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); scrollbar-width: thin; }
.subject-sidebar-heading { padding: 0 6px 10px; }
.subject-sidebar-heading h2 { margin: 0; font-size: 22px; }
.subject-filter input { width: 100%; min-height: 40px; margin-bottom: 8px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2); outline: 0; font-size: 14px; }
.subject-filter input:focus { border-color: var(--accent); }
.subject-filter--wide input { max-width: 420px; min-height: 46px; margin-bottom: 18px; background: var(--surface); }
.subject-list { display: flex; flex-direction: column; gap: 2px; }
.subject-option { display: flex; align-items: center; gap: 9px; min-height: 38px; padding: 6px 8px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); line-height: 1.25; transition: background .18s, color .18s, transform .18s; }
.subject-option:hover { background: var(--accent-soft); color: var(--accent-2); transform: translateX(3px); }
.subject-option.is-active { background: var(--accent-soft); color: var(--accent-2); font-weight: 800; }
.subject-icon { flex: none; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; font-size: 14px; background: hsl(var(--hue, 262) 70% 60% / .16); }
.subject-option > span:nth-child(2) { flex: 1; }
.subject-count { min-width: 26px; padding: 2px 6px; border-radius: 7px; text-align: center; font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--surface-2); }

/* subject tiles */
.subjects-section { padding: 10px 0 70px; }
.subject-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.subject-tile { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 4px; min-height: 124px; padding: 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); transition: transform .3s var(--spring), box-shadow .3s, border-color .3s; }
.subject-tile::after { content: ''; position: absolute; right: -40px; bottom: -40px; width: 120px; height: 120px; border-radius: 50%; background: hsl(var(--hue) 75% 62% / .16); transition: transform .5s var(--ease-out); }
.subject-tile:hover { transform: translateY(-5px); box-shadow: var(--shadow); border-color: hsl(var(--hue) 65% 60% / .7); }
.subject-tile:hover::after { transform: scale(1.6); }
.subject-tile-icon { font-size: 30px; line-height: 1; margin-bottom: 6px; transition: transform .4s var(--spring); }
.subject-tile:hover .subject-tile-icon { transform: scale(1.18) rotate(-8deg); }
.subject-tile b { position: relative; z-index: 1; font: 800 16px/1.2 'Manrope', sans-serif; }
.subject-tile small { position: relative; z-index: 1; color: var(--muted); font-size: 13px; }

/* ---------- how it works & tutor ---------- */
.how-section { display: grid; grid-template-columns: .9fr 1.1fr; gap: 48px; align-items: center; padding: 20px 0 80px; }
.how-intro h2 { font-size: clamp(30px, 4vw, 42px); letter-spacing: -1.4px; }
.how-intro h2 span { color: var(--accent); }
.how-intro > p { color: var(--muted); font-size: 16px; }
.how-steps { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 10px; }
.how-steps li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: 14.5px; transition: transform .25s var(--spring); }
.how-steps li:hover { transform: translateX(6px); }
.how-steps li span { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-weight: 800; }
.how-steps b { color: var(--ink); }

.tutor-card { position: relative; padding: 24px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); }
.tutor-card--demo { transform: rotate(1deg); }
.tutor-card--demo::before { content: '✦'; position: absolute; top: -14px; right: 24px; font-size: 26px; color: var(--gold); animation: sparkle 3s ease-in-out infinite; }
.tutor-card--inline { margin-top: 14px; box-shadow: none; animation: rise-in .35s var(--ease-out) both; }
.tutor-head { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.tutor-card h3, .tutor-title { font-size: 21px; margin-bottom: 14px; }
.tutor-block { margin: 14px 0; }
.tutor-label { margin: 0 0 8px; font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.tutor-condition { padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border-left: 4px solid var(--accent); }
.tutor-condition p:last-child, .tutor-step p:last-child, .tutor-answer p:last-child, details p:last-child { margin-bottom: 0; }
.tutor-theory, .tutor-hint { margin: 12px 0; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); overflow: hidden; }
.tutor-theory summary, .tutor-hint summary { cursor: pointer; padding: 11px 14px; font-weight: 700; font-size: 14.5px; list-style: none; display: flex; align-items: center; gap: 8px; }
.tutor-theory summary::-webkit-details-marker, .tutor-hint summary::-webkit-details-marker { display: none; }
.tutor-theory summary::before { content: '📘'; }
.tutor-theory summary::after, .tutor-hint summary::after { content: '▾'; margin-left: auto; transition: transform .25s; }
.tutor-theory[open] summary::after, .tutor-hint[open] summary::after { transform: rotate(180deg); }
.tutor-theory > :not(summary), .tutor-hint > :not(summary) { padding: 0 16px 14px; animation: rise-in .3s var(--ease-out) both; }
.tutor-hint { background: var(--gold-soft); border-color: transparent; }
.tutor-steps { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 10px; }
.tutor-step { counter-increment: step; position: relative; padding: 12px 14px 12px 52px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); line-height: 1.65; }
.tutor-step::before { content: counter(step); position: absolute; left: 12px; top: 11px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: var(--accent-soft); color: var(--accent-2); font-weight: 800; font-size: 14px; }
.tutor-step.is-revealed { animation: step-in .45s var(--spring) both; }
.tutor-step.is-hidden { display: none; }
.tutor-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 12px; }
.tutor-controls .link-btn, .tutor-progress { white-space: nowrap; }
.tutor-progress { font-size: 13px; color: var(--muted); }
.tutor-answer { margin-top: 16px; padding: 14px 16px; border-radius: 14px; background: var(--mint-soft); color: var(--ink); border: 1px solid color-mix(in srgb, var(--mint) 35%, transparent); }
.tutor-answer b { color: var(--mint); }
.tutor-answer > p:first-of-type { display: inline; }
.tutor-answer.is-locked { position: relative; color: transparent; user-select: none; }
.tutor-answer.is-locked > * { filter: blur(7px); }
.tutor-answer.is-locked::after { content: 'Відповідь з’явиться після останнього кроку'; position: absolute; inset: 0; display: grid; place-items: center; color: var(--mint); font-weight: 700; font-size: 14px; }
.tutor-answer.is-unlocked { animation: answer-pop .6s var(--spring) both; }
.tutor-feedback { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 14px; }
.vote-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; transition: transform .25s var(--spring), border-color .2s, background .2s; }
.vote-btn:hover { transform: translateY(-2px) scale(1.04); border-color: var(--accent); }
.vote-btn.is-chosen { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-2); }
.tutor-feedback .link-btn { margin-left: auto; font-size: 13px; color: var(--muted); }
.katex { font-size: 1.08em; }
.katex-display { margin: .6em 0; overflow-x: auto; overflow-y: hidden; padding: 4px 0; }

/* ---------- about band & prose ---------- */
.about-band { display: flex; align-items: center; gap: 24px; margin-bottom: 70px; padding: 30px 34px; overflow: hidden; border-radius: 24px; color: #fff; background: linear-gradient(110deg, color-mix(in srgb, var(--accent) 85%, #000 15%), var(--accent) 55%, color-mix(in srgb, var(--accent) 70%, #fff 30%)); box-shadow: 0 18px 40px color-mix(in srgb, var(--accent) 30%, transparent); }
.about-band::before, .about-band::after { content: ''; position: absolute; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .2); pointer-events: none; animation: orbit 30s linear infinite; }
.about-band::before { width: 260px; height: 260px; right: 200px; top: -170px; }
.about-band::after { width: 190px; height: 190px; right: 20px; bottom: -140px; }
.about-mark { position: relative; flex: none; width: 70px; height: 70px; display: grid; place-items: center; border-radius: 22px 22px 22px 7px; background: rgba(255, 255, 255, .18); font: 800 40px 'Manrope', sans-serif; transform: rotate(-6deg); }
.about-mark span { position: absolute; top: -6px; right: -7px; font-size: 18px; color: #ffe17f; }
.about-band .section-kicker { color: rgba(255, 255, 255, .8); margin-bottom: 4px; }
.about-band h2 { font-size: 26px; margin: 0 0 6px; }
.about-band p { margin: 0; color: rgba(255, 255, 255, .9); font-size: 15px; max-width: 640px; }
.about-band .button { margin-left: auto; z-index: 1; }
[data-theme="kontrast"] .about-band { background: #000; border: 2px solid #fff; }
.prose-page .about-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.prose-card { padding: 24px; margin-bottom: 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.about-grid .prose-card { margin: 0; }
.prose-card h2 { font-size: 22px; }
.prose-card p, .prose-card li { color: var(--ink-soft); font-size: 15.5px; }
.prose-card ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }

/* ---------- footer ---------- */
.site-footer { margin-top: 30px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 55%, transparent); }
.footer-inner { width: min(var(--wrap), calc(100% - 48px)); margin: 0 auto; display: flex; justify-content: space-between; gap: 40px; padding: 38px 0 24px; }
.footer-brand p { max-width: 340px; margin: 12px 0 0; color: var(--muted); font-size: 14px; }
.footer-links { display: flex; gap: 60px; }
.footer-links div { display: flex; flex-direction: column; gap: 8px; }
.footer-links b { font-family: 'Manrope', sans-serif; margin-bottom: 2px; }
.footer-links a { color: var(--muted); font-size: 14px; transition: color .2s, transform .2s; }
.footer-links a:hover { color: var(--accent-2); transform: translateX(3px); }
.footer-bottom { width: min(var(--wrap), calc(100% - 48px)); margin: 0 auto; display: flex; justify-content: space-between; gap: 12px; padding: 16px 0 26px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.heart { color: var(--rose); display: inline-block; animation: heartbeat 1.6s ease-in-out infinite; }

/* ---------- floating UI ---------- */
.to-top { position: fixed; z-index: 25; right: 22px; bottom: 22px; width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; border: 0; background: var(--surface); color: var(--accent-2); box-shadow: var(--shadow); font-size: 20px; font-weight: 800; opacity: 0; transform: translateY(20px) scale(.8); pointer-events: none; transition: opacity .3s, transform .35s var(--spring); }
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { transform: translateY(-3px); }
.to-top svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.to-top circle { fill: none; stroke-width: 3; }
.to-top-track { stroke: var(--line); }
.to-top-ring { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 100.53; stroke-dashoffset: calc(100.53 - 100.53 * var(--progress, 0)); }
.toast { position: fixed; z-index: 80; left: 50%; bottom: 26px; transform: translate(-50%, 30px) scale(.95); opacity: 0; pointer-events: none; padding: 12px 18px; border-radius: 14px; background: var(--ink); color: var(--bg); font-size: 14.5px; font-weight: 600; box-shadow: var(--shadow-lg); transition: opacity .25s, transform .35s var(--spring); max-width: calc(100vw - 32px); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast.is-error { background: var(--danger); color: #fff; }
.confetti { position: fixed; z-index: 90; width: 9px; height: 14px; pointer-events: none; border-radius: 2px; animation: confetti 1.1s cubic-bezier(.2, .6, .4, 1) forwards; }

.search-dialog { width: min(640px, calc(100% - 28px)); max-height: min(560px, calc(100% - 80px)); margin: 10vh auto auto; padding: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); overflow: hidden; }
.search-dialog[open] { animation: pop-in .22s var(--ease-out) both; }
.search-dialog::backdrop { background: rgba(10, 8, 20, .5); backdrop-filter: blur(6px); }
.search-dialog-form { display: flex; align-items: center; gap: 6px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.search-dialog-form input { flex: 1; min-width: 0; min-height: 44px; border: 0; outline: 0; background: transparent; font-size: 17px; }
.search-suggest { max-height: 440px; overflow: auto; padding: 8px; }
.suggest-hint { margin: 8px; color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.suggest-hint button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 9px; padding: 5px 10px; font-size: 13px; font-weight: 600; }
.suggest-group { margin: 6px 8px 4px; font-size: 11.5px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); }
.suggest-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; transition: background .15s; }
.suggest-item:hover, .suggest-item.is-active { background: var(--accent-soft); }
.suggest-item img, .suggest-thumb { flex: none; width: 34px; height: 46px; border-radius: 6px; object-fit: cover; background: var(--cover-bg); display: grid; place-items: center; font-size: 18px; }
.suggest-item b { display: block; font-size: 14.5px; line-height: 1.3; }
.suggest-item small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.3; }
.suggest-empty { padding: 18px; text-align: center; color: var(--muted); }

.modal { width: min(480px, calc(100% - 28px)); padding: 0; border: 1px solid var(--line); border-radius: 22px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
.modal[open] { animation: pop-in .25s var(--ease-out) both; }
.modal::backdrop { background: rgba(10, 8, 20, .5); backdrop-filter: blur(5px); }
.modal-form { display: grid; gap: 14px; padding: 24px; }
.modal-form h2 { font-size: 22px; margin: 0; }
.modal-form label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; }
.modal-form textarea { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); outline: 0; resize: vertical; }
.radio-list { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; }
.radio-list label { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 11px; border: 1px solid var(--line); cursor: pointer; font-weight: 600; }
.radio-list label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.optional { font-weight: 500; color: var(--muted); font-size: 12px; }
.hp-field { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- book page ---------- */
.book-hero { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 36px; align-items: center; padding: 30px; border-radius: 26px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; overflow: hidden; animation: rise-in .5s var(--ease-out) both; }
.book-hero::before { content: ''; position: absolute; right: -120px; top: -120px; width: 340px; height: 340px; border-radius: 50%; background: radial-gradient(circle, hsl(var(--hue) 80% 62% / .2), transparent 70%); pointer-events: none; }
.book-hero-cover { position: relative; aspect-ratio: 5 / 7; border-radius: 10px 18px 18px 10px; overflow: hidden; box-shadow: 14px 22px 40px rgba(0, 0, 0, .3); background: var(--cover-bg); transform: perspective(900px) rotateY(var(--ry, -8deg)) rotateX(var(--rx, 2deg)); transition: transform .25s ease-out; }
.book-hero-img, .book-hero-cover .cover-fallback { width: 100%; height: 100%; object-fit: cover; }
.book-hero-copy { position: relative; min-width: 0; }
.book-hero h1 { font-size: clamp(28px, 3.6vw, 42px); letter-spacing: -1.4px; margin: 14px 0 8px; }
.book-hero-authors { font-size: 17px; color: var(--ink-soft); margin-bottom: 8px; }
.book-hero-note { color: var(--muted); font-size: 14.5px; margin-bottom: 6px; }
.book-facts { display: flex; flex-wrap: wrap; gap: 10px 30px; margin: 18px 0; }
.book-facts dt { font-size: 12.5px; color: var(--muted); }
.book-facts dd { margin: 0; font: 800 22px/1.2 'Manrope', sans-serif; }
.book-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.solutions-section { padding-top: 54px; }
.solutions-heading { max-width: 700px; margin-bottom: 20px; }
.solutions-heading h2 { font-size: clamp(26px, 3.4vw, 36px); letter-spacing: -1px; }
.solutions-heading p { color: var(--muted); }
.solution-tools { display: grid; gap: 12px; margin-bottom: 18px; }
.chapter-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chapters { display: grid; gap: 16px; }
.chapter { padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.chapter-title { display: flex; align-items: baseline; gap: 10px; font-size: 19px; margin-bottom: 12px; }
.chapter-title small { font: 600 13px 'Onest', sans-serif; color: var(--muted); }
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.task-tile { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 54px; padding: 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); text-align: center; transition: transform .25s var(--spring), border-color .2s, background .2s, color .2s; }
.task-tile b { font: 800 17px/1 'Manrope', sans-serif; }
.task-tile small { font-size: 10.5px; color: var(--rose); margin-top: 3px; }
.task-tile:hover { transform: translateY(-3px) scale(1.04); border-color: var(--accent); color: var(--accent-2); }
.task-tile.is-active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.task-tile.is-active small { color: inherit; }
.task-tile.is-filtered { display: none; }
.solution-no-match { text-align: center; color: var(--muted); padding: 20px; }
.solutions-empty { padding: 38px 20px; text-align: center; border-radius: var(--radius); border: 1.5px dashed var(--line-strong); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.solutions-empty h3 { font-size: 20px; }
.solutions-empty p { color: var(--muted); max-width: 520px; margin: 0 auto; }
.request-card { margin-top: 30px; padding: 26px; border-radius: 24px; background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); border: 1px solid var(--line); }
.request-copy { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.request-icon { flex: none; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; background: var(--accent); color: var(--on-accent); font-size: 26px; transform: rotate(-6deg); }
.request-copy h2 { font-size: 23px; margin-bottom: 4px; }
.request-copy p { color: var(--muted); margin: 0; }
.request-form { display: grid; grid-template-columns: 1fr 1fr 2fr auto; gap: 12px; align-items: end; }
.request-form label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 700; color: var(--ink-soft); }
.request-form input, .request-form textarea { width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); outline: 0; font-size: 15px; resize: vertical; transition: border-color .2s, box-shadow .2s; }
.request-form input:focus, .request-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); }
.request-form textarea { min-height: 46px; height: 46px; }
.form-status { grid-column: 1 / -1; margin: 0; min-height: 1.2em; font-weight: 600; font-size: 14px; }
.form-status.is-ok, .form-success { color: var(--mint); }
.form-status.is-error { color: var(--danger); }
.form-success { font-weight: 700; padding: 10px 14px; border-radius: 12px; background: var(--mint-soft); }
.related-section { padding: 50px 0 20px; }
.inline-viewer { scroll-margin-top: calc(var(--header-h) + 20px); }

.task-header { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; }
.task-header-cover { flex: none; width: 72px; aspect-ratio: 5 / 7; border-radius: 8px; overflow: hidden; box-shadow: var(--shadow); }
.task-cover, .task-header-cover .cover-fallback { width: 100%; height: 100%; object-fit: cover; }
.task-header-cover .cover-fallback b { font-size: 9px; }
.task-header-cover .cover-fallback-icon { font-size: 16px; top: 6px; left: 12px; }
.task-header h1 { font-size: clamp(26px, 3.4vw, 38px); margin: 0 0 4px; }
.task-book { margin: 0; color: var(--muted); }
.task-book a:hover { color: var(--accent-2); }
.tutor-mode-bar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.tutor-mode-bar .switch-row { margin: 0; }
.task-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 10px; }

/* search & misc pages */
.search-group-title { font-size: 22px; margin: 30px 0 14px; }
.search-group-title small { font-size: 15px; color: var(--muted); }
.search-solutions { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.search-solution { display: grid; gap: 2px; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); transition: transform .25s var(--spring), border-color .2s; }
.search-solution:hover { transform: translateY(-3px); border-color: var(--accent); }
.search-solution span, .search-solution small { color: var(--muted); font-size: 13.5px; }
.error-page { text-align: center; padding: 70px 0 60px; }
.error-art { position: relative; display: inline-block; margin-bottom: 10px; }
.error-code { font: 800 clamp(90px, 18vw, 170px)/1 'Manrope', sans-serif; letter-spacing: -6px; background: linear-gradient(120deg, var(--accent), var(--mint), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; animation: float-c 5s ease-in-out infinite; display: inline-block; }
.error-orbit { position: absolute; top: 10%; right: -24px; font-size: 34px; color: var(--gold); animation: spin-slow 8s linear infinite; }
.error-page p { color: var(--muted); max-width: 460px; margin: 0 auto 20px; }
.error-actions { display: flex; gap: 10px; justify-content: center; }

/* ---------- reveal on scroll ---------- */
html.js[data-motion="full"] .reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); transition-delay: calc(var(--i, 0) * 45ms); }
html.js[data-motion="full"] .reveal.is-visible { opacity: 1; transform: none; }
html.js[data-motion="full"] .book-card.reveal.is-visible:hover { transform: translateY(-6px); transition-delay: 0s; }

/* ---------- theme switch transition ---------- */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { animation: theme-reveal .6s var(--ease-out); }
@keyframes theme-reveal { from { clip-path: circle(0 at var(--vt-x, 50%) var(--vt-y, 0)); } to { clip-path: circle(var(--vt-r, 150vmax) at var(--vt-x, 50%) var(--vt-y, 0)); } }

/* ---------- keyframes ---------- */
@keyframes rise-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes art-enter { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes blob-morph { 0% { border-radius: 44% 56% 49% 51% / 52% 43% 57% 48%; transform: rotate(0) scale(.98); } 100% { border-radius: 55% 45% 43% 57% / 44% 54% 46% 56%; transform: rotate(14deg) scale(1.04); } }
@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes float-a { 0%, 100% { transform: rotate(-12deg) translateY(0); } 50% { transform: rotate(-9deg) translateY(-12px); } }
@keyframes float-b { 0%, 100% { transform: rotate(10deg) translateY(0); } 50% { transform: rotate(13deg) translateY(-10px); } }
@keyframes float-c { 0%, 100% { transform: rotate(-2deg) translateY(0); } 50% { transform: rotate(0deg) translateY(-14px); } }
@keyframes note-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
@keyframes sparkle { 0%, 100% { transform: scale(.8) rotate(0); opacity: .7; } 50% { transform: scale(1.18) rotate(24deg); opacity: 1; } }
@keyframes pencil-bob { 0%, 100% { transform: rotate(25deg) translateY(0); } 50% { transform: rotate(36deg) translateY(-9px); } }
@keyframes spin-slow { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.25); } }
@keyframes underline-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes shine { to { transform: translateX(120%); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes wobble { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg) scale(1.05); } }
@keyframes heart-pop { 0% { transform: scale(1); } 40% { transform: scale(1.4); } 100% { transform: scale(1); } }
@keyframes heartbeat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.25); } 30% { transform: scale(1); } 45% { transform: scale(1.18); } }
@keyframes bump { 0% { transform: scale(1); } 50% { transform: scale(1.6); color: var(--rose); } 100% { transform: scale(1); } }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }
@keyframes step-in { from { opacity: 0; transform: translateX(-14px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes answer-pop { 0% { transform: scale(.94); } 60% { transform: scale(1.02); } 100% { transform: scale(1); } }
@keyframes confetti { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr .8fr; }
  .hero-art { transform: scale(.86); }
  .grades-strip { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .catalog-layout { grid-template-columns: minmax(0, 1fr) 230px; }
  .request-form { grid-template-columns: 1fr 1fr; }
  .request-form .request-message { grid-column: 1 / -1; }
}
@media (max-width: 1024px) {
  .main-nav { max-height: calc(100vh - var(--header-h) - 20px); overflow-y: auto; }
  .main-nav { display: none; position: absolute; top: calc(100% + 6px); left: 12px; right: 12px; flex-direction: column; align-items: stretch; gap: 2px; margin: 0; padding: 10px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
  .main-nav.is-open { display: flex; animation: pop-in .2s var(--ease-out) both; }
  .main-nav > a, .nav-grades-toggle { text-align: left; padding: 12px; width: 100%; }
  .grades-menu { position: static; transform: none; grid-template-columns: repeat(6, 1fr); box-shadow: none; margin-top: 6px; }
  .menu-toggle { display: inline-flex; }
  .tools-menu { grid-template-columns: 1fr; width: auto; }
}
@media (max-width: 860px) {
  :root { --header-h: 64px; }
  .wrap { width: calc(100% - 32px); }
  .hero { grid-template-columns: 1fr; min-height: 0; padding-top: 22px; }
  .hero-art { height: 360px; transform: none; margin-top: -10px; }
  .hero-art::before { width: 280px; height: 280px; }
  .art-orbit--one { width: 330px; height: 330px; }
  .art-orbit--two { width: 260px; height: 260px; }
  .hero-books { transform: scale(.78); }
  .catalog-layout { grid-template-columns: 1fr; }
  .subject-sidebar { position: static; max-height: none; order: -1; padding: 14px 10px 10px; }
  .subject-list { flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 6px; scrollbar-width: thin; }
  .subject-option { flex: none; border: 1px solid var(--line); }
  .subject-option:hover { transform: none; }
  .subject-sidebar-heading { display: none; }
  .how-section { grid-template-columns: 1fr; gap: 26px; }
  .book-hero { grid-template-columns: 150px minmax(0, 1fr); gap: 20px; padding: 20px; }
  .footer-inner { flex-direction: column; gap: 24px; }
  .prose-page .about-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .header-inner { width: calc(100% - 24px); gap: 10px; }
  .brand-word { font-size: 20px; }
  .icon-btn { min-width: 40px; height: 40px; padding: 0 9px; }
  .theme-panel { right: 12px; }
  .theme-grid { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: clamp(36px, 10.5vw, 52px); }
  .hero-lede { font-size: 15.5px; }
  .hero-search { min-height: 56px; }
  .hero-search button { padding: 12px 14px; }
  .hero-stats dd { font-size: 23px; }
  .hero-art { height: 300px; }
  .hero-books { transform: scale(.62); }
  .floating-note { font-size: 11px; padding: 8px 10px 8px 8px; }
  .floating-note b { font-size: 12px; }
  .note--top { top: 20px; }
  .note--bottom { bottom: 20px; }
  .grades-strip { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 10px; scrollbar-width: none; }
  .grades-strip::-webkit-scrollbar { display: none; }
  .grade-tile { flex: 0 0 76px; scroll-snap-align: start; }
  .grade-tile b { font-size: 24px; }
  .section-heading { flex-direction: column; align-items: flex-start; gap: 8px; }
  .catalog-toolbar { gap: 8px; }
  .catalog-search { flex-basis: 100%; max-width: none; }
  .catalog-search kbd, .hero-hint { display: none; }
  .segmented { flex: 1; }
  .segment { flex: 1; text-align: center; }
  .segment span { padding: 8px 6px; }
  .select-wrap, .select-wrap select { flex: 1; width: 100%; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .book-card-body { padding: 10px 11px 12px; }
  .book-card h3 { font-size: 14.5px; }
  .book-card-cover { margin: 8px 8px 0; }
  .bookmark-btn { top: 14px; right: 14px; width: 32px; height: 32px; }
  .card-open { display: none; }
  .subject-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .subject-tile { min-height: 110px; padding: 13px; }
  .about-band { flex-direction: column; align-items: flex-start; padding: 24px 20px; }
  .about-band .button { margin-left: 0; }
  .book-hero { grid-template-columns: 1fr; text-align: left; }
  .book-hero-cover { width: 150px; }
  .request-form { grid-template-columns: 1fr; }
  .request-card { padding: 20px; }
  .tutor-card { padding: 18px; }
  .tutor-step { padding-left: 46px; }
  .task-nav { flex-wrap: wrap; }
  .footer-links { gap: 34px; }
  .footer-bottom { flex-direction: column; }
  .to-top { right: 14px; bottom: 14px; }
}
@media (max-width: 380px) {
  .book-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .theme-grid { grid-template-columns: 1fr; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
[data-motion="reduced"] *, [data-motion="reduced"] *::before, [data-motion="reduced"] *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
[data-motion="reduced"] { scroll-behavior: auto; }

/* ---------- print ---------- */
@media print {
  .site-header, .site-footer, .bg-decor, .to-top, .tutor-feedback, .tutor-controls, .request-card, .related-section, .task-nav, .tutor-mode-bar, .breadcrumbs, .site-banner { display: none !important; }
  body { background: #fff; color: #000; }
  .tutor-step.is-hidden { display: block !important; }
  .tutor-answer.is-locked { color: inherit; }
  .tutor-answer.is-locked > * { filter: none; }
  .tutor-answer.is-locked::after { display: none; }
}

/* ---------- "by textbook page" view and solutions written out as in an exercise book ---------- */
.view-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 18px; }
.view-tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); font-weight: 700; font-size: 14.5px; transition: border-color .2s, background .2s, color .2s, transform .25s var(--spring); }
.view-tab:hover { border-color: var(--accent); color: var(--accent-2); transform: translateY(-2px); }
.view-tab.is-active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.pages-chapter { margin-bottom: 28px; }
.pages-chapter-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 14px; margin-bottom: 12px; }
.pages-chapter-head .chapter-title { margin-bottom: 0; }
.page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 8px; }
.page-tile { display: flex; flex-direction: column; gap: 4px; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); transition: transform .25s var(--spring), border-color .2s, color .2s; }
.page-tile b { font: 800 15.5px/1.15 'Manrope', sans-serif; }
.page-tile span { font-size: 13px; color: var(--muted); }
.page-tile:hover { transform: translateY(-3px); border-color: var(--accent); color: var(--accent-2); }
.page-tile.is-filtered { display: none; }

.pages-lede { color: var(--muted); margin: 0 0 14px; }
.pages-jump { flex-wrap: wrap; overflow: visible; margin-bottom: 20px; }
.notebook-list { display: grid; gap: 18px; }
.nb-page-divider { display: flex; align-items: center; gap: 12px; margin: 14px 0 0; font-size: 17px; color: var(--muted); }
.nb-page-divider::before, .nb-page-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.nb-chapter { margin: 4px 0 -6px; font-weight: 800; color: var(--accent-2); }
.notebook-card { --cell: 22px; --grid-line: color-mix(in srgb, var(--accent) 10%, transparent); position: relative; padding: 20px 22px 18px 50px; border-radius: 16px; border: 1px solid var(--line); background-color: var(--surface);
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px); background-size: var(--cell) var(--cell); box-shadow: var(--shadow-sm); scroll-margin-top: calc(var(--header-h) + 16px); }
.notebook-card::before { content: ''; position: absolute; top: 0; bottom: 0; left: 34px; width: 2px; background: color-mix(in srgb, var(--rose) 60%, transparent); }
.nb-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 10px; }
.nb-head h2 { font-size: 20px; margin: 0; }
.nb-number { padding: 0 4px; background: linear-gradient(transparent 55%, color-mix(in srgb, var(--gold) 45%, transparent) 55%); border-radius: 3px; }
.nb-title { color: var(--muted); font-weight: 600; }
.nb-condition { margin: 0 0 12px; padding: 10px 14px; border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; background: color-mix(in srgb, var(--surface) 82%, transparent); }
.nb-condition p:last-child, .nb-steps li p:last-child, .nb-answer p:last-child { margin-bottom: 0; }
.nb-label { margin: 6px 0 6px; font-weight: 800; font-style: italic; }
.nb-steps { display: grid; gap: 6px; padding-left: 22px; margin: 0; }
.nb-answer { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line-strong); font-size: 16.5px; }
.nb-answer b { color: var(--mint); }
.nb-answer > p:first-of-type { display: inline; }
.nb-foot { margin-top: 14px; font-size: 14px; }
.notebook-card--inline { margin-top: 14px; box-shadow: none; animation: rise-in .35s var(--ease-out) both; }
.nb-pill { margin-left: auto; }
.notebook-card .tutor-feedback { margin-top: 14px; }
.tutor-mode-bar { justify-content: space-between; flex-wrap: wrap; align-items: center; gap: 10px; }
.tutor-mode-bar .switch-row { margin-top: 0; margin-left: auto; }
.view-switch { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); }
.view-switch[hidden] { display: none; }
.view-switch-btn { padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--muted); transition: background .2s, color .2s; }
.view-switch-btn:hover { color: var(--ink); }
.view-switch-btn.is-active { background: var(--accent); color: var(--on-accent); }
.task-nav-links { text-align: center; }
@media (max-width: 640px) {
  .notebook-card { padding: 16px 14px 14px 32px; }
  .notebook-card::before { left: 20px; }
  .page-grid { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
  .view-tab { flex: 1 1 auto; justify-content: center; }
  .view-switch { width: 100%; }
  .view-switch-btn { flex: 1; padding: 8px 10px; }
}
@media print {
  .pages-jump, .nb-foot, .view-tabs, .view-switch { display: none !important; }
  .notebook-card { box-shadow: none; break-inside: avoid; }
}
