/* The Last Poor Coker: dark-first theme taken from the header art.
   Layout: marketing pages are a centered column on a near-black ground; the cover and reader keep their own fixed dark "paper". */
:root {
  --bg: #0b0a0a;
  --bg2: #100e0d;
  --panel: #151312;
  --paper: #100e0d;
  --ink: #d8cdbd;
  --ink-strong: #ece3d5;
  --muted: #9a8f80;
  --gold: #d9a24e;
  --gold-ink: #1a1206;
  --line: #2b2724;
  --danger: #e07a6a;
  --ok: #8fbf8a;
  --cover-bg: #070606;
  --cover-gold: #d9a24e;
  --cover-beige: #c6b8a4;
  --font-display: "Playfair Display", "Times New Roman", Times, serif;
  --font-read: "Literata", Georgia, "Times New Roman", serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #ece7df;
    --bg2: #e4ded4;
    --panel: #f6f2ec;
    --paper: #f8f5f0;
    --ink: #2a241f;
    --ink-strong: #16120f;
    --muted: #665c50;
    --gold: #8a5a10;
    --gold-ink: #fff8ea;
    --line: #d5ccbd;
    --danger: #a63d2c;
    --ok: #3f7a3a;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #ece7df;
  --bg2: #e4ded4;
  --panel: #f6f2ec;
  --paper: #f8f5f0;
  --ink: #2a241f;
  --ink-strong: #16120f;
  --muted: #665c50;
  --gold: #8a5a10;
  --gold-ink: #fff8ea;
  --line: #d5ccbd;
  --danger: #a63d2c;
  --ok: #3f7a3a;
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-read);
  font-size: 17px;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
#app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
h1,
h2,
h3 {
  font-family: var(--font-display);
  color: var(--ink-strong);
  line-height: 1.15;
  margin: 0;
  text-wrap: balance;
}
p {
  margin: 0 0 1em;
}
a {
  color: var(--gold);
  text-underline-offset: 3px;
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
img {
  max-width: 100%;
}
:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 4px;
}
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
[hidden] {
  display: none !important;
}
@media print {
  html {
    display: none !important;
  }
}

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding-left: max(20px, env(safe-area-inset-left, 0px));
  padding-right: max(20px, env(safe-area-inset-right, 0px));
}
.narrow {
  max-width: 520px;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 600;
}

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 50px;
  padding: 0 1.7rem;
  border-radius: 999px;
  border: 1px solid var(--gold);
  background: transparent;
  color: var(--gold);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.78rem;
  transition:
    background 0.15s,
    color 0.15s,
    border-color 0.15s;
}
.btn:hover {
  background: color-mix(in srgb, var(--gold) 14%, transparent);
}
.btn-primary {
  background: var(--gold);
  color: var(--gold-ink);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--gold) 86%, white);
}
.btn-quiet {
  border-color: var(--line);
  color: var(--ink);
}
.btn-quiet:hover {
  border-color: var(--gold);
  background: transparent;
}
.btn[disabled] {
  opacity: 0.55;
  cursor: default;
}
.btn-block {
  width: 100%;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 44px;
  height: 44px;
  padding: 0 0.75rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  transition: border-color 0.15s;
  text-decoration: none;
}
.icon-btn:hover {
  border-color: var(--gold);
}
.icon-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.field {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
}
.field label {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  background: var(--bg2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-strong);
}
.field input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 28%, transparent);
}
.pw {
  position: relative;
}
.pw input {
  padding-right: 70px !important;
}
.pw button {
  position: absolute;
  right: 6px;
  top: 6px;
  height: 38px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
}
.check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 18px;
}
.check input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--gold);
  flex: none;
}
.hp {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
}
.msg {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  margin: 0 0 18px;
  font-size: 0.95rem;
}
.msg.err {
  border-color: color-mix(in srgb, var(--danger) 60%, transparent);
  color: var(--danger);
}
.msg.ok {
  border-color: color-mix(in srgb, var(--ok) 60%, transparent);
  color: var(--ok);
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 0.88rem;
}

/* ---------- site header ---------- */
.site-head {
  padding-block: 14px;
}
.site-head .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink-strong);
  text-decoration: none;
  letter-spacing: 0.02em;
}
.brand span {
  color: var(--gold);
}
.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav a.link,
.nav button.link {
  color: var(--ink);
  text-decoration: none;
  padding: 10px 12px;
  font-size: 0.92rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.nav a.link:hover,
.nav button.link:hover {
  color: var(--gold);
}
@media (max-width: 560px) {
  .nav a.link.hide-s,
  .nav button.link.hide-s {
    display: none;
  }
}
.foot button.link {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.foot button.link:hover {
  color: var(--gold);
}

/* ---------- landing ---------- */
.hero {
  padding-block: 24px 56px;
  background: radial-gradient(
    ellipse 50% 45% at 78% 40%,
    color-mix(in srgb, var(--gold) 14%, transparent),
    transparent 70%
  );
}
.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 32px;
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.2rem, 5.4vw, 4rem);
  margin-bottom: 20px;
}
.hero h1 em {
  font-style: normal;
  color: var(--gold);
}
.hero .lede {
  font-size: 1.15rem;
  max-width: 34ch;
  color: var(--ink);
}
.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}
.proof {
  margin-top: 22px;
  font-size: 0.88rem;
  color: var(--muted);
}
@media (max-width: 820px) {
  .hero .wrap {
    grid-template-columns: minmax(0, 1fr);
  }
  .book-scene {
    order: -1;
  }
}

.book-scene {
  perspective: 1600px;
  display: grid;
  place-items: center;
  padding: 30px 0 40px;
  position: relative;
}
.book-scene::after {
  content: "";
  position: absolute;
  bottom: 10px;
  left: 18%;
  right: 8%;
  height: 26px;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0.55),
    transparent 70%
  );
  filter: blur(6px);
}
.book {
  --w: clamp(210px, 30vw, 310px);
  --t: 38px;
  position: relative;
  width: var(--w);
  aspect-ratio: 2/3;
  transform-style: preserve-3d;
  transform: rotateY(-28deg) rotateX(5deg);
  transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
  z-index: 1;
}
.book:hover,
.book:focus-within {
  transform: rotateY(-12deg) rotateX(2deg);
}
@media (prefers-reduced-motion: reduce) {
  .book {
    transition: none;
  }
}
.book > * {
  position: absolute;
}
.book .front {
  inset: 0;
  transform: translateZ(calc(var(--t) / 2));
  border-radius: 2px 2px 2px 2px;
  overflow: hidden;
  container-type: inline-size;
  background: var(--cover-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  background-image:
    radial-gradient(
      ellipse 80% 30% at 20% 6%,
      rgba(255, 255, 255, 0.07),
      transparent 70%
    ),
    radial-gradient(
      ellipse 70% 25% at 80% 40%,
      rgba(255, 255, 255, 0.04),
      transparent 70%
    );
}
.book .front::before {
  content: "";
  position: absolute;
  inset: 3.2cqw;
  border: 1px solid color-mix(in srgb, var(--cover-gold) 38%, transparent);
  border-radius: 2px;
  pointer-events: none;
  z-index: 2;
}
.book .front::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background:
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.55) 0,
      rgba(255, 255, 255, 0.07) 2.4%,
      rgba(0, 0, 0, 0.35) 4.4%,
      transparent 8%
    ),
    linear-gradient(115deg, rgba(255, 255, 255, 0.1), transparent 38%);
}
.book .front.photo::before {
  display: none;
}
.cv-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cv-title {
  margin: 11cqw 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  line-height: 0.9;
  text-align: center;
}
.cv-the {
  font-size: 9cqw;
  color: var(--cover-gold);
}
.cv-last {
  font-size: 21cqw;
  color: var(--cover-gold);
}
.cv-poor,
.cv-coker {
  font-size: 15.5cqw;
  color: var(--cover-beige);
}
.cv-tag {
  margin: 5cqw 0 0;
  font-size: 3.3cqw;
  color: var(--cover-gold);
  text-align: center;
  padding: 0 8cqw;
}
.cv-art {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 0;
  margin-top: 4cqw;
}
.cv-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 60% center;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 32%);
  mask-image: linear-gradient(to bottom, transparent 0, #000 32%);
}
.cv-author {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 7cqw;
  margin: 0;
  text-align: center;
  font-size: 3.6cqw;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--cover-beige);
  z-index: 2;
  text-shadow: 0 1px 8px #000;
}
.book .back {
  inset: 0;
  transform: translateZ(calc(var(--t) / -2));
  background: #0a0909;
  border-radius: 2px 2px 2px 2px;
}
.book .spine {
  top: 0;
  bottom: 0;
  left: calc(var(--t) / -2);
  width: var(--t);
  transform: rotateY(-90deg);
  background: linear-gradient(90deg, #050404, #14110f 40%, #0a0808);
  border-radius: 2px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.book .spine span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cover-gold);
  white-space: nowrap;
}
.book .pages {
  top: -0.2%;
  bottom: 0.2%;
  left: calc(100% - var(--t) / 2);
  width: calc(var(--t) - 4px);
  transform: rotateY(90deg);
  background: repeating-linear-gradient(
    90deg,
    #d9d0c1 0,
    #d9d0c1 1px,
    #b9b0a1 1px,
    #b9b0a1 2px
  );
}
.book .top {
  left: 0;
  right: 0.999px;
  top: calc(var(--t) / -2.2);
  height: calc(var(--t) - 4.5px);
  transform: rotateX(90deg);
  background: repeating-linear-gradient(
    0deg,
    #d9d0c1 0,
    #d9d0c1 1px,
    #b9b0a1 1px,
    #b9b0a1 2px
  );
}
@media (max-width: 820px) {
  .book {
    transform: rotateY(-20deg) rotateX(4deg);
    --w: clamp(200px, 56vw, 270px);
  }
}

.section {
  padding-block: 72px;
  border-top: 1px solid var(--line);
}
.section h2 {
  font-size: clamp(1.7rem, 3.6vw, 2.4rem);
  margin-bottom: 22px;
}
.prose {
  max-width: 62ch;
}
.prose p {
  font-size: 1.08rem;
}
.pull {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.6vw, 1.8rem);
  color: var(--gold);
  max-width: 26ch;
  margin: 0 0 24px;
  line-height: 1.3;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
  margin-top: 8px;
}
/* Region-aware store cards: fixed 3-column structure; 1-2 cards keep one-column width and center. */
.cards-fixed {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 8px;
}
.cards-fixed .card {
  width: 100%;
}
.cards-fixed.few {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}
.cards-fixed.few .card {
  width: calc((100% - 36px) / 3);
}
@media (max-width: 820px) {
  .cards-fixed,
  .cards-fixed.few {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 560px) {
  .cards-fixed {
    grid-template-columns: minmax(0, 1fr);
  }
  .cards-fixed.few .card {
    width: 100%;
  }
}
.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 26px 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.card.feature {
  border-color: color-mix(in srgb, var(--gold) 55%, var(--line));
}
.card h3 {
  font-size: 1.35rem;
}
.card .price {
  font-family: var(--font-display);
  font-size: 1.7rem;
  color: var(--gold);
  font-weight: 700;
}
.card p {
  color: var(--ink);
  flex: 1;
  margin: 0;
}
.badge {
  align-self: flex-start;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--gold);
  color: var(--gold);
}
.faq details {
  border-bottom: 1px solid var(--line);
  padding: 4px 0;
}
.faq details:first-of-type {
  border-top: 1px solid var(--line);
}
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 18px 36px 18px 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink-strong);
  position: relative;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: "+";
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold);
  font-size: 1.5rem;
  font-family: var(--font-read);
  font-weight: 400;
}
.faq details[open] summary::after {
  content: "\2212";
}
.faq details p {
  padding-bottom: 18px;
  max-width: 62ch;
  margin: 0;
  color: var(--ink);
}
.band {
  text-align: center;
  padding-block: 72px;
  border-top: 1px solid var(--line);
  background: radial-gradient(
    ellipse 50% 70% at 50% 100%,
    color-mix(in srgb, var(--gold) 14%, transparent),
    transparent 70%
  );
}
.band h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: 22px;
}
.band .cta-row {
  justify-content: center;
}
.foot {
  padding-block: 28px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

/* ---------- dialog ---------- */
dialog {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}
.dlg {
  padding: 28px 26px 26px;
}
.dlg h2 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}
.dlg .x {
  position: absolute;
  right: 10px;
  top: 10px;
}
.code {
  display: block;
  margin: 6px 0 18px;
  padding: 14px;
  border: 1px dashed var(--gold);
  border-radius: 10px;
  text-align: center;
  font:
    600 1.25rem/1 "Courier New",
    monospace;
  letter-spacing: 0.14em;
  color: var(--gold);
}

/* ---------- auth / buy pages ---------- */
.page {
  flex: 1;
  padding-block: 28px 64px;
}
.page h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  margin-bottom: 10px;
}
.page .sub {
  color: var(--muted);
  margin-bottom: 26px;
}
.steps {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 22px;
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.steps b {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--line);
  margin-right: 8px;
  font-weight: 600;
}
.steps .on {
  color: var(--gold);
}
.steps .on b {
  background: var(--gold);
  color: var(--gold-ink);
  border-color: var(--gold);
}
.steps i {
  flex: 0 0 28px;
  height: 1px;
  background: var(--line);
}
.formcard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 26px;
}
.formcard .alt {
  margin: 18px 0 0;
  text-align: center;
  font-size: 0.92rem;
  color: var(--muted);
}
.endcap {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 36px;
}
.endcap h1 {
  margin-bottom: 12px;
}

/* ---------- library (user area) ---------- */
.lib-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  padding: 26px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  margin-bottom: 28px;
}
.mini {
  width: 112px;
  aspect-ratio: 2/3;
  border-radius: 3px 7px 7px 3px;
  background: var(--cover-bg);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  container-type: inline-size;
}
.mini .cv-title {
  margin-top: 10cqw;
}
.mini .cv-art {
  margin-top: 3cqw;
}
@media (max-width: 560px) {
  .lib-hero {
    grid-template-columns: minmax(0, 1fr);
  }
  .mini {
    width: 96px;
  }
}
.bar {
  height: 8px;
  border-radius: 8px;
  background: var(--line);
  overflow: hidden;
  margin: 12px 0 8px;
}
.bar i {
  display: block;
  height: 100%;
  background: var(--gold);
  border-radius: 8px;
}
.stats {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 18px;
}
.stats b {
  color: var(--ink-strong);
  font-weight: 600;
}
.chlist {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.chlist button {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 16px 4px;
  min-height: 60px;
}
.chlist button:hover .t {
  color: var(--gold);
}
.chlist .l {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.chlist .t {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink-strong);
}
.chip {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.chip.done {
  border-color: var(--ok);
  color: var(--ok);
}
.chip.reading {
  border-color: var(--gold);
  color: var(--gold);
}
.sec-title {
  font-size: 1.4rem;
  margin: 34px 0 14px;
}
.tile {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  padding: 18px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 22px;
}
.tile p {
  margin: 0;
}

/* ---------- reader ---------- */
.reader {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding-left: max(14px, env(safe-area-inset-left, 0px));
  padding-right: max(14px, env(safe-area-inset-right, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.reader img {
  -webkit-user-drag: none;
  pointer-events: none;
}
.rbar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding-block: 10px;
}
.rbar-title {
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-strong);
}
.rbar-title small {
  display: block;
  font-family: var(--font-read);
  font-weight: 600;
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}
.rbar-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  position: relative;
}
.pagewrap {
  width: min(100%, 760px);
  height: 100%;
  position: relative;
  touch-action: pan-y;
}
.pagewrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.pagewrap canvas.flip-next {
  animation: flipn 0.22s ease-out;
}
.pagewrap canvas.flip-prev {
  animation: flipp 0.22s ease-out;
}
@keyframes flipn {
  from {
    opacity: 0.2;
    transform: translateX(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes flipp {
  from {
    opacity: 0.2;
    transform: translateX(-14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .pagewrap canvas.flip-next,
  .pagewrap canvas.flip-prev {
    animation: none;
  }
}
.status {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 14px;
  text-align: center;
  padding: 24px;
  color: var(--muted);
}
.rfoot {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding-block: 10px;
}
.rmeta {
  min-width: 0;
}
.rmeta .bar {
  margin: 0 0 6px;
  height: 4px;
}
.rmeta p {
  margin: 0;
  font-size: 0.76rem;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-btn[disabled] {
  opacity: 0.35;
  cursor: default;
}
.rbar-actions-wrap {
  position: relative;
}
.pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 32;
  width: min(320px, calc(100vw - 28px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.pop h3 {
  margin: 0 0 10px;
  font-family: var(--font-read);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.pop .row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}
.pop .row:last-child {
  margin-bottom: 0;
}
.seg {
  display: flex;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.seg button {
  flex: 1;
  min-height: 40px;
  background: transparent;
  border: 0;
  padding: 0 10px;
  font-size: 0.9rem;
}
.seg button[aria-pressed="true"] {
  background: var(--gold);
  color: var(--gold-ink);
  font-weight: 600;
}
.size-val {
  min-width: 3.6rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.drawer-back {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 30;
}
.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  width: min(380px, 100%);
  z-index: 31;
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: max(20px, env(safe-area-inset-top, 0px))
    max(20px, env(safe-area-inset-right, 0px))
    max(20px, env(safe-area-inset-bottom, 0px)) 20px;
  overflow-y: auto;
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.drawer h2 {
  font-size: 1.3rem;
}
.drawer .chlist button[aria-current="true"] .t {
  color: var(--gold);
}
.drawer .chlist button[disabled] {
  opacity: 0.5;
  cursor: default;
}

/* upsell mini popup */
.upsell {
  position: fixed;
  z-index: 25;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(440px, calc(100vw - 24px));
  background: var(--panel);
  border: 1px solid var(--gold);
  border-radius: 14px;
  padding: 16px 16px 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  animation: rise 0.3s ease-out;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translate(-50%, 12px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .upsell {
    animation: none;
  }
}
.upsell h3 {
  font-size: 1.05rem;
  margin-bottom: 4px;
  padding-right: 34px;
}
.upsell p {
  font-size: 0.92rem;
  margin: 0 0 12px;
  color: var(--ink);
}
.upsell .row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.upsell .btn {
  min-height: 42px;
  padding: 0 1.1rem;
  font-size: 0.72rem;
}
.upsell .x {
  position: absolute;
  right: 6px;
  top: 6px;
  border: 0;
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  background: var(--ink-strong);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 0.92rem;
}

/* ---------- small additions ---------- */
.rbar .btn {
  min-height: 40px;
  padding: 0 1rem;
  font-size: 0.7rem;
}
@media (max-width: 520px) {
  .rbar .btn {
    padding: 0 0.75rem;
    letter-spacing: 0.06em;
  }
}
.nav [data-install] {
  padding: 0 0.9rem;
}
.card .btn {
  margin-top: 10px;
}

/* completion screen */
dialog.done {
  width: min(520px, calc(100vw - 32px));
}
.done-q {
  margin-top: 18px;
  font-weight: 600;
}
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg2);
  color: var(--ink-strong);
  font: inherit;
  line-height: 1.5;
  resize: vertical;
}
.field textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 28%, transparent);
}
.stars {
  display: flex;
  gap: 4px;
  margin: 10px 0 18px;
}
.stars button {
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  border-radius: 10px;
  display: grid;
  place-items: center;
  padding: 0;
}
.stars button svg {
  width: 30px;
  height: 30px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linejoin: round;
}
.stars button.on {
  color: var(--gold);
}
.stars button.on svg {
  fill: currentColor;
}
.stars button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
dialog.done .row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

/* Reader on phones: a short top bar (back, title, play, Aa) with everything else in a bottom sheet. */
.pop select {
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.pop .quick {
  display: none;
}
.pop .quick .btn {
  flex: 1;
  min-height: 44px;
  padding: 0 0.75rem;
  font-size: 0.72rem;
}
.pop-grab {
  display: none;
}
@media (max-width: 640px) {
  .hide-s {
    display: none !important;
  }
  .pop .quick {
    display: flex;
  }
  .rbar {
    gap: 6px;
  }
  .rbar-title {
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.2;
    font-size: 0.9rem;
  }
  .rbar-actions-wrap {
    position: static;
  }
  .pop {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: auto;
    max-height: min(85dvh, 640px);
    overflow-y: auto;
    overscroll-behavior: contain;
    border-radius: 18px 18px 0 0;
    border-width: 1px 0 0;
    padding: 10px 18px calc(22px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -14px 50px rgba(0, 0, 0, 0.5);
  }
  .pop-grab {
    display: block;
    width: 44px;
    height: 4px;
    border-radius: 4px;
    background: var(--line);
    margin: 0 auto 14px;
  }
  .pop .seg button {
    min-height: 44px;
  }
}
