/* My News Reader — tablet first, then phone, then computer. Every corner is rounded; no dead space. */
:root {
  --bg: #e9e2d6; --paper: #fbf8f2; --paper2: #f3eee4; --ink: #1d1b18; --ink2: #5d574d; --line: #ded6c8; --chip: #efe8dc;
  --accent: #1d1b18; --on-accent: #fff; --shadow: 0 10px 30px rgba(40, 30, 10, .16);
  --serif: "Lora", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 14px; --rs: 10px; --gap: 12px;
  --top: max(env(safe-area-inset-top, 0px), env(titlebar-area-height, 0px)); /* below the phone's camera hole and below a desktop app's title bar */ --bot: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
[data-theme="sepia"] { --bg: #e3d5bd; --paper: #f6ecd9; --paper2: #ecdfc6; --ink: #3b2d1c; --ink2: #6e5a41; --line: #d9c7a6; --chip: #ecdcc0; --accent: #3b2d1c; --on-accent: #f6ecd9; }
[data-theme="rose"] { --bg: #f4dfe5; --paper: #fdf4f6; --paper2: #f9e7ec; --ink: #4b2b35; --ink2: #8c5f6b; --line: #efd2da; --chip: #f7dde4; --accent: #a8466a; --on-accent: #fff; }
[data-theme="night"] { --bg: #0f1012; --paper: #1b1c1f; --paper2: #232428; --ink: #ece8e1; --ink2: #a7a196; --line: #33343a; --chip: #2a2b30; --accent: #ece8e1; --on-accent: #111; --shadow: 0 10px 30px rgba(0, 0, 0, .5); color-scheme: dark; }

@font-face { font-family: "Lora"; src: url("/fonts/Lora-Variable.woff") format("woff"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Lora"; src: url("/fonts/Lora-Italic-Variable.woff") format("woff"); font-weight: 400 700; font-style: italic; font-display: swap; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--sans); -webkit-tap-highlight-color: transparent; }
body { overflow: hidden; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
/* no focus lines anywhere: a tap or click never leaves a frame around what was touched */
:focus, :focus-visible { outline: none; }
#brand:focus-visible, .tile:focus-visible { box-shadow: none; }

#app { height: 100%; max-width: 1440px; margin: 0 auto; display: flex; flex-direction: column; padding: calc(var(--top) + 6px) 14px calc(var(--bot) + 6px); gap: 6px; }

/* ---------- top bar: icons split evenly, the name always centred with clear space ---------- */
#bar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; min-height: 46px; }
#bar .side { display: flex; gap: 6px; align-items: center; }
#bar .side.r { justify-content: flex-end; }
#brand { margin: 0; text-align: center; font: 700 22px/1.1 var(--serif); letter-spacing: .01em; white-space: nowrap; display: flex; flex-direction: column; align-items: center; }
#brand { cursor: pointer; border-radius: 12px; padding: 2px 10px; user-select: none; -webkit-user-select: none; }
#brand:active { transform: scale(.97); }
@media (hover: hover) { #brand:hover { background: var(--paper); } }
#brand small { font: 500 11.5px/1.3 var(--sans); color: var(--ink2); letter-spacing: .04em; text-transform: uppercase; margin-top: 2px; }
.ic { width: 40px; height: 40px; border-radius: 12px; border: 0; background: none; box-shadow: none; color: var(--ink); font-size: 18px; display: grid; place-items: center; padding: 0; }
.ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ic:active { transform: scale(.95); }
#bInterests { color: var(--ink); font-size: 20px; }
.ic:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.pill { border: 0; background: none; color: var(--ink); border-radius: 999px; padding: 6px 10px; font-weight: 700; font-size: 14px; white-space: nowrap; }

/* ---------- Subject ribbons ---------- */
#ribbons { position: relative; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; min-height: 36px; }
#ribbons::-webkit-scrollbar { display: none; }
.rib { flex: 0 0 auto; border: 0; border-radius: 10px 10px 12px 12px; padding: 7px 12px 8px; font: 650 13.5px/1 var(--sans); color: var(--c); background: none; opacity: .72; white-space: nowrap; position: relative; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
.rib.on { opacity: 1; box-shadow: none; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; text-decoration-color: color-mix(in srgb, var(--ink2) 55%, transparent); }
.rib.pin::before { content: "★ "; }
.rib.cover { background: none; color: var(--ink); opacity: .72; }
.rib.cover.on { opacity: 1; box-shadow: none; }

/* ---------- the book ---------- */
#bookHost, #readerHost { position: relative; flex: 1; min-height: 0; }
.book { touch-action: none; user-select: none; -webkit-user-select: none; }
.stage { position: absolute; left: 0; top: 0; overflow: hidden; border-radius: var(--r); }
.book.is-spread .stage { overflow: visible; }
.slot { position: absolute; top: 0; }
.slotU { z-index: 1; } .rev { z-index: 2; } .slotT { z-index: 3; } .flap { z-index: 4; } .slotL { z-index: 1; }
.page { position: absolute; inset: 0; background: var(--paper); border-radius: var(--r); overflow: hidden; }
.book.is-spread .slotL .page, .book.is-spread .flapc .page { border-radius: var(--r) 4px 4px var(--r); }
.book.is-spread .slotU .page, .book.is-spread .slotT .page { border-radius: 4px var(--r) var(--r) 4px; }
.book.is-spread .slotL .page::after, .book.is-spread .flapc .page::after { content: ""; position: absolute; inset: 0 0 0 auto; width: 40px; background: linear-gradient(to left, rgba(0,0,0,.10), transparent); pointer-events: none; }
.book.is-spread .slotU .page::after, .book.is-spread .slotT .page::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 40px; background: linear-gradient(to right, rgba(0,0,0,.10), transparent); pointer-events: none; }
.rev, .flap { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }
.flapc { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.paperback { background: linear-gradient(135deg, var(--paper2), var(--paper)); }
.g { position: absolute; left: 0; top: 0; transform-origin: 0 50%; pointer-events: none; }
.rev .g { background: linear-gradient(to right, rgba(0,0,0,.38), rgba(0,0,0,.14) 7%, rgba(0,0,0,0) 26%); }
.flap .fg { background: linear-gradient(to right, rgba(0,0,0,.22), rgba(255,255,255,.22) 4%, rgba(255,255,255,0) 22%, rgba(0,0,0,.08) 60%); }
.tshade { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.tshade .g { background: linear-gradient(to right, rgba(0,0,0,.16), rgba(0,0,0,0) 9%); }
.stage.fade { animation: fade .22s ease; }
@keyframes fade { from { opacity: .35; } to { opacity: 1; } }
.corner { position: absolute; bottom: 0; width: 46px; height: 46px; z-index: 6; cursor: pointer; }
.corner.next { right: 0; border-radius: 0 0 var(--r) 0; background: linear-gradient(135deg, transparent 49%, rgba(0,0,0,.18) 50%, var(--paper2) 54%, var(--paper) 100%); }
.corner.prev { left: 0; border-radius: 0 0 0 var(--r); background: linear-gradient(225deg, transparent 49%, rgba(0,0,0,.18) 50%, var(--paper2) 54%, var(--paper) 100%); }
.corner.off { display: none; }

/* ---------- collage tiles ---------- */
.tile { position: absolute; border-radius: var(--rs); overflow: hidden; background: var(--paper2); cursor: pointer; display: flex; transition: opacity .25s, transform .25s; }
.tile .ti { position: relative; overflow: hidden; background: color-mix(in srgb, var(--c) 30%, var(--paper2)); }
.tile .ti img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; display: block; }
.tile .tx { display: flex; flex-direction: column; gap: 5px; min-width: 0; overflow: hidden; }
.tile h3 { margin: 0; font-family: var(--serif); font-weight: 700; line-height: 1.12; letter-spacing: -.005em; overflow-wrap: anywhere; }
.tile .tk { font: 650 10.5px/1.2 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .td { margin: 0; font: 400 14px/1.4 var(--sans); color: var(--ink2); overflow: hidden; }
.tile .why { font: 600 11.5px/1.2 var(--sans); color: #e0526b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .multi { position: absolute; top: 8px; left: 8px; background: rgba(0,0,0,.62); color: #fff; font: 650 11px/1 var(--sans); padding: 5px 8px; border-radius: 999px; z-index: 2; }
.tile .heart { position: absolute; top: 6px; right: 6px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(255,255,255,.88); color: #e0526b; font-size: 17px; display: grid; place-items: center; z-index: 3; padding: 0; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.tile .heart.on { background: #e0526b; color: #fff; }
.tile .play { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 46px; height: 46px; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; font-size: 18px; }
/* overlay: headline over the photo */
.tile.st-o .ti { position: absolute; inset: 0; }
.tile.st-o .tx { position: absolute; left: 0; right: 0; bottom: 0; max-height: 100%; padding: 40px 14px 12px; background: linear-gradient(to top, rgba(0,0,0,.82), rgba(0,0,0,.55) 55%, rgba(0,0,0,0)); color: #fff; justify-content: flex-end; }
.tile.st-o .td { color: rgba(255,255,255,.86); }
.tile.st-o .tk { color: #fff; opacity: .92; }
.tile.st-o .why { color: #ffb3c0; }
/* stacked: photo on top, words below */
.tile.st-v { flex-direction: column; }
.tile.st-v .ti { flex: 0 0 52%; }
.tile.promo-card.st-v .ti, .tile.promo-card.st-h .ti { flex-shrink: 0; }
.tile.st-v .tx { flex: 1; padding: 10px 12px 10px; }
/* side by side */
.tile.st-h .ti { flex: 0 0 46%; }
.tile.st-h .tx { flex: 1; padding: 12px 12px; justify-content: center; }
/* words only (no photo, or a small tile) */
.tile.st-t { background: color-mix(in srgb, var(--c) 14%, var(--paper2)); border-top: 4px solid var(--c); }
.tile.st-t .ti { display: none; }
.tile.st-t .tx { padding: 12px 14px; justify-content: center; flex: 1; }
.tile.gone { opacity: 0; transform: translateY(-40px) scale(.96); }

/* ---------- special pages ---------- */
.pg-pad { position: absolute; inset: 0; padding: 22px 24px; display: flex; flex-direction: column; }
.cover-img { position: absolute; inset: 0; }
.cover-img img { width: 100%; height: 100%; object-fit: cover; }
.cover-img .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 60px 26px 26px; color: #fff; background: linear-gradient(to top, rgba(0,0,0,.85), rgba(0,0,0,0)); }
.cover-img .cap h2 { margin: 0 0 6px; font: 700 clamp(24px, 3.6vw, 44px)/1.08 var(--serif); }
.cover-img .cap .tk { font: 650 11px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; opacity: .9; }
.cover-text { position: absolute; inset: 0; padding: 30px 28px; display: flex; flex-direction: column; gap: 14px; }
.cover-text .mast { font: 800 clamp(38px, 6vw, 72px)/.95 var(--serif); letter-spacing: -.02em; margin: 0; }
.cover-text .ed { font: 650 13px/1.2 var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--ink2); border-top: 2px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 8px 0; display: flex; justify-content: space-between; gap: 10px; }
.cover-text .teaser { border: 0; background: none; text-align: start; padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.cover-text .teaser b { font: 700 clamp(17px, 2.1vw, 23px)/1.18 var(--serif); }
.cover-text .teaser span { font: 650 10.5px/1 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--c); }
.cover-text .hint { margin-top: auto; color: var(--ink2); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.cover-single .cover-img { bottom: 46%; }
.cover-single .cover-text { top: 54%; padding: 18px 22px; gap: 8px; }
.cover-single .cover-text .mast { font-size: clamp(30px, 8vw, 46px); }
.sec-head { position: absolute; left: 16px; top: 12px; z-index: 4; font: 700 12px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: #fff; background: var(--c); padding: 6px 10px; border-radius: 8px; pointer-events: none; }
.end { align-items: center; justify-content: center; text-align: center; gap: 14px; }
.end h2 { margin: 0; font: 700 clamp(26px, 3.4vw, 40px)/1.1 var(--serif); }
.end p { margin: 0; color: var(--ink2); font-size: 16px; line-height: 1.5; max-width: 30em; }
.btn { border: 0; background: var(--accent); color: var(--on-accent); border-radius: 12px; padding: 12px 18px; font-weight: 700; font-size: 15px; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.btn.ghost { background: var(--chip); color: var(--ink); }
.btn.big { padding: 15px 26px; font-size: 17px; }
.promo { background: var(--paper2); border-radius: var(--r); padding: 22px; display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; max-width: 420px; text-decoration: none; box-shadow: 0 1px 0 var(--line); }
.promo .pi { font-size: 46px; }
.promo b { font: 700 22px/1.2 var(--serif); }
.promo span { color: var(--ink2); line-height: 1.45; }
.promo .lbl { font: 650 11px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink2); }
.printing { align-items: center; justify-content: center; text-align: center; gap: 12px; }
.printing .press { width: 64px; height: 64px; border-radius: 16px; background: var(--paper2); position: relative; overflow: hidden; }
.printing .press::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--ink) 18%, transparent), transparent); animation: sweep 1.2s linear infinite; }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ---------- reader (article pages) ---------- */
#reader { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; padding: calc(var(--top) + 6px) 14px calc(var(--bot) + 10px); max-width: 1440px; margin: 0 auto; }
#readerBar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; min-height: 46px; margin-bottom: 6px; }
#rTitle { text-align: center; font: 600 13px/1.2 var(--sans); color: var(--ink2); letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ic-gap { width: 40px; }
.a-media { position: absolute; inset: 0; background: #111; }
.a-media img { width: 100%; height: 100%; object-fit: cover; }
.a-media iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.a-media .play { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 72px; height: 72px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 28px; }
.a-text { position: absolute; inset: 0; padding: 28px 30px 22px; display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.a-text .tk { font: 650 12px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--c); }
.a-text h2 { margin: 0; font: 700 clamp(24px, 3vw, 40px)/1.12 var(--serif); letter-spacing: -.01em; }
.a-text .sum { margin: 0; font: 400 clamp(16px, 1.6vw, 19px)/1.55 var(--serif); color: var(--ink); }
.a-text .meta { color: var(--ink2); font-size: 14px; }
.a-text .also { display: flex; flex-wrap: wrap; gap: 6px; }
.a-text .also a { font-size: 13px; background: var(--chip); border-radius: 999px; padding: 6px 10px; text-decoration: none; }
.a-text .acts { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.a-single .a-media { bottom: 55%; }
.a-single .a-text { top: 45%; padding: 18px 20px 16px; gap: 9px; }
.dogear { position: absolute; top: 0; right: 0; width: 54px; height: 54px; border: 0; padding: 0; background: transparent; z-index: 5; }
.dogear::before { content: ""; position: absolute; inset: 0; background: linear-gradient(225deg, var(--bg) 50%, color-mix(in srgb, var(--paper2) 80%, #000) 50%, var(--paper2) 100%); border-radius: 0 var(--r) 0 0; opacity: 0; transition: opacity .2s; }
.dogear::after { content: "🔖"; position: absolute; top: 9px; right: 9px; font-size: 16px; opacity: .55; }
.dogear.on::before { opacity: 1; }
.dogear.on::after { opacity: 1; }

/* ---------- AplusZ Browser (full story) ---------- */
#viewer { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; padding-top: var(--top); animation: vin .22s ease; }
@keyframes vin { from { transform: translateY(24px); opacity: .4; } to { transform: none; opacity: 1; } }
#viewerBar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 12px; max-width: 1440px; width: 100%; margin: 0 auto; }
#vTitle { display: flex; flex-direction: column; align-items: center; min-width: 0; line-height: 1.15; }
#vTitle b { font: 700 15px/1.1 var(--serif); letter-spacing: .01em; }
#vSource { font: 600 12px/1.2 var(--sans); color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
#vSource::before { content: "🔒 "; font-size: 10px; }
.vbtns { display: flex; gap: 6px; }
#vBody { position: relative; flex: 1; max-width: 1440px; width: 100%; margin: 0 auto; padding: 0 12px calc(var(--bot) + 10px); }
#vFrame { width: 100%; height: 100%; border: 0; background: #fff; border-radius: var(--r); display: block; }
#vProgress { position: absolute; left: 12px; right: 12px; top: 0; height: 3px; border-radius: 3px; overflow: hidden; z-index: 2; pointer-events: none; }
#vProgress::after { content: ""; position: absolute; inset: 0; width: 40%; background: linear-gradient(90deg, transparent, #e0526b, transparent); animation: vprog 1s linear infinite; }
#vProgress.done { display: none; }
@keyframes vprog { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
#vOut { position: absolute; inset: 0 12px calc(var(--bot) + 10px); background: var(--paper); border-radius: var(--r); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 24px; }
#vOut p { margin: 0; font-size: 17px; line-height: 1.5; max-width: 26em; }
#vCloseBottom { position: absolute; left: 50%; bottom: calc(var(--bot) + 22px); translate: -50% 0; z-index: 4; width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--ink); color: var(--paper); font-size: 18px; display: grid; place-items: center; padding: 0; box-shadow: var(--shadow); opacity: .9; }
#vCloseBottom:active { transform: scale(.95); }
/* reading mode: the story's own text on turning pages */
#vRead { position: absolute; inset: 0 12px calc(var(--bot) + 10px); }
.rpage { background: var(--paper); }
.rclip { position: absolute; overflow: hidden; }
.rcols { column-fill: auto; font: 400 var(--rfs, 19px)/1.62 var(--serif); color: var(--ink); }
.rcols > * { margin: 0 0 .85em; }
.rcols p { text-align: start; hyphens: auto; -webkit-hyphens: auto; }
.rcols .rk { font: 650 12px/1.3 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--ink2); }
.rcols h1 { font: 700 calc(var(--rfs, 19px) * 1.65)/1.15 var(--serif); letter-spacing: -.01em; margin-bottom: .45em; }
.rcols .rby { font: 500 14px/1.4 var(--sans); color: var(--ink2); }
.rcols h2 { font: 700 calc(var(--rfs, 19px) * 1.15)/1.25 var(--serif); margin-top: 1.1em; break-after: avoid; }
.rcols blockquote { margin-inline: 0; padding-inline-start: 14px; border-inline-start: 3px solid #e0526b; font-style: italic; }
.rcols figure { margin: 0 0 .9em; break-inside: avoid; }
.rcols figure img { width: 100%; height: var(--rimg, 300px); object-fit: cover; border-radius: 10px; display: block; background: var(--paper2); }
.rcols li { margin-inline-start: 1.1em; list-style: disc; display: list-item; }
.rcols .rend { font: 600 13px/1.5 var(--sans); color: var(--ink2); border-top: 1px solid var(--line); padding-top: 10px; break-inside: avoid; }
.rcols .rend a { color: var(--ink2); }
.rpn { position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; font: 600 11px/1 var(--sans); color: var(--ink2); letter-spacing: .05em; }
#viewer.reading .vedge { display: none; }
.vlogo { width: 72px; height: 72px; border-radius: 20px; background: var(--ink); color: var(--paper); display: flex; align-items: center; justify-content: center; font: 800 30px/1 var(--serif); box-shadow: var(--shadow); }
.vlogo span { color: #e0526b; margin-left: -2px; }

/* ---------- scrubber ---------- */
#scrub { display: grid; grid-template-columns: minmax(0, 1fr) minmax(120px, 3fr) minmax(0, 1fr); align-items: center; gap: 12px; min-height: 30px; font: 600 12px/1 var(--sans); color: var(--ink2); }
#scrubSec { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; letter-spacing: .06em; }
#scrubLeft { display: flex; align-items: center; gap: 12px; min-width: 0; }
#scrubLeft #scrubSec { min-width: 0; }
#bComments { flex: none; border: 0; background: none; padding: 6px 0; margin: 0; color: inherit; font: inherit; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; }
#scrubNum { text-align: end; white-space: nowrap; }
#scrubRight { display: flex; align-items: center; justify-content: flex-end; gap: 14px; min-width: 0; }
#bGoFull { flex: none; border: 0; background: none; padding: 6px 0; margin: 0; color: inherit; font: inherit; text-transform: uppercase; letter-spacing: .06em; cursor: pointer; white-space: nowrap; }
#bGoFull:hover, #bComments:hover { color: var(--ink); }
#scrubBar { position: relative; height: 22px; cursor: pointer; touch-action: none; }
#scrubBar::before { content: ""; position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 4px; background: var(--line); }
#scrubFill { position: absolute; left: 0; top: 9px; height: 4px; border-radius: 4px; background: var(--ink); }
#scrubKnob { position: absolute; top: 3px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--paper); box-shadow: 0 1px 4px rgba(0,0,0,.3); }

/* ---------- sheets, pop-ups, toast ---------- */
#sheet { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.36); display: flex; align-items: center; justify-content: center; padding: calc(var(--top) + 12px) 12px calc(var(--bot) + 12px); }
#sheetBox { background: var(--paper); color: var(--ink); width: min(520px, 100%); max-height: 100%; overflow: auto; border-radius: 18px; padding: 20px 20px 18px; box-shadow: var(--shadow); }
#sheetBox h2 { margin: 0 0 12px; font: 700 24px/1.15 var(--serif); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
#sheetBox h3 { margin: 16px 0 8px; font: 700 13px/1.2 var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--ink2); }
#sheetBox p { line-height: 1.5; margin: 6px 0; }
.x { width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--chip); font-size: 16px; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { border: 0; background: var(--chip); border-radius: 999px; padding: 8px 12px; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; }
.chip.c { background: color-mix(in srgb, var(--c) 18%, var(--paper2)); }
.chip .del { opacity: .6; }
.field { display: flex; gap: 8px; margin: 8px 0; }
.field input { flex: 1; min-width: 0; border: 1px solid var(--line); background: var(--paper2); color: var(--ink); border-radius: 12px; padding: 12px 14px; font-size: 16px; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan { background: var(--paper2); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.plan.pro { background: color-mix(in srgb, #e0526b 12%, var(--paper2)); }
.plan b { font: 700 18px/1.2 var(--serif); }
.plan ul { margin: 4px 0 0; padding-inline-start: 18px; font-size: 14px; line-height: 1.5; }
.price { font: 700 26px/1 var(--serif); }
.muted { color: var(--ink2); font-size: 14px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.links { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-size: 14px; }
#pop { position: fixed; z-index: 70; background: var(--paper); color: var(--ink); border-radius: 14px; box-shadow: var(--shadow); padding: 8px; min-width: 180px; max-width: min(320px, calc(100vw - 16px)); }
#pop button { display: flex; width: 100%; border: 0; background: none; text-align: start; padding: 10px 12px; border-radius: 10px; gap: 10px; align-items: center; font-size: 15px; }
#pop button:hover, #pop button.on { background: var(--chip); }
#pop input { width: 100%; border: 1px solid var(--line); background: var(--paper2); color: var(--ink); border-radius: 10px; padding: 9px 10px; font-size: 15px; margin-bottom: 6px; }
#pop .grp { font: 650 11px/1 var(--sans); letter-spacing: .07em; text-transform: uppercase; color: var(--ink2); padding: 8px 12px 4px; }
#toast { position: fixed; left: 50%; bottom: calc(var(--bot) + 48px); translate: -50% 0; z-index: 80; background: var(--ink); color: var(--paper); border-radius: 14px; padding: 11px 14px; font-size: 14.5px; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow); max-width: calc(100vw - 24px); flex-wrap: wrap; justify-content: center; }
#toast button { border: 0; background: color-mix(in srgb, var(--paper) 18%, transparent); color: var(--paper); border-radius: 999px; padding: 6px 10px; font-size: 13.5px; font-weight: 650; }

/* ---------- "Want to move to the next article?" ---------- */
#ask { position: fixed; top: 50%; translate: 0 -50%; z-index: 90; width: min(230px, calc(50vw - 20px)); background: var(--paper); color: var(--ink); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 9px; align-items: stretch; text-align: center; box-shadow: var(--shadow); }
#ask.r { right: calc(env(safe-area-inset-right, 0px) + 12px); animation: askr .2s ease; }
#ask.l { left: calc(env(safe-area-inset-left, 0px) + 12px); animation: askl .2s ease; }
@keyframes askr { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes askl { from { transform: translateX(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
#ask span { font: 600 16px/1.3 var(--serif); }
#ask .btn { padding: 11px 12px; width: 100%; }
.vedge { position: absolute; top: 40px; bottom: calc(var(--bot) + 40px); width: 30px; z-index: 3; cursor: pointer; touch-action: none; }
.vedge.l { left: 0; } .vedge.r { right: 0; }
.vedge.r::after, .vedge.l::after { content: ""; position: absolute; top: 50%; width: 6px; height: 54px; margin-top: -27px; border-radius: 6px; background: color-mix(in srgb, var(--ink) 22%, transparent); }
.vedge.r::after { right: 2px; } .vedge.l::after { left: 2px; }

/* ---------- install gate (tablet & phone) ---------- */
#gate { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: grid; place-items: center; padding: 24px; }
#gateBox { max-width: 420px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
#gateBox img { border-radius: 20px; box-shadow: var(--shadow); }
#gateBox h2 { margin: 0; font: 800 34px/1 var(--serif); }
#gateBox p { margin: 0; font-size: 17px; line-height: 1.5; color: var(--ink2); }
#gHow { text-align: start; font-size: 16px; line-height: 1.6; margin: 0; padding-inline-start: 22px; }

/* ---------- SSR text for readers without script (hidden once the app starts) ---------- */
#ssr { padding: 12px; overflow: auto; height: 100%; font-family: var(--serif); }
.js #ssr { display: none; }

/* ---------- phone ---------- */
@media (max-width: 600px) {
  #app { padding-left: 8px; padding-right: 8px; }
  #brand { font-size: 19px; }
  .ic { width: 36px; height: 36px; font-size: 16px; }
  .rib { flex: 0 0 auto; padding: 7px 10px 8px; font-size: 12.5px; }
  .tile .td { font-size: 13px; }
  .a-text h2 { font-size: 24px; }
  .plans { grid-template-columns: 1fr; }
  #scrub { grid-template-columns: auto minmax(60px, 1fr) auto; gap: 10px; }
}
/* computer: hover cues */
@media (hover: hover) {
  .tile:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 60%, transparent); }
  .rib:hover { opacity: 1; }
}

/* ---------- round 3: cover, contents, big story, week, chips, peeks, zoom, shelf, reading extras ---------- */
img.fade { opacity: 0; transition: opacity .35s ease; } /* pictures only: the book stage uses "fade" for its jump animation */
img.fade.in { opacity: 1; }
.tile h3, .rcols h1, .cv-main h2, .big-img h2 { text-wrap: balance; }
.pg-cover { position: absolute; inset: 0; overflow: hidden; background: #111; }
.cv-img { position: absolute; inset: 0; cursor: pointer; }
.cv-img img { width: 100%; height: 100%; object-fit: cover; }
.cv-top { position: absolute; left: 0; right: 0; top: 0; padding: 22px 24px 46px; background: linear-gradient(to bottom, rgba(0,0,0,.62), rgba(0,0,0,0)); color: #fff; pointer-events: none; }
.cv-top .mast { margin: 0; font: 800 clamp(34px, 6vw, 68px)/.95 var(--serif); letter-spacing: -.02em; }
.cv-top .ed { display: flex; justify-content: space-between; gap: 10px; margin-top: 8px; padding-top: 6px; border-top: 2px solid rgba(255,255,255,.85); font: 650 12px/1.2 var(--sans); letter-spacing: .1em; text-transform: uppercase; }
.cchips { position: absolute; left: 18px; right: 18px; top: clamp(110px, 18%, 160px); display: flex; flex-direction: column; gap: 8px; align-items: flex-start; z-index: 3; }
.cchip { border: 0; background: rgba(255,255,255,.92); color: #1d1b18; border-radius: 14px; padding: 9px 12px; font: 600 13.5px/1.3 var(--sans); display: flex; gap: 8px; align-items: center; max-width: 100%; text-align: start; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.cchip b { font: 700 14px/1.25 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
.cchip .upd { background: #e0526b; color: #fff; border-radius: 8px; padding: 3px 7px; font: 700 11px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; }
.cchip.ev { background: #1d1b18; color: #fff; }
.cv-lines { position: absolute; left: 0; right: 0; bottom: 0; padding: 70px 24px 22px; background: linear-gradient(to top, rgba(0,0,0,.9), rgba(0,0,0,.55) 60%, rgba(0,0,0,0)); display: flex; flex-direction: column; gap: 10px; color: #fff; }
.cv-main, .cv-line { border: 0; background: none; color: inherit; text-align: start; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cv-main h2 { margin: 0; font: 700 clamp(24px, 3.6vw, 44px)/1.08 var(--serif); }
.cv-main .tk, .cv-line span { font: 650 11px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; opacity: .9; }
.cv-line { border-top: 1px solid rgba(255,255,255,.3); padding-top: 9px; }
.cv-line b { font: 600 clamp(15px, 1.8vw, 19px)/1.25 var(--serif); }
.cv-lines .hint { font: 500 13px/1 var(--sans); opacity: .8; text-align: end; }
.contents .ct-head { font: 800 clamp(26px, 3.4vw, 38px)/1.05 var(--serif); margin: 0 0 14px; }
.ct-list { display: flex; flex-direction: column; gap: 4px; }
.ct-row { border: 0; background: none; display: grid; grid-template-columns: 14px 1fr auto; gap: 12px; align-items: center; padding: 10px 8px; border-radius: 12px; text-align: start; }
.ct-row:hover { background: var(--paper2); }
.ct-row b { font: 600 18px/1.2 var(--serif); }
.ct-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); }
.ct-pg { font: 700 15px/1 var(--sans); color: var(--ink2); }
.pg-big { position: absolute; inset: 0; }
.big-img { position: absolute; inset: 0; cursor: pointer; background: #111; }
.big-img img { width: 100%; height: 100%; object-fit: cover; }
.big-img .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 60px 24px 22px; color: #fff; background: linear-gradient(to top, rgba(0,0,0,.88), rgba(0,0,0,0)); }
.big-img .cap h2 { margin: 6px 0 0; font: 700 clamp(22px, 3.2vw, 40px)/1.1 var(--serif); }
.big-img .tk { font: 650 11px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.pg-big.both .big-img { bottom: 50%; }
.pg-big.both .big-list { position: absolute; top: 50%; left: 0; right: 0; bottom: 0; padding: 14px 20px; overflow: hidden; }
.big-list .ct-head { font: 700 20px/1.2 var(--serif); margin: 0 0 8px; }
.big-row { border: 0; background: var(--paper2); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; display: flex; flex-direction: column; gap: 4px; text-align: start; width: 100%; }
.big-row span { font: 650 11px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); }
.big-row b { font: 600 16px/1.25 var(--serif); }
.week .ct-head { font: 800 clamp(24px, 3vw, 34px)/1.1 var(--serif); margin: 0 0 10px; }
.wk-row { border: 0; background: none; display: grid; grid-template-columns: 34px 72px 1fr; gap: 12px; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: start; width: 100%; }
.wk-n { font: 800 26px/1 var(--serif); color: #1d4ed8; }
.wk-img { width: 72px; height: 54px; border-radius: 10px; overflow: hidden; background: var(--paper2); }
.wk-img img { width: 100%; height: 100%; object-fit: cover; }
.wk-t { display: flex; flex-direction: column; gap: 3px; }
.wk-t small { font: 650 10.5px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--ink2); }
.wk-t b { font: 600 16px/1.25 var(--serif); }
.peek { position: absolute; right: 0; bottom: 0; width: 132px; height: 132px; border: 0; padding: 0; z-index: 6; background: linear-gradient(315deg, transparent 50%, rgba(0,0,0,.18) 50.5%, var(--c) 52%, color-mix(in srgb, var(--c) 70%, #fff) 100%); clip-path: polygon(100% 0, 100% 100%, 0 100%); border-radius: 0 0 var(--rs) 0; filter: drop-shadow(-3px -3px 6px rgba(0,0,0,.12)); }
.peek span { position: absolute; right: 8px; bottom: 10px; width: 92px; color: #fff; font: 700 11.5px/1.2 var(--sans); text-align: end; }
.hchips { position: absolute; left: 6px; right: 6px; bottom: 6px; z-index: 5; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; padding: 8px; background: rgba(255,255,255,.95); border-radius: 12px; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
.hchips .chip { background: color-mix(in srgb, #e0526b 14%, #fff); color: #1d1b18; font-size: 13px; padding: 7px 10px; }
#ask #askPreview { display: flex; flex-direction: column; gap: 6px; text-align: start; }
#ask #askPreview img { width: 100%; height: 110px; object-fit: cover; border-radius: 10px; }
#ask #askPreview b { font: 600 14px/1.3 var(--serif); }
#zoom { position: fixed; inset: 0; z-index: 120; background: rgba(0,0,0,.94); display: grid; place-items: center; touch-action: none; overflow: hidden; }
#zoom img { max-width: 100%; max-height: 100%; transform-origin: center; transition: transform .06s linear; user-select: none; -webkit-user-drag: none; }
#zoom .zx { position: absolute; top: calc(var(--top) + 12px); right: 12px; background: rgba(255,255,255,.9); }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.shelf-item { border: 0; background: none; display: flex; flex-direction: column; gap: 4px; text-align: start; padding: 0; }
.shelf-cover { aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--paper2); box-shadow: 0 6px 14px rgba(0,0,0,.15); }
.shelf-cover img { width: 100%; height: 100%; object-fit: cover; }
.shelf-item b { font: 600 14px/1.2 var(--serif); }
.shelf-item small { color: var(--ink2); font-size: 12px; }
.rcols > p:first-of-type::first-letter { float: left; font: 700 calc(var(--rfs, 19px) * 3.1)/0.82 var(--serif); padding: 6px 8px 0 0; color: var(--ink); }
#viewer:not(.reading) .rd { display: none; }
#vListen.on { background: #e0526b; color: #fff; }
#viewer.chrome-off #viewerBar, #viewer.chrome-off #vCloseBottom { display: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tile:focus-visible, .btn:focus-visible, .ic:focus-visible, .rib:focus-visible, .chip:focus-visible, #brand:focus-visible { background-color: color-mix(in srgb, #e0526b 22%, var(--paper2)); }
#gate.behind { background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
#gateArrow { position: fixed; z-index: 101; font-size: 46px; color: #e0526b; animation: bob 1.1s ease-in-out infinite; filter: drop-shadow(0 4px 8px rgba(0,0,0,.25)); }
#gateArrow.down { left: 50%; bottom: calc(var(--bot) + 6px); translate: -50% 0; }
#gateArrow.up { right: 70px; top: calc(var(--top) + 4px); transform: rotate(180deg); }
@keyframes bob { 0%, 100% { margin-bottom: 0; margin-top: 0; } 50% { margin-bottom: 12px; margin-top: 12px; } }
.switch { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; }
.switch input[type=checkbox] { width: 44px; height: 26px; accent-color: #e0526b; }
.switch input[type=time] { border: 1px solid var(--line); background: var(--paper2); color: var(--ink); border-radius: 10px; padding: 8px; font-size: 15px; }

/* one of his sites per visible page (Free) */
.promo-strip { position: absolute; left: 12px; right: 12px; bottom: 8px; height: 40px; display: flex; align-items: center; justify-content: center; text-align: center; gap: 8px; padding: 0 10px; border-radius: var(--rs); background: var(--paper2); text-decoration: none; color: inherit; z-index: 3; overflow: hidden; }
.promo-strip .pi { font-size: calc(var(--bf, 17px) * 1.05); line-height: 1; }
.promo-strip .pt { display: flex; align-items: baseline; justify-content: center; gap: 7px; min-width: 0; overflow: hidden; }
.promo-strip .pt b { font: 700 var(--bf, 17px)/1.1 var(--serif); letter-spacing: -.005em; white-space: nowrap; }
.promo-strip .pt small { color: var(--ink2); font: 400 var(--bf, 17px)/1.1 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.promo-strip .go { color: var(--ink2); font-size: calc(var(--bf, 17px) * .8); }
#vRead .promo-strip, .a-page .promo-strip { z-index: 7; }
#vRead .promo-strip { top: 8px; bottom: auto; }
.a-page .promo-strip { bottom: calc(var(--bot) + 4px); }
.pg-front .fr-mast .mast { font: 800 26px/1 var(--serif); margin: 0; cursor: pointer; }
.pg-front .fr-mast span { color: var(--ink2); font-size: 12.5px; }
.pg-front .tile, .pg-front .promo-strip { transform: translateY(38px); }
.pg-front .fr-mast { height: 38px; align-items: center; background: none; }

.cont-band { position: absolute; display: flex; align-items: center; gap: 8px; border: 0; border-radius: var(--rs); padding: 0 10px; background: color-mix(in srgb, var(--ink) 10%, var(--paper2)); color: var(--ink); font: 600 11.5px/1 var(--sans); overflow: hidden; text-align: start; z-index: 3; }
.cont-band .cl { text-transform: uppercase; letter-spacing: .06em; font-size: 10px; color: var(--ink2); white-space: nowrap; }
.cont-band b { font: 650 12.5px/1 var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cont-band .go { margin-left: auto; color: var(--ink2); font-size: 12px; }

/* the site band has its own room: nothing it could cover sits under it */
.pg-wrap { position: absolute; inset: 0; }
.pg-wrap > :first-child { overflow: hidden; }
.a-page.banded > .a-text, .a-page.banded > .a-media { bottom: 56px; }
.a-single.banded > .a-media { bottom: 55%; }

/* PC edition: full screen beside the theme (F11 does the same) */
#bFull .fs-off { display: none; }
:fullscreen #bFull .fs-on { display: none; }
:fullscreen #bFull .fs-off { display: inline; }

/* Topics pop-up */
.tp-results { display: flex; flex-direction: column; gap: 2px; margin: 0 0 6px; }
.tp-row { border: 0; background: none; color: var(--ink); text-align: start; padding: 9px 10px; border-radius: 10px; font: 500 15px/1.35 var(--serif); }
.tp-row:hover { background: var(--chip); }
.tp-row b { font-family: var(--sans); }
.tp-sec { font: 650 10.5px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; }
#sheetBox .chips small { margin-left: 2px; }

.tp-pick.on { background: color-mix(in srgb, var(--c, var(--ink)) 22%, var(--paper2)); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c, var(--ink)) 70%, transparent); font-weight: 650; }
.tp-pick.on::before { content: "✓ "; }
.tp-foot { position: sticky; bottom: -18px; padding: 12px 0 2px; background: linear-gradient(transparent, var(--paper) 35%); display: flex; justify-content: center; }
.tp-save { min-width: 160px; }

/* plans */
.picker { display: flex; flex-direction: column; gap: 8px; align-items: center; margin: 8px 0 4px; }
.seg { display: inline-flex; background: var(--chip); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; color: var(--ink); border-radius: 999px; padding: 7px 14px; font: 600 14px/1 var(--sans); }
.seg button.on { background: var(--paper); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg .save { color: #15803d; font-weight: 700; }
.pick-price { font: 700 22px/1.2 var(--serif); margin: 2px 0; }
.pl-foot { font-size: 12.5px; margin-top: 8px; }
.switch.fixed { opacity: .55; cursor: pointer; } /* greyed out, and a tap says why */
.switch.fixed input { pointer-events: none; }
.codebox summary { cursor: pointer; color: var(--ink2); font-size: 14px; margin: 10px 0 4px; }
.code-chip { border: 1.5px dashed var(--ink2); background: none; color: var(--ink); border-radius: 12px; padding: 10px 16px; font: 700 20px/1 var(--sans); letter-spacing: .14em; }
.fam .field input { font-size: 15px; }
#gOther { font-weight: 600; }

/* his sites as full cards on collage pages (Free) */
.tile.promo-card { text-decoration: none; color: inherit; background: var(--paper2); }
.tile.promo-card .ti { background: color-mix(in srgb, var(--ink) 8%, var(--paper2)); }
.tile.promo-card .ti { position: relative; overflow: hidden; }
.tile.promo-card .ti .bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: blur(16px) saturate(1.1); transform: scale(1.2); opacity: .55; }
.tile.promo-card .ti .fg { position: relative; width: 100%; height: 100%; object-fit: contain; display: block; }
.tile.promo-card .tx { position: relative; gap: 6px; }
.tile.promo-card .tk { color: var(--ink2); text-transform: none; letter-spacing: .02em; }
.tile.promo-card .td { display: block; color: var(--ink2); line-height: 1.42; }
.tile.promo-card .go { position: absolute; right: 10px; bottom: 8px; color: var(--ink2); font-size: 13px; }
.tile.promo-card.st-t { border-top: 0; background: var(--paper2); }

.ask-me { animation: askme .45s ease; box-shadow: 0 0 0 2px color-mix(in srgb, var(--ink) 35%, transparent) !important; }
@keyframes askme { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* #21 one text size everywhere the reader reads */
.a-text > *, #sheetBox > :not(h2) { zoom: var(--ts, 1); }
#bookHost.snap { pointer-events: none; }
/* #20 hand-off to the next section */
.next-sec { position: absolute; left: 12px; right: 12px; bottom: 4px; height: 26px; border: 0; background: transparent; color: var(--ink); font: 500 13px/26px var(--sans); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; border-top: 1px solid color-mix(in srgb, var(--ink) 14%, transparent); }
.next-sec b { color: var(--c); font-weight: 700; }
/* #16 word meaning */
#meaning { position: fixed; z-index: 80; background: var(--paper); color: var(--ink); border-radius: 14px; box-shadow: var(--shadow); padding: 12px 14px; max-height: 60vh; overflow: auto; }
#meaning .mn-word { font: 700 19px/1.2 var(--serif); margin: 0 0 6px; }
#meaning .mn-def { margin: 0 0 6px; line-height: 1.45; }
#meaning .mn-ex { margin: 0 0 8px; font-style: italic; line-height: 1.4; }
#meaning .mn-foot { display: flex; flex-wrap: wrap; gap: 6px; }
#meaning .mn-foot .chip { text-decoration: none; }
#meaning input { width: 100%; }
#meaning .mn-langs { display: flex; flex-direction: column; margin-top: 6px; }
#meaning .tp-row { text-align: start; padding: 8px 6px; border: 0; background: transparent; color: inherit; cursor: pointer; border-radius: 8px; }
#meaning .tp-row:hover { background: var(--paper2); }
/* Fable items */
.tile.is-new::after { content: ""; position: absolute; top: 10px; left: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); z-index: 4; }
.tile.was-read { opacity: .72; }
button.ct-extra { align-self: flex-start; width: max-content; display: inline-flex; align-items: center; gap: 6px; margin: 10px 8px 0 34px; border: 0; background: var(--chip); color: var(--ink); border-radius: 999px; padding: 9px 16px; font: 600 14px/1 var(--sans); cursor: pointer; }
.happy-code { margin-top: 12px; text-align: center; }
.code-chip.small { font-size: 12px; padding: 4px 8px; }
#meaning .tp-row.sug { background: var(--paper2); }
/* comments */
.cm-form textarea { width: 100%; min-height: 76px; resize: vertical; border: 1px solid var(--line); background: var(--paper2); color: var(--ink); border-radius: 12px; padding: 12px 14px; font: 400 16px/1.45 var(--sans); box-sizing: border-box; }
.cm-form .field { margin-bottom: 8px; }
.cm-form .cm-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; }
.cm-list { margin-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.cm-item { border-top: 1px solid color-mix(in srgb, var(--ink) 12%, transparent); padding-top: 10px; }
.cm-item .cm-who { font: 600 13px/1.2 var(--sans); }
.cm-item .cm-who small { font-weight: 400; color: var(--ink2); }
.cm-item .cm-body { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.cm-item .cm-acts { display: flex; gap: 14px; margin-top: 4px; }
.cm-item .cm-acts button { border: 0; background: none; padding: 2px 0; color: var(--ink2); font: 500 12px/1 var(--sans); cursor: pointer; }
.shake { animation: askme .32s ease 2; }
/* ---------- look and feel: soft entrances, gentle presses, smooth theme changes ---------- */
@keyframes sheetIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes boxIn { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: translateY(-4px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
#sheet { animation: sheetIn .18s ease-out; }
#sheetBox { animation: boxIn .24s cubic-bezier(.2, .8, .2, 1); overscroll-behavior: contain; scrollbar-width: thin; }
#pop { animation: popIn .14s ease-out; transform-origin: top center; overscroll-behavior: contain; }
#meaning { animation: popIn .16s ease-out; overscroll-behavior: contain; }
#toast { animation: toastIn .2s ease-out; }
.btn, .chip, .ic, .rib, .ct-row, .cv-line, .big-row, .wk-row, #bComments, #bGoFull, button.ct-extra, .next-sec { transition: transform .12s ease, background-color .2s ease, opacity .2s ease, color .2s ease; }
.btn:active, .chip:active, .ic:active, button.ct-extra:active { transform: scale(.96); }
.ct-row:active, .cv-line:active, .big-row:active, .wk-row:active { transform: scale(.985); }
html.theme-anim, html.theme-anim body, html.theme-anim * { transition: background-color .35s ease, color .35s ease, border-color .35s ease, fill .35s ease !important; }
@media (prefers-reduced-motion: reduce) {
  #sheet, #sheetBox, #pop, #meaning, #toast { animation: none; }
  .btn:active, .chip:active, .ic:active, .ct-row:active { transform: none; }
}
/* screensaver: stories give way softly */
.tile.saver-fade { transition: opacity 1.2s ease, transform 1.2s cubic-bezier(.22,.7,.18,1); }
.tile.saver-in { opacity: 0; transform: translateY(18px) scale(.97); }
.tile.saver-out { opacity: 0; transition: opacity 1.2s ease; pointer-events: none; }
/* phones: the masthead gives way so both icon groups always fit, no edge ever cut */
@media (max-width: 560px) {
  #bar { grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px; }
  #brand { padding: 2px 2px; font-size: clamp(15px, 4.6vw, 22px); min-width: 0; overflow: hidden; }
  #brand > * { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  #bInstall, #bFull { display: none !important; } /* phone-size: install happens on opening, Install stays a PC thing */
}

/* immersive: after 16 s without input the page fills the screen, smoothly; any input brings the bars back */
#bar, #ribbons, #scrub, #readerBar, #viewerBar, #vCloseBottom, .vedge { transition: opacity var(--imm-d, .5s) ease; }
html.imm-mag #bar, html.imm-mag #ribbons, html.imm-mag #scrub,
html.imm-read #readerBar,
html.imm-view #viewerBar, html.imm-view #vCloseBottom, html.imm-view .vedge,
html.imm-frame #viewerBar, html.imm-frame #vCloseBottom, html.imm-frame .vedge { opacity: 0; pointer-events: none; }
html.imm-mag #bookHost, html.imm-read #readerHost, html.imm-view #vBody, html.imm-frame #vBody {
  position: fixed; top: calc(var(--top) + 6px); left: 6px; right: 6px; bottom: calc(var(--bot) + 6px); width: auto; height: auto; max-width: none; margin: 0; padding: 0; z-index: 45; }
html.imm-read #readerHost { z-index: 35; }
html.imm-mag #bookHost { z-index: 25; }
html.imm-view #vRead, html.imm-view #vOut, html.imm-frame #vOut { inset: 0; }
html.imm-view #vProgress, html.imm-frame #vProgress { left: 0; right: 0; }

/* top bar auto-fit (tablet and phone first): sizes follow the screen, then the fitter shrinks the name, the icons and the gaps until all fits on one line */
@media (pointer: coarse), (max-width: 1100px) {
  #bar { gap: var(--bgap, clamp(4px, 1.2vw, 10px)); }
  #bar .side { gap: var(--sgap, clamp(2px, .8vw, 8px)); }
  #bar .ic { width: var(--ics, clamp(34px, 5.2vw, 44px)); height: var(--ics, clamp(34px, 5.2vw, 44px)); }
  #bar .ic svg { width: 56%; height: 56%; }
  #brand { font-size: var(--bfs, clamp(16px, 3.3vw, 24px)); }
  #brand small { font-size: var(--bsm, clamp(9.5px, 1.6vw, 12px)); }
  #bar .pill { font-size: var(--pfs, clamp(12px, 1.9vw, 14px)); padding: 6px clamp(6px, 1.2vw, 10px); }
}

/* night softening in full screen (22:00–06:00) */
html::after { content: ""; position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 70; transition: opacity 1.5s ease; }
html.imm-night::after { opacity: .3; transition-duration: 3s; }
