:root {
  color-scheme: light;
  --paper: #f6f4ee;
  --surface: #fffdf8;
  --surface-2: #efede6;
  --ink: #232724;
  --muted: #6d746f;
  --line: #dcdad2;
  --accent: #536c60;
  --accent-strong: #3d574b;
  --accent-soft: #dfe8e2;
  --gift: #9b6c24;
  --gift-soft: #f3e7d0;
  --danger: #9e4f48;
  --shadow: 0 18px 60px rgba(47, 54, 49, .12);
  --sidebar: 260px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1c211e;
  --surface: #242a26;
  --surface-2: #2d342f;
  --ink: #edf0ed;
  --muted: #adb6b0;
  --line: #3c4540;
  --accent: #9bb9a9;
  --accent-strong: #bdd3c7;
  --accent-soft: #33443b;
  --gift: #e0b978;
  --gift-soft: #493b26;
  --danger: #e1aaa5;
  --shadow: 0 20px 70px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); min-width: 320px; }
button, input, select { font: inherit; }
button, select { color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 68%, transparent); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.mobile-only { display: none; }

.access-panel {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: radial-gradient(circle at 15% 10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 34rem), var(--paper);
}
.access-card { width: min(100%, 430px); padding: 42px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow); }
.access-mark { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 24px; border-radius: 16px; color: white; background: var(--accent); font: 700 24px/1 Georgia, serif; }
.access-card h1 { margin: 8px 0 12px; font: 700 clamp(28px, 7vw, 38px)/1.15 Georgia, serif; }
.access-card > p:not(.eyebrow) { margin: 0 0 26px; color: var(--muted); line-height: 1.7; }
.access-card label { display: block; margin-bottom: 8px; font-weight: 700; }
.access-card input { width: 100%; min-height: 48px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--paper); }
.access-card button { width: 100%; min-height: 48px; margin-top: 14px; border: 0; border-radius: 12px; color: white; background: var(--accent); font-weight: 700; cursor: pointer; }
.access-card button:disabled { opacity: .65; cursor: wait; }
.access-card small { display: block; margin-top: 16px; color: var(--muted); text-align: center; }
.visitor-contact { position: fixed; left: calc(var(--sidebar) + 16px); right: auto; bottom: 18px; z-index: 41; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin: 0; }
.visitor-contact.is-raised { bottom: 92px; }
.visitor-contact[hidden], .visitor-contact-panel[hidden], .visitor-contact img[hidden], .visitor-contact-image-label[hidden], #visitor-contact-copy[hidden], #gift-contact-open[hidden], #vip-join-open[hidden] { display: none; }
#visitor-contact-toggle { width: 52px; height: 52px; padding: 0; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--accent); box-shadow: var(--shadow); cursor: pointer; }
#visitor-contact-toggle svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
#visitor-contact-toggle svg circle { fill: currentColor; stroke: none; }
#visitor-contact-toggle[aria-expanded="true"] { background: var(--accent); color: white; }
.visitor-contact-panel { position: relative; width: min(340px, calc(100vw - min(760px, 100vw - 280px) - var(--sidebar) - 32px)); padding: 28px 18px 18px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.visitor-contact-panel:not(:has(img:not([hidden]))) { width: min(280px, calc(100vw - 28px)); padding-top: 28px; }
.visitor-contact-kicker { margin: 0 0 5px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-align: center; }
.visitor-contact-title { margin: 0; color: var(--ink); font-size: 20px; font-weight: 800; text-align: center; }
.visitor-contact-description { margin: 8px 0 16px; color: var(--muted); font-size: 13px; line-height: 1.65; text-align: center; }
.visitor-contact-image-label { margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 700; text-align: center; }
.visitor-contact-panel img { display: block; width: 100%; height: auto; max-height: min(280px, 58vh); aspect-ratio: 1; object-fit: contain; border-radius: 16px; background: white; }
#visitor-contact-close { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--ink) 6%, transparent); color: var(--muted); font-size: 20px; cursor: pointer; }
#visitor-contact-copy { width: 100%; min-height: 42px; margin-top: 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 14px; font-weight: 700; cursor: pointer; }
#visitor-contact-copy:hover { border-color: var(--accent); color: var(--accent); }
#visitor-contact-hide { width: 100%; min-height: 32px; margin-top: 2px; border: 0; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
#visitor-contact-hide:hover { color: var(--ink); }
.visitor-contact-dismiss { margin: 10px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
@media (hover: hover) and (pointer: fine) {
  #visitor-contact-close, .visitor-contact-dismiss { display: none; }
}
.access-error { margin: 10px 0 0 !important; color: var(--danger) !important; font-weight: 700; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 28px 18px 20px; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(18px); display: flex; flex-direction: column; z-index: 30; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; }
.brand__mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--accent); color: white; font-family: Georgia, serif; font-size: 19px; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 15px; letter-spacing: .02em; }
.brand span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.category-nav { flex: 1; min-height: 0; overflow: auto; }
.nav-heading { margin: 22px 12px 8px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.nav-item { width: 100%; border: 0; background: transparent; border-radius: 10px; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; text-align: left; color: var(--muted); }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.is-active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.nav-item--gift { color: var(--gift); }
.nav-item--join { color: var(--accent); }
.nav-count { min-width: 24px; padding: 2px 7px; text-align: center; border-radius: 999px; background: color-mix(in srgb, var(--surface) 75%, transparent); font-size: 11px; }
.sidebar__foot { padding: 15px 10px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; display: flex; gap: 8px; align-items: center; }
.signal { width: 7px; height: 7px; border-radius: 50%; background: #6d9a7f; box-shadow: 0 0 0 4px color-mix(in srgb, #6d9a7f 16%, transparent); }

.workspace { margin-left: var(--sidebar); min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; height: 74px; display: flex; align-items: center; gap: 12px; padding: 14px clamp(22px, 4vw, 58px); border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent); background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: blur(16px); }
.search-wrap { flex: 1; max-width: 720px; height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.search-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent); }
.search-wrap input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search-wrap kbd { color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; background: var(--surface-2); font-size: 11px; }
.icon-button, .text-button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.icon-button { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }
.text-button { min-height: 36px; padding: 7px 12px; border-radius: 9px; }
.icon-button:hover, .text-button:hover { border-color: var(--accent); color: var(--accent-strong); }

#main-content { width: min(1120px, calc(100% - 44px)); margin: 0 auto; padding: 54px 0 90px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; padding: 20px 0 42px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 12px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.hero h1 { margin: 0; max-width: 680px; font-family: Georgia, "Songti SC", serif; font-size: clamp(32px, 4.5vw, 56px); font-weight: 560; line-height: 1.1; letter-spacing: -.03em; }
.hero p:last-child { max-width: 650px; margin: 18px 0 0; color: var(--muted); line-height: 1.7; }
.course-updated { display: inline-flex; align-items: center; width: fit-content; margin: 2px 0 0; padding: 4px 8px; border-radius: 999px; background: #fff4df; color: #9a5b12; font-size: 12px; font-weight: 750; line-height: 1.3; }
.catalog-stats { display: flex; gap: 12px; margin: 0; }
.catalog-stats div { min-width: 82px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.catalog-stats dt { color: var(--muted); font-size: 11px; }
.catalog-stats dd { margin: 4px 0 0; font-family: Georgia, serif; font-size: 25px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; padding: 24px 0; }
.filters label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 650; }
.filters select { min-width: 130px; height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 0 32px 0 10px; background: var(--surface); }
.filters .text-button { margin-left: auto; }
.results-heading { display: flex; justify-content: space-between; align-items: baseline; margin: 8px 0 14px; }
.results-heading h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 23px; }
.results-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.course-list { display: grid; gap: 10px; scroll-margin-top: 18px; }
.course-pager { display: flex; justify-content: center; align-items: center; gap: 16px; margin: 22px 0 8px; }
.course-pager button { min-height: 40px; padding: 0 18px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-weight: 700; cursor: pointer; }
.course-pager button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.course-pager button:disabled { opacity: .45; cursor: default; }
.course-pager span { color: var(--muted); font-size: 13px; }
.course-card { border: 1px solid var(--line); border-radius: 15px; background: var(--surface); overflow: hidden; transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.course-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: 0 12px 30px rgba(51, 64, 57, .08); }
.course-card__hit { width: 100%; border: 0; background: transparent; color: inherit; display: grid; grid-template-columns: 116px minmax(0, 1fr) 28px; gap: 18px; align-items: center; padding: 13px; text-align: left; }
.course-cover { aspect-ratio: 16 / 10; overflow: hidden; border-radius: 10px; background: var(--surface-2); }
.course-cover img { width: 100%; height: 100%; object-fit: cover; }
.course-card__body { min-width: 0; display: grid; gap: 6px; }
.course-card__top { display: flex; gap: 8px; align-items: center; }
.course-code { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .06em; }
.course-badges { display: flex; gap: 6px; }
.badge, .tag { border-radius: 999px; padding: 3px 8px; font-size: 10px; }
.badge { color: var(--accent-strong); background: var(--accent-soft); }
.badge--gift { color: var(--gift); background: var(--gift-soft); }
.badge--complete { color: #247348; background: #e7f6ec; }
.badge--syncing { color: #9a5b12; background: #fff4df; }
.detail-badges .badge--complete, .detail-badges .badge--syncing { padding: 5px 10px; font-size: 12px; font-weight: 750; }
.course-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; }
.course-summary { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.course-meta, .course-tags { display: flex; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: 11px; }
.tag { padding: 2px 7px; border: 1px solid var(--line); }
.course-arrow { color: var(--muted); font-size: 30px; font-weight: 200; }

.state-card { min-height: 260px; border: 1px dashed var(--line); border-radius: 16px; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 34px; color: var(--muted); text-align: center; background: color-mix(in srgb, var(--surface) 70%, transparent); }
.state-card strong { color: var(--ink); font-size: 18px; }
.state-card p { max-width: 440px; margin: 0 0 6px; line-height: 1.6; }
.state-card button { border: 1px solid var(--line); border-radius: 9px; padding: 8px 14px; background: var(--surface); }
.state-card--error strong { color: var(--danger); }
.loader { width: 26px; height: 26px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.detail-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(23, 28, 25, .28); backdrop-filter: blur(3px); }
.course-detail { --detail-bar: 58px; position: fixed; inset: 0 0 0 auto; z-index: 40; width: min(760px, calc(100% - 280px)); overflow-x: hidden; overflow-y: auto; overscroll-behavior-x: none; overscroll-behavior-y: contain; border-left: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.detail-toolbar { position: sticky; top: 0; z-index: 3; min-height: var(--detail-bar); display: flex; justify-content: space-between; align-items: center; padding: 8px 22px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); }
.detail-toolbar span { font-size: 13px; font-weight: 750; }
.detail-nav { position: sticky; top: var(--detail-bar); z-index: 2; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px max(18px, calc((100% - 680px) / 2)) 10px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); }
.detail-nav button { border: 1px solid transparent; border-radius: 999px; padding: 5px 12px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; }
.detail-nav button:hover, .detail-nav button.is-active { border-color: color-mix(in srgb, var(--accent) 28%, var(--line)); background: var(--accent-soft); color: var(--accent-strong); }
.detail-content { width: min(100%, 680px); min-width: 0; margin: 0 auto; padding: 18px 22px 88px; overflow-wrap: anywhere; word-break: break-word; font-size: 14px; line-height: 1.65; }
.detail-hero { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.detail-hero > * { min-width: 0; max-width: 100%; }
.detail-cover { display: block; width: auto; max-width: min(100%, 520px); max-height: 500px; height: auto; margin: 0 auto; border-radius: 12px; object-fit: contain; background: var(--surface-2); }
.detail-code { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .07em; }
.detail-title { margin: 4px 0 8px; font-family: Georgia, "Songti SC", serif; font-size: 22px; font-weight: 650; line-height: 1.35; letter-spacing: -.01em; }
.detail-badges, .detail-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.detail-section { min-width: 0; max-width: 100%; margin-top: 26px; }
.course-detail.has-detail-nav .detail-section { scroll-margin-top: calc(var(--detail-bar) + 56px); }
.detail-section h2 { margin: 0 0 10px; font-family: Georgia, "Songti SC", serif; font-size: 16px; }
.markdown { min-width: 0; max-width: 100%; color: var(--ink); font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; word-break: break-word; }
.markdown > * { max-width: 100%; }
.markdown h2, .markdown h3 { margin: 1.15em 0 .4em; font-size: 15px; line-height: 1.45; }
.markdown h3 { font-size: 14px; }
.markdown p { margin: .5em 0; }
.markdown a { color: var(--accent-strong); text-underline-offset: 3px; overflow-wrap: anywhere; word-break: break-all; }
.markdown ul, .markdown ol { max-width: 100%; padding-inline-start: 1.4em; }
.markdown li + li { margin-top: .35em; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--line); }
.info-grid div:last-child:nth-child(odd),
.info-grid .info-span,
.info-grid .detail-wechat { grid-column: 1 / -1; }
.info-grid div { padding: 10px 12px; background: var(--surface); }
.detail-wechat { display: flex; align-items: center; gap: 8px; }
.detail-wechat svg { width: 22px; height: 22px; flex: none; color: #07c160; }
.detail-wechat span { color: var(--muted); font-size: 12px; font-weight: 700; }
.detail-wechat strong { min-width: 0; color: #00b34d; font-size: 16px; font-weight: 800; overflow-wrap: anywhere; user-select: text; }
.detail-wechat button { margin-left: auto; border: 0; padding: 0; background: transparent; color: #00b34d; font-size: 13px; font-weight: 700; cursor: pointer; }
[data-theme="dark"] .detail-wechat svg,
[data-theme="dark"] .detail-wechat strong,
[data-theme="dark"] .detail-wechat button { color: #3dff8a; }
.info-grid dt { color: var(--muted); font-size: 11px; }
.info-grid dd { margin: 4px 0 0; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.gallery { display: grid; grid-template-columns: 1fr; gap: 14px; }
.gallery button { display: block; width: 100%; border: 0; border-radius: 12px; padding: 0; overflow: hidden; background: var(--surface-2); }
.gallery img { display: block; width: 100%; height: auto; object-fit: contain; }
.image-missing { min-height: 150px; display: grid; place-items: center; padding: 18px; color: var(--muted); text-align: center; }
.chapter { border-top: 1px solid var(--line); }
.chapter:last-child { border-bottom: 1px solid var(--line); }
.chapter summary { display: flex; align-items: center; gap: 10px; margin: 3px 0; padding: 10px 12px; border-radius: 10px; list-style: none; cursor: pointer; font-size: 14px; font-weight: 650; transition: background .15s ease, color .15s ease; }
.chapter summary::-webkit-details-marker { display: none; }
.chapter summary::marker { content: ""; }
.chapter > summary:hover { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent-strong); box-shadow: inset 3px 0 0 var(--accent); }
.chapter-chevron { flex: none; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 6px; background: var(--accent-soft); color: var(--accent-strong); }
.chapter-chevron::before { content: ""; width: 5px; height: 5px; margin-top: -1px; margin-left: -1px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); }
.chapter[open] > summary .chapter-chevron::before { margin-top: 1px; margin-left: 0; transform: rotate(45deg); }
.chapter > summary:hover .chapter-chevron, .chapter > summary:hover .chapter-hint { background: var(--accent); color: #fff; }
.chapter-title { min-width: 0; overflow-wrap: anywhere; }
.chapter-aside { margin-left: auto; display: flex; align-items: center; gap: 8px; flex: none; }
.chapter-hint { padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-size: 11px; font-weight: 700; }
.chapter-hint::before { content: "展开"; }
.chapter[open] > summary .chapter-hint::before { content: "收起"; }
.chapter-count { flex: 0 0 auto; color: var(--muted); font-size: 11px; font-weight: 500; }
.chapter > summary:hover .chapter-count { color: var(--accent-strong); }
.chapter-items { margin: 0 2px 12px; padding: 0 0 0 28px; color: var(--muted); font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.chapter-children { margin: 0 0 12px 16px; padding-left: 12px; border-left: 1px solid var(--line); }
.chapter-children > .chapter { border-top-color: color-mix(in srgb, var(--line) 70%, transparent); }
.chapter-children > .chapter > summary { font-size: 13px; font-weight: 640; }
.detail-chapter-tools { position: fixed; right: 24px; bottom: 22px; z-index: 41; display: flex; gap: 8px; padding: 7px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.detail-note { margin-top: 36px; padding: 18px 20px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 10px 10px 0; color: var(--muted); line-height: 1.65; font-size: 13px; }
.gift-select-button { width: 100%; margin-top: 18px; border: 1px solid color-mix(in srgb, var(--gift) 48%, var(--line)); border-radius: 11px; padding: 11px 15px; background: var(--gift-soft); color: var(--gift); font-weight: 750; }
.gift-select-button.is-selected { background: var(--gift); color: #fff; }

.gift-selection { position: fixed; left: calc(var(--sidebar) + 24px); right: 24px; bottom: 18px; z-index: 35; display: flex; align-items: center; justify-content: flex-end; gap: 10px; max-width: 850px; margin-left: auto; padding: 11px 12px 11px 17px; border: 1px solid color-mix(in srgb, var(--gift) 38%, var(--line)); border-radius: 15px; background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.gift-selection > div { min-width: 0; margin-right: auto; }
.gift-selection strong, .gift-selection span { display: block; }
.gift-selection > div > span { margin-top: 2px; color: var(--muted); font-size: 11px; }
.gift-copy { border: 0; border-radius: 10px; padding: 10px 15px; background: var(--gift); color: white; font-weight: 750; }
.gift-contact { border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line)); border-radius: 10px; padding: 9px 14px; background: var(--accent-soft); color: var(--accent); font-weight: 750; }
.gift-contact:hover { border-color: var(--accent); }
.copy-dialog { width: min(560px, calc(100% - 28px)); border: 1px solid var(--line); border-radius: 15px; padding: 24px; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.copy-dialog::backdrop { background: rgba(20, 24, 22, .48); }
.copy-dialog h2 { margin: 0 0 8px; font-family: Georgia, "Songti SC", serif; }
.copy-dialog p { color: var(--muted); line-height: 1.6; }
.copy-dialog textarea { width: 100%; min-height: 190px; resize: vertical; border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--paper); color: var(--ink); line-height: 1.6; }

.lightbox { width: min(1100px, calc(100vw - 36px)); height: min(820px, calc(100vh - 36px)); border: 0; border-radius: 16px; padding: 24px 66px; background: #121513; color: white; box-shadow: var(--shadow); }
.lightbox::backdrop { background: rgba(7, 9, 8, .8); backdrop-filter: blur(7px); }
.lightbox figure { height: 100%; margin: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 12px; place-items: center; }
.lightbox img { max-height: 100%; max-width: 100%; object-fit: contain; }
.lightbox figcaption { color: #c8ceca; font-size: 13px; }
.lightbox__close, .lightbox__nav { position: absolute; border: 0; background: rgba(255, 255, 255, .1); color: white; border-radius: 50%; }
.lightbox__close { top: 15px; right: 15px; width: 40px; height: 40px; font-size: 25px; }
.lightbox__nav { top: 50%; width: 44px; height: 44px; margin-top: -22px; font-size: 34px; }
.lightbox__nav--prev { left: 12px; }
.lightbox__nav--next { right: 12px; }

@media (max-width: 900px) {
  .hero { align-items: flex-start; flex-direction: column; }
  .course-detail { width: calc(100% - 80px); }
  .detail-hero { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
  :root { --sidebar: min(86vw, 310px); }
  .mobile-only { display: grid; }
  .sidebar { transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.is-open { transform: translateX(0); }
  .workspace { margin-left: 0; }
  .topbar { height: 66px; padding: 10px 14px; }
  .search-wrap kbd { display: none; }
  #main-content { width: min(100% - 28px, 680px); padding: 28px 0 70px; }
  .hero { gap: 22px; padding: 12px 0 28px; }
  .hero h1 { font-size: 35px; }
  .catalog-stats { width: 100%; }
  .catalog-stats div { flex: 1; min-width: 0; padding: 11px 12px; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; }
  .filters select { width: 100%; min-width: 0; }
  .filters .text-button { margin: 0; }
  .results-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .course-card__hit { grid-template-columns: 94px minmax(0, 1fr) 16px; gap: 12px; padding: 10px; }
  .course-summary, .course-tags { display: none; }
  .course-updated { font-size: 11px; }
  .course-detail { inset: 0; width: 100%; border: 0; }
  .detail-content { padding: 24px 18px 90px; }
  .detail-hero { grid-template-columns: 1fr; }
  .detail-cover { width: auto; max-width: 100%; max-height: 340px; }
  .info-grid, .gallery { grid-template-columns: 1fr; }
  .detail-chapter-tools { right: 12px; bottom: 12px; }
  .lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; border-radius: 0; padding: 58px 42px 26px; }
  .visitor-contact { left: 12px; right: auto; bottom: 12px; z-index: 36; }
  .visitor-contact-panel, .visitor-contact-panel:not(:has(img:not([hidden]))) { width: min(320px, calc(100vw - 28px)); }
  .visitor-contact.is-raised { bottom: 108px; }
  .gift-selection { left: 12px; right: 12px; bottom: 10px; flex-wrap: wrap; }
  .gift-selection > div { flex: 1 0 100%; }
}

@media (min-width: 761px) {
  .detail-cover { max-height: 320px; }
}

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


/* Open details over the frozen list, without a page-navigation flash. */
.course-detail[aria-hidden="false"]{animation:detail-enter .16s ease-out}
.detail-backdrop:not([hidden]){animation:detail-backdrop-enter .16s ease-out}
@keyframes detail-enter{from{opacity:.85;transform:translateX(18px)}to{opacity:1;transform:translateX(0)}}
@keyframes detail-backdrop-enter{from{opacity:0}to{opacity:1}}
@media(prefers-reduced-motion:reduce){.course-detail[aria-hidden="false"],.detail-backdrop:not([hidden]){animation:none}}
