:root {
  --primary-bg: #050505;
  --text-main: #fff;
  --text-muted: rgba(255, 255, 255, 0.58);
  --card-radius: 20px;
  --drawer-bg: #161618;
  --chip-bg: rgba(255, 255, 255, 0.05);
  --content-width: 1320px;
  /* Bridge for shared components (mobile-nav-v2.css, header-v2-test) that
     read the site-wide --v1-* variable names instead of this page's own. */
  --v1-page: var(--primary-bg);
  --v1-card: var(--drawer-bg);
  --v1-chip: var(--chip-bg);
  --v1-line: rgba(255, 255, 255, 0.08);
  --v1-text: var(--text-main);
  --v1-muted: var(--text-muted);
}
html[data-theme="light"] {
  --v1-line: #e9e9e9;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  background: var(--primary-bg);
}

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--text-main);
  font-family: "Unbounded", sans-serif;
}
/* auth.js re-injects its own copy of css/main.css into <head> at runtime,
   which lands after this stylesheet's static <link> tag regardless of HTML
   source order - its plain `body { color: var(--primary-color) }` then wins
   the cascade tie, overriding --text-main above (the exact bug this fixes
   is what made .page-title etc. render white on the light theme). Higher
   specificity via `html body` beats it regardless of injection timing. */
html body {
  background: var(--primary-bg) !important;
  color: var(--text-main) !important;
}

body.catalog-drawer-open {
  overflow: hidden;
}

body::-webkit-scrollbar {
  width: 8px;
  background: #050505;
}

body::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 4px;
}

.page-wrapper {
  min-height: 100vh;
  padding-left: 84px;
  display: flex;
  flex-direction: column;
}

.container {
  width: 100%;
  max-width: 1960px;
  margin: 0 auto;
  padding: 0 28px;
}

.catalog-header {
  position: relative;
  z-index: 40;
  margin-top: calc(92px + env(safe-area-inset-top));
  padding-top: 22px;
  margin-bottom: 30px;
}

.title-section {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto 26px;
}

.page-title {
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -1px;
}

.page-subtitle {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-muted);
}

.title-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.catalog-search-container {
  position: relative;
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto 12px;
}

.catalog-search-input {
  width: 100%;
  padding: 16px 34px 13px 58px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: #181818;
  color: #fff;
  font-family: "Unbounded", sans-serif;
  font-size: 15px;
  outline: none;
  transition: 0.25s;
}

.catalog-search-input:focus {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.3);
}

.catalog-search-icon {
  position: absolute;
  top: 50%;
  left: 22px;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.mobile-filter-bar {
  display: none;
}

.filters-container {
  position: relative;
  z-index: 50;
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto 14px;
  padding: 24px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(20px);
  overflow: visible;
}

.top-filters {
  position: relative;
  z-index: 60;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}

.filters-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

#total-count-label,
.active-tag-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.active-tag-label.is-active {
  color: rgba(255, 255, 255, 0.88);
}

.active-tag-label:empty {
  display: none;
}

.catalog-sort-row {
  position: relative;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 14px 42px 22px 0;
  color: var(--text-muted);
}

.catalog-sort-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.catalog-sort-cycle {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  font-family: "Unbounded", sans-serif;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  padding: 0;
  cursor: pointer;
  text-align: right;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.catalog-sort-cycle:hover {
  color: #fff;
  opacity: 0.82;
}

.catalog-sort-cycle:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.35);
  outline-offset: 4px;
  border-radius: 6px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
}

.custom-select-wrapper {
  position: relative;
  min-width: 228px;
}

.custom-select-wrapper.open {
  z-index: 300;
}

.dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.03);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.25s;
}

.dropdown-trigger:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.custom-select-wrapper.open .dropdown-trigger {
  border-color: rgba(255, 255, 255, 0.5);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: max-content;
  min-width: 244px;
  max-width: 320px;
  max-height: 400px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  background: #141414;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) scale(0.98);
  transition: all 0.25s ease;
  z-index: 320;
}

.custom-select-wrapper.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.dropdown-search-wrap {
  margin-bottom: 8px;
  padding: 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.dropdown-search {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 12px;
  font-family: "Unbounded", sans-serif;
  outline: none;
}

.dropdown-search::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.dropdown-options-list {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: #333 transparent;
}

.dropdown-options-list::-webkit-scrollbar {
  width: 4px;
}

.dropdown-options-list::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background: #333;
}

.dropdown-option {
  margin-bottom: 2px;
  padding: 12px 16px;
  border-radius: 12px;
  color: #999;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s;
}

.dropdown-option:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.dropdown-option.selected {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 600;
}

.catalog-layout {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 30px;
}

.main-content {
  position: relative;
  z-index: 1;
  flex: 1;
  min-width: 0;
  margin-top: -32px;
}

.anime-grid {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px 14px;
}

.anime-card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.24s ease;
  /* now a real <a> instead of a div/article - undo link defaults */
  text-decoration: none;
  color: inherit;
}

@media (min-width: 769px) {
  .filter-group-season {
    display: none;
  }
}

.anime-card:hover {
  transform: translateY(-4px);
}

.card-poster-wrapper {
  position: relative;
  aspect-ratio: 2 / 3;
  margin-bottom: 10px;
  overflow: hidden;
  border-radius: var(--card-radius);
  background: #111;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.38);
}

.card-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.anime-card:hover .card-poster {
  transform: scale(1.03);
}

.card-title-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.anime-title {
  margin: 0 0 4px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  display: block;
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.card-meta-line {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 7px;
  min-width: 0;
  margin-top: 0;
}

.card-studio,
.card-kind {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    padding: 5px 6px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgb(255 255 255 / 0%);
    color: rgba(255, 255, 255, 0.76);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.3px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-studio {
  max-width: calc(100% - 68px);
}

.card-kind {
  flex-shrink: 0;
}

.card-meta-separator {
  width: 4px;
  height: 4px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.34);
}

.skeleton-card {
  aspect-ratio: 2 / 3;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.3;
  }

  50% {
    opacity: 0.6;
  }
}

#empty-state {
  grid-column: 1 / -1;
  padding: 100px 20px;
  text-align: center;
}

#empty-state h3 {
  margin: 0 0 8px;
  font-size: 24px;
}

#empty-state p {
  margin: 0;
  color: var(--text-muted);
}

.catalog-scroll-sentinel {
  width: 100%;
  max-width: var(--content-width);
  min-height: 48px;
  margin: 8px auto 28px;
}

.catalog-scroll-sentinel.is-loading::after {
  content: "";
  display: block;
  width: 28px;
  height: 28px;
  margin: 10px auto;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: #fff;
  animation: catalog-spin 0.8s linear infinite;
}

@keyframes catalog-spin {
  to {
    transform: rotate(360deg);
  }
}

.filters-overlay {
  position: fixed;
  inset: 0;
  z-index: 10040;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  visibility: hidden;
  transition: 0.3s;
}

.filters-overlay.active {
  opacity: 1;
  visibility: visible;
}

.catalog-mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 10050;
  display: none;
  width: min(400px, 92vw);
  max-width: 92vw;
  height: 100dvh;
  background: #0a0a0a;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.8);
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.catalog-mobile-drawer.active {
  transform: translateX(0);
}

.cmd-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: #0a0a0a;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.cmd-panel.active {
  transform: translateX(0);
}

.cmd-main-panel.shifted {
  transform: translateX(-24%);
}

.cmd-header {
  min-height: 68px;
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: #0a0a0a;
  flex-shrink: 0;
}

.cmd-title {
  font-size: 16px;
  font-weight: 700;
}

.cmd-close,
.cmd-back,
.cmd-sub-reset {
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  font-family: "Unbounded", sans-serif;
  cursor: pointer;
}

.cmd-close {
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.55);
}

.cmd-back {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 700;
}

.cmd-sub-reset {
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
}

.cmd-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.cmd-nav-row {
  width: 100%;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: none;
  color: #fff;
  text-align: left;
  font-family: "Unbounded", sans-serif;
}

.cmd-nav-row:first-child {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.cmd-nav-label {
  font-size: 14px;
  font-weight: 600;
}

.cmd-nav-right {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: rgba(255, 255, 255, 0.45);
}

.cmd-nav-value {
  font-size: 13px;
  max-width: 170px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.cmd-nav-value.has-value {
  color: rgba(255, 255, 255, 0.9);
}

.cmd-section {
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.cmd-section-title {
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 700;
}

.cmd-check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.cmd-check-grid-single {
  grid-template-columns: 1fr;
}

.cmd-check-label {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.82);
}

.cmd-check-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.cmd-cb-box {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  transition: 0.2s;
}

.cmd-check-label input:checked ~ .cmd-cb-box {
  background: #fff;
  border-color: #fff;
}

.cmd-check-label input:checked ~ .cmd-cb-box::after {
  content: "";
  display: block;
  width: 4px;
  height: 8px;
  border: 2px solid #000;
  border-top: none;
  border-left: none;
  transform: rotate(45deg) translate(0, -1px);
}

.cmd-footer,
.cmd-sub-footer {
  flex-shrink: 0;
  padding: 16px 20px;
  background: #0a0a0a;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.45);
}

.cmd-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.cmd-btn-reset,
.cmd-btn-apply {
  padding: 16px;
  border-radius: 14px;
  font-family: "Unbounded", sans-serif;
  font-size: 13px;
  cursor: pointer;
}

.cmd-btn-reset {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-weight: 600;
}

.cmd-btn-apply {
  border: 0;
  background: #fff;
  color: #000;
  font-weight: 700;
}

.cmd-sub-search-wrap {
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.cmd-sub-search {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-family: "Unbounded", sans-serif;
  font-size: 13px;
  outline: none;
}

.cmd-sub-search::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.cmd-sub-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.cmd-sub-item {
  width: 100%;
  padding: 13px 20px;
  border-radius: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 14px;
}

@media (max-width: 1100px) {
  .page-wrapper {
    padding-left: 0;
    padding-bottom: 100px;
  }

  .container {
    padding: 0 16px;
  }

  .catalog-layout {
    display: block;
  }

  .title-section {
    margin-bottom: 25px;
  }

  .page-title {
    font-size: 28px;
  }
}

@media (max-width: 768px) {
  .catalog-header {
    margin-top: calc(84px + env(safe-area-inset-top));
  }

  .page-title {
    font-size: 24px;
  }

  .mobile-filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
  }

  .catalog-sort-row {
    display: none;
  }

  .mobile-sort-container {
    position: relative;
    flex: 1;
  }

  .mobile-sort-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.02);
    background: #181818;
    color: #fff;
    font-family: "Unbounded", sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
  }

  .mobile-sort-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    width: 100%;
    z-index: 2100;
    padding: 8px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: #161618;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: 0.2s;
  }

  .mobile-sort-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .mobile-sort-option {
    padding: 12px 16px;
    border-radius: 10px;
    color: #999;
    font-size: 13px;
  }

  .mobile-sort-option.selected {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }

  .mobile-filter-main-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border: 0;
    border-radius: 14px;
    background: #fff;
    color: #000;
    font-family: "Unbounded", sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
  }

  .filters-container {
    display: none;
  }

  .catalog-mobile-drawer {
    display: block;
  }

  .anime-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 8px;
  }

  .anime-title {
    font-size: 10px;
    margin-bottom: 3px;
  }

  .card-meta {
    gap: 0;
  }

  .card-meta-line {
    gap: 4px;
  }

  .card-studio,
  .card-kind {
    padding: 5px 6px;
    font-size: 8px;
  }

  .card-studio {
    max-width: calc(100% - 54px);
  }

  .card-poster-wrapper {
    margin-bottom: 7px;
  }

  .cmd-footer {
    grid-template-columns: 1fr;
  }

  .cmd-sub-footer .cmd-btn-apply,
  .cmd-footer .cmd-btn-apply {
    width: 100%;
    display: block;
  }
}

@media (max-width: 480px) {
  .catalog-mobile-drawer {
    width: 100%;
    max-width: 100%;
    border-left: 0;
  }

  .anime-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 6px;
  }
}

/* -- Quick-link chip row (mirrors the home page's hv2-chip row) -------- */
.cq-chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-bottom: 16px;
  width: 100%;
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
}
.cq-chip-row::-webkit-scrollbar { display: none; }
.cq-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: 11px;
  background: #17171a;
  color: rgba(255, 255, 255, .82);
  font-family: "Unbounded", sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.cq-chip svg { width: 15px; height: 15px; flex: 0 0 15px; opacity: .8; }
html[data-theme="light"] .cq-chip { background: #f1f1f1; color: #1e1e1e; }

/* -- Toggle-chip row: visually its own thing (filled #f2543d when on),
   distinct from the plain outline .cq-chip row above it and from
   .mobile-filter-bar right above - so the three rows read as three
   different jobs (quick pages / sort+drawer / one-tap tag toggles). ---- */
/* Underline-tab style (matches .hv2-tab-row on the home page's
   Последние/Топ за неделю/Коменты row exactly) - swapped in for the filled
   pill-chip look. The only real change from that reference is the active
   underline colour: #f2543d here instead of that row's plain white. */
.cq-toggle-row {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 14px auto 0;
  width: 100%;
  max-width: var(--content-width);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.cq-toggle-row::-webkit-scrollbar { display: none; }
.cq-toggle {
  flex: 0 0 auto;
  position: relative;
  background: none;
  border: 0;
  padding: 0 0 10px;
  font-family: "Unbounded", sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, .45);
  cursor: pointer;
  white-space: nowrap;
}
.cq-toggle.is-active { color: #fff; }
.cq-toggle.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: #f2543d;
}
html[data-theme="light"] .cq-toggle-row { border-bottom-color: #e9e9e9; }
html[data-theme="light"] .cq-toggle { color: rgba(30, 30, 30, .45); }
html[data-theme="light"] .cq-toggle.is-active { color: #1e1e1e; }

/* ---------- ongoing card actions: three-dot + v1-sheet family ----------
   Copied verbatim (same class names, same values) from tag.html's v1-sheet
   component - the notify/favourite window here is literally the same
   component, not a reimplementation that could visually drift from it. */
.card-more-btn {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: none;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: var(--v1-chip);
  color: var(--v1-text);
  cursor: pointer;
}
/* Only list mode ("карточками" off) shows the button at all - grid/tile
   mode never renders it, regardless of anime status. */
html[data-card-format="list"] .card-more-btn { display: flex; }
.card-more-btn svg { width: 15px; height: 15px; }

.v1-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease;
}
.v1-sheet-backdrop[data-open] { opacity: 1; pointer-events: auto; }
.v1-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  max-height: 70vh;
  overflow-y: auto;
  background: #0d0d0d;
  border-radius: 22px 22px 0 0;
  padding: 12px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}
.v1-sheet[data-open] { transform: translateY(0); pointer-events: auto; }
.v1-sheet__handle {
  width: 36px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.18);
}
.v1-sheet__title {
  margin: 0 0 8px;
  padding: 0 4px;
  font-family: "Unbounded", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.4);
}
.v1-sheet__item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 58px;
  padding: 0 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.v1-sheet__item:active { background: rgba(255, 255, 255, 0.07); }
.v1-sheet__item[data-active] { color: #8ea5ff; }
.v1-sheet__item svg { width: 18px; height: 18px; flex: 0 0 18px; opacity: 0.75; }
.v1-sheet__item-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  border-radius: 27px;
  object-fit: cover;
}
.v1-sheet__divider {
  height: 1px;
  margin: 6px 4px;
  background: rgba(255, 255, 255, 0.08);
}
.v1-sheet__item[data-active] svg { opacity: 1; }

.v1-notify-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.v1-notify-channels { display: flex; gap: 8px; margin-bottom: 14px; }
.v1-notify-chip {
  flex: 1 1 0;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 11px;
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}
.v1-notify-chip[data-active] { background: rgba(214, 214, 214, 0.16); border-color: rgba(142, 165, 255, 0); color: #fff; }

.v1-notify-loading {
  padding: 18px 4px;
  text-align: center;
  font-family: "Unbounded", sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
}

/* Ongoing/anons badge on the poster corner - same look tag.html already uses. */
.card-status-badge {
  position: absolute;
  bottom: 7px;
  right: 7px;
  padding: 4px 7px;
  border-radius: 7px;
  font-family: "Unbounded", sans-serif;
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: rgba(255, 255, 255, 0.85);
}
.card-status-badge.is-ongoing { background: rgba(95, 201, 90, 0.85); color: #0c1a0a; }
.card-status-badge.is-anons { background: rgba(175, 72, 10, 0.88); color: #fff; }

.cq-toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(12px);
  z-index: 10000;
  padding: 12px 18px;
  border-radius: 12px;
  background: #1c1c1c;
  color: #fff;
  font-family: "Unbounded", sans-serif;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}
.cq-toast.is-error { background: #3a1414; color: #ff9b9b; }
.cq-toast.is-open { opacity: 1; transform: translateX(-50%) translateY(0); }

html[data-theme="light"] .v1-sheet { background: #ffffff; box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.1); }
html[data-theme="light"] .v1-sheet__handle { background: rgba(0, 0, 0, 0.14); }
html[data-theme="light"] .v1-sheet__title { color: rgba(30, 30, 30, 0.45); }
html[data-theme="light"] .v1-sheet__item { color: #1e1e1e; }
html[data-theme="light"] .v1-sheet__item:active { background: rgba(0, 0, 0, 0.05); }
html[data-theme="light"] .v1-sheet__item[data-active] { color: #3a56d4; }
html[data-theme="light"] .v1-sheet__divider { background: #e9e9e9; }
html[data-theme="light"] .v1-notify-chip { border-color: #d2d2d2; color: rgb(156, 156, 156); }
html[data-theme="light"] .v1-notify-chip[data-active] { background: #000; }

@media (max-width: 480px) {
  html[data-card-format="list"] .card-poster-wrapper {
    width: 87px;
    min-width: 87px;
    height: 137px;
    border-radius: 9px;
  }
}

/* Force catalog page shell background; keep content surfaces untouched.
   The footer component fetches and re-injects its own copy of main.css into
   <head> after the initial page parse, landing AFTER this stylesheet in DOM
   order - with equal specificity and both rules !important, that later
   duplicate was winning the cascade and silently reverting the background to
   main.css's #050505. `html body` (two element selectors) is a structurally
   higher specificity than a plain `body` match, so this wins regardless of
   which stylesheet the DOM ends up placing last. */
html,
html body,
.page-wrapper {
    background-color: #0b0b0c !important;
}

/* ---------- light theme (new-catalog.html only) ---------- */
html[data-theme="light"] {
  --primary-bg: #ffffff;
  --text-main: #1e1e1e;
  --text-muted: #6f6f6f;
  --drawer-bg: #ffffff;
  --chip-bg: #f3f3f3;
}
html[data-theme="light"] html,
html[data-theme="light"] body,
html[data-theme="light"] .page-wrapper { background-color: #ffffff !important; }
html[data-theme="light"] body::-webkit-scrollbar { background: #f3f3f3; }
html[data-theme="light"] body::-webkit-scrollbar-thumb { background: #ccc; }
html[data-theme="light"] .title-dot { background: #1e1e1e; }
html[data-theme="light"] .catalog-search-input { background: #f3f3f3; color: #1e1e1e; }
html[data-theme="light"] .catalog-search-input::placeholder { color: rgba(0, 0, 0, 0.35); }
html[data-theme="light"] .catalog-search-input:focus { background: #ececec; border-color: rgba(0, 0, 0, 0.15); }
html[data-theme="light"] .filters-container { background: rgba(0, 0, 0, 0.02); }
html[data-theme="light"] .active-tag-label.is-active { color: rgba(0, 0, 0, 0.85); }
html[data-theme="light"] .catalog-sort-cycle { color: rgba(0, 0, 0, 0.7); }
html[data-theme="light"] .catalog-sort-cycle:hover { color: #1e1e1e; }
html[data-theme="light"] .dropdown-trigger { background: #f3f3f3; color: #1e1e1e; border-color: #e9e9e9; }
html[data-theme="light"] .dropdown-trigger:hover { background: #ececec; border-color: rgba(0, 0, 0, 0.18); }
html[data-theme="light"] .custom-select-wrapper.open .dropdown-trigger { border-color: rgba(0, 0, 0, 0.4); }
html[data-theme="light"] .dropdown-menu { background: #ffffff; box-shadow: 0 24px 48px rgba(0, 0, 0, 0.12); border: 1px solid #e9e9e9; }
html[data-theme="light"] .dropdown-search { background: #f3f3f3; color: #1e1e1e; }
html[data-theme="light"] .dropdown-search::placeholder { color: rgba(0, 0, 0, 0.35); }
html[data-theme="light"] .dropdown-options-list { color: #ccc; }
html[data-theme="light"] .dropdown-options-list::-webkit-scrollbar-thumb { background: #ccc; }
html[data-theme="light"] .dropdown-option { color: #6f6f6f; }
html[data-theme="light"] .dropdown-option:hover { background: rgba(0, 0, 0, 0.05); color: #1e1e1e; }
html[data-theme="light"] .dropdown-option.selected { background: rgba(0, 0, 0, 0.08); color: #1e1e1e; }
html[data-theme="light"] .card-poster-wrapper { background: #e5e5e5; }
html[data-theme="light"] .anime-title { color: #1e1e1e; }
html[data-theme="light"] .card-studio,
html[data-theme="light"] .card-kind { background: rgba(0, 0, 0, 0.06); color: rgba(0, 0, 0, 0.65); }
html[data-theme="light"] .card-meta-separator { background: rgba(0, 0, 0, 0.25); }
html[data-theme="light"] .skeleton-card { background: rgba(0, 0, 0, 0.04); }
html[data-theme="light"] .catalog-scroll-sentinel.is-loading::after { border-top-color: #1e1e1e; }
html[data-theme="light"] .catalog-mobile-drawer,
html[data-theme="light"] .cmd-panel,
html[data-theme="light"] .cmd-header,
html[data-theme="light"] .cmd-footer,
html[data-theme="light"] .cmd-sub-footer { background: #ffffff; }
html[data-theme="light"] .catalog-mobile-drawer { border-left-color: #e9e9e9; box-shadow: -12px 0 40px rgba(0, 0, 0, 0.15); }
html[data-theme="light"] .cmd-close,
html[data-theme="light"] .cmd-back,
html[data-theme="light"] .cmd-sub-reset,
html[data-theme="light"] .cmd-nav-row { color: #1e1e1e; }
html[data-theme="light"] .cmd-close { color: rgba(0, 0, 0, 0.55); }
html[data-theme="light"] .cmd-sub-reset { color: rgba(0, 0, 0, 0.5); }
html[data-theme="light"] .cmd-nav-right { color: rgba(0, 0, 0, 0.5); }
html[data-theme="light"] .cmd-nav-value.has-value { color: rgba(0, 0, 0, 0.9); }
html[data-theme="light"] .cmd-check-label { color: rgba(0, 0, 0, 0.75); }
html[data-theme="light"] .cmd-check-label input:checked ~ .cmd-cb-box { background: #1e1e1e; border-color: #1e1e1e; }
html[data-theme="light"] .cmd-check-label input:checked ~ .cmd-cb-box::after { border-color: #fff; }
html[data-theme="light"] .cmd-btn-reset { background: rgba(0, 0, 0, 0.06); color: #1e1e1e; }
html[data-theme="light"] .cmd-btn-apply { background: #1e1e1e; color: #fff; }
html[data-theme="light"] .cmd-sub-search { background: rgba(0, 0, 0, 0.05); color: #1e1e1e; }
html[data-theme="light"] .cmd-sub-search::placeholder { color: rgba(0, 0, 0, 0.35); }
html[data-theme="light"] .mobile-sort-btn { background: #f3f3f3; color: #1e1e1e; }
html[data-theme="light"] .mobile-sort-dropdown { background: #ffffff; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12); border: 1px solid #e9e9e9; }
html[data-theme="light"] .mobile-sort-option { color: #6f6f6f; }
html[data-theme="light"] .mobile-sort-option.selected { background: rgba(0, 0, 0, 0.08); color: #1e1e1e; }
html[data-theme="light"] .mobile-filter-main-btn { background: #1e1e1e; color: #fff; }

/* ---------- card format: list mode ----------
   Reshapes the existing grid card markup into horizontal rows (poster left,
   meta right) matching tag.html's row card exactly - same poster size,
   genre line, one-line description and "N доступно" progress pill. The
   extra elements (.card-genres-line/.card-desc-line/.card-progress-pill)
   are always in the DOM (see new-catalog.js) but hidden by default below;
   list mode is the only place they're shown. Grid stays this page's
   default (no override needed) when the shared senku_card_format setting
   is unset or explicitly "grid". */
.card-genres-line,
.card-desc-line,
.card-progress-pill {
  display: none;
}

html[data-card-format="list"] .anime-grid {
  display: flex !important;
  flex-direction: column;
  gap: 0;
  max-width: 720px;
}
html[data-card-format="list"] .anime-card {
  display: grid;
  grid-template-columns: 100px 1fr;
  flex-direction: unset;
  align-items: flex-start;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--v1-line, rgba(255, 255, 255, 0.08));
}
html[data-card-format="list"] .anime-card:last-child { border-bottom: none; }
html[data-card-format="list"] .card-poster-wrapper {
  width: 100px;
  min-width: 111px;
  height: 159px;
  aspect-ratio: auto;
  margin-bottom: 0;
  flex-shrink: 0;
}
html[data-card-format="list"] .card-meta {
  flex: unset;
  min-width: 0;
  padding: 4px 0;
  gap: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}
html[data-card-format="list"] .anime-title {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.3;
}
html[data-card-format="list"] .card-meta-line { display: none; }

html[data-card-format="list"] .card-genres-line {
  display: flex;
  margin-top: 8px;
  gap: 6px;
  flex-wrap: wrap;
}
html[data-card-format="list"] .card-genres-line span {
  font-family: "Unbounded", sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--v1-muted, rgba(255, 255, 255, 0.5));
}
html[data-card-format="list"] .card-genres-line span + span::before {
  content: " · ";
  color: rgba(255, 255, 255, 0.2);
}
html[data-theme="light"][data-card-format="list"] .card-genres-line span + span::before {
  color: rgba(0, 0, 0, 0.2);
}

html[data-card-format="list"] .card-desc-line {
  display: block;
  margin: 6px 0 0;
  font-size: 11px;
  font-weight: 500;
  color: var(--v1-muted, rgba(255, 255, 255, 0.4));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html[data-card-format="list"] .card-progress-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 8px;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.5);
  font-family: "Unbounded", sans-serif;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 6px 10px;
}
html[data-card-format="list"] .card-progress-pill b {
  font-size: 11px;
  font-weight: 700;
  color: #fff;
}
html[data-card-format="list"] .card-progress-sep {
  color: rgba(255, 255, 255, 0.2);
}

html[data-theme="light"][data-card-format="list"] .card-progress-pill {
  color: #000;
  background: rgba(0, 0, 0, 0.14);
}
html[data-theme="light"][data-card-format="list"] .card-progress-pill b {
  color: #000;
}
html[data-theme="light"][data-card-format="list"] .card-progress-sep {
  color: rgba(0, 0, 0, 0.25);
}

@media (max-width: 480px) {
  html[data-card-format="list"] .anime-card {
    grid-template-columns: 88px 1fr;
    gap: 14px;
    padding: 14px 0;
  }
  html[data-card-format="list"] .card-poster-wrapper {
    width: 88px;
    min-width: 88px;
    height: 132px;
  }
}

/* The generic .dropdown-menu above (filter selects) also matches the header's
   profile menu list: on the catalog pages only, it drew a border + shadow box
   and a 400px height cap around the profile menu items. header.css resets it
   too; kept here so the fix doesn't wait on header.css's edge cache. */
#profile-dropdown-menu .dropdown-menu {
  border: 0 !important;
  box-shadow: none !important;
  max-height: none !important;
  z-index: auto !important;
  transition: none !important;
}
