:root {
  color-scheme: light;
  --header-height: 76px;
  --page: #f3f4ee;
  --surface: #ffffff;
  --surface-soft: #e9ece4;
  --ink: #202820;
  --muted: #59635b;
  --line: #d3d9ce;
  --accent: #b7ed5e;
  --accent-ink: #243317;
  --blue: #315f84;
  --orange: #9b4b23;
  --hover-border: #aeb9a7;
  --reader-meta-bg: #e9f0f3;
  --reader-meta-border: #c7d5de;
  --code-inline: #274f6d;
  --index-bg: #e5edf0;
  --error-bg: #fffaf7;
  --error-border: #e2c4b5;
  --shadow: 0 16px 45px rgb(27 37 27 / 8%);
  --body-font: "Bahnschrift", "Aptos", "Segoe UI", sans-serif;
  --display-font: Georgia, "Times New Roman", serif;
  font-family: var(--body-font);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #171c18;
  --surface: #202722;
  --surface-soft: #29332c;
  --ink: #edf2e9;
  --muted: #b5c1b6;
  --line: #3b483f;
  --accent: #b7ed5e;
  --accent-ink: #26351b;
  --blue: #a4cbed;
  --orange: #f0a078;
  --hover-border: #637467;
  --reader-meta-bg: #26343a;
  --reader-meta-border: #425964;
  --code-inline: #c0ddf3;
  --index-bg: #2b3a3f;
  --error-bg: #352923;
  --error-border: #805b48;
  --shadow: 0 16px 45px rgb(0 0 0 / 25%);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: var(--header-height); }

body {
  min-width: 320px;
  margin: 0;
  background-color: var(--page);
  background-image: linear-gradient(90deg, transparent 49px, rgb(73 100 64 / 4%) 50px, transparent 51px), linear-gradient(transparent 49px, rgb(73 100 64 / 4%) 50px, transparent 51px);
  background-size: 50px 50px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  transition: background-color 180ms ease, color 180ms ease;
}

button, input { font: inherit; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
[hidden] { display: none !important; }

.app-shell { min-height: 100vh; }

.topbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 22px;
  padding: 0 clamp(20px, 5vw, 76px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--page) 96%, transparent);
  backdrop-filter: blur(14px);
  box-shadow: 0 5px 18px rgb(32 40 32 / 4%);
}

.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; }
.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 9px 3px 9px 3px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 21px;
  font-weight: 850;
}
.brand-name { font-size: 19px; font-weight: 850; letter-spacing: 0.1em; }
.topbar-tagline { color: var(--muted); font-size: 13px; }
.search-control { position: relative; width: min(270px, 25vw); flex: none; margin-left: auto; }
.search-control input { width: 100%; height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 13px; }
.search-control input::placeholder { color: var(--muted); }
.search-control input:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.search-results { position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; width: min(380px, calc(100vw - 36px)); max-height: min(420px, 70vh); overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); box-shadow: var(--shadow); }
.search-result-list { display: grid; gap: 0; margin: 0; padding: 5px; list-style: none; }
.search-result { display: grid; gap: 4px; padding: 11px 12px; border-radius: 4px; text-decoration: none; transition: background-color 140ms ease; }
.search-result:hover, .search-result:focus-visible { background: var(--surface-soft); }
.search-result strong { font-size: 13px; line-height: 1.35; }
.search-result span { color: var(--muted); font-size: 11px; }
.search-result i { margin: 0 4px; color: var(--orange); font-style: normal; }
.search-empty { margin: 0; padding: 14px; color: var(--muted); font-size: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; clip-path: inset(50%); }
.top-nav { display: flex; align-items: center; gap: 22px; }
.top-nav a { position: relative; color: var(--muted); font-size: 13px; font-weight: 700; text-decoration: none; transition: color 140ms ease; }
.top-nav a::after { position: absolute; right: 0; bottom: -7px; left: 0; height: 2px; background: var(--accent); content: ""; transform: scaleX(0); transform-origin: left; transition: transform 140ms ease; }
.top-nav a:hover { color: var(--ink); }
.top-nav a:hover::after { transform: scaleX(1); }
.theme-toggle { padding: 7px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: 11px; font-weight: 700; transition: border-color 140ms ease, background-color 140ms ease; }
.theme-toggle:hover { border-color: var(--hover-border); background: var(--surface-soft); }
.import-trigger { padding: 7px 10px; border: 1px solid var(--accent); border-radius: 5px; background: var(--accent); color: var(--accent-ink); cursor: pointer; font-size: 11px; font-weight: 750; transition: filter 140ms ease, transform 140ms ease; }
.import-trigger:hover { filter: brightness(0.96); transform: translateY(-1px); }

.page-layout { min-height: calc(100vh - 132px); }
.page-layout.has-sidebar { display: grid; grid-template-columns: 270px minmax(0, 1fr); }
.main-content { width: min(100%, 1320px); margin: 0 auto; padding: 0 clamp(22px, 6vw, 92px) 72px; }
.page-layout.has-sidebar .main-content { width: 100%; padding-right: clamp(24px, 5vw, 76px); padding-left: clamp(24px, 5vw, 76px); }
.sidebar { position: sticky; top: var(--header-height); align-self: start; height: calc(100vh - var(--header-height)); overflow-y: auto; padding: 26px 16px 36px 24px; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--surface-soft) 42%, var(--page)); }
.sidebar-heading { display: grid; gap: 13px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.sidebar-home, .sidebar-category { display: flex; align-items: center; justify-content: space-between; text-decoration: none; }
.sidebar-home { font-size: 14px; font-weight: 750; }
.sidebar-home span, .sidebar-category span { color: var(--muted); font-size: 11px; }
.sidebar-categories, .sidebar-lessons { display: grid; gap: 4px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.sidebar-label { margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.sidebar-category { min-width: 0; padding: 7px 9px; border-radius: 4px; color: var(--muted); font-size: 13px; text-decoration: none; transition: background-color 140ms ease, color 140ms ease; }
.sidebar-category:hover, .sidebar-lesson:hover { background: var(--surface); color: var(--ink); }
.sidebar-lessons { border-bottom: 0; }
.sidebar-lesson { padding: 8px 9px; border-radius: 4px; color: var(--muted); font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; text-decoration: none; transition: background-color 140ms ease, color 140ms ease; }
.sidebar-lesson.is-active { background: var(--accent); color: var(--accent-ink); font-weight: 750; }
.menu-toggle { display: none; }
.home-hero {
  position: relative;
  display: flex;
  min-height: 310px;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  margin: 30px 0 58px;
  padding: clamp(28px, 5vw, 58px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  animation: rise-in 420ms ease both;
}
.home-hero::before { position: absolute; top: -82px; right: 14%; width: 245px; height: 245px; border: 1px solid var(--line); border-radius: 50%; content: ""; }
.home-hero::after { position: absolute; top: -38px; right: 18%; width: 155px; height: 155px; border: 1px solid var(--line); border-radius: 50%; content: ""; }
.hero-copy { position: relative; z-index: 1; max-width: 670px; }
.hero-copy .eyebrow { display: flex; align-items: center; gap: 8px; }
.eyebrow-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); }
.hero-copy h1 { max-width: 650px; margin: 18px 0 14px; font-family: var(--display-font); font-size: 58px; font-weight: 500; line-height: 1.04; }
.hero-copy h1 em { color: var(--blue); font-weight: 500; }
.hero-description { max-width: 470px; margin: 0; color: var(--muted); font-size: 15px; }
.hero-link { display: inline-flex; align-items: center; gap: 15px; margin-top: 24px; padding-bottom: 4px; border-bottom: 1px solid var(--ink); font-size: 13px; font-weight: 750; text-decoration: none; }
.hero-link span { color: var(--orange); font-size: 18px; }
.hero-stamp { position: relative; z-index: 1; display: grid; width: 142px; height: 142px; flex: none; align-content: center; justify-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--surface); transform: rotate(7deg); }
.stamp-word { color: var(--ink); font-family: var(--display-font); font-size: 22px; line-height: 1.05; text-align: center; }
.stamp-ring { position: absolute; inset: -8px; border: 2px dashed var(--accent); border-radius: 50%; }

.content-section { margin: 0 0 58px; animation: rise-in 420ms 60ms ease both; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading h2 { margin: 5px 0 0; font-family: var(--display-font); font-size: 29px; font-weight: 500; line-height: 1.2; }
.section-note { margin: 0 0 3px; color: var(--muted); font-size: 12px; }
.category-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.category-card { position: relative; display: grid; min-height: 146px; grid-template-rows: 1fr auto auto; gap: 7px; padding: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); text-decoration: none; transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease; }
.category-card::before { position: absolute; top: 0; bottom: 0; left: 0; width: 3px; background: var(--accent); content: ""; transition: width 160ms ease; }
.category-card:hover { transform: translateY(-3px); border-color: var(--hover-border); box-shadow: 0 10px 24px rgb(27 37 27 / 8%); }
.category-card:hover::before { width: 5px; }
.category-index { color: var(--blue); font-size: 11px; font-weight: 800; }
.category-name { max-width: 100%; font-size: 16px; font-weight: 750; line-height: 1.3; overflow-wrap: anywhere; }
.category-count { color: var(--muted); font-size: 11px; }
.category-arrow { position: absolute; top: 13px; right: 14px; color: var(--orange); font-size: 18px; }

.recent-section { padding-top: 5px; }
.lesson-list { border-top: 1px solid var(--line); }
.lesson-row { display: grid; min-height: 74px; grid-template-columns: 42px minmax(0, 1fr) 24px; align-items: center; gap: 11px; border-bottom: 1px solid var(--line); text-decoration: none; transition: padding 150ms ease, background-color 150ms ease; }
.lesson-row:hover { padding-right: 10px; padding-left: 10px; background: var(--surface); }
.lesson-row-index { color: var(--orange); font-size: 11px; font-weight: 800; }
.lesson-row-copy { display: grid; gap: 3px; min-width: 0; }
.lesson-row-copy strong { overflow-wrap: anywhere; font-size: 14px; font-weight: 750; }
.lesson-row-copy > span { color: var(--muted); font-size: 11px; }
.lesson-row-copy i { margin: 0 5px; color: var(--orange); font-style: normal; }
.lesson-row-arrow { color: var(--blue); }
.empty-state { padding: 22px 0; color: var(--muted); }

.lesson-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.lesson-card { display: flex; min-width: 0; min-height: 218px; flex-direction: column; align-items: flex-start; padding: 19px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease; }
.lesson-card:hover { transform: translateY(-3px); border-color: var(--hover-border); box-shadow: 0 12px 26px rgb(27 37 27 / 8%); }
.lesson-card-index { display: grid; min-width: 31px; height: 25px; place-items: center; margin-bottom: 18px; padding: 0 7px; border-radius: 3px; background: var(--index-bg); color: var(--blue); font-size: 10px; font-weight: 800; }
.lesson-card-category { margin: 0 0 7px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; }
.lesson-card-category span { margin: 0 4px; color: var(--orange); }
.lesson-card h3 { margin: 0; font-size: 17px; font-weight: 750; line-height: 1.35; overflow-wrap: anywhere; }
.lesson-card-link { display: inline-flex; align-items: center; gap: 9px; margin-top: auto; padding-top: 20px; color: var(--blue); font-size: 12px; font-weight: 750; text-decoration: none; }
.lesson-card-link span { transition: transform 140ms ease; }
.lesson-card-link:hover span { transform: translateX(3px); }
.category-empty { grid-column: 1 / -1; margin: 0; padding: 20px; border: 1px dashed var(--line); border-radius: 6px; color: var(--muted); }
.error-state { grid-column: 1 / -1; margin: 0; padding: 20px 22px; border: 1px solid var(--error-border); border-left: 4px solid var(--orange); border-radius: 5px; background: var(--error-bg); color: var(--ink); }
.error-state strong { display: block; margin-bottom: 5px; font-size: 15px; }
.error-state p { margin: 0 0 10px; color: var(--muted); }
.error-state a { color: var(--blue); font-size: 13px; font-weight: 700; }
.loading-state { grid-column: 1 / -1; margin: 0; padding: 28px 0; color: var(--muted); }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 27px 0 25px; color: var(--muted); font-size: 12px; }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb [aria-current="page"] { max-width: 100%; overflow-wrap: anywhere; color: var(--ink); }
.reader-meta { display: inline-flex; margin-bottom: 7px; padding: 5px 9px; border: 1px solid var(--reader-meta-border); border-radius: 4px; background: var(--reader-meta-bg); color: var(--blue); }
.lesson-content { max-width: 900px; padding: 17px 0 42px; font-size: 16px; line-height: 1.8; overflow-wrap: anywhere; }
.lesson-content > :first-child { margin-top: 0; }
.lesson-content h1, .lesson-content h2, .lesson-content h3, .lesson-content h4 { margin: 1.75em 0 0.65em; color: var(--ink); font-family: var(--display-font); font-weight: 600; line-height: 1.28; }
.lesson-content h1 { font-size: 32px; }
.lesson-content h2 { font-size: 25px; }
.lesson-content h3 { font-size: 20px; }
.lesson-content h4 { font-size: 17px; }
.lesson-content p, .lesson-content ul, .lesson-content ol, .lesson-content blockquote { margin: 0 0 1.15em; }
.lesson-content li { margin: 0.25em 0; padding-left: 4px; }
.lesson-content a { color: var(--blue); }
.lesson-content hr { height: 1px; margin: 2em 0; border: 0; background: var(--line); }
.lesson-content blockquote { padding: 8px 18px; border-left: 3px solid var(--orange); color: var(--muted); }
.lesson-content pre { max-width: 100%; margin: 1.45em 0; padding: 20px 22px; overflow: auto; border: 1px solid #37453d; border-radius: 7px; background: #18231f; color: #edf3eb; font: 13px/1.7 "Cascadia Code", "Consolas", monospace; tab-size: 4; box-shadow: inset 3px 0 0 var(--accent); }
.lesson-content pre code { padding: 0; background: transparent; color: inherit; font: inherit; }
.lesson-content :not(pre) > code { padding: 2px 5px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface-soft); color: var(--code-inline); font: 0.88em "Cascadia Code", "Consolas", monospace; }
.lesson-content table { display: block; width: 100%; margin: 1.4em 0; overflow-x: auto; border-collapse: collapse; border-spacing: 0; font-size: 14px; }
.lesson-content th, .lesson-content td { min-width: 110px; padding: 9px 12px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.lesson-content th { background: var(--surface-soft); font-weight: 750; }
.lesson-content img { max-width: 100%; height: auto; }
.uploaded-html-frame { display: block; width: 100%; min-height: 72vh; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.remove-upload { margin: 0 0 8px 12px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--muted); cursor: pointer; font-size: 11px; }
.remove-upload:hover { border-color: var(--orange); color: var(--orange); }
.lesson-content .hljs-keyword, .lesson-content .hljs-selector-tag { color: #d2b7ff; }
.lesson-content .hljs-string, .lesson-content .hljs-attr { color: #b9e690; }
.lesson-content .hljs-number, .lesson-content .hljs-literal { color: #ffc17d; }
.lesson-content .hljs-comment { color: #b1c0b5; }
.lesson-pagination { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 880px; padding-top: 20px; border-top: 1px solid var(--line); }
.pagination-link { display: grid; min-width: 0; min-height: 86px; gap: 8px; padding: 15px 17px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); text-decoration: none; transition: border-color 150ms ease, transform 150ms ease, box-shadow 150ms ease; }
.pagination-link:hover { transform: translateY(-2px); border-color: var(--blue); box-shadow: 0 8px 20px rgb(27 37 27 / 7%); }
.pagination-link span { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; }
.pagination-link strong { overflow-wrap: anywhere; font-size: 12px; }
.next-link { text-align: right; }

.import-dialog { width: min(510px, calc(100vw - 30px)); max-height: min(90vh, 760px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.import-dialog::backdrop { background: rgb(17 24 19 / 48%); backdrop-filter: blur(3px); }
.import-form { display: grid; gap: 15px; padding: 25px; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.dialog-heading h2 { margin: 5px 0 0; font-family: var(--display-font); font-size: 27px; font-weight: 500; }
.dialog-close { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: 21px; line-height: 1; }
.dialog-note { margin: -7px 0 0; color: var(--muted); font-size: 12px; }
.import-field { display: grid; gap: 6px; color: var(--ink); font-size: 12px; font-weight: 700; }
.import-field input { width: 100%; min-width: 0; min-height: 40px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); font-size: 13px; }
.import-field input[type="file"] { padding: 6px; font-size: 11px; }
.import-field input[type="file"]::file-selector-button { margin-right: 10px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-soft); color: var(--ink); cursor: pointer; font: inherit; font-weight: 700; transition: background-color 140ms ease, border-color 140ms ease; }
.import-field input[type="file"]::file-selector-button:hover { border-color: var(--hover-border); background: var(--line); }
.import-field input:focus-visible, .dialog-close:focus-visible, .dialog-actions button:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.import-feedback { min-height: 18px; margin: 0; color: var(--orange); font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; }
.dialog-actions button { min-height: 39px; padding: 0 14px; border: 1px solid var(--line); border-radius: 5px; cursor: pointer; font-size: 12px; font-weight: 750; }
.dialog-secondary { background: var(--surface); color: var(--ink); }
.dialog-primary { border-color: var(--accent) !important; background: var(--accent); color: var(--accent-ink); }

.site-footer { display: flex; justify-content: space-between; gap: 14px; padding: 18px clamp(20px, 5vw, 76px); border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.site-footer span:first-child { color: var(--ink); font-weight: 850; letter-spacing: 0.1em; }
@keyframes rise-in { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1040px) {
  .page-layout.has-sidebar { grid-template-columns: 230px minmax(0, 1fr); }
  .page-layout.has-sidebar .main-content { padding-right: 28px; padding-left: 28px; }
  .category-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .lesson-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main-content { padding-right: 32px; padding-left: 32px; }
}

@media (max-width: 760px) {
  :root { --header-height: 88px; }
  .topbar { display: grid; min-height: var(--header-height); grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "brand search menu" "nav nav nav"; gap: 8px 12px; padding: 10px 16px; }
  .brand { grid-area: brand; }
  .search-control { width: 100%; min-width: 0; grid-area: search; margin: 0; }
  .top-nav { grid-area: nav; justify-content: flex-start; }
  .menu-toggle:not([hidden]) { display: block; grid-area: menu; padding: 7px 10px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); font-size: 11px; font-weight: 700; }
  .brand { gap: 8px; }
  .brand-mark { width: 32px; height: 32px; }
  .brand-name { font-size: 17px; }
  .topbar-tagline { display: none; }
  .top-nav { gap: 15px; }
  .top-nav a { font-size: 11px; }
  .theme-toggle, .import-trigger { padding: 6px 8px; font-size: 10px; }
  .page-layout.has-sidebar { display: block; }
  .sidebar { position: fixed; z-index: 9; top: var(--header-height); bottom: 0; left: 0; width: min(310px, 86vw); height: auto; padding: 22px; background: var(--page); box-shadow: var(--shadow); transform: translateX(-105%); transition: transform 180ms ease; }
  .sidebar.is-open { transform: translateX(0); }
  .page-layout.has-sidebar .main-content { padding-right: 19px; padding-left: 19px; }
  .main-content { padding: 0 19px 48px; }
  .home-hero { min-height: 290px; margin: 20px 0 42px; padding: 27px 23px; }
  .home-hero::before { right: 3%; }
  .home-hero::after { right: 7%; }
  .hero-stamp { width: 93px; height: 93px; margin-right: -5px; }
  .stamp-number { font-size: 29px; }
  .stamp-label { font-size: 8px; }
  .hero-copy h1 { font-size: 44px; }
  .hero-description { max-width: 340px; font-size: 13px; }
  .category-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .category-card { min-height: 128px; padding: 15px; }
  .lesson-card { min-height: 205px; padding: 17px; }
  .section-heading { align-items: start; }
  .section-heading h2 { font-size: 25px; }
  .section-note { max-width: 45%; text-align: right; }
  .lesson-content { padding-top: 14px; font-size: 15px; }
  .lesson-content h1 { font-size: 25px; }
  .lesson-content h2 { font-size: 22px; }
  .lesson-pagination { gap: 7px; }
  .pagination-link { padding: 11px; }
}

@media (max-width: 430px) {
  :root { --header-height: 88px; }
  .topbar { padding-right: 13px; padding-left: 13px; }
  .search-control input { height: 40px; padding: 0 10px; font-size: 12px; }
  .search-results { right: 0; left: auto; width: min(380px, calc(100vw - 26px)); }
  .top-nav { width: 100%; justify-content: space-between; }
  .top-nav { gap: 7px; }
  .top-nav a { font-size: 10px; }
  .theme-toggle, .import-trigger { padding: 5px 6px; font-size: 9px; }
  .main-content { padding-right: 15px; padding-left: 15px; }
  .home-hero { align-items: start; min-height: 310px; }
  .hero-copy { max-width: 100%; }
  .hero-copy h1 { max-width: 285px; font-size: 39px; }
  .hero-stamp { position: absolute; right: 23px; bottom: 18px; width: 76px; height: 76px; }
  .stamp-word { font-size: 13px; }
  .stamp-ring { inset: -5px; }
  .hero-link { margin-top: 18px; }
  .category-card { min-height: 114px; }
  .lesson-grid { grid-template-columns: 1fr; }
  .lesson-card { min-height: 166px; }
  .site-footer { padding-right: 16px; padding-left: 16px; }
  .page-layout.has-sidebar .main-content { padding-right: 15px; padding-left: 15px; }
  .lesson-pagination { grid-template-columns: 1fr; }
  .next-link { text-align: left; }
  .import-form { padding: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
