/* GoinBook - cinematic reading. Navy, black and gold like the logo. */
@font-face { font-family: 'Literata'; src: url(../fonts/literata-latin-wght-normal.woff2) format('woff2'); font-weight: 200 900; font-style: normal; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Literata'; src: url(../fonts/literata-latin-ext-wght-normal.woff2) format('woff2'); font-weight: 200 900; font-style: normal; font-display: swap; unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Literata'; src: url(../fonts/literata-latin-wght-italic.woff2) format('woff2'); font-weight: 200 900; font-style: italic; font-display: swap; }
@font-face { font-family: 'Literata'; src: url(../fonts/literata-latin-ext-wght-italic.woff2) format('woff2'); font-weight: 200 900; font-style: italic; font-display: swap; unicode-range: U+0100-024F, U+1E00-1EFF, U+A720-A7FF; }
@font-face { font-family: 'Source Serif 4'; src: url(../fonts/source-serif-4-latin-wght-normal.woff2) format('woff2'); font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Source Serif 4'; src: url(../fonts/source-serif-4-latin-wght-italic.woff2) format('woff2'); font-weight: 200 900; font-style: italic; font-display: swap; }
@font-face { font-family: 'Lexend'; src: url(../fonts/lexend-latin-wght-normal.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'EB Garamond'; src: url(../fonts/eb-garamond-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'EB Garamond'; src: url(../fonts/eb-garamond-latin-700-normal.woff2) format('woff2'); font-weight: 600 700; font-display: swap; }
@font-face { font-family: 'EB Garamond'; src: url(../fonts/eb-garamond-latin-400-italic.woff2) format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'Atkinson Hyperlegible'; src: url(../fonts/atkinson-hyperlegible-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Atkinson Hyperlegible'; src: url(../fonts/atkinson-hyperlegible-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'OpenDyslexic'; src: url(../fonts/opendyslexic-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'OpenDyslexic'; src: url(../fonts/opendyslexic-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }

:root {
  --gold: #d9b46a; --gold-2: #f0d39a; --navy: #0b1220; --navy-2: #121b2e; --night: #05070c;
  --ui-bg: rgba(14, 19, 32, .86); --ui-fg: #ece6d8; --ui-muted: #a59d8d; --ui-line: rgba(217, 180, 106, .22);
  --page-bg: #f8f3e8; --page-bg2: #efe7d6; --ink: #2b2620; --accent: #9a6b1f;
  --font: 'Literata', Georgia, serif; --font-size: 20px; --font-weight: 400; --line-height: 1.6;
  --para-space: .4em; --letter-space: 0; --word-space: 0; --indent: 1.4em; --align: justify; --hyphens: auto;
  --dim: 0; --warmth: 0; --r: 14px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--ui-fg); font-family: 'Lexend', system-ui, -apple-system, sans-serif; font-size: 15px; overscroll-behavior: none; }
body { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
a { color: var(--gold); }
.muted { color: var(--ui-muted); }
.small { font-size: 13px; }
.error { color: #ff9b8a; }
.row { display: flex; align-items: center; } .row.gap { gap: 10px; } .row.wrap { flex-wrap: wrap; }

/* ---------- buttons and inputs ---------- */
.btn { border: 1px solid var(--ui-line); background: rgba(255,255,255,.05); color: var(--ui-fg); padding: 10px 16px; border-radius: 999px; font-weight: 500; transition: background .2s, transform .1s; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 42px; }
.btn:hover { background: rgba(255,255,255,.1); } .btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(180deg, var(--gold-2), var(--gold)); color: #1a1408; border-color: transparent; box-shadow: 0 4px 18px rgba(217,180,106,.25); }
.btn.ghost { background: transparent; }
.btn.danger { color: #ffb3a6; border-color: rgba(255,120,100,.35); background: transparent; }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: 13px; }
.btn[disabled] { opacity: .4; pointer-events: none; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; display: inline-grid; place-items: center; font-size: 22px; color: inherit; }
.icon-btn:hover { background: rgba(255,255,255,.08); }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.link { background: none; border: 0; padding: 0; color: var(--gold); text-align: left; text-decoration: underline; text-underline-offset: 3px; }
.inp { width: 100%; background: rgba(255,255,255,.06); color: var(--ui-fg); border: 1px solid var(--ui-line); border-radius: 10px; padding: 10px 12px; font: inherit; min-height: 42px; }
.inp:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
select.inp { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
select.inp option { background: var(--navy-2); }
textarea.inp, .note-text { width: 100%; min-height: 110px; background: rgba(255,255,255,.06); color: var(--ui-fg); border: 1px solid var(--ui-line); border-radius: 10px; padding: 12px; font: 16px/1.5 'Literata', Georgia, serif; resize: vertical; }
.field { display: grid; gap: 6px; margin: 12px 0; } .field > span { font-size: 13px; color: var(--ui-muted); } .field small { color: var(--ui-muted); font-size: 12px; }
.slider { display: flex; align-items: center; gap: 12px; } .slider input { flex: 1; accent-color: var(--gold); height: 30px; } .slider output { min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; color: var(--gold-2); font-size: 13px; }
.toggle { display: flex; align-items: center; gap: 12px; margin: 10px 0; cursor: pointer; min-height: 40px; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .track { width: 44px; height: 26px; border-radius: 13px; background: rgba(255,255,255,.15); position: relative; flex: none; transition: background .2s; }
.toggle .track::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle input:checked + .track { background: var(--gold); } .toggle input:checked + .track::after { transform: translateX(18px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; } .check input { accent-color: var(--gold); width: 18px; height: 18px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; background: rgba(255,255,255,.05); padding: 4px; border-radius: 12px; border: 1px solid var(--ui-line); }
.seg button { border: 0; background: transparent; padding: 8px 12px; border-radius: 9px; font-size: 13px; color: var(--ui-muted); flex: 1 1 auto; min-height: 36px; }
.seg button.on { background: rgba(217,180,106,.18); color: var(--gold-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { border: 1px solid var(--ui-line); background: transparent; border-radius: 999px; padding: 6px 12px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: rgba(217,180,106,.18); color: var(--gold-2); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------- splash ---------- */
#splash { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: #000; }
#splash img { width: min(70vmin, 520px); opacity: 0; transform: scale(.94); filter: blur(6px) brightness(.6); }
#splash.play img { animation: splashIn 1.6s cubic-bezier(.2,.7,.1,1) forwards; }
#splash.out { opacity: 0; transition: opacity .6s; }
@keyframes splashIn { 60% { opacity: 1; filter: blur(0) brightness(1.15); } 100% { opacity: 1; transform: scale(1); filter: blur(0) brightness(1); } }

/* ---------- library ---------- */
#library { position: fixed; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: calc(var(--safe-t) + 18px) clamp(14px, 4vw, 48px) calc(var(--safe-b) + 40px);
  background: radial-gradient(1200px 600px at 20% -10%, rgba(40,90,100,.28), transparent 60%), radial-gradient(900px 500px at 90% 10%, rgba(217,150,60,.16), transparent 60%), linear-gradient(180deg, #070b14, #04060a 70%); }
#library.drop { outline: 3px dashed var(--gold); outline-offset: -12px; }
.lib-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 22px; }
.lib-logo { width: 52px; height: 52px; border-radius: 12px; box-shadow: 0 0 30px rgba(217,180,106,.35); }
.lib-head h1 { font: 600 32px 'EB Garamond', Georgia, serif; margin: 0; background: linear-gradient(180deg, #f6e1ad, #c99a48); -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: .5px; }
.lib-search { flex: 1 1 220px; max-width: 420px; }
.lib-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-left: auto; }
.goal-ring { --p: 0; width: 46px; height: 46px; border-radius: 50%; border: 0; display: grid; place-items: center; background: conic-gradient(var(--gold) calc(var(--p) * 360deg), rgba(255,255,255,.1) 0); position: relative; font-size: 12px; }
.goal-ring::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; background: #0a0f1a; }
.goal-ring span { position: relative; }
.hero { display: flex; gap: 24px; align-items: center; padding: 20px; border-radius: 22px; margin-bottom: 26px; background: linear-gradient(135deg, rgba(217,180,106,.13), rgba(40,90,110,.12)); border: 1px solid var(--ui-line); box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.hero-cover { width: 120px; aspect-ratio: 2/3; object-fit: cover; border-radius: 4px 10px 10px 4px; box-shadow: -6px 0 0 rgba(0,0,0,.25) inset, 0 18px 40px rgba(0,0,0,.6); }
.hero h2 { font: 600 28px 'EB Garamond', Georgia, serif; margin: 2px 0; }
.eyebrow { text-transform: uppercase; letter-spacing: 2px; font-size: 11px; color: var(--gold); margin: 0; }
.hero-info { flex: 1; min-width: 0; } .hero-info .row { margin-top: 12px; }
.bar { height: 4px; background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; margin: 8px 0 4px; } .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); }
.lib-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; } .lib-controls .seg { flex: 0 1 auto; } .lib-controls select { width: auto; }
.shelves .shelf { position: relative; margin-bottom: 30px; }
.shelf-books { display: flex; gap: clamp(14px, 2.4vw, 30px); align-items: flex-end; padding: 0 18px; min-height: 230px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.shelf-board { height: 22px; margin-top: -4px; border-radius: 3px; background: linear-gradient(180deg, #6b4626 0%, #4a2f18 40%, #2c1b0d 100%); box-shadow: 0 14px 24px rgba(0,0,0,.6), inset 0 2px 0 rgba(255,220,170,.18); position: relative; }
.shelf-board::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 100%; background: repeating-linear-gradient(90deg, rgba(0,0,0,.08) 0 2px, transparent 2px 40px); opacity: .5; }
.book-card { position: relative; background: none; border: 0; padding: 0; text-align: left; color: inherit; flex: none; width: clamp(110px, 14vw, 150px); cursor: pointer; }
.book-card .cover-wrap { position: relative; aspect-ratio: 2/3; border-radius: 3px 8px 8px 3px; overflow: hidden; transform: perspective(900px) rotateY(-14deg); transform-origin: left center; transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s; box-shadow: -8px 10px 24px rgba(0,0,0,.55), inset 3px 0 0 rgba(255,255,255,.12); }
.book-card .cover-wrap::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 12px; background: linear-gradient(90deg, rgba(0,0,0,.45), rgba(255,255,255,.12) 60%, transparent); z-index: 2; }
.book-card:hover .cover-wrap, .book-card:focus-visible .cover-wrap { transform: perspective(900px) rotateY(-4deg) translateY(-6px); box-shadow: -4px 20px 40px rgba(0,0,0,.7), 0 0 30px rgba(217,180,106,.15); }
.book-card .cover { width: 100%; height: 100%; object-fit: cover; display: block; }
.book-card .wear { position: absolute; inset: 0; z-index: 2; opacity: var(--wear); pointer-events: none;
  background: linear-gradient(90deg, transparent calc(var(--crease) - 1px), rgba(255,255,255,.35) var(--crease), rgba(0,0,0,.25) calc(var(--crease) + 1px), transparent calc(var(--crease) + 2px)), radial-gradient(circle at 92% 6%, rgba(255,240,210,.5), transparent 18%), radial-gradient(circle at 8% 96%, rgba(255,240,210,.35), transparent 22%), linear-gradient(0deg, rgba(120,90,50,.18), transparent 30%); mix-blend-mode: screen; }
.book-card .meta { margin-top: 10px; display: grid; gap: 2px; font-size: 13px; } .book-card .meta strong { font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; } .book-card .meta span { color: var(--ui-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shelves .book-card .meta { display: none; }
.book-card .more { position: absolute; top: 4px; right: 4px; z-index: 3; width: 34px; height: 34px; font-size: 18px; background: rgba(0,0,0,.45); opacity: 0; transition: opacity .2s; }
.book-card:hover .more, .book-card:focus-within .more, .rows .book-card .more { opacity: 1; }
@media (hover: none) { .book-card .more { opacity: 1; } }
.badge { position: absolute; bottom: 8px; left: 14px; z-index: 3; background: rgba(0,0,0,.65); color: var(--gold-2); font-size: 11px; padding: 3px 8px; border-radius: 999px; }
.badge.lock { left: auto; right: 8px; }
.shelves .book-card { width: clamp(100px, 13vw, 140px); }
.shelves .book-card:hover::after { content: attr(data-title); }
.rows { display: grid; gap: 10px; }
.book-card.row { width: 100%; display: flex; gap: 16px; align-items: center; padding: 10px; border-radius: 14px; background: rgba(255,255,255,.03); border: 1px solid transparent; }
.book-card.row:hover { border-color: var(--ui-line); }
.book-card.row .cover-wrap { width: 64px; flex: none; transform: none; }
.book-card.row .meta { margin: 0; flex: 1; min-width: 0; } .book-card.row .more { position: static; }
.empty { text-align: center; padding: 40px 10px; }
.classics { margin-top: 30px; padding: 20px; border-radius: 18px; border: 1px solid var(--ui-line); background: rgba(255,255,255,.02); }
.classics h2 { font: 600 22px 'EB Garamond', Georgia, serif; margin: 0 0 4px; }
.lib-foot { text-align: center; color: var(--ui-muted); font-size: 12px; margin-top: 30px; }

/* ---------- reader stage ---------- */
#reader { position: fixed; inset: 0; background: radial-gradient(ellipse at 50% 40%, #1c1712 0%, #0c0a08 70%, #050403 100%); user-select: none; -webkit-user-select: none; }
html[data-ui=dark] #reader { background: radial-gradient(ellipse at 50% 40%, #121318 0%, #060608 75%); }
html.oled #reader { background: #000; }
.stage { position: absolute; inset: 0; display: grid; place-items: center; touch-action: none; overflow: hidden; }
.book { position: relative; transition: width .2s, height .2s; }
.book::before { content: ''; position: absolute; inset: 6px -4px -10px; background: rgba(0,0,0,.55); filter: blur(18px); border-radius: 8px; z-index: 0; }
html.oled .book::before { display: none; }
.page { position: absolute; top: 0; left: 0; overflow: hidden; background-color: var(--page-bg); color: var(--ink); z-index: 1; contain: layout paint; --age: 0; }
.page::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0; }
html[data-texture=cream] .page::before { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .35 0 0 0 0 .2 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
html[data-texture=recycled] .page::before { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.55' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .3 0 0 0 0 .22 0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
html[data-texture=parchment] .page::before { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .03' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .35 0 0 0 0 .15 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"), radial-gradient(ellipse at center, transparent 55%, rgba(120,80,30,.16)); }
html[data-texture=glossy] .page::before { background: linear-gradient(115deg, rgba(255,255,255,.18), transparent 35%, transparent 70%, rgba(255,255,255,.08)); }
.page::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 3; background: rgba(160, 110, 40, var(--age)); mix-blend-mode: multiply; }
/* inner shadow along the spine */
.spread .page[data-role] { box-shadow: none; }
.spread .book > .page:nth-of-type(n) { }
.page-body { position: absolute; overflow: hidden; z-index: 1; }
.page-head, .page-foot { position: absolute; left: 0; right: 0; z-index: 2; display: flex; justify-content: space-between; padding: 0 28px; font: 11.5px/1 'Lexend', system-ui, sans-serif; letter-spacing: .4px; color: color-mix(in srgb, var(--ink) 50%, transparent); white-space: nowrap; }
.page-head { top: 20px; justify-content: center; } .page-head .ph-title { overflow: hidden; text-overflow: ellipsis; max-width: 80%; font-style: italic; font-family: var(--font); font-size: 12.5px; }
.page-foot { bottom: 18px; font-variant-numeric: tabular-nums; }
html.no-header .page-head, html.no-footer .page-foot { display: none; }
.fixed-book .page-head, .fixed-book .page-foot { display: none; }
.page.blank .page-head, .page.blank .page-foot { display: none; }
.dogear { position: absolute; top: 0; right: 0; width: 34px; height: 34px; z-index: 4; display: none; background: linear-gradient(225deg, var(--night) 50%, color-mix(in srgb, var(--page-bg) 80%, #000) 50%); box-shadow: -2px 2px 4px rgba(0,0,0,.25); }
.page.bookmarked .dogear { display: block; }
#reader[data-rtl='1'] .dogear { right: auto; left: 0; transform: scaleX(-1); }

/* spine shading for two-page spreads */
.spread .page[data-slot=c], .spread .page[data-slot=d] { box-shadow: inset -26px 0 30px -18px rgba(0,0,0,.28); }
.spread .page[data-slot=a], .spread .page[data-slot=b] { box-shadow: inset 26px 0 30px -18px rgba(0,0,0,.28); }
html.oled .spread .page { box-shadow: none !important; }

/* book thickness at the edges (#112) */
.edges { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.edges i { position: absolute; top: 2px; bottom: 2px; background: repeating-linear-gradient(90deg, color-mix(in srgb, var(--page-bg) 85%, #000) 0 1px, var(--page-bg2) 1px 2px); border-radius: 2px; }
.edges .edge-r { right: calc(-1px - var(--left, .5) * 9px); width: calc(var(--left, .5) * 9px + 1px); }
.edges .edge-l { left: calc(-1px - var(--read, .5) * 9px); width: calc(var(--read, .5) * 9px + 1px); }
.book:not(:has(.spread)) .edges .edge-l { }
html.no-edges .edges, html.oled .edges, .fixed-book .edges { display: none; }
#reader:not(.spread) .edges .edge-l { display: none; }

/* flap: the back of the turning sheet */
.flap-wrap { position: absolute; left: 0; top: 0; width: 0; height: 0; display: none; z-index: 5; pointer-events: none; }
.flap-wrap.shadowed { filter: drop-shadow(0 6px 18px rgba(0,0,0,.35)); }
.flap { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform, clip-path; }
.flap .page { position: absolute; left: 0; top: 0; }
#reader:not(.spread) .flap .page::after { background: color-mix(in srgb, var(--page-bg) 86%, transparent); mix-blend-mode: normal; }
.fx { position: absolute; display: none; pointer-events: none; z-index: 6; }

/* ribbon bookmark (#115) */
.ribbon { position: absolute; top: -6px; right: 64px; z-index: 7; width: 22px; height: 54px; border: 0; padding: 0; background: linear-gradient(90deg, #7d1d1d, #a62a2a 50%, #7d1d1d); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%); opacity: .0; transition: opacity .25s, height .3s cubic-bezier(.3,1.6,.5,1); box-shadow: 0 2px 4px rgba(0,0,0,.3); }
.book:hover .ribbon, .chrome-on .ribbon { opacity: .85; }
.ribbon.pulled { height: 80px; }
.spread .ribbon { right: 50px; }
.book:has(.page.bookmarked:not([hidden])) .ribbon { opacity: 1; height: 72px; }
@media (hover: none) { .ribbon { opacity: .55; } }
#reader[data-rtl='1'] .ribbon { right: auto; left: 64px; }

/* ---------- book typography ---------- */
.chapter-frame { position: absolute; top: 0; left: 0; column-fill: auto; font-family: var(--font); font-size: var(--font-size); font-weight: var(--font-weight); line-height: var(--line-height); letter-spacing: var(--letter-space); word-spacing: var(--word-space); text-align: var(--align); hyphens: var(--hyphens); -webkit-hyphens: var(--hyphens); color: var(--ink); orphans: 2; widows: 2; font-kerning: normal; font-variant-ligatures: common-ligatures; text-rendering: optimizeLegibility; user-select: text; -webkit-user-select: text; overflow-wrap: break-word; will-change: transform; }
.chapter-frame p { margin: 0 0 var(--para-space); text-indent: var(--indent); }
.chapter-frame :is(h1, h2, h3, h4, h5, h6) + p, .chapter-frame p:first-child, .chapter-frame blockquote p, .chapter-frame li p { text-indent: 0; }
.chapter-frame :is(h1, h2, h3, h4) { font-weight: calc(var(--font-weight) + 200); line-height: 1.25; text-align: center; break-after: avoid; hyphens: manual; margin: 1.2em 0 .9em; text-indent: 0; }
.chapter-frame h1 { font-size: 1.6em; } .chapter-frame h2 { font-size: 1.35em; } .chapter-frame h3 { font-size: 1.15em; }
.chapter-frame h1:first-child, .chapter-frame h2:first-child { margin-top: 2.2em; }
.chapter-frame :is(h1, h2).reveal { animation: reveal 1.4s cubic-bezier(.2,.7,.1,1) both; }
@keyframes reveal { from { opacity: 0; letter-spacing: .25em; filter: blur(4px); } to { opacity: 1; letter-spacing: normal; filter: blur(0); } }
.chapter-frame img, .chapter-frame svg { max-width: 100%; height: auto; display: block; margin: .6em auto; break-inside: avoid; object-fit: contain; }
.chapter-frame blockquote { margin: .8em 1.2em; font-style: italic; }
.chapter-frame a { color: var(--accent); text-decoration: none; }
.chapter-frame [data-link] { color: var(--accent); cursor: pointer; }
.chapter-frame sup { line-height: 0; }
.chapter-frame hr { border: 0; text-align: center; margin: 1.2em 0; } .chapter-frame hr::after { content: '\2042'; color: var(--accent); }
.chapter-frame table { border-collapse: collapse; font-size: .85em; max-width: 100%; } .chapter-frame td, .chapter-frame th { border: 1px solid color-mix(in srgb, var(--ink) 25%, transparent); padding: 4px 6px; }
.chapter-frame pre, .chapter-frame code { font-family: ui-monospace, Menlo, monospace; font-size: .85em; white-space: pre-wrap; }
.chapter-frame .verse { text-indent: 0; margin: 0; } .chapter-frame .poem { margin: .8em 1.5em; }
html.publisher .chapter-frame [data-align=center] { text-align: center; text-indent: 0; }
html.publisher .chapter-frame [data-align=right] { text-align: right; text-indent: 0; }
.chapter-frame aside[data-note] { font-size: .85em; opacity: .85; border-top: 1px solid color-mix(in srgb, var(--ink) 20%, transparent); padding-top: .4em; margin-top: 1em; }
html.bionic .chapter-frame b.bio { font-weight: calc(var(--font-weight) + 250); }
.fixed-img, .fixed-canvas { display: block; margin: 0 auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.fixed-book .page-body { display: grid; place-items: center; }

/* highlights (CSS Custom Highlight API, with <mark> fallback) */
::highlight(hl-yellow) { background-color: rgba(245, 215, 110, .5); }
::highlight(hl-green) { background-color: rgba(154, 211, 122, .45); }
::highlight(hl-blue) { background-color: rgba(127, 182, 240, .45); }
::highlight(hl-pink) { background-color: rgba(242, 155, 191, .45); }
::highlight(hl-purple) { background-color: rgba(183, 156, 240, .45); }
::highlight(hl-orange) { background-color: rgba(243, 169, 107, .45); }
::highlight(ul-solid) { text-decoration: underline solid #c58a2a 2px; }
::highlight(ul-dashed) { text-decoration: underline dashed #c58a2a 2px; }
::highlight(ul-wavy) { text-decoration: underline wavy #c58a2a 1.5px; }
::highlight(hl-note) { text-decoration: underline dotted rgba(90, 80, 70, .8) 2px; }
::highlight(hl-old) { background-color: rgba(150, 130, 100, .14); text-decoration: underline dotted rgba(130, 110, 80, .55) 1.5px; }
::highlight(tts) { background-color: rgba(127, 182, 240, .55); }
::highlight(search) { background-color: rgba(243, 169, 107, .75); }
html[data-ui=dark] ::highlight(hl-yellow) { background-color: rgba(245, 215, 110, .28); }
html[data-ui=dark] ::highlight(hl-green) { background-color: rgba(154, 211, 122, .26); }
html[data-ui=dark] ::highlight(hl-blue) { background-color: rgba(127, 182, 240, .28); }
html[data-ui=dark] ::highlight(hl-pink) { background-color: rgba(242, 155, 191, .26); }
html[data-ui=dark] ::highlight(hl-purple) { background-color: rgba(183, 156, 240, .28); }
html[data-ui=dark] ::highlight(hl-orange) { background-color: rgba(243, 169, 107, .28); }
html[data-ui=dark] ::highlight(hl-note) { text-decoration-color: rgba(200, 190, 170, .7); }
mark.hl { color: inherit; border-radius: 2px; } mark.hl-yellow { background: rgba(245,215,110,.5); } mark.hl-green { background: rgba(154,211,122,.45); } mark.hl-blue { background: rgba(127,182,240,.45); } mark.hl-pink { background: rgba(242,155,191,.45); } mark.hl-purple { background: rgba(183,156,240,.45); } mark.hl-orange { background: rgba(243,169,107,.45); }
mark.hl.st-wavy, mark.hl.st-solid, mark.hl.st-dashed { background: none; text-decoration: underline wavy #c58a2a; } mark.hl.old { background: rgba(150,130,100,.14); }
::selection { background: rgba(217, 180, 106, .45); }

/* ---------- reader chrome ---------- */
.chrome { position: absolute; left: 0; right: 0; z-index: 20; background: var(--ui-bg); backdrop-filter: blur(18px) saturate(1.3); -webkit-backdrop-filter: blur(18px) saturate(1.3); color: var(--ui-fg); transition: transform .32s cubic-bezier(.2,.8,.2,1), opacity .32s; opacity: 0; pointer-events: none; }
.chrome.show { opacity: 1; pointer-events: auto; transform: none !important; }
.chrome.top { top: 0; padding: calc(var(--safe-t) + 6px) 8px 6px; display: flex; align-items: center; gap: 6px; transform: translateY(-100%); border-bottom: 1px solid var(--ui-line); }
.chrome.top .ttl { flex: 1; min-width: 0; display: grid; } .chrome.top .ttl strong { font: 600 16px 'EB Garamond', Georgia, serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .chrome.top .ttl span { font-size: 12px; color: var(--ui-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chrome.top .tools { display: flex; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.chrome.bottom { bottom: 0; padding: 12px 18px calc(var(--safe-b) + 12px); transform: translateY(100%); border-top: 1px solid var(--ui-line); }
.chrome .jump { width: 100%; accent-color: var(--gold); height: 34px; }
.chrome .info { font-size: 12.5px; color: var(--ui-muted); text-align: center; font-variant-numeric: tabular-nums; }
.jump-bubble { position: absolute; bottom: 74px; transform: translateX(-50%); background: #000; color: var(--gold-2); padding: 6px 12px; border-radius: 10px; font-size: 13px; white-space: nowrap; border: 1px solid var(--ui-line); }
.back-chip { position: absolute; left: 50%; bottom: calc(var(--safe-b) + 90px); transform: translateX(-50%); z-index: 21; background: var(--ui-bg); color: var(--gold-2); border: 1px solid var(--ui-line); border-radius: 999px; padding: 10px 18px; backdrop-filter: blur(10px); }

/* comfort overlays */
#reader::after { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 30; background: #000; opacity: var(--dim); transition: opacity 2s; }
#reader::before { content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 29; background: #ff8a1f; mix-blend-mode: multiply; opacity: calc(var(--warmth) * .38); }
html.drifting #reader::after { opacity: .82; transition: opacity 55s linear; }
html.drifting #reader::before { opacity: .45; transition: opacity 55s linear; }
.ruler { position: fixed; height: 56px; z-index: 15; pointer-events: none; background: rgba(217,180,106,.12); border-top: 1px solid rgba(217,180,106,.5); border-bottom: 1px solid rgba(217,180,106,.5); }
.focus-mask { --fy: 40%; position: fixed; inset: 0; z-index: 14; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.55) calc(var(--fy) - 70px), transparent calc(var(--fy) - 40px), transparent calc(var(--fy) + 40px), rgba(0,0,0,.55) calc(var(--fy) + 70px)); transition: --fy .3s; }
.sleep-overlay { position: fixed; inset: 0; z-index: 90; background: #000; display: grid; place-content: center; text-align: center; color: #6e675a; }
.sleep-moon { width: 60px; height: 60px; margin: 0 auto 20px; border-radius: 50%; box-shadow: 14px -8px 0 0 #8a7a52; transform: rotate(-20deg); }
.sleep-msg { font: italic 20px 'Literata', Georgia, serif; } .sleep-hint { font-size: 12px; }

/* scroll mode */
.scroller { position: absolute; inset: 0; overflow-y: auto; background: var(--page-bg); color: var(--ink); padding: 60px max(24px, calc(50% - 360px)) 120px; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.scroller .chapter-frame { position: static; columns: auto !important; height: auto !important; width: auto !important; transform: none !important; }
.scroll-nav { display: flex; justify-content: space-between; margin-top: 40px; } .scroll-nav .btn { color: var(--ink); border-color: color-mix(in srgb, var(--ink) 30%, transparent); }

/* ---------- selection bar ---------- */
.sel-bar { position: fixed; z-index: 60; background: rgba(14,16,22,.96); border: 1px solid var(--ui-line); border-radius: 16px; padding: 8px; box-shadow: 0 16px 40px rgba(0,0,0,.5); max-width: min(560px, calc(100vw - 16px)); color: var(--ui-fg); }
.sb-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; } .sb-row + .sb-row { margin-top: 6px; border-top: 1px solid rgba(255,255,255,.07); padding-top: 6px; }
.sb-color { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,.2); margin: 2px; }
.sb-color.on { border-color: #fff; box-shadow: 0 0 0 2px var(--gold); }
.sb-btn { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: transparent; padding: 6px 8px; border-radius: 10px; font-size: 11px; min-width: 52px; }
.sb-btn:hover { background: rgba(255,255,255,.08); } .sb-btn .i { font-size: 17px; line-height: 1; } .sb-btn.compact .l { display: none; }

/* ---------- sheets, dialogs, popovers ---------- */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.45); opacity: 0; pointer-events: none; transition: opacity .25s; }
body.scrim-on .scrim { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; z-index: 45; background: rgba(13,17,28,.97); color: var(--ui-fg); border: 1px solid var(--ui-line); box-shadow: 0 20px 60px rgba(0,0,0,.6); display: flex; flex-direction: column; visibility: hidden; transition: transform .32s cubic-bezier(.2,.8,.2,1), visibility .32s; }
.sheet.side-right { top: 0; right: 0; bottom: 0; width: min(440px, 100vw); transform: translateX(105%); border-radius: 18px 0 0 18px; }
.sheet.side-left { top: 0; left: 0; bottom: 0; width: min(420px, 100vw); transform: translateX(-105%); border-radius: 0 18px 18px 0; }
.sheet.open { transform: none; visibility: visible; }
@media (max-width: 700px) and (orientation: portrait) {
  .sheet.side-right, .sheet.side-left { top: auto; left: 0; right: 0; width: 100%; max-height: 82vh; border-radius: 18px 18px 0 0; transform: translateY(105%); }
  .sheet.open { transform: none; }
}
.sheet-head, .dlg-head { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-t) + 10px) 14px 6px 20px; }
.sheet-head h2, .dlg-head h2 { font: 600 21px 'EB Garamond', Georgia, serif; margin: 0; color: var(--gold-2); }
.sheet > .seg { margin: 4px 16px 8px; }
.sheet-body { overflow-y: auto; padding: 6px 20px calc(var(--safe-b) + 24px); -webkit-overflow-scrolling: touch; flex: 1; }
.sheet-body h3 { font: 600 15px 'Lexend', sans-serif; color: var(--gold); margin: 22px 0 6px; letter-spacing: .3px; }
.dialog { position: fixed; z-index: 50; left: 50%; top: 50%; width: min(480px, calc(100vw - 24px)); max-height: 86vh; display: none; flex-direction: column; transform: translate(-50%, -50%); background: rgba(15,19,30,.98); border: 1px solid var(--ui-line); border-radius: 20px; box-shadow: 0 30px 80px rgba(0,0,0,.7); }
.dialog.open { display: flex; animation: pop .25s cubic-bezier(.2,.8,.2,1); } .dialog.wide { width: min(640px, calc(100vw - 24px)); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(.97); } }
.dlg-head { padding-top: 12px; } .dlg-body { overflow-y: auto; padding: 4px 20px 10px; } .dlg-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 12px 16px 16px; }
.popover { position: fixed; z-index: 55; background: rgba(15,19,30,.98); border: 1px solid var(--ui-line); border-radius: 16px; padding: 14px 16px; box-shadow: 0 20px 50px rgba(0,0,0,.6); max-height: 60vh; overflow-y: auto; color: var(--ui-fg); }
.popover h3 { margin: 0 0 8px; font: 600 19px 'EB Garamond', Georgia, serif; color: var(--gold-2); }
.popover p { margin: 6px 0; line-height: 1.5; } .pop-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.pos { color: var(--gold); } .wiki-thumb { float: right; width: 90px; border-radius: 8px; margin: 0 0 8px 10px; }
.footnote { font: 16px/1.55 'Literata', Georgia, serif; }
#toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 28px); transform: translate(-50%, 30px); z-index: 99; background: rgba(10,12,18,.95); color: var(--ui-fg); border: 1px solid var(--ui-line); padding: 12px 20px; border-radius: 999px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .3s; max-width: calc(100vw - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.loading { position: fixed; inset: 0; z-index: 70; display: grid; place-content: center; justify-items: center; background: rgba(0,0,0,.6); gap: 14px; color: var(--ui-muted); }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 3px solid rgba(217,180,106,.2); border-top-color: var(--gold); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.fatal { padding: 30px; color: #ffb3a6; }

/* panel contents */
.toc { display: grid; gap: 2px; }
.toc-item { text-align: left; background: none; border: 0; padding: 11px 12px; border-radius: 10px; color: var(--ui-fg); font: 15px/1.35 'Literata', Georgia, serif; }
.toc-item:hover { background: rgba(255,255,255,.06); } .toc-item.current { background: rgba(217,180,106,.16); color: var(--gold-2); }
.toc-item.lvl1 { padding-left: 28px; font-size: 14px; } .toc-item.lvl2 { padding-left: 44px; font-size: 13.5px; } .toc-item.lvl3 { padding-left: 58px; font-size: 13px; }
.note-card { border: 1px solid rgba(255,255,255,.08); border-radius: 14px; padding: 12px 14px; margin: 10px 0; background: rgba(255,255,255,.03); }
.note-card blockquote, .note-quote, .smart blockquote, .year blockquote { margin: 6px 0; padding-left: 12px; border-left: 3px solid var(--gold); font: italic 15px/1.5 'Literata', Georgia, serif; color: #e9e1cf; }
.nc-head { display: flex; align-items: center; gap: 8px; color: var(--ui-muted); } .nc-note { margin: 6px 0; } .nc-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.sealed { font-style: italic; color: var(--gold-2); } .capsule { color: var(--gold); font-size: 13px; }
.results { display: grid; gap: 6px; margin-top: 10px; }
.result { text-align: left; border: 1px solid rgba(255,255,255,.07); background: rgba(255,255,255,.03); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; font: 14px/1.45 'Literata', Georgia, serif; }
.result small { font-family: 'Lexend', sans-serif; color: var(--gold); font-size: 11.5px; } .result mark { background: rgba(217,180,106,.45); color: inherit; border-radius: 3px; }
.mood-grid { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; } .mood { font-size: 12px; padding: 5px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.1); color: var(--ui-muted); } .mood.ok { border-color: var(--gold); color: var(--gold-2); }
.themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.theme-sw { border: 2px solid rgba(255,255,255,.12); border-radius: 12px; padding: 14px 4px; font: 13px 'Literata', Georgia, serif; }
.theme-sw.on { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(217,180,106,.35); }
.preview { padding: 14px; border-radius: 12px; background: var(--page-bg); color: var(--ink); font-size: var(--font-size); line-height: var(--line-height); font-weight: var(--font-weight); letter-spacing: var(--letter-space); margin: 4px 0 8px; }
.profile .btn:first-child { flex: 1; justify-content: center; }
.chat { display: grid; gap: 8px; max-height: 50vh; overflow-y: auto; margin: 10px 0; } .chat .me { justify-self: end; background: rgba(217,180,106,.16); padding: 8px 12px; border-radius: 14px 14px 4px 14px; margin: 0; max-width: 85%; } .chat .ai { background: rgba(255,255,255,.05); padding: 10px 12px; border-radius: 14px 14px 14px 4px; margin: 0; line-height: 1.5; white-space: pre-wrap; }
.xr-item { border-bottom: 1px solid rgba(255,255,255,.06); } .xr-name { width: 100%; text-align: left; background: none; border: 0; padding: 12px 4px; } .xr-detail { padding: 0 0 12px; display: grid; gap: 6px; }
.web { width: 100%; height: auto; } .web-edge { stroke: rgba(217,180,106,.5); stroke-width: 1.5; } .web-rel { fill: var(--ui-muted); font-size: 12px; } .web-node circle { fill: #1a2236; stroke: var(--gold); stroke-width: 1.5; } .web-node text { fill: var(--ui-fg); font-size: 13px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07); border-radius: 14px; padding: 12px; display: grid; gap: 2px; } .stat strong { font: 600 20px 'EB Garamond', Georgia, serif; color: var(--gold-2); } .stat span { font-size: 12px; color: var(--ui-muted); }
.heatmap { display: grid; grid-template-rows: repeat(7, 12px); grid-auto-flow: column; grid-auto-columns: 12px; gap: 3px; overflow-x: auto; padding: 4px 0; }
.hm { border-radius: 3px; background: rgba(255,255,255,.06); } .hm.l1 { background: rgba(217,180,106,.3); } .hm.l2 { background: rgba(217,180,106,.5); } .hm.l3 { background: rgba(217,180,106,.75); } .hm.l4 { background: var(--gold-2); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; } .bdg { font-size: 12px; padding: 6px 10px; border-radius: 999px; border: 1px dashed rgba(255,255,255,.15); color: var(--ui-muted); } .bdg.ok { border: 1px solid var(--gold); color: var(--gold-2); background: rgba(217,180,106,.1); }
.vocab-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 14px; } .vocab-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .vocab-row small { color: var(--ui-muted); }
.flashcard { text-align: center; padding: 10px 0; } .cloze { font: italic 19px/1.5 'Literata', Georgia, serif; } .card-back { border-top: 1px solid var(--ui-line); margin-top: 12px; padding-top: 8px; }
.memory { padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.06); display: grid; gap: 4px; } .mem-photo { max-width: 100%; border-radius: 12px; margin-top: 6px; }
.finish h3 { font: 600 24px 'EB Garamond', Georgia, serif; margin: 0; color: var(--gold-2); }
.ai-out p { line-height: 1.55; }
.color-row { display: flex; gap: 4px; margin: 10px 0; }

/* light reading themes: chrome and panels stay dark and cinematic, the page is what changes */
@media (max-width: 600px) {
  .lib-head h1 { font-size: 26px; } .lib-actions { width: 100%; margin-left: 0; } .hero { flex-direction: row; padding: 14px; gap: 14px; } .hero-cover { width: 86px; } .hero h2 { font-size: 22px; }
  .chrome.top .tools .icon-btn { width: 40px; }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
.page.measure { position: fixed !important; left: -40000px !important; top: 0 !important; visibility: hidden; pointer-events: none; z-index: -1; }
@font-face { font-family: 'Caveat'; src: url(../fonts/caveat-latin-400-normal.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Caveat'; src: url(../fonts/caveat-latin-700-normal.woff2) format('woff2'); font-weight: 700; font-display: swap; }

/* ===================== V2: community, live, pen, voice, gifts, extras ===================== */
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; background: linear-gradient(135deg, #2a3a5e, #12182a); color: var(--gold-2); font-weight: 600; flex: none; border: 1px solid var(--ui-line); }
.code { font-family: ui-monospace, Menlo, monospace; letter-spacing: 2px; color: var(--gold-2); }
.big-code { font: 600 34px ui-monospace, Menlo, monospace; letter-spacing: 6px; color: var(--gold-2); text-align: center; margin: 8px 0; }
.pair-box { border: 1px dashed var(--gold); border-radius: 14px; padding: 10px; margin: 10px 0; text-align: center; }
.people { display: grid; gap: 8px; }
.person { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.06); background: none; border-left: 0; border-right: 0; border-top: 0; color: inherit; text-align: left; }
.person.wide { width: 100%; } .person strong { flex: 1; }
.badge-n { background: var(--gold); color: #000; border-radius: 999px; padding: 1px 8px; font-size: 12px; }
.feed { display: grid; gap: 10px; } .feed-item { display: flex; gap: 10px; } .feed-item p { margin: 0 0 4px; }
.club-card { width: 100%; display: grid; gap: 2px; text-align: left; padding: 12px 14px; margin: 8px 0; border-radius: 14px; border: 1px solid var(--ui-line); background: rgba(255,255,255,.03); color: inherit; }
.members { display: grid; gap: 8px; } .member { display: grid; grid-template-columns: auto 1fr 120px auto; gap: 10px; align-items: center; } .member .bar { margin: 0; }
.pace { background: rgba(217,180,106,.12); border-radius: 12px; padding: 10px 12px; color: var(--gold-2); }
.comment { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.06); } .comment > div { flex: 1; min-width: 0; } .comment p { margin: 2px 0; line-height: 1.45; }
.comment.duel { border-left: 3px solid #f3a96b; padding-left: 10px; } .comment.author { border-left: 3px solid var(--gold); padding-left: 10px; flex-direction: column; }
.tag { font-size: 11px; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; padding: 1px 8px; margin-left: 6px; color: var(--ui-muted); } .tag.gold { border-color: var(--gold); color: var(--gold-2); }
.link.small { font-size: 12.5px; }
.reactions { display: flex; gap: 8px; flex-wrap: wrap; } .react { font-size: 26px; width: 54px; height: 54px; border-radius: 50%; border: 1px solid var(--ui-line); background: rgba(255,255,255,.04); } .react.on { background: rgba(217,180,106,.3); transform: scale(1.08); }
.heat { height: 70px; border-radius: 10px; overflow: hidden; background: rgba(255,255,255,.04); } .heat svg { width: 100%; height: 100%; display: block; }
.stars { display: flex; gap: 4px; } .star { font-size: 30px; background: none; border: 0; color: rgba(255,255,255,.25); } .star.on { color: var(--gold); }
.spoiler { filter: blur(6px); cursor: pointer; user-select: none; }
.author-note { margin-top: 18px; color: var(--ui-muted); } .author-note summary { cursor: pointer; }
.list-picks { max-height: 40vh; overflow-y: auto; }
.chrome.bottom .ghosts { position: relative; height: 0; margin: 0 9px; }
.ghost-dot { position: absolute; top: -8px; transform: translateX(-50%); width: 22px; height: 22px; border-radius: 50%; background: #2a3a5e; border: 1.5px solid var(--gold); color: var(--gold-2); font-size: 11px; display: grid; place-items: center; opacity: .85; }
.ripple { position: absolute; z-index: 25; width: 14px; height: 14px; border-radius: 50%; border: 2px solid rgba(217,180,106,.7); pointer-events: none; animation: ripple 2.2s ease-out forwards; }
@keyframes ripple { to { transform: scale(9); opacity: 0; } }

/* pen layer */
.ink-layer { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.ink-layer svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pen-mode .ink-layer { pointer-events: auto; cursor: crosshair; touch-action: none; }
.ink-answer { font: 700 22px 'Caveat', cursive; }
.ink-bar { position: absolute; left: 50%; bottom: calc(var(--safe-b) + 14px); transform: translateX(-50%); z-index: 22; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; background: var(--ui-bg); backdrop-filter: blur(14px); border: 1px solid var(--ui-line); border-radius: 18px; padding: 8px 10px; max-width: calc(100vw - 20px); }
.ink-tool { border: 1px solid var(--ui-line); background: transparent; color: var(--ui-fg); border-radius: 999px; padding: 7px 12px; font-size: 13px; } .ink-tool.on { background: rgba(217,180,106,.2); color: var(--gold-2); } .ink-tool.done { background: var(--gold); color: #000; }
.ink-color { width: 26px; height: 26px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); }

/* family voice */
.voice-bar { position: absolute; left: 50%; top: calc(var(--safe-t) + 14px); transform: translateX(-50%); z-index: 22; display: flex; gap: 10px; align-items: center; background: var(--ui-bg); border: 1px solid var(--ui-line); border-radius: 999px; padding: 8px 14px; backdrop-filter: blur(14px); }
.vb-dot { width: 12px; height: 12px; border-radius: 50%; background: #e0453a; animation: pulse 1.2s infinite; } @keyframes pulse { 50% { opacity: .3; } }

/* gifts */
.hand-pad { width: 100%; aspect-ratio: 5/2; background: #fbf7ec; border-radius: 12px; touch-action: none; cursor: crosshair; box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); }
.gift-stage { display: grid; place-items: center; min-height: 300px; gap: 10px; }
.gift-box { width: 200px; height: 170px; position: relative; border: 0; border-radius: 8px; background: linear-gradient(135deg, #14213d, #0b1220); box-shadow: 0 20px 50px rgba(0,0,0,.6); animation: wobble 2.4s ease-in-out infinite; }
.gift-box.wrap-red { background: linear-gradient(135deg, #8a1c1c, #4a0d0d); } .gift-box.wrap-kraft { background: linear-gradient(135deg, #a77b4f, #7a5532); } .gift-box.wrap-stars { background: radial-gradient(circle at 20% 30%, #fff 1px, transparent 2px) 0 0/24px 24px, linear-gradient(135deg, #0b1440, #050815); }
.gift-box .ribbon-v, .gift-box .ribbon-h { position: absolute; background: linear-gradient(90deg, #c99a48, #f0d39a, #c99a48); }
.gift-box .ribbon-v { left: 45%; width: 10%; top: 0; bottom: 0; } .gift-box .ribbon-h { top: 42%; height: 12%; left: 0; right: 0; }
.gift-box .bow { position: absolute; left: 50%; top: -22px; width: 70px; height: 40px; transform: translateX(-50%); background: radial-gradient(ellipse at 25% 50%, #f0d39a 40%, transparent 42%), radial-gradient(ellipse at 75% 50%, #f0d39a 40%, transparent 42%); }
.gift-box.open { animation: unwrap .9s cubic-bezier(.5,0,.7,.4) forwards; }
@keyframes wobble { 50% { transform: rotate(-2deg) scale(1.02); } }
@keyframes unwrap { 30% { transform: scale(1.1) rotate(3deg); } 100% { transform: scale(1.6) rotate(-8deg); opacity: 0; filter: blur(8px); } }
.gift-card { text-align: center; max-width: 520px; } .gift-card h3 { font: 600 26px 'EB Garamond', Georgia, serif; color: var(--gold-2); margin: 4px 0; }
.gift-card .ink-note { width: 100%; border-radius: 10px; background: #fbf7ec; margin: 10px 0; }
.gift-card.reveal .ink-note { animation: inkIn 2.6s ease-out both .2s; } @keyframes inkIn { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.gift-msg { font: italic 17px/1.5 'Literata', Georgia, serif; } .gift-from { font: 700 26px 'Caveat', cursive; color: var(--gold-2); }

/* extras */
.vibe-chip { position: absolute; left: 50%; top: calc(var(--safe-t) + 18px); transform: translateX(-50%); z-index: 21; background: var(--ui-bg); border: 1px solid var(--ui-line); border-radius: 999px; padding: 8px 16px; font-size: 13px; color: var(--ui-fg); backdrop-filter: blur(10px); transition: opacity .6s; animation: pop .4s ease-out; }
.vibe-chip.out { opacity: 0; } .vibe-chip strong { color: var(--gold-2); }
.quiz-q { margin: 14px 0; } .quiz-opt { display: block; width: 100%; text-align: left; margin: 4px 0; } .quiz-opt.right { border-color: #9ad37a; background: rgba(154,211,122,.18); } .quiz-opt.wrong { border-color: #ff9b8a; background: rgba(255,120,100,.12); }
.hook-card { padding: 16px; border-radius: 16px; background: var(--page-bg); color: var(--ink); } .hook-text { font: 18px/1.65 'Literata', Georgia, serif; } .hook-card .btn.ghost { color: var(--ink); border-color: rgba(0,0,0,.2); }
.goal-banner { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 16px; border-radius: 14px; background: rgba(217,180,106,.12); border: 1px solid var(--ui-line); color: var(--gold-2); }
.blind-cover { position: absolute; inset: 0; z-index: 3; display: grid; place-content: center; text-align: center; gap: 6px; padding: 10px; background: repeating-linear-gradient(45deg, #2a1717 0 10px, #3a1f1f 10px 20px); color: #f3d7a0; }
.blind-cover strong { font: 600 22px 'EB Garamond', Georgia, serif; }
.badge.cloud { left: auto; right: 8px; top: 8px; bottom: auto; }
.cast-pic { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 8px; border: 1px solid var(--gold); }
.xr-name { display: flex; align-items: center; gap: 4px; } .cast-add { display: inline-block; margin: 0 0 8px 4px; cursor: pointer; }
.level { display: grid; gap: 4px; margin-bottom: 14px; } .level strong { font: 600 22px 'EB Garamond', Georgia, serif; color: var(--gold-2); } .bar.big { height: 8px; border-radius: 4px; }
.reg-chart { display: flex; align-items: flex-end; gap: 3px; height: 90px; padding: 6px; background: rgba(255,255,255,.03); border-radius: 10px; } .reg-chart i { flex: 1; background: var(--gold); border-radius: 2px 2px 0 0; min-height: 2px; }
.more-menu { display: grid; gap: 8px; }
/* story time-of-day tint (#212) and typography tempo (#211) */
.page-body::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: var(--story-tint, transparent); mix-blend-mode: multiply; transition: background 2s; }
.chapter-frame { letter-spacing: calc(var(--letter-space) + var(--tempo-ls, 0em)); }
