:root {
  color-scheme: dark;
  --body: #0b0b0c;
  --sidebar: #101012;
  --surface: #151517;
  --raised: #1b1b1e;
  --line: #2a2a2d;
  --ink: #f4f2ef;
  --muted: #a6a5ad;
  --accent: #f3c982;
  --accent-ink: #171209;
  --radius: 14px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--body);
  color: var(--ink);
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 300px; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(2.35rem, 5.8vw, 4.25rem); line-height: 1.05; font-weight: 760; letter-spacing: -.065em; }
h2 { font-size: clamp(1.45rem, 3.5vw, 2rem); line-height: 1.15; letter-spacing: -.045em; }
h3 { font-size: 1.08rem; margin-top: 1.2rem; margin-bottom: .55rem; }
p { line-height: 1.55; }
img { max-width: 100%; display: block; }
button, input, select { font: inherit; }
button, .primary, select {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  min-height: 44px;
  padding: .65rem 1rem;
}
button, select { cursor: pointer; }
button:hover, select:hover { background: var(--raised); border-color: #545359; }
button:disabled { opacity: .45; cursor: default; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
.primary {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 720;
  border-color: transparent;
}
.primary:hover { color: var(--accent-ink); background: #ffe0a7; border-color: transparent; }
.muted, small { color: var(--muted); }
.eyebrow { color: var(--accent); font-family: ui-monospace, monospace; font-size: .82rem; letter-spacing: .14em; font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.brand { display: inline-flex; align-items: center; gap: .7rem; font-weight: 770; font-size: 1.62rem; letter-spacing: -.068em; }
.brand img { border-radius: 10px; box-shadow: 0 0 0 1px #353138; }
.brand-dot { color: var(--accent); }
.layout { display: grid; grid-template-columns: 216px minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky; top: 0; height: 100dvh; background: var(--sidebar); border-right: 1px solid var(--line);
  padding: 1.9rem .9rem 1rem; display: flex; flex-direction: column; gap: 2.25rem;
}
.sidebar .home { margin-left: .63rem; }
.sidebar nav { display: grid; gap: .38rem; }
.sidebar nav a {
  color: var(--muted); display: flex; gap: .76rem; align-items: center; border: 1px solid transparent; border-radius: 9px;
  padding: .55rem .85rem; font-size: .95rem; font-weight: 640; min-height: 46px;
}
.sidebar nav a:hover, .sidebar-user:hover { background: var(--raised); color: var(--ink); }
.sidebar nav a[aria-current] { color: var(--accent); background: #211c16; border-color: #392d1e; }
.nav-icon { line-height: 1; display: inline-grid; place-items: center; font-size: 1.34rem; min-width: 1.15rem; }
.sidebar-user { margin-top: auto; display: flex; align-items: center; gap: .75rem; padding: .65rem .6rem; border-radius: 9px; }
.sidebar-user strong, .sidebar-user small { display: block; overflow-wrap: anywhere; }
.avatar { border-radius: 50%; background: #30271d; color: var(--accent); width: 36px; height: 36px; display: grid; place-items: center; flex: none; font-weight: 780; }
.topbar { display: flex; min-height: 76px; align-items: center; justify-content: space-between; padding: 0 clamp(1.4rem, 3.3vw, 3.45rem); gap: .9rem; border-bottom: 1px solid var(--line); }
.top-search { min-width: 0; width: min(36rem, 58%); }
.global-search { position: relative; }
.global-search input { padding-left: 2.8rem; min-height: 43px; }
.search-mark { position: absolute; left: 1rem; top: 13px; width: 14px; height: 14px; border: 1.8px solid var(--muted); border-radius: 50%; pointer-events: none; }
.search-mark::after { content: ""; display: block; position: absolute; width: 7px; height: 2px; background: var(--muted); transform: rotate(45deg); right: -5px; bottom: -3px; border-radius: 2px; }
.safe-badge { color: #d2e0c9; display: inline-flex; gap: .5rem; align-items: center; padding: .4rem .7rem; font-size: .83rem; border: 1px solid #343d32; border-radius: 999px; background: #171c16; white-space: nowrap; }
.safe-badge span { color: #b5d69e; }
.mobile-home, .mobile-nav { display: none; }
.main-content { max-width: 1660px; margin: auto; padding: clamp(1.35rem, 3.2vw, 3.25rem); }
.hero {
  background-color: #000;
  background-image: linear-gradient(90deg,#000 5%, #0006 49%, transparent 70%), url("/discover.png");
  background-position: center, center right; background-repeat: no-repeat; background-size: cover, auto 120%;
  border: 1px solid var(--line); border-radius: var(--radius); min-height: clamp(260px, 32vw, 400px); display: grid; align-items: center; overflow: hidden;
}
.hero-content { padding: clamp(1.55rem, 4.5vw, 4.5rem); width: min(65%, 620px); }
.hero h1 { font-size: clamp(3.25rem, 7vw, 6.65rem); margin: .28rem 0 .7rem; letter-spacing: -.083em; }
.hero p:not(.eyebrow) { color: #dfdce0; font-size: clamp(1rem, 1.7vw, 1.22rem); margin-bottom: 1.35rem; }
.catalog { margin-top: 2.05rem; scroll-margin-top: 1rem; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.05rem; }
.browse-options, .genre-row, .title-actions, .tag-list { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.browse-options select { font-size: .875rem; }
.genre-row { margin-bottom: 1.3rem; }
.chip, .tag-list span { font-size: .875rem; padding: .42rem .75rem; border-radius: 99px; min-height: 36px; }
.chip[aria-pressed="true"] { background: #2b2317; color: var(--accent); border-color: #53402a; }
.tag-list span { min-height: auto; border: 1px solid var(--line); color: var(--muted); }
.card-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1.55rem .85rem; }
.manga-card { min-width: 0; display: flex; flex-direction: column; gap: .29rem; }
.cover { aspect-ratio: 2 / 3; overflow: hidden; display: grid; place-items: center; background: #212124; border: 1px solid var(--line); border-radius: 9px; width: 100%; color: var(--muted); font-size: 2rem; }
.cover > * { grid-area: 1 / 1; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.manga-card:hover .cover { border-color: var(--accent); }
.manga-card strong { margin-top: .3rem; line-height: 1.25; font-size: .94rem; overflow-wrap: anywhere; }
.manga-card:hover strong { color: var(--accent); }
.manga-card small { font-size: .82rem; }
.status { padding: 2.8rem 1rem; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); display: grid; place-items: center; gap: .9rem; }
.pager { display: flex; gap: 1rem; justify-content: center; align-items: center; margin-top: 1.6rem; }
.more { margin-top: 1rem; }
.back { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); font-weight: 670; font-size: .9rem; min-height: 44px; }
.back:hover { color: var(--ink); }
.back span { font-size: 1.6rem; line-height: 1; }
.title-card { display: grid; grid-template-columns: minmax(120px, 240px) minmax(0, 1fr); gap: clamp(1rem,4vw,3rem); margin: .55rem 0 2.4rem; }
.title-card h1 { margin: .5rem 0 .6rem; overflow-wrap: anywhere; }
.title-actions { margin: 1.18rem 0 .7rem; }
.synopsis { white-space: pre-line; margin-top: 1rem; color: #d8d6dc; max-width: 62ch; overflow-wrap: anywhere; }
.chapter-section h2 { margin-bottom: 1rem; }
.chapter-link { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); gap: 1rem; padding: .9rem .45rem; }
.chapter-link:hover { color: var(--accent); }
.chapter-link strong, .chapter-link small { display: block; }
.reader { max-width: 1100px; min-height: 100dvh; margin: auto; }
.reader-top { position: sticky; top: 0; z-index: 2; background: #101012; border-bottom: 1px solid var(--line); }
.reader-bar { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: .75rem; padding: max(.55rem, env(safe-area-inset-top)) max(.9rem, env(safe-area-inset-right)) .55rem max(.9rem, env(safe-area-inset-left)); }
.reader-heading { text-align: center; min-width: 0; }
.reader-heading strong, .reader-heading small { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-progress { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 1rem .55rem; color: var(--muted); font-size: .875rem; }
#page-images { max-width: 850px; margin: auto; }
#page-images figure { margin: 0 auto; min-height: 240px; text-align: center; scroll-margin-top: var(--reader-scroll-top, 66px); }
#page-images img { display: block; width: auto; max-width: 100%; height: auto; margin: auto; }
.reader-controls { padding: .8rem; display: flex; align-items: center; justify-content: center; gap: .55rem; flex-wrap: wrap; }
.reader-controls:empty { display: none; }
.reader-controls a { min-height: 44px; display: inline-grid; place-items: center; padding: .7rem; color: var(--accent); }
.reader-bottom { padding-bottom: env(safe-area-inset-bottom); }
.reader-top, .reader-bottom { transition: transform .18s ease, opacity .18s ease; }
.reader-controls-hidden .reader-top, .reader-controls-hidden .reader-bottom { opacity: 0; visibility: hidden; pointer-events: none; }
.reader-controls-hidden .reader-top { transform: translateY(-100%); }
.reader-paged { max-width: none; background: #000; }
.reader-paged .reader-top, .reader-paged .reader-bottom { position: fixed; inset-inline: 0; max-width: 1100px; margin-inline: auto; }
.reader-paged .reader-bottom { bottom: 0; z-index: 2; background: #101012; border-top: 1px solid var(--line); }
.reader-paged.reader-controls-hidden .reader-bottom { transform: translateY(100%); }
.reader-paged #page-images {
  display: flex;
  max-width: none;
  height: 100dvh;
  overflow: auto hidden;
  overscroll-behavior: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  touch-action: pan-x pinch-zoom;
}
.reader-paged #page-images::-webkit-scrollbar { display: none; }
.reader-paged[data-page-direction="rtl"] #page-images { direction: rtl; }
.reader-paged[data-page-direction="vertical"] #page-images {
  flex-direction: column;
  overflow: hidden auto;
  scroll-snap-type: y mandatory;
  touch-action: pan-y pinch-zoom;
}
.reader-paged #page-images figure {
  display: grid;
  flex: 0 0 100%;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  min-width: 0;
  min-height: 0;
  margin: 0;
  direction: ltr;
  scroll-margin: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.reader-paged #page-images img { max-height: 100%; object-fit: contain; }
.reader-menu-toggle:focus-visible { position: fixed; z-index: 3; top: max(.5rem, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); width: auto; height: auto; padding: .55rem .75rem; clip: auto; overflow: visible; }
@media (prefers-reduced-motion: reduce) {
  .reader-top, .reader-bottom { transition: none; }
}
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.1rem, 3vw, 1.8rem); }
.panel h2 { margin-bottom: .65rem; font-size: 1.5rem; }
.panel > p { margin-bottom: .65rem; }
.panel > button { margin-top: .65rem; }
.stack { display: grid; gap: .85rem; align-content: start; }
label { display: grid; font-size: .93rem; font-weight: 620; gap: .48rem; }
input { color: var(--ink); border: 1px solid var(--line); width: 100%; min-height: 46px; border-radius: 8px; padding: .65rem .78rem; background: var(--surface); font-size: 1rem; }
.panel input { background: var(--body); }
input::placeholder { color: var(--muted); }
.form-message:empty, #account-status:empty, #bookmark-status:empty { display: none; }
.form-message { font-size: .9rem; }
.error { color: #ffc0b9; }
.invitation { margin-top: 1rem; border: 1px solid #5d482e; background: #251d15; border-radius: 8px; padding: .8rem; display: grid; gap: .45rem; }
.invitation code { overflow-wrap: anywhere; color: var(--accent); font-size: .94rem; user-select: all; }
.invitation button { justify-self: start; }
.item-list { padding: 0; margin: 0; list-style: none; }
.item-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .35rem .8rem; padding: .65rem 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.loading-screen { min-height: 100dvh; display: grid; place-items: center; color: var(--muted); }
.auth-layout { display: grid; grid-template-columns: minmax(300px, 525px) 1fr; min-height: 100dvh; background: #09090a; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(1.45rem, 6vw, 5.4rem); gap: 1rem; }
.auth-panel .brand { margin-bottom: 1.1rem; }
.auth-panel h1 { font-size: clamp(2.3rem, 4.3vw, 3.75rem); }
.auth-panel form { margin-top: .4rem; }
.auth-panel details { color: var(--muted); font-size: .88rem; }
.auth-panel details label { margin-top: .6rem; }
.auth-panel summary { cursor: pointer; min-height: 34px; }
.auth-panel .primary { width: 100%; }
.auth-art { background: radial-gradient(ellipse at 65% 38%,#2b2419 0%,transparent 56%), repeating-linear-gradient(145deg,transparent 0 22px,#ffffff08 22px 23px), #0e0d0c; border-left: 1px solid var(--line); }
.quiet { justify-self: start; align-self: start; }
@media (max-width: 1120px) {
  .layout { grid-template-columns: 182px minmax(0,1fr); }
  .card-grid { grid-template-columns: repeat(4,minmax(0,1fr)); }
}
@media (max-width: 740px) {
  .layout { display: block; padding-bottom: calc(65px + env(safe-area-inset-bottom)); }
  .sidebar { display: none; }
  .mobile-home { display: inline-flex; }
  .mobile-home .brand { font-size: 1.25rem; gap: .43rem; }
  .mobile-home img { width: 29px; height: 29px; border-radius: 7px; }
  .mobile-nav { display: flex; position: fixed; z-index: 2; bottom: 0; left: 0; right: 0; justify-content: space-around; padding: .37rem .13rem calc(.42rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: #101012; }
  .mobile-nav a { font-size: .75rem; display: grid; justify-items: center; gap: .25rem; color: var(--muted); flex: 1; min-height: 44px; align-content: center; }
  .mobile-nav a[aria-current] { color: var(--accent); }
  .topbar { min-height: 63px; padding: max(.55rem, env(safe-area-inset-top)) 1rem .55rem; gap: .65rem; flex-wrap: wrap; }
  .top-search { flex: 1; width: auto; }
  .top-search:empty { display: none; }
  .safe-badge { font-size: 0; padding: .35rem .42rem; }
  .safe-badge span { font-size: .83rem; }
  .main-content { padding: 1rem .9rem; }
  .hero { min-height: 230px; background-position: center, right center; background-size: cover, auto 113%; }
  .hero-content { width: 75%; padding: 1.1rem; }
  .hero h1 { font-size: clamp(2.9rem, 10vw, 4.3rem); }
  .hero p:not(.eyebrow) { margin-bottom: 1rem; }
  .catalog { margin-top: 1.6rem; }
  .section-header { flex-wrap: wrap; }
  .genre-row { flex-wrap: nowrap; overflow-x: auto; padding: .2rem .17rem .45rem; scrollbar-width: thin; }
  .genre-row .chip { white-space: nowrap; }
  .card-grid { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1.05rem .6rem; }
  .title-card { grid-template-columns: minmax(90px, 33%) minmax(0, 1fr); }
  .title-card h1 { font-size: clamp(1.65rem, 6vw, 2.5rem); }
  .title-card .primary, .title-card button { font-size: .82rem; padding: .48rem .6rem; }
  .settings-grid { grid-template-columns: 1fr; }
  .auth-layout { grid-template-columns: 1fr; }
  .auth-panel { width: min(470px, 100%); margin: auto; padding-top: max(1.6rem, env(safe-area-inset-top)); padding-bottom: max(1.6rem, env(safe-area-inset-bottom)); }
  .auth-art { display: none; }
}
@media (max-width: 365px) {
  .topbar { gap: .45rem; }
  .safe-badge { display: none; }
  .card-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

.reader-download { display: flex; flex-wrap: wrap; gap: .7rem; align-items: center; padding: .7rem 1rem; }
.reader-download span { color: var(--muted); font-size: .875rem; }
.reader-download a { color: var(--accent); }
.download-list > li { display: block; padding: 0; }
.download-chapters { list-style: none; margin: 0; padding: 0 0 0 1.15rem; }
.download-chapters li { align-items: center; gap: .7rem 1rem; }
.download-list strong, .download-list small, #extensions small { display: block; }
.download-actions { display: flex; gap: .5rem; align-items: center; }
.offline-notice { margin-bottom: 1rem; }
.category-controls, .category-controls form, .chapter-toolbar, .series-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: .65rem;
}
.category-controls { margin: .6rem 0; }
.category-controls input:not([type="checkbox"]) { width: min(18rem, 100%); }
.category-controls form { flex: 1; }
.toggle-field, .title-categories label { display: flex; align-items: center; gap: .55rem; }
.toggle-field input, .title-categories input { width: 1rem; min-height: auto; accent-color: var(--accent); }
.title-categories { margin: .8rem 0; }
.title-categories label { min-height: 36px; }
.series-actions a { color: var(--accent); padding: .55rem 0; }
.store-list li { align-items: center; gap: .65rem 1rem; }
.store-list strong, .store-list small { display: block; }
.store-entry { flex-wrap: wrap; }
.store-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.extension-review { flex: 1 0 100%; border-top: 1px solid var(--line); padding-top: .65rem; }
.extension-review dl { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .4rem .8rem; }
.extension-review dd { margin: 0; overflow-wrap: anywhere; color: var(--muted); }
.update-list li { display: block; padding: 0; }
.update-series .chapter-link { padding-left: 1.15rem; border-bottom: 0; border-top: 1px solid var(--line); }
.update-series time { color: var(--muted); font-size: .82rem; text-align: right; flex-shrink: 0; }
.chapter-toolbar { margin: .65rem 0; }
.chapter-line { display: flex; align-items: center; gap: .5rem; }
.chapter-line .chapter-link { flex: 1; min-width: 0; }
.chapter-line .chapter-download, .group-download .chapter-download { flex: none; font-size: .82rem; padding: .5rem .7rem; }
a.chapter-download { color: var(--accent); }
.chapter-group { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: start; }
.chapter-versions { border-bottom: 1px solid var(--line); }
:is(.chapter-versions, .update-series, .download-series) > summary { display: flex; align-items: center; gap: .65rem; min-height: 49px; cursor: pointer; }
:is(.chapter-versions, .update-series, .download-series) > summary::before { content: "›"; color: var(--accent); font-size: 1.3rem; }
:is(.chapter-versions, .update-series, .download-series)[open] > summary::before { transform: rotate(90deg); }
.update-series summary small, .download-series .series-count { margin-left: auto; white-space: nowrap; }
.download-series summary { padding: .45rem 0; }
.chapter-versions .chapter-line { margin-left: 1rem; }
.category-status:empty, #series-download-status:empty { display: none; }
@media (max-width: 760px) {
  .mobile-nav [data-nav="history"] { display: none; }
  .chapter-group { gap: .45rem; }
}
