/* ===========================================================================
   CrunchWatch — design system
   Sharp, dark, content-first streaming UI. Square geometry (max 4px radius),
   brand orange/gold/red used sparingly on overwhelmingly dark surfaces.
   Component layer + base that Tailwind utilities do not provide.
   NOTE: legacy --accent/--bg/... aliases are kept because page scripts and
   admin-adjacent markup reference them; they map to the new palette.
   =========================================================================== */

:root {
  /* Brand surfaces */
  --cw-bg: #090b0f;
  --cw-surface: #11141a;
  --cw-surface-2: #181b20;
  --cw-surface-3: #1f232c;
  --cw-border: #242832;
  --cw-border-strong: #323845;

  /* Typography */
  --cw-text: #f7f7f7;
  --cw-text-secondary: #aeb2ba;
  --cw-text-muted: #737985;

  /* Brand accents (use sparingly, ~10-15% of the UI) */
  --cw-gold: #ffd15a;
  --cw-orange: #f89614;
  --cw-orange-deep: #f56c12;
  --cw-red: #f51f26;
  --cw-cream: #fff3cf;
  --cw-brand-gradient: linear-gradient(135deg, #ffd15a 0%, #f89614 38%, #f56c12 65%, #f51f26 100%);
  --cw-accent-soft: rgba(249, 150, 20, 0.12);

  /* Geometry */
  --cw-radius-sm: 2px;
  --cw-radius-md: 3px;
  --cw-radius-max: 4px;

  /* Chrome */
  --cw-nav-h: 60px;
  --cw-nav-bg: #0b0d12;
  --cw-motion: 180ms;

  /* Legacy aliases (do not remove — referenced across page scripts) */
  --accent: var(--cw-orange-deep);
  --accent-hover: var(--cw-orange);
  --accent-soft: var(--cw-accent-soft);
  --cyan: var(--cw-gold);
  --bg: var(--cw-bg);
  --card: var(--cw-surface);
  --elevated: var(--cw-surface-2);
  --bd: var(--cw-border);
  --faint: var(--cw-text-secondary);
  --muted: var(--cw-text-muted);
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

/* Hide Alpine `x-cloak` elements from the very first paint (before Alpine's
   own style injection), preventing a flash of dropdowns/menus. */
[x-cloak] {
  display: none !important;
}

body {
  padding-top: var(--cw-nav-h);
  background: var(--cw-bg);
  color: var(--cw-text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection {
  background: rgba(249, 150, 20, 0.35);
  color: #fff;
}

/* ---------------------------------------------------------------------------
   Radius guard: the old UI used rounded-xl/2xl pills everywhere. Any leftover
   `rounded-*` utilities in page templates are clamped here so no surface can
   drift back into bubbly territory. Intentionally round elements (avatars,
   spinners, switch knobs, status dots) use `rounded-full` and are untouched.
   --------------------------------------------------------------------------- */
.rounded-2xl, .rounded-xl { border-radius: var(--cw-radius-md) !important; }
.rounded-lg { border-radius: var(--cw-radius-sm) !important; }
.rounded-md { border-radius: var(--cw-radius-sm) !important; }
.rounded { border-radius: var(--cw-radius-max) !important; }
.rounded-sm { border-radius: var(--cw-radius-sm) !important; }

/* ---------------------------------------------------------------------------
   Focus + motion accessibility
   --------------------------------------------------------------------------- */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--cw-gold);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------------------------------------------------------------------------
   Typography helpers
   --------------------------------------------------------------------------- */
.cw-display {
  font-family: 'Oswald', 'Inter', system-ui, sans-serif;
  letter-spacing: 0.01em;
}
.cw-eyebrow {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cw-gold);
}
.cw-section-title {
  font-family: 'Oswald', 'Inter', system-ui, sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--cw-text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
}
.cw-section-title::before {
  content: '';
  width: 3px;
  height: 1.1em;
  background: var(--cw-brand-gradient);
  flex-shrink: 0;
}
.cw-viewall {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--cw-text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: color var(--cw-motion) ease;
  white-space: nowrap;
}
.cw-viewall:hover { color: var(--cw-orange); }

/* Brand lockup */
.brand-lockup { gap: 0.55rem; }
.brand-logo { display: block; }
.brand-alpha {
  align-self: center;
  text-align: center;
  color: var(--cw-gold);
  border: 1px solid rgba(255, 209, 90, 0.4);
  border-radius: var(--cw-radius-sm);
  padding: 0.15rem 0.35rem;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
@media (max-width: 420px) {
  .brand-logo { max-width: 112px; }
  .brand-alpha { font-size: 0.55rem; padding: 0.12rem 0.28rem; }
}
.register-popup {
  position: relative;
  border: 1px solid var(--cw-border);
}

/* Scrollbars: thin, dark, square */
* {
  scrollbar-width: thin;
  scrollbar-color: #323845 transparent;
}
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #323845; border-radius: 0; }
*::-webkit-scrollbar-thumb:hover { background: var(--cw-orange-deep); }

/* ---------------------------------------------------------------------------
   Buttons — rectangular, sharp, bold, compact
   --------------------------------------------------------------------------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--cw-brand-gradient);
  color: #160b02;
  border-radius: var(--cw-radius-sm);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  padding: 0.625rem 1rem;
  border: 1px solid transparent;
  transition: filter var(--cw-motion) ease, transform 150ms ease;
  white-space: nowrap;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--cw-surface-2);
  color: var(--cw-text);
  border: 1px solid var(--cw-border-strong);
  border-radius: var(--cw-radius-sm);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  padding: 0.625rem 1rem;
  transition: border-color var(--cw-motion) ease, background var(--cw-motion) ease, color var(--cw-motion) ease;
  white-space: nowrap;
}
.btn-secondary:hover {
  background: var(--cw-surface-3);
  border-color: var(--cw-orange-deep);
  color: #fff;
}
.btn-secondary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: transparent;
  color: #ff6b6b;
  border: 1px solid rgba(255, 107, 107, 0.5);
  border-radius: var(--cw-radius-sm);
  font-weight: 700;
  line-height: 1;
  padding: 0.625rem 1rem;
  transition: background 150ms, color 150ms;
  white-space: nowrap;
}
.btn-logout:hover { background: rgba(245, 31, 38, 0.12); }

/* ---------------------------------------------------------------------------
   Badges / chips — compact, structured, tiny radius
   --------------------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.4rem;
  border-radius: var(--cw-radius-sm);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.5;
  white-space: nowrap;
  text-transform: uppercase;
}
.badge-accent,
span.badge-accent {
  background: rgba(249, 150, 20, 0.16) !important;
  color: var(--cw-gold) !important;
  border: 1px solid rgba(249, 150, 20, 0.35);
}
.badge-green,
span.badge-green {
  background: rgba(34, 197, 94, 0.12) !important;
  color: #4ade80 !important;
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.badge-gray,
span.badge-gray {
  background: rgba(0, 0, 0, 0.55) !important;
  color: #e5e7eb !important;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

/* Genre/theme pills on the details page */
.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.32rem 0.6rem;
  border-radius: var(--cw-radius-sm);
  background: var(--cw-surface-2);
  border: 1px solid var(--cw-border);
  color: var(--cw-text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: color 150ms ease, border-color 150ms ease;
}
.filter-chip:hover {
  color: var(--cw-gold);
  border-color: var(--cw-orange-deep);
}

/* ---------------------------------------------------------------------------
   Inputs
   --------------------------------------------------------------------------- */
.inp {
  width: 100%;
  background: var(--cw-surface-2);
  border: 1px solid var(--cw-border-strong);
  color: #fff;
  border-radius: var(--cw-radius-sm);
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.inp::placeholder { color: var(--cw-text-muted); }
.inp:focus {
  border-color: var(--cw-orange-deep);
  box-shadow: 0 0 0 2px rgba(245, 108, 18, 0.25);
}
select.inp {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23737985' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.625rem center;
  background-size: 1rem;
  padding-right: 2rem;
}

/* ---------------------------------------------------------------------------
   Custom themed dropdown (browse filters, squared)
   --------------------------------------------------------------------------- */
.dd { position: relative; }
.dd-cap {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cw-text-muted);
  margin-bottom: 0.3rem;
}
.dd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: var(--cw-surface-2);
  border: 1px solid var(--cw-border-strong);
  color: #fff;
  border-radius: var(--cw-radius-sm);
  padding: 0.5rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 120px;
  cursor: pointer;
  transition: border-color 150ms ease;
  white-space: nowrap;
}
.dd-btn:hover { border-color: var(--cw-orange-deep); }
.dd-btn .dd-chevron { transition: transform 150ms ease; color: var(--cw-text-muted); }
.dd.open .dd-chevron { transform: rotate(180deg); }
.dd-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 0.375rem);
  z-index: 30;
  min-width: 100%;
  max-height: 16rem;
  overflow-y: auto;
  background: var(--cw-surface);
  border: 1px solid var(--cw-border-strong);
  border-radius: var(--cw-radius-sm);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);
  padding: 0.25rem;
  display: none;
}
.dd-menu.dd-grid {
  width: 480px;
  max-width: calc(100vw - 24px);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.25rem;
  padding: 0.5rem;
}
@media (max-width: 640px) {
  .dd-menu.dd-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 340px; max-width: calc(100vw - 24px); }
}
.dd.open .dd-menu { display: block; }
.dd.open .dd-menu.dd-grid { display: grid; }
.dd-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.7rem;
  font-size: 0.8rem;
  border-radius: var(--cw-radius-sm);
  color: var(--cw-text-secondary);
  cursor: pointer;
  transition: color 120ms ease, background 120ms ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dd-option:hover { color: #fff; background: var(--cw-surface-2); }
.dd-option.selected {
  color: var(--cw-gold);
  background: var(--cw-accent-soft);
  box-shadow: inset 2px 0 0 var(--cw-orange-deep);
}

/* ---------------------------------------------------------------------------
   Navbar — 60px, dark, subtle bottom border, text links with active indicator
   --------------------------------------------------------------------------- */
.cw-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--cw-nav-h);
  background: var(--cw-nav-bg);
  border-bottom: 1px solid #1b1f27;
}
.cw-nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
  height: var(--cw-nav-h);
  display: flex;
  align-items: center;
  gap: 1rem;
}
@media (min-width: 640px) { .cw-nav-inner { padding: 0 1.5rem; } }
.cw-nav-links { display: none; align-items: center; gap: 0.25rem; flex: 1; min-width: 0; }
@media (min-width: 1024px) { .cw-nav-links { display: flex; } }
.cw-nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: var(--cw-nav-h);
  padding: 0 0.7rem;
  font-size: 0.83rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--cw-text-secondary);
  transition: color 150ms ease;
  white-space: nowrap;
}
.cw-nav-link:hover { color: #fff; }
.cw-nav-link.active { color: #fff; }
.cw-nav-link.active::after {
  content: '';
  position: absolute;
  left: 0.7rem; right: 0.7rem; bottom: 0;
  height: 2px;
  background: var(--cw-brand-gradient);
}
.cw-nav-menu { position: relative; }
.cw-nav-menu-panel {
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 170px;
  background: var(--cw-surface);
  border: 1px solid var(--cw-border-strong);
  border-radius: var(--cw-radius-sm);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);
  padding: 0.3rem;
  z-index: 50;
}
.cw-nav-menu-grid {
  width: 440px;
  max-width: calc(100vw - 2rem);
  padding: 0.6rem;
}
.cw-nav-menu-panel a {
  display: block;
  padding: 0.45rem 0.7rem;
  font-size: 0.82rem;
  color: var(--cw-text-secondary);
  border-radius: var(--cw-radius-sm);
  transition: color 120ms, background 120ms;
}
.cw-nav-menu-panel a:hover { color: #fff; background: var(--cw-surface-2); }
.cw-account-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 14rem;
  background: var(--cw-surface);
  border: 1px solid var(--cw-border-strong);
  border-radius: var(--cw-radius-sm);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);
  padding: 0.3rem 0;
  z-index: 50;
}
.cw-account-panel a, .cw-account-panel button.cw-account-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.5rem 1rem;
  font-size: 0.83rem;
  color: var(--cw-text-secondary);
  transition: color 120ms, background 120ms;
}
.cw-account-panel a:hover, .cw-account-panel button.cw-account-link:hover {
  color: #fff;
  background: var(--cw-surface-2);
}
/* Legacy class kept for stacking above the watch player overlays */
.navbar-blur { z-index: 1000 !important; }

/* ---------------------------------------------------------------------------
   Footer — simplified, thin divider, compact columns
   --------------------------------------------------------------------------- */
.cw-footer {
  border-top: 1px solid #1b1f27;
  background: var(--cw-nav-bg);
  margin-top: 3rem;
}
.cw-footer h4 {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cw-text-muted);
  margin-bottom: 0.8rem;
}
.cw-footer li a {
  font-size: 0.8rem;
  color: var(--cw-text-secondary);
  transition: color 150ms;
}
.cw-footer li a:hover { color: var(--cw-orange); }
.cw-az-strip a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.9rem;
  height: 2rem;
  padding: 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--cw-text-muted);
  background: var(--cw-surface-2);
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius-sm);
  transition: color 150ms, border-color 150ms;
}
.cw-az-strip a:hover { color: var(--cw-gold); border-color: var(--cw-orange-deep); }

/* ---------------------------------------------------------------------------
   Anime card grid + poster card (square, dense, content-first)
   --------------------------------------------------------------------------- */
.anime-grid {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem 0.9rem;
}
@media (min-width: 480px) { .anime-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 768px) { .anime-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .anime-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .anime-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (min-width: 1600px) { .anime-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); } }

.anime-card { width: 100%; min-width: 0; position: relative; }
.anime-card::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--cw-brand-gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--cw-motion) ease;
}
.anime-card:hover::after { transform: scaleX(1); }
.anime-card-media {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--cw-radius-sm);
  background: var(--cw-surface-2);
  border: 1px solid var(--cw-border);
  aspect-ratio: 2/3;
}
.anime-card:hover .anime-card-media { border-color: var(--cw-border-strong); }
.anime-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--cw-motion) ease, filter var(--cw-motion) ease;
}
.anime-card:hover .anime-card-media img { transform: scale(1.03); filter: brightness(1.06); }
.anime-card-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--cw-text-secondary);
  margin-top: 0.45rem;
  line-height: 1.35;
  /* Fixed 3-line box so every card in a row occupies identical height no
     matter the title length; overflow clamps with an ellipsis. */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 3.04rem;
  transition: color 150ms;
}
.anime-card:hover .anime-card-title { color: #fff; }

/* Episode picker grid inside the player column */
.episode-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.4rem;
}
@media (min-width: 1024px) {
  .episode-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
.ep-btn {
  position: relative;
  padding: 0.5rem 0.15rem;
  border-radius: var(--cw-radius-sm);
  background: var(--cw-surface-2);
  border: 1px solid var(--cw-border);
  color: var(--cw-text-secondary);
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}
.ep-btn:hover { color: #fff; border-color: var(--cw-orange-deep); }
.ep-btn.ep-current, .ep-btn.bg-accent {
  background: var(--cw-brand-gradient) !important;
  border-color: transparent !important;
  color: #160b02 !important;
}
@media (max-width: 480px) {
  .episode-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; }
  .ep-btn { font-size: 0.9rem; padding: 0.65rem 0.15rem; }
}

/* Line clamp fallback (Tailwind's line-clamp needs the plugin; supply it) */
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* Skeleton shimmer for loading states (sharp, matches new surfaces) */
.skeleton {
  background: linear-gradient(90deg, #14171d 25%, #1e232c 50%, #14171d 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--cw-radius-sm);
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Carousel / row arrows: minimal square buttons */
.carousel-arrow {
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--cw-radius-sm);
  background: var(--cw-surface-2);
  border: 1px solid var(--cw-border-strong);
  color: var(--cw-text-secondary);
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
  flex-shrink: 0;
  cursor: pointer;
}
.carousel-arrow:hover { color: var(--cw-gold); border-color: var(--cw-orange-deep); }
.carousel-arrow:disabled { opacity: 0.35; cursor: not-allowed; }

.home-row-rail {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  scroll-behavior: smooth;
}
.home-row-rail::-webkit-scrollbar { display: none; }
.home-row-track {
  display: flex;
  gap: 0.9rem;
  width: max-content !important;
}
.home-row-track > .swiper-slide {
  width: 150px !important;
  flex: 0 0 150px;
}
@media (min-width: 1280px) {
  .home-row-track > .swiper-slide { width: 168px !important; flex-basis: 168px; }
}

/* Hero swiper pagination: small squares, brand active */
.hero-swiper .swiper-pagination-bullet {
  background: rgba(255, 255, 255, 0.4);
  opacity: 1;
  width: 14px;
  height: 4px;
  border-radius: 1px;
}
.hero-swiper .swiper-pagination-bullet-active {
  background: var(--cw-brand-gradient);
  width: 26px;
  border-radius: 1px;
}

/* ---------------------------------------------------------------------------
   Cinematic hero billboard (integrated into the page, not a floating card)
   --------------------------------------------------------------------------- */
.cw-hero { position: relative; width: 100%; overflow: hidden; background: #05060a; }
.cw-hero-bg { position: absolute; inset: 0; }
.cw-hero-bg img { width: 100%; height: 100%; object-fit: cover; object-position: center 20%; }
.cw-hero-shade {
  position: absolute; inset: 0;
  background:
    linear-gradient(to top, var(--cw-bg) 2%, rgba(9, 11, 15, 0.55) 45%, rgba(9, 11, 15, 0.25) 100%),
    linear-gradient(to right, rgba(9, 11, 15, 0.92) 0%, rgba(9, 11, 15, 0.45) 55%, rgba(9, 11, 15, 0.1) 100%);
}
.cw-hero-body {
  position: relative;
  max-width: 1400px;
  margin: 0 auto;
  padding: 3.5rem 1rem 4.5rem;
}
@media (min-width: 640px) { .cw-hero-body { padding: 5rem 1.5rem 5.5rem; } }
.cw-hero-kicker {
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 0.9rem; flex-wrap: wrap;
}
.cw-hero-title {
  font-family: 'Oswald', 'Inter', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.02;
  color: #fff;
  font-size: clamp(1.9rem, 4.5vw, 3.4rem);
  max-width: 16ch;
  margin: 0 0 0.7rem;
}
.cw-hero-desc {
  font-size: 0.86rem;
  line-height: 1.6;
  color: var(--cw-text-secondary);
  max-width: 52ch;
  margin-bottom: 1.1rem;
}
.cw-hero-meta {
  display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap;
  font-size: 0.75rem; font-weight: 600; color: var(--cw-text-secondary);
  margin-bottom: 1.4rem;
}
.cw-hero-meta .dot { color: var(--cw-text-muted); }
.cw-hero-cta { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }
.cw-hero-cta .btn-primary, .cw-hero-cta .btn-secondary {
  padding: 0.7rem 1.4rem;
  font-size: 0.85rem;
}

/* ---------------------------------------------------------------------------
   Continue-watching rail items (compact, sharp, progress-forward)
   --------------------------------------------------------------------------- */
.cw-cw-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 300px;
  flex: 0 0 300px;
  background: var(--cw-surface);
  border: 1px solid var(--cw-border);
  border-left: 2px solid var(--cw-orange-deep);
  border-radius: var(--cw-radius-sm);
  padding: 0.55rem;
  transition: border-color 150ms ease, background 150ms ease;
}
.cw-cw-item:hover { border-color: var(--cw-border-strong); border-left-color: var(--cw-gold); background: var(--cw-surface-2); }
.cw-cw-thumb {
  width: 44px; height: 64px; flex-shrink: 0;
  background: var(--cw-surface-3);
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius-sm);
  overflow: hidden;
}
.cw-cw-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---------------------------------------------------------------------------
   Search results dropdown rows (structured, square, keyboard-highlightable)
   --------------------------------------------------------------------------- */
.cw-search-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.45rem 0.7rem;
  transition: background 120ms ease;
}
.cw-search-row:hover, .cw-search-row.bg-elevated { background: var(--cw-surface-2); }
.cw-search-row.bg-elevated { box-shadow: inset 2px 0 0 var(--cw-orange-deep); }
.cw-search-row img {
  width: 34px; height: 50px; object-fit: cover; flex-shrink: 0;
  border-radius: var(--cw-radius-sm);
  background: var(--cw-surface-3);
}

/* ---------------------------------------------------------------------------
   Flat content panels + section separators (no floating rounded cards)
   --------------------------------------------------------------------------- */
.cw-panel {
  background: var(--cw-surface);
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius-sm);
}
.cw-section { border-top: 1px solid var(--cw-border); padding-top: 1.25rem; margin-top: 1.25rem; }
.cw-section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 0.9rem;
}
.cw-split { border-top: 1px solid var(--cw-border); }

/* Genre/theme index rows: structured, square, strong hover */
.cw-tax-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.9rem;
  background: var(--cw-surface);
  border: 1px solid var(--cw-border);
  border-left: 2px solid transparent;
  border-radius: var(--cw-radius-sm);
  transition: border-color 150ms ease, background 150ms ease;
}
.cw-tax-row:hover { border-color: var(--cw-border-strong); border-left-color: var(--cw-orange-deep); background: var(--cw-surface-2); }
.cw-tax-row span:first-child {
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em;
  color: var(--cw-text); text-transform: uppercase;
}
.cw-tax-row:hover span:first-child { color: var(--cw-gold); }

/* A–Z letter buttons: compact squares */
.cw-az {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2.25rem;
  padding: 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 800;
  border-radius: var(--cw-radius-sm);
  background: var(--cw-surface-2);
  border: 1px solid var(--cw-border);
  color: var(--cw-text-muted);
  transition: color 150ms, border-color 150ms, background 150ms;
}
.cw-az:hover { color: var(--cw-gold); border-color: var(--cw-orange-deep); }
.cw-az.active { background: var(--cw-brand-gradient); border-color: transparent; color: #160b02; }

/* Schedule date tabs: structured, orange bottom edge when active */
.date-tab {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.85rem 0.5rem;
  border-radius: var(--cw-radius-sm);
  border: 1px solid var(--cw-border);
  border-bottom: 2px solid var(--cw-border);
  background: var(--cw-surface);
  cursor: pointer;
  transition: border-color 150ms, background 150ms;
  min-width: 3.8rem;
  text-align: center;
}
.date-tab:hover { border-color: var(--cw-border-strong); }
.date-tab.active {
  border-color: var(--cw-border-strong);
  border-bottom-color: var(--cw-orange-deep);
  background: var(--cw-surface-2);
}
.date-tab .tab-day { font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--cw-text-muted); }
.date-tab .tab-num { font-size: 1.35rem; font-weight: 800; line-height: 1.15; color: #fff; }
.date-tab .tab-mon { font-size: 0.6rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; color: var(--cw-text-secondary); }
.date-tab.active .tab-day { color: var(--cw-gold); }
.date-tab.no-eps { opacity: 0.45; }
.date-tab.no-eps:hover { opacity: 0.7; }
#date-strip::-webkit-scrollbar { display: none; }
#date-strip { -ms-overflow-style: none; scrollbar-width: none; }

/* OTP code boxes (centralized; forgot/verify share this) */
.code-box {
  width: 2.75rem; height: 3.25rem; text-align: center; font-size: 1.5rem; font-weight: 700;
  color: #fff; background: var(--cw-surface-2); border: 1px solid var(--cw-border-strong);
  border-radius: var(--cw-radius-sm); outline: none; transition: border-color 150ms, box-shadow 150ms;
}
.code-box:focus { border-color: var(--cw-orange-deep); box-shadow: 0 0 0 2px rgba(245, 108, 18, 0.25); }

/* Auth panels + form messages */
.cw-auth {
  width: 100%;
  max-width: 26rem;
  background: var(--cw-surface);
  border: 1px solid var(--cw-border);
  border-top: 2px solid var(--cw-orange-deep);
  border-radius: var(--cw-radius-sm);
  padding: 2rem;
}
.cw-form-msg {
  margin-bottom: 1rem;
  padding: 0.7rem 0.85rem;
  font-size: 0.8rem;
  border-radius: var(--cw-radius-sm);
  border: 1px solid;
}
.cw-form-msg.err { background: rgba(245, 31, 38, 0.08); border-color: rgba(245, 31, 38, 0.35); color: #ff8080; }
.cw-form-msg.ok { background: rgba(34, 197, 94, 0.08); border-color: rgba(34, 197, 94, 0.35); color: #4ade80; }

/* ---------------------------------------------------------------------------
   Search loading dots (small squares while results load)
   --------------------------------------------------------------------------- */
.search-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 1rem;
}
.search-loading span {
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--cw-orange);
  animation: search-bounce 1s infinite ease-in-out;
}
.search-loading span:nth-child(2) { animation-delay: 0.15s; }
.search-loading span:nth-child(3) { animation-delay: 0.3s; }
@keyframes search-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* ---------------------------------------------------------------------------
   Watched episode buttons (browser-local watch history — no account needed)
   --------------------------------------------------------------------------- */
.ep-btn.ep-watched {
  background: var(--cw-surface);
  color: var(--cw-text-muted);
  border-color: var(--cw-border);
  opacity: 0.55;
}
.ep-btn.ep-watched:hover { opacity: 0.85; color: #fff; border-color: var(--cw-orange-deep); }
.ep-btn.ep-watched::after {
  content: '✓';
  position: absolute;
  top: 1px; right: 3px;
  font-size: 8px;
  color: var(--cw-gold);
}

/* ===========================================================================
   Profile / library / settings — shared components
   =========================================================================== */
.avatar-ring {
  box-shadow: 0 0 0 2px var(--cw-bg), 0 0 0 3px rgba(255, 209, 90, 0.5);
}
.eki-nav-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  max-width: 2rem;
  aspect-ratio: 1 / 1;
  flex: 0 0 2rem;
  border-radius: 50%;
  overflow: hidden;
  object-fit: cover;
}
.avatar-edit-hint {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 150ms;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.avatar-wrap:hover .avatar-edit-hint { opacity: 1; }
.progress-track {
  height: 4px;
  border-radius: 1px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 1px;
  background: var(--cw-brand-gradient);
}
/* Library tabs: text tabs with an orange bottom border when selected */
.lib-tab {
  padding: 0.6rem 0.2rem;
  margin-right: 1.25rem;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cw-text-muted);
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  transition: color 150ms, border-color 150ms;
  white-space: nowrap;
}
.lib-tab:hover { color: #fff; }
.lib-tab.active { color: var(--cw-gold); border-bottom-color: var(--cw-orange-deep); }
.stat-tile {
  background: var(--cw-surface);
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius-sm);
  padding: 0.9rem 1rem;
}
.stat-tile .stat-value {
  font-family: 'Oswald', 'Inter', system-ui, sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  color: #fff;
}
.stat-tile .stat-key {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--cw-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 0.35rem;
}
.rank-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: var(--cw-radius-sm);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 209, 90, 0.1);
  color: var(--cw-gold);
  border: 1px solid rgba(255, 209, 90, 0.35);
}
.profile-settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  color: var(--cw-text-secondary);
  border: 1px solid var(--cw-border-strong);
  border-radius: var(--cw-radius-sm);
  background: var(--cw-surface-2);
  transition: color 150ms, border-color 150ms, background 150ms;
}
.profile-settings-btn:hover {
  color: var(--cw-gold);
  border-color: var(--cw-orange-deep);
  background: var(--cw-surface-3);
}
.profile-settings-btn svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}

/* Toggle switch (slightly rounded by function, square surroundings) */
.switch {
  position: relative;
  display: inline-flex;
  width: 2.6rem;
  height: 1.5rem;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--cw-border-strong);
  cursor: pointer;
  transition: background 150ms;
  flex-shrink: 0;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: calc(1.5rem - 8px);
  height: calc(1.5rem - 8px);
  border-radius: 2px;
  background: #fff;
  transition: transform 150ms;
}
.switch.on { background: var(--cw-orange-deep); border-color: var(--cw-orange-deep); }
.switch.on::after { transform: translateX(1.1rem); }

/* Segmented control */
.segmented {
  display: inline-flex;
  padding: 2px;
  border-radius: var(--cw-radius-sm);
  background: var(--cw-surface-2);
  border: 1px solid var(--cw-border-strong);
  gap: 2px;
}
.segmented button {
  padding: 0.4rem 0.9rem;
  border-radius: var(--cw-radius-sm);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--cw-text-secondary);
  transition: color 150ms, background 150ms;
}
.segmented button.on { color: #160b02; background: var(--cw-brand-gradient); }

/* Library remove control — square dark chip. Hidden on desktop until
   hover, always visible on touch devices. */
.lib-remove {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 10;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: var(--cw-radius-sm);
  background: rgba(9, 11, 15, 0.85);
  border: 1px solid var(--cw-border-strong);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 150ms, border-color 150ms, color 150ms;
}
.group:hover .lib-remove { opacity: 1; }
.lib-remove:hover { border-color: var(--cw-red); color: #ff8080; }
@media (max-width: 767px) {
  .lib-remove { opacity: 1; }
}

/* Share buttons */
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.8rem;
  border-radius: var(--cw-radius-sm);
  background: var(--cw-surface-2);
  border: 1px solid var(--cw-border);
  color: var(--cw-text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: color 150ms, border-color 150ms;
  white-space: nowrap;
}
.share-btn:hover { color: var(--cw-gold); border-color: var(--cw-orange-deep); }
.share-btn svg { width: 1rem; height: 1rem; flex-shrink: 0; }
.share-btn img { width: 1rem; height: 1rem; flex-shrink: 0; object-fit: contain; }
@media (max-width: 639px) {
  .share-label { display: none; }
  .share-btn { padding: 0.55rem; }
}

/* Discord surfaces: deliberate but restrained */
.discord-join-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 1rem;
  border-radius: var(--cw-radius-sm);
  background: var(--cw-surface-2);
  border: 1px solid var(--cw-border-strong);
  color: #fff;
  font-size: 0.83rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  transition: border-color var(--cw-motion) ease, background var(--cw-motion) ease;
  white-space: nowrap;
}
.discord-join-btn svg { width: 1.15rem; height: 1.15rem; }
.discord-join-btn:hover { background: #5865f2; border-color: #5865f2; }
.join-discord { border-radius: var(--cw-radius-sm); }

/* Language toggle buttons (watch player) */
.lang-btn {
  border-radius: var(--cw-radius-sm);
  border: 1px solid transparent;
}
.lang-btn.bg-accent {
  background: var(--cw-brand-gradient) !important;
  color: #160b02 !important;
  border-color: transparent !important;
}
.lang-btn:disabled { cursor: not-allowed; }

/* Continue Watching shortcut in the navbar */
.cw-continue-link {
  display: none;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--cw-text-secondary);
  border: 1px solid var(--cw-border-strong);
  border-radius: var(--cw-radius-sm);
  padding: 0.45rem 0.7rem;
  transition: color 150ms, border-color 150ms;
  white-space: nowrap;
}
@media (min-width: 768px) { .cw-continue-link { display: inline-flex; } }
.cw-continue-link:hover { color: var(--cw-gold); border-color: var(--cw-orange-deep); }
.cw-continue-link .cw-live-dot {
  width: 6px; height: 6px; border-radius: 1px;
  background: var(--cw-brand-gradient);
}

/* Detail-page episode list buttons */
.cw-ep-list { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.4rem; }
@media (min-width: 640px) { .cw-ep-list { grid-template-columns: repeat(10, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .cw-ep-list { grid-template-columns: repeat(12, minmax(0, 1fr)); } }
.cw-ep-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.1rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--cw-text-secondary);
  background: var(--cw-surface-2);
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius-sm);
  transition: color 150ms, border-color 150ms;
}
.cw-ep-cell:hover { color: #fff; border-color: var(--cw-orange-deep); }
.cw-ep-cell.is-watched { color: var(--cw-text-muted); opacity: 0.55; }

/* Mobile filter drawer (browse) */
#filters-toggle { display: none; }
@media (max-width: 767px) {
  #filters-toggle { display: inline-flex; }
  #filters.collapsed { display: none; }
}

/* Detail banner + watch layout helpers */
.cw-backdrop img { object-position: center 20%; }
.cw-player-frame {
  background: #05060a;
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius-sm);
}
.cw-side-panel {
  background: var(--cw-surface);
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius-sm);
}
