﻿/* ============================================================
   NasaComics — Modern Manga Reader Stylesheet
   Clean, premium, high-readability UI.
   ============================================================ */

:root {
  /* Dark Theme (Default) */
  --bg:          #0b0c13;
  --surface:     #12131c;
  --surface-2:   #191b28;
  --surface-3:   #212435;
  --ink:         #f1f3fa;
  --ink-2:       #8e94a9;
  --ink-3:       #5e6377;
  --rule:        #23263a;
  --rule-light:  #1c1e2e;
  --accent:      #f59e0b;
  --accent-on:   #000000;
  --accent-soft: rgba(245, 158, 11, 0.12);
  --success:     #10b981;
  --success-soft:rgba(16, 185, 129, 0.12);
  --danger:      #ef4444;

  /* Sizing & Radius */
  --r-card:      10px;
  --r-button:    8px;
  --r-input:     8px;
  --r-pill:      999px;

  /* Typography */
  --font-main:   "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --font-mono:   "JetBrains Mono", monospace;
  --t-fast:      180ms ease-out;
  --container:   1200px;
}

[data-theme="light"] {
  --bg:          #f8f9fb;
  --surface:     #ffffff;
  --surface-2:   #f1f3f7;
  --surface-3:   #e4e7ef;
  --ink:         #0f172a;
  --ink-2:       #64748b;
  --ink-3:       #94a3b8;
  --rule:        #e2e8f0;
  --rule-light:  #edf2f7;
  --accent:      #d97706;
  --accent-on:   #ffffff;
  --accent-soft: rgba(217, 119, 6, 0.1);
  --success:     #059669;
  --success-soft:rgba(5, 150, 105, 0.1);
  --danger:      #dc2626;
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
[data-theme="light"] { color-scheme: light; }

body {
  font-family: var(--font-main);
  font-size: 0.9375rem;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img { max-width: 100%; display: block; }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Container */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

.section { padding-block: 28px; }

/* Navbar (Desktop) */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.navbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 20px;
  max-width: var(--container);
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.brand__logo { color: var(--ink); }
.brand__accent { color: var(--accent); }

.nav-links { display: flex; gap: 6px; align-items: center; }

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--r-button);
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 600;
  transition: all var(--t-fast);
}

.nav-link:hover { color: var(--ink); background: var(--surface-2); }
.nav-link.is-active { color: var(--accent); background: var(--accent-soft); }
.nav-link svg { width: 16px; height: 16px; }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-button);
  color: var(--ink-2);
  border: 1px solid var(--rule);
  background: var(--surface);
  transition: all var(--t-fast);
}

.theme-toggle:hover { color: var(--ink); border-color: var(--accent); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }

/* Bottom Navigation (Mobile) */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  background: var(--surface);
  border-top: 1px solid var(--rule);
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  justify-content: space-around;
  align-items: center;
}

.bottom-nav__item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 16px;
  border-radius: var(--r-button);
  color: var(--ink-2);
  font-size: 0.6875rem;
  font-weight: 600;
}

.bottom-nav__item svg { width: 20px; height: 20px; }
.bottom-nav__item.is-active { color: var(--accent); }

/* Page Header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-header__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.count-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  color: var(--ink-2);
}

.page-header__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* View Toggle Buttons */
.view-toggle {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-button);
  padding: 2px;
}

.view-toggle__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--ink-3);
  transition: all var(--t-fast);
}

.view-toggle__btn:hover { color: var(--ink); }
.view-toggle__btn.is-active { background: var(--surface-2); color: var(--accent); }
.view-toggle__btn svg { width: 16px; height: 16px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--r-button);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1;
  min-height: 38px;
  transition: all var(--t-fast);
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn:active { transform: scale(0.98); }

.btn--primary {
  background: var(--accent);
  color: var(--accent-on);
  font-weight: 700;
}
.btn--primary:hover { filter: brightness(1.1); }

.btn--secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--rule);
}
.btn--secondary:hover { background: var(--surface-2); border-color: var(--ink-3); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

/* Filter & Search Bar */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-box__input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 38px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--r-input);
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color var(--t-fast);
}

.search-box__input::placeholder { color: var(--ink-3); }
.search-box__input:focus { border-color: var(--accent); outline: none; }

.search-box__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.filter-group {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.filter-label {
  font-size: 0.8125rem;
  color: var(--ink-2);
  font-weight: 600;
}

.select {
  height: 40px;
  padding: 0 32px 0 12px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--r-input);
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 500;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%238e94a9%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22m6 9 6 6 6-6%22/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  transition: border-color var(--t-fast);
}

.select:focus { border-color: var(--accent); outline: none; }
/* ---------- Manga Grid (Grid View) ---------- */
.manga-grid[data-view="grid"] {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 20px 16px;
}

.manga-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  overflow: hidden;
  transition: transform var(--t-fast), border-color var(--t-fast);
  color: inherit;
  text-decoration: none;
}

.manga-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.manga-card__cover-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4.2;
  overflow: hidden;
  background: var(--surface-2);
}

.manga-card__cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 500ms cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.manga-card:hover .manga-card__cover {
  transform: scale(1.06);
}

.manga-card__cover-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(0, 0, 0, 0.5) 100%);
  opacity: 0;
  transition: opacity 300ms ease-out;
  pointer-events: none;
}

.manga-card:hover .manga-card__cover-wrap::after {
  opacity: 1;
}

.manga-card__badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}

.manga-card__new {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 3px 7px;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #000;
  background: var(--accent);
  border-radius: 3px;
  box-shadow: 0 0 0 0 var(--accent);
  animation: new-pulse 1.8s ease-out infinite;
}

@keyframes new-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55); }
  70%  { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.manga-card__progress {
  position: relative;
  height: 3px;
  background: var(--rule);
  overflow: hidden;
}

.manga-card__progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 350ms cubic-bezier(0.16, 1, 0.3, 1);
}

.manga-card.is-new .manga-card__cover {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

.manga-card__body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.manga-card__title {
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.manga-card__meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--ink-2);
}

.manga-card__chapters {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink-2);
}

/* ---------- Manga List (List View) ---------- */
.manga-grid[data-view="list"] {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.manga-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  color: inherit;
  text-decoration: none;
  transition: all var(--t-fast);
}

.manga-row:hover {
  background: var(--surface-2);
  border-color: var(--rule-light);
  transform: translateX(3px);
}

.manga-row:hover .manga-row__arrow {
  color: var(--accent);
  transform: translateX(2px);
}

.manga-row__cover {
  width: 44px;
  height: 60px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--surface-2);
}

.manga-row__info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.manga-row__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.manga-row__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--ink-2);
}

.manga-row__right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.manga-row__chapters {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--ink-2);
}

.manga-row__arrow {
  color: var(--ink-3);
  width: 16px;
  height: 16px;
  transition: all var(--t-fast);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge--ongoing {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge--completed {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

/* Genre Tag */
.genre-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  color: var(--ink-2);
}

/* ---------- Manga Detail Hero ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 20px;
  transition: color var(--t-fast);
}
.back-link:hover { color: var(--accent); }

.manga-hero {
  display: flex;
  gap: 28px;
  margin-bottom: 36px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
  padding: 24px;
}

.manga-hero__cover-wrap {
  width: 190px;
  flex-shrink: 0;
}

.manga-hero__cover {
  width: 100%;
  aspect-ratio: 3 / 4.2;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-2);
}

.manga-hero__body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.manga-hero__title {
  font-size: 1.625rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.manga-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-pill);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ink-2);
}

.meta-pill strong { color: var(--ink); }

.manga-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.manga-synopsis {
  color: var(--ink-2);
  line-height: 1.6;
  font-size: 0.875rem;
  max-height: 140px;
  overflow-y: auto;
  padding-right: 8px;
}

.manga-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 8px;
}

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface-2);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.2s ease;
}

.progress-status {
  font-size: 0.8125rem;
  color: var(--ink-2);
  margin-top: 6px;
}

/* ---------- Chapter Section ---------- */
.chapters-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chapters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.chapters-header h2 {
  font-size: 1.125rem;
  font-weight: 700;
}

.chapter-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.chapter-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  transition: all var(--t-fast);
}

.chapter-item:hover {
  background: var(--surface-2);
  border-color: var(--rule-light);
  transform: translateY(-1px);
}

.chapter-item:hover .chapter-item__arrow {
  color: var(--accent);
  transform: translateX(2px);
}

.chapter-item__badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 4px;
  flex-shrink: 0;
}

.chapter-item__title {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chapter-item__right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.chapter-item__status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--success);
  background: var(--success-soft);
  padding: 2px 6px;
  border-radius: 4px;
}

.chapter-item__status svg { width: 12px; height: 12px; }

.chapter-item__arrow {
  color: var(--ink-3);
  width: 14px;
  height: 14px;
  transition: all var(--t-fast);
}

/* ---------- States (Loading / Empty) ---------- */
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  gap: 12px;
  background: var(--surface);
  border: 1px dashed var(--rule);
  border-radius: var(--r-card);
}

.state__icon { color: var(--ink-3); margin-bottom: 4px; }
.state__title { font-size: 1.125rem; font-weight: 700; }
.state__desc { font-size: 0.875rem; color: var(--ink-2); max-width: 420px; }
.state__action { margin-top: 8px; }
.state--inline { padding: 40px; border: 0; background: transparent; }

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--rule);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--surface);
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 10px 18px;
  border-radius: var(--r-button);
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  z-index: 200;
  opacity: 0;
  transition: all var(--t-fast);
  pointer-events: none;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast--success { border-color: var(--success); }
.toast--error { border-color: var(--danger); }

/* ---------- Reader Page ---------- */
body.reader-page { background: #000; color: #fff; }

body.reader-page .top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 12, 0.95);
  border-bottom: 1px solid #222;
}

.top-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  max-width: 900px;
  margin: 0 auto;
}

.top-bar__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #aaa;
  font-size: 0.875rem;
  font-weight: 600;
}
.top-bar__link:hover { color: #fff; }

.top-bar__title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-bar__btn {
  background: #1e1e24;
  color: #eee;
  border: 1px solid #333;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

#pages {
  max-width: 860px;
  margin: 0 auto;
  padding: 10px 0 100px;
}

#pages img {
  width: 100%;
  margin-bottom: 4px;
  cursor: pointer;
  background: #0d0d11;
}

.reader-nav {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 100;
  background: rgba(15, 15, 20, 0.9);
  border: 1px solid #333;
  padding: 6px;
  border-radius: var(--r-pill);
}

.reader-nav__btn {
  background: var(--accent);
  color: var(--accent-on);
  font-weight: 700;
  font-size: 0.8125rem;
  padding: 8px 18px;
  border-radius: var(--r-pill);
}
.reader-nav__btn[disabled] { background: #222; color: #666; cursor: not-allowed; }

.page-ind {
  position: fixed;
  bottom: 74px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.8);
  color: #aaa;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid #333;
  z-index: 99;
}

/* ---------- Responsive ---------- */
@media (max-width: 1023px) {
  .navbar { display: none; }
  .bottom-nav { display: flex; }
  body:not(.reader-page) { padding-bottom: 70px; }
  .chapter-list { grid-template-columns: 1fr; }
}

@media (max-width: 639px) {
  .section { padding-block: 16px; }
  .page-header { flex-direction: column; align-items: stretch; gap: 12px; }
  .page-header__left { justify-content: space-between; }
  .page-header__right { justify-content: space-between; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  
  .manga-grid[data-view="grid"] {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 10px;
  }
  
  .manga-hero {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px;
    gap: 16px;
  }
  
  .manga-hero__cover-wrap { width: 140px; }
  .manga-meta { justify-content: center; }
  .manga-genres { justify-content: center; }
  .manga-actions { justify-content: center; }
  
  .manga-row__meta { display: none; }
  .manga-row { padding: 8px 10px; gap: 10px; }
  .manga-row__cover { width: 36px; height: 50px; }
}

/* ---------- Reader UI Auto-Hide ---------- */
.top-bar, .reader-nav, .page-ind {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease !important;
}

body.ui-hidden .top-bar {
  transform: translateY(-100%) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.ui-hidden .reader-nav {
  transform: translate(-50%, 80px) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

body.ui-hidden .page-ind {
  transform: translate(-50%, 80px) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}


/* === Continue Reading ============================================ */
.continue-section {
  margin-bottom: 24px;
}
.section-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 0;
}
.continue-section__head,
.genre-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}
.continue-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 180px;
  gap: 14px;
  overflow-x: auto;
  padding: 4px 2px 14px 2px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.continue-row::-webkit-scrollbar { height: 6px; }
.continue-row::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }

.continue-card {
  position: relative;
  display: block;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--rule);
  scroll-snap-align: start;
  text-decoration: none;
  color: inherit;
  transition: border-color 150ms ease-out, transform 150ms ease-out;
}
.continue-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.continue-card__cover {
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: var(--surface-2);
}
.continue-card__body {
  padding: 10px 12px 12px 12px;
}
.continue-card__title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 6px 0;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.continue-card__chapter {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 11px;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.continue-card__progress {
  height: 3px;
  background: var(--rule);
  border-radius: 2px;
  overflow: hidden;
}
.continue-card__progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 200ms ease-out;
}

/* === Genre Filter ================================================ */
.genre-section {
  margin-bottom: 20px;
}
.genre-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.genre-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
  transition: color 150ms ease-out, background 150ms ease-out, border-color 150ms ease-out;
  font-family: inherit;
}
.genre-chip:hover {
  color: var(--ink);
  border-color: var(--ink-2);
}
.genre-chip.is-active {
  color: var(--bg);
  background: var(--accent);
  border-color: var(--accent);
}
.btn-link {
  background: none;
  border: none;
  color: var(--ink-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 6px;
  transition: color 150ms ease-out;
}
.btn-link:hover {
  color: var(--accent);
}
.btn-link:disabled {
  opacity: 0.4;
  cursor: default;
}

@media (max-width: 640px) {
  .continue-row {
    grid-auto-columns: 140px;
    gap: 10px;
  }
}


/* === Skeleton Loading (shimmer) ================================ */
@keyframes skeleton-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-2) 0%,
    var(--surface-3) 50%,
    var(--surface-2) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
  border-radius: 4px;
}

.skeleton-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.skeleton-card__cover {
  aspect-ratio: 3 / 4.2;
  border-radius: var(--r-card);
}

.skeleton-card__line {
  height: 12px;
  width: 80%;
}
.skeleton-card__line--short { width: 50%; height: 10px; }

.skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r-card);
}
.skeleton-row__cover {
  width: 40px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 4px;
}
.skeleton-row__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.skeleton-row__line {
  height: 11px;
  width: 70%;
}
.skeleton-row__line--short { width: 40%; height: 9px; }

.skeleton-chapter {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--rule);
}
.skeleton-chapter__badge {
  width: 64px;
  height: 22px;
  border-radius: 4px;
}
.skeleton-chapter__line {
  flex: 1;
  height: 12px;
}


