/* Kosmokomi. The book covers are loud and colourful, so everything around them stays calm:
   flat surfaces, one deep-navy "night sky", and depth (shadow) only on the books themselves.
   Fonts are served from this site (web/static/fonts), never from another company. */
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("/fonts/fredoka-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 300 700; font-display: swap;
  src: url("/fonts/fredoka-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url("/fonts/figtree-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Figtree"; font-style: normal; font-weight: 300 900; font-display: swap;
  src: url("/fonts/figtree-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --night: #0a1030;
  --night-2: #141d52;
  --blue: #2350d8;
  --blue-soft: #e8edfd;
  --orange: #ff7a1a;
  --orange-hot: #ff8f3d;
  --yellow: #ffd60a;
  --yellow-soft: #fff4c2;
  --bg: #f4f6fc;
  --surface: #ffffff;
  --ink: #0e1433;
  --muted: #586083;
  --line: #dfe4f3;
  --line-strong: #c3cbe4;
  --green: #12805c;
  --green-soft: #d9f4e8;
  --red: #c4302b;
  --red-soft: #fde4e1;
  --r-card: 20px;
  --r-cover: 6px;
  --book-shadow: 0 1px 2px rgba(10, 16, 48, .22), 0 10px 22px -8px rgba(10, 16, 48, .4);
  --book-shadow-up: 0 2px 4px rgba(10, 16, 48, .22), 0 22px 36px -12px rgba(10, 16, 48, .5);
  --head: "Fredoka", ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  /* older names still used inline by a few pages */
  --space: var(--night); --planet: var(--blue); --star: var(--yellow); --ring: var(--orange); --paper: var(--bg);
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; font: 400 17px/1.6 var(--body); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
img { max-width: 100%; height: auto; }
a { color: var(--blue); text-underline-offset: .18em; }
h1, h2, h3 { font-family: var(--head); font-weight: 600; line-height: 1.08; letter-spacing: -0.015em; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(2.2rem, 5.2vw, 3.5rem); }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); }
h3 { font-size: 1.3rem; letter-spacing: -0.005em; }
p { margin: 0 0 1em; }
.wrap { width: min(1200px, 100% - 40px); margin-inline: auto; }
.narrow { width: min(760px, 100% - 40px); margin-inline: auto; }
.small { font-size: .88rem; color: var(--muted); }
.center { text-align: center; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 99; background: #fff; padding: 8px 14px; border-radius: 99px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 6px; }
.sky :focus-visible, .topbar :focus-visible, .footer :focus-visible, body.reader :focus-visible { outline-color: var(--yellow); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5em; font: 600 1.02rem/1 var(--head);
  color: var(--ink); background: var(--orange); border: 0; border-radius: 999px; padding: .85em 1.45em;
  text-decoration: none; cursor: pointer; transition: transform .12s, background-color .12s, box-shadow .12s; }
.btn:hover { background: var(--orange-hot); transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: default; transform: none; }
.btn-big { font-size: 1.15rem; padding: 1em 1.7em; }
.btn-small { font-size: .92rem; padding: .62em 1.05em; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: #2f5df0; }
.btn-ghost { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.btn-ghost:hover { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn-star { background: var(--yellow); color: var(--ink); }
.btn-star:hover { background: #ffe14a; }
.btn-danger { background: var(--surface); color: var(--red); box-shadow: inset 0 0 0 1.5px var(--red); }
.btn-danger:hover { background: var(--red-soft); }
.btn-google { background: var(--surface); color: var(--ink); width: 100%; box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.btn-google:hover { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn-google svg { width: 20px; height: 20px; }
.sky .btn-ghost, .topbar .btn-ghost { background: rgba(255, 255, 255, .08); color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .35); }
.sky .btn-ghost:hover, .topbar .btn-ghost:hover { background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 1.5px #fff; }
.linkish { background: none; border: 0; color: var(--blue); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

/* Header */
.topbar { background: rgba(10, 16, 48, .88); -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); position: sticky; top: 0; z-index: 20; }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; }
.brand { display: block; transition: transform .2s; }
.brand:hover { transform: rotate(-4deg) scale(1.05); }
.brand img { display: block; width: 66px; height: auto; margin: 6px 0; }
.mainnav { display: flex; align-items: center; gap: 4px 6px; flex-wrap: wrap; justify-content: flex-end; }
.mainnav > a:not(.btn) { color: #d5dcfa; text-decoration: none; font: 500 1rem var(--head); padding: 8px 12px; border-radius: 99px; }
.mainnav > a:not(.btn):hover { color: #fff; background: rgba(255, 255, 255, .08); }
.mainnav > a[aria-current]:not(.btn) { color: #fff; background: rgba(255, 255, 255, .12); }
.mainnav > .btn { margin-left: 8px; }
@media (max-width: 480px) { .mainnav > a:not(.btn) { font-size: .95rem; padding: 8px 9px; } .brand img { width: 56px; } .mainnav > .btn { margin-left: 2px; } }

/* Night sky */
.sky { position: relative; color: #fff; overflow: hidden;
  background: radial-gradient(90% 120% at 85% 0%, #1c2f8f 0%, transparent 55%), radial-gradient(70% 90% at 0% 100%, #18225f 0%, transparent 60%), var(--night); }
.sky::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .7;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 22%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 78% 12%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 52% 68%, var(--yellow) 50%, transparent 51%), radial-gradient(1.5px 1.5px at 88% 58%, #cfe0ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 33% 84%, #fff 50%, transparent 51%), radial-gradient(2px 2px at 6% 64%, var(--yellow) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 64% 34%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 95% 90%, #fff 50%, transparent 51%);
  background-size: 460px 340px; }
.sky > * { position: relative; }
.sky h1, .sky h2 { color: #fff; }

/* Hero: words on the left, a slowly drifting wall of real covers on the right */
.hero { margin-top: -64px; padding-top: 64px; }
.hero-in { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .95fr); gap: 48px; align-items: center; min-height: min(760px, 92vh); }
.hero-copy { padding: 56px 0; }
.hero h1 { font-size: clamp(2.7rem, 6.2vw, 4.9rem); line-height: .98; letter-spacing: -0.025em; margin-bottom: .45em; }
.hero .lead { font-size: clamp(1.08rem, 1.6vw, 1.28rem); color: #d0d8fb; max-width: 31em; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 30px 0 16px; }
.hero-note { font-size: .95rem; color: #a9b5ea; margin: 0; }
.wall { align-self: stretch; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; height: min(760px, 92vh); overflow: hidden; transform: rotate(4deg) scale(1.08); transform-origin: center;
  -webkit-mask-image: linear-gradient(#0000, #000 16%, #000 84%, #0000); mask-image: linear-gradient(#0000, #000 16%, #000 84%, #0000); }
.wall-track { display: grid; gap: 16px; animation: drift 80s linear infinite; }
.wall-col:nth-child(2) .wall-track { animation-duration: 64s; animation-direction: reverse; }
.wall-col:nth-child(3) .wall-track { animation-duration: 96s; }
.wall img { display: block; width: 100%; aspect-ratio: 1024 / 1480; object-fit: cover; border-radius: var(--r-cover); box-shadow: 0 12px 28px -10px rgba(0, 0, 0, .7); background: var(--night-2); }
@keyframes drift { to { transform: translateY(calc(-50% - 8px)); } }
@media (max-width: 900px) {
  .hero-in { grid-template-columns: 1fr; gap: 0; min-height: 0; }
  .hero-copy { padding: 40px 0 28px; }
  .wall { height: 340px; transform: rotate(3deg) scale(1.06); gap: 12px; }
  .wall-track { gap: 12px; }
  @keyframes drift { to { transform: translateY(calc(-50% - 6px)); } }
}

/* Sections */
.section { padding: 88px 0; }
.section-alt { background: var(--surface); }
.section-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 48px; align-items: end; margin-bottom: 40px; }
.section-head h2 { margin: 0; }
.section-head p { margin: 0; color: var(--muted); font-size: 1.08rem; max-width: 34em; }
@media (max-width: 760px) { .section { padding: 60px 0; } .section-head { grid-template-columns: 1fr; margin-bottom: 28px; } }

/* Subjects: each one shows three of its own covers */
.subjects { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.subject { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 26px 22px 20px; text-decoration: none; color: var(--ink); overflow: hidden; transition: border-color .15s; }
.subject:hover { border-color: var(--ink); }
.fan { display: flex; justify-content: center; margin-bottom: 20px; }
.fan img { width: 34%; aspect-ratio: 1024 / 1480; object-fit: cover; border-radius: var(--r-cover); box-shadow: var(--book-shadow); background: var(--night-2); transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.fan img:nth-child(1) { transform: rotate(-7deg) translate(14%, 5%); }
.fan img:nth-child(2) { position: relative; z-index: 1; transform: scale(1.08); }
.fan img:nth-child(3) { transform: rotate(7deg) translate(-14%, 5%); }
.subject:hover .fan img:nth-child(1) { transform: rotate(-11deg) translate(2%, 3%); }
.subject:hover .fan img:nth-child(3) { transform: rotate(11deg) translate(-2%, 3%); }
.subject-all { display: flex; flex-direction: column; justify-content: flex-end; min-height: 180px; background: var(--night); border-color: var(--night); color: #fff; }
.subject-all:hover { border-color: var(--yellow); }
.subject-all .subject-name { font-size: 1.7rem; max-width: 9em; }
.subject-all .subject-n { color: #b9c4f1; margin-top: 8px; }
.subject-name { display: block; font: 600 1.25rem/1.15 var(--head); }
.subject-n { display: block; color: var(--muted); font-size: .95rem; margin-top: 2px; }

/* Video */
.video-frame { position: relative; background: #000; border-radius: 24px; overflow: hidden; box-shadow: 0 30px 60px -30px rgba(10, 16, 48, .55); }
.video-frame video { display: block; width: 100%; height: auto; }
.video-wide { max-width: 1000px; margin-inline: auto; }
.video-tall { display: none; max-width: 340px; margin-inline: auto; }
@media (max-width: 600px) { .video-wide { display: none; } .video-tall { display: block; } }

/* How it works: a real sequence, so it is numbered */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; counter-reset: step; list-style: none; padding: 0; margin: 0; }
.step { counter-increment: step; border-top: 2px solid var(--ink); padding-top: 18px; }
.step::before { content: counter(step); display: block; font: 600 3.4rem/1 var(--head); color: var(--blue); margin-bottom: 14px; }
.step h3 { margin-bottom: .35em; }
.step p { margin: 0; color: var(--muted); }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; gap: 28px; } }

.promise { display: grid; grid-template-columns: repeat(2, 1fr); gap: 36px 56px; }
.promise > div { display: grid; grid-template-columns: 52px 1fr; grid-template-rows: auto 1fr; gap: 4px 18px; align-items: start; }
.promise svg { grid-row: span 2; width: 52px; height: 52px; padding: 13px; border-radius: 16px; background: var(--blue-soft); color: var(--blue); }
.promise h3 { margin: 4px 0 0; }
.promise p { margin: 0; color: var(--muted); }
@media (max-width: 760px) { .promise { grid-template-columns: 1fr; gap: 28px; } }

.closing { border-radius: 32px; padding: clamp(40px, 7vw, 80px) clamp(24px, 6vw, 72px); display: grid; grid-template-columns: 1fr auto; gap: 24px 40px; align-items: center; }
.closing h2 { margin: 0 0 .3em; font-size: clamp(1.9rem, 4.4vw, 3rem); }
.closing p { margin: 0; color: #d0d8fb; max-width: 32em; }
@media (max-width: 760px) { .closing { grid-template-columns: 1fr; border-radius: 24px; } }

/* Small pieces */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; gap: .5em; align-items: baseline; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; padding: .48em 1em;
  font: 500 .98rem var(--head); color: var(--ink); text-decoration: none; cursor: pointer; transition: border-color .12s, background-color .12s; }
.chip:hover { border-color: var(--ink); }
.chip b { font-weight: 500; font-size: .85em; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip[aria-pressed="true"] b { color: #b9c4f1; }
.caption { display: inline-block; background: var(--yellow-soft); padding: .32em .8em; font: 500 .92rem var(--head); border-radius: 999px; color: var(--ink); }

/* Cards & forms */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); padding: 28px; }
.center-card { margin: 72px auto; text-align: center; padding: 48px 28px; }
.page-head { padding: 56px 0 12px; }
.page-head p { color: var(--muted); max-width: 44em; font-size: 1.08rem; }
label { font-weight: 600; display: block; margin-bottom: 6px; }
input[type=email], input[type=text], input[type=search] { width: 100%; font: inherit; color: var(--ink); padding: .78em 1em; border: 1.5px solid var(--line-strong); border-radius: 14px; background: var(--surface); transition: border-color .12s, box-shadow .12s; }
input[type=search] { border-radius: 999px; padding-left: 1.2em; }
input[type=email]:focus, input[type=text]:focus, input[type=search]:focus { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(35, 80, 216, .18); }
.check { display: flex; gap: .65em; align-items: flex-start; font-weight: 400; margin: 16px 0; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; accent-color: var(--blue); }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); margin: 22px 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line-strong); }
.notice { border-radius: 14px; padding: 13px 16px; background: var(--yellow-soft); margin: 14px 0; }
.notice.ok { background: var(--green-soft); }
.notice.err { background: var(--red-soft); }
.notice.dev { background: #ece8ff; outline: 1.5px dashed #8a7be0; outline-offset: -1.5px; overflow-wrap: anywhere; }
.login-card { max-width: 480px; margin: 56px auto 88px; padding: 36px 32px; }
@media (max-width: 480px) { .card { padding: 22px; } .login-card { padding: 26px 22px; margin-top: 28px; } }

/* Library */
.lib-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 8px 0 16px; }
.lib-tools input[type=search] { max-width: 320px; }
.lib-filter { margin-bottom: 36px; }
.shelf { margin: 0 0 48px; scroll-margin-top: 90px; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.shelf-head h2 { margin: 0; font-size: 1.7rem; }
.shelf-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(140px, 172px); gap: 20px; overflow-x: auto; padding: 8px 6px 22px; margin: 0 -6px; scroll-snap-type: x proximity; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
.shelf-row.grid { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); overflow: visible; gap: 28px 20px; }
.tile { display: block; text-decoration: none; color: var(--ink); scroll-snap-align: start; position: relative; container-type: inline-size; }
.tile img { display: block; width: 100%; aspect-ratio: 1024 / 1480; object-fit: cover; border-radius: var(--r-cover); box-shadow: var(--book-shadow); background: var(--night-2); transition: transform .18s cubic-bezier(.2, .8, .2, 1), box-shadow .18s; }
.tile span { display: block; font: 600 .98rem/1.25 var(--head); margin-top: 12px; }
.tile .meta { font: 400 .84rem var(--body); color: var(--muted); margin-top: 2px; }
.tile:hover img { transform: translateY(-5px); box-shadow: var(--book-shadow-up); }
.badge { position: absolute; top: 8px; left: 8px; font: 600 .74rem/1 var(--head); letter-spacing: .02em; padding: .42em .7em; border-radius: 999px; background: var(--yellow); color: var(--ink); z-index: 2; margin: 0 !important; box-shadow: 0 2px 6px rgba(10, 16, 48, .3); }
/* FREE sits at the bottom-left of the cover so it never hides the title (the cover is 1.4453 times as tall as it is wide) */
.badge.free { background: #fff; color: var(--green); top: calc(144.53cqw - 2.3em); }
.badge.done { left: auto; right: 8px; background: var(--green); color: #fff; }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; background: var(--orange); border-radius: 99px; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }

/* Book page */
.book-hero { display: grid; grid-template-columns: minmax(200px, 360px) 1fr; gap: 56px; padding: 56px 0 72px; align-items: center; }
.book-cover { position: relative; }
.book-hero .cover { display: block; border-radius: 10px; box-shadow: 0 2px 4px rgba(10, 16, 48, .2), 0 40px 60px -30px rgba(10, 16, 48, .6); width: 100%; background: var(--night-2); }
.book-hero .badge { top: auto; bottom: 14px; left: 14px; font-size: .85rem; }
.book-hero .kicker { font: 500 1.05rem var(--head); color: var(--blue); margin-bottom: 10px; }
.book-hero .book-sub { font-size: 1.3rem; color: var(--muted); }
.book-hero .facts { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 22px; }
.book-hero .bar { max-width: 360px; }
.book-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 22px 0 0; }
@media (max-width: 700px) { .book-hero { grid-template-columns: 1fr; gap: 28px; padding: 32px 0 48px; } .book-cover { max-width: 250px; } }

/* Pricing */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: stretch; margin: 28px 0 36px; }
.plan { display: flex; flex-direction: column; padding: 32px 28px; position: relative; }
.plan h2 { font-size: 1.4rem; text-align: left; margin: 0; }
.plan.best { background: var(--night); border-color: var(--night); color: #fff; }
.plan.best h2 { color: #fff; }
.plan .price { font: 600 3rem/1 var(--head); letter-spacing: -0.02em; margin: 18px 0 6px; min-height: 1em; }
.plan .per { color: var(--muted); }
.plan.best .per, .plan.best .small { color: #b9c4f1; }
.plan ul { list-style: none; padding: 0; margin: 24px 0 28px; flex: 1; border-top: 1px solid var(--line); }
.plan.best ul { border-color: rgba(255, 255, 255, .18); }
.plan li { padding: .62em 0 .62em 1.7em; border-bottom: 1px solid var(--line); position: relative; }
.plan.best li { border-color: rgba(255, 255, 255, .18); }
.plan li::before { content: ""; position: absolute; left: 2px; top: 1.02em; width: .8em; height: .42em; border-left: 2.5px solid var(--green); border-bottom: 2.5px solid var(--green); transform: rotate(-45deg); }
.plan.best li::before { border-color: var(--yellow); }
.plan .ribbon { position: absolute; top: 28px; right: 24px; background: var(--yellow); }
@media (max-width: 900px) { .plans { grid-template-columns: 1fr; } .plan.best { order: -1; } }

/* FAQ & legal */
.faq details { border-bottom: 1px solid var(--line-strong); }
.faq details:first-of-type { border-top: 1px solid var(--line-strong); }
.faq summary { cursor: pointer; padding: 20px 4px; font: 600 1.15rem/1.3 var(--head); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: ""; flex: none; width: 14px; height: 14px; background: linear-gradient(var(--ink), var(--ink)) center / 100% 2px no-repeat, linear-gradient(var(--ink), var(--ink)) center / 2px 100% no-repeat; transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq summary:hover { color: var(--blue); }
.faq details > div { padding: 0 4px 10px; color: #2c3358; max-width: 40em; }
.legal { padding-bottom: 88px; }
.legal h2 { font-size: 1.45rem; margin-top: 1.8em; }
.legal li { margin-bottom: .4em; }
.draft { background: var(--red-soft); outline: 1.5px dashed var(--red); outline-offset: -1.5px; border-radius: 14px; padding: 13px 16px; font-weight: 600; }

/* Shelf (progress) & account */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; margin: 16px 0 48px; }
.stat { padding: 22px 24px; color: var(--muted); }
.stat b { display: block; font: 600 2.8rem/1 var(--head); letter-spacing: -0.02em; color: var(--ink); margin-bottom: 6px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 16px; }
.bdg { text-align: center; padding: 22px 12px 18px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--surface); }
.bdg .ico { font-size: 2.5rem; line-height: 1.2; display: block; }
.bdg b { display: block; font: 600 1.02rem var(--head); margin: 6px 0 2px; }
.bdg small { color: var(--muted); }
.bdg.locked { background: transparent; border-style: dashed; border-color: var(--line-strong); }
.bdg.locked .ico { filter: grayscale(1); opacity: .35; }
.bdg.locked b { color: var(--muted); }
.subj { display: grid; grid-template-columns: 150px 1fr auto; gap: 14px; align-items: center; padding: 9px 0; }
.subj a { color: var(--ink); font-weight: 600; text-decoration: none; }
.subj a:hover { text-decoration: underline; }
.subj .bar { margin: 0; height: 8px; }
@media (max-width: 480px) { .subj { grid-template-columns: 110px 1fr auto; } }
.acct { display: grid; gap: 20px; margin: 16px 0 88px; }
.acct h2 { font-size: 1.45rem; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.devices { list-style: none; padding: 0; margin: 0 0 18px; }
.devices li { padding: 11px 0; border-bottom: 1px solid var(--line); }
.status-pill { display: inline-block; font: 600 .88rem var(--head); padding: .28em .85em; border-radius: 99px; background: var(--green-soft); color: var(--green); }
.status-pill.off { background: var(--line); color: var(--muted); }

/* Footer */
.footer { background: var(--night); color: #b9c4f1; padding: 56px 0 36px; }
.footer-in { display: grid; grid-template-columns: 1.2fr 1fr; gap: 28px 40px; }
.footer-in > div p { max-width: 26em; margin-top: 12px; }
.footer nav { display: grid; grid-template-columns: repeat(2, auto); gap: 10px 40px; justify-content: end; align-content: start; }
.footer a { color: #fff; text-decoration: none; font-weight: 500; }
.footer a:hover { text-decoration: underline; }
.footer .small { grid-column: 1 / -1; color: #8d9ad0; margin: 0; padding-top: 24px; border-top: 1px solid rgba(255, 255, 255, .12); }
@media (max-width: 700px) { .footer-in { grid-template-columns: 1fr; } .footer nav { justify-content: start; } }

/* ---------- Reader ---------- */
body.reader { background: #070a1c; color: #fff; overflow: hidden; height: 100dvh; }
body.reader .topbar, body.reader .footer { display: none; }
.rd { position: fixed; inset: 0; display: flex; flex-direction: column; user-select: none; -webkit-user-select: none; }
.rd-top, .rd-bottom { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: rgba(7, 10, 28, .86); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); z-index: 5; transition: transform .25s, opacity .25s; }
.rd-top { padding-top: max(8px, env(safe-area-inset-top)); }
.rd-bottom { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
.rd.chrome-off .rd-top { transform: translateY(-100%); opacity: 0; }
.rd.chrome-off .rd-bottom { transform: translateY(100%); opacity: 0; }
.rd.chrome-off .rd-stage { inset: 0; }
.rd-title { flex: 1; min-width: 0; font: 500 1.02rem var(--head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 4px; }
.rd-btn { background: rgba(255, 255, 255, .1); color: #fff; border: 0; border-radius: 999px; min-width: 40px; height: 40px; font: 600 1rem var(--head); cursor: pointer; display: inline-grid; place-items: center; text-decoration: none; padding: 0 12px; transition: background-color .12s; }
.rd-btn:hover { background: rgba(255, 255, 255, .22); }
.rd-btn[aria-pressed="true"] { background: var(--yellow); color: var(--ink); }
.rd-count { font: 500 .92rem var(--head); min-width: 70px; text-align: center; color: #b9c4f1; font-variant-numeric: tabular-nums; }
.rd-bottom input[type=range] { flex: 1; accent-color: var(--orange); height: 30px; }
.rd-stage { position: absolute; inset: calc(56px + env(safe-area-inset-top)) 0 calc(58px + env(safe-area-inset-bottom)); transition: inset .25s; display: flex; align-items: center; justify-content: center; gap: 4px; overflow: hidden; touch-action: pan-y pinch-zoom; }
.rd-stage img.pg { max-height: 100%; max-width: 100%; object-fit: contain; display: block; background: #151a38; }
.rd.spread .rd-stage img.pg { max-width: 50%; }
.rd-stage.zoomed { display: block; overflow: auto; touch-action: auto; }
.rd-stage.zoomed img.pg { max-width: none; max-height: none; width: min(1600px, 200vw); margin: 0 auto; }
.rd-tap { position: absolute; top: 15%; bottom: 15%; width: 28%; z-index: 3; background: transparent; border: 0; cursor: pointer; }
.rd-tap.prev { left: 0; }
.rd-tap.next { right: 0; }
.rd-stage.zoomed ~ .rd-tap { display: none; }
.rd-spinner { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.rd-spinner::after { content: ""; width: 40px; height: 40px; border: 4px solid rgba(255, 255, 255, .16); border-top-color: var(--yellow); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.rd-card { background: var(--surface); color: var(--ink); border-radius: 28px; box-shadow: 0 40px 80px -20px rgba(0, 0, 0, .7); padding: 34px 30px; max-width: 520px; width: calc(100% - 32px); max-height: calc(100% - 140px); overflow: auto; text-align: center; position: relative; z-index: 4; }
.rd-card h2 { text-align: center; font-size: 1.8rem; }
.rd-card .btn { margin: 3px; }
.quiz { text-align: left; }
.quiz .q { font: 600 1.25rem/1.3 var(--head); margin: 8px 0 18px; }
.quiz .opts { display: grid; gap: 10px; margin-bottom: 14px; }
.quiz .opt { text-align: left; font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 14px; padding: 13px 16px; cursor: pointer; transition: border-color .12s, background-color .12s; }
.quiz .opt:not([disabled]):hover { border-color: var(--ink); }
.quiz .opt.right { background: var(--green-soft); border-color: var(--green); }
.quiz .opt.wrong { background: var(--red-soft); border-color: var(--red); }
.quiz .opt[disabled] { cursor: default; color: var(--ink); }
.quiz .progress { font: 500 .92rem var(--head); color: var(--muted); text-align: center; }
.quiz .score { font: 600 4rem/1.1 var(--head); letter-spacing: -0.02em; text-align: center; color: var(--blue); }
.rd-toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: var(--yellow); color: var(--ink); border-radius: 999px; padding: 12px 20px; font: 600 1rem var(--head); z-index: 10; box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .6); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---------- Reader: report a problem ---------- */
.rp { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; background: rgba(7, 10, 28, .97); color: #fff; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.rp-in { margin: 0 auto; width: min(100%, 880px); padding: max(14px, env(safe-area-inset-top)) 14px 24px; display: grid; gap: 12px; }
.rp h2 { font-size: 1.3rem; margin: 0; }
.rp p { margin: 0; color: #cdd5f7; }
.rp-pages { display: flex; justify-content: center; gap: 10px; }
.rp-page { position: relative; display: inline-block; line-height: 0; touch-action: none; cursor: crosshair; border: 2px solid rgba(255, 255, 255, .25); border-radius: 6px; }
.rp-page img { display: block; max-height: 52vh; max-width: 100%; width: auto; height: auto; -webkit-user-drag: none; }
.rp-box { position: absolute; border: 3px solid #ff4d4d; background: rgba(255, 77, 77, .18); border-radius: 4px; pointer-events: none; }
.rp fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 6px; }
.rp legend { font: 600 1rem var(--head); margin-bottom: 4px; }
.rp label.opt { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 10px; cursor: pointer; }
.rp label.opt:has(input:checked) { background: var(--yellow); color: var(--ink); border-color: var(--yellow); }
.rp textarea { width: 100%; min-height: 76px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .3); background: rgba(255, 255, 255, .08); color: #fff; padding: 10px; font: inherit; }
.rp .msg { min-height: 1.3em; color: #ffb4b4; }
.rp-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Open public beta: slim notice under the top bar (config.json "open_beta"). */
.beta-bar { position: relative; z-index: 19; background: var(--yellow); color: var(--ink); font-size: .92rem; line-height: 1.4; padding: 7px 0; text-align: center; }
.beta-bar b { font-weight: 700; }
body.reader .beta-bar { display: none; }
/* The landing hero tucks up under the top bar; with the beta bar there, it starts below the bar instead. */
.beta-bar + main > .hero:first-child { margin-top: 0; padding-top: 0; }
