/* ink world web reader layout. Components come from /shared/ink.css; tokens from /shared/tokens.css.
   Phone under 720 px: tab bar and safe areas. From 720 px: left rail, wider grids, two-pane story, centred reading column. */

/* Text-safe accent tokens (the fill tokens stay in tokens.css). */
:root { --seal-text: #C8371F; --azurite-text: #2E5C8A; --malachite-text: #2F7D5B; --gutter: max(16px, env(safe-area-inset-left, 0px)); --gutter-r: max(16px, env(safe-area-inset-right, 0px)); --rail-w: 0px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --seal-text: #E8735E; --azurite-text: #7FA6D1; --malachite-text: #5FB28C; } }
:root[data-theme="dark"] { --seal-text: #E8735E; --azurite-text: #7FA6D1; --malachite-text: #5FB28C; }

/* ---------- Night Ink (doc 13 §1): indigo ink, night paper, moon gold. No red anywhere. ---------- */
:root[data-side="night"] {
  --paper: #F3F1F8; --wash: #E8E5F1; --wash-deep: #DAD6E8; --line: #CFCBE0; --ink-faint: #575A89; --ink-soft: #464A80; --ink: #2B2F6B;
  --seal: #B98A2E; --seal-deep: #9C7424; --on-seal: #1B1E45; --azurite: #4B5299; --malachite: #4B5299; --bg: var(--paper); --fg: var(--ink);
  --seal-text: #7D5A12; --azurite-text: #4B5299; --malachite-text: #4B5299; color-scheme: light;
}
@media (prefers-color-scheme: dark) { :root[data-side="night"]:not([data-theme="light"]) { --paper: #12131F; --wash: #1D1F30; --wash-deep: #262838; --line: #2F3247; --ink-faint: #A9A7C4; --ink-soft: #C9C7DE; --ink: #E4E2F2; --seal: #D9AE55; --seal-deep: #C29842; --on-seal: #12131F; --azurite: #A9A7C4; --malachite: #A9A7C4; --seal-text: #D9AE55; --azurite-text: #C9C7DE; --malachite-text: #C9C7DE; --bg: #12131F; --fg: #E4E2F2; color-scheme: dark; } }
:root[data-side="night"][data-theme="dark"] { --paper: #12131F; --wash: #1D1F30; --wash-deep: #262838; --line: #2F3247; --ink-faint: #A9A7C4; --ink-soft: #C9C7DE; --ink: #E4E2F2; --seal: #D9AE55; --seal-deep: #C29842; --on-seal: #12131F; --azurite: #A9A7C4; --malachite: #A9A7C4; --seal-text: #D9AE55; --azurite-text: #C9C7DE; --malachite-text: #C9C7DE; --bg: #12131F; --fg: #E4E2F2; color-scheme: dark; }
:root[data-side="night"] .badge.fresh { color: var(--on-seal); }
:root[data-side="night"] .badge.sub { background: var(--ink); color: var(--paper); }
:root[data-side="night"] .paper-grain { display: none; }
:root[data-side="night"] .night-av { background: var(--wash); border: 1.5px solid var(--ink); }
@media (prefers-reduced-motion: no-preference) {
  :root.retint body, :root.retint .navrail, :root.retint .tabbar, :root.retint .topbar, :root.retint .rtop { transition: background-color 900ms var(--ease), color 900ms var(--ease); }
  .settle-slow { animation: settleIn 900ms var(--ease) both; }
}
@media (prefers-reduced-motion: reduce) { .settle-slow { animation: fadeIn 300ms linear both; } }
.night-av { display: inline-grid; place-items: center; border-radius: 50%; font-family: var(--font-display); font-size: calc(var(--s) * .42); color: var(--ink); }
.crescent { display: block; }

/* ---------- Base ---------- */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font-ui); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; min-height: 100dvh; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 200; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: var(--r-md); font-weight: 700; text-decoration: none; }
.skip:focus { top: 12px; }
main:focus { outline: none; }
a { text-underline-offset: 3px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.block { display: block; }
.center { text-align: center; }
.h3 { font-family: var(--font-display); font-weight: 400; font-size: 24px; line-height: 1.05; }
.err { color: var(--seal-text); }
.btn.danger { color: var(--seal-text); border-color: var(--seal-text); }
.btn.azurite { color: var(--azurite-text); border-color: var(--azurite-text); }
.badge.free { color: var(--malachite-text); border-color: var(--malachite-text); }
.badge.sm { height: 18px; font-size: 9px; padding: 0 5px; }
.chip.sm { min-height: 30px; font-size: 12px; padding: 0 11px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--seal); display: inline-block; flex: none; }
.iconbtn .dot { position: absolute; top: 9px; right: 9px; }
.phone-only { display: flex; }
.desk-only { display: none; }
.mockflag { position: fixed; left: 8px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 150; margin: 0; font-size: 11px; font-weight: 800; background: var(--wash-deep); color: var(--ink-soft); padding: 2px 8px; border-radius: 6px; pointer-events: none; }
.loading { display: grid; place-items: center; gap: 4px; padding: 64px 0; }
.boot { min-height: 60vh; }

/* ---------- Shell ---------- */
.shell { min-height: 100dvh; }
main { display: block; padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)); }
.navrail { display: none; }
.screen { padding: 8px var(--gutter-r) 24px var(--gutter); max-width: 1180px; margin: 0 auto; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--paper); padding: 6px var(--gutter-r) calc(6px + env(safe-area-inset-bottom, 0px)) var(--gutter); }
.tabbar::before { content: ""; position: absolute; left: 0; right: 0; top: -3px; height: 6px; background: var(--ink); opacity: .9; }
.has-tx .tabbar::before { -webkit-mask: var(--tx-mask-rule) center / 100% 100% no-repeat; mask: var(--tx-mask-rule) center / 100% 100% no-repeat; }
.tabbar[hidden] { display: none; }
.tabbar ul { list-style: none; margin: 0; padding: 0; display: flex; justify-content: space-around; }
.tabbar a { position: relative; display: grid; justify-items: center; gap: 2px; min-width: 64px; min-height: 52px; padding-top: 6px; font-size: 12px; color: var(--ink-faint); font-weight: 600; text-decoration: none; }
.tabbar a svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--ink); font-weight: 800; }
.tabbar a[aria-current="page"] svg { stroke-width: 2.4; }
.tabbar a[aria-current="page"]::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 5px; background: var(--seal); border-radius: 3px; }
.has-tx .tabbar a[aria-current="page"]::after { border-radius: 0; -webkit-mask: var(--tx-mask-underline) center / 100% 100% no-repeat; mask: var(--tx-mask-underline) center / 100% 100% no-repeat; }
body[data-route="reader"] main, body[data-route="signin"] main { padding-bottom: 0; }

@media (min-width: 720px) {
  :root { --rail-w: 96px; --gutter: 32px; --gutter-r: 32px; }
  .phone-only { display: none !important; }
  .desk-only { display: inline-block; }
  .shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); }
  main { padding-bottom: 48px; min-width: 0; }
  .tabbar { display: none !important; }
  .navrail { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100dvh; padding: 16px 8px 20px; border-right: 1px solid var(--line); background: var(--paper); overflow-y: auto; z-index: 30; }
  .navrail .brand { display: grid; justify-items: center; gap: 2px; text-decoration: none; color: var(--ink); }
  .navrail .brand-t { font-family: var(--font-display); font-size: 18px; line-height: 1; text-align: center; }
  .navrail ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
  .navrail ul a { position: relative; display: grid; justify-items: center; gap: 2px; min-height: 60px; padding: 8px 4px; border-radius: var(--r-md); color: var(--ink-faint); text-decoration: none; font-size: 12px; font-weight: 600; }
  .navrail ul a svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .navrail ul a[aria-current="page"] { color: var(--ink); font-weight: 800; background: var(--wash); }
  .navrail ul a[aria-current="page"]::before { content: ""; position: absolute; left: -8px; top: 14px; bottom: 14px; width: 4px; border-radius: 2px; background: var(--seal); }
  .navrail ul a .dot { position: absolute; top: 10px; right: 22px; }
  .navrail-foot { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; }
  .navrail-foot .btn.sm { padding: 0 12px; }
  .screen { padding-top: 24px; }
}
@media (hover: hover) { .navrail ul a:hover, .tabbar a:hover { color: var(--ink); } }
@media (min-width: 1100px) {
  :root { --rail-w: 220px; --gutter: 48px; --gutter-r: 48px; }
  .navrail { padding: 24px 16px; }
  .navrail .brand { grid-template-columns: auto 1fr; align-items: center; justify-items: start; gap: 8px; padding: 0 8px; }
  .navrail .brand-t { font-size: 26px; text-align: left; }
  .navrail ul a { grid-template-columns: 24px 1fr; justify-items: start; align-items: center; gap: 12px; min-height: 48px; padding: 0 14px; font-size: 15px; }
  .navrail ul a[aria-current="page"]::before { left: -16px; }
  .navrail ul a .dot { top: 50%; right: 14px; margin-top: -4px; }
  .navrail-foot { align-items: stretch; }
  .navrail-foot .drops { align-self: flex-start; }
}

/* ---------- Day/night switch ---------- */
.sideswitch { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px; border-radius: var(--r-full); color: var(--ink); font-weight: 700; font-size: 13px; }
.ss-track { position: relative; width: 44px; height: 26px; border-radius: 13px; border: 1.5px solid var(--ink); background: var(--paper); flex: none; }
.ss-knob { position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%; background: var(--ink); transition: translate 300ms var(--ease); }
.sideswitch[aria-checked="true"] .ss-knob { translate: 18px 0; background: var(--seal); box-shadow: inset -5px -2px 0 0 var(--paper); }
@media (min-width: 720px) and (max-width: 1099px) { .navrail .ss-l { display: none; } }

/* ---------- Page heads and top bars ---------- */
.pagehead { display: flex; align-items: center; gap: 8px; min-height: 56px; padding-top: env(safe-area-inset-top, 0px); }
.pagehead h1 { flex: 1; min-width: 0; font-size: 36px; }
.pagehead .row { gap: 6px; }
.pagehead .row:empty { display: none; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 4px; min-height: 56px; margin: -8px calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter)); padding: env(safe-area-inset-top, 0px) var(--gutter-r) 0 calc(var(--gutter) - 12px); background: color-mix(in oklab, var(--paper) 92%, transparent); backdrop-filter: blur(8px); }
.topbar .tb-title { flex: 1; min-width: 0; text-align: center; }
.topbar h1 { font-size: 18px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .tb-right { min-width: 44px; display: flex; justify-content: flex-end; }
@media (min-width: 720px) { .pagehead h1 { font-size: 46px; } .topbar { margin-top: -24px; } .topbar .tb-title { text-align: left; } }
html { scroll-padding-top: 72px; }

/* ---------- Story cards, grids, rails ---------- */
.story-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); min-width: 0; border-radius: var(--r-md); }
.story-card .cover { width: 100%; }
.story-card .t { font-weight: 700; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.story-card .m { font-size: 12px; color: var(--ink-faint); display: flex; align-items: center; gap: 4px; }
@media (hover: hover) { .story-card:hover .t { text-decoration: underline; } .story-card:hover .cover { border-color: var(--ink-soft); } }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 20px 14px; }
.screen .rail, div.rail { display: flex; gap: 14px; overflow-x: auto; padding: 4px var(--gutter-r) 10px var(--gutter); margin: 0 calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter)); scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding-inline: var(--gutter) var(--gutter-r); overscroll-behavior-x: contain; }
div.rail::-webkit-scrollbar { display: none; }
div.rail > * { width: 132px; flex: none; scroll-snap-align: start; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 28px 20px; } div.rail > * { width: 160px; } }
@media (min-width: 1500px) { .grid { grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); } }
.cover.sm { width: 64px; }
.cover.xs { width: 52px; }
.srow { display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--ink); padding: 6px 0; }
.srow-t { display: flex; flex-direction: column; min-width: 0; }

/* Home */
.hero { display: grid; grid-template-columns: 120px 1fr; gap: 16px; align-items: start; margin-top: 4px; padding: 16px; border-radius: var(--r-lg); background: var(--wash) var(--tx-wash-mist) top center / 100% 100% no-repeat; }
.hero-cover { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero { background-image: none; } }
:root[data-theme="dark"] .hero { background-image: none; }
.hero-title { font-size: 30px; margin: 4px 0 4px; }
.hero-title a { color: inherit; text-decoration: none; }
@media (hover: hover) { .hero-title a:hover { text-decoration: underline; } }
.hero-blurb { margin: 8px 0 14px; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.hero .row { gap: 12px; }
@media (min-width: 720px) { .hero { grid-template-columns: 220px 1fr; gap: 32px; padding: 28px; align-items: center; } .hero-title { font-size: 48px; } .hero-blurb { font-size: 18px; max-width: 52ch; } }
@media (max-width: 380px) { .hero { grid-template-columns: 96px 1fr; gap: 12px; padding: 12px; } .hero-title { font-size: 26px; } }
.home-mo { padding: 8px 0 0; }
.cont-grid { display: grid; gap: 10px; }
@media (min-width: 720px) { .cont-grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; } }
.cont { display: flex; gap: 14px; align-items: center; text-decoration: none; color: var(--ink); padding: 10px 14px 10px 10px; }
.cont-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cont-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cont-t .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cont .progress { margin-top: 6px; }
@media (hover: hover) { .card.tap:hover { background: var(--wash-deep); } }
.shelves { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 16px 12px; }
@media (min-width: 720px) { .shelves { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 22px 18px; } }
.shelf-tile { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 13px; line-height: 1.2; border-radius: var(--r-md); }
.cover.medal-cover { width: 100%; aspect-ratio: 1; border-radius: 50%; border-width: 2px; }
@media (hover: hover) { .shelf-tile:hover span { text-decoration: underline; } }

/* Explore */
.search { margin: 4px 0 12px; }
@media (min-width: 720px) { .search { max-width: 560px; } }
.filters { display: flex; flex-direction: column; gap: 12px; margin-bottom: 8px; }
.shelf-chips, .tag-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 6px 6px; margin: 0 -6px; scrollbar-width: none; }
.shelf-chips::-webkit-scrollbar, .tag-chips::-webkit-scrollbar { display: none; }
.shelf-chips .chip, .tag-chips .chip { flex: none; }
@media (min-width: 720px) { .shelf-chips, .tag-chips { flex-wrap: wrap; overflow: visible; } }
.tag-chips .chip { background: transparent; border-color: var(--line); }
.sortrow .seg { flex: 1; max-width: 360px; }
.shelf-blurb { margin: 8px 0 16px; }
#count { margin: 8px 0 12px; min-height: 21px; }

/* Empty */
.empty-card { position: relative; width: 140px; margin: 8px auto 4px; }
.empty-card .empty-cover { width: 140px; }
.empty-card .empty-mo { position: absolute; right: -36px; bottom: -14px; }
.empty .btn { margin-top: 8px; }

/* ---------- Story ---------- */
.story-wrap { display: flex; flex-direction: column; gap: 8px; }
.story-top { display: flex; gap: 16px; align-items: flex-start; }
.story-cover { width: 128px; }
.story-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.story-title { font-size: 34px; }
.by { color: var(--azurite-text); font-weight: 700; font-size: 15px; }
.badges { gap: 6px; }
.actions { gap: 10px; margin: 14px 0 6px; }
.actions .btn.grow { flex: 1; }
.blurb { color: var(--ink-soft); margin: 8px 0; }
.tagrow { gap: 6px; margin: 4px 0 8px; }
.tagrow .chip { text-decoration: none; }
.cw-box { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px; }
.cw-box h2 { margin-bottom: 6px; }
.warns { margin: 0; padding-left: 18px; color: var(--ink-soft); font-size: 14px; }
.warns li { margin: 2px 0; }
.spoil { display: inline; font: inherit; color: var(--ink-soft); text-decoration: underline dotted; text-underline-offset: 3px; text-align: left; padding: 6px 0; line-height: inherit; }
.spoil:disabled { text-decoration: none; cursor: default; color: var(--ink-soft); }
.chlist { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--ink); }
.chrow { display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 8px 4px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.chrow .n { width: 44px; flex: none; font-family: var(--font-brush); font-size: 22px; line-height: 1; }
.chrow .t { flex: 1; min-width: 0; }
.chrow .t b { display: block; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chrow .t > span { font-size: 12px; color: var(--ink-faint); }
.chrow .s { flex: none; display: flex; justify-content: flex-end; align-items: center; min-width: 64px; }
.chrow.here { background: var(--wash); }
@media (hover: hover) { .chrow:hover { background: var(--wash); } }
.lockp { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: 14px; }
.lockp svg { width: 11px; height: 14px; }
.lockp.inv { margin-left: 6px; }
@media (min-width: 720px) and (max-width: 959px) { .story-cover { width: 200px; } .story-title { font-size: 40px; } }
@media (min-width: 960px) {
  .story-wrap { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 48px; align-items: start; }
  .story-info { position: sticky; top: 64px; max-height: calc(100dvh - 72px); overflow-y: auto; overscroll-behavior: contain; padding: 0 8px 24px 0; scrollbar-width: thin; }
  .story-top { flex-direction: column; }
  .story-cover { width: 100%; max-width: 300px; }
  .story-title { font-size: 40px; }
  .story-chapters .sec { margin-top: 8px; }
}
@media (min-width: 1100px) { .story-wrap { grid-template-columns: 360px minmax(0, 1fr); gap: 64px; } }

/* Author */
.author-wrap { display: flex; flex-direction: column; gap: 8px; }
.author-head { display: flex; gap: 16px; align-items: center; }
.author-head .ringed { margin: 0; }
.author-head .ringed img { width: 100%; height: 100%; object-fit: cover; }
.author-name { font-size: 36px; }
.author-bio { max-width: 60ch; }
.tiers { max-width: 640px; display: grid; grid-auto-rows: 1fr; } /* every tier the height of the tallest, like the drop packs */
.perks { margin: 0; padding-left: 20px; color: var(--ink-soft); }

/* ---------- Reader ---------- */
.screen-reader { --rsize: 19px; --rlh: 1.7; background: var(--rbg, var(--paper)); color: var(--rfg, var(--ink)); max-width: none; padding: 0 0 calc(88px + env(safe-area-inset-bottom, 0px)); min-height: 100dvh; }
.screen-reader.theme-sepia { --rbg: #F3EAD8; --rfg: #3B3127; --line: #DCCFB6; --ink: #3B3127; --ink-soft: #55493B; --ink-faint: #6B5E4D; --wash: #EADFC8; --paper: #F3EAD8; }
.screen-reader.theme-night { --rbg: #0E0E10; --rfg: #ECEAE3; --line: #2E2E33; --ink: #ECEAE3; --ink-soft: #C9C7C0; --ink-faint: #A09F98; --wash: #1A1A1C; --wash-deep: #26262A; --paper: #0E0E10; color-scheme: dark; }
:root[data-side="night"] .screen-reader.theme-sepia { --rbg: #EEEAF4; --rfg: #2B2F6B; --ink: #2B2F6B; --paper: #EEEAF4; --wash: #E2DDEC; --line: #D2CCE2; --ink-soft: #464A80; --ink-faint: #575A89; }
:root[data-side="night"] .screen-reader.theme-night { --rbg: #12131F; --rfg: #E4E2F2; --ink: #E4E2F2; --paper: #12131F; --wash: #1D1F30; --line: #2F3247; --ink-soft: #C9C7DE; --ink-faint: #A9A7C4; }
body[data-route="reader"] { background: var(--paper); }
.rtop { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 4px; min-height: 56px; padding: env(safe-area-inset-top, 0px) var(--gutter-r) 0 calc(var(--gutter) - 12px); background: color-mix(in oklab, var(--rbg, var(--paper)) 92%, transparent); backdrop-filter: blur(8px); color: var(--rfg, var(--ink)); }
.rtop-t { flex: 1; min-width: 0; text-align: center; font-weight: 700; font-size: 15px; }
.rtop .ell { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aa { font-family: var(--font-reading); font-size: 18px; }
.reader-col { max-width: 680px; margin: 0 auto; padding: 0 var(--gutter-r) 0 var(--gutter); }
@media (min-width: 720px) { .reader-col { padding: 0 32px; } .rtop .rtop-t { text-align: center; } }
.chapter-head { padding: 28px 0 16px; }
.chapter-head .n { font-family: var(--font-brush); font-size: 48px; line-height: 1; }
.ch-title { font-family: var(--font-display); font-weight: 400; font-size: 34px; line-height: 1.05; margin-top: 6px; }
@media (min-width: 720px) { .chapter-head { padding-top: 48px; } .ch-title { font-size: 44px; } }
.prose { font-family: var(--font-reading); font-size: var(--rsize); line-height: var(--rlh); }
@media (min-width: 720px) { .prose { font-size: max(var(--rsize), 19px); } }
.prose p { margin: 0 0 1em; hyphens: auto; overflow-wrap: break-word; position: relative; border-radius: 6px; }
.prose p:first-of-type::first-letter { font-family: var(--font-display); font-size: 2.6em; float: left; line-height: .8; padding: 6px 4px 0 0; }
.prose p.sel { background: color-mix(in oklab, var(--rfg, var(--ink)) 6%, transparent); box-shadow: 0 0 0 6px color-mix(in oklab, var(--rfg, var(--ink)) 6%, transparent); }
.prose hr.scene { border: 0; height: 24px; margin: 1.4em auto; width: 120px; background: radial-gradient(circle, currentColor 2.5px, transparent 3px) 0 50% / 40px 24px repeat-x; opacity: .7; }
.pnote, .padd { display: inline-grid; place-items: center; min-width: 32px; height: 28px; margin-left: 6px; padding: 0 8px; vertical-align: 1px; border-radius: 14px; border: 1.5px solid var(--line); font-family: var(--font-ui); font-size: 12px; font-weight: 800; color: var(--ink-soft); line-height: 1; position: relative; }
.pnote::after, .padd::after { content: ""; position: absolute; inset: -8px -4px; }
.padd { border-color: var(--ink); color: var(--ink); }
.padd svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .pnote:hover { border-color: var(--ink); color: var(--ink); } }
.anote { margin: 24px 0 0; padding: 16px; border-left: 3px solid var(--line); color: var(--ink-soft); white-space: pre-line; }
.endcard { margin: 40px 0 0; padding: 22px; border-radius: var(--r-lg); border: 1.5px solid var(--ink); display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center; }
.endcard h2 { font-size: 28px; }
.small-say { font-size: 19px; }
.endacts { width: 100%; gap: 10px; }
.readerbar { position: fixed; z-index: 30; left: var(--rail-w); right: 0; bottom: 0; display: flex; align-items: center; gap: 6px; min-height: 60px; padding: 0 max(8px, env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) max(8px, env(safe-area-inset-left, 0px)); border-top: 1px solid var(--line); background: var(--rbg, var(--paper)); color: var(--rfg, var(--ink)); transition: translate 250ms var(--ease), opacity 150ms; }
.readerbar.hide { translate: 0 110%; opacity: 0; }
.readerbar .lbl { width: 64px; font-size: 12px; color: var(--ink-faint); flex: none; text-align: center; }
.readerbar .progress { flex: 1; }
@media (min-width: 720px) { .readerbar { padding-inline: max(16px, calc((100vw - var(--rail-w) - 720px) / 2)); } .readerbar.hide { translate: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .readerbar { transition: opacity 150ms; } .readerbar.hide { translate: none; } }
.reader-col.locked { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding-top: 48px; }
.reader-col.locked .lockcover { width: 140px; }
.reader-col.locked h1 { font-size: 34px; }
.stopscreen { padding-top: 64px; }
.stopscreen h1 { font-size: 34px; }

/* ---------- Sheets ---------- */
.sheet-hero { display: grid; place-items: center; gap: 6px; padding-top: 4px; }
.sheet .x { color: var(--ink); }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 52px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.setrow label { cursor: pointer; }
.stepper { display: flex; min-height: 44px; border-radius: var(--r-full); border: 1.5px solid var(--ink); overflow: hidden; flex: none; }
.stepper button { width: 52px; font-family: var(--font-reading); color: var(--ink); }
.stepper button:disabled { color: var(--ink-faint); cursor: default; opacity: .5; }
.stepper button + .v { border-left: 1.5px solid var(--ink); border-right: 1.5px solid var(--ink); }
.stepper .v { display: grid; place-items: center; min-width: 56px; font-weight: 800; font-size: 14px; }
.theme-dots { display: flex; gap: 12px; }
.theme-dots button { width: 44px; height: 44px; border-radius: var(--r-full); border: 1.5px solid #6E6D69; display: grid; place-items: center; font-family: var(--font-reading); font-size: 16px; }
.theme-dots button[aria-pressed="true"] { border: 3px solid var(--ink); box-shadow: 0 0 0 2px var(--paper) inset; }
.td-paper { background: #FDFDFB; color: #141414; } .td-sepia { background: #F3EAD8; color: #3B3127; } .td-night { background: #0E0E10; color: #ECEAE3; }
:root[data-side="night"] .td-paper { background: #F3F1F8; color: #2B2F6B; } :root[data-side="night"] .td-night { background: #12131F; color: #E4E2F2; }
.sample { font-family: var(--font-reading); color: var(--ink-soft); padding: 8px 0; }
.quote { font-family: var(--font-reading); font-size: 15px; color: var(--ink-soft); border-left: 3px solid var(--line); padding: 2px 0 2px 12px; }
.composer { display: flex; flex-direction: column; gap: 10px; }
.composer[hidden] { display: none; }
.composer .btn { align-self: flex-end; }
.cmts, .replies { list-style: none; margin: 0; padding: 0; }
.cmt { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.cmt.reply { border-bottom: 0; padding-bottom: 0; }
.cmt-av { flex: none; border-radius: 50%; width: 44px; height: 44px; margin: -2px 0 0 -2px; }
.cmt-av:disabled { cursor: default; }
.cmt .b { flex: 1; min-width: 0; }
.cmt .who { font-weight: 800; font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; }
.cmt .who time { font-weight: 400; color: var(--ink-faint); margin-left: 6px; font-size: 13px; }
.cmt .who .badge { margin-left: 4px; height: 18px; font-size: 9px; }
.cmt .txt { margin: 4px 0 6px; overflow-wrap: anywhere; white-space: pre-line; }
.cmt .acts { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.cmt .acts .btn.text { min-height: 36px; padding: 0 4px; font-size: 13px; }
.cmt .quote { font-size: 13px; margin: 4px 0; }
.replies { margin-top: 4px; padding-left: 4px; }
.replies .cmt-av .avc { --s: 36px; }
.bnp.big { display: block; width: 100%; height: 100px; border-radius: var(--r-md); overflow: hidden; }
.bnp.big svg { width: 100%; height: 100%; }

/* ---------- Auth ---------- */
.screen-signin { display: grid; place-items: center; min-height: 100dvh; }
.auth { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 16px; padding: 24px 0; }
.auth-card { display: flex; flex-direction: column; gap: 14px; }
.auth-card h1 { font-size: 40px; }
.auth-art { display: grid; place-items: center; }
.code-in { font-size: 28px; letter-spacing: .4em; text-align: center; font-weight: 800; }
.devcode { background: var(--wash); padding: 6px 10px; border-radius: var(--r-sm); font-weight: 700; }
.birth { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
select.input { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
@media (min-width: 720px) { .auth { max-width: 860px; display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: center; } .auth-card h1 { font-size: 48px; } }

/* ---------- Me, look, store, inbox, family ---------- */
.profile .pfoot { padding: 0 14px 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.profile .nm { margin: 0; }
.me-grid { display: flex; flex-direction: column; }
@media (min-width: 960px) { .me-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 48px; align-items: start; } .me-side { position: sticky; top: 24px; } }
.namerow { align-items: flex-end; gap: 10px; }
.namerow .err { flex-basis: 100%; }
.pad-top { padding-top: 14px; }
.quiet { border: 0; padding: 12px 0 0; margin: 0; }
.quiet legend { font-weight: 700; padding: 0; margin-bottom: 6px; }
.quiet .row { align-items: flex-end; }
.quiet .input[type="time"] { width: 140px; }
.subs { list-style: none; margin: 0; padding: 0; }
.linkcard { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); }
.divider.spaced { margin: 28px 0; }
.narrow { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.looktabs { width: 100%; }
.balcard { display: flex; justify-content: space-between; align-items: center; background: var(--wash) var(--tx-wash-river) center bottom / 100% 70% no-repeat; }
.balbig { display: flex; align-items: center; gap: 8px; font-size: 34px; font-weight: 800; }
.dropi { width: 18px; display: inline-flex; } .dropi svg { width: 18px; height: 23px; }
/* Every pack is the same size: equal rows, one border width; "best value" is marked by its label and an inset ring. */
.packs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); grid-auto-rows: 1fr; gap: 12px; }
.pack { border-radius: var(--r-md); border: 1.5px solid var(--ink); padding: 14px; text-align: left; display: flex; flex-direction: column; gap: 4px; min-height: 120px; }
.pack b { font-size: 24px; font-weight: 800; } .pack span { font-size: 13px; color: var(--ink-soft); } .pack .p { font-weight: 800; font-size: 16px; color: var(--ink); margin-top: auto; }
.pack.best { box-shadow: inset 0 0 0 1px var(--ink); }
.pack:disabled { opacity: .6; cursor: progress; }
@media (hover: hover) { .pack:not(:disabled):hover { background: var(--wash); } }
.notice { margin: 4px 0; }
.notice.ok { border-left: 4px solid var(--malachite-text); }
.inbox { list-style: none; margin: 0; padding: 0; }
.ibx { display: flex; gap: 12px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none; min-height: 64px; }
.ibx.unread b { font-weight: 800; }
@media (hover: hover) { .ibx:hover { background: var(--wash); } }
.waitcard, .askform { margin-top: 4px; }
.fam { display: flex; flex-direction: column; gap: 4px; max-width: 880px; }
.child { display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px; background: var(--paper); border: 1.5px solid var(--ink); }
.child header { gap: 10px; }
.child h3 { font-size: 28px; }
.ctl-grid { display: grid; gap: 12px; margin: 8px 0 14px; }
@media (min-width: 720px) { .ctl-grid { grid-template-columns: 1fr 1fr; column-gap: 24px; } .ctl-grid .quiet { grid-column: 1 / -1; } }
.childacts { gap: 10px; }
.reqs { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.req .row { margin-top: 8px; }
.pins .field { width: 130px; }
.pin-in { letter-spacing: .3em; font-weight: 800; }
.lib-note { margin-top: 12px; }
.noscript { padding: 24px; font-family: system-ui, sans-serif; }
/* Programmatic focus targets (route headings, sheet titles) don't need a ring; real controls keep theirs. */
h1[tabindex="-1"]:focus, h2[tabindex="-1"]:focus, main:focus { outline: none; }
/* While a sheet is open, toasts move to the top so they never cover the sheet's buttons. */
.overlay.open ~ .toast { top: calc(16px + env(safe-area-inset-top, 0px)); bottom: auto; }
.pagehead .ss-l { display: none; }
.fam form .row { align-items: flex-end; }
.ts:empty { display: none; }
/* Warnings list: our own bullet, so a wrapping spoiler button keeps the bullet beside its first line. */
.warns { list-style: none; padding-left: 0; }
.warns li { position: relative; padding-left: 16px; }
.warns li::before { content: ""; position: absolute; left: 3px; top: .62em; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.warns .spoil { display: block; padding: 0; min-height: 24px; }
/* Offline and install (offline.js, pwa.js). Quiet: small, no colour alarm, slow fades only, none with reduced motion. */
.offline-note { position: fixed; right: max(8px, env(safe-area-inset-right, 0px)); bottom: calc(76px + env(safe-area-inset-bottom, 0px)); z-index: 45; margin: 0; display: flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-full); background: var(--wash-deep); color: var(--ink-soft); font-size: 12px; font-weight: 700; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity 900ms var(--ease), visibility 0s linear 900ms; }
.offline-note.on { opacity: 1; visibility: visible; transition: opacity 900ms var(--ease), visibility 0s; }
.offline-note i { width: 6px; height: 6px; border-radius: var(--r-full); background: var(--ink-faint); flex: none; }
.saved-copy { margin: 0 0 4px; }
.offline-t { margin: 20px 0 6px; font-size: 17px; }
.offline-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.offline-list a { display: block; min-height: 44px; padding: 10px 0; color: var(--ink); }
.install { margin-top: 24px; padding: 12px 14px; border-radius: var(--r-md); background: var(--wash); display: grid; gap: 6px; }
.install p { margin: 0; color: var(--ink-soft); }
.install .row { gap: 8px; flex-wrap: wrap; }
@media (prefers-reduced-motion: no-preference) { .install { animation: fadeIn 900ms var(--ease) both; } }
@media (prefers-reduced-motion: reduce) { .offline-note, .offline-note.on { transition: none; } }

/* =====================================================================================================
   Glass flow: Revolut-style navigation and interaction on the ink language (docs/little-ink-world/14-glass-flow.md).
   Paper, sumi ink, the one cinnabar seal, the brush fonts, Mo and the ink cards stay as they were. What changes is
   the chrome: a floating frosted top bar (avatar, search pill, drops), a floating tab bar with a sliding ink blob that
   tucks in while you read down, centred heroes, round actions, stacked glass cards, big story cards, story pages whose
   art fades into the paper, and sheets that push the page back. All motion is soft and slow; reduced motion fades.
   ===================================================================================================== */
:root {
  --glass: color-mix(in oklab, var(--paper) 58%, transparent);
  --glass-hi: color-mix(in oklab, var(--paper) 78%, transparent);
  --glass-line: color-mix(in oklab, var(--ink) 9%, transparent);
  --glass-blur: blur(22px) saturate(1.4);
  --glass-shadow: 0 10px 30px color-mix(in oklab, var(--ink) 9%, transparent);
  --soft: cubic-bezier(0.25, 0.1, 0.25, 1);
  --spring: cubic-bezier(0.2, 0.9, 0.25, 1);
  --tint: var(--ink); --tint-k: 12%;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --tint-k: 24%; } }
:root[data-theme="dark"] { --tint-k: 24%; }
.glassy, .gcard, .gsearch, .ground, .gpill, .act i, .chipw, .tabbar, .gtop.scrolled, .mtop.scrolled, .topbar.over.scrolled { -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }

/* Each tab carries a soft ink-wash tint at the top of the page. */
body[data-route="home"] { --tint: var(--ink); } body[data-route="explore"] { --tint: var(--azurite); }
body[data-route="library"] { --tint: var(--malachite); } body[data-route="drops"] { --tint: var(--seal); --tint-k: 8%; }
body[data-route="me"], body[data-route="inbox"] { --tint: var(--azurite); }
body:not([data-route="reader"]):not([data-route="signin"]) { background: radial-gradient(130% 520px at 50% 0, color-mix(in oklab, var(--tint) var(--tint-k), var(--paper)) 0%, color-mix(in oklab, var(--tint) calc(var(--tint-k) * .4), var(--paper)) 52%, var(--paper) 100%) no-repeat, var(--paper); }
.has-tx body:not([data-route="reader"]):not([data-route="signin"]) main { background: var(--tx-wash-mist) top center / 100% 220px no-repeat; }

/* ---------- Glass top bar (phones; the rail does this job from 720 px) ---------- */
.gtop { position: fixed; z-index: 35; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top, 0px)) var(--gutter-r) 10px var(--gutter); transition: background-color 300ms var(--soft), box-shadow 300ms var(--soft); }
.gtop[hidden] { display: none; }
.gtop.scrolled { background: var(--glass); box-shadow: 0 1px 0 var(--glass-line); }
.gav { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 50%; transition: scale 200ms var(--spring); }
.gav .avc { --s: 40px; }
.gsearch { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: var(--r-full); background: var(--glass); border: 1px solid var(--glass-line); color: var(--ink-faint); font-size: 15px; text-align: left; transition: scale 200ms var(--spring); }
.gsearch > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gsearch .gs-i { display: inline-flex; } .gsearch svg { width: 17px; height: 17px; stroke: var(--ink); fill: none; stroke-width: 2.2; stroke-linecap: round; }
.gav:active, .gsearch:active, .ground:active, .gpill:active, .drops.gdrops:active { scale: .93; }
.drops.gdrops { min-height: 40px; border: 1px solid var(--glass-line); background: var(--glass); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); padding: 0 13px 0 11px; }
.gtop .btn.sm { min-height: 40px; }
.gtop .sideswitch .ss-l { display: none; }
.screen.g { padding-top: calc(64px + env(safe-area-inset-top, 0px)); }
@media (min-width: 720px) { .gtop { display: none !important; } .screen.g { padding-top: 24px; } }

/* round glass buttons (top bars, modal headers, story page) */
.ground { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; color: var(--ink); background: var(--glass); border: 1px solid var(--glass-line); transition: scale 200ms var(--spring); }
.ground svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.iconbtn.ground { width: 40px; height: 40px; margin: 2px; }

/* ---------- Heroes: one centred figure, a pill ---------- */
.hero-wrap { will-change: transform, opacity; transform-origin: 50% 0; }
.hero { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; padding: 14px 8px 4px; margin: 0; background: none !important; border-radius: 0; }
.home .hero, .screen-home .hero { grid-template-columns: none; }
.hero-cover { width: 70px; rotate: -3deg; filter: drop-shadow(0 8px 16px color-mix(in oklab, var(--ink) 16%, transparent)); transition: rotate 400ms var(--spring), scale 300ms var(--spring); }
.hero-cover:active { rotate: 0deg; scale: .96; }
.hero-cover .cover.big { width: 70px; border-radius: 10px; }
.hero-t { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.hero .eyebrow, .hero .lbl { margin: 8px 0 0; font-size: 13px; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--ink-soft); font-family: var(--font-ui); }
.hero .hero-title, .hero .big { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 46px; line-height: .98; color: var(--ink); text-wrap: balance; max-width: 14ch; }
.hero .big.num { font-family: var(--font-ui); font-weight: 800; font-size: 54px; letter-spacing: -.02em; display: inline-flex; align-items: center; gap: 10px; max-width: none; }
.hero .big .dropi { width: 26px; } .hero .big .dropi svg { width: 26px; height: 34px; }
.hero .sub { margin: 0; font-size: 13px; color: var(--ink-faint); max-width: 34ch; }
.hero .small.soft { margin: 2px 0 0; }
.hero-acts { justify-content: center; gap: 10px; margin-top: 12px; }
.hero-blurb { display: none; }
.home-mo { padding: 12px 0 0; }
@media (min-width: 720px) { .hero .hero-title, .hero .big { font-size: 60px; } .hero-cover, .hero-cover .cover.big { width: 92px; } .hero { padding-top: 28px; } }
.gpill { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 20px; border-radius: var(--r-full); font-weight: 700; font-size: 14px; color: var(--ink); text-decoration: none; background: var(--glass-hi); border: 1px solid var(--glass-line); transition: scale 200ms var(--spring); }
.hero > .gpill { margin-top: 12px; }

/* ---------- Round actions ---------- */
.acts4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 22px 0 16px; max-width: 520px; margin-inline: auto; }
.act { display: flex; flex-direction: column; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; color: var(--ink); text-decoration: none; line-height: 1.2; text-align: center; }
.act i { position: relative; width: 50px; height: 50px; border-radius: 50%; display: grid; place-items: center; background: var(--glass-hi); border: 1px solid var(--glass-line); box-shadow: var(--glass-shadow); transition: scale 220ms var(--spring), background-color 200ms; }
.act i::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; border: 1.5px solid var(--ink); opacity: .12; }
.act i svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.act i .dot { position: absolute; top: 2px; right: 2px; width: 10px; height: 10px; }
.act:active i { scale: .88; }

/* ---------- Glass cards ---------- */
.gcard { position: relative; border-radius: 24px; background: var(--glass-hi); border: 1px solid var(--glass-line); box-shadow: var(--glass-shadow); padding: 12px 16px; margin: 0 0 12px; }
.gh { display: inline-flex; align-items: center; gap: 2px; margin: 0; padding: 4px 0 6px; font-family: var(--font-ui); font-size: 13px; font-weight: 700; color: var(--ink-soft); letter-spacing: 0; text-transform: none; }
.gh a { display: inline-flex; align-items: center; gap: 2px; color: inherit; text-decoration: none; }
.gh svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.gsec { font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1; margin: 26px 4px 12px; }
.glrow { display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 6px 0; color: var(--ink); text-decoration: none; border-radius: 14px; transition: background-color 200ms; }
.glrow + .glrow, .gcard .cont + .cont { border-top: 1px solid var(--glass-line); }
.glrow:active { background: color-mix(in oklab, var(--ink) 5%, transparent); }
.glrow .tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.glrow .tx b { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.glrow .tx > span { font-size: 13px; color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.glrow .rt { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.glrow > svg { width: 16px; height: 16px; flex: none; stroke: var(--ink-faint); fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.cover.circ { width: 42px; aspect-ratio: 1; border-radius: 50%; }
.cover.circ svg { height: 150%; top: -8%; }
.gsee { display: block; text-align: center; font-weight: 700; font-size: 14px; padding: 12px 0 6px; border-top: 1px solid var(--glass-line); color: var(--ink); text-decoration: none; }
.gcard .cont { background: none; padding: 8px 0; border-radius: 14px; }
.gcard .cont-grid { gap: 0; }
@media (min-width: 720px) { .gcard .cont-grid { gap: 0 24px; } .gcard .cont + .cont { border-top: 0; } }
.screen .card { border-radius: 20px; background: var(--glass-hi); border: 1px solid var(--glass-line); }
.gcard .card { box-shadow: none; border: 0; background: none; }

/* shelves: four medallions a page inside a card on phones */
.gcard .shelves.wcar { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; gap: 0; margin: 4px -8px 4px; padding: 4px 0 6px; }
.gcard .shelves.wcar::-webkit-scrollbar { display: none; }
.gcard .shelves.wcar .shelf-tile { flex: 0 0 25%; scroll-snap-align: start; padding: 0 6px; font-size: 12px; }
@media (min-width: 720px) { .gcard .shelves.wcar { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); overflow: visible; gap: 18px 12px; } .gcard .shelves.wcar .shelf-tile { padding: 0; } }
.shelf-tile { transition: scale 220ms var(--spring); } .shelf-tile:active { scale: .94; }

/* ---------- Big story cards: the ink card fades into the paper ---------- */
.grid.feed { grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 720px) { .grid.feed { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; } }
.story-card.feat { position: relative; display: flex; flex-direction: column; gap: 0; border-radius: 26px; overflow: hidden; background: var(--paper); border: 1px solid var(--glass-line); box-shadow: var(--glass-shadow); transition: scale 260ms var(--spring); }
.story-card.feat:active { scale: .985; }
.sc-art { position: relative; display: block; height: 260px; overflow: hidden; }
.sc-art .cover { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border: 0; border-radius: 0; }
.sc-art .cover svg { transition: scale 1200ms var(--soft); }
.story-card.feat:active .sc-art .cover svg { scale: 1.03; }
.sc-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, color-mix(in oklab, var(--paper) 70%, transparent) 72%, var(--paper) 97%); pointer-events: none; }
.chipw { position: absolute; z-index: 2; top: 12px; left: 12px; display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px 0 4px; border-radius: var(--r-full); font-weight: 700; font-size: 13px; color: var(--ink); background: var(--glass-hi); border: 1px solid var(--glass-line); max-width: calc(100% - 24px); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.chipw i { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 50%; font-style: normal; font-family: var(--font-display); font-size: 15px; background: var(--paper); border: 1.5px solid var(--ink); }
.sc-meta { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: -78px; padding: 0 16px 16px; }
.pill2 { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: var(--r-full); background: var(--seal); color: var(--on-seal); font-size: 11px; font-weight: 800; }
.story-card.feat .t { font-family: var(--font-display); font-weight: 400; font-size: 28px; line-height: 1.02; -webkit-line-clamp: 2; }
.story-card.feat .m { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.sc-blurb { font-size: 13px; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (hover: hover) { .story-card.feat:hover .t { text-decoration: none; } .story-card.feat:hover { border-color: color-mix(in oklab, var(--ink) 20%, transparent); } }
div.rail > .story-card.feat { width: 260px; }

/* ---------- Explore ---------- */
.xhero { padding-bottom: 10px; }
.gsearchf { min-height: 48px; margin: 6px 0 12px; background: var(--glass-hi); border: 1px solid var(--glass-line); box-shadow: var(--glass-shadow); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
@media (min-width: 720px) { .gsearchf { max-width: 560px; margin-inline: auto; } }
.filters.gcard { padding-top: 14px; padding-bottom: 14px; }
.chip { transition: scale 200ms var(--spring); } .chip:active { scale: .94; }
.shelf-chips .chip:not([aria-pressed="true"]), .tag-chips .chip:not([aria-pressed="true"]) { background: color-mix(in oklab, var(--paper) 70%, transparent); border-color: var(--glass-line); }

/* segmented controls: a paper pill slides under the choice */
.seg.gseg { position: relative; isolation: isolate; background: color-mix(in oklab, var(--ink) 6%, transparent); }
.seg.gseg::before { content: ""; position: absolute; z-index: -1; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / var(--sn, 3)); border-radius: var(--r-full); background: var(--paper); box-shadow: 0 1px 4px color-mix(in oklab, var(--ink) 16%, transparent); transform: translateX(calc(var(--si, 0) * 100%)); transition: transform 380ms var(--spring); }
.seg.gseg button { background: transparent !important; color: var(--ink-faint); font-weight: 700; }
.seg.gseg button[aria-pressed="true"], .seg.gseg button[aria-selected="true"], .seg.gseg button.on { color: var(--ink); }
#res .grid.feed { animation: swapIn 320ms var(--soft) both; }
@keyframes swapIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Story page ---------- */
.topbar.over { position: fixed; top: 0; left: var(--rail-w); right: 0; margin: 0; z-index: 30; padding: calc(8px + env(safe-area-inset-top, 0px)) var(--gutter-r) 8px var(--gutter); background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; transition: background-color 300ms var(--soft), box-shadow 300ms var(--soft); }
.topbar.over.scrolled { background: var(--glass); box-shadow: 0 1px 0 var(--glass-line); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
.topbar.over .tb-t { margin: 0; font-weight: 800; font-size: 16px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0; transform: translateY(6px); transition: opacity 300ms var(--soft), transform 300ms var(--soft); }
.topbar.over.scrolled .tb-t { opacity: 1; transform: none; }
.dhero { position: relative; height: 380px; margin: -8px calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter)); overflow: hidden; -webkit-mask-image: linear-gradient(180deg, #000 50%, transparent 98%); mask-image: linear-gradient(180deg, #000 50%, transparent 98%); }
.dhero .cover { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; border: 0; border-radius: 0; will-change: transform; }
.screen-story .story-wrap { position: relative; margin-top: -96px; }
.screen-story .story-cover { display: none; }
.screen-story .story-top { gap: 0; }
.screen-story .story-meta { gap: 6px; }
.screen-story .story-title { font-size: 44px; line-height: .98; }
.screen-story .by { display: inline-flex; align-items: center; align-self: flex-start; height: 32px; padding: 0 12px; border-radius: var(--r-full); color: var(--ink); text-decoration: none; font-size: 13px; background: var(--glass-hi); border: 1px solid var(--glass-line); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); order: -1; }
.facts { margin: 12px 0; }
.kv2 { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 46px; font-size: 14px; }
.kv2 + .kv2 { border-top: 1px solid var(--glass-line); }
.kv2 dt { color: var(--ink-soft); } .kv2 dd { margin: 0; font-weight: 800; text-align: right; }
.about .blurb { margin: 0 0 8px; color: var(--ink); }
.cw-box.gcard { border-top: 1px solid var(--glass-line); margin-top: 0; }
.chlist.gcard { border-top: 1px solid var(--glass-line); padding-top: 4px; padding-bottom: 4px; }
.chlist.gcard li + li .chrow { border-top: 1px solid var(--glass-line); }
.chlist.gcard .chrow { border-bottom: 0; border-radius: 12px; }
.chlist.gcard .chrow .n { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid color-mix(in oklab, var(--ink) 24%, transparent); font-size: 17px; }
/* the reading button floats at the bottom on phones */
@media (max-width: 959px) {
  .screen-story .actions { position: fixed; z-index: 25; left: var(--gutter); right: var(--gutter-r); bottom: calc(12px + env(safe-area-inset-bottom, 0px)); margin: 0; padding: 0; }
  .screen-story .actions::before { content: ""; position: absolute; z-index: -1; left: calc(-1 * var(--gutter)); right: calc(-1 * var(--gutter-r)); bottom: calc(-12px - env(safe-area-inset-bottom, 0px)); height: 110px; background: linear-gradient(180deg, transparent, color-mix(in oklab, var(--paper) 88%, transparent) 45%, var(--paper)); pointer-events: none; }
  .screen-story .actions .btn { min-height: 52px; }
  .screen-story .actions #save2 { background: var(--glass-hi); border-color: var(--glass-line); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
  .screen-story { padding-bottom: 96px; }
}
@media (min-width: 960px) {
  .dhero { height: 300px; margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter-r)); }
  .screen-story .story-wrap { margin-top: -120px; }
  .screen-story .story-info { top: 72px; }
}

/* ---------- Author, library, drops ---------- */
.author-head.phead { flex-direction: column; text-align: center; gap: 8px; padding-top: 12px; }
.author-head.phead .ringed { margin: 0 auto; }
.author-wrap .author-bio { text-align: center; margin: 0 auto; }
.author-wrap > .row.actions { max-width: 480px; width: 100%; margin: 10px auto 6px; }
.tiers.gcard { padding: 10px; gap: 8px; }
.tiers.gcard .tier { border-color: var(--glass-line); border-radius: 16px; background: color-mix(in oklab, var(--paper) 60%, transparent); }
.lhero .mo-wrap, .dhero2 .mo-wrap { margin-bottom: -4px; }
.dhero2 .balbig { font-size: 54px; }
.packs.gcard { padding: 12px; }
.pack { border: 1px solid var(--glass-line); border-radius: 18px; background: color-mix(in oklab, var(--paper) 65%, transparent); transition: scale 220ms var(--spring); }
.pack:not(:disabled):active { scale: .97; }
.pack.best { box-shadow: inset 0 0 0 1.5px var(--ink); }
.screen-drops .narrow { gap: 12px; }

/* ---------- Profile and other modal-style pages ---------- */
.mtop { position: sticky; top: 0; z-index: 25; display: flex; align-items: center; gap: 8px; min-height: 56px; margin: -8px calc(-1 * var(--gutter-r)) 8px calc(-1 * var(--gutter)); padding: calc(8px + env(safe-area-inset-top, 0px)) var(--gutter-r) 8px var(--gutter); transition: background-color 300ms var(--soft), box-shadow 300ms var(--soft); }
.mtop.scrolled { background: var(--glass); box-shadow: 0 1px 0 var(--glass-line); }
.mt-title { flex: 1; min-width: 0; margin: 0; text-align: center; font-family: var(--font-ui); font-size: 16px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-right { min-width: 40px; display: flex; justify-content: flex-end; }
@media (min-width: 720px) { .mtop { margin-top: -24px; } .mt-title { text-align: left; font-family: var(--font-display); font-weight: 400; font-size: 40px; } }
.profile { border: 1px solid var(--glass-line); border-radius: 24px; background: var(--glass-hi); box-shadow: var(--glass-shadow); margin-bottom: 12px; }
.screen-me .gcard .setrow, .screen-me .gcard .subs .setrow { border-bottom-color: var(--glass-line); }
.screen-me .gcard .setrow:last-child { border-bottom: 0; }
.me-side .gcard .stack { display: grid; gap: 10px; }
.screen-me .me-side > .stack.gcard { display: grid; gap: 10px; }

/* ---------- Floating tab bar: an ink blob slides under the current tab ---------- */
.tabbar { left: 0; right: 0; margin: 0 auto; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: calc(100% - 32px); max-width: 360px; padding: 5px; border-radius: var(--r-full); background: var(--glass-hi); border: 1px solid var(--glass-line); box-shadow: 0 12px 34px color-mix(in oklab, var(--ink) 16%, transparent); transition: max-width 380ms var(--soft), transform 380ms var(--soft), opacity 300ms var(--soft); isolation: isolate; }
.tabbar::before { display: none !important; }
.tabbar .ind { position: absolute; z-index: -1; top: 5px; bottom: 5px; left: 5px; width: calc((100% - 10px) / 4); transform: translateX(calc(var(--ti, 0) * 100%)); transition: transform 460ms var(--spring); }
.tabbar .ind::before { content: ""; position: absolute; inset: 0; border-radius: var(--r-full); background: color-mix(in oklab, var(--ink) 9%, transparent); }
.tabbar.noind .ind { opacity: 0; }
.tabbar ul { justify-content: space-between; }
.tabbar li { flex: 1; }
.tabbar a { min-width: 0; min-height: 52px; padding-top: 7px; border-radius: var(--r-full); font-size: 11px; font-weight: 700; transition: color 250ms, min-height 380ms var(--soft); }
.tabbar a svg { width: 22px; height: 22px; transition: scale 300ms var(--spring); }
.tabbar a[aria-current="page"]::after { display: none; }
.tabbar a:active svg { scale: .85; }
.tabbar a.bump svg { animation: bump 420ms var(--spring); }
@keyframes bump { 0% { scale: 1; } 40% { scale: .8; } 100% { scale: 1; } }
.tabbar a > span { max-height: 16px; overflow: hidden; transition: opacity 250ms var(--soft), max-height 380ms var(--soft); }
.tabbar.compact { max-width: 232px; }
.tabbar.compact a { min-height: 40px; }
.tabbar.compact a > span { opacity: 0; max-height: 0; }
main { padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 720px) { main { padding-bottom: 48px; } }
.offline-note, .mockflag { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }

/* the rail on wider screens: frosted, pill items */
@media (min-width: 720px) {
  .navrail { background: color-mix(in oklab, var(--paper) 70%, transparent); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); border-right: 1px solid var(--glass-line); }
  .navrail ul a { border-radius: 16px; transition: background-color 250ms, color 250ms; }
  .navrail ul a[aria-current="page"] { background: color-mix(in oklab, var(--ink) 8%, transparent); }
  .navrail ul a[aria-current="page"]::before { display: none; }
}

/* ---------- Sheets float, and the page behind steps back ---------- */
.overlay.open { background: rgba(20,20,20,.22); }
.sheet { width: calc(100% - 16px); margin-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); border-radius: 32px; background-color: color-mix(in oklab, var(--paper) 92%, transparent); -webkit-backdrop-filter: blur(30px) saturate(1.5); backdrop-filter: blur(30px) saturate(1.5); border: 1px solid var(--glass-line); box-shadow: 0 20px 50px rgba(0,0,0,.2); padding-bottom: 20px; }
.sheet::before { border-radius: 32px 32px 0 0; }
main, .gtop, .tabbar { transition: transform 460ms var(--soft), filter 460ms var(--soft), opacity 300ms var(--soft), max-width 380ms var(--soft); }
body:not([data-route="reader"]):has(.overlay.open) main { transform: scale(.96); transform-origin: 50% var(--vy, 50vh); filter: blur(6px); }
body:not([data-route="reader"]):has(.overlay.open) .gtop, body:not([data-route="reader"]):has(.overlay.open) .tabbar { filter: blur(4px); opacity: .5; }

/* ---------- Reader chrome: round glass buttons, a floating progress pill (reading text never moves) ---------- */
.rtop .iconbtn { width: 40px; height: 40px; margin: 2px; border-radius: 50%; background: color-mix(in oklab, var(--rbg, var(--paper)) 60%, transparent); border: 1px solid var(--glass-line); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); }
@media (max-width: 719px) {
  .readerbar { left: 0; right: 0; margin: 0 auto; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); width: calc(100% - 32px); max-width: 440px; min-height: 56px; padding: 0 6px 0 10px; border: 1px solid var(--glass-line); border-radius: var(--r-full); background: color-mix(in oklab, var(--rbg, var(--paper)) 74%, transparent); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur); box-shadow: 0 12px 34px rgba(0,0,0,.14); }
  .readerbar.hide { translate: 0 140%; }
}

/* ---------- Motion: pushes zoom softly from the tap, cards rise in once ---------- */
@media (prefers-reduced-motion: no-preference) {
  .screen.settle { animation: zoomSettle 560ms var(--soft) both; }
  .rise { animation: rise 520ms var(--soft) calc(var(--ri, 0) * 55ms) backwards; }
}
@keyframes zoomSettle { from { opacity: 0; transform: scale(.94); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
@media (prefers-reduced-motion: reduce) {
  main, .gtop, .tabbar, .tabbar .ind, .seg.gseg::before, .topbar.over .tb-t { transition: opacity 150ms linear !important; }
  body:has(.overlay.open) main { transform: none !important; filter: none !important; }
  .tabbar a.bump svg, #res .grid.feed { animation: none; }
}
