:root {
  --blue: #3B82F6; --blue-d: #2563EB; --green: #059669; --purple: #7C3AED; --orange: #F97316;
  --ink: #0F172A; --body: #334155; --muted: #64748B; --line: #E2E8F0; --soft: #F8FAFC;
  --serif: "Source Serif 4", Georgia, serif; --text: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 12px; --shadow: 0 2px 10px rgba(15, 23, 42, .06); --ease: 200ms ease; --wrap: 1320px;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 20px; }
body { margin: 0; font: 400 15px/1.55 var(--text); color: var(--body); background: #fff; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; color: var(--ink); line-height: 1.2; }
h1, h2 { font-family: var(--serif); letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; }
svg { display: block; }
.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 28px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--blue); color: #fff; padding: 10px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 6px; }
.fine { font-size: 12px; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent; font: 600 14px/1 var(--text); cursor: pointer; text-decoration: none; transition: background var(--ease), border-color var(--ease), color var(--ease); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-d); }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: #CBD5E1; background: var(--soft); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 13px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--muted); cursor: pointer; transition: all var(--ease); }
.icon-btn:hover { color: var(--ink); border-color: #CBD5E1; }
.icon-btn[aria-pressed="true"] { color: var(--blue); border-color: #BFDBFE; background: #EFF6FF; }
.icon-btn[aria-pressed="true"] .i { fill: currentColor; }
.link { display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 0; border: 0; background: none; color: var(--blue-d); font: 600 14px/1 var(--text); cursor: pointer; text-decoration: none; }

/* header */
.top { border-bottom: 1px solid var(--line); background: #fff; }
.top-in { display: flex; align-items: center; gap: 24px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font: 700 22px/1 var(--serif); color: var(--ink); text-decoration: none; }
.logo-mark { display: flex; align-items: flex-end; gap: 2px; height: 24px; }
.logo-mark i { width: 6px; border-radius: 2px; background: var(--blue); }
.logo-mark i:nth-child(1) { height: 22px; } .logo-mark i:nth-child(2) { height: 16px; background: var(--green); transform: rotate(-10deg); } .logo-mark i:nth-child(3) { height: 20px; background: var(--purple); }
.top-links { display: flex; gap: 4px; margin-left: auto; }
.top-links a { display: inline-flex; align-items: center; gap: 6px; padding: 10px 12px; font-weight: 500; text-decoration: none; color: var(--body); border-radius: 8px; }
.top-links a:hover { background: var(--soft); }
.rl-link b { min-width: 22px; padding: 2px 6px; border-radius: 999px; background: #EFF6FF; color: var(--blue-d); font-size: 12px; text-align: center; }

/* hero */
.hero { padding: 56px 0 36px; text-align: center; background: #fff; }
h1 { font-size: clamp(34px, 4.6vw, 54px); font-weight: 700; }
.sub { margin-top: 10px; font-size: 18px; color: var(--muted); }
.search-wrap { position: relative; max-width: 640px; margin: 28px auto 0; z-index: 20; }
.search { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 16px; border: 2px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow); transition: border-color var(--ease), box-shadow var(--ease); }
.search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(59, 130, 246, .15); }
.s-ico { color: var(--muted); width: 20px; height: 20px; }
.search input { flex: 1; min-width: 0; min-height: 44px; border: 0; outline: 0; font: 400 16px/1 var(--text); color: var(--ink); background: transparent; }
.search input::-webkit-search-cancel-button { display: none; }
.s-clear { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 8px; background: var(--soft); color: var(--muted); cursor: pointer; }
.s-clear[hidden] { display: none; }
.s-go { min-height: 44px; }
.sugg { position: absolute; left: 0; right: 0; top: calc(100% + 6px); list-style: none; margin: 0; padding: 6px; border-radius: 12px; background: #fff; border: 1px solid var(--line); box-shadow: 0 16px 40px rgba(15, 23, 42, .12); text-align: left; }
.sugg[hidden] { display: none; }
.sugg li { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border-radius: 8px; cursor: pointer; color: var(--ink); }
.sugg li[aria-selected="true"], .sugg li:hover { background: #EFF6FF; }
.sugg small { margin-left: auto; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.sg-k { color: var(--muted); }
.search-wrap.stuck { position: fixed; top: 0; left: 0; right: 0; max-width: none; margin: 0; padding: 8px 12px; background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); box-shadow: 0 2px 10px rgba(15, 23, 42, .08); z-index: 45; }
.chips { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font: 500 13px/1 var(--text); color: var(--body); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .i { width: 15px; height: 15px; }
.stats { list-style: none; padding: 0; margin: 28px auto 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 0; font-size: 14px; color: var(--muted); }
.stats li { padding: 0 20px; }
.stats li + li { border-left: 1px solid var(--line); }
.stats b { color: var(--ink); font-family: var(--serif); font-size: 18px; }

/* layout */
.layout { display: grid; grid-template-columns: 280px 1fr; gap: 32px; padding-top: 24px; padding-bottom: 64px; border-top: 1px solid var(--line); }
.filters { align-self: start; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; padding-right: 6px; }
.f-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.f-head h2 { font: 700 18px/1 var(--text); }
.f-close, .f-apply { display: none; }
fieldset { border: 0; border-bottom: 1px solid var(--line); margin: 0; padding: 14px 0; }
legend { padding: 0; margin-bottom: 6px; font-size: 12px; font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: .08em; }
.cb { display: flex; align-items: center; gap: 10px; min-height: 36px; cursor: pointer; font-size: 14px; color: var(--body); }
.cb input { width: 18px; height: 18px; margin: 0; accent-color: var(--blue); flex: none; }
.cb small { margin-left: auto; font-size: 12px; color: var(--muted); }
.tdot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--c); }
.more[hidden] { display: none; }
.range { position: relative; height: 36px; }
.r-track { position: absolute; left: 0; right: 0; top: 16px; height: 4px; border-radius: 2px; background: var(--line); }
.r-track i { position: absolute; top: 0; bottom: 0; background: var(--blue); border-radius: 2px; }
.range input { position: absolute; left: 0; right: 0; top: 0; width: 100%; height: 36px; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.range input::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 3px solid var(--blue); cursor: grab; }
.range input::-moz-range-thumb { pointer-events: auto; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 3px solid var(--blue); cursor: grab; }
.range input::-webkit-slider-runnable-track { background: transparent; }
.r-out { font-size: 13px; font-weight: 600; color: var(--ink); }
.filters > .link { margin-top: 10px; }

/* results */
.r-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.r-count { color: var(--muted); }
.r-count b { color: var(--ink); }
.r-ctrl { display: flex; align-items: center; gap: 8px; }
.f-btn { display: none; }
.views { display: flex; gap: 4px; }
.view.on { color: #fff; background: var(--ink); border-color: var(--ink); }
.sort select { min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: 500 14px/1 var(--text); color: var(--ink); }
.pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 12px 0 18px; min-height: 4px; }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border-radius: 999px; border: 1px solid #BFDBFE; background: #EFF6FF; color: var(--blue-d); font: 500 13px/1 var(--text); cursor: pointer; }
.pill .i { width: 14px; height: 14px; }
.cards.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.card { position: relative; display: flex; flex-direction: column; border-radius: var(--r); background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); overflow: hidden; transition: transform var(--ease), box-shadow var(--ease); }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--blue); opacity: 0; transition: opacity var(--ease); z-index: 1; }
.card:hover { transform: translateY(-4px); box-shadow: 0 16px 32px rgba(15, 23, 42, .1); }
.card:hover::before { opacity: 1; }
.thumb { position: relative; aspect-ratio: 16 / 9; background: var(--soft); overflow: hidden; }
.thumb svg { width: 100%; height: 100%; }
.thumb.book { display: grid; place-items: center; padding: 16px 0; background: linear-gradient(180deg, #F1F5F9, #E2E8F0); }
.thumb.book svg { width: auto; height: 100%; aspect-ratio: 2 / 3; border-radius: 3px 6px 6px 3px; box-shadow: 6px 8px 16px rgba(15, 23, 42, .25); }
.play { position: absolute; top: 50%; left: 50%; display: grid; place-items: center; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%; background: rgba(255, 255, 255, .92); color: var(--purple); }
.play .i { fill: currentColor; }
.dur { position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 6px; background: rgba(15, 23, 42, .78); color: #fff; font-size: 12px; font-weight: 600; }
.dur .i { width: 11px; height: 11px; fill: currentColor; }
.c-body { display: flex; flex-direction: column; gap: 6px; padding: 16px; flex: 1; }
.badges { display: flex; justify-content: space-between; gap: 6px; }
.type { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px; background: color-mix(in srgb, var(--tc) 12%, white); color: var(--tc); font-size: 12px; font-weight: 700; }
.type .i { width: 13px; height: 13px; }
.acc { padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.acc.fr { background: #F1F5F9; color: var(--body); } .acc.pr { background: #FEF3C7; color: #92400E; } .acc.oa { background: #D1FAE5; color: #047857; }
.card h3 { font: 700 18px/1.3 var(--serif); }
.t-link { padding: 0; border: 0; background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.t-link:hover { color: var(--blue-d); text-decoration: underline; }
.by { font-size: 14px; color: var(--muted); }
.meta { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--body); }
.meta .i { width: 14px; height: 14px; }
.rate { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink); }
.rate .i { width: 14px; height: 14px; color: #F59E0B; fill: #F59E0B; }
.rate small { font-weight: 400; color: var(--muted); }
.prog { height: 6px; margin-top: 4px; border-radius: 3px; background: #FFEDD5; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--orange); }
.prog-t { font-size: 12px; font-weight: 600; color: #C2410C; }
.acts { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 10px; }
.acts .btn-blue { margin-right: auto; }
/* list view */
.cards.list { display: grid; gap: 10px; }
.cards.list .card { flex-direction: row; align-items: center; gap: 14px; padding: 10px 12px; }
.cards.list .card:hover { transform: none; }
.cards.list .thumb { flex: none; width: 60px; height: 80px; aspect-ratio: auto; border-radius: 6px; padding: 0; }
.cards.list .thumb.book svg { height: 80px; box-shadow: none; }
.cards.list .play, .cards.list .dur { display: none; }
.cards.list .c-body { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "t a" "b a" "m a"; gap: 2px 14px; padding: 0; }
.cards.list .badges { grid-area: m; justify-content: flex-start; order: 3; }
.cards.list h3 { grid-area: t; font-size: 16px; }
.cards.list .by { grid-area: b; font-size: 13px; }
.cards.list .meta, .cards.list .rate, .cards.list .prog, .cards.list .prog-t { display: none; }
.cards.list .acts { grid-area: a; margin: 0; padding: 0; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.pager { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin-top: 28px; }
.pg { min-width: 44px; min-height: 42px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font: 600 14px/1 var(--text); color: var(--ink); cursor: pointer; }
.pg.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.demo-note { margin-top: 16px; text-align: center; font-size: 12px; color: var(--muted); }

/* collections etc */
.sec { padding: 56px 0; }
.sec.tint { background: var(--soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sec-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.sec-head h2 { display: flex; align-items: center; gap: 8px; font-size: 26px; }
.col-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 40px; }
.rl-n { color: var(--muted); font-size: 14px; }
.rl-n b { color: var(--ink); }
.rl-items { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.rl-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-align: left; cursor: pointer; font: inherit; }
.rl-item:hover { border-color: #BFDBFE; }
.rl-th { width: 44px; height: 60px; flex: none; border-radius: 4px; overflow: hidden; }
.rl-th svg { width: 100%; height: 100%; }
.rl-item b { display: block; font: 600 14px/1.3 var(--serif); color: var(--ink); }
.rl-item small { color: var(--muted); font-size: 12px; }
.cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.col { display: grid; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r); background: #fff; text-align: left; cursor: pointer; font: inherit; transition: box-shadow var(--ease), transform var(--ease); }
.col:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.mosaic { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; margin-bottom: 8px; }
.mosaic span { overflow: hidden; }
.mosaic svg { width: 100%; height: 100%; }
.col b { font: 700 16px/1.3 var(--serif); color: var(--ink); }
.col small { font-size: 13px; color: var(--muted); }
.recent { list-style: none; padding: 0 0 8px; margin: 0; display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; }
.recent li { flex: 0 0 180px; scroll-snap-align: start; }
.rv { display: grid; gap: 8px; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; font: inherit; }
.rv-th { display: block; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.rv-th svg { width: 100%; height: 100%; }
.rv-t { display: flex; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink); }
.rv-t span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rv-t .i { width: 14px; height: 14px; color: var(--muted); margin-top: 2px; }

/* footer */
.foot { background: var(--ink); color: #94A3B8; padding: 48px 0 28px; font-size: 14px; }
.foot-top { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 32px; }
.news label { color: #fff; }
.news-row { display: flex; gap: 8px; margin-top: 10px; }
.news input { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid #334155; background: #1E293B; color: #fff; font: 400 15px/1 var(--text); }
.news-msg { min-height: 20px; margin-top: 8px; color: #93C5FD; }
.foot h3 { color: #fff; font-size: 14px; margin-bottom: 6px; }
.foot-top a { display: block; padding: 10px 0; text-decoration: none; }
.foot-top a:hover { color: #fff; }
.copy { margin-top: 32px; padding-top: 20px; border-top: 1px solid #1E293B; }
.note { margin-top: 6px; font-size: 12px; color: #64748B; }

/* dialog */
.dlg { width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 16px; box-shadow: 0 40px 80px rgba(15, 23, 42, .3); color: var(--body); }
.dlg::backdrop { background: rgba(15, 23, 42, .55); }
.dlg-x { position: absolute; top: 10px; right: 10px; }
.dlg-body { display: grid; gap: 12px; padding: 28px; }
.kicker { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.dlg h2 { font-size: 26px; padding-right: 40px; }
.player { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; }
.player svg { width: 100%; height: 100%; }
.play.big { width: 64px; height: 64px; margin: -32px 0 0 -32px; }
.reader { padding: 18px; border-radius: 12px; background: #FFFBF2; border: 1px solid #F3E8D2; font: 400 17px/1.7 var(--serif); color: var(--ink); }
.r-h { font: 700 13px/1 var(--text); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 8px; }
.mods { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.mods li { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px; background: var(--soft); color: var(--ink); }
.mods li .i { color: #CBD5E1; }
.mods li.done .i { color: var(--orange); }
.cites { display: grid; gap: 12px; }
.cites > div { padding: 14px; border-radius: 10px; background: var(--soft); border: 1px solid var(--line); }
.cites b { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.cites p { margin: 6px 0 10px; font-family: var(--serif); color: var(--ink); }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 90; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; transition: opacity var(--ease), transform var(--ease); max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.scrim { position: fixed; inset: 0; z-index: 54; background: rgba(15, 23, 42, .45); }
.scrim[hidden] { display: none; }

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

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
  .filters { position: fixed; top: 0; bottom: 0; left: 0; z-index: 55; width: min(340px, 88vw); max-height: none; padding: 16px 20px 24px; background: #fff; box-shadow: 20px 0 40px rgba(15, 23, 42, .2); transform: translateX(-105%); visibility: hidden; transition: transform 260ms ease, visibility 260ms; }
  .filters.open { transform: none; visibility: visible; }
  .f-close { display: inline-grid; }
  .f-apply { display: flex; width: 100%; margin-top: 14px; position: sticky; bottom: 0; box-shadow: 0 -12px 16px #fff; }
  .filters { overflow-y: auto; height: 100vh; height: 100dvh; }
  .f-btn { display: inline-flex; }
  .cards.grid { grid-template-columns: repeat(2, 1fr); }
  .col-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .top-links a:not(.rl-link) { display: none; }
  .hero { padding: 36px 0 28px; }
  .sub { font-size: 16px; }
  .search { padding-left: 12px; }
  .s-go { display: none; }
  .stats li { padding: 4px 10px; font-size: 13px; }
  .stats li:nth-child(3) { border-left: 0; }
  .r-head { flex-direction: column; align-items: stretch; }
  .r-ctrl { justify-content: space-between; }
  .cards.grid { grid-template-columns: 1fr; }
  .cards.list .c-body { grid-template-columns: 1fr; grid-template-areas: "t" "b" "m" "a"; }
  .cards.list .acts { margin-top: 6px; }
  .btn-sm, .icon-btn, .chip, .pill, .cb, .link, .pg, .sort select, .btn { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  .cols { grid-template-columns: 1fr; }
  .foot-top { grid-template-columns: 1fr 1fr; }
  .news { grid-column: 1 / -1; }
}
