/* Geography: an earthy, map-like look (deep pine, sand, ochre), deliberately unlike the Maths site. */
:root {
  --bg: #f3efe6;
  --bg-2: #ebe5d8;
  --card: #fffdf8;
  --ink: #17282a;
  --ink-2: #44585a;
  --muted: #6f7f7d;
  --line: #d9d1c0;
  --pine: #1d5c4f;
  --pine-2: #2a7a67;
  --pine-soft: #dcebe4;
  --ochre: #c9861f;
  --ochre-soft: #f6e6c6;
  --clay: #b5523b;
  --clay-soft: #f5ddd5;
  --sky: #3d6f96;
  --sky-soft: #dde8f1;
  --good: #2f8a5b;
  --shadow: 0 1px 2px rgba(23, 40, 42, .06), 0 6px 20px rgba(23, 40, 42, .06);
  --radius: 14px;
  --head: "Fraunces", Georgia, serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101a19; --bg-2: #15211f; --card: #182523; --ink: #e8efe9; --ink-2: #b9c7c1; --muted: #8b9c97; --line: #2b3a37;
    --pine: #5fb49c; --pine-2: #7fcbb4; --pine-soft: #1c3631; --ochre: #e6ad4d; --ochre-soft: #3a2f1b; --clay: #e3876f; --clay-soft: #3b2420;
    --sky: #86b3d6; --sky-soft: #1d2d3a; --good: #6cc796; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
  }
  :root:not([data-theme="light"]) body { background-color: #101a19; }
}
:root[data-theme="dark"] {
  --bg: #101a19; --bg-2: #15211f; --card: #182523; --ink: #e8efe9; --ink-2: #b9c7c1; --muted: #8b9c97; --line: #2b3a37;
  --pine: #5fb49c; --pine-2: #7fcbb4; --pine-soft: #1c3631; --ochre: #e6ad4d; --ochre-soft: #3a2f1b; --clay: #e3876f; --clay-soft: #3b2420;
  --sky: #86b3d6; --sky-soft: #1d2d3a; --good: #6cc796; --shadow: 0 1px 2px rgba(0,0,0,.3); color-scheme: dark;
}
:root[data-theme="dark"] body { background-color: #101a19; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.55 var(--body); color: var(--ink); background: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='520' viewBox='0 0 520 520'%3E%3Cg fill='none' stroke='%23b8ab90' stroke-opacity='.18' stroke-width='1.2'%3E%3Cpath d='M-20 120c80-40 160 30 260 0s180-70 300-20'/%3E%3Cpath d='M-20 160c90-40 170 30 270 0s170-60 290-15'/%3E%3Cpath d='M-20 330c100 30 180-40 280-10s160 60 280 10'/%3E%3Cpath d='M-20 370c100 30 170-30 270-5s170 55 290 5'/%3E%3Cellipse cx='380' cy='250' rx='60' ry='34'/%3E%3Cellipse cx='380' cy='250' rx='32' ry='16'/%3E%3C/g%3E%3C/svg%3E");
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--head); font-weight: 600; letter-spacing: -.01em; line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.08rem; }
a { color: var(--pine); }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }

/* ---------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: 10px max(16px, env(safe-area-inset-left)); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: var(--head); font-weight: 600; font-size: 1.15rem; margin-right: 6px; }
.brand img { width: 32px; height: 32px; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 7px 12px; border-radius: 999px; color: var(--ink-2); text-decoration: none; white-space: nowrap; font-weight: 500; font-size: .95rem; }
.nav a:hover { background: var(--bg-2); }
.nav a.on { background: var(--pine); color: #fff; }
:root[data-theme="dark"] .nav a.on { color: #0d1a17; }
.search { position: relative; }
.search input { width: 220px; padding: 8px 12px 8px 34px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search-results { position: absolute; right: 0; top: calc(100% + 6px); width: min(420px, 92vw); max-height: 70vh; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.search-results button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.search-results button:hover, .search-results button.sel { background: var(--bg-2); }
.search-results small { display: block; color: var(--muted); }
.icon-btn { border: 1px solid var(--line); background: var(--card); width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center; cursor: pointer; flex: none; }
.icon-btn:hover { border-color: var(--pine); }
.ico { width: 18px; height: 18px; }

/* ---------- layout */
main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 80px; }
.view-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.view-head p { margin: 0; color: var(--ink-2); max-width: 60ch; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .72rem; font-weight: 700; color: var(--ochre); margin-bottom: 4px; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.card h3 { margin-bottom: 6px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 500; text-decoration: none; color: var(--ink); }
.btn:hover { border-color: var(--pine); }
.btn.primary { background: var(--pine); border-color: var(--pine); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #0d1a17; }
.btn.small { padding: 5px 10px; font-size: .86rem; border-radius: 8px; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-2); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: .76rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--bg-2); color: var(--ink-2); white-space: nowrap; }
.chip.t-phys { background: var(--sky-soft); color: var(--sky); }
.chip.t-hum { background: var(--ochre-soft); color: #8a5a10; }
:root[data-theme="dark"] .chip.t-hum { color: var(--ochre); }
.chip.auto { background: transparent; border: 1px dashed var(--line); color: var(--muted); font-weight: 500; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.seg button { border: 0; background: none; padding: 6px 12px; cursor: pointer; font-size: .9rem; }
.seg button.on { background: var(--pine-soft); color: var(--pine); font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.filters input[type="search"], .filters select { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.filters input[type="search"] { flex: 1; min-width: 200px; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }

/* ---------- progress */
.bar { height: 8px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--pine), var(--pine-2)); border-radius: 99px; transition: width .4s; }
.ring { --p: 0; width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--pine) calc(var(--p) * 1%), var(--bg-2) 0); }
.ring > div { width: 92px; height: 92px; border-radius: 50%; background: var(--card); display: grid; place-items: center; text-align: center; }
.ring b { font-family: var(--head); font-size: 1.6rem; display: block; line-height: 1; }
.rag { display: inline-flex; gap: 4px; }
.rag button { border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 3px 9px; font-size: .78rem; cursor: pointer; color: var(--ink-2); }
.rag button.on[data-v="1"] { background: var(--clay-soft); border-color: var(--clay); color: var(--clay); }
.rag button.on[data-v="2"] { background: var(--ochre-soft); border-color: var(--ochre); color: #8a5a10; }
.rag button.on[data-v="3"] { background: var(--pine-soft); border-color: var(--pine); color: var(--pine); }

/* ---------- home */
.hero { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; background: linear-gradient(135deg, #1d5c4f, #143c34); color: #f4efe3; border-radius: 20px; padding: 26px 28px; margin-bottom: 20px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='200'%3E%3Cg fill='none' stroke='%23fff' stroke-opacity='.08' stroke-width='1.5'%3E%3Cpath d='M0 150c60-40 120-20 200-50s140-40 200-10'/%3E%3Cpath d='M0 170c60-40 130-20 210-50s130-40 190-10'/%3E%3Cpath d='M0 190c60-40 140-20 220-50s120-40 180-10'/%3E%3C/g%3E%3C/svg%3E") right bottom / 600px no-repeat; pointer-events: none; }
.hero h1 { color: #fff; }
.hero p { margin: 0 0 14px; color: #d8e6df; max-width: 52ch; }
.hero .ring { background: conic-gradient(var(--ochre) calc(var(--p) * 1%), rgba(255,255,255,.16) 0); }
.hero .ring > div { background: #17463d; color: #fff; }
.hero .btn { background: #f4efe3; color: #17282a; border-color: transparent; }
.home-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.topic-row { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line); cursor: pointer; border-radius: 8px; }
.topic-row:last-child { border-bottom: 0; }
.topic-row:hover { background: var(--bg-2); }
.badge { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-family: var(--head); font-weight: 700; font-size: 1.05rem; }
.badge.phys { background: var(--sky-soft); color: var(--sky); }
.badge.hum { background: var(--ochre-soft); color: #8a5a10; }
:root[data-theme="dark"] .badge.hum { color: var(--ochre); }
.kw-day { border-left: 4px solid var(--ochre); }
.kw-day .term { font-family: var(--head); font-size: 1.3rem; font-weight: 600; }

/* ---------- course / contents */
.paper { margin-bottom: 28px; }
.paper > h2 { display: flex; align-items: center; gap: 10px; }
.topic-card { cursor: pointer; transition: transform .15s, border-color .15s; display: flex; flex-direction: column; gap: 10px; }
.topic-card:hover { transform: translateY(-2px); border-color: var(--pine); }
.topic-card .top { display: flex; gap: 12px; align-items: center; }
.topic-card.off { opacity: .5; }
.topic-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.topic-head .badge { width: 60px; height: 60px; font-size: 1.4rem; border-radius: 16px; }
.eq { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; box-shadow: var(--shadow); overflow: hidden; }
.eq > summary { list-style: none; cursor: pointer; padding: 16px 18px; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; }
.eq > summary::-webkit-details-marker { display: none; }

.eq-num { align-self: start; justify-self: start; font-family: var(--head); font-weight: 700; color: var(--pine); background: var(--pine-soft); border-radius: 10px; padding: 4px 10px; }
.eq-title { font-family: var(--head); font-weight: 600; font-size: 1.05rem; }
.eq-body { padding: 0 18px 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.eq-body h4 { margin: 4px 0 8px; font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.obj { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: .93rem; }
.obj:last-child { border-bottom: 0; }
.sec { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; }
.sec:hover { background: var(--bg-2); }
.sec.sub { padding-left: 34px; font-size: .92rem; color: var(--ink-2); }
.sec a { flex: 1; color: var(--ink); text-decoration: none; cursor: pointer; }
.sec .pg { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.tick { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--line); background: var(--card); cursor: pointer; display: grid; place-items: center; flex: none; padding: 0; }
.tick.on { background: var(--pine); border-color: var(--pine); color: #fff; }
.tick svg { width: 13px; height: 13px; }
.eq-tools { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }

/* ---------- reader */
.reader { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.reader-bar { position: sticky; top: 58px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; margin-bottom: 12px; box-shadow: var(--shadow); }
.reader-bar .ttl { flex: 1; min-width: 160px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reader-bar input { width: 64px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); text-align: center; }
.pages { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.page { background: #fff; box-shadow: var(--shadow); border-radius: 6px; position: relative; width: 100%; max-width: var(--pw, 820px); }
.page canvas { width: 100%; height: auto; display: block; border-radius: 6px; }
.page .pnum { position: absolute; top: 8px; right: 10px; font-size: .75rem; background: rgba(0,0,0,.55); color: #fff; padding: 1px 8px; border-radius: 99px; }
:root[data-theme="dark"] .page.dim canvas { filter: invert(.9) hue-rotate(180deg); }
.side { position: sticky; top: 58px; max-height: calc(100vh - 74px); overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.side .card { padding: 14px; }
.tabs { display: flex; gap: 4px; margin-bottom: 10px; }
.tabs button { flex: 1; border: 0; background: var(--bg-2); padding: 7px; border-radius: 8px; cursor: pointer; font-size: .88rem; font-weight: 500; }
.tabs button.on { background: var(--pine); color: #fff; }
.notes-area { width: 100%; min-height: 260px; resize: vertical; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); line-height: 1.5; }
.saved { font-size: .78rem; color: var(--muted); }
.mini { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.mini:last-child { border-bottom: 0; }
.mini b { display: block; }

/* ---------- keywords */
.az { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 14px; }
.az button { border: 0; background: none; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.az button:hover:not(:disabled) { background: var(--bg-2); }
.az button.on { background: var(--pine); color: #fff; }
.az button:disabled { opacity: .3; cursor: default; }
.kw { display: flex; flex-direction: column; gap: 8px; }
.kw .term { font-family: var(--head); font-weight: 600; font-size: 1.12rem; }
.kw p { margin: 0; font-size: .95rem; color: var(--ink-2); }
.kw .foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: auto; }
.star { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 1.15rem; line-height: 1; padding: 2px; }
.star.on { color: var(--ochre); }
.flash { max-width: 620px; margin: 0 auto; text-align: center; }
.flashcard { perspective: 1200px; height: 300px; cursor: pointer; margin: 18px 0; }
.flashcard .inner { position: relative; width: 100%; height: 100%; transition: transform .5s; transform-style: preserve-3d; }
.flashcard.flip .inner { transform: rotateY(180deg); }
.flashcard .face { position: absolute; inset: 0; backface-visibility: hidden; display: grid; place-items: center; padding: 26px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.flashcard .front { font-family: var(--head); font-size: 1.8rem; font-weight: 600; }
.flashcard .back { transform: rotateY(180deg); font-size: 1.05rem; text-align: left; }
.flash-actions { display: flex; gap: 10px; justify-content: center; }
.box-dots { display: flex; gap: 6px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }

/* ---------- case studies */
.case { display: flex; flex-direction: column; gap: 10px; }
.case .place { font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--clay); }
.case h3 { font-size: 1.1rem; margin: 0; }
.case p { margin: 0; color: var(--ink-2); font-size: .94rem; }
.case ul { margin: 0; padding-left: 18px; font-size: .9rem; color: var(--ink-2); }
.case ul li { margin: 3px 0; }
.case .foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: auto; padding-top: 6px; }
.case textarea { width: 100%; min-height: 80px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--bg); font-size: .9rem; }
.case.mine { border-left: 4px solid var(--ochre); }

/* ---------- writing */
.writing { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 16px; align-items: start; }
.qlist { max-height: calc(100vh - 160px); overflow: auto; padding: 8px; }
.qitem { padding: 10px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; }
.qitem:hover { background: var(--bg-2); }
.qitem.on { border-color: var(--pine); background: var(--pine-soft); }
.qitem .meta { display: flex; gap: 6px; margin-bottom: 4px; flex-wrap: wrap; }
.qitem .q { font-size: .92rem; }
.marks { font-weight: 700; color: var(--clay); }
.editor { display: flex; flex-direction: column; gap: 12px; }
.editor .question { font-family: var(--head); font-size: 1.2rem; font-weight: 600; }
.editor textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: var(--card); line-height: 1.65; font-size: 1rem; resize: vertical; }
.editor .plan { min-height: 110px; }
.editor .answer { min-height: 380px; font-family: "Literata", Georgia, serif; }
.timer { font-family: var(--head); font-variant-numeric: tabular-nums; font-size: 1.35rem; font-weight: 600; }
.timer.over { color: var(--clay); }
.guide { background: var(--ochre-soft); border-radius: 12px; padding: 12px 14px; font-size: .93rem; }
.checks label { display: flex; gap: 8px; align-items: start; padding: 4px 0; font-size: .93rem; }
.drafts .mini { cursor: pointer; }

/* ---------- notes */
.note-card { cursor: pointer; }
.note-card pre { white-space: pre-wrap; font: inherit; font-size: .9rem; color: var(--ink-2); margin: 6px 0 0; max-height: 9em; overflow: hidden; }

/* ---------- settings sheet */
.sheet { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(10, 20, 18, .45); padding: 16px; }
.sheet .card { width: min(560px, 100%); max-height: 88vh; overflow: auto; }
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.set-row:last-child { border-bottom: 0; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 60; font-size: .92rem; box-shadow: var(--shadow); }

/* ---------- login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(440px, 100%); text-align: center; padding: 32px 28px; }
.login-card img { width: 56px; height: 56px; margin-bottom: 10px; }
.login-card p { color: var(--ink-2); }
.login-card .btn { width: 100%; justify-content: center; padding: 11px; margin-top: 8px; }
.login-msg { min-height: 1.4em; color: var(--clay); font-size: .92rem; }

/* ---------- small screens */
@media (max-width: 900px) {
  .reader, .writing, .home-cols { grid-template-columns: 1fr; }
  .side { position: static; max-height: none; }
  .eq-body { grid-template-columns: 1fr; }
  .search input { width: 150px; }
  .qlist { max-height: 320px; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .nav { order: 3; flex-basis: 100%; }
  .search { flex: 1; }
  .search input { width: 100%; }
  .hero { grid-template-columns: 1fr; padding: 20px; }
  .hero .ring { display: none; }
  .reader-bar { top: 104px; }
  .eq > summary { grid-template-columns: auto 1fr; }
  .eq > summary > span:last-child { grid-column: 1 / -1; }
  .obj { grid-template-columns: 1fr; gap: 6px; }
  .topic-head { align-items: flex-start; }
}
@media print {
  .topbar, .filters, .reader-bar, .btn, .icon-btn { display: none !important; }
  body { background: #fff; }
}

/* ---------- integrated book viewer */
main:has(.viewer) { max-width: none; padding-top: 12px; }
.viewer { display: grid; grid-template-columns: 280px minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.viewer.toc-off { grid-template-columns: minmax(0, 1fr) 340px; }
.viewer.toc-off .toc { display: none; }
.vmain { min-width: 0; }
.toc { position: sticky; top: 70px; max-height: calc(100vh - 86px); overflow: auto; padding: 10px; font-size: .9rem; }
.toc-h { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 4px 6px 8px; }
.toc-t > summary { list-style: none; cursor: pointer; display: flex; gap: 8px; align-items: center; padding: 6px; border-radius: 8px; font-weight: 600; line-height: 1.25; }
.toc-t > summary::-webkit-details-marker { display: none; }
.toc-t > summary:hover { background: var(--bg-2); }
.badge.sm { width: 30px; height: 30px; border-radius: 8px; font-size: .8rem; flex: none; }
.toc-eq { margin: 2px 0 6px 10px; padding: 4px 6px; border-left: 2px solid var(--line); }
.toc-eq.on { border-left-color: var(--pine); background: var(--pine-soft); border-radius: 0 8px 8px 0; }
.toc-eq > a { display: block; cursor: pointer; color: var(--ink); text-decoration: none; padding: 3px 0 5px; line-height: 1.3; }
.toc-eq > a b { color: var(--pine); }
.toc-s { display: flex; align-items: center; gap: 7px; padding: 3px 0; }
.toc-s a { flex: 1; cursor: pointer; color: var(--ink-2); text-decoration: none; line-height: 1.25; }
.toc-s a:hover, .toc-eq > a:hover { color: var(--pine); }
.toc-s .pg { color: var(--muted); font-size: .75rem; }
.toc .tick { width: 16px; height: 16px; border-radius: 5px; }
.toc .tick svg { width: 11px; height: 11px; }
.viewer .reader-bar { top: 66px; }
.viewer .side { top: 70px; }
.side-eq-t { font-family: var(--head); font-weight: 600; font-size: 1.02rem; line-height: 1.3; }
.viewer .pages { gap: 12px; }
.page { overflow: hidden; }
.textLayer { position: absolute; inset: 0; overflow: hidden; line-height: 1; text-size-adjust: none; -webkit-text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; z-index: 2; }
.textLayer span, .textLayer br { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.textLayer span.markedContent { top: 0; height: 0; }
.textLayer ::selection { background: rgba(29, 92, 79, .32); }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: -1; cursor: default; user-select: none; }
.textLayer mark.kwm { color: transparent; background: rgba(201, 134, 31, .16); border-bottom: 2px solid rgba(201, 134, 31, .75); border-radius: 2px; cursor: help; }
.no-kw .textLayer mark.kwm { background: none; border: 0; cursor: text; }
.kw-pop { position: absolute; z-index: 40; width: 320px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.18); padding: 12px 14px; font-size: .92rem; }
.kw-pop b { font-family: var(--head); font-size: 1.05rem; }
.kw-pop p { margin: 4px 0 8px; color: var(--ink-2); }
.sel-add { position: absolute; z-index: 40; box-shadow: var(--shadow); }
@media (max-width: 1100px) {
  .viewer, .viewer.toc-off { grid-template-columns: minmax(0, 1fr) 300px; }
  .viewer:not(.toc-off) .toc { display: block; position: fixed; left: 8px; top: 64px; bottom: 8px; width: min(320px, 86vw); max-height: none; z-index: 30; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
}
@media (max-width: 900px) {
  .viewer, .viewer.toc-off { grid-template-columns: 1fr; }
  .viewer .side { position: static; max-height: none; }
}
@media (max-width: 640px) { .viewer .reader-bar { top: 104px; } .viewer .reader-bar .ttl { display: none; } }
