/* ============================================================
   Xmanga — "Ink & Ember" identity layer. Loaded LAST.
   Colour tokens live where they always did (base.css, themes.css, theme-glass.css: purple → ember
   on warm ink/paper). This file adds the new pieces (wordmark, featured carousel, poster covers,
   continue cards, A–Я index, cinematic series hero, chapter tools, reader progress / tap zones /
   hand-off) and re-dresses a few shared ones.

   Specificity: the Liquid Glass sheet scopes everything as
     html[data-style="glass"] body:not(.reading) .x
   so re-dressed shared components use  html[data-style] body:not(.reading) .x  (same weight, later
   wins), and the Lite / reduced-motion roll-backs sit at the very end.
   ============================================================ */

:root {
  --font-display: "Unbounded", "Xmanga Display MN", "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mx-grad: linear-gradient(135deg, #e2441c 0%, #d6360f 42%, #c9205a 100%);
  --mx-ink: #14110f;                 /* art scrims, always dark */
  --mx-gold: #f5b83d;
  --mx-ease: cubic-bezier(.2, .8, .2, 1);
  --r-cover: 12px;
  --cv: 214 54 15;                   /* a cover's dominant colour, set per tile by js/ui.js */
  --star: #f5b83d;
}

/* ---------- Liquid Glass ambient field: ember, rose and a little gold instead of violet/blue ---------- */
html[data-style="glass"] {
  --lg-ambient:
    radial-gradient(62% 40% at 6% 0%, rgb(255 122 92 / .26), transparent 72%),
    radial-gradient(56% 36% at 100% 12%, rgb(240 110 160 / .16), transparent 72%),
    radial-gradient(60% 40% at 0% 78%, rgb(245 184 61 / .14), transparent 72%),
    radial-gradient(70% 44% at 96% 100%, rgb(214 54 15 / .12), transparent 72%);
}
html[data-style="glass"][data-scheme="dark"] {
  --lg-ambient:
    radial-gradient(62% 38% at 6% 0%, rgb(214 54 15 / .26), transparent 72%),
    radial-gradient(56% 34% at 100% 12%, rgb(201 32 90 / .14), transparent 72%),
    radial-gradient(60% 40% at 0% 80%, rgb(245 184 61 / .07), transparent 72%),
    radial-gradient(70% 44% at 96% 100%, rgb(214 54 15 / .12), transparent 72%);
}
html[data-style="glass"][data-scheme="amoled"] {
  --lg-ambient:
    radial-gradient(46% 24% at 0% 0%, rgb(214 54 15 / .22), transparent 74%),
    radial-gradient(40% 20% at 100% 100%, rgb(201 32 90 / .12), transparent 74%);
}

html[data-style] { --pink: #c9205a; }
html[data-style][data-scheme="dark"], html[data-style][data-scheme="amoled"] { --pink: #ff8a6e; }

/* ---------- type: tighter, heavier headings; tabular numerals where numbers line up ---------- */
body { font-feature-settings: "ss01", "cv11"; letter-spacing: -.003em; }
h1, h2, h3 { letter-spacing: -.015em; }
::selection { background: rgb(214 54 15 / .25); }
:focus-visible { outline: 2.5px solid var(--accent-light); outline-offset: 2px; border-radius: 6px; }
body.reading :focus-visible { outline-color: #ff9a80; }

/* ---------- wordmark ---------- */
.brand {
  display: inline-flex; align-items: baseline; font-family: var(--font-display);
  font-weight: 800; font-size: 22px; letter-spacing: -.045em; line-height: 1; color: var(--text);
}
.brand b {
  font-weight: 900; font-size: 1.18em; margin-right: 1px; transform: skewX(-8deg); display: inline-block;
  background: var(--mx-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ============================================================
   Home
   ============================================================ */
.home-brand {
  display: flex; align-items: center; gap: 14px;
  max-width: 1024px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) var(--gutter) 4px;
}
.home-search {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 14px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-size: 14.5px;
  box-shadow: inset 0 0 0 1px var(--glass-edge);
}
.home-search span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-search .icon { width: 19px; height: 19px; }
.home-search:active { background: var(--border); }
html[data-style="glass"] .home-search { background: var(--lg-fill); box-shadow: inset 0 1px 0 var(--lg-hi), inset 0 0 0 1px var(--lg-rim); }

/* top tabs: one quiet row, the active one is an ink pill */
html[data-style] body:not(.reading) .discover-top { height: calc(56px + env(safe-area-inset-top, 0px)); }
html[data-style] body:not(.reading) .discover-page.is-foru .discover-top { height: 56px; padding-top: 0; top: 0; }
html[data-style] body:not(.reading) .discover-page.is-foru .discover-top .top-search { display: none; }
html[data-style] body:not(.reading) .top-tabs { gap: 6px; align-items: center; }
html[data-style] body:not(.reading) .top-tab {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px;
  font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; color: var(--text-2);
  background: none; box-shadow: none; -webkit-background-clip: border-box; background-clip: border-box;
  transition: color .16s, background-color .16s;
}
html[data-style] body:not(.reading) .top-tab.is-active {
  font-size: 15.5px; font-weight: 700; color: var(--bg);
  background: var(--text); -webkit-text-fill-color: currentColor;
  box-shadow: inset 0 0 0 100px var(--text), 0 6px 16px -8px rgb(0 0 0 / .45);
}
html[data-style] body:not(.reading) .top-tab.is-active::before,
html[data-style] body:not(.reading) .top-tab.is-active::after { display: none; }
html[data-style] body:not(.reading) .top-search .icon { width: 24px; height: 24px; }

/* ---------- section heads ---------- */
html[data-style] body:not(.reading) .section-head { margin: 30px 0 14px; gap: 12px; }
html[data-style] body:not(.reading) .section-title {
  display: flex; align-items: center; gap: 8px; min-width: 0; padding-left: 16px;
  font-family: var(--font-display); font-size: 16px; font-weight: 700; letter-spacing: -.03em; line-height: 1.25;
}
html[data-style] body:not(.reading) .section-title::before {
  width: 6px; height: 17px; border-radius: 1.5px; transform: translateY(-50%) skewX(-14deg);
  background: var(--mx-grad); box-shadow: none;
}
.section-count {
  flex-shrink: 0; padding: 2px 8px; border-radius: 999px; font-family: var(--font); font-size: 12px; font-weight: 600; letter-spacing: 0;
  color: var(--text-2); background: var(--surface-2); font-variant-numeric: tabular-nums;
}
html[data-style] body:not(.reading) .section-more {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin: -10px -6px -10px 0; padding: 0 6px;
  font-size: 14px; font-weight: 600; color: var(--accent-light);
}
.section-more .icon { width: 15px; height: 15px; }
.discover-page .wrap > .hero:first-child { margin-top: 14px; }
.discover-page .section-head:first-child { margin-top: 20px; }

/* ============================================================
   Covers
   ============================================================ */
html[data-style] body:not(.reading) .cover {
  border-radius: var(--r-cover); container-type: inline-size;
  background: rgb(var(--cv) / .16);
}
.cover-img { opacity: 0; transition: opacity .28s ease; }
.cover-img.is-in { opacity: 1; }
.cover-img:not([src]) { visibility: hidden; }

/* weak page (blank / credits) → typographic cover: the title over the blurred, tinted panel */
.cover.is-weak::before {
  content: "XMANGA"; position: absolute; z-index: 1; left: 9%; top: 7%;
  font: 800 8px/1 var(--font-display); font-size: clamp(7px, 6.2cqw, 13px); letter-spacing: .16em; color: rgb(255 255 255 / .72);
}
.cover-type { display: none; }
html[data-style] body:not(.reading) .cover.is-weak { background: linear-gradient(160deg, rgb(var(--cv) / .9), #14110f); }
.cover.is-weak .cover-type {
  position: absolute; inset: 0; z-index: 1;
  display: flex; align-items: flex-end; padding: 9% 9% 10%;
  font: 800 15px/1.08 var(--font); font-size: clamp(12px, 13.5cqw, 34px); letter-spacing: -.025em;
  color: #fff; text-shadow: 0 1px 10px rgb(0 0 0 / .35); overflow-wrap: anywhere; overflow: hidden;
  background:
    radial-gradient(circle at 1px 1px, rgb(255 255 255 / .16) 1px, transparent 1.6px) 0 0 / 7px 7px,
    linear-gradient(180deg, transparent 20%, rgb(0 0 0 / .5) 100%);
}
.cover.is-weak .cover-cap { display: none; }
.thumb .cover.is-weak::before, .quick-cover.is-weak::before, .cont-art.is-weak::before { display: none; }
.thumb .cover.is-weak .cover-type, .quick-cover.is-weak .cover-type, .cont-art.is-weak .cover-type { padding: 8%; font-size: 9px; line-height: 1.1; }

/* poster rows: bigger tiles with the title printed on the art */
.hscroll.hscroll-poster { grid-auto-columns: 41%; gap: 12px; padding-bottom: 4px; scroll-padding-left: var(--gutter); }
@media (min-width: 480px) { .hscroll.hscroll-poster { grid-auto-columns: 172px; } }
@media (min-width: 900px) { .hscroll.hscroll-poster { grid-auto-columns: 188px; gap: 16px; } }
.cover-cap {
  position: absolute; inset: auto 0 0 0; z-index: 1; display: flex; align-items: flex-end;
  min-height: 56%; padding: 0 10px 11px;
  background: linear-gradient(180deg, transparent 0%, rgb(12 10 9 / .55) 45%, rgb(12 10 9 / .9) 100%);
}
.cover-cap span {
  font-weight: 750; font-size: 14.5px; line-height: 1.14; letter-spacing: -.02em; color: #fff;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
  text-shadow: 0 1px 6px rgb(0 0 0 / .4);
}
.card-poster { position: relative; }
.card-poster .card-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); min-height: 0; margin: 0; }
.card-poster .card-sub { margin-top: 7px; font-size: 12.5px; }
html[data-style] body:not(.reading) .card-title { font-size: 13.5px; font-weight: 600; line-height: 1.25; min-height: calc(13.5px * 1.25 * 2); letter-spacing: -.01em; }
html[data-style] body:not(.reading) .card-sub { font-size: 12.5px; }
.grid-3 { gap: 20px 12px; }

/* read-progress hairline + rank numeral + NEW sticker */
.card-progress { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; height: 3px; background: rgb(255 255 255 / .25); }
.card-progress i { display: block; height: 100%; background: var(--mx-grad); }
.card-rank {
  position: absolute; left: 6px; top: 2px; z-index: 2;
  font: 900 34px/1 var(--font-display); letter-spacing: -.06em; color: #fff;
  -webkit-text-stroke: 1.5px rgb(0 0 0 / .55); paint-order: stroke fill; text-shadow: 0 3px 12px rgb(0 0 0 / .5);
}
html[data-style] body:not(.reading) .cover .qol-new {
  right: auto; left: 7px; top: 7px; padding: 0 7px; border-radius: 4px; transform: rotate(-4deg);
  font-family: var(--font-display); font-size: 9.5px; font-weight: 800; letter-spacing: .04em; line-height: 19px;
  color: #1b1917; background: var(--mx-gold); box-shadow: 0 2px 8px rgb(0 0 0 / .3); border: 0;
  -webkit-backdrop-filter: none; backdrop-filter: none;
}
html[data-style] body:not(.reading) .new-dot {
  padding: 0 6px; border: 0; box-shadow: none; border-radius: 4px; transform: rotate(-3deg); line-height: 17px;
  font-family: var(--font-display); font-size: 9px; font-weight: 800; color: #1b1917; background: var(--mx-gold);
}

/* ============================================================
   Featured carousel
   ============================================================ */
.hero { margin: 0 calc(var(--gutter) * -1); }
.hero-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: calc(100% - var(--gutter) * 2 - 22px); gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  padding: 0 var(--gutter); scroll-padding-left: var(--gutter);
}
.hero-track::-webkit-scrollbar { display: none; }
.hero-slide {
  position: relative; scroll-snap-align: start; overflow: hidden; isolation: isolate;
  aspect-ratio: 1 / 1.06; max-height: 62vh; border-radius: 22px; color: #fff;
  background: rgb(var(--cv) / .35) linear-gradient(160deg, rgb(var(--cv) / .5), var(--mx-ink));
  box-shadow: 0 18px 36px -22px rgb(var(--cv) / .7), 0 2px 8px rgb(0 0 0 / .12);
}
.hero-slide:only-child { grid-column: 1; }
.hero-track:has(> .hero-slide:only-child) { grid-auto-columns: 100%; }
html[data-style] body:not(.reading) .hero-art,
.hero-art {
  position: absolute; inset: 0; z-index: -2; aspect-ratio: auto; border-radius: 0; box-shadow: none; background: none;
}
.hero-art .cover-img { object-position: 50% 22%; }
.hero-art.is-weak::before, .hero-art.is-weak .cover-type { display: none; }
.hero-shade {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(circle at 1px 1px, rgb(255 255 255 / .09) 1px, transparent 1.6px) 0 0 / 6px 6px,
    linear-gradient(180deg, rgb(12 10 9 / .28) 0%, transparent 26%, rgb(12 10 9 / .5) 56%, rgb(12 10 9 / .94) 100%);
  -webkit-mask-image: linear-gradient(180deg, #000, #000); mask-image: linear-gradient(180deg, #000, #000);
}
.hero-link { position: absolute; inset: 0; z-index: 0; border-radius: inherit; }
.hero-body { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: 0 18px 18px; pointer-events: none; }
.hero-body a { pointer-events: auto; }
.hero-kicker {
  display: inline-flex; align-items: center; gap: 8px; padding: 0 9px; border-radius: 4px; transform: rotate(-2deg); transform-origin: left bottom;
  font: 800 10px/22px var(--font-display); letter-spacing: .02em; color: #1b1917; background: var(--mx-gold);
}
.hero-kicker span { opacity: .6; font-variant-numeric: tabular-nums; }
.hero-title {
  margin-top: 10px; font-size: clamp(24px, 7.4vw, 34px); font-weight: 800; line-height: 1.04; letter-spacing: -.035em;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
  text-shadow: 0 2px 18px rgb(0 0 0 / .45); text-wrap: balance;
}
.hero-meta { margin-top: 8px; font-size: 13.5px; color: rgb(255 255 255 / .82); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-actions { display: flex; gap: 10px; margin-top: 14px; }
.hero-cta, .hero-more {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 18px; border-radius: 999px;
  font-size: 15px; font-weight: 700; white-space: nowrap; transition: transform .16s var(--mx-ease);
}
.hero-cta { flex: 1 1 auto; min-width: 0; overflow: hidden; color: #14110f; background: #fff; box-shadow: 0 8px 22px -10px rgb(0 0 0 / .6); }
.hero-cta .icon { width: 18px; height: 18px; color: #d6360f; }
.hero-more { color: #fff; background: rgb(255 255 255 / .16); box-shadow: inset 0 0 0 1px rgb(255 255 255 / .22); }
.hero-more .icon { width: 18px; height: 18px; }
.hero-cta:active, .hero-more:active { transform: scale(.96); }
.hero-dots { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.hero-dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--border); transition: width .22s var(--mx-ease), background-color .22s; }
.hero-dots i.is-on { width: 20px; background: var(--accent); }
@media (min-width: 700px) {
  .hero-track { grid-auto-columns: 340px; }
  .hero-slide { aspect-ratio: 5 / 6; }
  .hero-title { font-size: 26px; }
  .hero-dots { display: none; }
}

@media (max-width: 379.98px) {
  .hero-cta, .hero-more { padding: 0 14px; font-size: 14px; gap: 6px; }
  .hero-more { flex: 0 0 46px; padding: 0; font-size: 0; gap: 0; }
  .hero-body { padding: 0 14px 14px; }
}

/* ============================================================
   Continue reading
   ============================================================ */
.hscroll.hscroll-cont { grid-auto-columns: min(86%, 340px); gap: 12px; scroll-padding-left: var(--gutter); padding-bottom: 4px; }
.cont-card {
  position: relative; display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px 12px 10px 10px; border-radius: 18px; overflow: hidden;
  background: linear-gradient(120deg, rgb(var(--cv) / .2), rgb(var(--cv) / .05) 70%), var(--surface);
  box-shadow: inset 0 0 0 1px rgb(var(--cv) / .22);
  transition: transform .16s var(--mx-ease);
}
.cont-card:active { transform: scale(.98); }
html[data-style] body:not(.reading) .cont-art { width: 62px; flex-shrink: 0; border-radius: 10px; }
.cont-main { flex: 1; min-width: 0; }
.cont-title { font-size: 15px; font-weight: 700; letter-spacing: -.015em; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.cont-sub { margin-top: 3px; font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cont-bar { height: 4px; margin-top: 9px; border-radius: 2px; background: rgb(127 127 127 / .22); overflow: hidden; }
.cont-bar i { display: block; height: 100%; border-radius: 2px; background: var(--mx-grad); }
.cont-foot { display: flex; justify-content: space-between; margin-top: 5px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cont-play {
  flex-shrink: 0; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  color: #fff; background: var(--mx-grad); box-shadow: 0 8px 18px -8px rgb(214 54 15 / .7);
}
.cont-play .icon { width: 19px; height: 19px; margin-left: 2px; }

/* ============================================================
   A–Я index
   ============================================================ */
.az-strip {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: 0 calc(var(--gutter) * -1); padding: 2px var(--gutter) 4px; scroll-padding: 0 var(--gutter);
}
.az-strip::-webkit-scrollbar { display: none; }
.az-item {
  flex: 0 0 auto; display: grid; place-items: center; min-width: 46px; height: 46px; padding: 0 8px; border-radius: 14px;
  font: 700 15px/1 var(--font-display); letter-spacing: -.02em; color: var(--text);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--border);
  transition: transform .14s var(--mx-ease), background-color .14s;
}
.az-item.az-all { padding: 0 14px; font-family: var(--font); font-size: 14px; }
.az-item:active { transform: scale(.92); }
.az-item.is-active { color: #fff; background: var(--mx-grad); box-shadow: 0 8px 16px -8px rgb(214 54 15 / .7); }
html[data-style="glass"] .az-item:not(.is-active) { background: var(--lg-fill); box-shadow: inset 0 1px 0 var(--lg-hi), inset 0 0 0 1px var(--lg-rim); }
.az-wrap:empty { display: none; }
.az-wrap { margin-bottom: 4px; }

.home-all {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; margin-top: 32px; padding: 0 18px 0 20px; border-radius: 18px;
  font-family: var(--font-display); font-size: 14px; font-weight: 700; letter-spacing: -.03em; color: var(--bg); background: var(--text);
  transition: transform .16s var(--mx-ease);
}
.home-all:active { transform: scale(.98); }
.home-all .icon { width: 20px; height: 20px; flex-shrink: 0; }

/* ============================================================
   All: filter pills + count
   ============================================================ */
html[data-style] body:not(.reading) .filter-boxes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 14px 0 12px; }
html[data-style] body:not(.reading) .filter-box {
  position: relative; flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; height: 54px; padding: 0 26px 0 14px; border-radius: 16px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--border);
}
html[data-style="glass"] body:not(.reading) .filter-box { background: var(--lg-fill); box-shadow: inset 0 1px 0 var(--lg-hi), inset 0 0 0 1px var(--lg-rim); }
html[data-style] body:not(.reading) .filter-box::after { display: none; }
html[data-style] body:not(.reading) .filter-box-label { font-size: 11.5px; color: var(--muted); }
html[data-style] body:not(.reading) .filter-box-value { font-size: 14px; font-weight: 700; color: var(--text); max-width: 100%; }
.filter-box .filter-box-caret { position: absolute; right: 10px; top: 50%; margin-top: -7px; }
.filter-box-caret { width: 14px; height: 14px; color: var(--muted); }
.all-count { margin: 10px 0 14px; font-weight: 600; }
.tab-count { font-variant-numeric: tabular-nums; }

/* ============================================================
   Latest: day groups
   ============================================================ */
.latest-group { margin-top: 22px; }
.latest-day { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 14px; font-weight: 700; letter-spacing: -.03em; }
html[data-style] body:not(.reading) .latest-row .thumb { width: 58px; }
html[data-style] body:not(.reading) .list-row .thumb .cover { border-radius: 9px; }
html[data-style] body:not(.reading) .list-row-title { font-weight: 650; letter-spacing: -.01em; }
html[data-style] body:not(.reading) .latest-ch { font-size: 13.5px; font-weight: 600; color: var(--accent-light); }

/* search */
html[data-style] body:not(.reading) .tag { min-height: 40px; height: auto; border-radius: 999px; font-weight: 500; color: var(--text-2); }
.search-block-head { font-weight: 700; }
html[data-style] body:not(.reading) .link-btn { min-height: 44px; display: inline-flex; align-items: center; font-weight: 600; }

/* ============================================================
   Series detail
   ============================================================ */
html[data-style] body:not(.reading) .detail-page { background: var(--bg); }
html[data-style="glass"] body:not(.reading) .detail-page { background: transparent; }
.dx-hero {
  position: relative; isolation: isolate; overflow: hidden; color: #fff;
  min-height: min(112vw, 66vh, 520px); display: flex; flex-direction: column;
  padding-top: var(--dp-safe-t); padding-bottom: 22px;
  background: rgb(var(--cv) / .5) linear-gradient(160deg, rgb(var(--cv) / .6), var(--mx-ink));
}
.dx-hero-bg {
  position: absolute; inset: 0; z-index: -2;
  background: var(--dp-cover) 50% 18% / cover no-repeat;
}
.dx-hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(circle at 1px 1px, rgb(255 255 255 / .08) 1px, transparent 1.6px) 0 0 / 6px 6px,
    linear-gradient(180deg, rgb(12 10 9 / .62) 0%, rgb(12 10 9 / .1) 24%, rgb(12 10 9 / .3) 48%, rgb(12 10 9 / .92) 86%, rgb(12 10 9 / .97) 100%);
}
.dx-hero-inner { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: var(--dp-max); margin: 0 auto; padding: 0 6px; }
.dx-hero .icon-btn { color: #fff; background: rgb(12 10 9 / .34); margin: 0 4px; }
.dx-hero .icon-btn:active { background: rgb(255 255 255 / .22); }
.detail-page .dx-hero .dp-hero-actions { gap: 0; }
.dx-hero-row { margin-top: auto; display: flex; align-items: flex-end; gap: 16px; padding: 28px 12px 0; }
html[data-style] body:not(.reading) .dx-hero-cover { display: none; }
.dx-hero-text { flex: 1; min-width: 0; }
.dx-status {
  display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; border-radius: 4px; transform: rotate(-2deg); transform-origin: left bottom;
  font: 800 10px/22px var(--font-display); letter-spacing: .02em; color: #1b1917; background: var(--mx-gold);
}
.dx-status.is-done { background: #fff; }
.dx-hero-title {
  margin-top: 10px; font-size: clamp(25px, 7.6vw, 36px); font-weight: 800; line-height: 1.05; letter-spacing: -.035em;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
  text-shadow: 0 2px 18px rgb(0 0 0 / .5); text-wrap: balance;
}
.dx-author { margin-top: 8px; font-size: 14.5px; font-weight: 600; color: rgb(255 255 255 / .9); }
.dx-hero-meta { display: flex; flex-wrap: wrap; gap: 4px 0; margin-top: 10px; font-size: 13.5px; color: rgb(255 255 255 / .8); }
.dx-hero-meta span + span::before { content: "·"; margin: 0 8px; opacity: .6; }
.dx-prog { display: flex; align-items: center; gap: 12px; margin: 14px 12px 0; }
.dx-prog-bar { flex: 1; height: 4px; border-radius: 2px; background: rgb(255 255 255 / .22); overflow: hidden; }
.dx-prog-bar i { display: block; height: 100%; border-radius: 2px; background: var(--mx-grad); }
.dx-prog-label { font-size: 12.5px; color: rgb(255 255 255 / .82); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* the page slides over the art as a rounded sheet; its top edge is the sticky tab bar */
html[data-style] body:not(.reading) .detail-page .dp-tabs {
  margin-top: -20px; border-radius: 22px 22px 0 0; background: var(--bg); box-shadow: none; padding-top: 4px;
}
html[data-style="glass"] body:not(.reading) .detail-page .dp-tabs { background: var(--glass-strong); }
html[data-style] body:not(.reading) .detail-page .u-tab { font-size: 15.5px; font-weight: 600; height: 52px; }
html[data-style] body:not(.reading) .detail-page .u-tab.is-active { font-weight: 700; }
html[data-style] body:not(.reading) .detail-page .dp-mini .app-header-title { font-weight: 700; letter-spacing: -.02em; }

/* description tab */
html[data-style] body:not(.reading) .detail-page .dp-stat-num { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -.04em; color: var(--accent-light); }
html[data-style] body:not(.reading) .detail-page .dp-stat-label { font-size: 13.5px; color: var(--text-2); }
html[data-style] body:not(.reading) .detail-page .dp-info dt { color: var(--text-2); }
html[data-style] body:not(.reading) .detail-page .dp-info dd { font-weight: 600; }
html[data-style] body:not(.reading) .pill-outline { min-height: 40px; height: auto; font-size: 14px; font-weight: 600; }

/* chapters tab */
html[data-style] body:not(.reading) .detail-page .dx-ch-head { padding: 16px 0 10px; gap: 12px; }
.dx-ch-summary { flex: 1; min-width: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 4px; font-size: 14px; color: var(--text-2); }
.dx-ch-summary b { font-family: var(--font-display); font-size: 20px; font-weight: 800; letter-spacing: -.04em; color: var(--text); }
.dx-ch-read { margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--accent-light); background: var(--accent-soft); }
.dx-seg { flex-shrink: 0; display: flex; padding: 3px; border-radius: 999px; background: var(--surface-2); }
.dx-seg-btn { min-width: 64px; height: 38px; padding: 0 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--text-2); transition: color .16s, background-color .16s; }
.dx-seg-btn.is-active { color: var(--bg); background: var(--text); }
html[data-style="glass"] .dx-seg { background: var(--lg-fill); box-shadow: inset 0 0 0 1px var(--lg-rim); }
.dx-ch-tools { display: flex; gap: 8px; margin-bottom: 10px; }
.dx-tool {
  flex: 1; min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 44px; padding: 0 12px; border-radius: 13px;
  font-size: 13.5px; font-weight: 600; color: var(--text); background: var(--surface); box-shadow: inset 0 0 0 1px var(--border);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: transform .14s var(--mx-ease);
}
html[data-style="glass"] .dx-tool { background: var(--lg-fill); box-shadow: inset 0 1px 0 var(--lg-hi), inset 0 0 0 1px var(--lg-rim); }
.dx-tool .icon { width: 17px; height: 17px; color: var(--accent-light); }
.dx-tool:active { transform: scale(.97); }
.dx-tool:disabled { opacity: .4; }
.dx-ranges { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--gutter) * -1) 8px; padding: 0 var(--gutter); }
.dx-ranges::-webkit-scrollbar { display: none; }
.dx-range {
  flex: 0 0 auto; height: 44px; padding: 0 14px; border-radius: 999px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--text-2); background: var(--surface-2);
}
.dx-range:active { color: #fff; background: var(--accent); }

html[data-style] body:not(.reading) .detail-page .dp-ch-list { border-top: 1px solid var(--border); }
html[data-style] body:not(.reading) .detail-page .dp-ch {
  gap: 2px; min-height: 68px; content-visibility: auto; contain-intrinsic-size: auto 68px;
  border-bottom: 1px solid var(--border);
}
html[data-style] body:not(.reading) .detail-page .dp-ch-main { display: flex; align-items: center; gap: 12px; padding: 11px 0; }
.dp-ch-num {
  position: relative; flex-shrink: 0; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px;
  font: 700 13px/1 var(--font-display); letter-spacing: -.04em; font-variant-numeric: tabular-nums;
  color: var(--text); background: var(--surface-2); overflow: hidden;
}
.dp-ch-num[style*="--part"]::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--part) * 1%); background: rgb(214 54 15 / .28);
}
.dp-ch-num .icon { width: 17px; height: 17px; color: var(--muted); }
.dp-ch-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
html[data-style] body:not(.reading) .detail-page .dp-ch-title { font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; }
html[data-style] body:not(.reading) .detail-page .dp-ch-sub { margin-top: 3px; font-size: 12.5px; gap: 2px 0; }
.detail-page .dp-ch-sub > span::before { content: "·"; margin: 0 7px; opacity: .6; }
html[data-style] body:not(.reading) .detail-page .dp-ch.is-read .dp-ch-title { color: var(--muted); font-weight: 500; }
.detail-page .dp-ch.is-read .dp-ch-num { color: var(--muted); background: none; box-shadow: inset 0 0 0 1px var(--border); }
.detail-page .dp-ch.is-current .dp-ch-num { color: #fff; background: var(--mx-grad); }
.detail-page .dp-ch.is-locked .dp-ch-title { color: var(--text-2); }
html[data-style] body:not(.reading) .detail-page .dp-ch-check { color: var(--muted); opacity: .55; margin-right: -8px; }
html[data-style] body:not(.reading) .detail-page .dp-ch-check.is-on { color: var(--accent-light); opacity: 1; }
html[data-style] body:not(.reading) .detail-page .dp-ch-reading { font-weight: 600; }

/* bottom action bar */
html[data-style] body:not(.reading) .detail-page .dp-read { font-size: 16px; font-weight: 700; gap: 9px; background: var(--mx-grad); color: #fff; }
html[data-style] body:not(.reading) .detail-page .dp-read.is-disabled { background: var(--surface-2); color: var(--muted); }
html[data-style] body:not(.reading) .detail-page .dp-read .icon { width: 20px; height: 20px; }
html[data-style] body:not(.reading) .detail-page .dp-fav { flex-basis: 36%; font-size: 15.5px; font-weight: 600; }
html[data-style] body:not(.reading) .detail-page .dp-bar.is-chapters .dp-fav { flex-basis: 22%; }
html[data-style] body:not(.reading) .detail-page .dp-fav .icon { width: 25px; height: 25px; }
@media (max-width: 759.98px) {
  html[data-style="standard"] body:not(.reading) .detail-page .dp-bar,
  html[data-style="lite"] body:not(.reading) .detail-page .dp-bar { padding: 8px 12px calc(8px + var(--safe-b)); }
  html[data-style="standard"] body:not(.reading) .detail-page .dp-bar-inner,
  html[data-style="lite"] body:not(.reading) .detail-page .dp-bar-inner { height: 50px; }
  html[data-style="standard"] body:not(.reading) .detail-page .dp-read,
  html[data-style="lite"] body:not(.reading) .detail-page .dp-read { border-radius: 14px; }
}

@media (min-width: 760px) {
  .dx-hero { min-height: 400px; }
  .dx-hero-bg { inset: -60px; filter: blur(36px) saturate(1.2); transform: scale(1.1); }
  .dx-hero::after { background: linear-gradient(180deg, rgb(12 10 9 / .5), rgb(12 10 9 / .78)); }
  html[data-style] body:not(.reading) .dx-hero-cover { display: block; width: 200px; flex-shrink: 0; border-radius: 14px; box-shadow: 0 0 0 1px rgb(255 255 255 / .16), 0 24px 50px -18px rgb(0 0 0 / .7); }
  .dx-hero-row { align-items: center; padding-bottom: 26px; gap: 28px; }
  .dx-hero-title { font-size: 38px; }
}

/* ============================================================
   Shared chrome
   ============================================================ */
html[data-style] body:not(.reading) .app-header-title { font-family: var(--font-display); font-size: 16px; font-weight: 700; letter-spacing: -.03em; }
html[data-style] body:not(.reading) .detail-page .dp-mini .app-header-title { font-family: var(--font); font-size: 16.5px; }
html[data-style] body:not(.reading) .tab-item { font-size: 11px; font-weight: 600; letter-spacing: 0; min-height: 44px; }
html[data-style] body:not(.reading) .tab-item .icon { width: 25px; height: 25px; }
html[data-style="standard"] .btn-primary, html[data-style="lite"] .btn-primary { background: var(--mx-grad); color: #fff; }
html[data-style] body:not(.reading) .btn { font-weight: 650; }
html[data-style] body:not(.reading) .sheet-title { font-weight: 700; letter-spacing: -.015em; }
html[data-style] body:not(.reading) .empty-title { font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -.03em; }
html[data-style] body:not(.reading) .empty-state:not(.downloads-empty) .empty-illus {
  background:
    radial-gradient(circle at 1px 1px, rgb(127 127 127 / .28) 1px, transparent 1.7px) 0 0 / 8px 8px,
    radial-gradient(circle at 50% 60%, var(--accent-soft), transparent 70%);
  box-shadow: none; color: var(--accent-light);
}
html[data-style] body:not(.reading) .empty-illus .icon { width: 64px; height: 64px; }
.recent-group-title, .tab-section-title, .settings-group-title { letter-spacing: -.01em; }
html[data-style] body:not(.reading) .recent-row .thumb { width: 56px; }

/* account + sign-in */
html[data-style] body:not(.reading) .auth-badge { background: var(--mx-grad); color: #fff; }
html[data-style] body:not(.reading) .auth-title { font-size: 17px; font-weight: 700; letter-spacing: -.015em; }
.auth-brand { display: flex; justify-content: center; margin: 4px 0 14px; }
.auth-brand .brand { font-size: 30px; }
.auth-perks { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; padding: 0; list-style: none; }
.auth-perks li {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  color: var(--text-2); background: var(--surface-2);
}
html[data-style="glass"] .auth-perks li { background: var(--lg-fill); box-shadow: inset 0 0 0 1px var(--lg-rim); }
.auth-perks .icon { width: 14px; height: 14px; color: var(--accent-light); }
html[data-style] body:not(.reading) .profile-name, html[data-style] body:not(.reading) .member-card-title { font-weight: 750; letter-spacing: -.02em; }
html[data-style] body:not(.reading) :is(.summary-stat, .stat-tile) :is(b, strong, .stat-num, .summary-num) { font-family: var(--font-display); letter-spacing: -.04em; }

/* ============================================================
   Reader
   ============================================================ */
.rx-progress { position: fixed; left: 0; right: 0; top: 0; z-index: 26; height: 3px; background: rgb(255 255 255 / .1); pointer-events: none; }
.rx-progress i { display: block; height: 100%; transform-origin: 0 50%; transform: scaleX(0); background: var(--mx-grad); will-change: transform; }
body.reading .reader-top-manga { font-weight: 700; letter-spacing: -.015em; }
body.reading .reader-top .icon-btn, body.reading .reader-bottom .icon-btn { width: 44px; height: 44px; }
body.reading .reader-pill { font-variant-numeric: tabular-nums; }

.rx-zones { position: fixed; inset: 0; z-index: 24; display: grid; grid-template-rows: 26fr 48fr 26fr; color: #fff; animation: rx-fade .3s ease both; }
.rx-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 600; background: rgb(12 10 9 / .78); }
.rx-zone.is-mid { background: rgb(12 10 9 / .5); border-block: 1.5px dashed rgb(255 255 255 / .5); }
.rx-zone:not(.is-mid) .icon { color: #ff9a80; }
.rx-zone .icon { width: 30px; height: 30px; }
@keyframes rx-fade { from { opacity: 0; } }

.reader-end-card.rx-end {
  position: relative; overflow: hidden; isolation: isolate; text-align: left; gap: 10px; padding: 22px 18px 18px; border-radius: 26px;
  background: linear-gradient(160deg, rgb(var(--cv) / .34), rgb(18 15 13 / .9) 62%), #14110f;
}
.rx-end::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .2;
  background: var(--rx-art) 50% 20% / cover no-repeat;
  -webkit-mask-image: linear-gradient(120deg, transparent 30%, #000); mask-image: linear-gradient(120deg, transparent 30%, #000);
}
.rx-end-kicker { font: 700 10.5px/1 var(--font-display); letter-spacing: .02em; color: rgb(255 255 255 / .66); text-transform: uppercase; }
.rx-end .reader-end-title { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.rx-end-bar { height: 4px; border-radius: 2px; background: rgb(255 255 255 / .16); overflow: hidden; margin: 2px 0 8px; }
.rx-end-bar i { display: block; height: 100%; background: var(--mx-grad); }
.btn.rx-next { height: 62px; justify-content: space-between; padding: 0 16px 0 18px; border-radius: 18px; background: var(--mx-grad); color: #fff; border: 0; text-align: left; }
.rx-next-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.rx-next-text small { font-size: 11.5px; font-weight: 600; opacity: .85; }
.rx-next-text span { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.rx-next .icon { width: 22px; height: 22px; flex-shrink: 0; }
.rx-end-row { display: flex; gap: 10px; }
.rx-end-row .btn { flex: 1; min-width: 0; height: 46px; padding: 0 10px; font-size: 14.5px; border-radius: 14px; }
.rx-end-row .btn .icon { width: 18px; height: 18px; }
.rx-end .reader-end-done { margin: 0; padding: 14px 16px; border-radius: 16px; font-weight: 600; color: #fff; background: rgb(255 255 255 / .08); }

/* ============================================================
   Motion (cheap: opacity + transform only)
   ============================================================ */
@keyframes mx-rise { from { opacity: 0; transform: translateY(10px); } }
.view > .page > .wrap, .view > .detail-page > .dp-body, .view > .page > .empty-state { animation: mx-rise .32s var(--mx-ease) both; }
.hero-slide { animation: mx-rise .4s var(--mx-ease) both; }
html[data-style] body:not(.reading) .card .cover { transition: transform .2s var(--mx-ease), box-shadow .2s; }
html[data-style] body:not(.reading) .card:active .cover,
html[data-style] body:not(.reading) .card.is-pressing .cover { transform: scale(.96); }

/* ============================================================
   AMOLED: keep it black
   ============================================================ */
html[data-scheme="amoled"] .cont-card { background: linear-gradient(120deg, rgb(var(--cv) / .16), transparent 70%), #000; }
html[data-scheme="amoled"] .hero-slide { box-shadow: none; }
html[data-scheme="amoled"] .az-item:not(.is-active), html[data-scheme="amoled"] .dx-tool { background: #0a0a0a; }

/* ============================================================
   LITE: flat, no gradients-on-everything, no decorative motion
   ============================================================ */
html[data-style="lite"] .cover-img { transition: none; opacity: 1; }
html[data-style="lite"] body:not(.reading) .cover { container-type: normal; }
html[data-style="lite"] .cover.is-weak .cover-type { font-size: 13px; background: linear-gradient(180deg, transparent 20%, rgb(0 0 0 / .5) 100%); }
html[data-style="lite"] .cover.is-weak::before { font-size: 8px; }
html[data-style="lite"] .hero-shade { background: linear-gradient(180deg, rgb(12 10 9 / .2) 0%, rgb(12 10 9 / .92) 100%); }
html[data-style="lite"] .hero-slide { box-shadow: none; animation: none; }
html[data-style="lite"] .dx-hero::after { background: linear-gradient(180deg, rgb(12 10 9 / .55) 0%, rgb(12 10 9 / .2) 30%, rgb(12 10 9 / .94) 100%); }
html[data-style="lite"] .dx-hero-bg { filter: none; transform: none; inset: 0; }
html[data-style="lite"] .cont-card { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); transition: none; }
html[data-style="lite"] .cont-play, html[data-style="lite"] .az-item.is-active { box-shadow: none; }
html[data-style="lite"] body:not(.reading) .top-tab.is-active { box-shadow: none; background: var(--text); color: var(--bg); }
html[data-style="lite"] body:not(.reading) .top-tab { transition: none; }
html[data-style="lite"] .view > .page > .wrap, html[data-style="lite"] .view > .detail-page > .dp-body, html[data-style="lite"] .view > .page > .empty-state { animation: none; }
html[data-style="lite"] body:not(.reading) .card .cover { transition: none; }
html[data-style="lite"] body:not(.reading) .card:active .cover,
html[data-style="lite"] body:not(.reading) .card.is-pressing .cover { transform: none; }
html[data-style="lite"] :is(.hero-cta, .hero-more, .az-item, .dx-tool, .home-all, .dx-seg-btn, .hero-dots i) { transition: none; }
html[data-style="lite"] :is(.hero-cta, .hero-more, .az-item, .dx-tool, .home-all, .cont-card):active { transform: none; opacity: .8; }
html[data-style="lite"] body:not(.reading) .empty-state:not(.downloads-empty) .empty-illus { background: var(--surface-2); }
html[data-style="lite"] .rx-end::before, html[data-style="lite"] .rx-zones { animation: none; }
html[data-style="lite"] .reader-end-card.rx-end { background: #14110f; }
html[data-style="lite"] .rx-end::before { display: none; }
html[data-style="lite"] .card-rank { text-shadow: none; }

@media (prefers-reduced-motion: reduce) {
  .view > .page > .wrap, .view > .detail-page > .dp-body, .view > .page > .empty-state, .hero-slide, .rx-zones { animation: none; }
  .cover-img { transition: none; }
  :is(.hero-cta, .hero-more, .az-item, .dx-tool, .home-all, .cont-card, .dx-seg-btn, .hero-dots i, .top-tab) { transition: none !important; }
  html[data-style] body:not(.reading) .card .cover { transition: none; }
  html[data-style] body:not(.reading) .card:active .cover, html[data-style] body:not(.reading) .card.is-pressing .cover { transform: none; }
}

/* ---------- wide screens ---------- */
@media (min-width: 640px) {
  .home-brand { padding-top: 22px; }
  .home-search { max-width: 420px; margin-left: auto; }
  .brand { font-size: 26px; }
  .az-strip { flex-wrap: wrap; overflow: visible; }
  .hscroll.hscroll-cont { grid-auto-columns: 340px; }
}

/* ---------- "Download app" sheet (js/install.js) ---------- */
.install-hero { display: flex; gap: 14px; align-items: center; margin: 2px 0 16px; }
.install-hero p { margin: 0; color: var(--text-2, var(--muted)); font-size: 14.5px; line-height: 1.45; }
.install-icon { flex: none; width: 64px; height: 64px; border-radius: 16px; box-shadow: 0 8px 22px rgb(214 54 15 / .28); }
.install-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: none; }
.install-steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; line-height: 1.45; padding: 12px 14px; border-radius: 14px; background: var(--surface-2, rgb(127 127 127 / .08)); }
.install-step-n {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  font: 700 13px/1 var(--font-display, inherit); color: #fff; background: var(--mx-grad, var(--accent));
}
.install-sheet .sheet-footer .btn { width: 100%; justify-content: center; }
