:root {
  --bg: #f6f4ef; --surface: #ffffff; --surface-2: #efece5; --text: #1c1b19; --muted: #7a766d;
  --line: rgba(0,0,0,.08); --accent: #c2571a; --accent-soft: rgba(194,87,26,.12);
  --shadow: 0 10px 30px -12px rgba(40,30,10,.25); --radius: 18px;
  --safe-top: env(safe-area-inset-top); --safe-bottom: env(safe-area-inset-bottom);
  --ui: "Inter", -apple-system, system-ui, sans-serif; --serif: "Literata", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121214; --surface: #1c1c1f; --surface-2: #26262a; --text: #ecebe8; --muted: #9a9890;
    --line: rgba(255,255,255,.08); --accent: #f08a4b; --accent-soft: rgba(240,138,75,.15);
    --shadow: 0 10px 30px -12px rgba(0,0,0,.7); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121214; --surface: #1c1c1f; --surface-2: #26262a; --text: #ecebe8; --muted: #9a9890;
  --line: rgba(255,255,255,.08); --accent: #f08a4b; --accent-soft: rgba(240,138,75,.15);
  --shadow: 0 10px 30px -12px rgba(0,0,0,.7); color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--ui); }
body { min-height: 100dvh; -webkit-font-smoothing: antialiased; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* ---------- layout ---------- */
#view { padding: calc(var(--safe-top) + 20px) 16px calc(var(--safe-bottom) + 96px); max-width: 1200px; margin: 0 auto; }
.tabbar {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--safe-bottom) + 12px); display: flex; gap: 4px; padding: 6px;
  background: color-mix(in srgb, var(--surface) 78%, transparent); backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6); border: 1px solid var(--line); border-radius: 999px; box-shadow: var(--shadow);
}
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 20px; border-radius: 999px; color: var(--muted); font-size: 11px; font-weight: 500; transition: .2s; }
.tabbar a.active { color: var(--accent); background: var(--accent-soft); }
.tabbar .brand { display: none; }
@media (min-width: 900px) {
  .tabbar { left: 0; top: 0; bottom: 0; transform: none; flex-direction: column; width: 220px; border-radius: 0; border-width: 0 1px 0 0; padding: calc(var(--safe-top) + 24px) 14px; box-shadow: none; gap: 6px; }
  .tabbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; padding: 0 12px 20px; color: var(--accent); }
  .tabbar a { flex-direction: row; gap: 12px; font-size: 15px; padding: 11px 14px; border-radius: 12px; }
  #view { margin-left: 220px; padding: calc(var(--safe-top) + 32px) 40px 48px; }
}

h1.page { font-size: clamp(28px, 5vw, 38px); letter-spacing: -.02em; margin: 6px 0 18px; font-weight: 700; }
h2.sec { font-size: 20px; margin: 28px 0 14px; display: flex; justify-content: space-between; align-items: baseline; letter-spacing: -.01em; }
h2.sec a { font-size: 14px; color: var(--accent); font-weight: 500; }
.muted { color: var(--muted); }

/* ---------- search ---------- */
.search-box { position: sticky; top: calc(var(--safe-top) + 8px); z-index: 5; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 4px 6px 4px 14px; box-shadow: var(--shadow); }
.search-box svg { color: var(--muted); flex: none; }
.search-box input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font: inherit; font-size: 17px; color: var(--text); padding: 12px 0; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; margin: 14px 0 4px; }
.seg button { border: 0; background: none; padding: 7px 16px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.1); }

/* ---------- grids & cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 22px 16px; }
@media (min-width: 700px) { .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 28px 22px; } }
.card { display: flex; flex-direction: column; gap: 8px; text-align: left; border: 0; background: none; padding: 0; animation: rise .35s ease both; }
.card .t { font-weight: 600; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .a { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cover { position: relative; aspect-ratio: 2/3; border-radius: 6px 12px 12px 6px; overflow: hidden; background: var(--surface-2); box-shadow: var(--shadow), inset 3px 0 0 rgba(0,0,0,.08); transition: transform .25s; }
.card:hover .cover { transform: translateY(-4px); }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover .ph { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 14px 12px; color: #fff; font-family: var(--serif); }
.cover .ph b { font-size: 15px; line-height: 1.25; font-weight: 600; }
.cover .ph i { font-size: 11px; opacity: .85; font-style: normal; font-family: var(--ui); }
.cover .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0,0,0,.25); }
.cover .bar span { display: block; height: 100%; background: var(--accent); }
.badge { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; padding: 3px 7px; border-radius: 99px; font-weight: 600; backdrop-filter: blur(6px); }

.list { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; }
.row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--line); background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; width: 100%; }
.row:last-child { border-bottom: 0; }
.row:active { background: var(--surface-2); }
.row .ava { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #fff; flex: none; }
.row .txt { flex: 1; min-width: 0; }
.row .txt b { display: block; font-weight: 600; font-size: 15px; }
.row .txt span { font-size: 13px; color: var(--muted); }
.row > svg { color: var(--muted); width: 18px; flex: none; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 9px 15px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; font-weight: 500; white-space: nowrap; }
.chip:hover { border-color: var(--accent); color: var(--accent); }

.hero { display: grid; grid-template-columns: 110px 1fr; gap: 18px; align-items: center; background: linear-gradient(135deg, var(--accent-soft), transparent 70%), var(--surface);
  border: 1px solid var(--line); border-radius: 24px; padding: 18px; margin-bottom: 8px; cursor: pointer; }
.hero .cover { width: 110px; }
.hero small { text-transform: uppercase; letter-spacing: .08em; font-size: 11px; color: var(--accent); font-weight: 700; }
.hero h3 { font-family: var(--serif); font-size: 22px; margin: 6px 0 4px; line-height: 1.2; }
.hero .prog { height: 6px; background: var(--surface-2); border-radius: 9px; margin: 14px 0 6px; overflow: hidden; }
.hero .prog span { display: block; height: 100%; background: var(--accent); border-radius: 9px; }

.more { display: block; margin: 28px auto 0; padding: 12px 28px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty svg { width: 54px; height: 54px; stroke-width: 1.2; opacity: .5; }
.empty h3 { color: var(--text); margin: 12px 0 6px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 500; border: 0; background: none; padding: 0; margin-bottom: 4px; }

.skel { background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.spinner { width: 34px; height: 34px; border: 3px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.center { display: grid; place-items: center; padding: 60px 0; }

/* ---------- bottom sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: .25s; z-index: 40; backdrop-filter: blur(2px); }
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow-y: auto; background: var(--surface); border-radius: 26px 26px 0 0;
  padding: 10px 20px calc(var(--safe-bottom) + 24px); transform: translateY(105%); transition: transform .35s cubic-bezier(.2,.9,.3,1); box-shadow: 0 -10px 40px rgba(0,0,0,.2); }
.sheet.open { transform: none; }
@media (min-width: 700px) {
  .sheet { left: 50%; right: auto; bottom: 50%; width: min(640px, 92vw); border-radius: 26px; transform: translate(-50%, 60%) scale(.96); opacity: 0; max-height: 86dvh; padding: 24px 28px 28px; transition: .3s cubic-bezier(.2,.9,.3,1); pointer-events: none; }
  .sheet.open { transform: translate(-50%, 50%); opacity: 1; pointer-events: auto; }
  .sheet .grabber { display: none; }
}
.grabber { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 0 auto 14px; }
.bk { display: grid; grid-template-columns: 120px 1fr; gap: 18px; }
@media (min-width: 700px) { .bk { grid-template-columns: 160px 1fr; gap: 24px; } }
.bk h2 { font-family: var(--serif); font-size: 22px; line-height: 1.2; margin: 2px 0 8px; }
.bk .authors a { color: var(--accent); font-weight: 500; }
.bk .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.bk .meta span { font-size: 12px; background: var(--surface-2); padding: 4px 9px; border-radius: 99px; color: var(--muted); }
.desc { font-family: var(--serif); line-height: 1.6; font-size: 15px; margin: 18px 0 0; white-space: pre-line; color: var(--text); opacity: .9; }
.actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.btn { flex: 1; min-width: 130px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 14px 18px; border-radius: 14px; border: 0; font-weight: 600; font-size: 15px; background: var(--surface-2); }
.btn.primary { background: var(--accent); color: #fff; }
.btn svg { width: 19px; height: 19px; }
.formats { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; margin-top: 14px; }
.formats a { text-align: center; padding: 11px 6px; border-radius: 12px; border: 1px solid var(--line); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.formats a:hover { border-color: var(--accent); color: var(--accent); }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin-top: 22px; }

.toast { position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 96px); transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; opacity: 0; pointer-events: none; transition: .25s; z-index: 100; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- reader ---------- */
.reader { --r-bg: #fbfaf7; --r-text: #23211d; --r-muted: #8b877d; --r-ui: rgba(251,250,247,.9);
  position: fixed; inset: 0; z-index: 60; background: var(--r-bg); color: var(--r-text); display: flex; flex-direction: column; }
.reader[data-rt="sepia"] { --r-bg: #f4ecd8; --r-text: #4b3a26; --r-muted: #9a8669; --r-ui: rgba(244,236,216,.92); }
.reader[data-rt="gray"] { --r-bg: #3a3a3c; --r-text: #e2e1dc; --r-muted: #a09f9a; --r-ui: rgba(58,58,60,.92); }
.reader[data-rt="dark"] { --r-bg: #000000; --r-text: #c9c7c1; --r-muted: #77756f; --r-ui: rgba(20,20,20,.92); }
.reader[hidden] { display: none; }
.r-top, .r-bottom { position: absolute; left: 0; right: 0; z-index: 3; background: var(--r-ui); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); transition: transform .25s, opacity .25s; }
.r-top { top: 0; display: flex; align-items: center; gap: 4px; padding: calc(var(--safe-top) + 6px) 8px 6px; border-bottom: 1px solid rgba(128,128,128,.15); }
.r-bottom { bottom: 0; padding: 12px 20px calc(var(--safe-bottom) + 12px); border-top: 1px solid rgba(128,128,128,.15); }
.reader.immersive .r-top { transform: translateY(-100%); opacity: 0; pointer-events: none; }
.reader.immersive .r-bottom { transform: translateY(100%); opacity: 0; pointer-events: none; }
.r-title { flex: 1; min-width: 0; text-align: center; }
.r-title b, .r-title span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r-title b { font-size: 14px; }
.r-title span { font-size: 12px; color: var(--r-muted); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; border-radius: 12px; color: var(--r-text); flex: none; }
.icon-btn:active { background: rgba(128,128,128,.15); }
.r-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--r-muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
#rSlider { width: 100%; accent-color: var(--accent); }

.r-stage { position: absolute; inset: 0; padding: calc(var(--safe-top) + 34px) var(--r-pad, 28px) calc(var(--safe-bottom) + 34px); }
.r-pages { width: 100%; height: 100%; overflow: hidden; position: relative; }
.r-content { height: 100%; font-family: var(--r-font, var(--serif)); font-size: var(--r-size, 19px); line-height: var(--r-lh, 1.6);
  text-align: justify; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; column-fill: auto; }
.reader.scroll .r-pages { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.reader.scroll .r-content { height: auto; columns: auto !important; max-width: 720px; margin: 0 auto; padding-bottom: 40px; }
.reader.scroll .r-stage { padding-top: calc(var(--safe-top) + 10px); padding-bottom: 0; }
.r-content p { margin: 0; text-indent: 1.5em; }
.r-content h1, .r-content h2, .r-content h3, .r-content h4 { text-align: center; text-indent: 0; line-height: 1.3; break-after: avoid; hyphens: none; }
.r-content h2 { font-size: 1.45em; margin: 1.2em 0 1em; font-weight: 600; }
.r-content h3 { font-size: 1.2em; margin: 1.2em 0 .8em; font-weight: 600; }
.r-content h4 { font-size: 1.05em; margin: 1em 0 .6em; }
.r-content h2 + p, .r-content h3 + p, .r-content h4 + p, .r-content .gap + p { text-indent: 0; }
.r-content .gap { height: 1em; }
.r-content figure { margin: 1em 0; text-align: center; break-inside: avoid; }
.r-content img { max-width: 100%; max-height: 70vh; border-radius: 4px; }
.r-content blockquote { margin: 1em 0 1em 1.5em; font-style: italic; }
.r-content .epigraph { margin-left: 30%; font-size: .9em; }
.r-content .epigraph p, .r-content blockquote p, .r-content .poem p { text-indent: 0; text-align: left; }
.r-content .author { text-align: right; font-style: italic; margin-top: .4em; }
.r-content .poem { margin: 1em 0 1em 1.5em; }
.r-content .stanza { margin-bottom: .8em; break-inside: avoid; }
.r-content .tbl { overflow-x: auto; }
.r-content table { border-collapse: collapse; font-size: .85em; margin: 1em 0; }
.r-content td, .r-content th { border: 1px solid rgba(128,128,128,.3); padding: 4px 8px; text-indent: 0; }
.r-content a.note { color: var(--accent); cursor: pointer; font-size: .8em; vertical-align: super; line-height: 0; }
.r-content .chapter-end { text-align: center; color: var(--r-muted); padding: 2em 0; font-family: var(--ui); font-size: 14px; text-indent: 0; break-inside: avoid; }
.r-content .chapter-end button { margin-top: 12px; border: 0; background: var(--accent); color: #fff; padding: 12px 22px; border-radius: 12px; font-weight: 600; }

.r-loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--r-muted); background: var(--r-bg); z-index: 5; }
.r-loading[hidden] { display: none; }
.panel { position: absolute; z-index: 8; top: 0; bottom: 0; right: 0; width: min(380px, 88vw); background: var(--r-bg); color: var(--r-text); box-shadow: -10px 0 40px rgba(0,0,0,.25);
  transform: translateX(105%); transition: transform .3s cubic-bezier(.2,.9,.3,1); overflow-y: auto; padding: calc(var(--safe-top) + 20px) 20px calc(var(--safe-bottom) + 20px); }
.panel.open { transform: none; }
.panel h3 { margin: 0 0 14px; font-size: 20px; }
.panel ol { list-style: none; padding: 0; margin: 0; }
.panel li { padding: 12px 10px; border-radius: 10px; cursor: pointer; font-size: 15px; line-height: 1.35; }
.panel li.cur { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.panel li:hover { background: rgba(128,128,128,.12); }
.settings .grp { margin-bottom: 22px; }
.settings .grp > span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--r-muted); font-weight: 600; margin-bottom: 10px; }
.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button { flex: 1; padding: 12px; border-radius: 12px; border: 1px solid rgba(128,128,128,.25); background: none; font-size: 16px; font-weight: 600; }
.stepper output { min-width: 50px; text-align: center; font-variant-numeric: tabular-nums; }
.themes { display: flex; gap: 10px; }
.themes button { flex: 1; height: 48px; border-radius: 12px; border: 2px solid transparent; font-weight: 600; font-family: var(--serif); font-size: 18px; }
.themes button.on, .opts button.on { border-color: var(--accent); }
.opts { display: flex; gap: 8px; }
.opts button { flex: 1; padding: 11px 6px; border-radius: 12px; border: 2px solid rgba(128,128,128,.25); background: none; font-size: 14px; }
.note-pop { position: absolute; z-index: 9; left: 16px; right: 16px; bottom: calc(var(--safe-bottom) + 16px); max-height: 45%; overflow-y: auto; background: var(--r-ui); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(128,128,128,.25); border-radius: 18px; padding: 16px 20px; font-family: var(--serif); font-size: 16px; line-height: 1.5; box-shadow: 0 10px 40px rgba(0,0,0,.25); display: none; max-width: 640px; margin: 0 auto; }
.note-pop.open { display: block; animation: rise .2s; }
.note-pop p { margin: 0 0 .5em; }

/* ---------- v2 ---------- */
.cover img { position: absolute; inset: 0; z-index: 1; opacity: 0; transition: opacity .3s; }
.cover img.ok { opacity: 1; }
.cover .bar, .cover .badge { z-index: 2; }
.tabbar a { padding: 8px 14px; }
@media (min-width: 900px) { .tabbar a { padding: 11px 14px; } }
.search-box .clear { border: 0; background: var(--surface-2); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); flex: none; }
.search-box .clear svg { width: 16px; height: 16px; }
.search-box .clear[hidden] { display: none; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 14px 0 6px; }
.filters .seg { margin: 0; }
.seg.small button { padding: 6px 12px; font-size: 13px; }
#results { margin-top: 6px; transition: opacity .15s; }
#results.busy { opacity: .55; }
.rs h2.sec { margin-top: 22px; }
.people { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 10px; scrollbar-width: none; scroll-snap-type: x proximity; }
.people::-webkit-scrollbar { display: none; }
.person { flex: none; width: 128px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 16px 10px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; transition: transform .2s, border-color .2s; }
.person:hover { transform: translateY(-2px); border-color: var(--accent); }
.person b { font-size: 13px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.person span { font-size: 12px; color: var(--muted); }
.ava { border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; flex: none; letter-spacing: .02em; }
.person .ava { font-size: 19px; }
.author-head { display: flex; align-items: center; gap: 16px; margin: 10px 0 4px; }
.author-head .ava { font-size: 26px; }
.recent { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.recent .row svg:first-child { color: var(--muted); }
.slink { color: inherit !important; font-size: inherit !important; font-weight: 700 !important; }
h2.sec .slink:hover { color: var(--accent) !important; }
.shelf { display: grid; grid-auto-flow: column; grid-auto-columns: 120px; gap: 14px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.shelf::-webkit-scrollbar { display: none; }
.serlink { display: inline-block; margin-top: 6px; font-size: 13px; color: var(--muted); }
.serlink:hover { color: var(--accent); }
.gfilter { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 14px; padding: 12px 14px; font: inherit; font-size: 16px; color: var(--text); outline: none; margin-bottom: 14px; }
.gfilter:focus { border-color: var(--accent); }
.ggroup { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; margin-bottom: 10px; overflow: hidden; }
.ggroup summary { list-style: none; display: flex; align-items: center; gap: 12px; padding: 16px; cursor: pointer; }
.ggroup summary::-webkit-details-marker { display: none; }
.ggroup summary b { flex: 1; font-weight: 600; }
.ggroup summary svg { width: 18px; color: var(--muted); transition: transform .2s; }
.ggroup[open] summary svg { transform: rotate(90deg); }
.gdot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.gitems { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 16px; }
.gitems .chip { white-space: normal; }
.reader.pdfmode .r-bottom { display: none; }
.reader.pdfmode .r-stage { padding: calc(var(--safe-top) + 64px) 12px calc(var(--safe-bottom) + 12px); }
.reader.pdfmode .r-pages { overflow: auto; }
.pdfbox { display: flex; flex-direction: column; gap: 12px; height: 100%; }
.pdfbox .btn { flex: none; }
.pdfbox iframe { flex: 1; width: 100%; border: 0; border-radius: 12px; background: #fff; }
.r-err { max-width: 420px; padding: 0 20px; text-align: center; color: var(--r-text); }
.r-err .actions { justify-content: center; }
