/* Manhwa Today */

:root {
  --bg:         #13141e;
  --bg-card:    #1a1b2e;
  --bg-card2:   #22233a;
  --border:     #2d3050;
  --accent:     #598fbf;
  --accent-dk:  #3d6fa3;
  --text:       #e8e6e3;
  --text-muted: #9597aa;
  --text-dim:   #6b6e86;
  --green:      #2ecc71;
  --red:        #e74c3c;
  --yellow:     #f5c518;
  --radius:     6px;
  --shadow:     0 2px 12px rgba(0,0,0,.45);
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  touch-action: manipulation; /* prevent double-tap zoom on all devices */
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #fff; text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dk); }

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #0d0e1a;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  height: 54px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.navbar-spacer {
  flex: 1;
  display: flex;
  justify-content: flex-end;
}

.navbar-brand {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
}
.navbar-brand span { color: var(--accent); }

.navbar-search {
  width: 280px;
  position: relative;
}
.navbar-search input {
  width: 100%;
  padding: 7px 36px 7px 12px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .2s;
  box-sizing: border-box;
}
.navbar-search input:focus { border-color: var(--accent); }
.navbar-search button {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
}
.navbar-search button:hover { color: var(--accent); }

.navbar-links {
  display: flex;
  gap: 12px;
  font-size: 13px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
}
.navbar-links a { color: var(--text-muted); transition: color .15s; }
.navbar-links a:hover { color: #fff; text-decoration: none; }

/* ── Container ──────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 20px;
}

/* ── Section heading ─────────────────────────────────────────── */
.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #fff;
}
.section-heading::before {
  content: '';
  display: block;
  width: 14px;
  height: 28px;
  background: var(--accent);
  border-radius: 3px;
  flex-shrink: 0;
}

/* ── Homepage manga list ─────────────────────────────────────── */
.manga-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.manga-item {
  background: var(--bg-card);
  display: flex;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  transition: background .15s;
  position: relative;
}
.manga-item:hover { background: var(--bg-card2); }

.manga-item-cover {
  flex-shrink: 0;
  width: 108px;
  height: 148px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-card2);
  position: relative;
}
.manga-item-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .25s;
}
.manga-item:hover .manga-item-cover img { transform: scale(1.05); }

.manga-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.manga-item-title {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}

.manga-item-rating {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--yellow);
}
.manga-item-rating .score {
  color: var(--text-muted);
  font-size: 11px;
}


.manga-item-chapters {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 2px;
}
.chapter-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.chapter-pill {
  display: inline-flex;
  padding: 3px 10px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  color: var(--text);
  white-space: nowrap;
  text-decoration: none;
  transition: border-color .15s, color .15s;
}
.chapter-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.chapter-time {
  font-size: 11px;
  color: var(--text-dim);
}

/* Badge overlay on covers */
.badge {
  position: absolute;
  top: 5px;
  left: 5px;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  z-index: 1;
}
.badge-hot { background: #c0392b; color: #fff; }
.badge-completed { background: #27ae60; color: #fff; }
.badge-new { background: var(--accent); color: #fff; }

/* Cover placeholder */
.cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card2);
  color: var(--text-dim);
  font-size: 10px;
  text-align: center;
}

/* ── Loading / error ────────────────────────────────────────── */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-msg {
  background: #2a1315;
  border: 1px solid #5c2326;
  border-radius: var(--radius);
  padding: 16px;
  color: #e74c3c;
  font-size: 13px;
}

/* ── Manga detail breadcrumb ─────────────────────────────────── */
.manga-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.manga-breadcrumb a {
  color: var(--text-dim);
  text-decoration: none;
}
.manga-breadcrumb a:hover { color: var(--accent); }
.manga-breadcrumb span { color: var(--text); }

/* ── Manga detail page ──────────────────────────────────────── */
.manga-header {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  margin-bottom: 24px;
}
@media (max-width: 640px) {
  .manga-header { grid-template-columns: 140px 1fr; gap: 14px; }
}

.manga-cover {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 175 / 238;
  background: var(--bg-card2);
}
.manga-cover img { width: 100%; height: 100%; object-fit: cover; }

.manga-info h1 {
  font-size: 20px;
  margin: 0 0 10px;
  color: #fff;
  line-height: 1.3;
}
.meta-table {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}
.meta-label { color: var(--text-muted); white-space: nowrap; }
.meta-value { color: var(--text); }
.meta-value a { color: var(--text); }
.meta-value a:hover { color: var(--accent); text-decoration: none; }

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.status-ongoing { background: #1a4a6b; color: #5bc0eb; }
.status-completed { background: #1a4a29; color: #2ecc71; }

.rating-stars {
  color: var(--yellow);
  font-size: 15px;
  letter-spacing: 1px;
}

.action-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, transform .1s;
  border: none;
  text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dk); color: #fff; text-decoration: none; }
.btn-secondary {
  background: var(--bg-card2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.description-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-muted);
}
.description-box.collapsed {
  max-height: 100px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
  mask-image: linear-gradient(to bottom, black 60%, transparent 100%);
  cursor: pointer;
}
.description-box p { margin: 0 0 8px; }
.description-box p:last-child { margin-bottom: 0; }

/* ── Chapter list ───────────────────────────────────────────── */
.chapter-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.chapter-search {
  padding: 6px 10px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  outline: none;
  width: 180px;
  transition: border-color .2s;
}
.chapter-search:focus { border-color: var(--accent); }
.sort-btn {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.sort-btn:hover { border-color: var(--accent); color: var(--accent); }

.chapter-list {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 480px;
  overflow-y: auto;
}
.chapter-item {
  display: flex;
  align-items: center;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.chapter-item:last-child { border-bottom: none; }
.chapter-item:hover { background: var(--bg-card2); }
.chapter-item a {
  color: var(--text);
  font-size: 13px;
  flex: 1;
  transition: color .15s;
}
.chapter-item a:hover { color: var(--accent); text-decoration: none; }
.chapter-item .chapter-date {
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.chapter-item.ch-read {
  box-shadow: inset 3px 0 0 var(--accent);
}
.chapter-item.ch-read a {
  color: var(--text-dim);
}
.chapter-item.ch-read:hover a { color: var(--accent); }

/* ── Genre chips (clickable) ────────────────────────────────── */
.genre-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.genre-chip {
  display: inline-block;
  padding: 3px 10px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.genre-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

/* ── Chapter reader nav ──────────────────────────────────────── */
.ch-logo {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .3px;
  color: #fff;
  text-decoration: none;
}
.ch-logo:hover { color: #fff; text-decoration: none; }
.ch-logo span { color: var(--accent); }

.ch-manga-title {
  font-size: 11px;
  color: var(--text-dim);
  text-decoration: none;
  text-align: center;
  max-width: 580px;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 16px;
  box-sizing: border-box;
  transition: color .15s;
}
.ch-manga-title:hover { color: var(--accent); text-decoration: none; }

.ch-nav-row-spread { justify-content: space-between; }

.ch-back-link {
  font-size: 11px;
  color: var(--text-dim);
  text-decoration: none;
  margin-top: 2px;
  margin-bottom: calc(env(safe-area-inset-bottom, 0px) + 72px);
  display: block;
  transition: color .15s;
}
.ch-back-link:hover { color: var(--accent); }

.ch-nav {
  background: #0d0e1a;
  border-bottom: 1px solid var(--border);
  padding: 10px 16px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
}
.ch-nav-bottom {
  background: #0d0e1a;
  border-top: 1px solid var(--border);
  border-bottom: none;
  padding: 14px 16px;
  position: static;
}
.ch-brand {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .3px;
}
.ch-brand a { color: #fff; text-decoration: none; }
.ch-brand a:hover { text-decoration: none; color: #fff; }
.ch-brand span { color: var(--accent); }

.ch-nav-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 640px;
  justify-content: center;
}
.ch-title-link {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color .15s;
}
.ch-title-link:hover { color: var(--accent); text-decoration: none; }

.ch-select-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 100%;
  max-width: 420px;
}
.ch-current-title {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
}
.chapter-select {
  width: 100%;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 7px 10px;
  font-size: 12px;
  cursor: pointer;
  outline: none;
  transition: border-color .2s;
}
.chapter-select:focus { border-color: var(--accent); }

.nav-btn {
  padding: 7px 16px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background .15s, border-color .15s, color .15s;
}
.nav-btn:disabled { opacity: .3; cursor: not-allowed; }
.nav-prev { background: var(--bg-card2); color: var(--text); border: 1px solid var(--border); }
.nav-prev:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.nav-next { background: var(--accent); color: #fff; border: 1px solid transparent; }
.nav-next:hover:not(:disabled) { background: var(--accent-dk); }

/* ── Reading area ────────────────────────────────────────────── */
.reading-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #111;
  padding: 12px 0 20px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;  /* allow finger scroll, block pinch-zoom & double-tap-zoom */
}
.manga-page {
  width: 100%;
  max-width: 610px;
  display: block;
  margin: 0 auto;
  line-height: 0;
}
.manga-page img {
  width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
  -webkit-touch-callout: none;
  pointer-events: none;
}
.manga-page + .manga-page {
  margin-top: 0;
}
.manga-page.loading-page {
  min-height: 500px;
  background: var(--bg-card2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.4;
}
.manga-page.loading-page::before { content: 'Loading…'; }

/* ── Chapter nav: always fixed, slides away on scroll-down ───── */
#chapterNav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  transition: transform .2s ease-out;
  box-shadow: 0 2px 16px rgba(0,0,0,.45);
}
#chapterNav.ch-nav-hidden {
  transform: translateY(-110%);
}

/* ── Scroll-to-top button ─────────────────────────────────────── */
.scroll-top-btn {
  position: fixed;
  bottom: 28px;
  right: 20px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(80,90,140,0.75);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, background .15s;
}
.scroll-top-btn.visible {
  opacity: 1;
  pointer-events: auto;
}
.scroll-top-btn.visible:hover { background: var(--accent); }
.page-error {
  background: #1a0f0f;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--red);
  font-size: 12px;
  width: 100%;
}

/* ── Search results (reuses .manga-list grid from homepage) ──── */

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 20px 12px 4px;
}
.page-btn {
  padding: 6px 14px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.page-btn:disabled { opacity: .35; cursor: not-allowed; }
.page-btn:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }
.page-btn-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  cursor: default;
}
.page-dots {
  font-size: 13px;
  color: var(--text-dim);
  padding: 0 2px;
  user-select: none;
  align-self: center;
}

/* ── Duplicate warning card (admin only, manga detail page) ─── */
.dup-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(245, 197, 24, .06);
  border: 1px solid rgba(245, 197, 24, .25);
  border-radius: var(--radius);
  padding: 9px 12px;
  margin-bottom: 8px;
  font-size: 12px;
  flex-wrap: wrap;
}
.dup-card-label {
  color: var(--text-muted);
  white-space: nowrap;
}
.dup-card-link {
  color: var(--yellow);
  font-weight: 500;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dup-card-link:hover { color: #fff; }
.dup-card-ch {
  color: var(--text-dim);
  font-size: 11px;
  white-space: nowrap;
}
.dup-card-actions { display: flex; gap: 6px; margin-left: auto; }
.btn-dup-yes {
  background: transparent;
  color: var(--green);
  border: 1px solid rgba(46, 204, 113, .4);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-dup-yes:hover  { background: rgba(46, 204, 113, .12); border-color: var(--green); }
.btn-dup-yes:disabled { opacity: .4; cursor: not-allowed; }
.btn-dup-no {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.btn-dup-no:hover { color: var(--text-muted); border-color: #4a4d6a; }

/* ── Block button (manga detail page) ───────────────────────── */
.block-row {
  margin-bottom: 20px;
}
.btn-block {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
  font-size: 12px;
  padding: 6px 14px;
  opacity: .75;
  transition: background .15s, opacity .15s, color .15s;
}
.btn-block:hover {
  background: rgba(231, 76, 60, .12);
  opacity: 1;
  color: #ff6b6b;
  border-color: #ff6b6b;
  text-decoration: none;
}
.btn-block:disabled { opacity: .4; cursor: not-allowed; }

/* ── Blocklist page ──────────────────────────────────────────── */
.blocklist-grid {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}
.blocklist-item {
  background: var(--bg-card);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  transition: background .15s;
}
.blocklist-item:hover { background: var(--bg-card2); }
.blocklist-item-cover {
  flex-shrink: 0;
  width: 48px;
  height: 66px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-card2);
}
.blocklist-item-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.blocklist-item-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-whitelist {
  background: transparent;
  color: var(--green);
  border: 1px solid var(--green);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: var(--radius);
  flex-shrink: 0;
  cursor: pointer;
  opacity: .8;
  font-weight: 600;
  transition: background .15s, opacity .15s;
}
.btn-whitelist:hover {
  background: rgba(46, 204, 113, .12);
  opacity: 1;
}
.btn-whitelist:disabled { opacity: .35; cursor: not-allowed; }

/* ── Footer ─────────────────────────────────────────────────── */
footer {
  background: #0d0e1a;
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 20px;
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 40px;
}

footer a { color: var(--text-dim); }
footer a:hover { color: var(--accent); text-decoration: none; }

/* ── Empty state ────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
  font-size: 14px;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  .manga-list { grid-template-columns: 1fr; }
  .manga-header { grid-template-columns: 140px 1fr; gap: 14px; }
  .navbar { gap: 8px; }
}
@media (max-width: 640px) {
  .navbar-search {
    width: auto;
    display: flex;
    align-items: center;
    /* normal row: input LEFT, button RIGHT */
  }
  .navbar-search button {
    position: relative;
    z-index: 2;
    transform: none;
    flex-shrink: 0;
    background: #0d0e1a; /* matches navbar — covers input border when closed */
    transition: background .25s ease, color .15s;
  }
  .navbar-search.open button {
    background: var(--bg-card2); /* matches input — seamless when open */
  }
  .navbar-search input {
    max-width: 0;
    width: 210px;
    opacity: 0;
    padding: 0;
    border-width: 0;
    margin-right: 0;
    pointer-events: none;
    font-size: 16px; /* prevents iOS auto-zoom */
    box-sizing: border-box;
    transition: max-width .28s ease, opacity .22s ease, padding .28s ease, margin-right .28s ease;
  }
  .navbar-search.open input {
    max-width: 210px;
    opacity: 1;
    padding: 7px 34px 7px 12px; /* right gap for icon */
    margin-right: -32px;         /* input extends under the icon on the right */
    border-width: 1px;
    pointer-events: auto;
  }
}
@media (max-width: 480px) {
  .manga-item-cover { width: 88px; height: 120px; }
  .manga-item-title { font-size: 12px; }
  .manga-header { grid-template-columns: 120px 1fr; gap: 10px; }
  .manga-info h1 { font-size: 16px; }
  .chapter-nav { gap: 6px; }
  .chapter-title { font-size: 11px; }
}
@media (min-width: 900px) {
  .chapter-controls,
  .chapter-list { max-width: 760px; }
}
