/* ============================================================
   yukbaca — styles.css
   Arah: Swiss minimalism × kios cetak (rak buku/majalah)
   Satu warna aksen (vermillion), kertas netral, grotesque padat.
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  color-scheme: light;
  --bg: #FBF8F7;
  --bg-tint: #FEF2F2;
  --surface: #FFFFFF;
  --surface-2: #F4EEED;
  --ink: #1C1114;
  --ink-2: #574A4E;
  --ink-3: #6E5F63;
  --line: #E9DFDE;
  --line-2: #D8C9C8;
  --brand: #DC2626;
  --brand-text: #C81E1E;
  --brand-strong: #C01E1E;
  --brand-ink: #FFFFFF;
  --brand-soft: #FCE9E8;
  --link: #1E40AF;
  --ring: #DC2626;

  --shadow-1: 0 1px 2px rgba(28, 17, 20, .05), 0 10px 30px rgba(28, 17, 20, .06);
  --shadow-2: 0 18px 60px rgba(28, 17, 20, .22);

  --r-xs: 2px;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;

  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
  --dur-4: 440ms;
  --ease: cubic-bezier(.2, .7, .3, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-back: cubic-bezier(.34, 1.2, .64, 1);

  --sidebar-w: 248px;
  --topbar-h: 64px;
  --spine-h: 4px;

  --font-ui: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Archivo', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #120A0C;
  --bg-tint: #1D0F12;
  --surface: #1A1013;
  --surface-2: #241619;
  --ink: #F7EEEE;
  --ink-2: #C7B4B6;
  --ink-3: #A89194;
  --line: #352528;
  --line-2: #473336;
  --brand: #F2555A;
  --brand-text: #F2555A;
  --brand-strong: #E13E44;
  --brand-ink: #1A0709;
  --brand-soft: #2A1416;
  --link: #9DB7F5;
  --ring: #F2555A;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .35);
  --shadow-2: 0 22px 70px rgba(0, 0, 0, .6);
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html:focus-within { scroll-behavior: smooth; }

body {
  margin: 0;
  padding-top: var(--spine-h);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
}

img { max-width: 100%; display: block; }
h1, h2, h3, h4, p, dl, dd, figure { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: var(--brand); color: var(--brand-ink); }

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
  border-radius: 3px;
}
:focus:not(:focus-visible) { outline: none; }

a, button, select { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 500;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--bg);
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 600;
  transition: top var(--dur-2) var(--ease);
}
.skip-link:focus, .skip-link:focus-visible { top: calc(var(--spine-h) + 12px); }

/* Thick brand spine — signature element, selalu terlihat */
.spine {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--spine-h);
  background: var(--brand);
  z-index: 120;
}

/* ---------- Utilities ---------- */
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.micro-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.u-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.u-num { font-variant-numeric: tabular-nums; }
.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;
}
.kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  padding: 3px 5px;
  border: 1px solid var(--line-2);
  border-bottom-width: 2px;
  border-radius: 3px;
  color: var(--ink-3);
  background: var(--surface-2);
}
.kbd-group { display: inline-flex; gap: 3px; }
.dot-sep { color: var(--ink-3); padding: 0 4px; }

/* ---------- Shell ---------- */
.shell { display: block; }
.main-col { margin-left: var(--sidebar-w); min-height: calc(100dvh - var(--spine-h)); display: flex; flex-direction: column; }
#app { flex: 1; outline: none; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: var(--spine-h);
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px 16px 20px;
  background: var(--bg);
  border-right: 1px solid var(--line);
  overflow-y: auto;
  scrollbar-width: thin;
}
.brand { display: inline-flex; align-items: center; gap: 10px; padding: 2px 8px; align-self: flex-start; }
.brand-mark { color: var(--ink); flex: none; }
.brand-word {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 21px;
  letter-spacing: -.035em;
  line-height: 1;
  color: var(--ink);
}
.brand-dot { color: var(--brand); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.nav-item .ic { width: 18px; height: 18px; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item[aria-current="page"] { background: var(--ink); color: var(--bg); font-weight: 600; }
.nav-item[aria-current="page"] .ic { stroke-width: 1.8; }

.side-block { display: flex; flex-direction: column; gap: 8px; padding: 0 8px; }
.side-genres { display: flex; flex-direction: column; gap: 1px; }
.side-genre {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-height: 32px;
  padding: 6px 4px 6px 0;
  font-size: 13px;
  color: var(--ink-2);
  border-radius: var(--r-xs);
  transition: color var(--dur-2) var(--ease);
}
.side-genre:hover { color: var(--brand); }
.side-genre .count { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.status-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.status-top { display: flex; align-items: center; gap: 7px; }
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-3);
  flex: none;
}
.status-dot[data-state="ok"] { background: #1F9D55; box-shadow: 0 0 0 3px rgba(31, 157, 85, .16); }
.status-dot[data-state="error"] { background: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.status-dot[data-state="loading"] { background: #C99A2E; animation: pulse 1.4s infinite; }
.status-name { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.status-sep { color: var(--ink-3); font-weight: 400; }
.status-sync { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); letter-spacing: .02em; }
.side-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  border-radius: var(--r-sm);
  transition: color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.side-link .ic { width: 15px; height: 15px; }
.side-link:hover { color: var(--ink); background: var(--surface-2); }

@keyframes pulse { 50% { opacity: .35; } }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: var(--spine-h);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--topbar-h);
  padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand--compact { display: none; padding-left: 0; min-height: 44px; align-items: center; }
.page-heading { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.page-eyebrow { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.page-title {
  font-family: var(--font-display);
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -.01em;
  line-height: 1.2;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.search-trigger {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 40px;
  width: 288px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-3);
  font-size: 13px;
  text-align: left;
  transition: border-color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.search-trigger:hover { border-color: var(--ink-2); }
.search-trigger .ic { width: 16px; height: 16px; color: var(--ink-3); }
.search-trigger-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-2);
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); border-color: var(--ink-2); }
.icon-btn:active { background: var(--line); }
.topbar-search-link { display: none; }

/* Tema toggle: ikon berganti halus */
#btn-theme .ic-sun, #btn-theme .ic-moon { position: absolute; transition: opacity var(--dur-2) var(--ease), transform var(--dur-3) var(--ease); }
#btn-theme { position: relative; overflow: hidden; }
#btn-theme .ic-sun { opacity: 1; transform: rotate(0) scale(1); }
#btn-theme .ic-moon { opacity: 0; transform: rotate(-40deg) scale(.6); }
[data-theme="dark"] #btn-theme .ic-sun { opacity: 0; transform: rotate(40deg) scale(.6); }
[data-theme="dark"] #btn-theme .ic-moon { opacity: 1; transform: rotate(0) scale(1); }

/* ---------- Page & sections ---------- */
.page { max-width: 1280px; margin: 0 auto; padding: 32px 40px 88px; }
.section { margin-top: 52px; }
.section:first-child { margin-top: 0; }

.view-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.view-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(30px, 3.6vw, 46px);
  line-height: 1.02;
  letter-spacing: -.028em;
  margin: 0;
  text-wrap: balance;
}
.view-title .accent { color: var(--brand); }
.view-sub { color: var(--ink-2); font-size: 15px; max-width: 62ch; }

/* Folio — penomoran bagian ala majalah cetak */
.folio {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 20px;
}
.folio-no {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 26px;
  line-height: 1;
  color: var(--brand);
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.folio-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(18px, 1.8vw, 22px);
  letter-spacing: -.015em;
  line-height: 1.1;
}
.folio-side { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.more-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding: 8px 2px;
  min-height: 34px;
  transition: color var(--dur-2) var(--ease), gap var(--dur-2) var(--ease);
}
.more-link:hover { color: var(--brand); gap: 9px; }
.more-link .ic { width: 14px; height: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -.005em;
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease),
              border-color var(--dur-2) var(--ease), transform var(--dur-1) var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn .ic { width: 17px; height: 17px; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-strong); }
.btn-secondary { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn-secondary:hover { background: var(--ink); color: var(--bg); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn .spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex: none;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink-2);
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}
.btn-icon:hover { background: var(--surface-2); color: var(--ink); border-color: var(--ink-2); }
.btn-icon.is-active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.btn-icon .ic { width: 18px; height: 18px; }

/* ---------- Hero (sampul edisi) ---------- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 236px;
  gap: 36px;
  align-items: center;
  padding: 34px 36px;
  background: var(--bg-tint);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(color-mix(in srgb, var(--brand) 30%, transparent) 1px, transparent 1.3px);
  background-size: 13px 13px;
  opacity: .5;
  -webkit-mask-image: linear-gradient(112deg, transparent 42%, #000 100%);
  mask-image: linear-gradient(112deg, transparent 42%, #000 100%);
  pointer-events: none;
}
.hero > * { position: relative; }
.hero-copy { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.hero-label { display: flex; align-items: center; gap: 8px; }
.hero-label .micro-label { color: var(--brand-text); }
.hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(30px, 3.4vw, 48px);
  line-height: .98;
  letter-spacing: -.028em;
  text-wrap: balance;
  max-inline-size: 22ch;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-title .accent { color: var(--brand); }
.hero-alt { font-size: 13px; color: var(--ink-3); margin-top: -6px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.pill--brand { border-color: color-mix(in srgb, var(--brand) 45%, transparent); color: var(--brand); }
.hero-synopsis {
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.6;
  max-width: 54ch;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-top: 4px; }

.hero-cover { position: relative; justify-self: center; width: 100%; max-width: 236px; }
.hero-cover .frame {
  position: absolute;
  inset: 0;
  transform: translate(10px, 10px);
  border: 1.5px solid var(--ink);
  border-radius: var(--r-md);
  opacity: .5;
  pointer-events: none;
}
.hero-cover .cover {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow-1);
}
.hero-cover img { width: 100%; height: 100%; object-fit: cover; }
.ribbon {
  position: absolute;
  top: -1px;
  right: 14px;
  width: 26px;
  height: 38px;
  background: var(--brand);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%);
  z-index: 2;
}
.hero-stamp {
  position: absolute;
  left: -14px;
  bottom: 18px;
  z-index: 3;
  transform: rotate(-6deg);
  background: var(--surface);
  border: 1px solid var(--ink);
  border-radius: var(--r-xs);
  padding: 5px 9px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
  box-shadow: var(--shadow-1);
}

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  overflow: hidden;
}
.stat { padding: 14px 18px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.stat:first-child { border-left: 0; }
.stat-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 25px;
  line-height: 1.1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.stat-value .unit { font-size: 13px; font-weight: 600; color: var(--ink-3); letter-spacing: 0; margin-left: 3px; }
.stat-sub { font-size: 11.5px; color: var(--ink-3); }

/* ---------- Grid & cover card ---------- */
.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 24px 18px;
}
.cover-card { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.cover-card .cover {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
  overflow: hidden;
  transition: border-color var(--dur-2) var(--ease), transform var(--dur-3) var(--ease);
}
.cover-card .cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--dur-4) var(--ease);
}
.cover-card:hover .cover { border-color: var(--ink); transform: translateY(-2px); }
@media (hover: hover) {
  .cover-card:hover .cover img { transform: scale(1.035); }
}
.cover-card:focus-visible { outline-offset: 4px; border-radius: var(--r-sm); }
.type-chip {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 3px 7px;
  border-radius: var(--r-xs);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px);
  border: 1px solid color-mix(in srgb, var(--line-2) 70%, transparent);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-2);
}
.saved-flag {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px; height: 24px;
  border-radius: var(--r-xs);
  background: var(--brand);
  color: var(--brand-ink);
}
.saved-flag .ic { width: 13px; height: 13px; stroke-width: 2; }
.new-flag {
  position: absolute;
  bottom: 8px;
  left: 8px;
  z-index: 2;
  padding: 3px 6px;
  background: var(--brand);
  color: var(--brand-ink);
  border-radius: var(--r-xs);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.cover-card-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cover-card-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.34;
  letter-spacing: -.006em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cover-card:hover .cover-card-title { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.cover-card-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cover-card-meta .ch { color: var(--ink-2); }

/* ---------- Rank ---------- */
.rank-list { display: flex; flex-direction: column; }
.rank-row {
  display: grid;
  grid-template-columns: 42px 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 10px 6px;
  border-bottom: 1px solid var(--line);
  border-radius: var(--r-xs);
  transition: background var(--dur-2) var(--ease);
}
.rank-row:last-child { border-bottom: 0; }
.rank-row:hover { background: var(--surface-2); }
.rank-no {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 28px;
  line-height: 1;
  color: transparent;
  -webkit-text-stroke: 1px var(--ink-2);
  font-variant-numeric: tabular-nums;
  transition: color var(--dur-2) var(--ease);
}
.rank-row:hover .rank-no { color: var(--brand); -webkit-text-stroke: 1px var(--brand); }
.rank-row[data-rank="1"] .rank-no { color: var(--brand); -webkit-text-stroke: 0; }
.rank-thumb {
  width: 44px; height: 58px;
  border-radius: var(--r-xs);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.rank-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rank-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rank-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank-row:hover .rank-title { text-decoration: underline; text-underline-offset: 3px; }
.rank-sub { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); letter-spacing: .02em; }
.rank-views { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }
.rank-views .ic { width: 13px; height: 13px; }

/* ---------- Genre panel ---------- */
.genre-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 28px; }
.genre-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 9px 2px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--ink-2);
  transition: color var(--dur-2) var(--ease), padding-left var(--dur-2) var(--ease);
}
.genre-row:hover { color: var(--brand); padding-left: 6px; }
.genre-row .count { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); }
.genre-row:hover .count { color: var(--brand); }

/* ---------- Two-column layout ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.split--even { grid-template-columns: 1fr 1fr; }

/* ---------- Filters ---------- */
.filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 24px;
}
.segment {
  display: inline-flex;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--surface);
}
.segment button {
  height: 40px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  border-left: 1px solid var(--line);
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.segment button:first-child { border-left: 0; }
.segment button:hover { background: var(--surface-2); color: var(--ink); }
.segment button[aria-pressed="true"] { background: var(--ink); color: var(--bg); font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > .micro-label { padding-left: 1px; }
.select, .input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  transition: border-color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.select { padding-right: 30px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236E5F63' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; }
[data-theme="dark"] .select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23A89194' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); }
.select:hover, .input:hover { border-color: var(--ink-2); }
.filter-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.filter-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 36px;
}
.page-indicator { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); letter-spacing: .04em; }

/* ---------- Skeleton ---------- */
.sk { position: relative; overflow: hidden; background: var(--surface-2); border-radius: var(--r-sm); }
.sk::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--surface) 70%, transparent), transparent);
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-card .cover { aspect-ratio: 3 / 4; border-radius: var(--r-md); }
.sk-line { height: 11px; border-radius: 3px; margin-top: 9px; }
.sk-line.w80 { width: 80%; }
.sk-line.w55 { width: 55%; }
.sk-hero { height: 260px; border-radius: var(--r-md); }
.sk-rankrow { display: grid; grid-template-columns: 42px 44px 1fr; gap: 14px; align-items: center; padding: 12px 6px; }
.sk-rankrow .sk-no { height: 26px; width: 34px; }
.sk-rankrow .sk-thumb { height: 58px; width: 44px; border-radius: var(--r-xs); }

/* ---------- Empty / error ---------- */
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  padding: 48px 24px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.state .state-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-3);
}
.state .state-icon .ic { width: 20px; height: 20px; }
.state-title { font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.state-text { font-size: 13.5px; color: var(--ink-2); max-width: 44ch; }
.state-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; justify-content: center; }

/* ---------- Detail ---------- */
.breadcrumb { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); letter-spacing: .03em; }
.breadcrumb a { color: var(--ink-3); transition: color var(--dur-2) var(--ease); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .sep { color: var(--ink-3); }
.breadcrumb [aria-current="page"] { color: var(--ink-2); }

.detail-hero {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  grid-template-areas:
    "cover title"
    "cover actions"
    "cover meta"
    "cover syn";
  column-gap: 36px;
  row-gap: 16px;
  align-items: start;
}
.d-cover { grid-area: cover; position: relative; }
.d-cover .cover {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow-1);
}
.d-cover .cover img { width: 100%; height: 100%; object-fit: cover; }
.d-title { grid-area: title; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.d-title h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(26px, 3vw, 40px);
  line-height: 1.04;
  letter-spacing: -.025em;
  text-wrap: balance;
}
.d-alt { font-size: 13px; color: var(--ink-3); }
.d-actions { grid-area: actions; display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.d-meta {
  grid-area: meta;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px 22px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.d-meta dt { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 3px; }
.d-meta dd { font-size: 13.5px; font-weight: 500; color: var(--ink); margin: 0; }
.d-syn { grid-area: syn; display: flex; flex-direction: column; gap: 10px; }
.synopsis { color: var(--ink-2); font-size: 14.5px; line-height: 1.68; max-width: 74ch; }
.synopsis.is-clamped {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.syn-toggle {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 0;
  padding: 4px 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--brand);
}
.syn-toggle .ic { width: 13px; height: 13px; transition: transform var(--dur-2) var(--ease); }
.syn-toggle[aria-expanded="true"] .ic { transform: rotate(180deg); }
.tag-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-xs);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  transition: border-color var(--dur-2) var(--ease), color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.tag:hover { border-color: var(--ink); color: var(--ink); background: var(--surface-2); }

/* ---------- Panel & chapters ---------- */
.panel { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.panel-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: -.01em; display: flex; align-items: baseline; gap: 8px; }
.panel-title .count { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); letter-spacing: .03em; }
.panel-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ch-search { width: 180px; }
.ch-list { max-height: 540px; overflow-y: auto; scrollbar-width: thin; }
.ch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  min-height: 46px;
  border-bottom: 1px solid var(--line);
  transition: background var(--dur-2) var(--ease);
}
.ch-row:last-child { border-bottom: 0; }
.ch-row:hover { background: var(--surface-2); }
.ch-name { font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-date { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); white-space: nowrap; }
.ch-done { color: var(--brand); display: inline-flex; }
.ch-done .ic { width: 15px; height: 15px; stroke-width: 2; }
.ch-empty { padding: 24px 16px; font-size: 13px; color: var(--ink-3); text-align: center; }

/* ---------- Reader ---------- */
body[data-chrome="reader"] { background: #0D090A; }
body[data-chrome="reader"] .sidebar,
body[data-chrome="reader"] .topbar,
body[data-chrome="reader"] .site-footer,
body[data-chrome="reader"] .bottomnav { display: none; }
body[data-chrome="reader"] .main-col { margin-left: 0; }
body[data-chrome="reader"] #app { padding: 0; }

.reader { min-height: calc(100dvh - var(--spine-h)); background: #0D090A; color: #F3EDEC; }
.reader a { color: inherit; }
.reader :focus-visible { outline-color: #FFFFFF; }

.reader-progress {
  position: fixed;
  top: var(--spine-h);
  left: 0;
  right: 0;
  height: 2px;
  z-index: 95;
  background: rgba(255, 255, 255, .1);
}
.reader-progress > span {
  display: block;
  height: 100%;
  background: var(--brand);
  transform-origin: 0 50%;
  transform: scaleX(var(--p, 0));
  transition: transform 120ms linear;
}

.rbar {
  position: fixed;
  top: var(--spine-h);
  left: 0;
  right: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 58px;
  padding: 0 16px;
  background: rgba(13, 9, 10, .84);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  transition: transform var(--dur-3) var(--ease), opacity var(--dur-3) var(--ease);
}
.rbar.is-hidden { transform: translateY(-102%); opacity: 0; }
.rbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex: none;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .04);
  color: #EFE7E6;
  transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}
.rbar-btn:hover { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .3); }
.rbar-btn[aria-disabled="true"],
.rbar-btn:disabled { opacity: .35; pointer-events: none; cursor: not-allowed; }
.rbar-btn .ic { width: 18px; height: 18px; }
.rbar-title { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.rbar-eyebrow { font-family: var(--font-mono); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: rgba(243, 237, 236, .55); }
.rbar-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rbar-spacer { flex: 1; }
.rbar-select,
.rbar-mode {
  height: 36px;
  max-width: 170px;
  padding: 0 28px 0 10px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--r-sm);
  background: #171012;
  color: #F3EDEC;
  font-size: 12px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%23A89194' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}

.reader-pages {
  max-width: min(840px, 100%);
  margin: 0 auto;
  padding: 74px 0 130px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rpage { position: relative; background: #171012; border-radius: 2px; overflow: hidden; min-height: 46vh; }
.rpage.is-ready { min-height: 0; }
.rpage img { width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity var(--dur-3) var(--ease); }
.rpage.is-ready img { height: auto; }
.rpage img.is-loaded { opacity: 1; }
.rpage::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, #171012 30%, #241619 50%, #171012 70%);
  background-size: 300% 100%;
  animation: rshimmer 1.6s linear infinite;
}
.rpage.is-ready::before { display: none; }
@keyframes rshimmer { from { background-position: 150% 0; } to { background-position: -150% 0; } }
.rpage-no {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 6px;
  border-radius: 2px;
  background: rgba(0, 0, 0, .45);
  font-family: var(--font-mono);
  font-size: 9px;
  color: rgba(255, 255, 255, .7);
  pointer-events: none;
}

.reader[data-reader-mode="swipe"] .reader-pages,
.reader[data-reader-mode="page"] .reader-pages {
  position: fixed;
  z-index: 1;
  inset: calc(var(--spine-h) + 58px) 0 calc(60px + env(safe-area-inset-bottom));
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 10px 48px;
  display: grid;
  place-items: center;
  overflow: hidden;
  box-sizing: border-box;
  background: #0D090A;
}
.reader[data-reader-mode="swipe"] .reader-pages { touch-action: pan-y; cursor: grab; }
.reader[data-reader-mode="swipe"] .reader-pages:active { cursor: grabbing; }
.reader[data-reader-mode="swipe"] .rpage:not(.is-current),
.reader[data-reader-mode="page"] .rpage:not(.is-current) { display: none; }
.reader[data-reader-mode="swipe"] .rpage,
.reader[data-reader-mode="page"] .rpage {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  border-radius: 0;
  background: transparent;
}
.reader[data-reader-mode="swipe"] .rpage.is-ready,
.reader[data-reader-mode="page"] .rpage.is-ready { min-height: 0; }
.reader[data-reader-mode="swipe"] .rpage img,
.reader[data-reader-mode="page"] .rpage img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.reader[data-reader-mode="swipe"] .reader-end,
.reader[data-reader-mode="page"] .reader-end { display: none; }
.reader[data-reader-mode="swipe"] .rpage.is-current { animation: readerPageIn 180ms var(--ease-out); }
@keyframes readerPageIn {
  from { opacity: .75; transform: translateX(8px); }
  to { opacity: 1; transform: translateX(0); }
}
.reader.is-pseudo-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 500;
  width: 100vw;
  height: 100dvh;
  min-height: 100dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.reader.is-pseudo-fullscreen[data-reader-mode="swipe"] .reader-pages,
.reader.is-pseudo-fullscreen[data-reader-mode="page"] .reader-pages { inset: 58px 0 calc(60px + env(safe-area-inset-bottom)); }

.reader-end {
  max-width: min(840px, 100%);
  margin: 0 auto;
  padding: 8px 24px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}
.reader-end-line { width: 100%; display: flex; align-items: center; gap: 14px; color: rgba(243, 237, 236, .4); }
.reader-end-line::before, .reader-end-line::after { content: ""; height: 1px; background: rgba(255, 255, 255, .12); flex: 1; }
.reader-end-text { font-family: var(--font-mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.reader-end-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.reader-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, .05);
  color: #F3EDEC;
  font-size: 13.5px;
  font-weight: 600;
  transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}
.reader-btn:hover { background: rgba(255, 255, 255, .12); }
.reader-btn--brand { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.reader-btn--brand:hover { background: var(--brand-strong); border-color: var(--brand-strong); }
.reader-btn[aria-disabled="true"] { opacity: .35; pointer-events: none; }
.reader-btn .ic { width: 16px; height: 16px; }

.rfoot {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(13, 9, 10, .86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, .08);
  transition: transform var(--dur-3) var(--ease), opacity var(--dur-3) var(--ease);
}
.rfoot.is-hidden { transform: translateY(102%); opacity: 0; }
.rfoot-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rfoot-page { font-family: var(--font-mono); font-size: 10px; letter-spacing: .06em; color: rgba(243, 237, 236, .6); }
.rfoot-ch { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rfoot-actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------- Command palette ---------- */
.palette-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 11vh 16px 16px;
  background: rgba(18, 10, 12, .48);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn 160ms var(--ease-out);
}
.palette {
  width: min(580px, 100%);
  max-height: min(70dvh, 620px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  animation: popIn 180ms var(--ease-out);
}
.palette-input-row { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 16px; border-bottom: 1px solid var(--line); flex: none; }
.palette-input-row .ic { color: var(--ink-3); }
.palette-input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 15px; color: var(--ink); outline: none; }
.palette-input::placeholder { color: var(--ink-3); }
.palette-close { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink-3); }
.palette-close:hover { background: var(--surface-2); color: var(--ink); }
.palette-list { overflow-y: auto; padding: 8px; min-height: 0; flex: 1; overscroll-behavior: contain; }
.palette-group { padding: 9px 10px 5px; }
.palette-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--ink);
  font-size: 13.5px;
  text-align: left;
  transition: background var(--dur-1) var(--ease);
}
.palette-item .ic { width: 16px; height: 16px; color: var(--ink-3); }
.palette-item:hover { background: var(--surface-2); }
.palette-item[aria-selected="true"] { background: var(--surface-2); box-shadow: inset 2px 0 0 var(--brand); }
.palette-item[aria-selected="true"] .ic { color: var(--brand); }
.palette-meta { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); letter-spacing: .02em; white-space: nowrap; }
.palette-thumb { width: 26px; height: 34px; border-radius: 2px; overflow: hidden; background: var(--surface-2); flex: none; }
.palette-thumb img { width: 100%; height: 100%; object-fit: cover; }
.palette-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .05em;
  color: var(--ink-3);
  flex: none;
}
.palette-foot .kbd { font-size: 9px; padding: 2px 4px; }
.palette-hint { display: inline-flex; align-items: center; gap: 5px; }
.palette-empty { padding: 24px 16px; text-align: center; font-size: 13px; color: var(--ink-3); }

@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.985); } }

/* ---------- Toast ---------- */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 320;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
body[data-chrome="reader"] .toast-region { bottom: calc(88px + env(safe-area-inset-bottom)); }
.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--bg);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-2);
  pointer-events: auto;
  animation: toastIn var(--dur-3) var(--ease-back);
  max-width: 100%;
}
.toast .ic { width: 15px; height: 15px; flex: none; }
.toast.is-out { animation: toastOut var(--dur-2) var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(6px); } }

/* ---------- Footer ---------- */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 20px 40px 28px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .02em;
  color: var(--ink-3);
}
.site-footer a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); transition: color var(--dur-2) var(--ease); }
.site-footer a:hover { color: var(--brand); }

/* ---------- Bottom nav (mobile) ---------- */
.bottomnav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 80;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 5px 8px calc(5px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.bn-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  border-radius: var(--r-sm);
  font-size: 10.5px;
  font-weight: 500;
  color: var(--ink-3);
  transition: color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
.bn-item .ic { width: 20px; height: 20px; }
.bn-item:hover { color: var(--ink); background: var(--surface-2); }
.bn-item[aria-current="page"] { color: var(--brand); font-weight: 600; }
.bn-item[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: -5px;
  width: 22px;
  height: 2px;
  border-radius: 1px;
  background: var(--brand);
}

/* ---------- Entrance reveal ---------- */
.reveal { opacity: 0; transform: translateY(14px) scale(.99); transition: opacity var(--dur-4) var(--ease-out), transform var(--dur-4) var(--ease-out); }
.reveal.in { opacity: 1; transform: none; }

.route-anim { animation: routeIn var(--dur-3) var(--ease-out); }
@keyframes routeIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .page { padding: 28px 28px 88px; }
  .topbar { padding: 0 24px; }
  .search-trigger { width: 240px; }
  .split { grid-template-columns: 1fr; gap: 44px; }
  .split--even { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1023px) {
  .sidebar { display: none; }
  .main-col { margin-left: 0; }
  .bottomnav { display: grid; }
  .brand--compact { display: inline-flex; }
  .search-trigger { display: none; }
  .topbar-search-link { display: inline-flex; }
  .page { padding: 24px 20px 108px; }
  .site-footer { padding: 20px 20px 92px; }
  .topbar { gap: 12px; }
  .page-heading { display: none; }
}

@media (max-width: 860px) {
  .hero { grid-template-columns: minmax(0, 1fr) 168px; gap: 22px; padding: 24px 22px; }
  .hero-cover .frame { transform: translate(7px, 7px); }
  .hero-synopsis { -webkit-line-clamp: 2; }
  .split--even { grid-template-columns: 1fr; }
  .detail-hero {
    grid-template-columns: 132px minmax(0, 1fr);
    grid-template-areas:
      "cover title"
      "actions actions"
      "meta meta"
      "syn syn";
    column-gap: 18px;
    row-gap: 14px;
  }
  .d-cover .cover { border-radius: var(--r-sm); }
  .ch-search { width: 132px; }
  .ch-list { max-height: 460px; }
}

@media (max-width: 640px) {
  .page { padding: 20px 16px 104px; }
  .site-footer { padding: 18px 16px 88px; flex-direction: column; align-items: flex-start; gap: 6px; }
  .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 104px;
    column-gap: 14px;
    row-gap: 9px;
    align-items: start;
    padding: 18px 16px;
  }
  .hero-copy { display: contents; }
  .hero-label { grid-row: 1; grid-column: 1; }
  .hero-title { grid-row: 2; grid-column: 1; }
  .hero-alt { grid-row: 3; grid-column: 1; }
  .hero-cover { grid-row: 1 / span 3; grid-column: 2; width: 100%; max-width: 104px; margin-top: 2px; }
  .hero-cover .frame { display: none; }
  .hero-cover .cover { aspect-ratio: 3 / 4; border-radius: var(--r-sm); }
  .ribbon { width: 18px; height: 27px; right: 8px; }
  .hero-stamp { display: none; }
  .hero-title { font-size: clamp(23px, 6.6vw, 30px); }
  .hero-synopsis { display: none; }
  .hero-alt { font-size: 11.5px; }
  .hero-meta { grid-column: 1 / -1; gap: 5px; }
  .hero-meta .pill { font-size: 9px; padding: 3px 7px; }
  .hero-actions { grid-column: 1 / -1; padding-top: 4px; gap: 8px; }
  .hero-actions .btn { flex: 1 1 auto; }
  .hero-actions .btn-icon { flex: none; }
  .stat { padding: 12px 12px; }
  .stat .micro-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 9px; letter-spacing: .1em; }
  .stat-value { font-size: 22px; }
  .stat-sub { font-size: 10.5px; }
  .stats { grid-template-columns: 1fr 1fr; margin-top: 12px; }
  .stat { border-left: 1px solid var(--line); }
  .stat:nth-child(odd) { border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 12px; }
  .cover-card-title { font-size: 13px; }
  .rank-row { grid-template-columns: 30px 38px minmax(0, 1fr) auto; gap: 10px; padding: 9px 4px; }
  .rank-no { font-size: 21px; }
  .rank-thumb { width: 38px; height: 50px; }
  .rank-views { font-size: 9.5px; }
  .genre-grid { grid-template-columns: 1fr; }
  .folio { gap: 10px; padding-bottom: 8px; }
  .folio-no { font-size: 21px; }
  .folio-side .more-link span { display: none; }
  .filterbar { gap: 9px; }
  .filter-actions { margin-left: 0; width: 100%; }
  .segment { width: 100%; }
  .segment button { flex: 1; padding: 0 8px; font-size: 12px; }
  .field { flex: 1 1 44%; }
  .select { width: 100%; }
  .icon-btn { width: 44px; height: 44px; }
  .topbar { height: 60px; padding: 0 12px; }
  .brand-word { font-size: 19px; }
  .palette-overlay { padding: 8vh 10px 10px; }
  .detail-hero { grid-template-columns: 108px minmax(0, 1fr); }
  .d-title h1 { font-size: clamp(21px, 6vw, 27px); }
  .d-actions .btn { flex: 1 1 auto; }
  .panel-head { padding: 12px; }
  .panel-tools { width: 100%; margin-left: 0; }
  .ch-search { flex: 1; width: auto; }
  .ch-row { padding: 0 12px; }
  .ch-date { display: none; }
  .reader-pages { gap: 3px; padding: 66px 0 118px; }
  .rbar { height: 54px; gap: 8px; padding: 0 10px; }
  .rbar-select { width: 100px; max-width: 100px; padding-left: 7px; padding-right: 22px; }
  .rbar-mode { width: 86px; max-width: 86px; padding-left: 7px; padding-right: 22px; }
  .rbar .rbar-btn { width: 38px; height: 38px; }
  .reader[data-reader-mode="swipe"] .reader-pages,
  .reader[data-reader-mode="page"] .reader-pages { inset: calc(var(--spine-h) + 54px) 0 calc(56px + env(safe-area-inset-bottom)); padding: 8px 38px; }
  .reader.is-pseudo-fullscreen[data-reader-mode="swipe"] .reader-pages,
  .reader.is-pseudo-fullscreen[data-reader-mode="page"] .reader-pages { inset: 54px 0 calc(56px + env(safe-area-inset-bottom)); }
  .rfoot { gap: 8px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .rfoot .rbar-btn { width: 38px; height: 38px; }
  .view-sub { font-size: 14px; }
}

@media (max-width: 380px) {
  .rbar { gap: 4px; padding: 0 6px; }
  .rbar .rbar-btn { width: 32px; height: 36px; }
  .rbar-mode { width: 76px; max-width: 76px; padding-left: 6px; padding-right: 18px; }
  .rbar-select { width: 82px; max-width: 82px; padding-left: 6px; padding-right: 18px; }
  .rbar-eyebrow { display: none; }
  .rbar-name { font-size: 11px; }
  .hero-cover { width: 92px; margin-left: 10px; }
  .hero-meta { padding-right: 100px; }
  .shelf { gap: 18px 10px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
  html:focus-within { scroll-behavior: auto; }
}

/* ---------- Lanjut baca ---------- */
.continue-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(238px, 1fr)); gap: 12px; }
.continue-card {
  display: flex;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
.continue-card:hover { border-color: var(--ink); transform: translateY(-2px); }
.continue-cover {
  width: 52px; height: 70px; flex: none;
  border-radius: var(--r-xs); overflow: hidden;
  border: 1px solid var(--line); background: var(--surface-2);
}
.continue-cover img { width: 100%; height: 100%; object-fit: cover; }
.continue-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; justify-content: center; }
.continue-title {
  font-size: 13px; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.continue-meta { font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.continue-sub { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .06em; color: var(--ink-3); text-transform: uppercase; margin-top: 4px; }
.progress { display: block; height: 3px; margin-top: 6px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); transform-origin: 0 50%; transform: scaleX(var(--v, .2)); }

/* ---------- Daftar koleksi ---------- */
.library-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.lib-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.lib-row:last-child { border-bottom: 0; }
.lib-row:hover { background: var(--surface-2); }
.lib-cover { width: 56px; height: 74px; border-radius: var(--r-xs); overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.lib-cover img { width: 100%; height: 100%; object-fit: cover; }
.lib-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.lib-title { font-size: 14.5px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.lib-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-3); }
.lib-actions { display: flex; align-items: center; gap: 8px; }
.lib-actions .btn-icon { width: 40px; height: 40px; }
@media (max-width: 640px) {
  .lib-row { grid-template-columns: 44px minmax(0, 1fr); grid-template-areas: "cov main" "act act"; gap: 10px 12px; padding: 12px; }
  .lib-cover { grid-area: cov; width: 44px; height: 58px; }
  .lib-main { grid-area: main; }
  .lib-actions { grid-area: act; justify-content: flex-end; }
}

/* ---------- Segment sebagai tautan ---------- */
.segment a {
  display: inline-flex; align-items: center; justify-content: center;
  height: 40px; padding: 0 14px;
  font-size: 13px; font-weight: 500; color: var(--ink-2);
  border-left: 1px solid var(--line);
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.segment a:first-child { border-left: 0; }
.segment a:hover { background: var(--surface-2); color: var(--ink); }
.segment a[aria-current="page"] { background: var(--ink); color: var(--bg); font-weight: 600; }

/* ---------- Tambahan kecil ---------- */
.panel-pad { padding: 6px 12px; }
.btn-secondary.is-active { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.sk-hero { height: 268px; border-radius: var(--r-md); }
.more-link { background: none; border: 0; }
.tag .ic { width: 12px; height: 12px; }
.btn-icon[aria-busy="true"] { opacity: .6; }

/* ---------- Dialog konfirmasi ---------- */
.palette.confirm { max-width: 420px; }
.confirm-body { padding: 22px 22px 6px; }
.confirm-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.confirm-text { font-size: 13.5px; color: var(--ink-2); margin-top: 8px; line-height: 1.6; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 18px 22px 20px; }
