:root {
  --bg: #07080d;
  --bg-glow-1: #2a1a5e;
  --bg-glow-2: #0e2a4a;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-solid: #12141f;
  --surface-border: rgba(255, 255, 255, 0.08);
  --accent: #8b6bff;
  --accent-2: #ff6bd6;
  --accent-gradient: linear-gradient(135deg, #8b6bff 0%, #6a4be8 55%, #4b6bff 100%);
  --movie-gradient: linear-gradient(135deg, #8b6bff 0%, #4b6bff 100%);
  --series-gradient: linear-gradient(135deg, #ff6bd6 0%, #ff9a4b 100%);
  --gold: #ffca4b;
  --text: #f3f4fa;
  --text-dim: #9096ac;
  --text-faint: #5c6178;
  --success: #34d17c;
  --warn: #d4c34d;
  --danger: #ff6b81;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

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

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
  /* A static color wash across the whole viewport (not just behind the mobile-width
     content column) so wide desktop windows don't show flat black side gutters —
     the animated glow blobs below add extra movement/brightness on top of this. */
  background:
    radial-gradient(ellipse 90% 60% at 15% -10%, rgba(139, 107, 255, 0.28), transparent 60%),
    radial-gradient(ellipse 90% 60% at 100% 110%, rgba(75, 107, 255, 0.24), transparent 60%),
    radial-gradient(ellipse 70% 50% at 100% 10%, rgba(255, 107, 214, 0.16), transparent 55%),
    radial-gradient(ellipse 70% 50% at 0% 100%, rgba(255, 202, 75, 0.12), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  direction: rtl;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body::before, body::after {
  content: "";
  position: fixed;
  width: 60vw;
  height: 60vw;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.35;
  z-index: -1;
  pointer-events: none;
  animation: driftGlow 22s ease-in-out infinite;
}

body::before {
  background: var(--bg-glow-1);
  top: -20vw;
  right: -15vw;
}

body::after {
  background: var(--bg-glow-2);
  bottom: -25vw;
  left: -20vw;
  animation-delay: -11s;
  animation-direction: alternate-reverse;
}

.bg-glow-3 {
  content: "";
  position: fixed;
  width: 42vw;
  height: 42vw;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.22;
  z-index: -1;
  pointer-events: none;
  background: var(--accent-2);
  top: 35vh;
  left: -12vw;
  animation: driftGlow 26s ease-in-out infinite;
  animation-delay: -6s;
}

.bg-glow-4 {
  content: "";
  position: fixed;
  width: 36vw;
  height: 36vw;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.18;
  z-index: -1;
  pointer-events: none;
  background: var(--gold);
  bottom: 5vh;
  right: -10vw;
  animation: driftGlow 30s ease-in-out infinite;
  animation-delay: -18s;
}

/* Soft dark edges so the glow blobs read as ambient cinema light rather than
   flat color patches, and content stays readable at the viewport edges. */
.bg-vignette {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(3, 4, 8, 0.55) 100%);
}

/* Very subtle film-grain texture (inline SVG noise, no external asset) to keep
   the dark background from looking like a flat, dead-flat gradient. */
.bg-grain {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes driftGlow {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(4vw, 3vw) scale(1.08); }
  66% { transform: translate(-3vw, -2vw) scale(0.96); }
}

@media (prefers-reduced-motion: reduce) {
  body::before, body::after, .bg-glow-3, .bg-glow-4 {
    animation: none;
  }
}

.screen {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 100px 16px;
  animation: fadeIn 0.35s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.hidden {
  display: none !important;
}

h1 {
  font-size: 21px;
  font-weight: 800;
  margin: 8px 0 4px 0;
  letter-spacing: -0.2px;
}

p.subtitle {
  color: var(--text-dim);
  font-size: 13px;
  margin: 0 0 22px 0;
}

/* ---------- surfaces ---------- */
.card {
  background-color: #141622;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: border-color 0.15s ease;
}

.card:active {
  transform: scale(0.985);
}

/* ---------- inputs ---------- */
input, textarea {
  width: 100%;
  background-color: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  padding: 14px;
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

input::placeholder, textarea::placeholder {
  color: var(--text-faint);
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  background-color: rgba(255, 255, 255, 0.07);
}

/* ---------- buttons ---------- */
button {
  width: 100%;
  background: var(--accent-gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 15px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-top: 10px;
  box-shadow: 0 6px 18px rgba(139, 107, 255, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.12s ease;
}

button:active {
  transform: scale(0.97);
  box-shadow: 0 3px 10px rgba(139, 107, 255, 0.25);
}

button.secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--surface-border);
  box-shadow: none;
}

button.icon-btn {
  width: auto;
  padding: 7px 11px;
  font-size: 11.5px;
  font-weight: 700;
  margin-top: 0;
  white-space: nowrap;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
  color: var(--text-dim);
  box-shadow: none;
}

button.icon-btn:active {
  transform: scale(0.94);
}

.search-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-row input {
  flex: 1;
  min-width: 0;
}

.genre-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* ---------- top bar ---------- */
/* Frosted glass rather than a painted purple band: the app's own background glow
   shows through it, so the bar reads as part of the page instead of a stripe sitting
   on top of it. The tint is deliberately faint — the previous 0.28/0.22/0.24 gradient
   was strong enough to fight the posters for attention on every screen. */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 -16px 14px -16px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px 16px;
  position: sticky;
  top: 0;
  z-index: 30;
  background: linear-gradient(120deg, rgba(139, 107, 255, 0.13) 0%, rgba(75, 107, 255, 0.09) 50%, rgba(255, 107, 214, 0.11) 100%);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  transition: background 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

/* Scrolled state only deepens the glass a little and adds a lift shadow — enough to
   separate it from content passing underneath without becoming a solid slab. */
.top-bar.scrolled {
  background: linear-gradient(120deg, rgba(20, 18, 40, 0.82) 0%, rgba(14, 16, 32, 0.8) 55%, rgba(30, 16, 38, 0.82) 100%);
  border-bottom-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

/* Slides up out of view while scrolling down through the catalog, returns on the
   first upward scroll — see onScroll() in app.js. */
.top-bar.bar-hidden {
  transform: translateY(-100%);
}

.top-bar {
  transition: background 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease,
    transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

@media (prefers-reduced-motion: reduce) {
  .top-bar {
    transition: none;
  }
  .top-bar.bar-hidden {
    transform: none;
  }
}

.top-bar .brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.top-bar .brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  overflow: hidden;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(139, 107, 255, 0.4);
}

.top-bar .brand-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.top-bar .app-name {
  font-family: "Vazirmatn", sans-serif;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, var(--text) 25%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Logout is a rare action that was taking a full-size labelled pill in the most
   valuable strip of the screen. Same tap target (36px), a fraction of the weight. */
#logout-button {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 0;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

/* Drawn as an inline SVG rather than the "⏻" (U+23FB) character it used to be: that
   glyph is missing from Vazirmatn and from the default Android system fonts, so the
   button rendered as an empty box on phones. */
#logout-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--text-dim);
  stroke-width: 2;
  stroke-linecap: round;
  transition: stroke 0.12s ease;
}

#logout-button:active {
  background: rgba(255, 107, 129, 0.16);
  border-color: rgba(255, 107, 129, 0.35);
}

#logout-button:active svg {
  stroke: var(--danger);
}

/* ---------- filter chips ---------- */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 2px 12px 2px;
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

/* Tightened from 8px/16px padding and 12px text: with seven categories these wrap
   onto two rows, and at the old size the header (bar + search + chips) took a third
   of the screen before a single poster was visible. */
.chip {
  flex: 0 0 auto;
  padding: 6px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.chip:active {
  transform: scale(0.94);
}

.chip.active {
  background: var(--accent-gradient);
  color: #fff;
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(139, 107, 255, 0.38);
}

/* ---------- library grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.poster-card {
  background-color: #141622;
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.22);
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
}

.poster-card:active {
  border-color: var(--accent);
  transform: scale(0.97);
}

.poster-tile {
  aspect-ratio: 2 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.85);
  position: relative;
  overflow: hidden;
}

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

.poster-tile .kind-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background-color: rgba(0, 0, 0, 0.55);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.poster-tile .kind-badge.movie { background: var(--movie-gradient); }
.poster-tile .kind-badge.series { background: var(--series-gradient); }

.poster-tile .rating-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background-color: rgba(3, 4, 8, 0.72);
  color: var(--gold);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Customers' own average score (see the 1-10 rate-scale in the detail modal) —
   mirrored on the opposite corner from the IMDb badge, with its own color so
   the two scores are never confused for one another at a glance. */
.poster-tile .customer-rating-badge {
  position: absolute;
  bottom: 6px;
  left: 6px;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background-color: rgba(3, 4, 8, 0.72);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.poster-info {
  padding: 7px 8px 9px 8px;
}

.poster-title {
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.poster-meta {
  font-size: 9.5px;
  color: var(--text-faint);
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.audio-badge-group {
  display: flex;
  align-items: center;
  gap: 3px;
  min-width: 0;
}

.audio-badge {
  flex: 0 0 auto;
  font-size: 8.5px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  white-space: nowrap;
}

.audio-badge.dubbed { background: rgba(52, 209, 124, 0.16); color: var(--success); }
.audio-badge.subtitled { background: rgba(75, 214, 255, 0.16); color: #7fe0ff; }
.audio-badge.original { background: rgba(255, 202, 75, 0.16); color: var(--gold); }

/* ---------- bottom nav ---------- */
/* Anchored to both edges instead of centred with a max-width, and the buttons share
   the space equally (flex: 1 1 0). Before this, each tab was sized by its own label,
   so the four came out 59/67/103/90px wide — visibly lopsided, and on a 375px phone
   they filled the pill to the last pixel with no breathing room. */
.tabs {
  display: flex;
  gap: 3px;
  position: fixed;
  bottom: calc(12px + env(safe-area-inset-bottom));
  left: 12px;
  right: 12px;
  max-width: 456px;
  margin: 0 auto;
  background: linear-gradient(120deg, rgba(24, 20, 46, 0.88) 0%, rgba(16, 18, 36, 0.86) 55%, rgba(32, 18, 42, 0.88) 100%);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  padding: 4px;
  overflow: hidden;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(18px) saturate(1.4);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  z-index: 20;
}

.tabs button {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
  margin: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.62);
  font-weight: 700;
  font-size: 10.5px;
  box-shadow: none;
  border-radius: 999px;
  padding: 9px 4px;
  /* Labels differ a lot in length ("درخواست" vs "درخواست‌های من"); with equal
     columns the longest one has to shrink rather than push the others out. */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.18s ease, background 0.18s ease;
}

.tabs button.active {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 14px rgba(139, 107, 255, 0.45);
}

/* Content used to scroll right up against the floating bar. This fades the last few
   rows out behind it instead of letting posters collide with its edge. */
.tabs::before {
  content: "";
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(72px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 15%, transparent);
  pointer-events: none;
  z-index: -1;
}

/* ---------- status badges ---------- */
.title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.badge {
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge.pending { background-color: rgba(212, 195, 77, 0.15); color: var(--warn); }
.badge.fulfilled { background-color: rgba(52, 209, 124, 0.15); color: var(--success); }
.badge.cancelled { background-color: rgba(255, 107, 129, 0.15); color: var(--danger); }

.meta {
  color: var(--text-faint);
  font-size: 12px;
  margin-top: 6px;
}

.empty-state {
  text-align: center;
  color: var(--text-faint);
  padding: 50px 20px;
  font-size: 13px;
}

.empty-state .empty-icon {
  font-size: 34px;
  margin-bottom: 10px;
  opacity: 0.6;
}

/* ---------- skeleton loaders ---------- */
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.skeleton-card {
  border-radius: var(--radius-md);
  aspect-ratio: 2 / 3;
  background: linear-gradient(100deg, rgba(255,255,255,0.04) 30%, rgba(255,255,255,0.09) 50%, rgba(255,255,255,0.04) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- notify banner ---------- */
#notify-banner {
  background: linear-gradient(135deg, rgba(139,107,255,0.18), rgba(75,107,255,0.12));
  border: 1px solid rgba(139, 107, 255, 0.3);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 13px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

#notify-banner span {
  flex: 1;
}

#notify-banner button {
  width: auto;
  margin-top: 0;
  padding: 9px 16px;
  font-size: 12px;
  white-space: nowrap;
}

/* ---------- toast ---------- */
#toast-container {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 0 20px;
  pointer-events: none;
}

.toast {
  background: var(--surface-solid);
  border: 1px solid var(--surface-border);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  animation: toastIn 0.25s ease;
  max-width: 400px;
}

.toast.success { border-color: rgba(52, 209, 124, 0.4); }
.toast.error { border-color: rgba(255, 107, 129, 0.4); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- login screen ---------- */
/* Centred rather than pinned to the top: the login screen is a short form on an
   otherwise empty page, so top-aligning it left a tall dead area underneath. */
#screen-login {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: 40px;
}

.login-hero {
  text-align: center;
  margin-top: 0;
  margin-bottom: 26px;
}

.login-hero .logo-orb {
  width: 76px;
  height: 76px;
  margin: 0 auto 16px auto;
  border-radius: 24px;
  overflow: hidden;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 34px rgba(139, 107, 255, 0.45);
  animation: orbGlow 3.2s ease-in-out infinite;
}

.login-hero .logo-orb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@keyframes orbGlow {
  0%, 100% { box-shadow: 0 12px 34px rgba(139, 107, 255, 0.45); }
  50% { box-shadow: 0 16px 46px rgba(255, 107, 214, 0.5); }
}

.login-hero h1 {
  font-family: "Vazirmatn", sans-serif;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.35;
  margin-bottom: 6px;
  background: linear-gradient(135deg, var(--text) 30%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* A soft halo behind the logo so it sits in its own pool of light rather than
   floating on flat background. */
.login-hero .logo-orb::after {
  content: "";
  position: absolute;
  inset: -40%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 107, 255, 0.35), transparent 65%);
  filter: blur(18px);
  z-index: -1;
}

.login-hero .logo-orb {
  position: relative;
  isolation: isolate;
}

.login-card {
  background: linear-gradient(160deg, rgba(28, 24, 52, 0.9), rgba(18, 20, 32, 0.9));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 20px 18px;
}

/* The two inputs sat flush against each other with nothing between them. */
.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-dim);
}

.field-optional {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-faint);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  padding: 2px 7px;
  margin-right: 4px;
}

.field input {
  /* A phone number is Latin digits reading left-to-right even inside an RTL form. */
  text-align: right;
}

.field input:focus {
  box-shadow: 0 0 0 3px rgba(139, 107, 255, 0.18);
}

#login-button {
  margin-top: 6px;
  padding: 15px;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 10px 26px rgba(139, 107, 255, 0.35);
}

.login-error {
  color: var(--danger);
  margin-top: 10px;
  text-align: center;
  font-weight: 600;
}

.login-error:empty {
  margin-top: 0;
}

.login-note {
  margin: 14px 0 0 0;
  text-align: center;
  font-size: 11.5px;
  color: var(--text-faint);
}

/* ---------- pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 18px 0 8px 0;
}

.page-btn {
  width: auto;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 16px;
  margin-top: 0;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--surface-border);
  box-shadow: none;
}

.page-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.page-btn:not(:disabled):active {
  transform: scale(0.95);
}

.page-indicator {
  text-align: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-dim);
  line-height: 1.6;
}

.page-indicator small {
  font-weight: 500;
  color: var(--text-faint);
}

/* ---------- title detail modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 4, 8, 0.72);
  backdrop-filter: blur(4px);
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.modal-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 86vh;
  overflow-y: auto;
  background-color: #141622;
  border: 1px solid var(--surface-border);
  border-radius: 22px 22px 0 0;
  padding: 18px 18px 26px 18px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}

.modal-close {
  width: auto;
  margin: 0 0 12px auto;
  display: block;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--surface-border);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
}

.modal-body {
  display: flex;
  gap: 14px;
}

.modal-poster {
  flex: 0 0 auto;
  width: 120px;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 800;
}

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

.modal-info {
  flex: 1;
  min-width: 0;
}

.modal-info h2 {
  font-size: 17px;
  margin: 0 0 6px 0;
  line-height: 1.3;
}

.title-fa {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent, #8b6bff);
  margin: -2px 0 6px 0;
}

.select-btn {
  margin-top: 16px;
  background: linear-gradient(120deg, #8b6bff 0%, #6a4be8 45%, #ff6bd6 100%);
  border: none;
  box-shadow: 0 8px 24px rgba(139, 107, 255, 0.4);
}

.select-btn.selected {
  background: linear-gradient(135deg, #34d17c, #1fa864);
  box-shadow: 0 6px 18px rgba(52, 209, 124, 0.3);
}

.select-hint {
  margin: 8px 0 0 0;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 1.6;
  background: linear-gradient(120deg, #8b6bff 0%, #ff6bd6 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.rate-box {
  margin-top: 14px;
  padding: 12px;
  background: rgba(139, 107, 255, 0.08);
  border: 1px solid rgba(139, 107, 255, 0.25);
  border-radius: var(--radius-md);
}

.rate-prompt {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0 0 10px 0;
  line-height: 1.6;
}

.rate-scale {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.rate-scale .rate-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  margin: 0;
  border-radius: 50%;
  border: 1px solid rgba(139, 107, 255, 0.45);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 10.5px;
  line-height: 1;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 0 8px rgba(139, 107, 255, 0.5);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.rate-scale .rate-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(139, 107, 255, 0.8);
}

.rate-scale .rate-btn.active {
  background: var(--accent-gradient);
  border-color: transparent;
  transform: scale(1.15);
  box-shadow: 0 0 16px rgba(139, 107, 255, 0.9), 0 0 6px rgba(255, 107, 214, 0.7);
}

.fact-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.fact-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
}

.fact-chip--runtime { background: rgba(75, 214, 255, 0.12); border-color: rgba(75, 214, 255, 0.3); color: #7fe0ff; }
.fact-chip--episodes { background: rgba(139, 107, 255, 0.14); border-color: rgba(139, 107, 255, 0.32); color: #b6a3ff; }
.fact-chip--audio { background: rgba(52, 209, 124, 0.12); border-color: rgba(52, 209, 124, 0.3); color: #6be0a0; }
.fact-chip--rating { background: rgba(255, 202, 75, 0.14); border-color: rgba(255, 202, 75, 0.35); color: var(--gold); }
.fact-chip--genres { background: rgba(255, 107, 214, 0.12); border-color: rgba(255, 107, 214, 0.3); color: #ff9fe0; }

.modal-poster.zoomable {
  cursor: zoom-in;
  position: relative;
}

.modal-poster.zoomable::after {
  content: "🔍";
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: rgba(3, 4, 8, 0.55);
  border-radius: 999px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

/* ---------- poster lightbox ---------- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(3, 4, 8, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}

.lightbox-overlay img {
  max-width: 92vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.lightbox-overlay .modal-close {
  position: absolute;
  top: 18px;
  left: 18px;
  margin: 0;
}

/* ---------- request form ---------- */
.tab-icon-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 14px;
}

/* ==================== home screen (hero + rows) ==================== */
/* Shown instead of the flat paged grid whenever nothing is filtered — see
   isHomeMode() in app.js. */

.hero {
  margin: 4px 0 20px;
}

.hero-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  border-radius: var(--radius-lg);
}

.hero-track::-webkit-scrollbar {
  display: none;
}

.hero-slide {
  position: relative;
  flex: 0 0 100%;
  scroll-snap-align: center;
  min-height: 210px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  isolation: isolate;
}

/* The poster itself, blown up and blurred, is the banner's backdrop — no separate
   wide artwork is stored, and a blurred poster reads as intentional atmosphere. */
.hero-backdrop {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(22px) saturate(1.4);
  transform: scale(1.25);
  opacity: 0.55;
  z-index: -1;
}

.hero-slide::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(7, 8, 13, 0.94) 8%, rgba(7, 8, 13, 0.55) 60%, rgba(7, 8, 13, 0.85));
  z-index: -1;
}

.hero-content {
  display: flex;
  gap: 14px;
  padding: 16px;
  align-items: center;
}

.hero-poster {
  flex: 0 0 auto;
  width: 96px;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

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

.hero-text {
  min-width: 0;
  flex: 1;
}

.hero-eyebrow {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

.hero-text h2 {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 900;
  line-height: 1.3;
}

.hero-text p {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-cta {
  width: auto;
  padding: 8px 18px;
  font-size: 12px;
  font-weight: 800;
  border-radius: 999px;
  background: var(--accent-gradient);
  border: none;
  color: #fff;
  box-shadow: 0 8px 22px rgba(139, 107, 255, 0.4);
}

.hero-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 10px;
}

.hero-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  transition: width 0.25s ease, background 0.25s ease;
  cursor: pointer;
}

.hero-dot.active {
  width: 18px;
  background: var(--accent);
}

.home-row {
  margin-bottom: 22px;
}

.row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}

.row-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.row-more {
  width: auto;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  background: transparent;
  border: none;
  box-shadow: none;
}

.row-scroller {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-bottom: 4px;
  scrollbar-width: none;
}

.row-scroller::-webkit-scrollbar {
  display: none;
}

/* A row card is a fixed-width version of the same grid card so both stay in sync
   visually — see posterCardHtml() in app.js, which builds both. */
.poster-card--row {
  flex: 0 0 108px;
  width: 108px;
  scroll-snap-align: start;
}

.hero-skeleton,
.row-skeleton {
  border-radius: var(--radius-lg);
  background: linear-gradient(100deg, #14162200 8%, rgba(255, 255, 255, 0.06) 18%, #14162200 33%);
  background-color: #141622;
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}

.hero-skeleton {
  height: 210px;
  margin-bottom: 22px;
}

.row-skeleton {
  height: 190px;
  margin-bottom: 22px;
}

/* ==================== sort picker ==================== */
.modal-sheet--short {
  max-height: 70vh;
}

.sort-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.sort-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 13px 14px;
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-md);
  color: var(--text);
  box-shadow: none;
}

.sort-option.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
}

#sort-button.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
}

/* ==================== detail modal: prev/next ==================== */
.modal-body {
  position: relative;
}

.detail-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  border-radius: 999px;
  background: rgba(20, 22, 34, 0.9);
  border: 1px solid var(--surface-border);
  color: var(--text);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(6px);
}

.detail-nav--prev {
  right: -6px;
}

.detail-nav--next {
  left: -6px;
}

.detail-nav:disabled {
  opacity: 0.25;
  box-shadow: none;
}

.detail-position {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  margin-top: 14px;
}

/* ==================== detail modal: similar titles ==================== */
.detail-similar {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--surface-border);
}

.detail-similar .row-head h3 {
  font-size: 14px;
}

/* ---------- cancel request ---------- */
/* Deliberately understated: withdrawing a request is a legitimate action but not the
   one the card is about, so it reads as a quiet secondary control until pressed. */
.cancel-request-btn {
  width: auto;
  margin-top: 12px;
  padding: 7px 14px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 999px;
  background: rgba(255, 107, 129, 0.1);
  border: 1px solid rgba(255, 107, 129, 0.28);
  color: var(--danger);
  box-shadow: none;
}

.cancel-request-btn:active {
  background: rgba(255, 107, 129, 0.2);
  transform: scale(0.96);
}

.cancel-request-btn:disabled {
  opacity: 0.55;
}

.request-card .title-row {
  margin-bottom: 4px;
}
