:root {
  --neutral-0: hsl(30 33% 99%);
  --neutral-50: hsl(30 25% 96%);
  --neutral-100: hsl(30 18% 92%);
  --neutral-200: hsl(30 12% 85%);
  --neutral-500: hsl(30 6% 40%);
  --neutral-600: hsl(30 7% 32%);
  --neutral-900: hsl(30 12% 11%);
  --primary-50: hsl(10 80% 96%);
  --primary-600: hsl(8 72% 44%);
  --primary-700: hsl(6 74% 37%);
  --primary-800: hsl(5 72% 30%);
  --success-50: hsl(145 50% 94%);
  --success-700: hsl(150 60% 24%);
  --danger-50: hsl(0 80% 96%);
  --danger-700: hsl(0 70% 38%);
  --info-50: hsl(215 70% 95%);
  --info-700: hsl(215 65% 34%);

  --color-surface-page: var(--neutral-50);
  --color-surface-raised: var(--neutral-0);
  --color-surface-overlay: var(--neutral-0);
  --color-surface-sunken: var(--neutral-100);
  --color-text-primary: var(--neutral-900);
  --color-text-secondary: var(--neutral-600);
  --color-text-tertiary: var(--neutral-500);
  --color-border-hairline: hsl(30 20% 30% / .12);
  --color-border-input: hsl(30 8% 55%);
  --color-action-primary: var(--primary-600);
  --color-action-primary-hover: var(--primary-700);
  --color-action-primary-text: hsl(0 0% 100%);
  --color-accent-text: var(--primary-700);
  --color-accent-tint: var(--primary-50);
  --color-success-bg: var(--success-50);
  --color-success-text: var(--success-700);
  --color-danger-bg: var(--danger-50);
  --color-danger-text: var(--danger-700);
  --color-info-bg: var(--info-50);
  --color-info-text: var(--info-700);
  --color-overlay-scrim: hsl(30 15% 8% / .82);
  --color-overlay-text: hsl(30 25% 96%);
  --highlight-top: inset 0 1px 0 hsl(0 0% 100% / .6);

  --shadow-sm: 0 1px 2px hsl(30 30% 10% / .06), 0 1px 3px hsl(30 30% 10% / .08);
  --shadow-md: 0 2px 4px hsl(30 30% 10% / .04), 0 4px 12px hsl(30 30% 10% / .08);
  --shadow-lg: 0 4px 8px hsl(30 30% 10% / .04), 0 12px 32px hsl(30 30% 10% / .12);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 999px;

  --text-xs: 12px;
  --text-sm: 14px;
  --text-base: 16px;
  --text-lg: 18px;
  --text-xl: 20px;
  --text-3xl: 30px;

  --duration-fast: 120ms;
  --duration-medium: 200ms;
  --ease-enter: cubic-bezier(.2, .8, .2, 1);

  --content-max: 1280px;
  --topbar-height: 64px;
  --tabbar-height: 64px;
  --target-min: 44px;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-surface-page: hsl(280 8% 7%);
    --color-surface-raised: hsl(280 7% 10%);
    --color-surface-overlay: hsl(280 7% 14%);
    --color-surface-sunken: hsl(280 8% 5%);
    --color-text-primary: hsl(30 20% 93%);
    --color-text-secondary: hsl(30 10% 72%);
    --color-text-tertiary: hsl(30 6% 62%);
    --color-border-hairline: hsl(0 0% 100% / .08);
    --color-border-input: hsl(30 6% 48%);
    --color-action-primary: hsl(8 68% 52%);
    --color-action-primary-hover: hsl(8 70% 58%);
    --color-accent-text: hsl(10 85% 72%);
    --color-accent-tint: hsl(8 40% 18%);
    --color-success-bg: hsl(150 30% 15%);
    --color-success-text: hsl(145 55% 70%);
    --color-danger-bg: hsl(0 35% 17%);
    --color-danger-text: hsl(0 85% 78%);
    --color-info-bg: hsl(215 30% 17%);
    --color-info-text: hsl(215 80% 80%);
    --highlight-top: inset 0 1px 0 hsl(0 0% 100% / .08);
    --shadow-sm: 0 1px 2px hsl(0 0% 0% / .3);
    --shadow-md: 0 2px 6px hsl(0 0% 0% / .35);
    --shadow-lg: 0 8px 24px hsl(0 0% 0% / .45);
  }
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  scroll-padding-top: calc(var(--topbar-height) + var(--space-4));
  scroll-padding-bottom: calc(var(--tabbar-height) + var(--space-4));
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-text-primary);
  background: var(--color-surface-page);
}

img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--color-action-primary);
  outline-offset: 2px;
}

[tabindex="-1"]:focus { outline: none; }

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100px;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--color-surface-overlay);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}
.skip-link:focus { top: var(--space-4); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--space-8);
  height: var(--topbar-height);
  padding: 0 max(var(--space-6), calc((100vw - var(--content-max)) / 2));
  background: color-mix(in srgb, var(--color-surface-page) 88%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border-hairline);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: var(--text-lg);
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--color-action-primary);
  color: var(--color-action-primary-text);
  font-size: var(--text-base);
  box-shadow: var(--highlight-top), var(--shadow-sm);
}

.nav { display: flex; gap: var(--space-1); }

.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--target-min);
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-weight: 500;
  text-decoration: none;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.nav-link:hover { color: var(--color-text-primary); background: var(--color-surface-sunken); }
.nav-link[aria-current="page"] { color: var(--color-accent-text); font-weight: 600; }
.nav-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: var(--space-3);
  right: var(--space-3);
  bottom: 2px;
  height: 2px;
  border-radius: var(--radius-full);
  background: var(--color-action-primary);
}

.nav-link svg, .icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--radius-full);
  background: var(--color-action-primary);
  color: var(--color-action-primary-text);
  font-size: var(--text-xs);
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-12);
  outline: none;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

.page-title {
  font-size: var(--text-3xl);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-subtitle { color: var(--color-text-secondary); margin-top: var(--space-1); }

.segmented {
  display: inline-flex;
  padding: var(--space-1);
  gap: var(--space-1);
  border-radius: var(--radius-lg);
  background: var(--color-surface-sunken);
}
.segmented a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-weight: 500;
  text-decoration: none;
}
.segmented a[aria-current="page"] {
  background: var(--color-surface-raised);
  color: var(--color-text-primary);
  font-weight: 600;
  box-shadow: var(--highlight-top), var(--shadow-sm);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: var(--space-8) var(--space-6);
  list-style: none;
  margin: 0;
  padding: 0;
}

.card { position: relative; }

.card-link {
  display: block;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-lg);
}

.card-cover {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--color-surface-sunken);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--duration-fast);
}
.card-cover img { width: 100%; height: 100%; object-fit: cover; }

.card:hover .card-cover, .card:focus-within .card-cover {
  box-shadow: var(--shadow-md);
}

.card-rank {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 1;
  display: grid;
  place-items: center;
  min-width: 32px;
  height: 32px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-md);
  background: var(--color-action-primary);
  color: var(--color-action-primary-text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--highlight-top), var(--shadow-md);
}

.card-title {
  margin-top: var(--space-3);
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta { color: var(--color-text-tertiary); font-size: var(--text-sm); margin-top: 2px; }

.preview {
  position: fixed;
  left: var(--preview-left, 16px);
  top: var(--preview-top, 16px);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  width: var(--preview-width, 400px);
  max-height: calc(100vh - 88px);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--color-surface-overlay);
  border: 1px solid var(--color-border-hairline);
  box-shadow: var(--highlight-top), var(--shadow-lg);
  animation: preview-in var(--duration-medium) var(--ease-enter);
}
@keyframes preview-in { from { opacity: 0; transform: translateY(4px); } }

.preview-head { display: flex; flex-direction: column; gap: var(--space-1); }
.preview-title { font-size: var(--text-xl); font-weight: 600; line-height: 1.3; }
.preview-meta { color: var(--color-text-secondary); font-size: var(--text-sm); }
.preview-owned { display: flex; align-items: center; gap: var(--space-1); color: var(--color-success-text); font-size: var(--text-sm); font-weight: 500; }
.preview-owned .icon { width: 16px; height: 16px; }
.preview-plot {
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.preview-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.preview-subtitle {
  margin-top: var(--space-2);
  color: var(--color-text-tertiary);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.preview-scroll {
  flex: 1 1 auto;
  min-height: 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
  margin: 0 calc(-1 * var(--space-3));
  border-radius: var(--radius-md);
}
.preview-chapters { list-style: none; margin: 0; padding: 0; }
.preview-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--target-min);
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  font-variant-numeric: tabular-nums;
}
.preview-row:hover { background: var(--color-surface-sunken); }
.preview-row .chapter-label { white-space: nowrap; }
.preview-row .chapter-date { margin-left: auto; white-space: nowrap; }
.preview-row .badge { white-space: nowrap; }
.preview-sentinel { height: 1px; }
.preview-action { display: inline-flex; width: var(--target-min); justify-content: center; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--color-accent-text);
  cursor: pointer;
  transition: background var(--duration-fast);
}
.icon-button:hover:not(:disabled) { background: var(--color-accent-tint); }
.icon-button:disabled { opacity: .5; cursor: not-allowed; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--target-min);
  padding: 0 var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--duration-fast), box-shadow var(--duration-fast);
}
.button:disabled { cursor: not-allowed; opacity: .5; box-shadow: none; }
.button:active:not(:disabled) { transform: scale(.98); }

.button-primary {
  background: var(--color-action-primary);
  color: var(--color-action-primary-text);
  box-shadow: var(--highlight-top), var(--shadow-sm);
}
.button-primary:hover:not(:disabled) { background: var(--color-action-primary-hover); box-shadow: var(--highlight-top), var(--shadow-md); }

.button-secondary {
  background: var(--color-surface-raised);
  color: var(--color-text-primary);
  border-color: var(--color-border-hairline);
  box-shadow: var(--highlight-top), var(--shadow-sm);
}
.button-secondary:hover:not(:disabled) { box-shadow: var(--highlight-top), var(--shadow-md); }

.button-link {
  min-height: var(--target-min);
  padding: 0 var(--space-2);
  background: none;
  color: var(--color-accent-text);
}
.button-link:hover { text-decoration: underline; }

.panel {
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border-hairline);
  border-radius: var(--radius-lg);
  box-shadow: var(--highlight-top), var(--shadow-sm);
  padding: var(--space-6);
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-12);
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
}

.search-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}
.field { display: flex; flex-direction: column; gap: var(--space-1); flex: 1 1 260px; max-width: 480px; }
.field-label { font-weight: 600; font-size: var(--text-sm); }
.field-hint { color: var(--color-text-tertiary); font-size: var(--text-sm); }
.input, .select {
  min-height: var(--target-min);
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border-input);
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  font-size: var(--text-base);
  box-shadow: inset 0 1px 2px hsl(30 30% 10% / .06);
}
.input[aria-invalid="true"] { border-color: var(--color-danger-text); }
.field-error { display: flex; gap: var(--space-1); align-items: center; color: var(--color-danger-text); font-size: var(--text-sm); }

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  max-width: 440px;
  margin: var(--space-12) auto;
  text-align: center;
  color: var(--color-text-secondary);
}
.state .icon { width: 40px; height: 40px; color: var(--color-text-tertiary); }
.state-title { color: var(--color-text-primary); font-size: var(--text-xl); font-weight: 600; }
.state-error .icon { color: var(--color-danger-text); }

.skeleton {
  border-radius: var(--radius-lg);
  background: var(--color-surface-sunken);
  animation: pulse 1.6s ease-in-out infinite;
}
.skeleton-cover { aspect-ratio: 2 / 3; }
.skeleton-line { height: 14px; margin-top: var(--space-3); width: 80%; border-radius: var(--radius-sm); }
@keyframes pulse { 50% { opacity: .55; } }

.detail {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: var(--space-8);
  align-items: start;
}
.detail-cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-lg);
  background: var(--color-surface-sunken);
  box-shadow: var(--shadow-md);
}
.detail-body { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.back-link { display: inline-flex; align-items: center; gap: var(--space-1); margin-bottom: var(--space-4); }
.badges { display: flex; flex-wrap: wrap; gap: var(--space-2); list-style: none; margin: 0; padding: 0; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--color-surface-sunken);
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  font-weight: 500;
}
.badge-accent { background: var(--color-accent-tint); color: var(--color-accent-text); }
.badge-success { background: var(--color-success-bg); color: var(--color-success-text); }
.badge-danger { background: var(--color-danger-bg); color: var(--color-danger-text); }
.badge-info { background: var(--color-info-bg); color: var(--color-info-text); }
.badge .icon { width: 14px; height: 14px; }
.plot { max-width: 70ch; color: var(--color-text-secondary); }
.authors { color: var(--color-text-secondary); font-size: var(--text-sm); }

.download-panel { display: flex; flex-direction: column; gap: var(--space-6); margin-top: var(--space-4); }
.download-panel h2, .section-title { font-size: var(--text-xl); font-weight: 600; line-height: 1.4; }
.download-actions { flex-wrap: wrap; }
.range-form { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-3); }
.range-form .field { flex: 1 1 180px; }

.chapters { margin-top: var(--space-12); }
.chapters-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
.volume {
  border-bottom: 1px solid var(--color-border-hairline);
}
.volume summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 52px;
  padding: 0 var(--space-2);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.volume summary::-webkit-details-marker { display: none; }
.volume summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform var(--duration-medium);
}
.volume[open] summary::after { transform: rotate(-135deg); }
.volume-count { color: var(--color-text-tertiary); font-weight: 400; font-size: var(--text-sm); margin-left: auto; margin-right: var(--space-4); }
.chapter-list { list-style: none; margin: 0 0 var(--space-4); padding: 0; }
.chapter-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--target-min);
  padding: 0 var(--space-2);
  border-radius: var(--radius-md);
  cursor: pointer;
}
.chapter-row:hover { background: var(--color-surface-sunken); }
.chapter-row input { width: 20px; height: 20px; accent-color: var(--color-action-primary); }
.chapter-label { flex: 1; font-variant-numeric: tabular-nums; }
.chapter-date { color: var(--color-text-tertiary); font-size: var(--text-sm); }

.selection-bar {
  position: sticky;
  bottom: var(--space-4);
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-6);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--color-surface-overlay);
  border: 1px solid var(--color-border-hairline);
  box-shadow: var(--highlight-top), var(--shadow-lg);
}

.job-list, .library-files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.job {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2) var(--space-4);
  align-items: center;
}
.job-title { font-weight: 600; }
.job-sub { color: var(--color-text-secondary); font-size: var(--text-sm); display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.job-actions { display: flex; gap: var(--space-2); }
.job progress { grid-column: 1 / -1; width: 100%; height: 6px; accent-color: var(--color-action-primary); }
.job-error { grid-column: 1 / -1; color: var(--color-danger-text); font-size: var(--text-sm); }

.library-manga + .library-manga { margin-top: var(--space-12); }
.library-manga h2 { margin-bottom: var(--space-4); }
.library-file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-3) var(--space-4);
}
.library-file-name { flex: 1 1 240px; font-weight: 500; }
.library-file-size { color: var(--color-text-tertiary); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }

.login { max-width: 400px; margin: var(--space-12) auto; display: flex; flex-direction: column; gap: var(--space-6); }
.login form { display: flex; flex-direction: column; gap: var(--space-4); }
.login .field { max-width: none; flex: none; }

.toasts {
  position: fixed;
  left: 50%;
  bottom: var(--space-6);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: min(480px, calc(100vw - 2 * var(--space-4)));
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--color-text-primary);
  color: var(--color-surface-page);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  animation: toast-in var(--duration-medium) var(--ease-enter);
}
.toast a { color: inherit; font-weight: 600; margin-left: auto; }
.toast-error { background: var(--color-danger-text); color: var(--color-surface-page); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 860px) {
  .detail { grid-template-columns: 1fr; }
  .detail-cover { max-width: 200px; }
}

@media (max-width: 639px) {
  .topbar {
    padding: 0 var(--space-4);
    background: var(--color-surface-page);
    backdrop-filter: none;
  }
  .main { padding: var(--space-6) var(--space-4) calc(var(--tabbar-height) + var(--space-12)); }
  .nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    justify-content: space-around;
    padding: var(--space-1) var(--space-2) max(var(--space-1), env(safe-area-inset-bottom));
    background: var(--color-surface-overlay);
    border-top: 1px solid var(--color-border-hairline);
  }
  .nav-link {
    flex-direction: column;
    gap: 2px;
    min-width: 64px;
    padding: var(--space-1);
    font-size: var(--text-xs);
  }
  .nav-link[aria-current="page"]::after { display: none; }
  .nav-badge { position: absolute; top: 0; right: 8px; }
  .page-title { font-size: 26px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6) var(--space-4); }
  .selection-bar { bottom: calc(var(--tabbar-height) + var(--space-3)); }
  .toasts { bottom: calc(var(--tabbar-height) + var(--space-4)); }
  .job { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.chapter-item { display: flex; align-items: center; gap: var(--space-1); }
.chapter-item > .chapter-row { flex: 1; min-width: 0; }

.reader { max-width: 900px; margin: 0 auto; }
.reader-header { display: grid; justify-items: start; gap: var(--space-2); margin-bottom: var(--space-6); }
.reader-pages { display: grid; gap: 0; background: var(--color-surface-sunken); border-radius: var(--radius-md); overflow: hidden; }
.reader-page { display: block; width: 100%; height: auto; min-height: 200px; background: var(--color-surface-sunken); }
.reader-nav { display: flex; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin: var(--space-8) 0; }
.reader-nav-spacer { flex: 1; }
.reader-end { display: grid; gap: var(--space-2); margin-top: var(--space-8); padding-bottom: var(--space-12); }
.reader-end .reader-nav { margin: var(--space-2) 0 0; }
.reader-auto { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); min-height: var(--target-min); color: var(--color-text-secondary); }
.reader-end-sentinel { height: 1px; }

.reader-counter {
  position: fixed;
  left: 50%;
  bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 20;
  display: grid;
  gap: var(--space-1);
  min-width: 160px;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  background: var(--color-overlay-scrim);
  color: var(--color-overlay-text);
  font-size: var(--text-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.reader-progress { display: block; height: 3px; border-radius: var(--radius-full); background: hsl(0 0% 100% / .25); overflow: hidden; }
.reader-progress-bar { display: block; height: 100%; width: 0; background: var(--color-action-primary); transition: width var(--duration-fast) var(--ease-enter); }
@media (prefers-reduced-motion: reduce) { .reader-progress-bar { transition: none; } }
@media (max-width: 639px) { .reader-counter { bottom: calc(var(--tabbar-height) + var(--space-3) + env(safe-area-inset-bottom)); } }
