:root {
  --bg: #151515;
  --bg-elev: #1b1b1b;
  --bg-soft: #202020;
  --bg-chip: rgba(38, 38, 38, 0.63);
  --bg-chip-on: #2a3d2a;
  --line: #2a2a2a;
  --text: #ffffff;
  --muted: #9a9a9a;
  --faint: #6e6e6e;
  --green: #96ca8e;
  --cyan: #bbdbdf;
  --star: #e8c36a;
  --danger: #e57373;
  --radius: 2px;
  --header-h: 55px;
  /* Spacing scale (8px base) */
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 24px;
  --space-5: 32px;
  --space-6: 40px;
  --gap: var(--space-2);
  --section-gap: var(--space-5);
  --section-head-gap: var(--space-2);
  --page-pad-x: 16px;
  --page-pad-y: 20px;
  --max: 1340px;
  --sidebar: 320px;
  --font: Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--font);
  min-height: 100vh;
  overflow-x: clip;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--cyan); }
img { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
::selection { background: #355a3a; color: #fff; }

#loading-bar {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: var(--green); z-index: 1000;
  transition: width .25s ease;
}
#loading-bar.on { width: 70%; }
#loading-bar.done { width: 100%; opacity: 0; transition: width .2s, opacity .35s; }

/* —— Header (Kuroiru-like) —— */
#header-cont {
  position: sticky; top: 0; z-index: 50;
  background: rgba(26, 26, 26, 0.86);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #1c1c1c;
}
#header {
  max-width: var(--max);
  margin: 0 auto;
  min-height: var(--header-h);
  height: var(--header-h);
  padding: 0 var(--page-pad-x);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 450px) minmax(0, 1fr);
  align-items: center;
  gap: 14px;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  justify-self: start;
}
.logo {
  font-family: "Fredoka", Roboto, sans-serif;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  color: #151515;
  -webkit-text-stroke: 1.35px #e8e8e8;
  paint-order: stroke fill;
  text-shadow: none;
  flex-shrink: 0;
  padding: 2px 0;
}
.logo:hover {
  color: #151515;
  -webkit-text-stroke-color: #fff;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: nowrap;
  min-width: 0;
}
.header-nav a {
  padding: 6px 8px;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  border-radius: 2px;
  white-space: nowrap;
}
.header-nav a:hover { color: #fff; background: transparent; }
.header-nav a.active { color: #fff; font-weight: 400; }
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  justify-self: end;
}
.header-nav-right { justify-content: flex-end; }
.header-actions {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0 0 0 4px;
  flex-shrink: 0;
}

.search-slot {
  position: relative;
  width: 100%;
  max-width: 450px;
  justify-self: center;
  min-width: 0;
}
.search-wrap {
  position: relative;
  width: 100%;
  display: flex;
  align-items: stretch;
  background: transparent;
  border: 0;
  border-radius: 0;
}
.search-inside {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  height: 34px;
  background: #151515;
  border: 1px solid #353535;
  border-right: 0;
  border-radius: 3px 0 0 3px;
}
.search-inside input {
  flex: 1;
  min-width: 0;
  height: 100%;
  background: transparent;
  border: 0;
  outline: 0;
  padding: 9px 10px;
  font-size: 14px;
  color: #fff;
  font-family: Arial, Roboto, sans-serif;
}
.search-inside input::placeholder { color: #6e6e6e; }
.search-inside input::-webkit-search-decoration,
.search-inside input::-webkit-search-cancel-button { display: none; }
.search-inside-btn {
  width: 44px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #868686;
  flex-shrink: 0;
}
.search-inside-btn:hover { color: #cfcfcf; }
.search-btn {
  width: 49px;
  height: 34px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: #e6e6e6;
  background: #262626;
  border: 1px solid #353535;
  border-left: 0;
  border-radius: 0 3px 3px 0;
}
.search-btn:hover { color: #fff; background: #2e2e2e; }
.search-dismiss {
  display: none;
  width: 40px;
  height: 34px;
  place-items: center;
  flex-shrink: 0;
  color: #bbbbbb;
  background: transparent;
  border: 0;
  border-radius: 3px;
}
.search-dismiss:hover { color: #fff; }
.menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 168px;
  padding: 6px;
  background: #1a1a1a;
  border: 1px solid #353535;
  border-radius: 3px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.menu-dropdown[hidden] { display: none !important; }
.menu-dropdown a {
  display: block;
  padding: 9px 12px;
  font-size: 13.5px;
  color: var(--muted);
  border-radius: 2px;
  white-space: nowrap;
}
.menu-dropdown a:hover,
.menu-dropdown a.active {
  color: #fff;
  background: #242424;
}

/* Full-screen search layer (mobile) — outside header stacking context */
.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
}
.search-overlay:not([hidden]) {
  display: block;
}
.search-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.78);
  cursor: pointer;
}
.search-overlay-panel {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 12px;
  background: #121212;
  border-bottom: 1px solid #2a2a2a;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.55);
}
.search-overlay-panel .search-wrap {
  display: flex;
  align-items: stretch;
  gap: 8px;
  max-width: none;
  width: 100%;
}
.search-overlay-panel .search-inside {
  flex: 1;
  min-width: 0;
  height: 42px;
  background: #1a1a1a;
  border-radius: 3px 0 0 3px;
}
.search-overlay-panel .search-btn {
  width: 46px;
  height: 42px;
  border-radius: 3px;
  border-left: 1px solid #353535;
}
.search-overlay-panel .search-dismiss {
  display: grid;
  height: 42px;
  width: 42px;
}
.search-overlay-panel .suggest {
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(62vh, 440px);
  z-index: 2;
  background: #1a1a1a;
}

.icon-btn {
  width: 40px;
  height: 31px;
  display: grid;
  place-items: center;
  color: #bbbbbb;
  border-radius: 0;
  padding: 7px 10px 2px;
  margin: 0 3px 0 0;
}
.icon-btn:hover,
.icon-btn.active {
  color: #fff;
  background: transparent;
}
.icon-btn svg { display: block; }
/* Desktop: search field only — never show search/menu icons */
.icon-btn.search-toggle,
.menu-wrap {
  display: none !important;
}

.suggest {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #1a1a1a; border: 1px solid #353535;
  border-radius: 3px; max-height: 360px; overflow: auto; z-index: 60;
}
.suggest a {
  display: flex; gap: 10px; align-items: center;
  padding: 8px 10px; border-bottom: 1px solid #222;
}
.suggest a:hover { background: #222; color: #fff; }
.suggest img { width: 36px; height: 50px; object-fit: cover; border-radius: 1px; background: #111; }
.suggest .s-meta { font-size: 12px; color: var(--muted); }
.suggest .s-title { font-size: 13px; font-weight: 500; }

.settings-grid {
  display: grid;
  gap: 12px;
  max-width: 560px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 3px;
}
.settings-row label { font-size: 14px; }
.profile-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: var(--space-2);
  margin: var(--space-3) 0 var(--space-4);
}
.profile-stat {
  padding: var(--space-3);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 3px;
}
.profile-stat b { display: block; font-size: 22px; margin-bottom: 4px; }
.profile-stat span { font-size: 12px; color: var(--muted); }
.discord-card {
  max-width: 520px;
  padding: 22px;
  background: linear-gradient(135deg, #1a1c2e 0%, #151515 100%);
  border: 1px solid #2a2f4a;
  border-radius: 4px;
}
.discord-card p { color: var(--muted); line-height: 1.55; }
.btn-discord {
  background: #5865f2;
  border-color: #5865f2;
  color: #fff;
}
.btn-discord:hover { background: #4752c4; color: #fff; border-color: #4752c4; }

/* —— Layout —— */
#app {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--page-pad-y) var(--page-pad-x) var(--space-6);
  min-height: calc(100vh - var(--header-h) - 80px);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar);
  gap: var(--space-4);
  align-items: start;
}
.home-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
}
.home-main > .section,
.home-main > .hero,
.home-main > #heroMount {
  margin-bottom: 0;
}
.home-side {
  position: sticky;
  top: calc(var(--header-h) + var(--space-2));
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.home-side > .side-panel,
.home-side > .section {
  margin-bottom: 0;
}

/* —— Hero —— */
.hero {
  position: relative;
  overflow: hidden;
  display: block;
  padding: 14px;
  margin-bottom: 0;
  background: #151515;
  border: 1px solid #242028;
  border-radius: 3px;
  min-height: 200px;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-image: var(--hero-bg);
  background-size: cover;
  background-position: center 25%;
  transform: scale(1.06);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}
.hero.has-bg .hero-bg {
  opacity: 0.42;
}
.hero.has-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(95deg, rgba(21, 21, 21, 0.92) 0%, rgba(21, 21, 21, 0.7) 36%, rgba(21, 21, 21, 0.4) 62%, rgba(21, 21, 21, 0.62) 100%),
    linear-gradient(180deg, rgba(21, 21, 21, 0.2) 0%, rgba(21, 21, 21, 0.55) 100%);
}
.hero-content {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  min-height: 185px;
}
.hero-poster-wrap {
  position: relative;
  width: 130px;
  min-height: 185px;
  align-self: stretch;
  border-radius: 3px;
  overflow: hidden;
  background: #111;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.hero-poster {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  min-height: 100%;
  padding-bottom: 2px;
}
.hero-title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.15;
}
.hero-stats {
  display: flex; gap: 14px; align-items: center;
  font-size: 14px; color: var(--muted);
}
.hero-stats .star { color: var(--star); }
.hero-desc {
  margin: 0;
  font-size: 13.5px;
  color: #b5b5b5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hero-genres { font-size: 13px; color: var(--cyan); }
.hero-nav {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 3;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}
.hero-nav button {
  width: 28px; height: 28px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: var(--radius);
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
}
.hero-nav button svg { width: 15px; height: 15px; display: block; }
.hero-nav button:hover { background: rgba(32, 32, 32, 0.85); border-color: #555; }
.hero-stats svg,
.item-pop svg,
.trend-stats svg,
.anime-score svg,
.muted svg {
  width: 12px;
  height: 12px;
  display: inline-block;
  vertical-align: -1px;
  margin-right: 2px;
}
.hero-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-right: 110px; /* keep clear of hero-nav chips */
}
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  font-size: 13px; font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-soft);
  white-space: nowrap;
}
.btn:hover { color: #fff; border-color: #444; }
.btn-primary { background: #2d4a30; border-color: #3d6340; color: #dff5df; }
.btn-primary:hover { background: #355636; color: #fff; }
.btn-ico {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.btn-ico svg {
  width: 16px;
  height: 16px;
  display: block;
}
.btn-label { line-height: 1.2; }
.btn-icon-only .btn-label,
.btn.is-icon .btn-label { display: none; }
.btn-icon-only .btn-ico svg,
.btn.is-icon .btn-ico svg { width: 17px; height: 17px; }
/* Decorative icons only when labels collapse on small screens */
.hero-actions .btn-ico,
.anime-hero-actions .btn-ico { display: none; }

html.reduce-motion *,
html.reduce-motion *::before,
html.reduce-motion *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  scroll-behavior: auto !important;
}

/* —— Sections —— */
.section {
  margin-bottom: var(--section-gap);
}
.section:last-child {
  margin-bottom: 0;
}
.section-head {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-bottom: var(--section-head-gap);
}
.section-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}
.section-count { color: var(--muted); font-size: 14px; font-weight: 400; }
.section-tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.switch-item {
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 2px;
  color: var(--muted);
  border: 1px solid transparent;
}
.switch-item.on, .switch-item:hover {
  color: #fff;
  background: var(--bg-soft);
  border-color: var(--line);
}
.see-more {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
}
.see-more svg { width: 15px; height: 15px; display: block; }
.see-more:hover { color: #fff; background: var(--bg-soft); }

/* —— Genre chips —— */
.tags-row {
  display: flex; gap: 8px; overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge legacy */
}
.tags-row::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
  height: 0;
  width: 0;
}
.tags-card {
  flex: 0 0 auto;
  padding: 6px 12px;
  font-size: 13px;
  background: var(--bg-chip);
  border: 1px solid #3a3a3a;
  border-radius: 2px;
  white-space: nowrap;
  color: #ebfcff;
}
.tags-card:nth-child(3n) { border-color: #4a6a4a; }
.tags-card:nth-child(3n+1) { border-color: #5a4a6a; }
.tags-card:nth-child(3n+2) { border-color: #6a4a4a; }
.tags-card:hover, .tags-card.on {
  background: var(--bg-chip-on);
  color: #fff;
  border-color: var(--green);
}

/* —— Explore filters —— */
.explore-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: flex-end;
  margin: 0 0 var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 3px;
}
.filter-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 120px;
}
.filter-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}
.az-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 var(--space-3);
}
.az-chip {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 2px;
}
.az-chip:hover { color: #fff; border-color: #444; }
.az-chip.on {
  color: #dff5df;
  background: var(--bg-chip-on);
  border-color: var(--green);
}
.genre-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 var(--space-3);
}
.explore-meta {
  margin: 0 0 var(--space-3);
  font-size: 13px;
}
.explore-tabs { margin-bottom: var(--space-3); }

/* —— Anime cards —— */
.rail {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px 8px;
}
.panel-item {
  display: block;
  min-width: 0;
  color: inherit;
}
.panel-item:hover { color: inherit; }
.panel-item:hover .item-title { color: var(--cyan); }
.cover {
  position: relative;
  aspect-ratio: 150 / 215;
  background: #111;
  border-radius: 2px;
  overflow: hidden;
}
.cover-img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.item-pop {
  position: absolute; top: 0; left: 0; right: 0;
  z-index: 2;
  display: flex; gap: 6px; align-items: center;
  padding: 5px 6px 14px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, rgba(0,0,0,.92) 0%, rgba(0,0,0,.55) 55%, transparent 100%);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95), 0 0 6px rgba(0, 0, 0, 0.65);
}
.item-pop .sc { color: #f3d68a; }
.item-pop .pop { color: #f5f5f5; }
.item-pop svg {
  flex: 0 0 auto;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.9));
}
.item-rank {
  position: absolute;
  left: 5px;
  bottom: 4px;
  z-index: 2;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.72);
  color: var(--green);
}
.item-ep {
  position: absolute; right: 5px; bottom: 4px;
  font-size: 11px; font-weight: 500;
  padding: 1px 5px;
  background: rgba(0,0,0,.65);
  border-radius: 2px;
}
.item-title {
  margin: 6px 0 2px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.item-bottom {
  font-size: 12.5px;
  color: var(--green);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-bottom.ago { color: var(--muted); }

/* —— Sidebar trending —— */
.side-panel {
  background: transparent;
  margin-bottom: 0;
}
.side-head {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-bottom: var(--section-head-gap);
}
.side-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.vert-scroll { display: flex; flex-direction: column; gap: 4px; }
.trending-mobile { display: none; }
.trend-rail {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
}
.trend-rail::-webkit-scrollbar {
  display: none;
  height: 0;
}
.trend-rail .panel-item {
  flex: 0 0 112px;
  width: 112px;
}

/* —— Continue Watching —— */
.continue-rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  margin: 0 -2px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
}
.continue-rail::-webkit-scrollbar {
  display: none;
  height: 0;
}
.continue-card {
  flex: 0 0 min(72vw, 260px);
  width: min(72vw, 260px);
  max-width: 280px;
  color: inherit;
  scroll-snap-align: start;
}
.continue-card:hover { color: inherit; }
.continue-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 4px;
  overflow: hidden;
  background: #111;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.continue-thumb img,
.continue-ph {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.continue-ph {
  background: linear-gradient(145deg, #1a1a1a, #0d0d0d 55%, #181818);
}
.continue-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.45) 100%);
  pointer-events: none;
}
.continue-play svg {
  width: 40px;
  height: 40px;
  padding: 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  transition: transform 0.15s ease, background 0.15s ease;
}
.continue-card:hover .continue-play svg,
.continue-card:focus-visible .continue-play svg {
  transform: scale(1.06);
  background: rgba(45, 74, 48, 0.92);
}
.continue-ep {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 3px 7px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}
.continue-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.18);
  z-index: 2;
}
.continue-bar i {
  display: block;
  height: 100%;
  background: var(--green, #96ca8e);
  border-radius: 0 1px 1px 0;
}
.continue-meta {
  margin-top: 8px;
  min-width: 0;
}
.continue-title {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.continue-card:hover .continue-title { color: var(--cyan); }
.continue-sub {
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (min-width: 720px) {
  .continue-card {
    flex: 0 0 240px;
    width: 240px;
  }
}
@media (min-width: 1100px) {
  .continue-card {
    flex: 0 0 260px;
    width: 260px;
  }
}

.vert-item {
  display: grid;
  grid-template-columns: 22px 42px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 6px 4px;
  border-radius: 2px;
}
.vert-item:hover { background: var(--bg-soft); color: inherit; }
.vert-rank {
  font-size: 13px; font-weight: 700; color: var(--muted); text-align: center;
}
.vert-item:nth-child(-n+3) .vert-rank { color: var(--green); }
.vert-thumb {
  width: 42px; height: 58px; object-fit: cover;
  border-radius: 2px; background: #111;
}
.vert-title {
  font-size: 13px; font-weight: 500; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.vert-bottom, .trend-stats {
  display: flex; flex-wrap: wrap; gap: 8px;
  font-size: 11.5px; color: var(--muted); margin-top: 2px;
}
.trend-stats .up { color: var(--green); }
.trend-stats .down { color: var(--danger); }

/* —— My list —— */
.list-bar {
  display: flex; flex-wrap: wrap; gap: var(--space-1); align-items: center;
  margin-bottom: var(--space-3);
}
.list-bar select, .ghost-select {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 6px 8px;
  font-size: 13px;
}
.view-tog { display: flex; gap: 2px; margin-left: auto; }
.view-tog button {
  padding: 5px 9px;
  font-size: 12px;
  color: var(--muted);
  border-radius: 2px;
}
.view-tog button.on { background: #2a2a2a; color: #fff; }
.list-empty {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.list-ph {
  height: 120px;
  background: #1a1a1a;
  border: 1px dashed #2c2c2c;
  border-radius: 2px;
}
.history-right { margin-left: auto; color: var(--muted); display: grid; place-items: center; }
.history-right svg { width: 16px; height: 16px; display: block; }
.history-right:hover { color: var(--danger); }

/* —— Pages: anime / watch / search —— */
.page-title { margin: 0 0 var(--space-3); font-size: 22px; font-weight: 700; }
.page-meta {
  margin: calc(var(--space-2) * -1) 0 var(--space-3);
  color: var(--muted);
  font-size: 13.5px;
}
.page-lead {
  margin: calc(var(--space-1) * -1) 0 var(--space-4);
  color: var(--muted);
}

.anime-hero {
  --anime-poster-w: 180px;
  --anime-poster-h: 260px;
  position: relative;
  overflow: hidden;
  margin: 0 0 var(--section-gap);
  padding: var(--space-3);
  border-radius: 3px;
  background: var(--bg);
  border: 1px solid transparent;
  min-height: calc(var(--anime-poster-h) + 36px);
}
.anime-hero-bg {
  position: absolute;
  inset: -2%;
  background-image: var(--anime-bg);
  background-size: cover;
  background-position: center 30%;
  transform: scale(1.02);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}
.anime-hero.has-bg .anime-hero-bg { opacity: 0.36; }
.anime-hero.has-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(
      180deg,
      var(--bg) 0%,
      rgba(21, 21, 21, 0.7) 16%,
      rgba(21, 21, 21, 0.48) 40%,
      rgba(21, 21, 21, 0.48) 60%,
      rgba(21, 21, 21, 0.7) 84%,
      var(--bg) 100%
    ),
    linear-gradient(
      90deg,
      rgba(21, 21, 21, 0.32) 0%,
      rgba(21, 21, 21, 0.32) 60%,
      rgba(21, 21, 21, 0.5) 100%
    );
}
.anime-hero-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: var(--anime-poster-w) minmax(0, 1fr);
  gap: clamp(12px, 2vw, 20px);
  align-items: stretch;
  min-height: var(--anime-poster-h);
}
.anime-poster {
  width: var(--anime-poster-w);
  height: 100%;
  min-height: var(--anime-poster-h);
  object-fit: cover;
  border-radius: 3px;
  background: #111;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
  align-self: stretch;
}
.anime-hero-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 100%;
}
.anime-hero-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.anime-title {
  margin: 0;
  font-size: clamp(20px, 2.4vw, 30px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.01em;
}
.anime-alt {
  font-size: clamp(12px, 1.2vw, 14px);
  color: var(--muted);
  line-height: 1.3;
}
.anime-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  font-size: clamp(12px, 1.15vw, 13.5px);
  color: var(--muted);
  margin: 0;
}
.anime-meta b,
.anime-score {
  color: var(--star);
  font-weight: 600;
}
.anime-desc {
  margin: 0;
  font-size: clamp(12.5px, 1.2vw, 14px);
  line-height: 1.45;
  color: #b8b8b8;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.anime-genres {
  font-size: clamp(12px, 1.15vw, 13.5px);
  color: var(--cyan);
  line-height: 1.35;
}
.anime-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}
.anime-hero-actions .btn {
  padding: 8px 14px;
  font-size: clamp(12.5px, 1.15vw, 13.5px);
}

/* —— Episode cards (image + title) —— */
.ep-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px 10px;
}
.ep-card {
  display: block;
  min-width: 0;
  color: inherit;
  border-radius: 3px;
}
.ep-card:hover { color: inherit; }
.ep-card:hover .ep-card-title { color: var(--cyan); }
.ep-card.on .ep-thumb { outline: 1px solid var(--green); outline-offset: 1px; }
.ep-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #111;
  border-radius: 3px;
  overflow: hidden;
}
.ep-thumb .ep-ph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
  color: #3a3a3a;
  background: #1a1a1a;
}
.ep-thumb .ep-ph[hidden] {
  display: none !important;
}
.ep-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  z-index: 1;
}
.ep-badge {
  position: absolute; left: 6px; top: 6px;
  z-index: 2;
  font-size: 11px; font-weight: 600;
  padding: 2px 6px;
  background: rgba(0,0,0,.72);
  border-radius: 2px;
}
.ep-badge.filler { right: 6px; left: auto; background: rgba(120,60,20,.85); color: #ffd8b0; }
.ep-card-title {
  margin-top: 6px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ep-grid.compact {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px 6px;
  max-height: 420px;
  overflow: auto;
  padding-right: 2px;
}
.ep-grid.compact .ep-card-title { font-size: 11.5px; -webkit-line-clamp: 1; }

/* Catalog browse grid (genre / explore) */
.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 12px 8px;
}
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: var(--space-4) 0 0;
}
.page-stack {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
}
.page-stack > .section,
.page-stack > .anime-hero {
  margin-bottom: 0;
}
.pager a, .pager span, .pager button {
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--bg-soft);
  color: var(--muted);
}
.pager a svg { width: 15px; height: 15px; display: block; }
.pager a:hover, .pager button:hover { color: #fff; border-color: #444; }
.pager .on { color: var(--green); border-color: var(--green); background: #1a241a; }
.pager .disabled { opacity: 0.35; pointer-events: none; }
.pager .pager-info { border: 0; background: transparent; color: var(--muted); min-width: auto; }

.skeleton {
  background: linear-gradient(90deg, #1a1a1a 25%, #222 50%, #1a1a1a 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 2px;
}
.sk-home .sk-hero {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 16px;
  padding: 14px;
  margin-bottom: 0;
  background: #191919;
  border: 1px solid #242028;
  border-radius: 3px;
}
.sk-home .sk-poster { width: 130px; height: 185px; }
.sk-line { height: 12px; margin-bottom: 8px; }
.sk-line.lg { height: 22px; width: 55%; }
.sk-line.md { width: 80%; }
.sk-line.sm { width: 40%; }
.sk-rail {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 10px 8px;
  margin-bottom: var(--section-gap);
}
.sk-card { aspect-ratio: 150 / 215; }
.sk-anime {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 18px;
  margin-bottom: var(--section-gap);
  padding: 18px;
  border: 1px solid #242028;
  border-radius: 3px;
  min-height: 296px;
}
.sk-anime .sk-poster { width: 180px; height: 260px; border-radius: 3px; }
.sk-watch {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sk-player { aspect-ratio: 16 / 9; width: 100%; }
.sk-side-block { height: 36px; margin-bottom: 8px; width: 120px; }

@keyframes shimmer { to { background-position: -200% 0; } }

.watch-layout {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
}
.watch-layout > .section {
  margin-bottom: 0;
}
.watch-stage {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.watch-head {
  margin-bottom: 0;
}
.watch-head .page-title {
  margin: var(--space-1) 0 0;
}
.player-frame {
  position: relative;
  background: #000;
  border-radius: 3px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  width: 100%;
}
.player-frame iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%; border: 0;
}
.server-list { display: flex; flex-direction: column; gap: 6px; }
.server-list.row {
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.server-list.row::-webkit-scrollbar { display: none; height: 0; }
.server-list button, .server-list .srv {
  flex: 0 0 auto;
  text-align: center;
  padding: 6px 11px;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.2;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  white-space: nowrap;
}
.server-list .srv:hover { color: #fff; border-color: #444; }
.server-list .on { border-color: var(--green); color: var(--green); background: rgba(150, 202, 142, 0.08); }

.watch-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: 0;
  flex-wrap: nowrap;
  min-width: 0;
}
.watch-nav {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  align-items: center;
  flex: 0 0 auto;
}
.watch-sources {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  justify-content: flex-end;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.watch-sources::-webkit-scrollbar { display: none; height: 0; }
.watch-sources .type-tog {
  display: flex;
  gap: 4px;
  margin: 0;
  flex-shrink: 0;
}
.watch-sources .type-tog .switch-item {
  padding: 5px 10px;
  font-size: 12.5px;
  font-weight: 400;
}
.watch-sources .server-list.row {
  min-width: 0;
  max-width: none;
  flex: 0 1 auto;
}
.type-tog { display: flex; gap: 6px; margin-bottom: 10px; }

.community-section { margin-top: 0; }
.community-embed {
  min-height: 180px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.community-embed iframe {
  width: 100%;
  border: 0;
  display: block;
  background: var(--bg);
}
.schedule-day {
  margin-bottom: var(--space-4);
}
.schedule-day:last-child {
  margin-bottom: 0;
}
.schedule-row {
  display: grid;
  grid-template-columns: 64px 48px minmax(0, 1fr) auto;
  gap: var(--space-2);
  align-items: center;
  padding: var(--space-1) 0;
  border-bottom: 1px solid #222;
}
.schedule-row img { width: 48px; height: 66px; object-fit: cover; border-radius: 2px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.error-box {
  padding: 20px;
  border: 1px solid #3a2a2a;
  background: #1a1515;
  border-radius: 3px;
  color: #f0c0c0;
}

/* —— Footer —— */
#site-footer {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--space-4) var(--page-pad-x) var(--space-5);
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  border-top: 1px solid #222;
  font-size: 13px;
  color: var(--muted);
}
.foot-left, .foot-right { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.foot-brand { color: #fff; font-weight: 500; }
.foot-label { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }

/* —— Responsive —— */
@media (max-width: 1100px) {
  .header-nav a { padding: 6px 7px; font-size: 12.5px; }
  .header-right { gap: 6px; }
  .anime-hero {
    --anime-poster-w: 150px;
    --anime-poster-h: 216px;
    padding: 16px;
  }
  .ep-grid,
  .ep-grid.compact { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  :root {
    --sidebar: 100%;
    --page-pad-x: 14px;
    --page-pad-y: 16px;
    --section-gap: 28px;
  }
  .home-grid { grid-template-columns: 1fr; gap: var(--space-5); }
  .home-side { position: static; }
  .trending-mobile { display: block; }
  .trending-desktop { display: none; }
  #header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }
  .header-nav { display: none; }
  .search-slot { display: none; }
  .icon-btn.search-toggle {
    display: grid !important;
  }
  .menu-wrap {
    display: block !important;
    position: relative;
  }

  body.search-open {
    overflow: hidden;
  }

  .ep-grid,
  .ep-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .explore-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    align-items: flex-end;
    scrollbar-width: none;
  }
  .explore-filters::-webkit-scrollbar { display: none; }
  .filter-field { min-width: 110px; flex: 0 0 auto; }
  .filter-actions { margin-left: 0; flex: 0 0 auto; }
  .schedule-row {
    grid-template-columns: 56px 44px minmax(0, 1fr) auto;
    gap: 10px;
  }
  .schedule-row img { width: 44px; height: 60px; }
  #site-footer {
    padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 720px) {
  :root {
    --page-pad-x: 12px;
    --page-pad-y: 14px;
    --section-gap: 24px;
    --header-h: 52px;
  }
  #header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 0 10px;
  }
  .logo {
    font-size: 22px;
    -webkit-text-stroke-width: 1.1px;
  }
  .header-actions { gap: 0; }
  .icon-btn { width: 34px; height: 30px; padding: 5px 6px 2px; margin: 0; }

  /* Home hero — keep horizontal desktop form */
  .hero {
    padding: 10px;
    min-height: 0;
  }
  .hero-content {
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 12px;
    min-height: 142px;
  }
  .hero-poster-wrap { width: 100px; min-height: 142px; }
  .hero-title { font-size: 17px; }
  .hero-stats { font-size: 12.5px; gap: 10px; }
  .hero-desc { -webkit-line-clamp: 2; font-size: 12.5px; }
  .hero-genres {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .hero-nav {
    right: 8px;
    bottom: 8px;
    gap: 6px;
    font-size: 12px;
  }
  .hero-nav button { width: 26px; height: 26px; }
  .hero-actions {
    padding-right: 88px;
    gap: 6px;
    flex-wrap: nowrap;
  }

  /* Details hero — keep horizontal */
  .anime-hero {
    --anime-poster-w: 112px;
    --anime-poster-h: 160px;
    padding: 12px;
    margin-bottom: 0;
    min-height: 0;
  }
  .anime-hero-inner {
    grid-template-columns: var(--anime-poster-w) minmax(0, 1fr);
    gap: 12px;
    min-height: var(--anime-poster-h);
  }
  .anime-title { font-size: 18px; }
  .anime-alt { font-size: 12px; }
  .anime-meta { font-size: 12px; gap: 6px 10px; }
  .anime-desc { -webkit-line-clamp: 3; font-size: 12.5px; }
  .anime-genres {
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .anime-hero-actions {
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .anime-hero-actions::-webkit-scrollbar { display: none; }
  .anime-hero-actions .btn {
    flex: 0 0 auto;
    padding: 7px 10px;
    font-size: 12.5px;
  }
  /* Secondary list actions → icon only */
  .anime-hero-actions .btn:not(.btn-primary) .btn-label { display: none; }
  .anime-hero-actions .btn:not(.btn-primary) .btn-ico { display: inline-flex; }
  .anime-hero-actions .btn:not(.btn-primary) {
    padding: 7px 10px;
    min-width: 34px;
    justify-content: center;
  }

  /* Watch strip — single horizontal row, nav icon-only */
  .watch-toolbar {
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .watch-toolbar::-webkit-scrollbar { display: none; }
  .watch-nav .btn .btn-label { display: none; }
  .watch-nav .btn {
    padding: 7px 10px;
    min-width: 34px;
    justify-content: center;
    gap: 0;
  }
  .watch-nav .btn .btn-ico svg { width: 17px; height: 17px; }
  .watch-sources { gap: 6px; }
  .watch-sources .type-tog .switch-item { padding: 5px 8px; font-size: 12px; }
  .server-list button,
  .server-list .srv { padding: 5px 9px; font-size: 12px; }

  .watch-head .page-title { font-size: 17px; }
  .page-title { font-size: 19px; }
  .section-title { font-size: 16px; }

  .rail { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px 6px; }
  .catalog-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px 6px; }
  .sk-rail { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .item-title { font-size: 12px; }
  .ep-grid,
  .ep-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 8px; }
  .ep-card-title { font-size: 12px; }

  .schedule-row {
    grid-template-columns: 48px 40px minmax(0, 1fr);
    gap: 8px 8px;
  }
  .schedule-row img { width: 40px; height: 56px; }
  .schedule-row > :nth-child(1),
  .schedule-row > :nth-child(2) {
    grid-row: 1 / span 2;
    align-self: center;
  }
  .schedule-row > :nth-child(3) {
    grid-column: 3;
    grid-row: 1;
  }
  .schedule-row > .item-bottom {
    grid-column: 3;
    grid-row: 2;
    justify-self: start;
    font-size: 11.5px;
    margin-top: -2px;
  }

  .list-empty { grid-template-columns: 1fr; }
  .profile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-row {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
  }
  .az-strip { gap: 3px; }
  .az-chip { min-width: 26px; height: 26px; padding: 0 6px; font-size: 11.5px; }

  .sk-anime {
    grid-template-columns: 112px 1fr;
    padding: 12px;
    min-height: 184px;
    gap: 12px;
  }
  .sk-anime .sk-poster { width: 112px; height: 160px; }
  .sk-home .sk-hero { grid-template-columns: 100px 1fr; gap: 12px; padding: 10px; }
  .sk-home .sk-poster { width: 100px; height: 142px; }
}

@media (max-width: 560px) {
  :root {
    --page-pad-x: 10px;
    --page-pad-y: 12px;
    --section-gap: 20px;
  }

  .hero-content {
    grid-template-columns: 84px minmax(0, 1fr);
    gap: 10px;
    min-height: 120px;
  }
  .hero-poster-wrap { width: 84px; min-height: 120px; }
  .hero-title { font-size: 15.5px; }
  .hero-stats {
    font-size: 11.5px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .hero-desc { display: none; }
  .hero-genres {
    display: block;
    font-size: 11.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .hero-nav span { display: none; } /* counter text — chips only */
  .hero-actions { padding-right: 68px; }
  .hero-actions .btn .btn-label { display: none; }
  .hero-actions .btn .btn-ico { display: inline-flex; }
  .hero-actions .btn {
    padding: 7px 9px;
    min-width: 32px;
    justify-content: center;
    gap: 0;
  }

  .anime-hero {
    --anime-poster-w: 88px;
    --anime-poster-h: 126px;
    padding: 10px;
  }
  .anime-hero-inner {
    grid-template-columns: var(--anime-poster-w) minmax(0, 1fr);
    gap: 10px;
  }
  .anime-title { font-size: 16px; }
  .anime-alt { display: none; }
  .anime-desc { -webkit-line-clamp: 2; }
  .anime-genres {
    display: block;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  /* All details actions → icon only on very small */
  .anime-hero-actions .btn .btn-label { display: none; }
  .anime-hero-actions .btn .btn-ico { display: inline-flex; }
  .anime-hero-actions .btn {
    padding: 7px 9px;
    min-width: 32px;
    justify-content: center;
    gap: 0;
  }

  .watch-sources .type-tog .switch-item { padding: 5px 7px; }
  .ep-grid,
  .ep-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ep-grid.compact .ep-card-title { -webkit-line-clamp: 1; }

  .rail { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); }
  .catalog-grid { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); }

  .sk-anime { grid-template-columns: 88px 1fr; padding: 10px; min-height: 146px; }
  .sk-anime .sk-poster { width: 88px; height: 126px; }
  .sk-home .sk-hero { grid-template-columns: 84px 1fr; }
  .sk-home .sk-poster { width: 84px; height: 120px; }

  .suggest a { padding: 7px 8px; gap: 8px; }
  .suggest img { width: 32px; height: 44px; }
}

@media (max-width: 400px) {
  :root { --page-pad-x: 8px; }

  .logo { font-size: 20px; }

  .hero-content {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 8px;
    min-height: 104px;
  }
  .hero-poster-wrap { width: 72px; min-height: 104px; }
  .hero-title { font-size: 14.5px; }
  .hero-stats {
    display: flex;
    font-size: 11px;
    gap: 6px;
  }
  .hero-genres { font-size: 11px; }
  .hero-actions { padding-right: 60px; }

  .anime-hero {
    --anime-poster-w: 72px;
    --anime-poster-h: 104px;
    padding: 8px;
  }
  .anime-hero-inner {
    grid-template-columns: var(--anime-poster-w) minmax(0, 1fr);
    gap: 8px;
  }
  .anime-title { font-size: 14.5px; }
  .anime-meta { font-size: 11.5px; }
  .anime-desc { -webkit-line-clamp: 2; font-size: 12px; }

  .ep-grid,
  .ep-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rail { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }
  .catalog-grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); }

  .schedule-row {
    grid-template-columns: 42px 36px minmax(0, 1fr);
  }
  .schedule-row img { width: 36px; height: 50px; }

  .sk-anime { grid-template-columns: 72px 1fr; padding: 8px; min-height: 120px; }
  .sk-anime .sk-poster { width: 72px; height: 104px; }
  .sk-home .sk-hero { grid-template-columns: 72px 1fr; }
  .sk-home .sk-poster { width: 72px; height: 104px; }
}
