/* Ko-Stream — local library UI */
:root {
  --bg: #0c0e17;
  --bg-deep: #070810;
  --bg-card: #141824;
  --bg-elevated: #1a2030;
  --accent: #ffd369;
  --accent-hover: #ffe08a;
  --accent-muted: #c9a84a;
  --accent-glow: rgba(255, 211, 105, 0.25);
  --purple: #6c5ce7;
  --purple-dark: #3d3566;
  --text: #f5f6fa;
  --muted: #9aa3b5;
  --border: #252b3d;
  --gold: #ffd369;
  --hd: #6ee7b7;
  --danger: #f87171;
  --header-bg: rgba(7, 8, 16, 0.92);
  --spotlight-shade: rgba(7, 8, 16, 0.97);
  --radius: 10px;
  --radius-lg: 14px;
  --header-h: 64px;
  --page-max: 1040px;
  --page-pad: clamp(0.75rem, 2.5vw, 1.25rem);
  --scrollbar-track: var(--bg-deep);
  --scrollbar-thumb: #2a3348;
  --scrollbar-thumb-hover: #3d4a66;
}

[data-theme="pink-light"],
[data-theme="red-light"] {
  --bg: #fdf6f9;
  --bg-deep: #f8e8ef;
  --bg-card: #ffffff;
  --bg-elevated: #faf0f5;
  --accent: #db2777;
  --accent-hover: #be185d;
  --accent-muted: #9d174d;
  --accent-glow: rgba(219, 39, 119, 0.18);
  --text: #1c1418;
  --muted: #6b5660;
  --border: #ebd0dc;
  --gold: #db2777;
  --hd: #1e8449;
  --danger: #b91c1c;
  --header-bg: rgba(255, 250, 253, 0.92);
  --spotlight-shade: rgba(20, 12, 18, 0.86);
  --scrollbar-track: var(--bg-deep);
  --scrollbar-thumb: #d4a8bc;
  --scrollbar-thumb-hover: #b889a0;
}

[data-theme="blue-green"] {
  --bg: #0a1520;
  --bg-deep: #061018;
  --bg-card: #102233;
  --bg-elevated: #163047;
  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --accent-muted: #14b8a6;
  --accent-glow: rgba(45, 212, 191, 0.22);
  --text: #e8f4f8;
  --muted: #8ab0c4;
  --border: #1e3a4f;
  --gold: #38bdf8;
  --hd: #4ade80;
  --danger: #fb7185;
  --header-bg: rgba(6, 16, 24, 0.92);
  --spotlight-shade: rgba(6, 16, 24, 0.95);
  --scrollbar-track: var(--bg-deep);
  --scrollbar-thumb: #23445c;
  --scrollbar-thumb-hover: #2f5a78;
}

* { box-sizing: border-box; }

* {
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

*::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 999px;
  border: 2px solid var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

*::-webkit-scrollbar-corner {
  background: var(--scrollbar-track);
}

*::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}
html { scroll-behavior: smooth; overflow-x: hidden; scroll-padding-top: var(--header-h); }

body {
  margin: 0;
  font-family: "Nunito", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.site-header {
  /* Fixed so scroll-lock overflow:hidden cannot unstick the bar (sticky left a gap). */
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  width: 100%;
  overflow: visible;
}

.skip-link {
  position: absolute;
  left: var(--page-pad);
  top: 0.5rem;
  z-index: 400;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--bg-deep);
  font-weight: 800;
  transform: translateY(-160%);
  transition: transform 0.15s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--accent-hover);
  outline-offset: 2px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.nav-link:focus-visible,
.nav-dropdown-link:focus-visible,
.header-user-menu-link:focus-visible,
.manga-tab:focus-visible,
.lang-switch-btn:focus-visible,
.theme-scheme-btn:focus-visible,
.anime-card:focus-visible,
.browse-tile:focus-visible,
.manga-card-open:focus-visible,
.btn-watch:focus-visible,
.btn-detail:focus-visible,
.btn-browse:focus-visible,
.btn-browse-secondary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.header-inner {
  position: relative;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--page-pad);
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: nowrap;
  overflow: visible;
}

.menu-toggle,
.search-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.35rem;
  cursor: pointer;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border-radius: 8px;
}

.search-toggle:hover,
.menu-toggle:hover {
  background: rgba(255, 211, 105, 0.08);
  color: var(--accent);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.05rem;
  font-weight: 800;
  font-size: 1.45rem;
  flex-shrink: 0;
}

.logo-mark {
  width: 3.15rem;
  height: 3.15rem;
  border-radius: 10px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
  /* PNG has aura padding — slight scale so the KO rectangle reads larger */
  transform: scale(1.12);
  transform-origin: center;
}

.logo-stream {
  display: inline-block;
  color: #12100c;
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 800;
  white-space: nowrap;
  line-height: 1;
  letter-spacing: 0.01em;
  margin-left: 0.2rem;
  -webkit-text-stroke: 1.65px var(--accent);
  paint-order: stroke fill;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: 0.25rem;
  flex-shrink: 0;
}

.nav-link {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--accent);
  background: rgba(255, 211, 105, 0.08);
}

.nav-dropdown {
  position: relative;
  flex-shrink: 0;
}

.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  line-height: inherit;
}

.nav-caret {
  width: 0.35rem;
  height: 0.35rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  opacity: 0.75;
  transition: transform 0.15s ease;
}

.nav-dropdown.is-open .nav-caret {
  transform: rotate(225deg) translateY(-1px);
}

.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  min-width: 8.5rem;
  padding: 0.3rem;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  z-index: 230;
}

.nav-dropdown.is-open .nav-dropdown-menu {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.nav-dropdown-link {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  white-space: nowrap;
}

.nav-dropdown-link:hover,
.nav-dropdown-link.is-active {
  color: var(--accent);
  background: rgba(255, 211, 105, 0.08);
}

.search-form {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 280px;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
}

.search-icon { color: var(--muted); font-size: 1.1rem; }

.search-form input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
}

.btn-header-login {
  background: var(--accent);
  color: #1a1200;
  font-weight: 800;
  font-size: 0.88rem;
  padding: 0.5rem 1.1rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.btn-header-login:hover { background: var(--accent-hover); }

.lang-switch {
  display: inline-flex;
  align-items: stretch;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}

.lang-switch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-decoration: none;
  line-height: 1;
}

.lang-switch-btn:hover {
  color: var(--accent);
  background: rgba(255, 211, 105, 0.08);
}

.lang-switch-btn.is-active {
  color: #1a1200;
  background: var(--accent);
}

.lang-switch-btn + .lang-switch-btn {
  border-left: 1px solid var(--border);
}

.lang-switch-btn.is-active + .lang-switch-btn,
.lang-switch-btn + .lang-switch-btn.is-active {
  border-left-color: transparent;
}

.header-account {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  flex-shrink: 0;
  position: relative;
}

.header-notifications {
  position: relative;
  flex-shrink: 0;
}

.header-notify-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}

.header-notify-toggle:hover,
.header-notifications.is-open .header-notify-toggle {
  color: var(--accent);
  background: rgba(255, 211, 105, 0.08);
}

.header-notify-icon {
  display: block;
}

.header-notify-badge {
  position: absolute;
  top: 0.2rem;
  right: 0.15rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: var(--accent);
  color: #1a1200;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1rem;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg-deep);
}

.header-notify-tray {
  display: none;
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  width: min(22rem, calc(100vw - 1.5rem));
  max-height: min(24rem, calc(100vh - var(--header-h) - 1.5rem));
  overflow: hidden;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  z-index: 240;
  flex-direction: column;
}

.header-notifications.is-open .header-notify-tray {
  display: flex;
}

.header-notify-tray-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.header-notify-tray-title {
  color: var(--text);
  font-weight: 800;
  font-size: 0.88rem;
}

.header-notify-mark-all {
  background: none;
  border: none;
  color: var(--accent-muted);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0.15rem 0.25rem;
  border-radius: 4px;
}

.header-notify-mark-all:hover {
  color: var(--accent);
}

.header-notify-list {
  overflow-y: auto;
  max-height: min(20rem, calc(100vh - var(--header-h) - 4.5rem));
  padding: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.header-notify-empty {
  margin: 0;
  padding: 1.1rem 0.85rem;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: center;
}

.header-notify-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  border-left: 3px solid transparent;
}

a.header-notify-item:hover {
  color: var(--text);
  background: rgba(255, 211, 105, 0.08);
}

.header-notify-item.is-unread {
  border-left-color: var(--accent);
  background: rgba(255, 211, 105, 0.05);
}

.header-notify-item-title {
  color: var(--text);
  font-weight: 700;
  font-size: 0.86rem;
}

.header-notify-item-body {
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--muted);
}

.header-notify-item-time {
  font-size: 0.7rem;
  color: var(--accent-muted);
  margin-top: 0.1rem;
}

.header-user-menu {
  position: relative;
  flex-shrink: 0;
}

.header-user-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 10rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.4rem 0.55rem;
  border-radius: 8px;
  line-height: inherit;
}

.header-user-toggle:hover,
.header-user-menu.is-open .header-user-toggle {
  color: var(--accent);
  background: rgba(255, 211, 105, 0.08);
}

.header-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-user-menu.is-open .nav-caret {
  transform: rotate(225deg) translateY(-1px);
}

.header-user-menu-panel {
  display: none;
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 9.5rem;
  padding: 0.3rem;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  z-index: 230;
}

.header-user-menu.is-open .header-user-menu-panel {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.header-user-menu-link {
  display: block;
  width: 100%;
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.88rem;
  font-family: inherit;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  white-space: nowrap;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  line-height: inherit;
}

.header-user-menu-link:hover,
.header-user-menu-link.is-active {
  color: var(--accent);
  background: rgba(255, 211, 105, 0.08);
}

.header-logout-form {
  margin: 0;
  display: block;
}

@media (max-width: 1050px) {
  .menu-toggle { display: inline-flex; }
  .header-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg-deep);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem var(--page-pad);
    margin-left: 0;
    /* Above manga-overview (90) while remaining inside header stacking (200). */
    z-index: 220;
  }
  .header-nav.open { display: flex; }
  .header-nav .nav-link {
    border-radius: 8px;
  }
  .nav-dropdown {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
  .nav-dropdown-toggle {
    width: 100%;
    justify-content: space-between;
  }
  .nav-dropdown-menu {
    position: static;
    min-width: 0;
    margin: 0.15rem 0 0.25rem;
    padding: 0.15rem 0 0.15rem 0.75rem;
    background: transparent;
    border: none;
    border-left: 2px solid var(--border);
    border-radius: 0;
    box-shadow: none;
  }
  .nav-dropdown-link {
    padding: 0.4rem 0.7rem;
  }
  .search-form {
    flex: 1 1 auto;
    min-width: 0;
    max-width: none;
    margin-left: auto;
  }
}

@media (max-width: 900px) {
  /* Keep a single-row header so --header-h stays accurate for overlays. */
  .header-inner {
    flex-wrap: nowrap;
    min-height: var(--header-h);
    gap: 0.45rem;
  }
  .search-toggle {
    display: inline-flex;
    margin-left: auto;
  }
  .search-form {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 221;
    margin: 0;
    max-width: none;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    padding: 0.65rem var(--page-pad);
    background: var(--bg-deep);
  }
  .search-form.is-open {
    display: flex;
  }
  .btn-header-login {
    margin-left: 0;
    padding: 0.45rem 0.85rem;
    font-size: 0.8rem;
  }
  .lang-switch-btn {
    min-width: 1.9rem;
    padding: 0.3rem 0.45rem;
    font-size: 0.68rem;
  }
  .header-notify-toggle {
    width: 2.15rem;
    height: 2.15rem;
  }
  .header-notify-tray {
    right: -2.5rem;
    width: min(20rem, calc(100vw - 1rem));
  }
  .header-user-toggle {
    max-width: 7.5rem;
    padding: 0.35rem 0.45rem;
    font-size: 0.82rem;
  }
  .logo { font-size: 1.2rem; }
  .logo-mark {
    width: 2.75rem;
    height: 2.75rem;
    transform: scale(1.08);
  }
}

@media (max-width: 420px) {
  .header-notify-tray {
    position: fixed;
    top: var(--header-h);
    left: 0.5rem;
    right: 0.5rem;
    width: auto;
  }
  /* Keep full brand; shrink chrome instead of hiding "-stream". */
  .logo { font-size: 1.05rem; gap: 0.05rem; }
  .logo-mark {
    width: 2.45rem;
    height: 2.45rem;
    transform: scale(1.06);
  }
  .menu-toggle,
  .search-toggle {
    width: 2.15rem;
    height: 2.15rem;
    font-size: 1.2rem;
  }
  .btn-header-login {
    padding: 0.45rem 0.65rem;
    font-size: 0.75rem;
  }
  .header-user-toggle {
    max-width: 6rem;
    font-size: 0.78rem;
  }
}

.site-main {
  min-height: 70vh;
  padding-top: var(--header-h);
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

.spotlight-section {
  position: relative;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--page-pad) 0.5rem;
}

.spotlight-carousel {
  position: relative;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0;
  border-radius: var(--radius-lg);
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  min-height: 420px;
  background: var(--bg-card);
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.spotlight-carousel::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.spotlight-slide {
  position: relative;
  flex: 0 0 100%;
  width: 100%;
  min-width: 100%;
  min-height: 420px;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}

.spotlight-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 20%;
}
/* Portrait/poster fallback: soft blur so upscales look intentional (same as detail). */
.spotlight-bg--poster::before {
  content: "";
  position: absolute;
  inset: -24px;
  background-image: inherit;
  background-size: cover;
  background-position: center;
  filter: blur(32px) saturate(1.05);
  transform: scale(1.12);
  z-index: 0;
  pointer-events: none;
}
.spotlight-bg--poster {
  background-size: cover;
  background-position: center top;
  overflow: hidden;
}

.spotlight-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, var(--spotlight-shade) 0%, color-mix(in srgb, var(--spotlight-shade) 75%, transparent) 45%, color-mix(in srgb, var(--spotlight-shade) 35%, transparent) 100%),
    linear-gradient(0deg, color-mix(in srgb, var(--spotlight-shade) 90%, transparent) 0%, transparent 50%);
}

.spotlight-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) min(180px, 28vw);
  gap: clamp(1rem, 3vw, 2rem);
  align-items: end;
  min-height: 420px;
  padding: clamp(1.25rem, 3vw, 2.5rem) clamp(1rem, 3vw, 2rem) clamp(1rem, 2vw, 2rem);
}

.spotlight-content {
  min-width: 0;
}

@media (max-width: 900px) {
  .spotlight-layout {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 0.85rem;
    min-height: 260px;
    align-items: center;
    padding: 1rem 0.9rem 1.1rem;
  }
  .spotlight-poster {
    display: block;
    width: 96px;
    max-width: 96px;
    grid-column: 1;
    grid-row: 1;
  }
  .spotlight-content {
    grid-column: 2;
    grid-row: 1;
  }
  .spotlight-poster-img {
    width: 96px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  }
  .spotlight-carousel { min-height: 260px; }
  .spotlight-slide { min-height: 260px; }
  .spotlight-content h1 { font-size: 1.2rem; margin: 0.25rem 0 0.45rem; }
  .spotlight-desc { -webkit-line-clamp: 2; font-size: 0.8rem; margin-top: 0.4rem; }
  .spotlight-shade {
    background:
      linear-gradient(90deg, color-mix(in srgb, var(--spotlight-shade) 78%, transparent) 0%, color-mix(in srgb, var(--spotlight-shade) 35%, transparent) 55%, transparent 100%),
      linear-gradient(0deg, color-mix(in srgb, var(--spotlight-shade) 55%, transparent) 0%, transparent 55%);
  }
  .spotlight-bg {
    background-position: center 25%;
    background-size: cover;
    filter: saturate(1.05);
  }
}

@media (max-width: 768px) {
  .spotlight-layout { min-height: 240px; }
  .spotlight-carousel { min-height: 240px; }
  .spotlight-slide { min-height: 240px; }
}

.spotlight-rank {
  color: var(--accent);
  font-weight: 800;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.spotlight-content h1 {
  font-size: clamp(1.25rem, 2.5vw, 2rem);
  font-weight: 800;
  margin: 0.4rem 0 0.75rem;
  line-height: 1.2;
  max-width: 100%;
  word-wrap: break-word;
}

.spotlight-desc {
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 100%;
  margin: 0.75rem 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Force readable light text on image heroes (all themes). */
.spotlight-content,
.spotlight-content h1 {
  color: #f5f6fa;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}
.spotlight-desc {
  color: rgba(245, 246, 250, 0.88);
}
.spotlight-content .tag,
.spotlight-content .tag-icon,
.spotlight-content .tag.genre,
.spotlight-content .tag.studio,
.spotlight-content .tag.tag-year {
  color: rgba(245, 246, 250, 0.92);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.28);
}
.spotlight-rank {
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.detail-info,
.detail-info h1 {
  color: #f5f6fa;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}
.detail-desc,
.detail-info .show-progress-label,
.detail-info .synopsis-text,
.detail-info .synopsis-toggle {
  color: rgba(245, 246, 250, 0.88);
}
.detail-info .tag,
.detail-info .tag-icon,
.detail-info .tag.genre,
.detail-info .tag.studio,
.detail-info .tag.tag-year {
  color: rgba(245, 246, 250, 0.92);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.28);
}
.detail-banner-shade {
  background: linear-gradient(
    0deg,
    var(--bg) 0%,
    rgba(12, 14, 23, 0.88) 42%,
    rgba(12, 14, 23, 0.62) 100%
  );
}


.meta-tags { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 0.5rem; }
.meta-tags-genres { margin-top: 0.35rem; }

.tag {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--muted);
}

.tag-icon { color: var(--text); }
.tag-hd { color: var(--hd); border-color: rgba(110, 231, 183, 0.35); }
.tag.genre { color: var(--accent-muted); }
.tag.studio { color: var(--text); border-color: rgba(255, 255, 255, 0.14); }
.tag.tag-year { color: var(--text); border-color: rgba(255, 255, 255, 0.12); }

.manga-overview-tags { margin-top: 0.35rem; margin-bottom: 0.5rem; }

.spotlight-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.25rem; }

.btn-watch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--accent);
  color: #1a1200;
  padding: 0.65rem 1.5rem;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.95rem;
}

.btn-watch:hover { background: var(--accent-hover); box-shadow: 0 8px 24px var(--accent-glow); }

.btn-detail {
  display: inline-flex;
  align-items: center;
  background: var(--purple-dark);
  border: 1px solid rgba(108, 92, 231, 0.4);
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  color: var(--text);
  font-weight: 700;
}

.btn-detail:hover { background: var(--purple); }

.mal-list-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  margin-top: 0.85rem;
}

.mal-list-status-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mal-list-status-select {
  min-width: 11rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

.mal-list-status-select:focus {
  outline: none;
  border-color: var(--accent-muted);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.mal-list-status-select:disabled {
  opacity: 0.65;
  cursor: wait;
}

.mal-list-status-hint,
.mal-list-status-msg {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.mal-list-status-msg.is-error {
  color: var(--danger);
}

.mal-user-score {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-top: 0.85rem;
  max-width: 22rem;
}

.mal-score-stars {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
}

.mal-score-star {
  appearance: none;
  border: 0;
  background: transparent;
  color: color-mix(in srgb, var(--text) 28%, transparent);
  font-size: 1.35rem;
  line-height: 1;
  padding: 0.1rem 0.12rem;
  cursor: pointer;
  transition: color 0.12s ease, transform 0.12s ease;
}

.mal-score-star.is-active,
.mal-score-star.is-preview {
  color: var(--accent);
}

.mal-score-star:hover,
.mal-score-star:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.mal-score-stars.is-saving {
  opacity: 0.65;
  pointer-events: none;
}

.mal-score-clear {
  appearance: none;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  margin-left: 0.35rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.mal-score-clear:hover,
.mal-score-clear:focus-visible {
  color: var(--text);
  border-color: var(--accent-muted);
  outline: none;
}

.mal-score-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-muted);
}

.spotlight-poster {
  width: 100%;
  max-width: 180px;
  aspect-ratio: 2/3;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  border: 2px solid rgba(255, 255, 255, 0.08);
  align-self: center;
  justify-self: end;
}

.spotlight-poster-img, .card-poster-img, .detail-poster-img, .latest-poster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.spotlight-dots {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
  margin-top: 0.75rem;
}

.spotlight-dots .dot {
  width: 24px;
  height: 4px;
  border-radius: 999px;
  border: none;
  background: var(--border);
  cursor: pointer;
  padding: 0;
}

.spotlight-dots .dot.active { background: var(--accent); width: 32px; }

.home-layout {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0.5rem var(--page-pad) 2.5rem;
}

.home-main {
  min-width: 0;
  overflow: hidden;
}

.section {
  margin-bottom: 2rem;
  min-width: 0;
  overflow: hidden;
}
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }

.section-title {
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  font-weight: 800;
  margin: 0;
  color: var(--accent);
}

.section-scroll-hint { color: var(--muted); opacity: 0.5; }

.card-scroll {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding-bottom: 0.75rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

.anime-card {
  flex: 0 0 clamp(110px, 28vw, 140px);
  scroll-snap-align: start;
  min-width: 0;
}

.card-poster {
  position: relative;
  aspect-ratio: 2/3;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
  transition: transform 0.2s, box-shadow 0.2s;
}

.anime-card:hover .card-poster {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.card-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.75) 0%, transparent 45%);
  pointer-events: none;
}

.card-rank {
  position: absolute;
  left: 4px;
  top: 0;
  bottom: 0;
  width: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--accent);
  z-index: 2;
}

.card-initials {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  background: linear-gradient(145deg, var(--purple-dark), var(--bg-card));
}

.card-ep-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--accent);
  color: #1a1200;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  z-index: 2;
}

.card-type {
  position: absolute;
  bottom: 8px;
  left: 8px;
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.65);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  z-index: 2;
}

.card-kind {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(0, 0, 0, 0.65);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  z-index: 2;
}

.card-title {
  font-size: 0.82rem;
  font-weight: 700;
  margin: 0.5rem 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.latest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: 0.65rem;
}

.latest-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.latest-card:hover { border-color: rgba(255, 211, 105, 0.35); background: var(--bg-elevated); }

.latest-poster {
  width: 52px;
  flex-shrink: 0;
  aspect-ratio: 2/3;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
}

.latest-info { flex: 1; min-width: 0; }
.latest-info h3 { margin: 0; font-size: 0.92rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.latest-info p { margin: 0.2rem 0 0; font-size: 0.78rem; color: var(--muted); }
.latest-genre { color: var(--accent-muted) !important; }
.latest-play { color: var(--accent); opacity: 0; }
.latest-card:hover .latest-play { opacity: 1; }

.top10 { list-style: none; margin: 0; padding: 0; }
.top10 li { display: flex; align-items: center; gap: 0.65rem; margin-bottom: 0.45rem; font-size: 0.84rem; font-weight: 600; min-width: 0; }
.top10-rank { color: var(--gold); font-weight: 800; font-size: 1rem; min-width: 1.75rem; flex-shrink: 0; }
.top10 a { flex: 1; min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill { font-size: 0.62rem; background: rgba(255, 211, 105, 0.15); color: var(--accent); padding: 0.12rem 0.45rem; border-radius: 999px; margin-left: 0.35rem; font-weight: 700; }

.detail-banner {
  position: relative;
  background-size: cover;
  background-position: center;
  min-height: min(380px, 60vh);
  width: 100%;
  overflow: hidden;
}
/* Portrait/poster fallback: soft blur layer so upscales look intentional, not blocky. */
.detail-banner--poster::before {
  content: "";
  position: absolute;
  inset: -24px;
  background-image: inherit;
  background-size: cover;
  background-position: center;
  filter: blur(32px) saturate(1.05);
  transform: scale(1.12);
  z-index: 0;
  pointer-events: none;
}
.detail-banner--poster {
  background-size: cover;
  background-position: center top;
}
.detail-banner-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    0deg,
    var(--bg) 0%,
    rgba(12, 14, 23, 0.88) 42%,
    rgba(12, 14, 23, 0.62) 100%
  );
}

.detail-hero {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 2.5rem) var(--page-pad) clamp(1rem, 3vw, 2rem);
  display: flex;
  gap: clamp(1rem, 3vw, 2rem);
  align-items: flex-start;
  flex-wrap: wrap;
}

.detail-poster {
  width: min(190px, 40vw);
  aspect-ratio: 2/3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.08);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 2rem;
}

.detail-info {
  flex: 1;
  min-width: min(100%, 260px);
}

.detail-info h1 {
  font-size: clamp(1.35rem, 3vw, 2.2rem);
  font-weight: 800;
  margin: 0 0 0.75rem;
  word-wrap: break-word;
}

.detail-desc {
  color: var(--muted);
  max-width: 100%;
  font-size: 0.95rem;
  margin: 1rem 0;
}

.detail-episodes {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--page-pad) 3rem;
}

.episode-list { display: flex; flex-direction: column; gap: 0.4rem; }

.episode-row {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
}

.episode-row .episode-item {
  flex: 1;
  min-width: 0;
}

.ep-mark-btn {
  position: relative;
  flex-shrink: 0;
  width: 2.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--hd);
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ep-mark-btn:hover {
  border-color: var(--hd);
  background: rgba(110, 231, 183, 0.1);
}

.ep-mark-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}

.ep-mark-btn.is-done {
  color: var(--accent);
  border-color: rgba(110, 231, 183, 0.45);
}

.ep-mark-btn.is-done:hover {
  border-color: #e57373;
  background: rgba(229, 115, 115, 0.08);
}

.ep-mark-check {
  line-height: 1;
}

.ep-mark-forbid {
  display: none;
  position: absolute;
  inset: 18%;
  border: 2.5px solid #c62828;
  border-radius: 50%;
  box-sizing: border-box;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.12);
}

.ep-mark-forbid::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 50%;
  height: 2.5px;
  margin-top: -1.25px;
  background: #c62828;
  transform: rotate(-45deg);
}

.ep-mark-btn.is-done .ep-mark-forbid,
.manga-overview-mark.is-done .ep-mark-forbid,
.player-complete.is-done .ep-mark-forbid,
.manga-reader-complete.is-done .ep-mark-forbid {
  display: block;
}

.player-section {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 1rem var(--page-pad) 2rem;
}

.player-back {
  display: inline-flex;
  align-items: center;
  margin-bottom: 0.85rem;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.92rem;
}

.player-back:hover {
  color: var(--accent);
}

.player-stage {
  width: 100%;
}

.player-wrap {
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.06);
}

.player-wrap video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.player-demo {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--muted);
  padding: 2rem;
  text-align: center;
}

.player-hint {
  margin: 0.65rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

.player-hint--below {
  margin-top: 0.5rem;
}

.player-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--border);
}

.player-footer-main {
  flex: 1 1 16rem;
  min-width: 0;
}

.player-ep-code {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.player-show-title {
  margin: 0.3rem 0 0;
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight: 800;
  line-height: 1.25;
}

.player-ep-title {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

.player-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex: 0 1 auto;
}

.player-nav {
  display: flex;
  gap: 0.45rem;
}

.player-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

.player-nav-btn.is-disabled {
  opacity: 0.35;
  pointer-events: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--muted);
  padding: 0.45rem 1rem;
}

.player-complete {
  min-height: 2.35rem;
  padding: 0.45rem 1.15rem;
  font-size: 0.85rem;
  white-space: nowrap;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.player-complete:disabled {
  opacity: 0.65;
  cursor: default;
  box-shadow: none;
}

.player-complete.is-done {
  padding-inline: 0.85rem;
}

.player-complete .ep-mark-forbid {
  inset: 22% auto 22% 0.55rem;
  width: 1.15rem;
  height: auto;
  aspect-ratio: 1;
}

.player-complete-label {
  font-weight: 700;
}

.manga-reader-complete {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.manga-reader-complete.is-done .ep-mark-forbid {
  inset: 22% auto 22% 0.55rem;
  width: 1.15rem;
  height: auto;
  aspect-ratio: 1;
}

.episode-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  flex-wrap: wrap;
}

.ep-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.page-search,
.catalog-page,
.mal-connect-page {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 1.25rem var(--page-pad);
  min-width: 0;
  overflow: hidden;
}

/* Browse / search page */
.browse-header {
  margin-bottom: 1.25rem;
}

.browse-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.browse-header-row .section-title {
  margin: 0;
}

.browse-meta {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.browse-avail-tabs {
  margin: 0;
  flex-shrink: 0;
}

.browse-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(120px, 180px) minmax(120px, 180px) auto;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* Manga/Manhwa: Availability + Genre + actions (status lives in header tabs) */
.browse-filters--manga {
  grid-template-columns: minmax(140px, 220px) minmax(140px, 1fr) auto;
}

.browse-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.browse-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.browse-field input,
.browse-field select {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
}

.browse-field input:focus,
.browse-field select:focus {
  outline: none;
  border-color: var(--accent-muted);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.browse-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-browse,
.btn-browse-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 0.88rem;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
}

.btn-browse {
  background: var(--accent);
  color: #1a1200;
}

.btn-browse:hover {
  background: var(--accent-hover);
}

.btn-browse-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--muted);
}

.btn-browse-secondary:hover {
  color: var(--text);
  border-color: var(--accent-muted);
}

.browse-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.browse-grid .browse-tile {
  flex: unset;
  min-width: 0;
}

.browse-tile-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0.4rem 0 0;
}

.browse-tile-genres .tag {
  font-size: 0.62rem;
  padding: 0.12rem 0.4rem;
}

.browse-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem 1rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
}

.browse-page-btn {
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-weight: 700;
  font-size: 0.88rem;
}

.browse-page-btn:hover:not(.disabled) {
  border-color: var(--accent-muted);
  color: var(--accent);
}

.browse-page-btn.disabled {
  opacity: 0.35;
  pointer-events: none;
}

.browse-page-nums {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.browse-page-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.4rem;
  padding: 0.45rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1;
  text-decoration: none;
}

.browse-page-num:hover:not(.is-active) {
  border-color: var(--accent-muted);
  color: var(--accent);
}

.browse-page-num.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1408;
  cursor: default;
}

.browse-page-ellipsis {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0 0.15rem;
  line-height: 1;
  user-select: none;
}

.browse-page-status {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.browse-empty {
  text-align: center;
  padding: 2.5rem 1rem;
}

.browse-empty-hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

@media (max-width: 900px) {
  .browse-filters {
    grid-template-columns: 1fr 1fr;
  }
  .browse-filters--manga {
    grid-template-columns: 1fr 1fr;
  }
  .browse-actions {
    grid-column: 1 / -1;
  }
  .browse-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .browse-filters,
  .browse-filters--manga {
    grid-template-columns: 1fr;
  }
  .browse-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }
}

.catalog-result {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

@media (max-width: 600px) {
  .spotlight-actions {
    flex-direction: column;
  }
  .spotlight-actions .btn-detail {
    width: 100%;
    justify-content: center;
  }
  .episode-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
  .ep-progress {
    margin-left: 0;
  }
  .ep-badge {
    margin-left: 0;
  }

  /* Watch / player: stack toolbar on small screens */
  .player-footer {
    align-items: stretch;
  }
  .player-toolbar {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  .player-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }
  .player-nav-btn,
  .player-complete {
    width: 100%;
    justify-content: center;
  }
  .player-section {
    padding: 0.75rem var(--page-pad) 2rem;
  }
  .player-wrap {
    border-radius: var(--radius);
  }
  .player-back {
    font-size: 0.85rem;
    margin-bottom: 0.65rem;
  }
  .btn-watch,
  .btn-detail {
    padding: 0.55rem 0.85rem;
    font-size: 0.88rem;
  }

  .detail-poster {
    width: min(120px, 34vw);
  }
  .detail-desc {
    font-size: 0.88rem;
  }
  .episode-row {
    gap: 0.35rem;
  }
  .ep-mark-btn {
    width: 2.25rem;
  }
  .grab-actions {
    padding: 0.75rem;
  }
  .grab-override-row {
    flex-direction: column;
  }
  .grab-override-row .grab-action-btn {
    width: 100%;
  }
  .meta-tags {
    gap: 0.35rem;
  }
  .tag {
    font-size: 0.72rem;
    padding: 0.2rem 0.45rem;
  }
  .spotlight-carousel,
  .spotlight-slide {
    min-height: 280px;
  }
  .site-footer {
    font-size: 0.78rem;
    padding: 1.25rem var(--page-pad);
  }
}

@supports (padding: max(0px)) {
  .site-header .header-inner {
    padding-left: max(var(--page-pad), env(safe-area-inset-left));
    padding-right: max(var(--page-pad), env(safe-area-inset-right));
  }
  .site-main {
    padding-bottom: env(safe-area-inset-bottom);
  }
}
.episode-item:hover { border-color: rgba(255, 211, 105, 0.35); background: var(--bg-elevated); }

.episode-item.ep-completed {
  opacity: 0.72;
  border-color: rgba(110, 231, 183, 0.2);
  background: rgba(110, 231, 183, 0.04);
}

.episode-item.ep-next {
  border-color: var(--accent);
  background: rgba(255, 211, 105, 0.08);
  box-shadow: 0 0 0 1px rgba(255, 211, 105, 0.15);
}

.ep-badge {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.ep-completed-badge {
  color: var(--hd);
  background: rgba(110, 231, 183, 0.12);
}

.ep-next-badge {
  color: #1a1200;
  background: var(--accent);
}

.ep-progress-badge {
  color: var(--accent);
  background: rgba(255, 211, 105, 0.12);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}

.tag-airing {
  color: #93c5fd;
  border-color: rgba(147, 197, 253, 0.35);
}

.tag-meta {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.35);
}

.meta-only-hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.75rem 0 1rem;
  max-width: 36rem;
}

.local-media-msg {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  color: var(--hd, #6ee7b7);
}

.local-media-msg.is-error {
  color: var(--danger);
}

.relations-pending {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 1rem;
}

.ep-meta-badge {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
}

.ep-local-badge {
  color: #6ee7b7;
  background: rgba(110, 231, 183, 0.14);
}

.ep-stream-badge {
  color: #93c5fd;
  background: rgba(147, 197, 253, 0.14);
}

.episode-row.ep-meta .episode-item {
  opacity: 0.92;
}

.episode-row.ep-local .episode-item {
  opacity: 1;
}

.tag-completed-show {
  display: inline-block;
  color: var(--hd);
  border-color: rgba(110, 231, 183, 0.35);
}

.tag-score {
  color: var(--gold);
  border-color: rgba(255, 211, 105, 0.35);
  font-weight: 800;
}

.tag-my-score {
  color: #c4b5fd;
  border-color: rgba(196, 181, 253, 0.35);
}

.card-score-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.72);
  color: var(--gold);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  z-index: 2;
}

.detail-episodes .section-title {
  margin-bottom: 0.75rem;
}

.show-relations {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0 0 1.25rem;
}

.relation-btn {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: min(100%, 220px);
  flex: 1 1 180px;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: border-color 0.15s, background 0.15s;
}

.relation-btn:hover {
  border-color: var(--accent-muted);
  background: var(--bg-elevated);
}

.relation-btn.relation-prequel {
  border-left: 3px solid #93c5fd;
}

.relation-btn.relation-sequel {
  border-left: 3px solid var(--accent);
}

.relation-btn.relation-external {
  border-style: dashed;
}

.relation-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.relation-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.relation-hint {
  font-size: 0.72rem;
  color: var(--accent-muted);
  font-weight: 600;
}

/* Compact prequel/sequel chips — phones + narrow tablets */
@media (max-width: 768px) {
  .show-relations {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 0.3rem;
    margin-bottom: 0.85rem;
  }
  .relation-btn {
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
    width: 100%;
    flex: 0 0 auto;
    padding: 0.25rem 0.5rem;
    min-height: 0;
    max-height: 2.75rem; /* ~44px tap target */
    line-height: 1.15;
    border-radius: calc(var(--radius) * 0.75);
  }
  .relation-label {
    font-size: 0.55rem;
    letter-spacing: 0.04em;
    line-height: 1.15;
    flex-shrink: 0;
  }
  .relation-title {
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.15;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .relation-hint {
    font-size: 0.55rem;
    line-height: 1.15;
    flex-shrink: 0;
    flex-basis: auto;
    white-space: nowrap;
  }
}

.ep-num { color: var(--accent); font-weight: 800; min-width: 4.5rem; font-size: 0.88rem; flex-shrink: 0; }
.ep-progress { margin-left: auto; color: var(--hd); font-size: 0.78rem; font-weight: 700; }

.grab-actions {
  width: 100%;
  margin: 1.25rem 0 0;
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.grab-actions .grab-resolve-btn,
.grab-override-tools .grab-action-btn {
  align-self: stretch;
  width: 100%;
  justify-content: center;
  min-height: 2.5rem;
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  font-size: 0.88rem;
  box-sizing: border-box;
}
.grab-override {
  width: 100%;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.grab-override label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0;
}
.grab-override-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.grab-override-row input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  min-height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.9rem;
}
.grab-override-row .grab-action-btn {
  flex: 0 0 auto;
  justify-content: center;
  min-height: 2.5rem;
  border-radius: var(--radius);
  padding: 0.5rem 0.9rem;
  font-size: 0.88rem;
  white-space: nowrap;
  box-sizing: border-box;
}
.grab-override-tools {
  display: flex;
  width: 100%;
}
.grab-override-msg {
  margin: 0;
  font-size: 0.85rem;
  color: var(--danger);
}

.catalog-header h1 { font-weight: 800; }
.catalog-meta { color: var(--muted); font-size: 0.9rem; }
.library-stats {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.55rem;
  max-width: 36rem;
}
.library-stats li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.85rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.library-stats-label {
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  min-width: 4.5rem;
}
.library-stats-value {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
}
.catalog-section { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--border); }

.requests-group { margin-top: 1.25rem; }
.requests-group-title {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
}
.requests-group-count {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent);
}
.requests-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.45rem;
}
.requests-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}
.requests-row:last-child { border-bottom: none; }
.requests-poster {
  width: 40px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--bg-card);
}
.requests-poster--empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  color: var(--muted);
}
.requests-body { flex: 1; min-width: 0; }
.requests-title {
  display: block;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.requests-title:hover { color: var(--accent); }
.requests-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
  margin-top: 0.2rem;
}
.requests-counts {
  font-size: 0.8rem;
  color: var(--muted);
}
.requests-dismiss { flex-shrink: 0; }
.requests-fulfill { flex-shrink: 0; }
.requests-requester {
  font-size: 0.8rem;
  color: var(--muted);
}
/* —— Admin users (/admin/users) —— */
.admin-users-page .catalog-header {
  margin-bottom: 0.25rem;
}

.admin-users-create-section {
  margin-top: 1.5rem;
}

.admin-users-create-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
  align-items: end;
  margin-top: 1rem;
  padding: 1.15rem 1.25rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  max-width: 40rem;
}

.admin-users-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
  margin: 0;
}

.admin-users-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-users-field input,
.admin-users-field select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  min-height: 2.6rem;
}

.admin-users-field input:focus,
.admin-users-field select:focus {
  outline: none;
  border-color: var(--accent-muted);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.admin-users-field--role {
  grid-column: 1 / -1;
  max-width: 14rem;
}

.admin-users-create-submit {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-start;
  padding-top: 0.15rem;
}

.admin-users-create-submit .btn-watch {
  min-width: 8.5rem;
  padding: 0.7rem 1.35rem;
}

.admin-users-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 0.85rem;
  -webkit-overflow-scrolling: touch;
}

.admin-users-table {
  width: 100%;
  min-width: 36rem;
  border-collapse: collapse;
}

.admin-users-table th,
.admin-users-table td {
  text-align: left;
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 0.92rem;
}

.admin-users-table th {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.admin-users-table td:nth-child(2),
.admin-users-table td:nth-child(3),
.admin-users-table td:nth-child(4) {
  white-space: nowrap;
}

.admin-users-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
  min-width: 18rem;
}

.admin-users-actions-spacer {
  flex: 1 1 auto;
  min-width: 0.5rem;
}

.admin-users-restrict-form {
  margin-left: auto;
}

.admin-users-inline-form {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin: 0;
}

.admin-users-reset-form {
  flex: 0 1 auto;
}

.admin-users-reset-form input[type="password"] {
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  min-width: 10rem;
  min-height: 2.35rem;
}

.admin-users-reset-form input[type="password"]:focus {
  outline: none;
  border-color: var(--accent-muted);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

@media (min-width: 720px) {
  .admin-users-create-form {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(8rem, 0.7fr) auto;
    max-width: none;
  }

  .admin-users-field--role {
    grid-column: auto;
    max-width: none;
  }

  .admin-users-create-submit {
    grid-column: auto;
    padding-top: 0;
  }
}

@media (max-width: 519px) {
  .admin-users-create-form {
    grid-template-columns: 1fr;
    padding: 1rem;
    gap: 0.9rem;
  }

  .admin-users-field--role {
    max-width: none;
  }

  .admin-users-create-submit .btn-watch {
    width: 100%;
  }

  .admin-users-table th,
  .admin-users-table td {
    padding: 0.7rem 0.55rem;
  }
}
.btn-request { margin-left: 0.5rem; }
.manga-overview-actions .btn-request { margin-left: 0; }
.btn-recommend { margin-left: 0.5rem; }
.manga-overview-actions .btn-recommend { margin-left: 0; }
.btn-recommend.is-recommended {
  color: var(--accent);
  border-color: rgba(255, 211, 105, 0.4);
  background: transparent;
  cursor: pointer;
  opacity: 1;
}
.btn-recommend.is-recommend-blocked:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.recommend-blocked-hint {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  max-width: 18rem;
}
.manga-overview-actions .recommend-blocked-hint {
  flex-basis: 100%;
}
.btn-request.is-requested,
.btn-request.is-requested:disabled {
  color: var(--hd);
  border-color: rgba(110, 231, 183, 0.35);
  background: transparent;
  cursor: default;
  opacity: 1;
  pointer-events: none;
}
.btn-request.is-requested:hover {
  background: transparent;
  color: var(--hd);
}

.family-recs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 1.25rem;
  margin-top: 0.35rem;
}
.family-recs-group { min-width: 0; }
.family-recs-by {
  margin: 0 0 0.55rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.02em;
}
@media (max-width: 700px) {
  .family-recs-grid { grid-template-columns: 1fr; }
}

.recommend-swap {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}
.recommend-swap[hidden] { display: none !important; }
.recommend-swap-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 6, 12, 0.72);
}
.recommend-swap-panel {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 1.25rem 1.35rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}
.recommend-swap-heading {
  margin: 0 0 0.65rem;
  font-size: 1.15rem;
}
.recommend-swap-body {
  margin: 0 0 1.1rem;
  color: var(--muted);
  line-height: 1.5;
}
.recommend-swap-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: flex-end;
}
.catalog-results { list-style: none; padding: 0; margin: 1rem 0 0; }
.catalog-search { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.catalog-search input { flex: 1; min-width: 0; padding: 0.55rem 0.85rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-card); color: inherit; font-family: inherit; }
.catalog-error { color: var(--danger); }
.catalog-success { color: var(--hd); }
.catalog-flash {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
  margin: 0.85rem 0 0;
  max-width: 42rem;
}
.catalog-flash-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
  max-width: 100%;
}
.catalog-flash--ok .catalog-flash-chip {
  border-color: rgba(110, 231, 183, 0.35);
  background: rgba(110, 231, 183, 0.1);
  color: var(--hd);
}
.catalog-flash--err .catalog-flash-chip {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.1);
  color: var(--danger);
}
.catalog-admin-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.75rem;
}
.catalog-admin-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.catalog-admin-actions-row .btn-watch,
.catalog-admin-actions-row .btn-detail {
  width: auto;
  min-width: 5.5rem;
  padding: 0.45rem 0.9rem;
  justify-content: center;
}
.catalog-admin-status {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: baseline;
}
.catalog-admin-status .catalog-meta {
  font-size: 0.82rem;
}
.mal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.mal-actions-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.sync-actions.is-syncing .btn-sync:disabled {
  background: var(--bg-elevated);
  color: var(--muted);
  border: 1px solid var(--border);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.72;
}

.sync-actions.is-syncing .btn-sync:disabled:hover {
  background: var(--bg-elevated);
  box-shadow: none;
}

.sync-actions.is-syncing .btn-sync.is-active-sync:disabled {
  background: rgba(110, 231, 183, 0.18);
  border-color: rgba(110, 231, 183, 0.45);
  color: var(--hd);
  opacity: 1;
}

.sync-actions.is-syncing .btn-sync.is-active-sync:disabled:hover {
  background: rgba(110, 231, 183, 0.22);
  box-shadow: 0 0 0 1px rgba(110, 231, 183, 0.2);
}
.mal-manual-form { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 0.75rem; }
.mal-manual-form textarea { width: 100%; padding: 0.75rem; border-radius: var(--radius); border: 1px solid var(--border); background: var(--bg-card); color: inherit; font-family: inherit; }
.mal-troubleshoot ul { margin: 0.75rem 0 0; padding-left: 1.25rem; color: var(--muted); }

.site-footer {
  text-align: center;
  padding: 2rem var(--page-pad);
  color: var(--muted);
  font-size: 0.82rem;
  border-top: 1px solid var(--border);
  background: var(--bg-deep);
  width: 100%;
}
.footer-badge { margin: 0.35rem 0 0; color: var(--accent-muted); font-size: 0.78rem; }
.empty { color: var(--muted); }

/* —— Manga —— */
.manga-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}

.manga-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.manga-card[hidden] {
  display: none !important;
}

.manga-card-open {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font: inherit;
}

.manga-card-open--static {
  cursor: default;
}

.manga-card--meta {
  opacity: 0.92;
}

.manga-card-cover {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.manga-card-progress-badge {
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  z-index: 2;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-deep) 78%, transparent);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
}

.manga-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.manga-card-fallback {
  font-size: 2rem;
  font-weight: 800;
  color: var(--muted);
}

.manga-card-body {
  padding: 0.65rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.manga-card-title {
  font-weight: 800;
  font-size: 0.92rem;
  line-height: 1.25;
}

.manga-card-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.manga-card-genres {
  font-size: 0.7rem;
  color: var(--accent-muted);
  line-height: 1.3;
}

.manga-chapter-data {
  display: none;
}

.manga-overview {
  position: fixed;
  top: var(--header-h);
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 90;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.manga-overview[hidden] {
  display: none;
}

.manga-overview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
}

.manga-overview-panel {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  margin: 0 auto;
  background: var(--bg);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  max-height: 100%;
  overflow: auto;
}

.manga-overview-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 0.65rem 1rem;
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 5;
  flex-shrink: 0;
}

.manga-overview-close {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  min-height: 2.5rem;
  min-width: 2.5rem;
  padding: 0 0.95rem;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.manga-overview-close:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.manga-btn-text {
  line-height: 1;
}

.manga-overview-hero {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  gap: 1.25rem;
  padding: 0.5rem 1.25rem 1.25rem;
  align-items: start;
}

.manga-overview-poster {
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
}

.manga-overview-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.manga-overview-title {
  margin: 0 0 0.35rem;
  font-size: clamp(1.25rem, 3vw, 1.7rem);
  line-height: 1.2;
}

.manga-overview-meta {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.manga-overview-synopsis {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.manga-overview-chapters-wrap {
  padding: 0 1.25rem 1.5rem;
}

.manga-overview-chapters-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.65rem;
}

.manga-overview-chapters-heading {
  margin: 0;
  font-size: 0.95rem;
}

.manga-overview-range-toggle {
  flex-shrink: 0;
}

.manga-overview-range {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.55rem 0.75rem;
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
}

.manga-overview-range[hidden] {
  display: none !important;
}

.manga-overview-range-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--muted);
  min-width: 7.5rem;
  flex: 1 1 7.5rem;
}

.manga-overview-range-select {
  font: inherit;
  font-size: 0.88rem;
  color: inherit;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.45rem 0.55rem;
}

.manga-overview-range-apply {
  flex-shrink: 0;
}

.manga-overview-range-status {
  flex: 1 1 100%;
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.manga-overview-chapters {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.manga-overview-chapter-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.4rem;
  align-items: stretch;
}

.manga-overview-chapter-btn {
  width: 100%;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.75rem;
  text-align: left;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: inherit;
  border-radius: var(--radius-lg);
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  font: inherit;
  min-width: 0;
}

.manga-overview-chapter-btn:hover {
  border-color: var(--accent);
}

.manga-overview-chapter-btn.is-done {
  opacity: 0.75;
}

.manga-overview-ch-num {
  color: var(--accent);
  font-weight: 800;
  min-width: 2.5rem;
  font-size: 0.88rem;
  flex-shrink: 0;
}

.manga-overview-ch-title {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manga-overview-ch-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  margin-left: auto;
}

.manga-overview-ch-done {
  color: var(--accent);
  font-weight: 800;
}

.manga-overview-ch-resume {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.82rem;
}

.manga-overview-ch-pages {
  color: var(--muted);
  font-size: 0.82rem;
}

.manga-overview-mark {
  position: relative;
  flex-shrink: 0;
  width: 2.5rem;
  min-width: 2.5rem;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--hd);
  border-radius: var(--radius);
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.manga-overview-mark:hover:not(:disabled) {
  border-color: var(--hd);
  background: rgba(110, 231, 183, 0.1);
  color: var(--hd);
}

.manga-overview-mark:disabled {
  opacity: 0.5;
  cursor: wait;
}

.manga-overview-mark.is-done {
  color: var(--accent);
  border-color: rgba(110, 231, 183, 0.45);
}

.manga-overview-mark.is-done:hover:not(:disabled) {
  border-color: #e57373;
  background: rgba(229, 115, 115, 0.08);
}

.manga-overview-actions {
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
}

.manga-overview-continue {
  min-width: 0;
}

.manga-overview-action-status {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.manga-overview-action-status.is-error {
  color: #f0a8a8;
}

.manga-overview-action-status[hidden] {
  display: none !important;
}

.manga-overview-empty {
  color: var(--muted);
  margin: 0;
}

/* Overview: lock background scroll on mobile only (desktop keeps page scroll). */
@media (max-width: 900px) {
  html.manga-overview-open,
  body.manga-overview-open {
    overflow: hidden;
    overscroll-behavior: none;
  }
}

/* Reader is fullscreen — lock scroll on all viewports. */
html.manga-reader-open,
body.manga-reader-open {
  overflow: hidden;
  overscroll-behavior: none;
}

@media (max-width: 640px) {
  .manga-overview-hero {
    grid-template-columns: 110px 1fr;
    gap: 0.85rem;
    padding: 0.25rem 1rem 1rem;
  }
  .manga-overview-bar {
    padding: 0.55rem 0.85rem;
  }
  .manga-overview-close {
    min-height: 2.75rem;
    padding: 0 1rem;
  }
}

.manga-reader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.manga-reader[hidden] {
  display: none !important;
}

.manga-reader-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
}

.manga-reader-panel {
  position: relative;
  z-index: 1;
  width: min(960px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: #07080f;
}

.manga-reader-bar,
.manga-reader-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: rgba(12, 14, 23, 0.95);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.manga-reader-footer {
  border-bottom: 0;
  border-top: 1px solid var(--border);
  justify-content: space-between;
}

.manga-reader-complete {
  margin-left: auto;
}

.manga-reader-close {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  min-height: 2.25rem;
  padding: 0 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.manga-reader-heading {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.manga-reader-title {
  font-weight: 800;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manga-reader-chapter {
  font-size: 0.78rem;
  color: var(--muted);
}

.manga-reader-progress {
  font-weight: 800;
  color: var(--accent);
  font-size: 0.9rem;
}

.manga-reader-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
}

.manga-reader.is-webtoon .manga-reader-stage {
  align-items: flex-start;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0;
  -webkit-overflow-scrolling: touch;
}

.manga-reader-page-wrap {
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.manga-reader-page-wrap[hidden],
.manga-reader-webtoon[hidden] {
  display: none !important;
}

.manga-reader-image {
  max-width: 100%;
  max-height: calc(100vh - 7.5rem);
  object-fit: contain;
  user-select: none;
  pointer-events: none;
}

.manga-reader-webtoon {
  width: min(860px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding-bottom: 2.5rem;
}

.manga-reader-webtoon-img {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
  background: #0a0b12;
}

.manga-reader-mode {
  font-size: 0.82rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  user-select: none;
}

.manga-reader-mode-label {
  line-height: 1.2;
}

.manga-reader.is-webtoon .manga-reader-zone--left,
.manga-reader.is-webtoon .manga-reader-zone--right,
.manga-reader.is-webtoon .manga-reader-zone--center {
  display: none;
}

/* ~20% side tap strips; center ~60% toggles chrome */
.manga-reader-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  -webkit-tap-highlight-color: transparent;
}

.manga-reader-zone--left {
  left: 0;
  width: 20%;
  justify-content: flex-start;
  padding-left: 0.35rem;
}

.manga-reader-zone--center {
  left: 20%;
  width: 60%;
  justify-content: center;
  z-index: 1;
  cursor: pointer;
}

.manga-reader-zone--right {
  right: 0;
  width: 20%;
  justify-content: flex-end;
  padding-right: 0.35rem;
}

.manga-reader-panel.chrome-hidden .manga-reader-bar,
.manga-reader-panel.chrome-hidden .manga-reader-footer {
  transform: translateY(0);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.manga-reader-bar,
.manga-reader-footer {
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

.manga-reader-chevron {
  font-size: clamp(1.75rem, 5vw, 2.75rem);
  font-weight: 300;
  line-height: 1;
  opacity: 0.35;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
  transition: opacity 0.15s ease;
  pointer-events: none;
  user-select: none;
}

.manga-reader-zone:hover .manga-reader-chevron,
.manga-reader-zone:focus-visible .manga-reader-chevron {
  opacity: 0.75;
}

.manga-reader-zone:focus-visible {
  outline: none;
}

.manga-reader-zone:focus-visible .manga-reader-chevron {
  outline: 2px solid var(--accent-muted);
  outline-offset: 4px;
  border-radius: 4px;
}

.manga-reader-zone:disabled {
  cursor: default;
}

.manga-reader-zone:disabled .manga-reader-chevron {
  opacity: 0.1;
}

.manga-reader-rtl {
  font-size: 0.82rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  cursor: pointer;
  user-select: none;
}

.manga-reader-rtl-label {
  line-height: 1.2;
}

.manga-switch {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  width: 2.4rem;
  height: 1.35rem;
}

.manga-switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.manga-switch-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  transition: background 0.15s ease, border-color 0.15s ease;
  pointer-events: none;
}

.manga-switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.35rem - 6px);
  height: calc(1.35rem - 6px);
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.15s ease, background 0.15s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.manga-switch input:checked + .manga-switch-track {
  background: rgba(255, 211, 105, 0.18);
  border-color: var(--accent-muted);
}

.manga-switch input:checked + .manga-switch-track::after {
  transform: translateX(1.05rem);
  background: var(--accent);
}

.manga-switch input:focus-visible + .manga-switch-track {
  outline: 2px solid var(--accent-muted);
  outline-offset: 2px;
}

.manga-reader-hint {
  font-size: 0.75rem;
  color: var(--muted);
}

@media (max-width: 600px) {
  .manga-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }
  .manga-reader-zone {
    width: 22%;
  }
  .manga-reader-hint {
    display: none;
  }
}

/* —— Schedule —— */
.schedule-page {
  padding-bottom: 2.5rem;
}

.schedule-week {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1.25rem;
}

.schedule-day {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  overflow: hidden;
}

.schedule-day.is-today {
  border-color: rgba(255, 211, 105, 0.45);
  box-shadow: 0 0 0 1px rgba(255, 211, 105, 0.12);
}

.schedule-day-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.18);
}

.schedule-day-head h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
}

.schedule-today-badge {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1a1200;
  background: var(--accent);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.schedule-day-count {
  margin-left: auto;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.schedule-day-empty,
.schedule-empty {
  margin: 0;
  padding: 0.85rem 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.schedule-entries {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
}

.schedule-entry-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 1rem;
  min-width: 0;
}

.schedule-entry-link:hover {
  background: var(--bg-elevated);
}

.schedule-poster {
  width: 2.5rem;
  height: 3.5rem;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
}

.schedule-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.schedule-poster-fallback {
  font-weight: 800;
  color: var(--muted);
}

.schedule-entry-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1;
}

.schedule-entry-title {
  font-weight: 700;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-entry-time {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.45rem;
  font-size: 0.85rem;
}

.schedule-entry-time strong {
  color: var(--accent);
  font-size: 1rem;
}

.schedule-jst {
  color: var(--muted);
  font-size: 0.78rem;
}

.schedule-unknown {
  margin-top: 1.75rem;
}

.schedule-unknown h2 {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 0.35rem;
}

@media (max-width: 600px) {
  .schedule-day-head {
    padding: 0.65rem 0.75rem;
  }
  .schedule-entry-link {
    padding: 0.5rem 0.75rem;
  }
  .schedule-poster {
    width: 2.15rem;
    height: 3rem;
  }
}


/* Legacy manga filter helpers (tabs still used for status / schedule) */
.manga-filters {
  /* Prefer .browse-filters--manga for the overview form */
  display: contents;
}

.manga-filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.manga-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.85rem 1.25rem;
}

.manga-filter-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.manga-genre-filter {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: min(100%, 12rem);
  flex: 0 1 14rem;
}

.manga-genre-select {
  appearance: none;
  width: 100%;
  padding: 0.45rem 2rem 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%239aa3b5' d='M1 1l5 5 5-5'/%3E%3C/svg%3E")
    no-repeat right 0.85rem center;
  color: var(--text);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
}

.manga-genre-select:hover {
  border-color: var(--accent);
  color: var(--text);
}

.manga-genre-select:focus {
  outline: none;
  border-color: var(--accent-muted);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.manga-tabs,
.schedule-mode-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin: 0;
}

.schedule-mode-tabs {
  margin: 0 0 1.25rem;
}

.manga-tab,
.schedule-mode-tab {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}

.manga-tab:hover,
.schedule-mode-tab:hover {
  border-color: var(--accent);
  color: var(--text);
}

.manga-tab.is-active,
.schedule-mode-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1408;
}

/* Second row under status tabs — avoid stacking full .manga-tabs bottom margins */
.manga-avail-tabs {
  margin: 0;
}

.manga-overview-complete-all {
  margin: 0;
}

.detail-episodes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.detail-episodes-head .section-title {
  margin: 0;
}

.episode-overview-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1rem;
  padding-top: 0.75rem;
}

.episode-overview-footer .btn-catalog-remove {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.4);
  background: transparent;
}

.episode-overview-footer .btn-catalog-remove:hover {
  background: rgba(248, 113, 113, 0.12);
  color: #fecaca;
}

.schedule-manga-releasing {
  margin-top: 0.5rem;
}

/* Sync index modal (Library) */
.sync-index-modal[hidden] {
  display: none;
}

.sync-index-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--page-pad);
}

.sync-index-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 8, 16, 0.72);
}

.sync-index-panel {
  position: relative;
  z-index: 1;
  width: min(640px, 100%);
  max-height: min(80vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}

.sync-index-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem 0.5rem;
  flex-shrink: 0;
}

.sync-index-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.sync-index-close {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.sync-index-close:hover {
  color: var(--text);
}

.sync-index-help {
  margin: 0 1.25rem 0.75rem;
  flex-shrink: 0;
}

.sync-index-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-card);
}

.sync-index-tab {
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.sync-index-tab.is-active {
  border-color: var(--accent-muted);
  color: var(--accent);
  background: rgba(255, 211, 105, 0.08);
}

.sync-index-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem 0.35rem;
  flex-shrink: 0;
}

.sync-index-toggle-all:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.sync-index-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.sync-index-row {
  border-bottom: 1px solid var(--border);
}

.sync-index-row:last-child {
  border-bottom: none;
}

.sync-index-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  cursor: pointer;
}

.sync-index-label:hover {
  background: rgba(255, 255, 255, 0.03);
}

.sync-index-label input {
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.sync-index-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.sync-index-title-text {
  font-weight: 600;
}

.sync-index-hint {
  font-size: 0.82rem;
  color: var(--muted);
}

body.sync-index-open {
  overflow: hidden;
}

/* Catalog missing-episode upload modal */
.catalog-upload-panel {
  width: min(520px, 100%);
}

.catalog-upload-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 0 1.25rem 1.25rem;
  overflow: auto;
}

.catalog-upload-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.catalog-upload-field span {
  font-weight: 600;
  color: var(--text);
}

.catalog-upload-field select,
.catalog-upload-field input[type="file"] {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  padding: 0.55rem 0.65rem;
  font: inherit;
}

.catalog-upload-field select:disabled {
  opacity: 0.6;
}

.catalog-upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.25rem;
}

.catalog-upload-form .btn-watch.is-uploading,
.catalog-upload-form .btn-watch.is-uploading:disabled,
#catalog-import-media.is-uploading,
#catalog-import-media.is-uploading:disabled {
  background: var(--hd);
  color: #0c1210;
  box-shadow: 0 8px 24px rgba(110, 231, 183, 0.35);
  opacity: 1;
  cursor: wait;
}

.catalog-upload-form .catalog-error,
.catalog-upload-form .catalog-success {
  margin: 0;
}

/* —— Mobile UI pass (~375px) —— */
/* —— Login —— */
body.login-view {
  min-height: 100vh;
  background: var(--bg-deep);
}

body.login-view .site-header .header-nav,
body.login-view .site-header .menu-toggle,
body.login-view .site-header .search-toggle,
body.login-view .site-header .search-form,
body.login-view .site-header .btn-header-login,
body.login-view .site-footer {
  display: none;
}

body.login-view .site-header .lang-switch {
  margin-left: auto;
}

body.login-view .site-header {
  background: transparent;
  border-bottom-color: transparent;
  backdrop-filter: none;
}

body.login-view .site-main {
  max-width: none;
  padding: 0;
  min-height: calc(100vh - var(--header-h));
  display: flex;
}

.login-shell {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.25rem, 4vw, 2.5rem);
  overflow: hidden;
}

.login-atmosphere {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(ellipse 55% 45% at 18% 22%, rgba(255, 211, 105, 0.14), transparent 58%),
    radial-gradient(ellipse 50% 40% at 82% 78%, rgba(108, 92, 231, 0.12), transparent 55%),
    radial-gradient(ellipse 70% 50% at 50% 110%, rgba(20, 24, 36, 0.95), transparent 50%),
    linear-gradient(165deg, #0a0c14 0%, #12182a 48%, #0c0e17 100%);
  animation: login-atmosphere-drift 18s ease-in-out infinite alternate;
  pointer-events: none;
}

.login-atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
  opacity: 0.55;
}

@keyframes login-atmosphere-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(1.5%, -1.2%, 0) scale(1.04); }
}

.login-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 24rem);
  padding: clamp(1.5rem, 4vw, 2rem);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 211, 105, 0.14);
  background: rgba(14, 17, 28, 0.82);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 24px 64px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(16px);
  animation: login-panel-in 0.55s ease-out both;
}

@keyframes login-panel-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-brand {
  text-align: center;
  margin-bottom: 1.35rem;
}

.login-brand-mark {
  width: 5.5rem;
  height: 5.5rem;
  object-fit: contain;
  display: block;
  margin: 0 auto 0.65rem;
  transform: scale(1.08);
  filter: drop-shadow(0 8px 24px rgba(255, 211, 105, 0.18));
  animation: login-mark-in 0.7s ease-out both;
}

@keyframes login-mark-in {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1.08);
  }
}

.login-brand-name {
  margin: 0;
  font-size: clamp(1.65rem, 4vw, 1.95rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.1;
  color: var(--text);
}

.login-brand-name span {
  color: var(--accent);
}

.login-brand-tagline {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.login-bootstrap-hint {
  margin: 0 0 1rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(20, 24, 36, 0.85);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.login-bootstrap-hint code {
  display: block;
  margin-top: 0.45rem;
  padding: 0.45rem 0.55rem;
  border-radius: 8px;
  background: var(--bg-deep);
  color: var(--accent-muted);
  font-size: 0.75rem;
  word-break: break-word;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.login-form label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.login-form input {
  width: 100%;
  min-width: 0;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: inherit;
  font: inherit;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-form input:focus {
  outline: none;
  border-color: rgba(255, 211, 105, 0.55);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.login-form input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.login-submit {
  width: 100%;
  justify-content: center;
  margin-top: 0.35rem;
  border: none;
  cursor: pointer;
  font: inherit;
}

.login-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.login-error {
  color: var(--danger);
  margin: 0 0 0.9rem;
  padding: 0.65rem 0.8rem;
  border-radius: var(--radius);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  font-size: 0.9rem;
}

@media (prefers-reduced-motion: reduce) {
  .login-atmosphere,
  .login-panel,
  .login-brand-mark {
    animation: none;
  }
}


@media (max-width: 600px) {
  .header-user-menu {
    flex-shrink: 0;
  }

  .header-user-menu-panel {
    right: 0;
    left: auto;
    min-width: 10.5rem;
    max-width: min(16rem, calc(100vw - 1.5rem));
  }

  .header-user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 5.5rem;
  }

  .mal-actions-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .mal-actions-row .btn-watch,
  .mal-actions-row .btn-detail,
  .mal-actions-row .btn-sync {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .catalog-admin-actions-row {
    gap: 0.4rem;
  }

  .catalog-admin-actions-row .btn-watch,
  .catalog-admin-actions-row .btn-detail {
    flex: 0 1 auto;
    width: auto;
    min-width: 4.75rem;
  }

  .catalog-search {
    flex-direction: column;
    align-items: stretch;
  }

  .catalog-search .btn-watch {
    width: 100%;
    justify-content: center;
  }

  .catalog-result {
    align-items: flex-start;
  }

  .catalog-result .btn-watch {
    width: 100%;
    justify-content: center;
  }

  .requests-row {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0.55rem 0.65rem;
  }

  .requests-body {
    flex: 1 1 calc(100% - 3.5rem);
    min-width: 0;
  }

  .requests-fulfill,
  .requests-dismiss {
    flex: 1 1 auto;
    min-width: calc(50% - 0.4rem);
    justify-content: center;
  }

  .detail-info .btn-watch,
  .detail-info .btn-detail,
  .detail-info .btn-request,
  .detail-info .btn-recommend {
    display: inline-flex;
    margin: 0.35rem 0.35rem 0 0;
    max-width: 100%;
  }

  .btn-request,
  .btn-recommend {
    margin-left: 0;
  }

  .recommend-blocked-hint {
    display: block;
    max-width: 100%;
  }

  .mal-list-status {
    flex-wrap: wrap;
    gap: 0.45rem;
    max-width: 100%;
  }

  .mal-list-status-select {
    max-width: 100%;
    min-width: 0;
  }

  .episode-overview-footer {
    justify-content: stretch;
  }

  .episode-overview-footer .btn-detail {
    flex: 1 1 auto;
    justify-content: center;
    min-width: min(100%, 9rem);
  }

  .browse-filters {
    gap: 0.65rem;
  }

  .browse-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .browse-actions .btn-watch,
  .browse-actions .btn-detail {
    flex: 1 1 auto;
    justify-content: center;
  }

  .admin-users-actions {
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .admin-users-reset-form {
    flex-wrap: wrap;
    width: 100%;
  }

  .admin-users-reset-form input[type="password"] {
    flex: 1 1 8rem;
    min-width: 0;
    max-width: 100%;
  }

  .sync-index-modal {
    align-items: flex-end;
    padding: 0;
  }

  .sync-index-panel {
    width: 100%;
    max-height: min(88vh, 720px);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .sync-index-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 0.65rem;
  }

  .sync-index-tab {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .sync-index-label {
    padding: 0.65rem 1rem;
  }

  .recommend-swap-panel {
    width: min(100%, 22rem);
    margin: 0 var(--page-pad);
  }

  .recommend-swap-actions {
    flex-wrap: wrap;
  }

  .recommend-swap-actions .btn-watch,
  .recommend-swap-actions .btn-detail {
    flex: 1 1 auto;
    justify-content: center;
  }
}


/* Native <video controls> + idle auto-hide (toggle controls attribute) */
.player-wrap.has-native-chrome {
  position: relative;
}

/* Hide native fullscreen — replaced by .player-fs-btn overlay. */
.player-wrap.has-native-chrome video::-webkit-media-controls-fullscreen-button {
  display: none !important;
}

.player-wrap.has-native-chrome video::-webkit-media-controls-picture-in-picture-button {
  display: none !important;
}

/* Custom fullscreen — overlays native FS slot (bottom-right of control bar). */
.player-fs-btn {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 4;
  width: 40px;
  height: var(--player-control-h, 40px);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.player-fs-btn:hover,
.player-fs-btn:focus-visible {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.player-fs-btn:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.45);
}

.player-fs-icon {
  display: block;
  flex-shrink: 0;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.85));
}

@media (pointer: coarse) {
  .player-fs-btn {
    width: 44px;
    height: var(--player-control-h, 44px);
  }
}

.player-wrap.has-native-chrome.is-idle .player-fs-btn {
  opacity: 0;
  pointer-events: none;
}

.player-wrap.has-native-chrome.is-idle {
  cursor: none;
}

.player-wrap.has-native-chrome:fullscreen,
.player-wrap.has-native-chrome:-webkit-full-screen {
  width: 100%;
  height: 100%;
  max-width: none;
  aspect-ratio: auto;
  border-radius: 0;
  background: #000;
}

.player-wrap.has-native-chrome:fullscreen .player-fs-btn,
.player-wrap.has-native-chrome:-webkit-full-screen .player-fs-btn {
  right: env(safe-area-inset-right, 0);
  bottom: env(safe-area-inset-bottom, 0);
}

.player-wrap.has-native-chrome:fullscreen video,
.player-wrap.has-native-chrome:-webkit-full-screen video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.player-wrap.has-native-chrome video::cue {
  background: rgba(7, 8, 16, 0.72);
  color: var(--text);
  font-size: 1.05em;
  line-height: 1.35;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

/* Progress / synopsis / theme / skeletons */
.show-progress {
  margin: 0.75rem 0 0.35rem;
  max-width: 22rem;
}

.show-progress-track {
  height: 0.45rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  overflow: hidden;
}

.show-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-muted), var(--accent));
  border-radius: inherit;
}

.show-progress-label {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
}

.synopsis-block {
  position: relative;
  margin: 0.75rem 0 0;
}

.synopsis-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.synopsis-text {
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  overflow: hidden;
  line-height: 1.55;
  width: 100%;
}

/* Keep hero layout stable: expanded panel overlays downward; JS locks min-height to collapsed footprint. */
.synopsis-block.is-expanded {
  z-index: 30;
}

.synopsis-block.is-expanded .synopsis-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 1;
  max-height: min(50vh, 22rem);
  padding: 0.75rem 0.85rem;
  gap: 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.synopsis-block.is-expanded .synopsis-text {
  display: block;
  -webkit-line-clamp: unset;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
}

.synopsis-toggle {
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1.35;
  cursor: pointer;
}

.synopsis-toggle:hover,
.synopsis-toggle:focus-visible {
  color: var(--accent-hover);
  outline: none;
}

.theme-scheme {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
  margin: 1rem 0 0;
}

.theme-scheme-label {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.theme-scheme-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.theme-scheme-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.theme-scheme-btn.is-active,
.theme-scheme-btn[aria-current="true"] {
  color: var(--bg-deep);
  background: var(--accent);
  border-color: var(--accent);
}

.browse-empty .btn-browse-secondary {
  display: inline-flex;
  margin-top: 0.85rem;
}

.skeleton-card,
.catalog-skeleton {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
  list-style: none;
}

.skeleton-poster {
  width: 48px;
  height: 68px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg-elevated), var(--border), var(--bg-elevated));
  background-size: 200% 100%;
  animation: skeleton-pulse 1.2s ease-in-out infinite;
  flex: 0 0 auto;
}

.skeleton-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-top: 0.25rem;
}

.skeleton-line {
  display: block;
  height: 0.7rem;
  width: 70%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-elevated), var(--border), var(--bg-elevated));
  background-size: 200% 100%;
  animation: skeleton-pulse 1.2s ease-in-out infinite;
}

.skeleton-line--title {
  width: 45%;
  height: 0.85rem;
}

@keyframes skeleton-pulse {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-poster,
  .skeleton-line {
    animation: none;
  }
}

