/* Nyandub portal reform. Functional styles stay in styles.css; this layer owns the product UI. */

:root {
  --bg: #f5f3f5;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --panel-soft: #efebef;
  --line: rgba(35, 27, 34, 0.11);
  --line-strong: rgba(35, 27, 34, 0.2);
  --text: #1c171c;
  --muted: #756b73;
  --soft: #50484f;
  --accent: #ff779f;
  --accent-2: #d93669;
  --primary-text: #24151b;
  --gold: #d49b26;
  --shadow: 0 18px 48px rgba(42, 25, 36, 0.08);
  --shadow-strong: 0 28px 80px rgba(42, 25, 36, 0.16);
  --input-bg: #ffffff;
  --select-bg: #ffffff;
  --card-bg: transparent;
  --chip-bg: #ffffff;
  --ghost-bg: rgba(255, 255, 255, 0.78);
  --token-bg: rgba(255, 255, 255, 0.16);
  --track-bg: rgba(35, 27, 34, 0.1);
  --placeholder: rgba(80, 72, 79, 0.52);
  --sidebar-bg: #171419;
  --nav-active-bg: rgba(255, 119, 159, 0.13);
  --continue-bg: #211d23;
  --brand-gradient: linear-gradient(145deg, #ff93b4, #f14f83);
  --brand-text: #2f1420;
  --player-bg: #09080b;
  --soft-panel-bg: #f0edf0;
  --portal-width: 1480px;
  --header-h: 72px;
  --motion-fast: 130ms;
  --motion-base: 220ms;
  --motion-slow: 420ms;
  --motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --motion-spring: cubic-bezier(0.2, 1.4, 0.34, 1);
}

html[data-theme^="dark"] {
  --bg: #0f0e12;
  --panel: #19171d;
  --panel-strong: #211e25;
  --panel-soft: #141217;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f7f2f5;
  --muted: #aaa1a9;
  --soft: #d6cfd4;
  --shadow: 0 20px 56px rgba(0, 0, 0, 0.28);
  --shadow-strong: 0 32px 90px rgba(0, 0, 0, 0.48);
  --input-bg: #201d23;
  --select-bg: #201d23;
  --card-bg: transparent;
  --chip-bg: #1d1a20;
  --ghost-bg: rgba(31, 28, 34, 0.82);
  --token-bg: rgba(17, 14, 18, 0.52);
  --track-bg: rgba(255, 255, 255, 0.11);
  --placeholder: rgba(214, 207, 212, 0.5);
  --sidebar-bg: #111014;
  --continue-bg: #1f1b21;
  --soft-panel-bg: #1c191f;
  --primary-text: #26131a;
}

html[data-theme$="-red"] { --accent: #ff6f96; --accent-2: #ec3f70; }
html[data-theme$="-orange"] { --accent: #ff9d62; --accent-2: #e96f2e; }
html[data-theme$="-yellow"] { --accent: #f2ce55; --accent-2: #c69811; }
html[data-theme$="-green"] { --accent: #78d895; --accent-2: #31a85a; }
html[data-theme$="-cyan"] { --accent: #6fd1df; --accent-2: #249bb0; }
html[data-theme$="-blue"] { --accent: #80adff; --accent-2: #4f7fe0; }
html[data-theme$="-violet"] { --accent: #b797ff; --accent-2: #8257dc; }

html {
  background: var(--bg);
  scroll-padding-top: calc(var(--header-h) + 18px);
}

body,
html[data-theme^="dark"] body {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 4%, var(--bg)) 0, var(--bg) 340px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background-color var(--motion-slow) var(--motion-ease), color var(--motion-base) ease;
}

button,
input,
textarea,
select {
  letter-spacing: 0;
}

button,
a,
summary,
label[for] {
  -webkit-tap-highlight-color: transparent;
}

button:not(:disabled),
a,
summary {
  transition:
    color var(--motion-base) ease,
    background-color var(--motion-base) ease,
    border-color var(--motion-base) ease,
    box-shadow var(--motion-base) var(--motion-ease),
    opacity var(--motion-base) ease,
    transform var(--motion-base) var(--motion-ease);
}

button:active:not(:disabled),
.nav-item:active,
.profile-link:active,
summary:active {
  transform: scale(0.965);
  transition-duration: 70ms;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 82%, #fff 18%);
  outline-offset: 2px;
}

.app-shell,
.app-shell.sidebar-collapsed {
  display: block;
  min-height: 100vh;
}

.main-view {
  min-width: 0;
  padding: 0 28px 72px;
}

.main-view.is-view-entering > :not(.topbar):not([hidden]) {
  animation: nyan-view-enter var(--motion-slow) var(--motion-ease) both;
}

.main-view[data-motion-direction="back"].is-view-entering > :not(.topbar):not([hidden]) {
  --view-enter-x: -12px;
}

.main-view[data-motion-direction="forward"].is-view-entering > :not(.topbar):not([hidden]) {
  --view-enter-x: 12px;
}

.main-view.is-view-entering .anime-card,
.main-view.is-view-entering .community-card,
.main-view.is-view-entering .schedule-card,
.main-view.is-view-entering .request-card,
.main-view.is-view-entering .forum-topic,
.main-view.is-view-entering .public-profile-card,
.main-view.is-view-entering .profile-module-card {
  animation: nyan-card-enter 380ms var(--motion-ease) both;
}

.main-view.is-view-entering :is(.anime-card, .community-card, .schedule-card, .request-card, .forum-topic, .public-profile-card, .profile-module-card):nth-child(2) {
  animation-delay: 35ms;
}

.main-view.is-view-entering :is(.anime-card, .community-card, .schedule-card, .request-card, .forum-topic, .public-profile-card, .profile-module-card):nth-child(3) {
  animation-delay: 70ms;
}

.main-view.is-view-entering :is(.anime-card, .community-card, .schedule-card, .request-card, .forum-topic, .public-profile-card, .profile-module-card):nth-child(4) {
  animation-delay: 105ms;
}

.main-view.is-view-entering :is(.anime-card, .community-card, .schedule-card, .request-card, .forum-topic, .public-profile-card, .profile-module-card):nth-child(n + 5) {
  animation-delay: 130ms;
}

/* Header and navigation */
.topbar,
.topbar.no-search {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 44px 162px auto minmax(220px, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: calc(100% + 56px);
  min-height: var(--header-h);
  margin: 0 -28px 0;
  padding: 10px max(28px, calc((100vw - var(--portal-width)) / 2));
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  box-shadow: none;
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
}

.topbar.no-search {
  grid-template-columns: 44px 162px minmax(360px, 1fr) auto;
}

.sidebar-toggle {
  width: 42px;
  min-width: 42px;
  height: 42px;
  border-color: var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 0;
}

.sidebar-toggle span {
  font-size: 17px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  width: auto;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.topbar-brand:hover,
.topbar-brand.active {
  border-color: transparent;
  background: transparent;
}

.topbar-brand .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  box-shadow: none;
}

.topbar-brand-copy {
  display: grid;
  min-width: 0;
  text-align: left;
}

.topbar-brand-copy strong {
  font-size: 17px;
  line-height: 1.05;
}

.topbar-brand-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.top-primary-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.top-primary-nav .nav-item {
  width: auto;
  min-height: 40px;
  padding: 0 11px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.top-primary-nav .nav-item .icon {
  width: 16px;
  min-width: 16px;
  color: currentColor;
  font-size: 11px;
}

.top-primary-nav .nav-item:hover,
.top-primary-nav .nav-item.active {
  border-color: transparent;
  background: var(--nav-active-bg);
  color: var(--accent-2);
}

.topbar-context {
  display: none;
}

.topbar > .search-field {
  max-width: 520px;
  min-height: 42px;
  justify-self: end;
  border-color: transparent;
  border-radius: 8px;
  background: var(--panel-soft);
}

.topbar > .search-field:focus-within {
  border-color: color-mix(in srgb, var(--accent) 54%, var(--line));
  background: var(--panel);
}

.search-field span {
  color: var(--accent-2);
  font-size: 20px;
}

.top-actions {
  gap: 6px;
}

.account-pill,
.notification-pill,
.quick-settings > summary,
.theme-toggle,
.glass-toggle,
.profile-pill {
  min-height: 42px;
  border-color: var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--soft);
  font-size: 13px;
}

.notification-pill strong {
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--primary-text);
  font-size: 11px;
}

.notification-symbol {
  display: none;
  color: var(--accent-2);
  font-size: 16px;
}

.quick-settings-panel {
  right: 0;
  width: min(400px, calc(100vw - 24px));
  margin-top: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-strong);
}

/* Navigation drawer */
.app-shell .sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 90;
  display: flex;
  width: min(320px, calc(100vw - 28px));
  height: 100dvh;
  padding: 18px;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background: #171419;
  color: #f8f4f7;
  box-shadow: 24px 0 80px rgba(0, 0, 0, 0.35);
  opacity: 1;
  overflow-y: auto;
  transform: translateX(0);
  transition: transform 190ms ease, visibility 190ms ease;
}

.sidebar-collapsed .sidebar {
  padding: 18px;
  border-right-color: rgba(255, 255, 255, 0.08);
  opacity: 1;
  pointer-events: none;
  visibility: hidden;
  transform: translateX(-102%);
}

.sidebar-head {
  min-height: 48px;
}

.sidebar .brand {
  color: #fff;
}

.sidebar .brand small,
.sidebar .nav-group-label,
.sidebar .continue-box span {
  color: rgba(255, 255, 255, 0.52);
}

.sidebar .brand-mark {
  box-shadow: none;
}

.sidebar .sidebar-close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 22px;
}

.sidebar .nav-list {
  gap: 18px;
  margin-top: 10px;
}

.sidebar .nav-group {
  gap: 4px;
}

.sidebar .nav-group + .nav-group {
  padding-top: 16px;
  border-top-color: rgba(255, 255, 255, 0.08);
}

.sidebar .nav-item {
  min-height: 42px;
  padding: 0 11px;
  border-color: transparent;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.66);
  font-size: 14px;
}

.sidebar .nav-item:hover,
.sidebar .nav-item.active {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.sidebar .nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.sidebar .icon {
  color: var(--accent);
}

.continue-box {
  border-color: rgba(255, 255, 255, 0.1);
  background: var(--continue-bg);
  color: #fff;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: block;
  width: 100%;
  height: 100%;
  background: rgba(7, 6, 8, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.sidebar-backdrop[hidden] {
  display: none;
}

/* Featured title */
.hero,
.main-view:not(.player-mode) .hero {
  display: none;
}

.main-view[data-section="library"] .hero,
.main-view[data-section="favorites"] .hero {
  display: block;
  width: min(100%, var(--portal-width));
  min-height: 360px;
  margin: 24px auto 0;
  border: 0;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(17, 13, 18, 0.92) 0%, rgba(17, 13, 18, 0.76) 43%, rgba(17, 13, 18, 0.14) 78%, rgba(17, 13, 18, 0.08) 100%),
    url("assets/hero.png") center 43% / cover;
  box-shadow: var(--shadow-strong);
}

html[data-theme^="dark"] .main-view[data-section="library"] .hero,
html[data-theme^="dark"] .main-view[data-section="favorites"] .hero {
  background:
    linear-gradient(90deg, rgba(12, 10, 14, 0.97) 0%, rgba(12, 10, 14, 0.76) 48%, rgba(12, 10, 14, 0.2) 82%, rgba(12, 10, 14, 0.08) 100%),
    url("assets/player-night.png") center 45% / cover;
}

.hero::after {
  display: none;
}

.hero-copy {
  width: min(700px, 100%);
  min-height: 360px;
  padding: 48px 52px;
  color: #fff;
}

.hero .eyebrow {
  color: color-mix(in srgb, var(--accent) 78%, #fff 22%);
}

.hero h1 {
  max-width: 15ch;
  margin-top: 12px;
  color: #fff;
  font-size: clamp(36px, 4.4vw, 62px);
  line-height: 0.98;
}

.hero-copy p {
  max-width: 55ch;
  margin-top: 16px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 16px;
  line-height: 1.55;
}

.hero-meta {
  margin-top: 18px;
}

.hero .meta-token {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(18, 14, 19, 0.48);
  color: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
}

.hero-actions {
  margin-top: 24px;
}

.hero .primary-btn,
.primary-btn {
  min-height: 44px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--primary-text);
  box-shadow: none;
}

.hero .ghost-btn {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(16, 13, 17, 0.54);
  color: #fff;
  backdrop-filter: blur(12px);
}

/* Catalog */
.content-grid {
  display: block;
  width: min(100%, var(--portal-width));
  margin: 34px auto 0;
}

.content-grid[hidden] {
  display: none;
}

.catalog-panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.resume-banner {
  grid-template-columns: 62px minmax(0, 1fr) auto;
  min-height: 86px;
  margin-bottom: 30px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.resume-banner:hover {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
  border-left-color: var(--accent);
  background: var(--panel-strong);
}

.resume-poster {
  width: 54px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 6px;
}

.resume-action {
  min-height: 38px;
  padding: 0 13px;
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.section-head {
  align-items: end;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.section-head h2,
.community-page .section-head h2,
.chat-page .section-head h2 {
  margin-top: 5px;
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.04;
}

.section-description {
  max-width: 62ch;
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
}

.catalog-sort {
  min-width: 220px;
}

.catalog-sort select {
  min-height: 42px;
  border-color: var(--line);
  background: var(--panel);
}

.chips {
  margin: -4px 0 18px;
}

.status-chip,
.chip {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.anime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  justify-content: stretch;
  gap: 24px 16px;
  padding-bottom: 30px;
  overflow: visible;
}

.anime-card {
  display: flex;
  min-height: 0;
  padding-bottom: 0;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 8px;
  background: var(--card-bg);
  box-shadow: 0 12px 28px color-mix(in srgb, var(--text) 8%, transparent);
  overflow: hidden;
  contain: none;
  content-visibility: visible;
  contain-intrinsic-size: none;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.anime-card:hover,
.anime-card:focus-visible {
  border-color: color-mix(in srgb, var(--accent-2) 52%, var(--line));
  background: var(--card-bg);
  box-shadow: 0 18px 38px color-mix(in srgb, var(--text) 14%, transparent);
  transform: translateY(-3px);
}

.poster {
  border-radius: 0;
  background:
    linear-gradient(150deg, color-mix(in srgb, var(--poster-a) 74%, #2c2430 26%), color-mix(in srgb, var(--poster-b) 70%, #131116 30%));
  box-shadow: 0 14px 32px rgba(25, 17, 23, 0.14);
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}

.anime-card:hover .poster,
.anime-card:focus-visible .poster {
  transform: none;
  box-shadow: none;
  filter: saturate(1.06);
}

.poster::before {
  width: 100%;
  height: 55%;
  inset: auto 0 0;
  border: 0;
  border-radius: 0;
  background: linear-gradient(0deg, rgba(13, 10, 14, 0.78), transparent);
}

.poster-code {
  left: 12px;
  bottom: 12px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 25px;
}

.poster-state,
.poster-favorite,
.poster-rating,
.poster-open {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(15, 12, 16, 0.7);
  color: #fff;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.poster-state {
  top: 10px;
  left: 10px;
}

.poster-rating {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  color: #ffd674;
  font-size: 10px;
  font-weight: 900;
}

.poster-favorite {
  top: 10px;
  right: 10px;
}

.poster-open {
  right: auto;
  left: 50%;
  bottom: 50%;
  min-width: 100px;
  text-align: center;
  transform: translate(-50%, 50%) scale(0.96);
}

.anime-card:hover .poster-open,
.anime-card:focus-visible .poster-open {
  transform: translate(-50%, 50%) scale(1);
}

.anime-card[data-type="manga"] .poster {
  border-right: 5px solid color-mix(in srgb, var(--text) 20%, transparent);
  border-radius: 0;
}

.card-body {
  min-height: 96px;
  padding: 11px 12px 10px;
  overflow: hidden;
  background: var(--card-bg);
}

.card-body strong {
  min-height: 38px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.27;
}

.card-body .card-genres {
  min-height: 18px;
  margin-top: 5px;
  -webkit-line-clamp: 1;
  color: var(--muted);
  font-size: 11px;
}

.card-body .progress-track {
  margin-top: 9px;
}

.card-footer {
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
}

.card-footer span:last-child {
  color: var(--accent-2);
}

.empty-state {
  min-height: 280px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 70%, transparent);
}

/* Player and reader */
.main-view.player-mode .content-grid {
  display: grid;
  width: min(100%, 1380px);
  max-width: none;
  margin-top: 26px;
}

.watch-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(360px, 26vw, 400px);
  gap: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.player-back {
  grid-column: 1 / -1;
  grid-row: 1;
  justify-self: start;
  min-height: 38px;
  border-color: var(--line);
  background: transparent;
}

.player {
  grid-column: 1;
  grid-row: 2;
  align-self: start;
  border-radius: 8px;
  background: #050507;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
}

.watch-sidebar {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  grid-column: 2;
  grid-row: 2 / span 2;
  align-self: start;
  gap: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.watch-info {
  align-items: start;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.watch-info h2 {
  font-size: 24px;
  line-height: 1.08;
}

.side-description {
  color: var(--muted);
  line-height: 1.55;
}

.rating-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 14px;
  border-block: 1px solid var(--line);
}

.rating-row span {
  grid-column: 1 / -1;
  margin: 0;
}

.rating-row button {
  width: 100%;
  min-width: 0;
  height: 42px;
}

.episode-row {
  gap: 7px;
}

.episode-btn {
  min-width: 42px;
  min-height: 38px;
  border-radius: 8px;
}

.reader-tools {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 8;
}

.reader-tools[hidden] {
  display: none;
}

.reader-tools > summary {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  background: rgba(12, 10, 14, 0.78);
  color: #fff;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.26);
  cursor: pointer;
  list-style: none;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.reader-tools > summary::-webkit-details-marker {
  display: none;
}

.reader-tools > summary span {
  font-size: 20px;
  line-height: 1;
}

.reader-tools[open] > summary {
  border-color: color-mix(in srgb, var(--accent-2) 72%, #fff 28%);
  background: color-mix(in srgb, var(--accent) 52%, rgba(12, 10, 14, 0.88));
}

.reader-tools:not([open]) > .reader-settings {
  display: none;
}

.reader-settings {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  grid-template-columns: 1fr;
  width: min(310px, calc(100vw - 42px));
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 94%, transparent);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.reader-zone:focus-visible {
  outline-offset: -5px;
}

.watch-panel > .comments-panel {
  grid-column: 1;
  grid-row: 3;
  margin-top: 10px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.comment-item,
.comment-empty {
  border-radius: 8px;
  background: var(--panel-soft);
}

/* Page foundations */
.community-page,
.chat-page,
.title-page,
.profile-page,
.settings-page,
.admin-panel,
.admin-stats-page,
.not-found-page {
  width: min(100%, 1380px);
  margin: 30px auto 0;
}

.title-page[hidden] {
  display: none !important;
}

.title-page-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin-bottom: 16px;
  background: transparent;
}

.title-page-hero {
  position: relative;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: end;
  gap: 30px;
  min-height: 390px;
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: #121016;
  box-shadow: var(--shadow-strong);
  overflow: hidden;
  isolation: isolate;
}

.title-page-backdrop {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-position: center;
  background-size: cover;
  transform: scale(1.02);
}

.title-page-hero::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(12, 10, 14, 0.92) 0%, rgba(12, 10, 14, 0.72) 52%, rgba(12, 10, 14, 0.42) 100%),
    linear-gradient(0deg, rgba(12, 10, 14, 0.72), transparent 58%);
  content: "";
}

.title-page-poster {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 3;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  background: linear-gradient(145deg, var(--poster-a), var(--poster-b));
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.34);
  overflow: hidden;
}

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

.title-page-poster > span {
  position: absolute;
  right: 16px;
  bottom: 14px;
  color: #fff;
  font-size: 30px;
  font-weight: 950;
}

.title-page-poster.has-image > span {
  display: none;
}

.title-page-copy {
  max-width: 760px;
  padding-bottom: 4px;
  color: #fff;
}

.title-page-copy .eyebrow {
  color: color-mix(in srgb, var(--accent) 78%, #fff 22%);
}

.title-page-copy h1 {
  max-width: 18ch;
  margin-top: 10px;
  color: #fff;
  font-size: clamp(38px, 4.4vw, 66px);
  line-height: 0.98;
}

.title-page-copy > p {
  max-width: 62ch;
  margin-top: 16px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 15px;
  line-height: 1.6;
}

.title-page-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 18px;
}

.title-page-meta span {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(10, 8, 12, 0.42);
  color: rgba(255, 255, 255, 0.84);
  font-size: 10px;
  font-weight: 850;
  backdrop-filter: blur(10px);
}

.title-page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 24px;
}

.title-page-actions button {
  min-height: 48px;
  padding-inline: 18px;
}

.title-page-actions .ghost-btn {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(12, 10, 14, 0.54);
  color: #fff;
}

.title-page-actions .ghost-btn.active {
  border-color: color-mix(in srgb, var(--accent) 72%, #fff 28%);
  color: color-mix(in srgb, var(--accent) 76%, #fff 24%);
}

.title-page-progress {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 16px;
  width: min(460px, 100%);
  margin-top: 20px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 11px;
}

.title-page-progress strong {
  justify-self: end;
  color: #fff;
}

.title-page-progress .progress-track {
  grid-column: 1 / -1;
  background: rgba(255, 255, 255, 0.16);
}

.title-page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  align-items: start;
  gap: 16px;
  margin-top: 16px;
}

.title-page-section {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.title-page-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.title-page-section-head h2 {
  margin-top: 5px;
  font-size: 26px;
}

.title-page-count {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--nav-active-bg);
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 950;
}

.title-unit-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.title-unit {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 11px;
  min-width: 0;
  min-height: 70px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-soft);
  color: var(--text);
  text-align: left;
}

.title-unit:hover,
.title-unit.active {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
  transform: translateY(-1px);
}

.title-unit-index,
.title-unit-action {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--panel);
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 950;
}

.title-unit-copy {
  min-width: 0;
}

.title-unit-copy strong,
.title-unit-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-unit-copy strong {
  font-size: 14px;
}

.title-unit-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.title-page-aside {
  display: grid;
  gap: 12px;
}

.title-rating-row {
  grid-template-columns: repeat(5, 42px);
  justify-content: space-between;
  margin-top: 12px;
  padding: 0;
  border: 0;
}

.title-rating-row button {
  width: 42px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
}

.title-facts {
  display: grid;
  gap: 0;
  margin-top: 10px;
}

.title-facts > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 42px;
  border-bottom: 1px solid var(--line);
}

.title-facts > div:last-child {
  border-bottom: 0;
}

.title-facts span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.title-facts strong {
  text-align: right;
  font-size: 12px;
}

.title-related-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.title-related-list button {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  text-align: left;
}

.title-related-list button:hover {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
  transform: translateY(-1px);
}

.title-related-list span,
.title-related-list small {
  color: var(--accent-2);
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
}

.title-related-list strong {
  font-size: 12px;
  line-height: 1.3;
}

@media (max-width: 1080px) {
  .title-page-hero {
    grid-template-columns: 180px minmax(0, 1fr);
    min-height: 340px;
    padding: 28px;
  }

  .title-page-layout {
    grid-template-columns: minmax(0, 1fr) 280px;
  }

  .title-unit-list {
    grid-template-columns: 1fr;
  }
}

.profile-page {
  container-type: inline-size;
}

.community-page,
.chat-page,
.admin-panel,
.admin-stats-page {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.community-page > .section-head,
.chat-page > .section-head,
.admin-panel > .section-head,
.admin-stats-page > .section-head {
  min-height: 92px;
  margin-bottom: 20px;
}

.section-refresh,
.icon-btn {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.community-composer {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.community-composer > summary {
  min-height: 54px;
  padding: 0 16px;
}

.community-form {
  padding: 0 16px 16px;
}

.community-card,
.schedule-card,
.request-card,
.forum-topic,
.forum-post,
.public-profile-card,
.notification-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: none;
}

.community-card:hover,
.forum-topic:hover,
.public-profile-card:hover {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
  transform: translateY(-1px);
}

.news-list,
.schedule-list,
.request-list,
.profile-list {
  gap: 10px;
}

.schedule-list {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.chat-page-layout {
  grid-template-columns: minmax(0, 1fr) 340px;
  min-height: 640px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-page-messages {
  padding: 18px;
  background: var(--panel-soft);
}

.chat-page-form {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  align-self: stretch;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: var(--panel);
}

.chat-page-form textarea {
  flex: 0 0 150px;
  min-height: 150px;
}

.chat-page-form .primary-btn {
  flex: 0 0 auto;
  width: 100%;
  min-height: 46px;
  max-height: 46px;
}

.chat-message,
.dm-message {
  border-radius: 8px;
  background: var(--panel);
}

.forum-layout {
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
}

.forum-topic-rail,
.forum-thread {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.forum-topic-list {
  gap: 4px;
}

.forum-topic {
  border-color: transparent;
  background: transparent;
}

.forum-topic.current {
  border-color: transparent;
  background: var(--nav-active-bg);
}

/* Drawers */
.chat-drawer,
.messages-drawer,
.notifications-drawer {
  position: fixed;
  inset: var(--header-h) 0 0 auto;
  z-index: 70;
  height: calc(100dvh - var(--header-h));
  border: 0;
  border-left: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel-strong);
  box-shadow: -24px 0 70px rgba(0, 0, 0, 0.22);
  animation: nyan-drawer-enter 300ms var(--motion-ease) both;
}

.chat-drawer,
.notifications-drawer {
  width: min(430px, 100vw);
}

.messages-drawer {
  width: min(880px, 100vw);
}

.chat-drawer-head {
  min-height: 78px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.message-layout {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.message-users {
  border-right: 1px solid var(--line);
  background: var(--panel-soft);
}

.message-user {
  border-radius: 8px;
}

.quick-settings[open] .quick-settings-panel,
.reader-tools[open] .reader-settings {
  transform-origin: top right;
  animation: nyan-popover-enter 220ms var(--motion-ease) both;
}

.notification-pill.has-unread strong,
.nav-item.has-unread::after {
  animation: nyan-notification-pop 360ms var(--motion-spring) both;
}

/* Profile */
.profile-hero {
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: clamp(260px, 25cqw, 345px);
  max-height: none;
  aspect-ratio: auto;
  border: 0;
  border-radius: 8px;
  background-color: #171419;
  box-shadow: var(--shadow-strong);
}

.profile-hero:not(.has-banner) {
  min-height: 330px;
  max-height: none;
  aspect-ratio: auto;
  background:
    linear-gradient(110deg, #171419 0%, #282229 58%, color-mix(in srgb, var(--accent) 44%, #282229) 100%);
}

.profile-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(90deg, rgba(13, 11, 15, 0.92), rgba(13, 11, 15, 0.48) 62%, rgba(13, 11, 15, 0.18));
  pointer-events: none;
}

.profile-hero-shade {
  position: relative;
  z-index: 1;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 36px 42px;
  background: transparent;
}

.profile-identity {
  position: relative;
  z-index: 1;
  align-items: end;
}

.profile-hero .account-large {
  width: 132px;
  height: 132px;
  border: 4px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
}

.profile-hero h2 {
  color: #fff;
  font-size: clamp(38px, 5vw, 64px);
}

.profile-hero p,
.profile-public-code {
  color: rgba(255, 255, 255, 0.68);
}

.profile-role {
  color: var(--accent);
}

.profile-edit-link {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(13, 11, 15, 0.48);
  color: #fff;
}

.profile-hero .profile-edit-link,
.profile-hero.has-banner .profile-edit-link {
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(13, 11, 15, 0.68);
  color: #fff;
}

.profile-dashboard {
  gap: 16px;
  margin-top: 18px;
}

.profile-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.profile-stats {
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.profile-stat {
  min-height: 104px;
  border-color: var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.profile-title-card,
.profile-activity > * {
  border-radius: 8px;
}

.profile-module {
  --module-accent: var(--accent);
  position: relative;
  min-width: 0;
  overflow: hidden;
  grid-column: span 6;
}

.profile-module::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: var(--module-accent);
  content: "";
}

.profile-module-width-full {
  grid-column: 1 / -1;
}

.profile-module-width-two-thirds {
  grid-column: span 8;
}

.profile-module-width-half {
  grid-column: span 6;
}

.profile-module-width-third {
  grid-column: span 4;
}

.profile-module-soft {
  border-color: color-mix(in srgb, var(--module-accent) 26%, var(--line));
  background: color-mix(in srgb, var(--module-accent) 8%, var(--panel));
}

.profile-module-outline {
  border-color: color-mix(in srgb, var(--module-accent) 58%, var(--line));
  background: transparent;
  box-shadow: none;
}

.profile-module-accent {
  border-color: color-mix(in srgb, var(--module-accent) 54%, var(--line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--module-accent) 22%, transparent), transparent 58%),
    var(--panel);
}

.profile-module-compact {
  padding: 16px;
}

.profile-module-compact .profile-section-head {
  padding-bottom: 10px;
}

.profile-module-compact .profile-title-list,
.profile-module-compact .profile-activity,
.profile-module-compact .profile-stats {
  margin-top: 10px;
}

.profile-module-compact .profile-title-card,
.profile-module-compact .profile-activity article {
  min-height: 62px;
}

.profile-module-align-center .profile-section-head {
  justify-content: center;
  text-align: center;
}

.profile-module-align-center .profile-section-count {
  position: absolute;
  right: 18px;
}

.profile-custom-copy {
  margin-top: 16px;
  color: var(--soft);
  font-size: 16px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.profile-module-align-center .profile-custom-copy {
  text-align: center;
}

.profile-modules-empty {
  grid-column: 1 / -1;
  padding: 34px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

/* Settings */
.settings-page-head {
  margin-bottom: 18px;
}

.settings-workspace {
  display: grid;
  grid-template-columns: 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.settings-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel-soft);
}

.settings-tab {
  min-height: 68px;
  padding: 12px 18px;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  text-align: left;
}

.settings-tab:last-child {
  border-right: 0;
}

.settings-tab.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: inset 0 -3px 0 var(--accent);
}

.settings-panels {
  padding: 28px;
}

.settings-panel {
  max-width: 980px;
}

.settings-panel-head {
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.settings-option-list,
.privacy-grid,
.telegram-connection,
.banner-summary-panel,
.settings-profile-preview {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  box-shadow: none;
}

.settings-option,
.privacy-option {
  border-radius: 0;
  background: transparent;
}

.settings-account-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.settings-modules-card {
  max-width: 1180px;
}

.profile-modules-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.profile-modules-head h3 {
  margin-bottom: 5px;
  font-size: clamp(26px, 3vw, 36px);
}

.profile-modules-head p {
  margin: 0;
  color: var(--muted);
}

.profile-module-total {
  flex: 0 0 auto;
  min-width: 76px;
  padding: 10px 15px;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, var(--panel-soft));
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.profile-studio-preview {
  overflow: hidden;
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line));
  border-radius: 26px;
  background: color-mix(in srgb, var(--accent) 6%, var(--panel-soft));
}

.profile-studio-preview-head,
.profile-module-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.profile-studio-preview-head {
  margin-bottom: 15px;
  padding-inline: 3px;
}

.profile-studio-preview-head small,
.profile-studio-preview-head strong,
.profile-module-list-head small,
.profile-module-list-head strong {
  display: block;
}

.profile-studio-preview-head small,
.profile-module-list-head small {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-studio-preview-head strong,
.profile-module-list-head strong {
  font-size: 16px;
}

.profile-studio-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--soft);
  font-size: 11px;
  font-weight: 800;
}

.profile-studio-live i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #54c987;
  box-shadow: 0 0 0 5px color-mix(in srgb, #54c987 16%, transparent);
}

.profile-module-preview {
  min-height: 270px;
  padding: 24px;
  border: 1px solid color-mix(in srgb, var(--line) 68%, transparent);
  border-radius: 21px;
  background: color-mix(in srgb, var(--panel) 94%, var(--accent) 6%);
  box-shadow: inset 0 1px 0 color-mix(in srgb, white 35%, transparent);
}

.profile-preview-identity {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 20px;
}

.profile-preview-identity > span:last-child,
.profile-preview-identity strong,
.profile-preview-identity small {
  display: block;
}

.profile-preview-identity strong {
  font-size: 15px;
}

.profile-preview-identity small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.profile-preview-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 15px;
  background: color-mix(in srgb, var(--accent) 25%, var(--panel-soft));
  color: var(--text);
  font-weight: 900;
}

.profile-preview-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 9px;
}

.profile-preview-module {
  --preview-accent: var(--accent);
  grid-column: span 6;
  min-width: 0;
  min-height: 76px;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--preview-accent) 28%, var(--line));
  border-radius: 15px;
  background: var(--panel-soft);
}

.profile-preview-width-full { grid-column: 1 / -1; }
.profile-preview-width-two-thirds { grid-column: span 8; }
.profile-preview-width-half { grid-column: span 6; }
.profile-preview-width-third { grid-column: span 4; }

.profile-preview-soft {
  background: color-mix(in srgb, var(--preview-accent) 10%, var(--panel-soft));
}

.profile-preview-outline {
  border-color: color-mix(in srgb, var(--preview-accent) 62%, var(--line));
  background: transparent;
}

.profile-preview-accent {
  border-color: color-mix(in srgb, var(--preview-accent) 52%, var(--line));
  background: color-mix(in srgb, var(--preview-accent) 20%, var(--panel));
}

.profile-preview-module header {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.profile-preview-module header > span {
  color: var(--preview-accent);
}

.profile-preview-module header strong {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-preview-pattern {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-top: 11px;
}

.profile-preview-pattern i {
  height: 18px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--preview-accent) 18%, var(--panel));
}

.profile-preview-pattern-activity,
.profile-preview-pattern-custom {
  grid-template-columns: 1fr;
}

.profile-preview-pattern-activity i,
.profile-preview-pattern-custom i {
  height: 4px;
  border-radius: 999px;
}

.profile-preview-pattern-activity i:nth-child(n + 4),
.profile-preview-pattern-custom i:nth-child(n + 3) {
  display: none;
}

.profile-preview-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 110px;
  border: 1px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.profile-module-builder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 26px;
}

.profile-module-builder-actions button {
  min-height: 48px;
  padding-inline: 17px;
  border-radius: 16px;
}

.profile-module-builder-actions button span {
  margin-right: 5px;
  font-size: 18px;
}

.profile-module-list-head {
  margin-bottom: 12px;
  padding-inline: 4px;
}

.profile-module-list-head > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.profile-module-builder {
  display: grid;
  gap: 14px;
}

.profile-module-editor {
  --module-editor-accent: var(--accent);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--module-editor-accent) 20%, var(--line));
  border-radius: 24px;
  background: var(--panel-soft);
  box-shadow: 0 10px 30px color-mix(in srgb, var(--bg) 42%, transparent);
  transition: border-color 160ms ease, opacity 160ms ease, transform 160ms ease;
}

.profile-module-editor:not(.is-enabled) {
  opacity: 0.58;
}

.profile-module-editor-head {
  display: grid;
  grid-template-columns: 54px minmax(150px, 1fr) auto auto auto;
  align-items: center;
  gap: 13px;
  min-height: 82px;
  padding: 14px 16px;
}

.profile-module-editor-title strong,
.profile-module-editor-title small {
  display: block;
}

.profile-module-editor-title small {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.profile-module-editor-title strong {
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-module-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 17px;
  background: color-mix(in srgb, var(--module-editor-accent) 20%, var(--panel));
  color: var(--module-editor-accent);
  font-size: 18px;
  font-weight: 900;
}

.profile-module-icon small {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 2px solid var(--panel-soft);
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  font-size: 8px;
}

.profile-module-reorder {
  display: inline-flex;
  gap: 4px;
}

.profile-module-reorder button,
.profile-module-remove {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 13px;
  background: var(--panel);
  color: var(--soft);
  font-weight: 900;
}

.profile-module-reorder button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--module-editor-accent) 18%, var(--panel));
  color: var(--text);
}

.profile-module-reorder button:disabled {
  opacity: 0.28;
}

.profile-module-enabled {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--soft);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.profile-module-enabled input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.profile-module-enabled i {
  position: relative;
  width: 46px;
  height: 28px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 30%, var(--panel));
  transition: background 160ms ease;
}

.profile-module-enabled i::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.2);
  content: "";
  transition: transform 160ms ease;
}

.profile-module-enabled input:checked + span + i,
.profile-module-enabled input:checked ~ i {
  background: var(--module-editor-accent);
}

.profile-module-enabled input:checked ~ i::after {
  transform: translateX(18px);
}

.profile-module-enabled input:focus-visible ~ i {
  outline: 3px solid color-mix(in srgb, var(--module-editor-accent) 36%, transparent);
  outline-offset: 2px;
}

.profile-module-remove {
  background: color-mix(in srgb, #df5f7d 10%, var(--panel));
  color: #df5f7d;
}

.profile-module-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 0 16px 14px;
  padding: 4px;
  border-radius: 15px;
  background: var(--panel);
}

.profile-module-mode button {
  min-height: 40px;
  border-radius: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.profile-module-mode button.active {
  background: color-mix(in srgb, var(--module-editor-accent) 18%, var(--panel-soft));
  color: var(--text);
  box-shadow: 0 3px 10px color-mix(in srgb, var(--bg) 32%, transparent);
}

.profile-module-simple,
.profile-module-advanced {
  padding: 0 16px 16px;
}

.profile-module-simple {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 12px;
}

.profile-module-advanced {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.profile-module-simple[hidden],
.profile-module-advanced[hidden] {
  display: none;
}

.profile-module-quick-group,
.profile-module-setting-group {
  min-width: 0;
  padding: 15px;
  border: 1px solid color-mix(in srgb, var(--line) 74%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 76%, transparent);
}

.profile-module-quick-group > header,
.profile-module-setting-group > header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.profile-module-quick-group > header strong,
.profile-module-quick-group > header small,
.profile-module-setting-group > header strong,
.profile-module-setting-group > header small {
  display: block;
}

.profile-module-quick-group > header small,
.profile-module-setting-group > header small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.profile-module-setting-group > header > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--module-editor-accent) 16%, var(--panel-soft));
  color: var(--module-editor-accent);
  font-size: 12px;
  font-weight: 900;
}

.profile-layout-choices {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
}

.profile-style-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.profile-layout-choice,
.profile-style-choice {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  min-height: 94px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--panel-soft);
  color: var(--soft);
  text-align: left;
}

.profile-layout-choice.is-selected,
.profile-style-choice.is-selected {
  border-color: color-mix(in srgb, var(--module-editor-accent) 52%, var(--line));
  background: color-mix(in srgb, var(--module-editor-accent) 14%, var(--panel-soft));
  color: var(--text);
}

.profile-layout-choice > span:last-child,
.profile-layout-choice strong,
.profile-layout-choice small,
.profile-style-choice > span:last-child,
.profile-style-choice strong,
.profile-style-choice small {
  display: block;
  min-width: 0;
}

.profile-layout-choice strong,
.profile-style-choice strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
}

.profile-layout-choice small,
.profile-style-choice small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.profile-layout-glyph,
.profile-style-glyph {
  display: flex;
  align-items: stretch;
  width: 100%;
  height: 24px;
  padding: 4px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--line) 54%, transparent);
}

.profile-layout-glyph i,
.profile-style-glyph i {
  display: block;
  border-radius: 4px;
  background: var(--module-editor-accent);
}

.profile-layout-glyph-full i { width: 100%; }
.profile-layout-glyph-two-thirds i { width: 68%; }
.profile-layout-glyph-half i { width: 50%; }
.profile-layout-glyph-third i { width: 34%; }

.profile-style-glyph i { width: 100%; }
.profile-style-glyph-soft i { opacity: 0.5; }
.profile-style-glyph-accent { background: color-mix(in srgb, var(--module-editor-accent) 20%, var(--panel)); }

.profile-module-setting-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.profile-module-setting-text {
  grid-column: span 1;
}

.profile-module-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.profile-module-field > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.profile-module-field input,
.profile-module-field select,
.profile-module-field textarea {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 13px;
  outline: 0;
  background: var(--input-bg);
  color: var(--text);
}

.profile-module-field input:focus,
.profile-module-field select:focus,
.profile-module-field textarea:focus {
  border-color: var(--module-editor-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--module-editor-accent) 15%, transparent);
}

.profile-module-field textarea {
  resize: vertical;
  line-height: 1.5;
}

.profile-module-field-wide {
  grid-column: 1 / -1;
}

.profile-module-color-field input {
  padding: 6px;
  cursor: pointer;
}

/* Admin */
.admin-category-tabs {
  position: sticky;
  top: calc(var(--header-h) + 8px);
  z-index: 12;
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: var(--shadow);
  overflow-x: auto;
  backdrop-filter: blur(16px);
}

.admin-category-tabs button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 7px;
}

.admin-card,
.admin-users-panel,
.admin-stat-card {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.admin-upload-form {
  padding: 0;
  overflow: hidden;
}

.admin-builder-titlebar {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.admin-builder-progress {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.admin-builder-workspace {
  padding: 20px;
}

.admin-builder-layout {
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 20px;
}

.admin-builder-steps {
  align-self: start;
  gap: 5px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.admin-builder-steps button {
  border-radius: 7px;
}

.admin-builder-steps button.active {
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.admin-builder-panel {
  border: 0;
  background: transparent;
}

.admin-builder-panel.active {
  animation: nyan-builder-step 300ms var(--motion-ease) both;
}

.admin-builder-footer {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.admin-community-grid,
.admin-stats-summary,
.admin-stats-grid {
  gap: 12px;
}

.admin-user-row,
.admin-activity-card,
.moderation-upload-card,
.bug-report-card {
  border-radius: 8px;
  background: var(--panel-soft);
}

.manga-page-grid {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.manga-page-card {
  min-width: 0;
  min-height: 250px;
  padding: 10px;
  border-radius: 18px;
  background: var(--panel-soft);
  box-shadow: 0 12px 30px color-mix(in srgb, var(--text) 7%, transparent);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.manga-page-card:hover {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  box-shadow: 0 16px 36px color-mix(in srgb, var(--accent) 13%, transparent);
  transform: translateY(-2px);
}

.manga-page-media {
  position: relative;
  min-width: 0;
}

.manga-page-media img,
.manga-page-media .manga-page-placeholder {
  display: block;
  border-radius: 12px;
}

.manga-page-replacing {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel-strong) 82%, transparent);
  color: var(--text);
  font-weight: 900;
  backdrop-filter: blur(8px);
}

.manga-page-card.is-replacing {
  pointer-events: none;
}

.manga-page-card.is-replacing .manga-page-replacing {
  display: grid;
  animation: nyan-soft-pulse 900ms ease-in-out infinite alternate;
}

.manga-pending-remove {
  position: absolute;
  z-index: 3;
  top: 9px;
  right: 9px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--danger) 42%, var(--line));
  border-radius: 50%;
  background: color-mix(in srgb, var(--panel-strong) 88%, transparent);
  color: var(--danger);
  font-size: 20px;
  line-height: 1;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--text) 12%, transparent);
  backdrop-filter: blur(10px);
}

.manga-pending-remove:hover {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 15%, var(--panel-strong));
  transform: scale(1.06);
}

.manga-page-footer {
  display: grid;
  gap: 8px;
  min-width: 0;
  margin-top: 9px;
}

.manga-page-footer small {
  min-width: 0;
  margin: 0;
}

.manga-page-replace {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 10%, var(--panel));
  color: var(--text);
  font-weight: 900;
}

.manga-page-replace:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--panel));
}

.manga-page-replace span {
  color: var(--accent-2);
  font-size: 18px;
  line-height: 1;
}

.manga-page-upload {
  border-radius: 18px;
  background: color-mix(in srgb, var(--accent) 7%, var(--panel-soft));
}

#mangaPageImage.is-page-turning {
  animation: nyan-page-turn 320ms var(--motion-ease) both;
}

.rating-row button.active {
  animation: nyan-rating-pop 260ms var(--motion-spring) both;
}

/* Inputs, dialogs and legal */
input,
textarea,
select {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
}

textarea {
  line-height: 1.5;
}

.ghost-btn {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--ghost-bg);
}

.age-dialog-card,
.account-dialog-card,
.banner-editor-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: var(--shadow-strong);
}

.age-dialog[open],
.account-dialog[open] {
  animation: nyan-dialog-shell 220ms ease-out both;
}

.age-dialog[open] .age-dialog-card,
.account-dialog[open] .account-dialog-card,
.account-dialog[open] .banner-editor-card {
  animation: nyan-dialog-card 300ms var(--motion-ease) both;
}

.age-dialog[open]::backdrop,
.account-dialog[open]::backdrop {
  animation: nyan-backdrop 220ms ease-out both;
}

.auth-tabs {
  border-radius: 8px;
  background: var(--panel-soft);
}

.legal-footer {
  width: min(100%, var(--portal-width));
  margin: 28px auto 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

/* Matte glass variation */
html[data-glass="on"] body {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 16%, var(--bg)) 0%, var(--bg) 42%, color-mix(in srgb, var(--accent-2) 10%, var(--bg)) 100%);
  background-attachment: fixed;
}

html[data-glass="on"] .topbar,
html[data-glass="on"] .sidebar,
html[data-glass="on"] .quick-settings-panel,
html[data-glass="on"] .watch-sidebar,
html[data-glass="on"] .comments-panel,
html[data-glass="on"] .profile-card,
html[data-glass="on"] .settings-workspace,
html[data-glass="on"] .admin-card,
html[data-glass="on"] .admin-users-panel,
html[data-glass="on"] .admin-stat-card,
html[data-glass="on"] .chat-drawer,
html[data-glass="on"] .messages-drawer,
html[data-glass="on"] .notifications-drawer {
  border-color: color-mix(in srgb, var(--accent) 22%, var(--line));
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16), var(--shadow);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
}

html[data-theme^="dark"][data-glass="on"] {
  --bg: #111017;
  --panel: rgba(29, 26, 35, 0.82);
  --panel-strong: rgba(34, 30, 40, 0.9);
  --panel-soft: rgba(19, 17, 23, 0.7);
  --input-bg: rgba(27, 24, 31, 0.82);
  --muted: #c2bac1;
  --soft: #e5dfe3;
}

html[data-theme^="dark"] .anime-card .poster {
  background:
    linear-gradient(150deg, color-mix(in srgb, var(--poster-a) 48%, #2c2630 52%), color-mix(in srgb, var(--poster-b) 34%, #111014 66%));
}

@keyframes nyan-view-enter {
  from {
    opacity: 0;
    transform: translate3d(var(--view-enter-x, 0), 8px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes nyan-card-enter {
  from {
    opacity: 0;
    transform: translate3d(0, 12px, 0) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes nyan-drawer-enter {
  from {
    opacity: 0;
    transform: translate3d(28px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes nyan-popover-enter {
  from {
    opacity: 0;
    transform: translate3d(0, -6px, 0) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes nyan-builder-step {
  from {
    opacity: 0;
    transform: translate3d(10px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes nyan-dialog-shell {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes nyan-dialog-card {
  from {
    opacity: 0;
    transform: translate3d(0, 14px, 0) scale(0.975);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes nyan-backdrop {
  from { background-color: rgba(28, 15, 24, 0); }
  to { background-color: rgba(28, 15, 24, 0.52); }
}

@keyframes nyan-notification-pop {
  0% { transform: scale(0.72); }
  68% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes nyan-rating-pop {
  0% { transform: scale(0.72) rotate(-8deg); }
  70% { transform: scale(1.16) rotate(3deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes nyan-page-turn {
  from {
    opacity: 0.35;
    transform: translate3d(8px, 0, 0) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes nyan-soft-pulse {
  from { opacity: 0.72; }
  to { opacity: 1; }
}

@media (max-width: 1220px) {
  .topbar,
  .topbar.no-search {
    grid-template-columns: 44px 148px auto minmax(190px, 1fr) auto;
  }

  .topbar.no-search {
    grid-template-columns: 44px 148px minmax(300px, 1fr) auto;
  }

  .topbar-brand-copy small,
  .top-primary-nav .nav-item .icon,
  .notification-pill > .notification-label,
  .quick-settings > summary span:last-child {
    display: none;
  }

  .notification-symbol {
    display: inline;
  }

  .top-primary-nav .nav-item {
    padding-inline: 9px;
  }

  .notification-pill {
    width: 42px;
    padding: 0;
  }

  .watch-panel {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}

@media (max-width: 980px) {
  :root {
    --header-h: 126px;
  }

  .main-view {
    padding-inline: 18px;
  }

  .topbar,
  .topbar.no-search {
    grid-template-columns: 44px 148px minmax(0, 1fr) auto;
    width: calc(100% + 36px);
    min-height: var(--header-h);
    margin-inline: -18px;
    padding-inline: 18px;
  }

  .top-primary-nav {
    grid-column: 3;
    grid-row: 1;
  }

  .topbar > .search-field {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    max-width: none;
  }

  .topbar.no-search {
    min-height: 72px;
  }

  .topbar.no-search > .search-field {
    display: none;
  }

  .hero-copy {
    padding: 40px;
  }

  .anime-grid {
    grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
  }

  .watch-panel {
    grid-template-columns: 1fr;
  }

  .watch-sidebar {
    position: static;
    grid-column: 1;
    grid-row: 3;
  }

  .watch-panel > .comments-panel {
    grid-column: 1;
    grid-row: 4;
  }

  .chat-page-layout {
    grid-template-columns: 1fr;
  }

  .chat-page-form {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .profile-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-builder-layout {
    grid-template-columns: 1fr;
  }

  .admin-builder-steps {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    overflow-x: auto;
  }
}

@media (max-width: 780px) {
  :root {
    --header-h: 118px;
  }

  body {
    padding-bottom: 70px;
  }

  .main-view {
    padding: 0 12px 42px;
  }

  .topbar,
  .topbar.no-search {
    grid-template-columns: 42px minmax(0, 1fr) auto;
    width: calc(100% + 24px);
    margin-inline: -12px;
    padding: 8px 12px;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .topbar-brand {
    grid-column: 2;
    min-width: 0;
  }

  .topbar-brand-copy small {
    display: none;
  }

  .topbar-brand .brand-mark {
    width: 34px;
    height: 34px;
  }

  .topbar .top-actions,
  .topbar.no-search .top-actions {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    width: auto;
    max-width: none;
    overflow: visible;
  }

  .notification-pill,
  .quick-settings > summary {
    width: 40px;
    min-width: 40px;
    padding: 0;
  }

  .notification-pill {
    position: relative;
  }

  .notification-pill strong {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 18px;
    height: 18px;
    padding-inline: 4px;
  }

  .account-pill {
    width: 40px;
    min-width: 40px;
    padding: 0;
  }

  .account-pill > span:last-child {
    display: none;
  }

  .top-primary-nav {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 75;
    display: grid;
    grid-column: auto;
    grid-row: auto;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    width: 100%;
    min-height: 64px;
    padding: 6px max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    box-shadow: 0 -12px 34px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .top-primary-nav .nav-item {
    display: grid;
    grid-template-rows: 18px auto;
    justify-items: center;
    gap: 2px;
    min-height: 50px;
    padding: 4px 3px;
    border-radius: 7px;
    font-size: 10px;
  }

  .top-primary-nav .nav-item .icon {
    display: grid;
    width: 18px;
    min-width: 18px;
    font-size: 13px;
  }

  .main-view[data-section="library"] .hero,
  .main-view[data-section="favorites"] .hero {
    min-height: 330px;
    margin-top: 14px;
    background-position: 58% center;
  }

  .hero-copy {
    justify-content: flex-end;
    min-height: 330px;
    padding: 28px 24px;
    background: linear-gradient(0deg, rgba(12, 10, 14, 0.94) 0%, rgba(12, 10, 14, 0.44) 68%, transparent 100%);
  }

  .hero h1 {
    max-width: 18ch;
    font-size: clamp(32px, 9vw, 46px);
  }

  .hero-copy p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 14px;
  }

  .content-grid {
    margin-top: 24px;
  }

  .section-head {
    align-items: start;
  }

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

  .card-body strong {
    min-height: 34px;
    font-size: 13px;
  }

  .card-body {
    min-height: 78px;
  }

  .card-body .card-genres {
    font-size: 10px;
  }

  .card-footer {
    display: none;
  }

  .poster-rating {
    right: 7px;
    bottom: 7px;
    padding: 4px 6px;
  }

  .poster-state {
    top: 7px;
    left: 7px;
  }

  .watch-panel,
  .main-view.player-mode .content-grid {
    margin-top: 16px;
  }

  .comments-panel,
  .watch-sidebar {
    padding: 16px;
  }

  .reader-tools {
    top: 10px;
    right: 10px;
  }

  .community-page,
  .chat-page,
  .title-page,
  .profile-page,
  .settings-page,
  .admin-panel,
  .admin-stats-page,
  .not-found-page {
    margin-top: 18px;
  }

  .forum-layout {
    grid-template-columns: 1fr;
  }

  .forum-topic-rail {
    max-height: 260px;
  }

  .profile-hero,
  .profile-hero-shade {
    aspect-ratio: auto;
    min-height: 390px;
  }

  .profile-hero-shade {
    padding: 26px;
  }

  .profile-identity {
    align-items: start;
  }

  .profile-module-width-full,
  .profile-module-width-two-thirds,
  .profile-module-width-half,
  .profile-module-width-third {
    grid-column: 1 / -1;
  }

  .profile-modules-head {
    align-items: center;
  }

  .profile-module-simple {
    grid-template-columns: 1fr;
  }

  .profile-module-editor-head {
    grid-template-columns: 50px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 12px;
  }

  .profile-module-reorder {
    grid-column: 2;
    justify-self: start;
  }

  .profile-module-enabled {
    grid-column: 3;
    grid-row: 1;
  }

  .profile-module-remove {
    grid-column: 3;
    grid-row: 2;
  }

  .profile-module-advanced {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-tabs {
    grid-template-columns: repeat(4, minmax(112px, 1fr));
    overflow-x: auto;
  }

  .settings-panels {
    padding: 18px;
  }

  .settings-page-head > .primary-btn {
    display: inline-flex;
  }

  .settings-mobile-save {
    display: none;
  }

  .admin-category-tabs {
    top: calc(var(--header-h) + 6px);
  }

  .chat-drawer,
  .messages-drawer,
  .notifications-drawer {
    inset: 0;
    z-index: 100;
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border-left: 0;
  }

  .legal-footer {
    padding-inline: 4px;
  }
}

@media (max-width: 520px) {
  .topbar-brand-copy strong {
    font-size: 15px;
  }

  .quick-settings {
    display: none;
  }

  .hero-copy {
    padding: 24px 18px;
  }

  .hero-meta {
    gap: 5px;
  }

  .hero .meta-token {
    padding: 5px 7px;
    font-size: 10px;
  }

  .resume-banner {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px;
    padding: 9px;
  }

  .resume-poster {
    width: 44px;
  }

  .resume-action {
    grid-column: 2;
    justify-self: start;
  }

  .section-head {
    display: grid;
  }

  .catalog-sort {
    width: 100%;
  }

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

  .poster-code {
    font-size: 20px;
  }

  .profile-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .profile-card {
    padding: 16px;
  }

  .profile-modules-head {
    align-items: flex-start;
  }

  .profile-modules-head p {
    font-size: 13px;
  }

  .profile-module-total {
    min-width: 64px;
    padding: 8px 10px;
  }

  .profile-studio-preview {
    margin-inline: -8px;
    padding: 12px;
    border-radius: 22px;
  }

  .profile-studio-live {
    font-size: 0;
  }

  .profile-module-preview {
    min-height: 230px;
    padding: 16px;
    border-radius: 18px;
  }

  .profile-preview-module {
    min-height: 70px;
    padding: 9px;
  }

  .profile-module-list-head > span {
    display: none;
  }

  .profile-module-editor-head {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    padding: 12px;
  }

  .profile-module-icon {
    width: 46px;
    height: 46px;
    border-radius: 16px;
  }

  .profile-module-editor-title strong {
    font-size: 15px;
  }

  .profile-module-enabled > span {
    display: none;
  }

  .profile-module-mode {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 0 12px 12px;
  }

  .profile-module-mode button {
    min-width: 0;
  }

  .profile-module-simple,
  .profile-module-advanced {
    grid-template-columns: 1fr;
    padding: 0 12px 12px;
  }

  .profile-layout-choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-style-choices {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .profile-module-setting-grid {
    grid-template-columns: 1fr;
  }

  .manga-page-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .manga-page-card {
    min-height: 0;
    padding: 8px;
    border-radius: 15px;
  }

  .manga-page-media img,
  .manga-page-media .manga-page-placeholder,
  .manga-page-replacing {
    border-radius: 10px;
  }

  .manga-page-replace {
    min-height: 36px;
    padding-inline: 8px;
    font-size: 12px;
  }

  .profile-module-quick-group,
  .profile-module-setting-group {
    padding: 13px;
    border-radius: 16px;
  }

  .profile-module-builder-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .profile-module-builder-actions > button {
    width: 100%;
  }

  .settings-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .settings-tab {
    min-height: 62px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    white-space: normal;
  }

  .settings-tab:nth-child(2n) {
    border-right: 0;
  }

  .settings-tab:nth-last-child(-n + 2) {
    border-bottom: 0;
  }

  .settings-tab small {
    display: none;
  }

  .settings-page-head > .primary-btn {
    width: 100%;
  }

  .admin-builder-workspace,
  .admin-users-panel {
    padding: 14px;
  }
}

/* Stability pass: keep dense pages predictable and cheap to paint. */
@media (hover: none), (pointer: coarse) {
  .anime-card,
  .community-card,
  .forum-topic,
  .public-profile-card,
  .notification-item,
  .nav-item,
  .primary-btn,
  .ghost-btn {
    transition-duration: 0s;
  }

  .anime-card:hover,
  .anime-card:focus-visible,
  .community-card:hover,
  .forum-topic:hover,
  .public-profile-card:hover {
    transform: none;
  }

  .anime-card:hover .poster,
  .anime-card:focus-visible .poster {
    filter: none;
  }
}

@media (max-width: 780px) {
  body {
    overflow-x: clip;
  }

  .top-primary-nav {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    height: calc(64px + env(safe-area-inset-bottom));
    min-height: 0;
    background: color-mix(in srgb, var(--bg) 98%, var(--panel));
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.12);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    transform: translateZ(0);
  }

  .section-head,
  .community-page > .section-head,
  .chat-page > .section-head,
  .admin-panel > .section-head,
  .admin-stats-page > .section-head {
    min-height: 0;
    margin-bottom: 14px;
    padding-bottom: 14px;
  }

  .chat-page-layout {
    grid-template-rows: auto auto;
    gap: 0;
    min-height: 0;
    overflow: visible;
    box-shadow: none;
  }

  .chat-page-messages {
    height: clamp(220px, 30dvh, 320px);
    min-height: 220px;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .chat-page-form {
    gap: 8px;
    padding: 12px;
  }

  .chat-page-form textarea {
    flex-basis: 96px;
    min-height: 96px;
    max-height: 160px;
  }

  .chat-messages,
  .dm-messages,
  .notifications-list,
  .message-users,
  .forum-topic-rail {
    overscroll-behavior: contain;
  }

  .anime-card {
    content-visibility: auto;
    contain-intrinsic-size: auto 330px;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--text) 7%, transparent);
  }

  .title-page {
    margin-top: 18px;
  }

  .title-page-back {
    margin-bottom: 12px;
  }

  .title-page-hero {
    grid-template-columns: 104px minmax(0, 1fr);
    align-items: center;
    gap: 16px;
    min-height: 0;
    padding: 18px;
    border-radius: 10px;
  }

  .title-page-poster {
    align-self: start;
  }

  .title-page-copy {
    padding: 0;
  }

  .title-page-copy h1 {
    margin-top: 6px;
    font-size: clamp(26px, 8vw, 38px);
    line-height: 1.02;
  }

  .title-page-copy > p {
    display: -webkit-box;
    margin-top: 9px;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    font-size: 12px;
    line-height: 1.45;
  }

  .title-page-meta {
    gap: 5px;
    margin-top: 10px;
  }

  .title-page-meta span {
    padding: 5px 7px;
    font-size: 8px;
  }

  .title-page-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 46px;
    margin-top: 14px;
  }

  .title-page-actions button {
    min-width: 0;
    min-height: 44px;
    padding-inline: 12px;
  }

  .title-page-actions .ghost-btn {
    width: 46px;
    padding: 0;
    font-size: 0;
  }

  .title-page-actions .ghost-btn span:first-child {
    font-size: 20px;
  }

  .title-page-progress {
    grid-column: 1 / -1;
    margin-top: 12px;
  }

  .title-page-layout {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 12px;
  }

  .title-page-section {
    padding: 16px;
  }

  .title-unit-list {
    grid-template-columns: 1fr;
  }

  .title-page-aside {
    grid-template-columns: 1fr;
  }

  .main-view.is-view-entering :is(.anime-card, .community-card, .schedule-card, .request-card, .forum-topic, .public-profile-card, .profile-module-card):nth-child(n + 9) {
    animation: none;
  }

  .poster-state,
  .poster-favorite,
  .poster-rating,
  .poster-open {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  html[data-glass="on"] .sidebar,
  html[data-glass="on"] .topbar,
  html[data-glass="on"] .quick-settings-panel,
  html[data-glass="on"] .chat-drawer,
  html[data-glass="on"] .messages-drawer,
  html[data-glass="on"] .notifications-drawer,
  html[data-glass="on"] .watch-sidebar,
  html[data-glass="on"] .comments-panel,
  html[data-glass="on"] .profile-card,
  html[data-glass="on"] .settings-workspace,
  html[data-glass="on"] .admin-card,
  html[data-glass="on"] .admin-users-panel {
    background: color-mix(in srgb, var(--panel-strong) 94%, var(--accent) 6%);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.13);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --motion-fast: 1ms;
    --motion-base: 1ms;
    --motion-slow: 1ms;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
  }

  .sidebar,
  .poster,
  .anime-card,
  .community-card,
  button,
  a,
  summary {
    transition: none;
  }
}

/* Linked anime and manga share one public title surface. */
.title-media-switch {
  display: inline-flex;
  align-items: stretch;
  min-width: 0;
  padding: 3px;
  border: 1px solid color-mix(in srgb, var(--accent) 48%, rgba(255, 255, 255, 0.2));
  border-radius: 9px;
  background: rgba(12, 10, 14, 0.55);
}

.title-media-switch .title-primary-action {
  min-width: 128px;
  border: 0;
  border-radius: 6px;
  box-shadow: none;
}

.title-media-switch.is-paired .title-primary-action + .title-primary-action {
  border-left: 1px solid rgba(255, 255, 255, 0.22);
}

.title-media-switch .title-primary-action:not(:hover):not(:focus-visible) {
  background: transparent;
  color: #fff;
}

.title-media-switch .title-primary-action:hover,
.title-media-switch .title-primary-action:focus-visible {
  background: var(--accent);
  color: var(--button-text);
}

.title-media-switch .title-primary-action:disabled {
  opacity: 0.48;
}

.admin-title-metadata-field > small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

@media (max-width: 720px) {
  .title-page-hero {
    grid-template-columns: 88px minmax(0, 1fr);
    grid-template-rows: auto auto auto auto auto auto;
    align-items: start;
    gap: 8px 14px;
  }

  .title-page-poster {
    grid-column: 1;
    grid-row: 1 / span 4;
  }

  .title-page-copy {
    display: contents;
  }

  .title-page-copy > .eyebrow {
    grid-column: 2;
    grid-row: 1;
  }

  .title-page-copy > h1 {
    grid-column: 2;
    grid-row: 2;
  }

  .title-page-copy > p {
    grid-column: 2;
    grid-row: 3;
  }

  .title-page-copy > .title-page-meta {
    grid-column: 2;
    grid-row: 4;
  }

  .title-page-actions {
    grid-column: 1 / -1;
    grid-row: 5;
    width: 100%;
    margin-left: 0;
  }

  .title-media-switch {
    width: 100%;
  }

  .title-media-switch .title-primary-action {
    flex: 1 1 50%;
    min-width: 0;
  }

  .title-page-actions > .ghost-btn {
    width: 100%;
  }

  .title-page-progress {
    grid-column: 1 / -1;
    grid-row: 6;
    width: 100%;
  }
}
