/* Outfit, self-hosted. The rules mirror the CSS Google Fonts serves for
   Outfit:wght@300;400;500;600;700 (v15, latin + latin-ext): one rule per
   weight so weight matching stays the same as with the hosted version. */
/* latin-ext */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(/assets/outfit-latin-ext-DdQaqQDo.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url(/assets/outfit-latin-Bc-8i84L.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/assets/outfit-latin-ext-DdQaqQDo.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/assets/outfit-latin-Bc-8i84L.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/assets/outfit-latin-ext-DdQaqQDo.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/assets/outfit-latin-Bc-8i84L.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/assets/outfit-latin-ext-DdQaqQDo.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/assets/outfit-latin-Bc-8i84L.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/assets/outfit-latin-ext-DdQaqQDo.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
  font-family: 'Outfit';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(/assets/outfit-latin-Bc-8i84L.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  /* Abyss tokens — source of truth for the theme */
  --abyss-accent: 245, 245, 247;
  --abyss-glass-tint: 42, 42, 42;
  --abyss-radius: 12px;
  --abyss-radius-dialog: 24px;
  --abyss-radius-drawer: 32px;
  --abyss-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --abyss-ease-snappy: cubic-bezier(0.4, 0.0, 0.2, 1);

  /* HSL Color System - Apple TV Style Dark Cinematic */
  --bg-primary: hsl(240, 10%, 4%);
  --bg-secondary: hsl(240, 10%, 8%);
  --bg-tertiary: hsl(240, 10%, 12%);
  --bg-glass: rgba(var(--abyss-glass-tint), 0.69);

  --text-primary: hsl(0, 0%, 96%);
  --text-secondary: hsl(240, 5%, 65%);
  --text-muted: hsl(240, 5%, 45%);

  --accent-color: rgb(var(--abyss-accent));
  --error-color: hsl(0, 85%, 60%);
  --error-bg: hsla(0, 85%, 60%, 0.1);
  --success-color: hsl(140, 70%, 50%);

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2.5rem;
  --spacing-xxl: 4rem;

  /* Typography — Outfit stays (no license/deployment risk vs. Abyss's Google Sans import);
     used consistently across app and player, tuned toward Abyss's calm, low-tracking feel. */
  --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Borders and Blurs */
  --radius-sm: 6px;
  --radius-md: var(--abyss-radius);
  --radius-lg: var(--abyss-radius-dialog);
  --radius-xl: var(--abyss-radius-drawer);
  --blur-glass: 30px;

  /* Shadows */
  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.7);
  --shadow-card: 0 4px 30px rgba(0, 0, 0, 0.1);

  /* Transitions */
  --transition-fast: 0.2s var(--abyss-ease-snappy);
  --transition-smooth: 0.35s var(--abyss-ease);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-main);
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Read by screen readers, not shown. */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* First stop for Tab: past the navigation to the page (index.html). */
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100000;
  padding: 10px 16px;
  border-radius: 10px;
  background: #fff;
  color: #000;
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--transition-fast, 0.15s);
}

.skip-link:focus {
  transform: none;
  outline: 2px solid var(--accent-color, #fff);
  outline-offset: 2px;
}

/* A dialog is open (js/utils/modal.js): the page behind stays put. */
html.modal-open,
body.modal-open {
  overflow: hidden !important;
  overscroll-behavior: none;
}

#app {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

/* Custom premium scrollbar */
* {
  scrollbar-color: rgba(var(--abyss-accent), 0.5) transparent;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(var(--abyss-accent), 0.5);
  border-radius: var(--abyss-radius);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(var(--abyss-accent), 0.8);
}

a {
  color: inherit;
  text-decoration: none;
}

button, input {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}
/* App shell */

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

.app-main {
  flex: 1;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  padding-top: 64px;
  overflow-x: hidden;
  overflow-x: clip;
}

/* Focus lands here from the skip link; the page is the outline enough. */
.app-main:focus {
  outline: none;
}

.app-main.app-main--edge-top {
  padding-top: 0;
}

.route-view-enter {
  opacity: 0;
  transform: translate3d(0, 14px, 0) scale(0.992);
  filter: blur(6px);
}

.route-view-enter.route-view-enter-active {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  filter: blur(0);
  transition: opacity 240ms ease, transform 260ms cubic-bezier(0.22, 1, 0.36, 1), filter 240ms ease;
}

.route-view-exit {
  opacity: 0;
  transform: translate3d(0, -8px, 0) scale(0.996);
  filter: blur(4px);
  transition: opacity 140ms ease, transform 160ms ease, filter 140ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .route-view-enter,
  .route-view-enter.route-view-enter-active,
  .route-view-exit {
    opacity: 1;
    transform: none;
    filter: none;
    transition: none;
  }
}

/* Navigation bar */

/* Page containers */

.page-container {
  min-height: 100%;
  padding-top: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

/* Layout section spacing */

.content-section {
  padding: var(--spacing-xl) var(--spacing-xxl);
}

/* Responsive Grid System */

.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--spacing-lg);
  padding: var(--spacing-lg) 0;
}

@media (min-width: 768px) {
  .grid-container {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--spacing-xl);
  }
}

@media (min-width: 1200px) {
  .grid-container {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

/* Responsive Navigation */

@media (max-width: 768px) {
  .app-main {
    padding-top: 60px;
  }
  .page-container {
    padding-top: 0;
  }
  .content-section {
    padding: var(--spacing-md);
  }
}

@media (max-width: 600px) {
  .content-section {
    padding: 14px;
  }
  .grid-container {
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 12px;
    padding: 12px 0;
  }
}

@media (max-width: 380px) {
  .grid-container {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
}
:root {
  /* Fixed-navbar bottom edge (top offset + height) plus breathing room.
     Pages that render prominent content behind the transparent spotlight
     navbar (e.g. detail hero) should pad against this instead of a magic
     number, so it stays correct if the navbar's own geometry changes. */
  --spotlight-navbar-clearance: calc(max(14px, env(safe-area-inset-top)) + 44px + 24px);
}

.navbar.navbar-spotlight {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 0;
  right: 0;
  z-index: 1860;
  height: 44px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 clamp(20px, 3vw, 34px);
  pointer-events: none;
  background: transparent;
  border: 0;
  box-shadow: none;
}

/* While the drawer is open the navbar slides aside with the page and sits
   under the dimmed backdrop like everything else; the drawer's own close
   button and the backdrop take over closing. */
.navbar.navbar-spotlight.mobile-open {
  z-index: 1690;
}

.navbar-left,
.navbar-center,
.navbar-right {
  display: flex;
  align-items: center;
  pointer-events: auto;
}

.navbar-left {
  justify-content: flex-start;
}

.navbar-center {
  justify-content: center;
}

.navbar-right {
  justify-content: flex-end;
  gap: 14px;
}

.navbar-top-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 40px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(var(--abyss-glass-tint), 0.72);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.navbar-top-tab {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.88rem;
  font-weight: 650;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.navbar-top-tab:hover {
  color: rgba(255, 255, 255, 0.86);
}

.navbar-top-tab.active {
  background: rgb(var(--abyss-accent));
  color: #121212;
}

.navbar-top-tab.active:hover {
  color: #121212;
}

.navbar-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mobile-menu-button,
.navbar-action-button {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  color: rgba(255, 255, 255, 0.88);
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.navbar-action-button {
  flex-direction: row;
}

.navbar-action-button:hover,
.mobile-menu-button:hover,
.navbar.mobile-open .mobile-menu-button {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.mobile-menu-button:active,
.navbar-action-button:active {
  transform: scale(0.94);
}

.navbar-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.navbar-action-icon svg {
  display: block;
}

.mobile-menu-button {
  position: relative;
}

/* The three lines sit on the button centre and are only offset by transform,
   so the open state rotates them into an exactly centred X. */
.mobile-menu-line {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 2px;
  margin: -1px 0 0 -9px;
  border-radius: 999px;
  background: currentColor;
  transition: transform 260ms cubic-bezier(0.4, 0, 0.2, 1), opacity 160ms ease;
}

.mobile-menu-line:nth-child(1) {
  transform: translateY(-6px);
}

.mobile-menu-line:nth-child(3) {
  transform: translateY(6px);
}

.navbar.mobile-open .mobile-menu-line:nth-child(1) {
  transform: rotate(45deg);
}

.navbar.mobile-open .mobile-menu-line:nth-child(2) {
  opacity: 0;
  transform: scaleX(0.4);
}

.navbar.mobile-open .mobile-menu-line:nth-child(3) {
  transform: rotate(-45deg);
}

@media (max-width: 768px) {
  .navbar-center {
    display: none;
  }

  .navbar.navbar-spotlight {
    grid-template-columns: auto 1fr auto;
  }
}

@media (max-width: 520px) {
  :root {
    --spotlight-navbar-clearance: calc(max(10px, env(safe-area-inset-top)) + 40px + 20px);
  }

  .navbar.navbar-spotlight {
    top: max(10px, env(safe-area-inset-top));
    height: 40px;
    padding: 0 12px;
    grid-template-columns: auto 1fr auto;
    column-gap: 8px;
  }

  .navbar-top-tab {
    min-height: 30px;
    padding: 0 12px;
    font-size: 0.78rem;
  }

  .navbar-right {
    gap: 4px;
  }

  .navbar-action-button,
  .mobile-menu-button {
    width: 34px;
    height: 34px;
  }
}

/* Shared base styles reused by the app drawer (mobile-drawer.css scopes the rest) */
.navbar-item {
  position: relative;
  list-style: none;
}

.navbar-link {
  display: inline-flex;
  align-items: center;
  position: relative;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.navbar-link:hover,
.navbar-link.active {
  color: var(--text-primary);
}

.mobile-nav-icon {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
}

.mobile-nav-icon svg {
  display: block;
}

.mobile-nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
:root {
  /* How far the app slides right while the drawer is open. */
  --drawer-push: clamp(40px, 4vw, 72px);
  --drawer-width: 296px;
  --drawer-inset: 12px;
  --drawer-motion: 420ms var(--abyss-ease);
}

/* A floating glass panel on the left: header with the logo, the scrolling
   entries in the middle and the user card pinned to the bottom. On desktop
   it hovers with a margin around it; phones get a full-height sheet
   (responsive.css). */
.mobile-drawer-nav {
  position: fixed;
  top: var(--drawer-inset);
  left: var(--drawer-inset);
  bottom: var(--drawer-inset);
  width: var(--drawer-width);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(124, 92, 255, 0.10), transparent 60%),
    linear-gradient(180deg, rgba(22, 22, 27, 0.9), rgba(12, 12, 15, 0.92));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 26px;
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.62),
    0 2px 10px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(30px) saturate(140%);
  -webkit-backdrop-filter: blur(30px) saturate(140%);
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
  contain: layout paint;
  transform: translate3d(calc(-100% - var(--drawer-inset) * 2), 0, 0);
  transition: transform var(--drawer-motion), visibility 0s linear 420ms;
  z-index: 1950;
}

body.mobile-nav-open .mobile-drawer-nav {
  visibility: visible;
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
  transition: transform var(--drawer-motion), visibility 0s;
}

/* The app itself moves right with the drawer. The navbar is fixed, so it
   gets the same shift on its own instead of through the shell. */
.app-main,
.app-footer,
.navbar.navbar-spotlight {
  transition: transform var(--drawer-motion);
}

body.mobile-nav-open .app-main,
body.mobile-nav-open .app-footer,
body.mobile-nav-open .navbar.navbar-spotlight {
  transform: translate3d(var(--drawer-push), 0, 0);
}

@media (prefers-reduced-motion: reduce) {
  .mobile-drawer-nav,
  .app-main,
  .app-footer,
  .navbar.navbar-spotlight {
    transition: none;
  }
}

/* Every block flies in from the left once the drawer opens; --fly-index is
   set by mobileDrawer.js (0 = header, then labels and entries in order, the
   user card last). Closing drops the animation, so the entries stay put
   while the panel slides out. */
@keyframes mobile-drawer-fly-in {
  from {
    opacity: 0;
    transform: translate3d(-18px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

body.mobile-nav-open .mobile-drawer-header,
body.mobile-nav-open .mobile-drawer-section-label,
body.mobile-nav-open .mobile-drawer-list > .mobile-nav-link-item,
body.mobile-nav-open .mobile-drawer-footer {
  animation: mobile-drawer-fly-in 420ms var(--abyss-ease) both;
  animation-delay: calc(60ms + var(--fly-index, 0) * 32ms);
}

@media (prefers-reduced-motion: reduce) {
  body.mobile-nav-open .mobile-drawer-header,
  body.mobile-nav-open .mobile-drawer-section-label,
  body.mobile-nav-open .mobile-drawer-list > .mobile-nav-link-item,
  body.mobile-nav-open .mobile-drawer-footer {
    animation: none;
  }
}

/* Header: the logo centred, the close button in the corner. */
.mobile-drawer-header {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  padding: 22px 56px 14px;
}

.mobile-drawer-brand {
  display: block;
  border-radius: 14px;
}

.mobile-drawer-brand:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 6px;
}

.mobile-drawer-logo {
  width: 92px;
  height: auto;
  display: block;
  filter: drop-shadow(0 14px 26px rgba(90, 60, 255, 0.28));
}

.mobile-drawer-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  color: rgba(255, 255, 255, 0.62);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.mobile-drawer-close:hover,
.mobile-drawer-close:focus-visible {
  background: rgba(255, 255, 255, 0.11);
  color: var(--text-primary);
  outline: none;
}

.mobile-drawer-close:active {
  transform: scale(0.94);
}

.mobile-drawer-close .settings-header-icon {
  display: inline-flex;
}

.mobile-drawer-close svg {
  width: 16px;
  height: 16px;
}

/* Middle: the entries scroll on their own, header and card stay. */
.mobile-drawer-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 12px 12px;
  scrollbar-width: none;
}

.mobile-drawer-scroll::-webkit-scrollbar {
  display: none;
}

.mobile-drawer-scroll[hidden],
.mobile-drawer-header[hidden],
.mobile-nav-link-item[hidden] {
  display: none !important;
}

.mobile-drawer-section + .mobile-drawer-section {
  margin-top: 10px;
}

.mobile-drawer-section-label {
  margin: 0;
  padding: 14px 12px 8px;
  color: rgba(255, 255, 255, 0.34);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.mobile-drawer-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
  min-width: 0;
}

/* One entry: icon, label, and for the accordions a chevron at the end. */
.mobile-drawer-nav .navbar-link {
  position: relative;
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  padding: 0 12px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 0.93rem;
  font-weight: 560;
  letter-spacing: 0.005em;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.mobile-drawer-nav .navbar-link svg {
  width: 20px;
  height: 20px;
  opacity: 0.8;
  transition: opacity var(--transition-fast);
}

.mobile-drawer-nav .navbar-link > span[aria-hidden='true'] {
  display: inline-flex;
}

.mobile-drawer-nav .navbar-link:hover,
.mobile-drawer-nav .navbar-link:focus-visible {
  color: rgba(255, 255, 255, 0.94);
  background: rgba(255, 255, 255, 0.05);
  outline: none;
}

.mobile-drawer-nav .navbar-link:hover svg {
  opacity: 1;
}

/* Current page: a lit row with a glowing bar on the left edge. */
.mobile-drawer-nav .navbar-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.035));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.mobile-drawer-nav .navbar-link.active svg {
  opacity: 1;
}

.mobile-drawer-nav .navbar-link.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  width: 3px;
  height: 20px;
  border-radius: 0 3px 3px 0;
  background: #fff;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.7);
  transform: translateY(-50%);
}

/* Bottom: the user card and the settings gear. */
.mobile-drawer-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px 12px;
  padding: 8px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.mobile-drawer-profile {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 6px 6px;
  border-radius: 12px;
  color: var(--text-primary);
  transition: background var(--transition-fast);
}

.mobile-drawer-profile:hover,
.mobile-drawer-profile:focus-visible,
.mobile-drawer-profile.active {
  background: rgba(255, 255, 255, 0.07);
  outline: none;
}

.mobile-drawer-avatar {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6 0%, #4f46e5 55%, #0ea5e9 100%);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.mobile-drawer-user {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.mobile-drawer-user-name {
  overflow: hidden;
  font-size: 0.9rem;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-drawer-user-hint {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.44);
  font-size: 0.74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-drawer-settings {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast), transform 420ms var(--abyss-ease);
}

.mobile-drawer-settings > span {
  display: inline-flex;
}

.mobile-drawer-settings:hover,
.mobile-drawer-settings:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  outline: none;
}

.mobile-drawer-settings:hover svg {
  transform: rotate(45deg);
}

.mobile-drawer-settings svg {
  transition: transform 420ms var(--abyss-ease);
}

/* Red dot on an entry or the gear: new answers, or work for an admin. */
.mobile-drawer-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  margin-left: auto;
  border-radius: 50%;
  background: #ff5a5a;
  box-shadow: 0 0 0 3px rgba(255, 90, 90, 0.2), 0 0 10px rgba(255, 90, 90, 0.5);
}

.mobile-drawer-dot[hidden] {
  display: none;
}

.mobile-drawer-accordion-link .mobile-drawer-dot {
  margin-right: 30px;
}

.mobile-drawer-settings {
  position: relative;
}

.mobile-drawer-settings .mobile-drawer-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  margin: 0;
}
/* Filme, Serien and Publisher: the row opens the overview, the chevron at its
   end folds out genres or publishers beneath it along a thin guide line. */
.mobile-drawer-accordion-trigger {
  position: relative;
  display: flex;
  align-items: center;
}

.mobile-drawer-accordion-link {
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 48px !important;
}

.mobile-drawer-accordion-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: rgba(255, 255, 255, 0.38);
  cursor: pointer;
  appearance: none;
  transform: translateY(-50%);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.mobile-drawer-accordion-toggle:hover,
.mobile-drawer-accordion-toggle:focus-visible,
.mobile-drawer-accordion.is-open .mobile-drawer-accordion-toggle {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.92);
  outline: none;
}

.mobile-drawer-chevron {
  display: inline-flex;
  transition: transform 260ms var(--abyss-ease);
}

.mobile-drawer-chevron svg {
  width: 16px;
  height: 16px;
}

.mobile-drawer-accordion.is-open .mobile-drawer-chevron {
  transform: rotate(90deg);
}

.mobile-drawer-submenu {
  max-height: 0;
  overflow: hidden;
  margin: 2px 0 4px 21px;
  padding: 0 0 0 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  list-style: none;
  opacity: 0;
  transition:
    max-height 280ms var(--abyss-ease),
    opacity 200ms ease;
}

.mobile-drawer-submenu[hidden] {
  display: none;
}

.mobile-drawer-accordion.is-open .mobile-drawer-submenu {
  opacity: 1;
}

.mobile-drawer-submenu-item {
  list-style: none;
}

.mobile-drawer-submenu-link {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 0.85rem;
  font-weight: 520;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.mobile-drawer-submenu-link:hover,
.mobile-drawer-submenu-link:focus-visible {
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.05);
  outline: none;
}

.mobile-drawer-submenu-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.mobile-drawer-submenu-empty {
  min-height: 34px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: rgba(255, 255, 255, 0.34);
  font-size: 0.82rem;
}

@media (prefers-reduced-motion: reduce) {
  .mobile-drawer-submenu,
  .mobile-drawer-chevron {
    transition: none;
  }
}
.mobile-nav-open {
  overflow: hidden;
}

.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
  backdrop-filter: blur(14px) saturate(84%);
  -webkit-backdrop-filter: blur(14px) saturate(84%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 260ms ease, visibility 260ms ease, backdrop-filter 260ms ease;
  z-index: 1700;
}

body.mobile-nav-open .mobile-nav-backdrop {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
/* Phones: a full-height sheet from the left edge, rounded on the open side,
   with the safe areas kept free. */
@media (max-width: 768px) {
  :root {
    --drawer-push: 36px;
    --drawer-width: min(86vw, 320px);
    --drawer-inset: 0px;
  }

  .mobile-drawer-nav {
    border-left: 0;
    border-radius: 0 26px 26px 0;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mobile-drawer-header {
    padding: 18px 56px 10px;
  }

  .mobile-drawer-logo {
    width: 84px;
  }
}

/* Short screens (landscape phones, small windows): a smaller header. */
@media (max-height: 560px) {
  .mobile-drawer-header {
    padding-top: 12px;
    padding-bottom: 4px;
  }

  .mobile-drawer-logo {
    width: 64px;
  }

  .mobile-drawer-section-label {
    padding-top: 10px;
    padding-bottom: 6px;
  }

  .mobile-drawer-nav .navbar-link {
    min-height: 40px;
  }
}
/* ---------------------------------
   FOOTER — one slim line
--------------------------------- */
.app-footer {
  margin-top: var(--spacing-xxl);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: var(--bg-primary);
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-inner {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 22px clamp(20px, 5vw, 64px) calc(22px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: var(--spacing-lg);
  flex-wrap: wrap;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-weight: 600;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  text-transform: uppercase;
  transition: color var(--transition-fast);
}

.footer-brand:hover {
  color: var(--text-primary);
}

.footer-brand-logo {
  width: 28px;
  height: auto;
}

.footer-nav {
  flex: 1 1 auto;
  min-width: 0;
}

.footer-link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  list-style: none;
  justify-content: center;
}

.footer-link {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.footer-link:hover {
  color: var(--text-primary);
}

.footer-copyright {
  white-space: nowrap;
}

@media (max-width: 768px) {
  .footer-inner {
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding-top: 18px;
    text-align: center;
  }
  .footer-link-list {
    gap: 6px 14px;
  }
}
.settings-header-icon,
.settings-profile-icon,
.settings-row-icon,
.settings-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.settings-header-icon svg,
.settings-profile-icon svg,
.settings-row-icon svg,
.settings-chevron svg {
  display: block;
  flex: 0 0 auto;
}

.settings-header-button:focus-visible,
.settings-option:focus-visible,
.settings-logout-button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
}

.settings-modal-backdrop,
.settings-dialog,
.settings-panel,
.admin-users-view {
  overscroll-behavior: contain;
}

.settings-modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(18px) saturate(110%);
  -webkit-backdrop-filter: blur(18px) saturate(110%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 220ms ease, visibility 220ms ease;
  z-index: 1500;
}

.settings-modal-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* The same glass as the navigation drawer: dark, a faint violet glow from
   the top corner, hairline border. */
.settings-dialog {
  position: relative;
  width: min(440px, calc(100vw - 32px));
  max-height: min(720px, calc(100vh - 48px));
  max-height: min(720px, calc(100dvh - 48px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(120% 55% at 0% 0%, rgba(124, 92, 255, 0.13), transparent 60%),
    linear-gradient(180deg, rgba(24, 24, 29, 0.94), rgba(13, 13, 16, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 26px;
  box-shadow:
    0 40px 110px rgba(0, 0, 0, 0.7),
    0 2px 10px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(30px) saturate(140%);
  -webkit-backdrop-filter: blur(30px) saturate(140%);
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  transition: transform 380ms var(--abyss-ease), opacity 220ms ease;
}

.settings-dialog:focus {
  outline: none;
}

.settings-modal-backdrop.open .settings-dialog {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .settings-dialog {
    transition: none;
  }
}
/* Sub views (Passwort ändern) get a header with back button, title and
   close; the overview only keeps the close button in its corner. */
.settings-dialog-header {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  padding: 16px 16px 6px;
}

.settings-dialog[data-view="root"] .settings-dialog-header {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  padding: 0;
  display: flex;
  pointer-events: none;
}

.settings-dialog[data-view="root"] .settings-dialog-title,
.settings-dialog[data-view="root"] .settings-header-button.invisible {
  display: none;
}

.settings-dialog[data-view="root"] .settings-header-button {
  pointer-events: auto;
}

.settings-dialog-title {
  min-width: 0;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 680;
  line-height: 1.2;
  text-align: center;
}

.settings-header-button {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.62);
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.settings-header-button svg {
  width: 16px;
  height: 16px;
}

.settings-header-button:hover {
  background: rgba(255, 255, 255, 0.11);
  color: var(--text-primary);
}

.settings-header-button:active {
  transform: scale(0.94);
}

.settings-header-button.invisible {
  visibility: hidden;
  pointer-events: none;
}
.settings-panel {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 20px 20px;
  scrollbar-width: none;
}

.settings-panel::-webkit-scrollbar {
  display: none;
}

.settings-panel-root {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding-top: 24px;
}

.settings-panel[hidden],
.settings-section[hidden] {
  display: none !important;
}

.settings-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-section-title {
  margin: 0;
  padding: 0 4px;
  color: rgba(255, 255, 255, 0.34);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
}

/* A group of rows on one card, separated by inset hairlines. */
.settings-options {
  display: flex;
  flex-direction: column;
  padding: 4px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-option {
  position: relative;
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 10px 0 8px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 580;
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.settings-options > * + * .settings-option::before,
.settings-options > .settings-option + .settings-option::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 54px;
  right: 10px;
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
}

.settings-option:hover {
  background: rgba(255, 255, 255, 0.06);
}

.settings-option:hover::before,
.settings-option:hover + .settings-option::before {
  opacity: 0;
}

.settings-option:active {
  transform: scale(0.99);
}

.settings-option-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-option-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Row icons sit on a small tile, like the settings of a phone. */
.settings-option .settings-row-icon {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.settings-option .settings-row-icon svg {
  width: 18px;
  height: 18px;
}

.settings-chevron {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.34);
  transition: transform var(--transition-fast), color var(--transition-fast);
}

.settings-chevron svg {
  width: 16px;
  height: 16px;
}

.settings-option:hover .settings-chevron {
  color: rgba(255, 255, 255, 0.8);
  transform: translateX(2px);
}

.settings-row-icon {
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.72);
}

.settings-row-icon.settings-accent-icon {
  color: rgb(var(--abyss-accent));
}

/* Count on a row (Admin-Tools: open requests and reports) */
.settings-option-badge {
  min-width: 22px;
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: #ff5a5a;
  color: #fff;
  font-size: 0.74rem;
  font-weight: 750;
  line-height: 1.6;
  text-align: center;
}

.settings-option-badge[hidden] {
  display: none;
}
.settings-logout-section {
  padding-top: 2px;
}

.settings-logout-button {
  width: 100%;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 14px;
  color: #ff6b6b;
  background: rgba(255, 90, 90, 0.07);
  border: 1px solid rgba(255, 90, 90, 0.14);
  padding: 0 16px;
  font-size: 0.9rem;
  font-weight: 650;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.settings-logout-button:hover {
  background: rgba(255, 90, 90, 0.13);
  border-color: rgba(255, 90, 90, 0.3);
}

.settings-logout-button:active {
  transform: scale(0.99);
}

.settings-logout-button .settings-logout-icon {
  color: currentColor;
}

.settings-logout-button .settings-logout-icon svg {
  width: 18px;
  height: 18px;
}

.settings-logout-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-version {
  margin: 0;
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.72rem;
  font-weight: 520;
  letter-spacing: 0.04em;
  text-align: center;
  user-select: text;
}

.settings-status {
  min-height: 18px;
  color: var(--text-muted);
  font-size: 0.82rem;
  line-height: 1.35;
  text-align: center;
}

.settings-status.success {
  color: var(--success-color);
}

.settings-status.error {
  color: var(--error-color);
}
/* Phones: a sheet from the bottom edge, full width, rounded on top. */
@media (max-width: 600px) {
  .settings-modal-backdrop {
    align-items: flex-end;
    padding: 0;
  }

  .settings-dialog {
    width: 100%;
    max-height: calc(100dvh - 48px);
    border-bottom: 0;
    border-radius: 26px 26px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(40px);
  }

  .settings-modal-backdrop.open .settings-dialog {
    transform: translateY(0);
  }

  /* A grab handle hints that this is a sheet. */
  .settings-dialog::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 50%;
    width: 38px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.18);
    transform: translateX(-50%);
  }

  .settings-panel {
    padding: 8px 16px 16px;
  }
}
/* Account header of the settings dialog. */
.settings-profile {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 0 52px 0 4px;
}

.settings-profile-avatar {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #8b5cf6 0%, #4f46e5 55%, #0ea5e9 100%);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(79, 70, 229, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.settings-profile-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.settings-profile-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-profile-role {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.8rem;
  font-weight: 520;
}

/* Library counts: three small tiles. */
.settings-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.settings-stat {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px 12px 11px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.settings-stat .settings-row-icon {
  width: 18px;
  height: 18px;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.5);
}

.settings-stat .settings-row-icon svg {
  width: 18px;
  height: 18px;
}

.settings-accent-icon {
  color: rgb(var(--abyss-accent));
}

.settings-stat-value {
  color: var(--text-primary);
  font-size: 1.32rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.settings-stat-label {
  color: rgba(255, 255, 255, 0.45);
  font-size: 0.76rem;
  font-weight: 520;
}
.settings-password-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 6px;
}

.settings-password-intro {
  margin: 0 0 2px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.84rem;
  line-height: 1.45;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-field-label {
  padding: 0 2px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.78rem;
  font-weight: 600;
}

/* Also used by the admin user details. */
.settings-input {
  width: 100%;
  height: 48px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  color: var(--text-primary);
  padding: 0 14px;
  font-size: 0.94rem;
  outline: none;
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.settings-input:focus {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

.settings-submit {
  min-height: 48px;
  margin-top: 4px;
  border: 0;
  border-radius: 14px;
  background: #fff;
  color: #0b0b0e;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.settings-submit:hover {
  opacity: 0.92;
}

.settings-submit:active {
  transform: scale(0.99);
}

.settings-submit:disabled {
  opacity: 0.55;
  cursor: wait;
}
/* Media Card Component - Apple TV Parallax hover effect */
.media-card {
  position: relative;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  width: 100%;
}

.media-card-image-container {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3; /* Poster Aspect Ratio */
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
  background-color: var(--bg-tertiary);
  transform-style: preserve-3d;
}

/* The card (or its inner link, next to a played toggle) is a link. */
a.media-card,
.media-card-link {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.media-card-link {
  display: flex;
  flex-direction: column;
  width: 100%;
}

a.media-card:focus,
.media-card-link:focus {
  outline: none;
}

a.media-card:focus-visible .media-card-image-container,
.media-card-link:focus-visible .media-card-image-container {
  outline: 3px solid rgba(255, 255, 255, 0.85);
  outline-offset: 3px;
}

/* Landscape Mode (Continue Watching, Backdrops) */
.media-card.landscape .media-card-image-container {
  aspect-ratio: 16/9;
}

.media-card-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-smooth);
}

@media (hover: hover) and (pointer: fine) {
  .media-card:hover .media-card-image-container {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(var(--abyss-accent), 0.18);
  }

  .media-card:hover .media-card-image {
    transform: scale(1.02);
  }
}

.media-card-details {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.media-card-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--transition-fast);
}

@media (hover: hover) and (pointer: fine) {
  .media-card:hover .media-card-title {
    color: rgb(var(--abyss-accent));
  }
}

.media-card-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Playback Progress Bar (Resumable Items) */
.media-progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 5px;
  background-color: rgba(var(--abyss-accent), 0.22);
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  overflow: hidden;
  z-index: 3;
}

.media-progress-fill {
  height: 100%;
  background-color: rgb(var(--abyss-accent));
  width: 0%;
}

/* Watched check, top left so it never collides with the type badge */
.media-card-played {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background-color: rgb(var(--abyss-accent));
  color: var(--bg-primary);
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Badge overlay */
.media-card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #ffffff;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Media Carousel Component */
.horizontal-carousel-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.media-carousel-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  margin-bottom: var(--spacing-lg);
}

.carousel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-md);
  min-width: 0;
}

.carousel-title-text {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.carousel-header-action {
  flex: 0 0 auto;
  margin-left: auto;
  margin-right: var(--spacing-md);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.carousel-header-action:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* Scrolling is left to the browser: no `scroll-behavior: smooth` here, it
   turns every wheel/touch delta into a restarted animation and swallows
   most of a trackpad gesture. The arrows pass `behavior: 'smooth'` to
   scrollTo() themselves. */
.carousel-track {
  max-width: 100%;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  touch-action: pan-x pan-y;
}

.media-carousel {
  display: flex;
  align-items: flex-start; /* Prevent vertical stretching of items with varying title lengths */
  gap: var(--spacing-lg);
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  min-width: 0;
  scroll-padding-inline: 4px;
  padding: 10px 4px 20px; /* padding prevent shadow cropping */
  scrollbar-width: none;
}

.media-carousel::-webkit-scrollbar {
  display: none;
}

.media-carousel-item {
  flex: 0 0 160px; /* Default Poster width */
  min-width: 0;
}

.media-carousel.landscape-carousel .media-carousel-item {
  flex: 0 0 300px; /* Landscape width */
}

@media (min-width: 768px) {
  .media-carousel-item {
    flex: 0 0 180px;
  }
  .media-carousel.landscape-carousel .media-carousel-item {
    flex: 0 0 360px;
  }
}

/* Featured Carousel */
.featured-carousel-container {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  margin-bottom: var(--spacing-xl);
}

.featured-carousel {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-xl);
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  min-width: 0;
  scroll-padding-inline: 4px;
  padding: 10px 4px 24px;
  scrollbar-width: none;
}

.featured-carousel::-webkit-scrollbar {
  display: none;
}

.featured-carousel-item {
  flex: 0 0 180px;
  min-width: 0;
}

.featured-carousel-item.large {
  flex: 0 0 220px;
}

.featured-carousel-item .media-card {
  transition: transform 0.2s ease;
}

.featured-carousel-item .media-card:hover {
  transform: scale(1.03);
}

.featured-carousel-container .carousel-title-text {
  font-size: 1.6rem;
  font-weight: 700;
}

.featured-carousel-item .media-card-title {
  font-size: 1rem;
  font-weight: 600;
}

.featured-carousel-item .media-card-subtitle {
  font-size: 0.85rem;
}

@media (min-width: 768px) {
  .featured-carousel-item {
    flex: 0 0 200px;
  }

  .featured-carousel-item.large {
    flex: 0 0 260px;
  }

  .featured-carousel-container .carousel-title-text {
    font-size: 1.8rem;
  }

  .featured-carousel-item .media-card-title {
    font-size: 1.05rem;
  }
}

/* Local section loader: mounts inline inside the section it belongs to, never fixed/global */
.section-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  width: 100%;
  min-height: 240px;
  padding: var(--spacing-lg);
  box-sizing: border-box;
  color: var(--text-secondary);
  grid-column: 1 / -1;
}

.section-loader-compact {
  min-height: 96px;
  padding: var(--spacing-md);
}

.section-loader-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(var(--abyss-accent), 0.14);
  border-radius: 50%;
  border-top-color: rgb(var(--abyss-accent));
  animation: section-loader-spin 1s linear infinite;
}

.section-loader-compact .section-loader-spinner {
  width: 22px;
  height: 22px;
  border-width: 2px;
}

.section-loader-label {
  font-size: 0.9rem;
}

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

@media (prefers-reduced-motion: reduce) {
  .section-loader-spinner {
    animation: none;
  }
}
/* ---------------------------------
   SKELETONS
   Loading placeholders that take the footprint of the real hero and
   carousels (sizes mirror media-card.css, carousel.css, home/hero-base.css).
--------------------------------- */
.skeleton-bar,
.skeleton-card-image,
.skeleton-hero-backdrop {
  position: relative;
  overflow: hidden;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-sm);
}

.skeleton-bar::after,
.skeleton-card-image::after,
.skeleton-hero-backdrop::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.06) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
}

.skeleton-bar {
  display: block;
  height: 0.9em;
}

/* The status text stays for assistive tech; the spinner is not needed. */
.skeleton-status {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Cards */
.skeleton-card {
  width: 100%;
}

.skeleton-card-image {
  aspect-ratio: 2 / 3;
  width: 100%;
  border-radius: var(--radius-md);
}

.skeleton-card.landscape .skeleton-card-image {
  aspect-ratio: 16 / 9;
}

.skeleton-card-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.skeleton-bar-title {
  width: 70%;
  height: 0.95rem;
}

.skeleton-bar-subtitle {
  width: 40%;
  height: 0.8rem;
}

/* Carousel */
.skeleton-carousel {
  position: relative;
}

.skeleton-carousel .skeleton-bar-heading {
  width: 180px;
  height: 1.2rem;
}

.skeleton-track {
  overflow: hidden;
  pointer-events: none;
}

/* Hero */
.home-hero-skeleton .skeleton-hero-backdrop {
  border-radius: 0;
  background-color: var(--bg-secondary);
}

.home-hero-skeleton .skeleton-hero-backdrop::after {
  animation-duration: 2.2s;
}

.skeleton-hero-content {
  gap: 14px;
}

.skeleton-bar-hero-title {
  width: min(420px, 70%);
  height: 3rem;
  border-radius: var(--radius-md);
}

.skeleton-hero-meta {
  display: flex;
  gap: 8px;
}

.skeleton-bar-pill {
  width: 72px;
  height: 26px;
  border-radius: var(--abyss-radius);
}

.skeleton-bar-text {
  width: 100%;
  max-width: 560px;
  height: 0.95rem;
}

.skeleton-bar-text.short {
  width: 65%;
}

.skeleton-hero-actions {
  display: flex;
  gap: 12px;
  margin-top: 6px;
}

.skeleton-bar-button {
  width: 150px;
  height: 46px;
  border-radius: var(--radius-md);
  background-color: rgba(255, 255, 255, 0.12);
}

.skeleton-bar-button.secondary {
  width: 120px;
  background-color: var(--bg-tertiary);
}

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

@media (max-width: 768px) {
  .skeleton-bar-hero-title {
    height: 2.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-bar::after,
  .skeleton-card-image::after,
  .skeleton-hero-backdrop::after {
    animation: none;
  }
}
/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: var(--spacing-xl);
  right: var(--spacing-xl);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  z-index: 10000;
  pointer-events: none;
}

.toast-message {
  pointer-events: auto;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  font-size: 0.95rem;
  max-width: 350px;
  transform: translateY(30px);
  opacity: 0;
  animation: toast-in 0.35s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.toast-message.error {
  border-left: 4px solid var(--error-color);
}

.toast-message.success {
  border-left: 4px solid var(--success-color);
}

@keyframes toast-in {
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.toast-message.fade-out {
  animation: toast-out 0.3s ease-in forwards;
}

@keyframes toast-out {
  to {
    transform: translateY(-20px);
    opacity: 0;
  }
}

/* Buttons */
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: 12px 28px;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.btn-primary {
  background-color: rgb(var(--abyss-accent));
  color: var(--bg-primary);
}

.btn-primary:hover {
  background-color: #ffffff;
  transform: scale(1.03);
  box-shadow: 0 0 20px rgba(var(--abyss-accent), 0.2);
}

.btn-secondary {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.03);
}

@media (max-width: 768px) {
  .media-card:hover .media-card-image-container,
  .media-card:hover .media-card-image {
    transform: none;
  }

  .media-carousel-container {
    margin-bottom: var(--spacing-lg);
  }

  .carousel-header {
    gap: 10px;
    margin-bottom: 10px;
  }

  .carousel-title-text {
    font-size: 1.15rem;
  }

  .media-carousel {
    gap: 14px;
    padding: 8px 2px 16px;
  }

  .media-carousel-item {
    flex-basis: 140px;
  }

  .media-carousel.landscape-carousel .media-carousel-item {
    flex-basis: 240px;
  }

  .media-card-title {
    font-size: 0.88rem;
  }

  .media-card-subtitle {
    font-size: 0.76rem;
  }

  .btn-primary,
  .btn-secondary {
    min-height: 44px;
    padding: 11px 18px;
    border-radius: var(--abyss-radius);
    font-size: 0.95rem;
  }

  #toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .toast-message {
    width: 100%;
    max-width: none;
    padding: 12px 14px;
    font-size: 0.9rem;
  }
}

@media (max-width: 600px) {
  .media-carousel-container {
    margin-bottom: 18px;
  }

  .carousel-title-text {
    font-size: 1.02rem;
  }

  .media-carousel {
    gap: 10px;
    padding: 6px 2px 14px;
  }

  .media-carousel-item {
    flex-basis: 118px;
  }

  .media-carousel.landscape-carousel .media-carousel-item {
    flex-basis: 180px;
  }

  .media-card-details {
    margin-top: 7px;
  }

  .media-card-title {
    font-size: 0.82rem;
  }

  .media-card-subtitle {
    font-size: 0.72rem;
  }

  .btn-primary,
  .btn-secondary {
    min-height: 40px;
    padding: 9px 14px;
    border-radius: var(--abyss-radius);
    font-size: 0.88rem;
  }
}

@media (max-width: 480px) {
  .media-carousel-item {
    flex-basis: 112px;
  }

  .media-carousel.landscape-carousel .media-carousel-item {
    flex-basis: 172px;
  }
}
/* ---------------------------------
   PLAYED TOGGLE
   The check that marks an item played: 44px next to the favourite heart on
   the detail page, compact on episode cards.
--------------------------------- */
.played-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  flex: 0 0 auto;
  border-radius: var(--radius-md);
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  transition: all var(--transition-fast);
}

.played-toggle:hover {
  background-color: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.03);
}

.played-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--abyss-accent), 0.25);
}

.played-toggle[aria-pressed="true"] {
  background-color: rgb(var(--abyss-accent));
  border-color: transparent;
  color: var(--bg-primary);
}

.played-toggle[aria-pressed="true"]:hover {
  background-color: #ffffff;
}

.played-toggle.compact {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 32px;
  min-height: 32px;
  height: 32px;
  padding: 0;
  border-radius: 50%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
}

.played-toggle.compact svg {
  width: 16px;
  height: 16px;
}

.played-toggle.compact:hover {
  transform: scale(1.08);
  background-color: rgba(0, 0, 0, 0.75);
}

.played-toggle.compact[aria-pressed="true"] {
  background-color: rgb(var(--abyss-accent));
  color: var(--bg-primary);
}

.played-toggle.compact[aria-pressed="true"]:hover {
  background-color: #ffffff;
}

@media (prefers-reduced-motion: reduce) {
  .played-toggle {
    transition: none;
  }
  .played-toggle:hover,
  .played-toggle.compact:hover {
    transform: none;
  }
}
/* ---------------------------------
   CONFIRM DIALOG
--------------------------------- */
.confirm-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 1600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(18px) saturate(118%);
  -webkit-backdrop-filter: blur(18px) saturate(118%);
  animation: confirm-fade-in 160ms ease both;
}

.confirm-dialog {
  width: 100%;
  max-width: 400px;
  padding: clamp(24px, 5vw, 32px);
  background: var(--bg-glass);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  animation: confirm-pop-in 220ms var(--abyss-ease) both;
}

.confirm-dialog-title {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.3;
}

.confirm-dialog-message {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.45;
}

.confirm-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-xs);
}

.confirm-dialog-actions .btn-primary,
.confirm-dialog-actions .btn-secondary {
  min-width: 96px;
}

@keyframes confirm-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes confirm-pop-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 480px) {
  .confirm-dialog-actions {
    flex-direction: column-reverse;
  }
  .confirm-dialog-actions .btn-primary,
  .confirm-dialog-actions .btn-secondary {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .confirm-dialog-overlay,
  .confirm-dialog {
    animation: none;
  }
}
/* ---------------------------------
   PAGE HEADING
   --------------------------------- */
.page-heading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 0 auto clamp(28px, 4vw, 48px);
  text-align: center;
}

.page-heading-title {
  max-width: min(920px, 100%);
  color: var(--text-primary);
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 780;
  line-height: 1.08;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.page-heading-rule {
  width: min(220px, 38vw);
  height: 1px;
  background: rgba(255, 255, 255, 0.16);
}

.page-heading-subtitle {
  max-width: 640px;
  color: var(--text-secondary);
  font-size: clamp(0.94rem, 1.6vw, 1.05rem);
  line-height: 1.5;
}

@media (max-width: 600px) {
  .page-heading {
    gap: 10px;
    margin-bottom: 24px;
  }

  .page-heading-title {
    font-size: clamp(1.65rem, 8vw, 2.2rem);
  }

  .page-heading-rule {
    width: min(160px, 52vw);
  }
}
/* Icon-Box, wie sie von createChatIcon()/createUsersManagementIcon() aus
   navbar/icons.js gestempelt wird. Ehemals Teil des Kachel-Grids im
   Einstellungen-Dialog; die Admin-Verwaltung ist inzwischen eine eigene
   Seite (#/admin), die Icon-Box wird dort auf den Menükarten verwendet. */
.admin-tool-card-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.72);
}

/* Admin option hidden state */
.admin-option-container[hidden] {
  display: none;
}
.watch-party-dialog-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(24px) saturate(118%);
  -webkit-backdrop-filter: blur(24px) saturate(118%);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
  z-index: 1500;
}

.watch-party-dialog-backdrop.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.watch-party-dialog {
  position: relative;
  width: min(520px, calc(100vw - 36px));
  max-height: min(640px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
  padding: 22px;
  background: rgba(var(--abyss-glass-tint), 0.92);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--abyss-radius-dialog);
  box-shadow: 0 36px 96px rgba(0, 0, 0, 0.68);
  backdrop-filter: blur(30px) saturate(128%);
  -webkit-backdrop-filter: blur(30px) saturate(128%);
  transform: translateY(12px) scale(0.985);
  transition: transform 180ms ease;
}

.watch-party-dialog-backdrop.open .watch-party-dialog {
  transform: translateY(0) scale(1);
}

.watch-party-dialog-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.watch-party-dialog-header h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: var(--text-primary);
  font-size: 1.08rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-party-dialog-back {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.76);
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 1.1rem;
  line-height: 1;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.watch-party-dialog-back:hover {
  background: rgba(255, 255, 255, 0.13);
  color: var(--text-primary);
}

.watch-party-dialog-back[hidden] {
  display: none;
}

.watch-party-dialog-close {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.76);
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 1.2rem;
  line-height: 1;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.watch-party-dialog-close:hover {
  background: rgba(255, 255, 255, 0.13);
  color: var(--text-primary);
}

.watch-party-search-input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  font-size: 0.95rem;
}

.watch-party-search-input:focus {
  outline: none;
  border-color: rgba(var(--abyss-accent), 0.6);
}

.watch-party-dialog-status {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.watch-party-dialog-status[hidden] {
  display: none;
}

.watch-party-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
}

.watch-party-empty-state {
  padding: 24px 4px;
  color: var(--text-secondary);
  font-size: 0.88rem;
  text-align: center;
}
/* Season tabs (episode picker) */

.watch-party-season-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.watch-party-season-tabs[hidden] {
  display: none;
}

.watch-party-season-tab {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.watch-party-season-tab.active {
  background: rgb(var(--abyss-accent));
  color: #121212;
  border-color: transparent;
}
/* Poster card grid (suggestions / search results) */

.watch-party-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
  gap: 14px;
  max-height: min(62vh, 620px);
  overflow-y: auto;
  list-style: none;
}

.watch-party-card {
  width: 100%;
  text-align: left;
  color: var(--text-primary);
  background: transparent;
  border: none;
}

.watch-party-card:disabled {
  opacity: 0.5;
  cursor: default;
}

.watch-party-card-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 8px;
  background: var(--bg-tertiary);
}

.watch-party-card-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.watch-party-card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 7px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 750;
  text-transform: uppercase;
}

.watch-party-card-title {
  display: block;
  margin-top: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}

.watch-party-card-meta {
  display: block;
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 0.84rem;
}
/* Episode list (episode picker) */

.watch-party-episode-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(56vh, 560px);
  overflow-y: auto;
}

.watch-party-episode-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.watch-party-episode-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}

.watch-party-episode-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.watch-party-episode-index {
  flex: 0 0 auto;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
}

.watch-party-episode-title {
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Resume-vs-new choice */

.watch-party-choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.watch-party-choice-button {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-height: 60px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.045);
  text-align: left;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.watch-party-choice-button:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
}

.watch-party-choice-title {
  color: var(--text-primary);
  font-size: 0.96rem;
  font-weight: 700;
}

.watch-party-choice-meta {
  color: var(--text-secondary);
  font-size: 0.82rem;
}
/* "Zuletzt dabei": running parties the user was in */

.watch-party-recent {
  display: grid;
  gap: 8px;
}

.watch-party-recent[hidden] {
  display: none;
}

.watch-party-recent-title {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.watch-party-recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.watch-party-recent-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px 8px 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
}

.watch-party-recent-thumb {
  flex: 0 0 auto;
  width: 72px;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08) center / cover no-repeat;
}

.watch-party-recent-body {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 2px;
}

.watch-party-recent-name,
.watch-party-recent-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.watch-party-recent-name {
  color: var(--text-primary);
  font-size: 0.92rem;
  font-weight: 700;
}

.watch-party-recent-meta {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.watch-party-recent-join {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: rgb(var(--abyss-accent));
  color: #121212;
  font: 700 0.82rem Outfit, system-ui, sans-serif;
  cursor: pointer;
  transition: filter var(--transition-fast), opacity var(--transition-fast);
}

.watch-party-recent-join:hover {
  filter: brightness(0.92);
}

.watch-party-recent-join:disabled {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  cursor: default;
  filter: none;
}
.watch-party-invitation-stack {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 100100;
  width: min(340px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.watch-party-invitation-card {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  background: rgb(18, 19, 23);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
}

.watch-party-invitation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.watch-party-invitation-kicker,
.watch-party-invitation-persist {
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.2;
}

.watch-party-invitation-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.watch-party-invitation-title,
.watch-party-invitation-media {
  overflow-wrap: anywhere;
}

.watch-party-invitation-title {
  font-size: 0.94rem;
  line-height: 1.25;
  font-weight: 800;
}

.watch-party-invitation-media {
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.3;
}

.watch-party-invitation-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.watch-party-invitation-accept,
.watch-party-invitation-decline {
  min-height: 38px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 750;
}

.watch-party-invitation-accept {
  background: rgb(var(--abyss-accent));
  color: #111;
}

.watch-party-invitation-decline {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.watch-party-invitation-accept:disabled,
.watch-party-invitation-decline:disabled {
  opacity: 0.6;
  cursor: default;
}

@media (max-width: 600px) {
  .watch-party-invitation-stack {
    left: max(16px, env(safe-area-inset-left));
    right: max(16px, env(safe-area-inset-right));
    width: auto;
  }
}
/* ---------------------------------
   OFFLINE OVERLAY
   Full-screen notice while the app has no connection. offline.html carries a
   copy of these rules inline, keep both in sync.
--------------------------------- */
.offline-overlay {
  position: fixed;
  inset: 0;
  z-index: 100200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  background:
    radial-gradient(circle at 50% 30%, hsl(240, 10%, 12%) 0%, transparent 60%),
    var(--bg-primary);
  color: var(--text-primary);
}

.offline-overlay[hidden] {
  display: none;
}

.offline-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--spacing-md);
  padding: clamp(28px, 6vw, 40px);
  background: var(--bg-glass);
  backdrop-filter: blur(var(--blur-glass));
  -webkit-backdrop-filter: blur(var(--blur-glass));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: offline-card-in 320ms var(--abyss-ease) both;
}

.offline-logo {
  width: 96px;
  height: auto;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.42));
}

.offline-icon {
  width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--error-bg);
  color: var(--error-color);
  margin-top: var(--spacing-xs);
}

.offline-title {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.offline-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 34ch;
}

.offline-retry {
  margin-top: var(--spacing-sm);
  min-width: 200px;
  min-height: 48px;
}

.offline-retry[disabled] {
  opacity: 0.7;
  cursor: progress;
  transform: none;
  box-shadow: none;
}

.offline-status {
  min-height: 1.2em;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Update notice (components/updateOverlay.js): the same card, above
   everything else, the offline notice and a fullscreen player included. */
.update-overlay {
  z-index: 100300;
}

.update-icon {
  background: rgba(var(--abyss-accent), 0.14);
  color: var(--accent-color);
}

.update-versions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.update-versions[hidden] {
  display: none;
}

.update-version {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.update-version--current {
  color: var(--text-muted);
}

.update-version--next {
  color: var(--accent-color);
  background: rgba(var(--abyss-accent), 0.14);
  border-color: rgba(var(--abyss-accent), 0.3);
}

.update-version-arrow {
  color: var(--text-muted);
}

@keyframes offline-card-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .offline-card {
    animation: none;
  }
}
/* ---------------------------------
   UI-KIT — gemeinsame Bausteine der Werkzeug-Seiten (Anfragen, Meldung)
   Dasselbe Glas wie Navigation, Einstellungen und Admin-Bereich: dunkle
   Flächen, feine Kanten, kleine Versal-Überschriften über Gruppen.
   --------------------------------- */
.ui-page {
  --ui-surface: rgba(255, 255, 255, 0.04);
  --ui-surface-hover: rgba(255, 255, 255, 0.065);
  --ui-surface-strong: rgba(255, 255, 255, 0.08);
  --ui-hairline: rgba(255, 255, 255, 0.07);
  --ui-radius: 18px;
  --ui-muted: rgba(255, 255, 255, 0.5);
  --ui-faint: rgba(255, 255, 255, 0.34);
  --ui-accent: #8b5cf6;
  --ui-accent-soft: rgba(139, 92, 246, 0.18);
  --ui-danger: #ff6b6b;
  --ui-success: #4ade80;
  --ui-warning: #facc15;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: min(100%, 1100px);
  margin: 0 auto;
}

/* Flex and grid rules below must not bring hidden parts back. */
.ui-page [hidden] {
  display: none !important;
}

.ui-page.ui-page-narrow {
  width: min(100%, 720px);
}

.ui-heading {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ui-title {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.ui-subtitle {
  margin: 0;
  color: var(--ui-muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.ui-group-title {
  margin: 0;
  padding: 0 4px;
  color: var(--ui-faint);
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Segmented control (Tabs, Umfang) */
.ui-segmented {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 13px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-hairline);
}

.ui-segmented.ui-segmented-full {
  display: flex;
}

.ui-segment {
  position: relative;
  flex: 1 1 0;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.86rem;
  font-weight: 620;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.ui-segment:hover {
  color: var(--text-primary);
}

.ui-segment.is-active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.ui-segment:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ui-segment:focus-visible,
.ui-button:focus-visible,
.ui-option:focus-visible,
.ui-row:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
}

/* Cards */
.ui-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: var(--ui-radius);
  background: var(--ui-surface);
  border: 1px solid var(--ui-hairline);
}

.ui-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Search field */
.ui-search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 50px;
  padding: 0 16px;
  border-radius: 16px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-hairline);
  cursor: text;
  transition: background var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.ui-search:focus-within {
  background: var(--ui-surface-hover);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.16);
}

.ui-search > span {
  display: inline-flex;
  color: var(--ui-muted);
}

.ui-search input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.98rem;
  outline: none;
}

.ui-search input::placeholder {
  color: rgba(255, 255, 255, 0.36);
}

.ui-search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

/* Chips and status */
.ui-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.6;
  white-space: nowrap;
}

.ui-chip svg {
  width: 12px;
  height: 12px;
}

.ui-chip-success { background: rgba(74, 222, 128, 0.14); color: #86efac; }
.ui-chip-warning { background: rgba(250, 204, 21, 0.14); color: #fde68a; }
.ui-chip-danger { background: rgba(255, 90, 90, 0.14); color: #ff9b9b; }
.ui-chip-accent { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; }
.ui-chip-muted { background: rgba(255, 255, 255, 0.06); color: rgba(255, 255, 255, 0.55); }

.ui-new-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ff5a5a;
  box-shadow: 0 0 0 3px rgba(255, 90, 90, 0.2);
}

/* Buttons */
.ui-button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 0.92rem;
  font-weight: 680;
  cursor: pointer;
  transition: background var(--transition-fast), opacity var(--transition-fast), transform var(--transition-fast);
}

.ui-button:active:not(:disabled) {
  transform: scale(0.985);
}

.ui-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.ui-button-primary {
  background: #fff;
  color: #0b0b0e;
}

.ui-button-primary:hover:not(:disabled) {
  opacity: 0.92;
}

.ui-button-secondary {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.ui-button-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
}

.ui-button-ghost {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.84rem;
}

.ui-button-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

/* Selectable rows (titles, seasons, episodes) */
.ui-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ui-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--ui-surface);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.ui-row:hover:not(:disabled) {
  background: var(--ui-surface-hover);
}

.ui-row.is-selected {
  background: var(--ui-accent-soft);
  border-color: rgba(167, 139, 250, 0.5);
}

.ui-row:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.ui-row-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ui-row-title {
  overflow: hidden;
  font-size: 0.93rem;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-row-meta {
  overflow: hidden;
  color: var(--ui-muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-thumb {
  flex: 0 0 auto;
  width: 40px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(14, 165, 233, 0.1)), rgba(255, 255, 255, 0.05);
}

/* Round check indicator at the end of a selectable row */
.ui-check {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: transparent;
  transition: background var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.ui-check svg {
  width: 13px;
  height: 13px;
}

.is-selected > .ui-check {
  background: var(--ui-accent);
  border-color: var(--ui-accent);
  color: #fff;
}

/* Option cards (problem types) */
.ui-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr));
  gap: 8px;
}

.ui-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--ui-hairline);
  border-radius: 16px;
  background: var(--ui-surface);
  color: var(--text-primary);
  text-align: left;
  cursor: pointer;
  transition: background var(--transition-fast), border-color var(--transition-fast);
}

.ui-option:hover {
  background: var(--ui-surface-hover);
}

.ui-option.is-selected {
  background: var(--ui-accent-soft);
  border-color: rgba(167, 139, 250, 0.5);
}

.ui-option-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.9);
}

.ui-option.is-selected .ui-option-icon {
  background: var(--ui-accent);
  color: #fff;
}

.ui-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ui-option-text strong {
  font-size: 0.92rem;
  font-weight: 650;
}

.ui-option-text span {
  color: var(--ui-muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

/* Text input / area */
.ui-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ui-label {
  padding: 0 2px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.78rem;
  font-weight: 600;
}

.ui-textarea {
  width: 100%;
  min-height: 96px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  resize: vertical;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.ui-textarea:focus {
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

.ui-hint {
  padding: 0 2px;
  color: var(--ui-faint);
  font-size: 0.76rem;
}

.ui-empty {
  padding: 40px 16px;
  border-radius: var(--ui-radius);
  border: 1px dashed var(--ui-hairline);
  color: var(--ui-muted);
  font-size: 0.9rem;
  text-align: center;
}

.ui-empty strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text-primary);
  font-size: 1rem;
}

/* Sticky action bar at the bottom of a flow */
.ui-action-bar {
  position: sticky;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 16px;
  border-radius: 18px;
  background: rgba(20, 20, 25, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.09);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
}

.ui-action-bar-text {
  min-width: 0;
  overflow: hidden;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .ui-page {
    gap: 16px;
  }

  .ui-action-bar {
    flex-direction: column;
    align-items: stretch;
    padding: 10px;
  }

  .ui-action-bar-text {
    padding: 0 6px;
    white-space: normal;
  }

  .ui-action-bar .ui-button {
    width: 100%;
  }
}
/* ---------------------------------
   HOME PAGE (DASHBOARD)
--------------------------------- */
:root {
  /* How far the first content-section row bleeds up into the hero (see
     `.home-hero + .content-section` below). */
  --hero-overlap: clamp(84px, 15vh, 132px);
  --hero-content-bottom: clamp(150px, 20vh, 210px);
}

.home-hero {
  position: relative;
  height: min(86vh, 820px);
  min-height: 620px;
  width: 100%;
  overflow: hidden;
  margin-top: 0;
  margin-bottom: 0;
  isolation: isolate;
}

.home-hero-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center 20%;
  z-index: 1;
}

.home-hero-backdrop::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    linear-gradient(to right, rgba(4, 4, 6, 0.95) 0%, rgba(4, 4, 6, 0.6) 40%, rgba(4, 4, 6, 0) 100%),
    linear-gradient(to top, var(--bg-primary) 0%, rgba(4, 4, 6, 0.3) 50%, rgba(4, 4, 6, 0) 100%);
  z-index: 2;
}

.hero-carousel .home-hero-backdrop::after {
  display: none;
}

.home-hero-content {
  position: absolute;
  left: clamp(26px, 4.8vw, 64px);
  bottom: var(--hero-content-bottom);
  width: min(560px, calc(100vw - 48px));
  max-width: 650px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.home-hero-title {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.1;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.home-hero-logo {
  width: min(420px, 48vw);
  max-height: 130px;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.72));
}

.home-hero-metadata {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.home-hero-metadata .meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(var(--abyss-glass-tint), 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--abyss-radius);
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
}

.home-hero-desc {
  max-width: 560px;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.78);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.home-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: var(--spacing-sm);
}

.btn-hero-info {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background var(--transition-fast), transform var(--transition-fast);
}

.btn-hero-info:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.05);
}

.hero-carousel {
  position: relative;
}

.hero-carousel-backdrops {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.hero-slide-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center 22%;
  transform: scale(1.01);
  transition: opacity 0.8s ease-in-out;
  z-index: 1;
}

.hero-carousel-gradient {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    linear-gradient(90deg, rgba(4, 4, 6, 0.9) 0%, rgba(4, 4, 6, 0.5) 38%, rgba(4, 4, 6, 0.12) 72%, rgba(4, 4, 6, 0.45) 100%),
    linear-gradient(0deg, var(--bg-primary) 0%, rgba(4, 4, 6, 0.86) 10%, rgba(4, 4, 6, 0.32) 38%, rgba(4, 4, 6, 0.02) 78%);
  z-index: 2;
}

.hero-slide-content {
  transition: opacity 0.8s ease-in-out;
}

/* Stops and restarts the automatic slide change (WCAG 2.2.2). */
.hero-carousel-pause {
  position: absolute;
  right: max(var(--spacing-lg), env(safe-area-inset-right));
  bottom: var(--spacing-lg);
  z-index: 4;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  opacity: 0.75;
  transition: opacity var(--transition-fast), background var(--transition-fast);
}

.hero-carousel-pause:hover,
.hero-carousel-pause:focus-visible {
  opacity: 1;
  background: rgba(0, 0, 0, 0.55);
}

.hero-carousel-pause:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}
@media (max-width: 768px) {
  .home-hero {
    height: 74svh;
    height: 74vh;
    min-height: 560px;
    max-height: none;
    margin-top: 0;
  }
  .home-hero-backdrop {
    background-position: center top;
  }
  .home-hero-backdrop::after {
    background:
      linear-gradient(to right, rgba(4, 4, 6, 0.98) 0%, rgba(4, 4, 6, 0.78) 58%, rgba(4, 4, 6, 0.3) 100%),
      linear-gradient(to top, var(--bg-primary) 0%, rgba(4, 4, 6, 0.72) 36%, rgba(4, 4, 6, 0.12) 100%);
  }
  .hero-carousel .home-hero-backdrop::after {
    display: none;
  }
  .hero-carousel-gradient {
    background:
      linear-gradient(to right, rgba(4, 4, 6, 0.98) 0%, rgba(4, 4, 6, 0.78) 58%, rgba(4, 4, 6, 0.3) 100%),
      linear-gradient(to top, var(--bg-primary) 0%, rgba(4, 4, 6, 0.72) 36%, rgba(4, 4, 6, 0.12) 100%);
  }
  .home-hero-content {
    left: 18px;
    right: 18px;
    bottom: var(--hero-content-bottom);
    width: auto;
    max-width: none;
    gap: 12px;
  }
  .home-hero-title {
    font-size: 2rem;
    letter-spacing: 0;
    line-height: 1.08;
  }
  .home-hero-logo {
    width: min(60vw, 260px);
    max-height: 84px;
  }
  .home-hero-metadata {
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.9rem;
  }
  .home-hero-desc {
    font-size: 0.95rem;
    line-height: 1.45;
    -webkit-line-clamp: 2;
    max-height: calc(2 * 1.45em);
  }
  .home-hero-actions {
    flex-wrap: wrap;
    gap: 10px;
  }
}

.hero-slide-content:not(.active) {
  display: none;
}

.home-hero + .content-section {
  position: relative;
  z-index: 4;
  margin-top: calc(-1 * var(--hero-overlap));
  padding-top: 0;
}

@media (max-width: 768px) {
  :root {
    --hero-overlap: 94px;
    --hero-content-bottom: clamp(112px, 20svh, 150px);
  }
}

@media (max-width: 900px) and (orientation: landscape), (max-height: 500px) and (orientation: landscape) {
    :root {
        --hero-overlap: 40px;
        --hero-content-bottom: 72px;
    }
    .home-hero {
        height: 92vh;
        height: 92svh;
        min-height: 260px;
        max-height: 420px;
    }
    .home-hero-content {
        bottom: var(--hero-content-bottom);
        left: 16px;
        right: 16px;
        gap: 8px;
        max-width: 62%;
    }
    .home-hero-title {
        font-size: 1.5rem;
    }
    .home-hero-desc {
        -webkit-line-clamp: 2;
        font-size: 0.85rem;
    }
}

.home-hero::before {
  content: '';
  display: none;
}
/* ---------------------------------
   HOME SECTION EMPTY STATE
   --------------------------------- */
.media-section-empty {
  overflow: visible;
}

.media-section-loading {
  overflow: visible;
}

.media-section-loading .section-loader {
  justify-content: flex-start;
  min-height: 54px;
  padding: 8px 0;
}

.section-empty-message {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}
/* ---------------------------------
   HOME SECTION MOTION
   --------------------------------- */
@keyframes home-section-fade-up {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.content-section > * {
  animation: home-section-fade-up 0.5s var(--abyss-ease) both;
}

@media (prefers-reduced-motion: reduce) {
  .content-section > * {
    animation: none;
  }

  .hero-slide-backdrop,
  .hero-slide-content {
    transition: none;
  }
}
/* ---------------------------------
   LIBRARY PAGE
   --------------------------------- */

.library-page {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overflow-x: clip;
}

.library-content {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
}

/* Cards far outside the viewport are not laid out or painted until they come
   close; the estimate keeps the scrollbar honest, "auto" remembers the real
   height once a card was rendered. */
.library-grid > .media-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 410px;
}

@media (max-width: 1199px) {
  .library-grid > .media-card {
    contain-intrinsic-size: auto 335px;
  }
}

@media (max-width: 600px) {
  .library-grid > .media-card {
    contain-intrinsic-size: auto 220px;
  }
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--spacing-lg);
  padding: var(--spacing-lg) 0;
  width: 100%;
}

@media (min-width: 768px) {
  .library-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--spacing-xl);
  }
}

@media (min-width: 1200px) {
  .library-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }
}

@media (max-width: 768px) {
  .library-page.content-section {
    padding: var(--spacing-md);
  }
}

@media (max-width: 600px) {
  .library-page.content-section {
    padding: 14px;
  }

  .library-grid {
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 12px;
    padding: 12px 0;
  }
}

@media (max-width: 480px) {
  .library-page.content-section {
    padding: 12px;
  }

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

  .library-page .media-card-title {
    font-size: 0.78rem;
  }

  .library-page .media-card-subtitle {
    font-size: 0.7rem;
  }

  .library-page .media-card-details {
    margin-top: 6px;
  }

  .library-page .media-card-badge {
    top: 6px;
    right: 6px;
    padding: 2px 5px;
    font-size: 0.65rem;
  }
}

@media (max-width: 340px) {
  .library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

/* ---------------------------------
   INFINITE SCROLL
   --------------------------------- */
.library-sentinel {
  height: 1px;
}

.library-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--spacing-lg) 0 var(--spacing-md);
}

.library-status .section-loader {
  min-height: 72px;
}

.library-end {
  color: var(--text-muted);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

.library-error {
  width: 100%;
}
/* ---------------------------------
   SEARCH PAGE
   --------------------------------- */
.search-container {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
  max-width: 1400px;
  margin: 0 auto;
}

.search-input-wrapper {
  position: relative;
  width: 100%;
  max-width: 600px;
  margin: var(--spacing-xl) auto 0 auto;
}

.search-input-field {
  width: 100%;
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 18px 24px;
  border-radius: var(--radius-xl);
  font-size: 1.25rem;
  color: var(--text-primary);
  transition: all var(--transition-fast);
  text-align: center;
  box-shadow: var(--shadow-md);
}

.search-input-field:focus {
  outline: none;
  background: var(--bg-tertiary);
  border-color: rgba(var(--abyss-accent), 0.35);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 0 4px rgba(var(--abyss-accent), 0.08);
  transform: scale(1.02);
}

.search-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 300px;
  color: var(--text-secondary);
  gap: var(--spacing-md);
}

.search-empty-state h3 {
  font-size: 1.5rem;
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .search-input-wrapper {
    margin-top: var(--spacing-md);
  }
  .search-input-field {
    padding: 14px 16px;
    border-radius: 18px;
    font-size: 1rem;
    text-align: left;
  }
  .search-empty-state {
    min-height: 220px;
    padding: 0 var(--spacing-sm);
  }
  .search-empty-state h3 {
    font-size: 1.25rem;
  }
}
/* ---------------------------------
   DETAIL PAGE
--------------------------------- */
.detail-page {
  --detail-hero-height: clamp(600px, 76vh, 700px);
  position: relative;
  width: 100%;
  overflow: hidden;
  isolation: isolate;
  padding-bottom: 0;
}

/* The backdrop has its own height, independent of the content below it, so
   unfolding the description does not rescale the image; the bottom gradient
   fades it into the page background. */
.detail-hero-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--detail-backdrop-height, var(--detail-hero-height));
  background-size: cover;
  background-position: center 24%;
  pointer-events: none;
  z-index: 1;
}

.detail-hero-backdrop::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    linear-gradient(to right, rgba(4, 4, 6, 0.98) 0%, rgba(4, 4, 6, 0.78) 38%, rgba(4, 4, 6, 0.28) 100%),
    linear-gradient(to top, var(--bg-primary) 0%, rgba(4, 4, 6, 0.72) 22%, rgba(4, 4, 6, 0.2) 72%, rgba(4, 4, 6, 0) 100%);
  z-index: 2;
}

.detail-content {
  position: relative;
  z-index: 3;
  width: min(100%, 1480px);
  max-width: 100%;
  margin: 0 auto;
  padding: clamp(var(--spotlight-navbar-clearance), 9vh, 116px) clamp(20px, 5vw, 64px) clamp(16px, 2.5vw, 28px);
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 2.5vw, 32px);
  min-width: 0;
  min-height: var(--detail-hero-height);
}

.detail-hero-main {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  grid-template-areas:
    'poster head'
    'poster info';
  align-content: center;
  align-items: center;
  column-gap: clamp(36px, 5vw, 72px);
  row-gap: 16px;
  min-height: 0;
  min-width: 0;
}

.detail-poster {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 2/3;
  justify-self: start;
  align-self: center;
  margin-top: clamp(12px, 2vh, 28px);
  border-radius: var(--abyss-radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  background-color: #0c0c10;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.detail-poster {
  grid-area: poster;
}

.detail-info-head {
  grid-area: head;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-self: end;
  width: 100%;
  max-width: 860px;
  min-width: 0;
}

.detail-info {
  grid-area: info;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-self: start;
  width: 100%;
  max-width: 860px;
  min-width: 0;
}

.detail-title {
  font-size: 3.25rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.1;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  max-width: 900px;
}

.detail-original-title {
  display: block;
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 1.15rem;
  font-weight: 400;
}

.detail-episode-title {
  color: var(--text-secondary);
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1.35;
  max-width: 780px;
}

.detail-tagline {
  margin: 2px 0;
  color: var(--text-primary);
  opacity: 0.86;
  font-size: 1.08rem;
  font-style: italic;
}

.detail-metadata {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 1rem;
}

.metadata-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(var(--abyss-glass-tint), 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--abyss-radius);
  padding: 4px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
}

.detail-genres {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.genre-tag {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 12px;
  border-radius: var(--abyss-radius);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.detail-overview {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 780px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Clamped description that unfolds on "mehr lesen" (see expandableText.js).
   The max-height is set inline while the height animates. */
.expandable-text {
  overflow: hidden;
  transition: max-height 320ms var(--abyss-ease);
}

.expandable-text-body {
  margin: 0;
}

.expandable-text-toggle {
  display: inline;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: rgb(var(--abyss-accent));
  text-shadow: none;
  white-space: nowrap;
  cursor: pointer;
  border-radius: 4px;
}

.expandable-text-toggle:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.expandable-text-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(var(--abyss-accent), 0.25);
}

.expandable-text.is-expanded .expandable-text-toggle {
  display: block;
  margin-top: 6px;
}

@media (prefers-reduced-motion: reduce) {
  .expandable-text {
    transition: none;
  }
}

.detail-crew {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.detail-actions {
  display: flex;
  gap: var(--spacing-md);
  flex-wrap: nowrap;
  margin: 2px 0 4px;
}

/* Report a problem / request missing seasons: quiet, below the facts. */
.detail-help-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-help-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 13px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.detail-help-link svg {
  flex-shrink: 0;
}

.detail-help-link:hover,
.detail-help-link:focus-visible {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.22);
  color: var(--text-primary);
}

.detail-help-report:hover,
.detail-help-report:focus-visible {
  color: #ff8a8a;
  border-color: rgba(255, 90, 90, 0.4);
}
/* From Uiverse.io by catraco */
.heart-container {
  --heart-color: rgb(255, 92, 92);
  position: relative;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: var(--radius-md);
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all var(--transition-fast);
}

.heart-container:hover {
  background-color: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.03);
}

.heart-container .checkbox {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 20;
  cursor: pointer;
}

.heart-container .svg-container {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.heart-container .svg-outline,
        .heart-container .svg-filled {
  width: 20px;
  height: 20px;
  position: absolute;
}

.heart-container .svg-outline {
  fill: var(--text-primary);
}

.heart-container .svg-filled {
  fill: var(--heart-color);
  animation: keyframes-svg-filled 1s;
  display: none;
}

.heart-container .svg-celebrate {
  position: absolute;
  animation: keyframes-svg-celebrate .5s;
  animation-fill-mode: forwards;
  display: none;
  stroke: var(--heart-color);
  fill: var(--heart-color);
  stroke-width: 2px;
}

.heart-container .checkbox:checked~.svg-container .svg-filled {
  display: block
}

.heart-container .checkbox:checked~.svg-container .svg-celebrate {
  display: block
}

@keyframes keyframes-svg-filled {
  0% {
    transform: scale(0);
  }

  25% {
    transform: scale(1.2);
  }

  50% {
    transform: scale(1);
    filter: brightness(1.5);
  }
}

@keyframes keyframes-svg-celebrate {
  0% {
    transform: scale(0);
  }

  50% {
    opacity: 1;
    filter: brightness(1.5);
  }

  100% {
    transform: scale(1.4);
    opacity: 0;
    display: none;
  }
}
.detail-trailer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(18px, 4vw, 48px);
  background: rgba(0, 0, 0, 0.76);
  backdrop-filter: blur(20px) saturate(115%);
  -webkit-backdrop-filter: blur(20px) saturate(115%);
}

.detail-trailer-modal {
  position: relative;
  width: min(980px, 100%);
  padding: clamp(18px, 3vw, 28px);
  border-radius: var(--abyss-radius-dialog);
  background: rgba(var(--abyss-glass-tint), 0.92);
  border: 1px solid rgba(255, 255, 255, 0.13);
  box-shadow:
    0 34px 92px rgba(0, 0, 0, 0.68),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

.detail-trailer-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.09);
  font-size: 1.35rem;
  line-height: 1;
}

.detail-trailer-title {
  padding-right: 48px;
  margin-bottom: 18px;
  color: var(--text-primary);
  font-size: clamp(1.15rem, 2.4vw, 1.45rem);
  font-weight: 740;
}

.detail-trailer-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 16px;
  background: #000;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.48);
}

.detail-trailer-player,
.detail-trailer-player iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
@media (max-width: 992px) {
  .detail-page {
    --detail-hero-height: 0px;
    --detail-backdrop-height: min(70vh, 600px);
  }

  .detail-hero-backdrop {
    background-position: center top;
  }

  .detail-content {
    padding: var(--spotlight-navbar-clearance) var(--spacing-md) 20px;
    gap: var(--spacing-lg);
  }

  .detail-hero-main {
    grid-template-columns: 1fr;
    grid-template-areas:
      'poster'
      'head'
      'info';
    min-height: 0;
    column-gap: 0;
    row-gap: var(--spacing-lg);
  }

  .detail-poster {
    width: min(54vw, 210px);
    margin: 0 auto;
    justify-self: center;
  }

  .detail-info-head,
  .detail-info {
    align-items: center;
    max-width: 760px;
    margin: 0 auto;
  }

  .detail-title {
    font-size: 2.2rem;
    text-align: center;
  }

  .detail-original-title {
    font-size: 1rem;
  }

  .detail-episode-title {
    font-size: 1rem;
    text-align: center;
  }

  .detail-metadata, .detail-genres, .detail-actions {
    justify-content: center;
  }

  .detail-overview {
    text-align: center;
  }
}

@media (max-width: 600px) {
  .detail-content {
    padding-top: var(--spotlight-navbar-clearance);
  }

  .detail-poster {
    width: min(62vw, 190px);
  }

  .detail-title {
    font-size: 1.9rem;
  }
}
/* ---------------------------------
   EXTENDED DETAILS (CAST, SEASONS)
--------------------------------- */
.detail-cast-section {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 0;
  overflow: hidden;
  padding-top: 2px;
}

.detail-cast-section .carousel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: 12px;
}

.carousel-arrows {
  display: flex;
  gap: var(--spacing-sm);
}

.carousel-arrow {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.carousel-arrow svg {
  fill: currentColor;
}

.carousel-arrow:hover:not(.disabled) {
  background: var(--text-primary);
  color: var(--bg-primary);
  transform: scale(1.05);
}

.carousel-arrow.disabled {
  opacity: 0.25;
  cursor: not-allowed;
  pointer-events: none;
}

.cast-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-primary);
}

.cast-list {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-lg);
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  min-width: 0;
  scroll-padding-inline: 4px;
  padding: 8px 4px 14px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  touch-action: pan-x pan-y;
}

.cast-list::-webkit-scrollbar {
  display: none;
}

.cast-card {
  flex: 0 0 112px;
  width: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: transform var(--transition-fast), opacity var(--transition-fast);
}

.cast-card-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: center;
  cursor: pointer;
  border-radius: var(--radius-md);
}

.cast-card-button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.8);
  outline-offset: 4px;
}

.cast-card:hover {
  transform: translateY(-3px) scale(1.03);
  opacity: 0.95;
}

.cast-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  background-color: var(--bg-tertiary);
  margin-bottom: var(--spacing-xs);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-sm);
}

.cast-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.cast-role {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}
@media (max-width: 768px) {
  .detail-content {
    padding: var(--spotlight-navbar-clearance) var(--spacing-md) 16px;
    gap: 18px;
  }
  /* Poster and title side by side, the rest below across the full width */
  .detail-hero-main {
    grid-template-columns: minmax(0, 118px) minmax(0, 1fr);
    grid-template-areas:
      'poster head'
      'info info';
    column-gap: 16px;
    row-gap: 18px;
    align-items: end;
  }
  .detail-info-head,
  .detail-info {
    align-items: flex-start;
    text-align: left;
    margin: 0;
  }
  .detail-info-head {
    gap: 10px;
    padding-bottom: 4px;
  }
  .detail-title {
    font-size: 2rem;
    text-align: left;
  }
  .detail-original-title,
  .detail-episode-title {
    text-align: left;
  }
  .detail-metadata,
  .detail-genres,
  .detail-actions {
    justify-content: flex-start;
  }
  .detail-poster {
    width: 100%;
    max-width: 118px;
    margin: 0;
    justify-self: start;
  }
  .detail-info {
    gap: 12px;
    width: 100%;
  }
  .detail-title {
    font-size: 1.75rem;
    line-height: 1.12;
  }
  .detail-original-title {
    font-size: 0.9rem;
  }
  .detail-metadata {
    gap: 6px 8px;
    font-size: 0.85rem;
  }
  .metadata-item {
    padding: 3px 10px;
    font-size: 0.76rem;
  }
  .detail-genres {
    gap: 6px;
  }
  .genre-tag {
    padding: 3px 10px;
    font-size: 0.78rem;
  }
  .detail-tagline {
    font-size: 0.95rem;
  }
  /* Play across the full width, the rest in one compact row below it */
  .detail-actions {
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    margin: 4px 0;
  }
  .detail-actions .btn-primary {
    flex: 1 0 100%;
    min-height: 50px;
    font-size: 1.05rem;
  }
  .detail-actions .btn-secondary {
    flex: 1 1 auto;
    min-height: 44px;
  }
  .detail-overview {
    font-size: 0.98rem;
    line-height: 1.5;
    text-align: left;
    text-shadow: none;
  }
  .detail-crew {
    font-size: 0.85rem;
    gap: 4px;
  }
  .cast-title {
    font-size: 1.15rem;
  }
  .cast-card {
    flex-basis: 96px;
    width: 96px;
  }
  .cast-avatar {
    width: 70px;
    height: 70px;
  }
  /* Episodes as a compact list: thumbnail left, title and number beside it */
  .episodes-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .episodes-grid .media-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
  }
  .episodes-grid .media-card-image-container {
    flex: 0 0 148px;
    width: 148px;
  }
  .episodes-grid .media-card-details {
    flex: 1 1 auto;
    min-width: 0;
    margin-top: 0;
  }
  .episodes-grid .media-card-title {
    white-space: normal;
    font-size: 0.9rem;
  }
  .episodes-grid .media-card-subtitle {
    white-space: normal;
    font-size: 0.82rem;
  }

  .detail-trailer-backdrop {
    padding: 16px;
  }

  .detail-trailer-modal {
    padding: 16px;
    border-radius: 18px;
  }

  .detail-trailer-frame {
    border-radius: 12px;
  }
}
/* ---------------------------------
   ACTOR DETAILS MODAL
--------------------------------- */
.actor-modal-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  background: rgba(4, 4, 6, 0.985);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  transition: opacity var(--transition-smooth), visibility var(--transition-smooth);
}

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

.actor-modal {
  background: var(--bg-glass);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 800px;
  max-height: 85dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: var(--spacing-xl);
  position: relative;
  transform: scale(0.9);
  transition: transform var(--transition-smooth);
}

.actor-modal::-webkit-scrollbar {
  width: 6px;
}
.actor-modal::-webkit-scrollbar-track {
  background: transparent;
}
.actor-modal::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

.actor-modal-overlay.active .actor-modal {
  transform: scale(1);
}

.actor-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  z-index: 10;
}

.actor-modal-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  transform: scale(1.05);
}

.actor-profile-row {
  display: flex;
  gap: var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
  margin-top: var(--spacing-md);
}

.actor-modal-avatar {
  flex: 0 0 140px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.1);
  box-shadow: var(--shadow-md);
  background-color: var(--bg-tertiary);
}

.actor-profile-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  justify-content: center;
}

.actor-modal-name {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.actor-modal-role {
  font-size: 1.1rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.actor-metadata-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: var(--spacing-xs);
}

.actor-bio {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: var(--spacing-xl);
}

@media (max-width: 768px) {
  .carousel-arrows {
    gap: 6px;
  }

  .carousel-arrow {
    width: 34px;
    height: 34px;
  }
}

@media (max-width: 600px) {
  .actor-profile-row {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .actor-profile-info {
    align-items: center;
  }
}

.seasons-section {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-top: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  overflow: hidden;
}

.seasons-tabs {
  display: flex;
  gap: var(--spacing-sm);
  overflow-x: auto;
  scrollbar-width: none;
}

.seasons-tabs::-webkit-scrollbar {
  display: none;
}

.season-tab {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.season-tab:hover, .season-tab.active {
  background: var(--text-primary);
  color: var(--bg-primary);
}

.episodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--spacing-lg);
  margin-top: var(--spacing-sm);
}

.detail-similar-section {
  position: relative;
  z-index: 4;
  margin-top: 0;
  padding-top: 10px;
  background: var(--bg-primary);
  overflow: hidden;
}

.detail-similar-section .media-carousel-container {
  margin-bottom: 0;
}

@media (max-width: 768px) {
  .actor-modal-overlay {
    width: 100%;
    height: 100dvh;
    padding: 12px;
  }
  .actor-modal {
    width: 100%;
    max-height: calc(100dvh - 24px);
    padding: 20px 16px;
    border-radius: 16px;
  }
  .actor-modal-close {
    top: 12px;
    right: 12px;
  }
  .actor-profile-row {
    gap: var(--spacing-md);
    margin-top: 8px;
    margin-bottom: var(--spacing-lg);
  }
  .actor-modal-avatar {
    flex: 0 0 112px;
    width: 112px;
    height: 112px;
  }
  .actor-modal-name {
    font-size: 1.65rem;
    letter-spacing: 0;
  }
  .actor-bio {
    font-size: 0.95rem;
    line-height: 1.5;
  }
}
