/* ==========================================================================
   KITSUBANE — Obsidian & Crimson Kitsune Design System
   ========================================================================== */

:root,
[data-theme="cyber"] {
  color-scheme: dark;
  --bg: #060609;
  --surface: #0b0b10;
  --surface-glass: rgba(16, 14, 18, 0.8);
  --header-bg: rgba(10, 8, 12, 0.88);
  --accent: #dc2626;
  --accent-secondary: #ef4444;
  --accent-soft: #fca5a5;
  --text: #f8fafc;
  --text-muted: #a1a1aa;

  --bg-primary: var(--bg);
  --bg-base: var(--bg);
  --bg-elevated: var(--surface);
  --glass-surface: var(--surface-glass);
  --glass-bg: var(--surface-glass);
  --glass-bg-elevated: rgba(22, 16, 20, 0.9);
  --glass-bg-recessed: rgba(10, 8, 12, 0.72);
  --glass-border: rgba(220, 38, 38, 0.25);
  --glass-highlight: rgba(252, 165, 165, 0.12);
  --accent-primary: var(--accent);
  --accent-glow: rgba(220, 38, 38, 0.42);
  --text-primary: var(--text);
  --text-main: var(--text);
  --text-secondary: var(--text-muted);
}

[data-theme="tokyo"] {
  color-scheme: dark;
  --bg: #090611;
  --surface: #140e21;
  --surface-glass: rgba(24, 16, 40, 0.78);
  --header-bg: rgba(14, 9, 26, 0.92);
  --accent: #a855f7;
  --accent-secondary: #ec4899;
  --accent-soft: #e9d5ff;
  --text: #faf5ff;
  --text-muted: #b8a5d6;

  --bg-primary: var(--bg);
  --bg-base: var(--bg);
  --bg-elevated: var(--surface);
  --glass-surface: var(--surface-glass);
  --glass-bg: var(--surface-glass);
  --glass-bg-elevated: rgba(34, 22, 56, 0.88);
  --glass-bg-recessed: rgba(10, 6, 18, 0.68);
  --glass-border: rgba(168, 85, 247, 0.25);
  --glass-highlight: rgba(255, 255, 255, 0.1);
  --accent-primary: var(--accent);
  --accent-glow: rgba(168, 85, 247, 0.38);
  --text-primary: var(--text);
  --text-main: var(--text);
  --text-secondary: var(--text-muted);
}

[data-theme="sakura"] {
  color-scheme: light;
  --bg: #f3f4f8;
  --surface: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.82);
  --header-bg: rgba(245, 246, 250, 0.94);
  --accent: #e11d48;
  --accent-secondary: #dc2626;
  --accent-soft: #fda4af;
  --text: #0f172a;
  --text-muted: #64748b;

  --bg-primary: var(--bg);
  --bg-base: var(--bg);
  --bg-elevated: var(--surface);
  --glass-surface: var(--surface-glass);
  --glass-bg: var(--surface-glass);
  --glass-bg-elevated: rgba(255, 255, 255, 0.94);
  --glass-bg-recessed: rgba(226, 232, 240, 0.72);
  --glass-border: rgba(225, 29, 72, 0.18);
  --glass-highlight: rgba(255, 255, 255, 0.9);
  --accent-primary: var(--accent);
  --accent-glow: rgba(225, 29, 72, 0.28);
  --text-primary: var(--text);
  --text-main: var(--text);
  --text-secondary: var(--text-muted);
}

/* ==========================================================================
   Global Reset, Viewport Lock & Single Scrollbar
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--accent) 45%, rgba(161, 161, 170, 0.3)) var(--bg);
}

html,
body {
  max-width: 100vw;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

html {
  overflow-y: auto;
  height: auto;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  overflow-x: clip !important;
  overflow-y: visible !important;
  min-height: 100vh;
  height: auto;
}

#app,
main,
.view,
#playerView,
#catalogView {
  overflow-y: visible !important;
  height: auto !important;
  max-height: none !important;
}

.kitsubane-container {
  width: 100%;
  max-width: 1400px;
  margin-inline: auto;
  padding-inline: 12px;
}

.ambient-crimson-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(60% 45% at 18% 8%, rgba(220, 38, 38, 0.12), transparent 70%),
    radial-gradient(50% 40% at 85% 22%, rgba(239, 68, 68, 0.08), transparent 70%);
}

[data-theme="sakura"] .ambient-crimson-glow {
  opacity: 0.4;
}

#player-modal {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--accent) 55%, rgba(161, 161, 170, 0.25)),
    rgba(161, 161, 170, 0.25)
  );
  border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.chip-scroll-row {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.chip-scroll-row::-webkit-scrollbar {
  display: none;
}

/* ==========================================================================
   Native Code-Driven Kitsune Preloader
   ========================================================================== */

#kitsubane-preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #000000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.45s ease;
}

#kitsubane-preloader.preloader-hidden {
  opacity: 0;
  pointer-events: none;
}

#kitsubane-preloader.preloader-done {
  display: none !important;
}

#kitsubane-preloader.preloader-done,
#kitsubane-preloader.preloader-done * {
  animation: none !important;
}

.preloader-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-inline: 16px;
}

.preloader-emblem-wrap {
  position: relative;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes kitsunePulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.94;
  }
  50% {
    transform: scale(1.03);
    opacity: 1;
  }
}

.preloader-emblem {
  width: clamp(150px, 42vw, 220px);
  aspect-ratio: 1 / 1;
  border-radius: 9999px;
  object-fit: cover;
  border: 2px solid rgba(239, 68, 68, 0.55);
  box-shadow: 0 0 32px rgba(220, 38, 38, 0.5);
  animation: kitsunePulse 2.4s ease-in-out infinite;
}

.preloader-track {
  margin-top: 28px;
  width: min(280px, 74vw);
  height: 8px;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.14);
  border: 1px solid rgba(239, 68, 68, 0.45);
  overflow: hidden;
}

.preloader-fill {
  height: 100%;
  width: 15%;
  border-radius: 999px;
  background: linear-gradient(90deg, #dc2626, #f87171);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.8);
  transition: width 0.25s ease-out;
}

.preloader-title {
  margin-top: 14px;
  font-family: "Cinzel", "Plus Jakarta Sans", serif;
  font-weight: 800;
  text-transform: uppercase;
  color: #fca5a5;
  letter-spacing: 0.18em;
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  text-shadow: 0 0 16px rgba(239, 68, 68, 0.85);
}

.preloader-petals {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

@keyframes petalDrift {
  0% {
    transform: translate3d(0, -10vh, 0) rotate(0deg) scale(0.85);
    opacity: 0;
  }
  15% {
    opacity: 0.85;
  }
  85% {
    opacity: 0.7;
  }
  100% {
    transform: translate3d(var(--drift-x, 48px), 110vh, 0) rotate(var(--rot, 280deg)) scale(1.05);
    opacity: 0;
  }
}

.preloader-petal {
  position: absolute;
  top: -8%;
  width: 12px;
  height: 22px;
  border-radius: 68% 32% 72% 28% / 60% 38% 62% 40%;
  background: linear-gradient(155deg, #f87171 0%, #dc2626 55%, #7f1d1d 100%);
  box-shadow: 0 0 10px rgba(220, 38, 38, 0.55);
  animation: petalDrift var(--dur, 7s) linear infinite;
  animation-delay: var(--delay, 0s);
}

.petal-1 { left: 10%; --dur: 7.4s; --delay: -1.2s; --drift-x: 42px; --rot: 260deg; }
.petal-2 { left: 22%; --dur: 6.2s; --delay: -3.5s; --drift-x: -36px; --rot: -240deg; width: 10px; height: 18px; }
.petal-3 { left: 36%; --dur: 8.1s; --delay: -0.6s; --drift-x: 54px; --rot: 310deg; }
.petal-4 { left: 50%; --dur: 6.8s; --delay: -4.2s; --drift-x: -44px; --rot: -290deg; width: 11px; height: 20px; }
.petal-5 { left: 64%; --dur: 7.6s; --delay: -2.1s; --drift-x: 38px; --rot: 250deg; }
.petal-6 { left: 76%; --dur: 6.5s; --delay: -5.0s; --drift-x: -50px; --rot: -320deg; width: 9px; height: 17px; }
.petal-7 { left: 86%; --dur: 7.9s; --delay: -1.7s; --drift-x: -28px; --rot: 220deg; }
.petal-8 { left: 93%; --dur: 6.9s; --delay: -3.0s; --drift-x: -60px; --rot: -270deg; width: 11px; height: 19px; }

/* ==========================================================================
   Cohesive Circular Ripple Theme Transition (View Transitions API + Fallback)
   ========================================================================== */

@keyframes themeCircleReveal {
  from {
    clip-path: circle(0px at var(--theme-x, 50%) var(--theme-y, 50%));
  }
  to {
    clip-path: circle(150vmax at var(--theme-x, 50%) var(--theme-y, 50%));
  }
}

::view-transition-old(root) {
  animation: none;
  mix-blend-mode: normal;
  z-index: 1;
}

::view-transition-new(root) {
  animation: themeCircleReveal 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
  mix-blend-mode: normal;
  z-index: 2;
}

html.theme-transitioning,
html.theme-transitioning * {
  transition:
    background-color 0.35s ease,
    color 0.35s ease,
    border-color 0.35s ease,
    box-shadow 0.35s ease !important;
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fade-in-up 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* ==========================================================================
   Obsidian & Crimson Glass Header Base
   ========================================================================== */

.site-header {
  background: var(--header-bg);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--glass-border);
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.75);
}

[data-theme="sakura"] .site-header {
  box-shadow: 0 10px 28px -12px rgba(15, 23, 42, 0.14);
}

/* ==========================================================================
   Crimson Glassmorphism Surfaces & Controls
   ========================================================================== */

.glass-pill,
.glass-pill-nav,
.glass-panel {
  background: var(--surface-glass);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 18px 36px -16px rgba(0, 0, 0, 0.68),
    inset 0 1px 0 var(--glass-highlight);
}

.glass-elevated {
  background: var(--glass-bg-elevated);
  backdrop-filter: blur(18px) saturate(165%);
  -webkit-backdrop-filter: blur(18px) saturate(165%);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 24px 48px -15px rgba(0, 0, 0, 0.75),
    inset 0 1px 0 var(--glass-highlight);
}

.glass-recessed {
  background: var(--glass-bg-recessed);
  border: 1px solid var(--glass-border);
}

.glass-input {
  background: var(--glass-bg-recessed);
  color: var(--text);
  border: 1px solid var(--glass-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.glass-input:focus {
  border-color: var(--accent-secondary);
}

.glass-input::placeholder {
  color: var(--text-muted);
}

.glass-button {
  background: var(--surface-glass);
  color: var(--text);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 10px 24px -10px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 var(--glass-highlight);
}

.glass-button:hover {
  background: var(--glass-bg-elevated);
  border-color: rgba(239, 68, 68, 0.5);
}

.glass-accent-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  color: #ffffff;
  border: 1px solid rgba(252, 165, 165, 0.28);
  box-shadow:
    0 12px 28px -8px var(--accent-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.glass-accent-btn:hover {
  filter: brightness(1.08);
}

.modal-backdrop {
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
}

/* ==========================================================================
   Rich Profile Modal (Banner, Floating Avatar, Stats & Rank Progress)
   ========================================================================== */

.profile-banner {
  position: relative;
  width: 100%;
  height: 120px;
  overflow: hidden;
  background: linear-gradient(135deg, #7f1d1d 0%, #dc2626 52%, #ef4444 100%);
}

.profile-banner-btn {
  color: #fff;
  background: rgba(10, 8, 12, 0.76);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(220, 38, 38, 0.35);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.profile-banner-btn:hover {
  background: rgba(16, 12, 16, 0.94);
  border-color: var(--accent-secondary);
}

.profile-avatar-wrap {
  position: relative;
  width: 76px;
  height: 76px;
  border-radius: 9999px;
  overflow: hidden;
  border: 4px solid var(--bg);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 10px 24px -8px rgba(0, 0, 0, 0.75);
  cursor: pointer;
}

.profile-avatar-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 6, 9, 0.62);
  color: #fff;
  font-size: 16px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.profile-avatar-wrap:hover .profile-avatar-overlay {
  opacity: 1;
}

.profile-stats-box {
  background: var(--glass-bg-recessed);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 16px;
}

.rank-progress-track {
  width: 100%;
  height: 7px;
  border-radius: 9999px;
  background: rgba(220, 38, 38, 0.16);
  overflow: hidden;
}

.rank-progress-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-soft));
  box-shadow: 0 0 14px var(--accent-glow);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   Role Badges & Comment Spoilers
   ========================================================================== */

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 9999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.03em;
  line-height: 1.4;
}

.role-badge-owner {
  background: linear-gradient(135deg, rgba(250, 204, 21, 0.24), rgba(220, 38, 38, 0.28));
  color: #fde047;
  border: 1px solid rgba(250, 204, 21, 0.45);
}

.role-badge-admin {
  background: rgba(220, 38, 38, 0.24);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.45);
}

.role-badge-mod {
  background: rgba(99, 102, 241, 0.22);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.spoiler-blur {
  filter: blur(6px);
  user-select: none;
  transition: filter 0.25s ease;
}

.spoiler-blur.spoiler-revealed {
  filter: none;
  user-select: text;
}

.spoiler-overlay-pill {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 5px 14px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: rgba(10, 8, 12, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--glass-border);
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.spoiler-overlay-pill:hover {
  background: var(--accent);
  border-color: var(--accent-secondary);
}

/* ==========================================================================
   Hero Seamless Dissolve Masks
   ========================================================================== */

.hero-fade-bottom {
  background: linear-gradient(
    to top,
    var(--bg) 0%,
    color-mix(in srgb, var(--bg) 88%, transparent) 24%,
    color-mix(in srgb, var(--bg) 35%, transparent) 62%,
    transparent 100%
  );
}

.hero-fade-left {
  background: linear-gradient(
    to right,
    var(--bg) 0%,
    color-mix(in srgb, var(--bg) 82%, transparent) 34%,
    color-mix(in srgb, var(--bg) 25%, transparent) 70%,
    transparent 100%
  );
}

/* ==========================================================================
   Locked 2:3 Poster Card Architecture (Right-Side Up Guaranteed)
   ========================================================================== */

.poster-card {
  position: relative;
  aspect-ratio: 2 / 3;
  width: 100%;
  overflow: hidden;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 20px 40px -15px rgba(0, 0, 0, 0.68),
    inset 0 1px 0 var(--glass-highlight);
  isolation: isolate;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.group:hover .poster-card {
  border-color: rgba(239, 68, 68, 0.55);
  box-shadow:
    0 20px 42px -14px rgba(220, 38, 38, 0.28),
    inset 0 1px 0 rgba(252, 165, 165, 0.2);
}

.poster-card > img,
.anime-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: none;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.group:hover .poster-card > img {
  transform: scale(1.05);
}

.poster-hover-gradient {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.25s ease;
  background: linear-gradient(
    to top,
    rgba(6, 6, 9, 0.94) 0%,
    rgba(6, 6, 9, 0.42) 45%,
    transparent 100%
  );
}

.group:hover .poster-hover-gradient {
  opacity: 1;
}

/* ==========================================================================
   Continue Watching 16:9 Card & History Controls
   ========================================================================== */

.continue-card {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  overflow: hidden;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--glass-border);
  box-shadow:
    0 20px 40px -15px rgba(0, 0, 0, 0.68),
    inset 0 1px 0 var(--glass-highlight);
  isolation: isolate;
}

.continue-card > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: none;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.group:hover .continue-card > img {
  transform: scale(1.05);
}

.continue-clear-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.continue-clear-btn:hover {
  color: #fca5a5;
  border-color: var(--accent-secondary);
  background: var(--glass-bg-elevated);
}

.cw-remove-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 20;
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(10, 8, 12, 0.8);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(220, 38, 38, 0.35);
  color: #fff;
  opacity: 0.82;
  transition: opacity 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.group:hover .cw-remove-btn,
.cw-remove-btn:focus-visible {
  opacity: 1;
}

.cw-remove-btn:hover {
  background: #dc2626;
  border-color: #ef4444;
  color: #fff;
  transform: scale(1.08);
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 9999px;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ==========================================================================
   ISOLATED DESKTOP LAYOUT (>= 1024px)
   ========================================================================== */

@media (min-width: 1024px) {
  .kitsubane-container {
    padding-inline: 24px;
  }

  .header-inner {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 24px;
  }

  .header-brand {
    order: 1;
    flex-shrink: 0;
  }

  .header-nav-desktop {
    order: 2;
    margin-inline: auto;
    flex-shrink: 0;
  }

  .header-search-wrap {
    order: 3;
    flex-shrink: 0;
  }

  .header-search-input {
    width: 240px;
    height: 40px;
  }

  .header-actions {
    order: 4;
    flex-shrink: 0;
  }

  .header-nav-mobile {
    display: none !important;
  }

  #hero-section h1 {
    font-size: clamp(2rem, 3vw, 2.75rem) !important;
    line-height: 1.12 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* ==========================================================================
   ISOLATED MOBILE & TABLET LAYOUT (< 1024px) — 60 FPS & Zero Overlap
   ========================================================================== */

@media (max-width: 1023px) {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
    max-width: 100vw;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(10, 8, 12, 0.95);
  }

  [data-theme="sakura"] .site-header {
    background: rgba(245, 246, 250, 0.96);
  }

  .header-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
  }

  .header-brand {
    order: 1;
  }

  .header-actions {
    order: 2;
  }

  .header-search-wrap {
    order: 3;
    flex-basis: 100%;
    width: 100%;
  }

  .header-search-input {
    width: 100%;
    height: 38px;
  }

  .header-nav-mobile {
    order: 4;
    flex-basis: 100%;
    width: 100%;
  }

  .header-nav-mobile .nav-btn {
    font-size: 13px !important;
    line-height: 1.2;
  }

  .header-nav-desktop {
    display: none !important;
  }

  /* 60 FPS Mobile GPU Optimization: disable heavy blur on scrolling elements */
  .glass-pill,
  .glass-pill-nav,
  .glass-panel,
  .glass-elevated,
  .glass-button,
  .modal-backdrop,
  .continue-clear-btn,
  .cw-remove-btn,
  .spoiler-overlay-pill,
  .profile-banner-btn {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(16, 14, 18, 0.94);
  }

  [data-theme="sakura"] .glass-pill,
  [data-theme="sakura"] .glass-pill-nav,
  [data-theme="sakura"] .glass-panel,
  [data-theme="sakura"] .glass-elevated,
  [data-theme="sakura"] .glass-button {
    background: rgba(255, 255, 255, 0.96);
  }

  .modal-backdrop {
    background: rgba(6, 6, 9, 0.92);
  }

  .ambient-crimson-glow {
    display: none;
  }

  .poster-card,
  .continue-card {
    box-shadow: 0 8px 18px -10px rgba(0, 0, 0, 0.65);
  }

  .poster-card > img,
  .continue-card > img,
  .group:hover .poster-card > img,
  .group:hover .continue-card > img {
    transform: none !important;
    transition: none;
  }

  /* Non-overlapping Hero & Main below sticky header */
  #hero-section,
  main,
  #continue-section,
  #catalog-section {
    width: 100%;
    max-width: 100%;
  }

  #hero-section > div {
    height: auto !important;
    min-height: 320px;
  }

  #hero-section > div > div:last-child {
    padding-top: 28px !important;
    padding-bottom: 32px !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  #hero-section h1 {
    font-size: 1.6rem !important;
    line-height: 1.15 !important;
  }

  main {
    margin-top: 0 !important;
    padding-top: 16px;
  }

  #catalog-section > div > div:first-child {
    padding-top: 0 !important;
  }

  #catalog-section .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  #continue-section .grid {
    grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  #player-stage,
  #player-modal .aspect-video {
    width: 100% !important;
    max-width: 100% !important;
    aspect-ratio: 16 / 9;
  }

  #player-modal .max-w-5xl {
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  #player-modal .spoiler-overlay-pill {
    max-width: calc(100% - 2.5rem);
    white-space: normal;
    text-align: center;
  }

  #auth-modal > div,
  #public-profile-modal > div,
  #people-modal > div,
  #settings-modal > div {
    width: 92vw !important;
    max-width: 480px !important;
    margin: auto;
    max-height: 90vh;
    overflow-y: auto;
  }

  .profile-banner-btn {
    padding-left: 10px !important;
    padding-right: 10px !important;
    font-size: 10px !important;
  }
}