/* ==========================================================================
   Movie Tracker — Main Stylesheet
   Dark Netflix-like theme · Inter font · No psych-test styles (see psychTest.css)
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Backgrounds */
  --bg-base: #08080a;
  --bg-elevated: #0f0f12;
  --bg-surface: #141418;
  --bg-card: #18181c;
  --bg-card-hover: #1e1e24;
  --bg-input: #121216;
  --bg-overlay: rgba(4, 4, 8, 0.82);

  /* Text */
  --text-primary: #f5f5f7;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-dim: #52525b;

  /* Accent */
  --accent: #e50914;
  --accent-hover: #f40612;
  --accent-soft: rgba(229, 9, 20, 0.14);
  --accent-glow: rgba(229, 9, 20, 0.35);

  /* Status */
  --status-want: #3b82f6;
  --status-want-soft: rgba(59, 130, 246, 0.14);
  --status-watching: #f59e0b;
  --status-watching-soft: rgba(245, 158, 11, 0.14);
  --status-watched: #22c55e;
  --status-watched-soft: rgba(34, 197, 94, 0.14);

  /* Borders & shadows */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 64px rgba(0, 0, 0, 0.55);
  --shadow-accent: 0 8px 32px rgba(229, 9, 20, 0.25);

  /* Layout */
  --header-height: 64px;
  --chat-width: 380px;
  --content-max: 1400px;
  --section-gap: 2.5rem;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  /* Typography */
  --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', Consolas, monospace;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 0.15s;
  --duration-normal: 0.25s;
  --duration-slow: 0.4s;

  /* Z-index scale */
  --z-header: 100;
  --z-ribbon: 90;
  --z-chat: 200;
  --z-modal: 500;
  --z-battle: 600;
  --z-dropdown: 50;
}

/* ── Светлая тема ──────────────────────────────────────────────── */
html[data-theme="light"] {
  color-scheme: light;

  --bg-base: #f3f4f7;
  --bg-elevated: #ffffff;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #eef0f4;
  --bg-input: #ffffff;
  --bg-overlay: rgba(240, 241, 245, 0.85);

  --text-primary: #18181b;
  --text-secondary: #3f3f46;
  --text-muted: #6b7280;
  --text-dim: #9ca3af;

  --border-subtle: rgba(0, 0, 0, 0.07);
  --border-default: rgba(0, 0, 0, 0.12);
  --border-strong: rgba(0, 0, 0, 0.22);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 8px 32px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 16px 64px rgba(15, 23, 42, 0.18);
}

html[data-theme="light"] body {
  background:
    radial-gradient(circle at 15% 0%, rgba(229, 9, 20, 0.06), transparent 40%),
    var(--bg-base);
}

html[data-theme="light"] .app-header {
  background: rgba(255, 255, 255, 0.82);
}

html[data-theme="light"] .app-tabbar {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

body.battle-open {
  overflow: hidden;
}

img, svg, video {
  display: block;
  max-width: 100%;
}

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

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

ul, ol {
  list-style: none;
}

fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

legend {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

::selection {
  background: var(--accent-soft);
  color: var(--text-primary);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* ── Buttons ──────────────────────────────────────────────────── */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.35rem;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: background var(--duration-fast), transform var(--duration-fast), box-shadow var(--duration-fast);
  white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: var(--shadow-accent);
}

.btn-primary:active:not(:disabled) {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.2rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: border-color var(--duration-fast), color var(--duration-fast), background var(--duration-fast);
}

.btn-secondary:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.btn-cancel-pick {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  transition: color var(--duration-fast), border-color var(--duration-fast);
}

.btn-cancel-pick:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* ── Form inputs ──────────────────────────────────────────────── */

input[type="text"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="email"],
textarea,
select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-default);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.9375rem;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

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

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(229, 9, 20, 0.5);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.55;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
  width: auto;
  accent-color: var(--accent);
}

form button[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.35rem;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--duration-fast);
  margin-top: 0.5rem;
}

form button[type="submit"]:hover {
  background: var(--accent-hover);
}


/* ── Login overlay ────────────────────────────────────────────── */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(229, 9, 20, 0.12), transparent),
    var(--bg-base);
}

.login-card {
  width: min(420px, 100%);
  padding: 2.5rem 2rem;
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  animation: fadeSlideUp 0.4s var(--ease-out);
}

.login-card > h1 {
  font-size: 1.75rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 1.75rem;
  letter-spacing: -0.02em;
}

.login-card h2 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.server-hint {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
  font-size: 0.8125rem;
  margin-bottom: 1rem;
  line-height: 1.45;
}

.auth-error {
  color: #f87171;
  font-size: 0.875rem;
  min-height: 1.25rem;
  margin-top: 0.25rem;
}

.auth-switch {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 1.25rem;
}

.auth-switch button {
  color: var(--accent);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-switch button:hover {
  color: var(--accent-hover);
}

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


/* ── App header ───────────────────────────────────────────────── */

.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: rgba(8, 8, 10, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1.5rem;
  height: var(--header-height);
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.header-brand-link {
  text-decoration: none;
  transition: opacity var(--duration-fast);
}

.header-brand-link:hover {
  opacity: 0.85;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  line-height: 1;
  flex-shrink: 0;
}

.site-logo img,
.site-logo svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.28));
}

.header-brand-text h1 {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.user-greeting {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.header-nav-link {
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--duration-fast), background var(--duration-fast);
}

.header-nav-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.header-nav-link--active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.header-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #b20710);
  color: #fff;
  font-weight: 700;
  font-size: 0.9375rem;
  text-decoration: none;
  transition: transform var(--duration-fast), box-shadow var(--duration-fast);
}

.header-avatar:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-accent);
}

.logout-btn {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: color var(--duration-fast), border-color var(--duration-fast);
}

.logout-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.profile-logout-section {
  display: flex;
  justify-content: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.profile-logout-btn {
  padding: 0.7rem 1.6rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
}

.profile-logout-btn:hover {
  color: #fff;
  background: rgba(248, 113, 113, 0.16);
  border-color: rgba(248, 113, 113, 0.55);
}


/* ── Premiere ribbon ──────────────────────────────────────────── */

.premiere-ribbon {
  position: relative;
  z-index: var(--z-ribbon);
  padding: 1.25rem 0 1rem;
  background: linear-gradient(180deg, rgba(229, 9, 20, 0.06) 0%, transparent 100%);
  border-bottom: 1px solid var(--border-subtle);
  /* Не даём плиткам ленты «вылезать» за края экрана по бокам. */
  overflow: hidden;
}

.premiere-ribbon--empty {
  display: none;
}

.premiere-ribbon-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1.5rem 0.75rem;
}

.premiere-ribbon-eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

.premiere-ribbon-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.premiere-ribbon-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.premiere-sort {
  width: auto;
  min-width: 140px;
  padding: 0.4rem 2rem 0.4rem 0.65rem;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.premiere-ribbon-stage {
  position: relative;
  max-width: var(--content-max);
  margin: 0 auto;
}

.premiere-ribbon-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--accent);
  color: #fff;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  box-shadow: var(--shadow-accent), 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: background var(--duration-fast), transform var(--duration-fast), box-shadow var(--duration-fast);
}

.premiere-ribbon-nav--prev {
  left: 0.35rem;
}

.premiere-ribbon-nav--next {
  right: 0.35rem;
}

.premiere-ribbon-nav:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-50%) scale(1.1);
  box-shadow: var(--shadow-accent), 0 12px 32px rgba(0, 0, 0, 0.55);
}

.premiere-ribbon-nav:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.premiere-ribbon-viewport {
  overflow: hidden;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.premiere-ribbon-track {
  display: flex;
  gap: 2.25rem;
  transition: transform 0.45s var(--ease-out);
  will-change: transform;
}

.premiere-ribbon-empty {
  padding: 1.5rem 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.premiere-ribbon-empty.rec-loading {
  display: flex;
  justify-content: center;
  width: 100%;
  min-width: 100%;
}

.premiere-ribbon-progress {
  height: 2px;
  max-width: var(--content-max);
  margin: 0.75rem auto 0;
  padding: 0 1.5rem;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.premiere-ribbon-progress::after {
  content: '';
  display: block;
  height: 100%;
  width: var(--progress, 0%);
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.35s var(--ease-out);
}

.premiere-ribbon-card {
  flex: 0 0 min(320px, 85vw);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  transition: transform var(--duration-normal), box-shadow var(--duration-normal), border-color var(--duration-normal);
}

.premiere-ribbon-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-default);
}

.premiere-ribbon-poster {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--bg-elevated);
  overflow: hidden;
}

.premiere-ribbon-poster--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  opacity: 0.4;
}

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

.premiere-ribbon-body {
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.premiere-ribbon-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.premiere-ribbon-badge {
  display: inline-flex;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.premiere-ribbon-badge--date {
  background: var(--accent-soft);
  color: #ff6b6b;
}

.premiere-ribbon-badge--tv {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

.premiere-ribbon-badge--list {
  background: var(--status-watched-soft);
  color: var(--status-watched);
}

.premiere-ribbon-card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.premiere-ribbon-original {
  display: block;
  font-size: 0.8125rem;
  font-style: italic;
  color: var(--text-muted);
  line-height: 1.3;
  min-height: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.premiere-ribbon-original--empty {
  visibility: hidden;
}

.premiere-ribbon-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.premiere-ribbon-overview {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.premiere-ribbon-reason {
  font-size: 0.8125rem;
  color: #a8b4ff;
  line-height: 1.4;
}

.premiere-ribbon-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.35rem;
}

.premiere-ribbon-btn {
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 500;
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-secondary);
  transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast);
}

.premiere-ribbon-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.premiere-ribbon-btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.premiere-ribbon-btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}


/* ── App layout ───────────────────────────────────────────────── */

.app-layout {
  display: flex;
  max-width: calc(var(--content-max) + var(--chat-width));
  margin: 0 auto;
}

.main-content {
  flex: 1;
  min-width: 0;
  padding: 0 1.5rem 4rem;
}

/* На широком экране второстепенные секции идут в две колонки,
   чтобы не оставалось много пустоты по бокам. */
.home-grid {
  margin-top: var(--section-gap);
}

@media (min-width: 1100px) {
  .home-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--section-gap);
    align-items: start;
  }

  .home-grid > .content-section {
    margin-top: 0;
  }
}

.page-content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 1.5rem 1.5rem 4rem;
}

.page-content--battle {
  max-width: 720px;
}

.page-content--account {
  max-width: 960px;
}

.content-section {
  margin-top: var(--section-gap);
}

.content-section--primary {
  margin-top: 1.75rem;
}

.content-row {
  margin-top: var(--section-gap);
}

.section-heading {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.panel-hint {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-top: 0.35rem;
  line-height: 1.5;
}

/* ── Hero section ─────────────────────────────────────────────── */

.hero-section {
  position: relative;
  margin-top: 1.5rem;
  padding: 3rem 2rem;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 80% at 80% 20%, rgba(229, 9, 20, 0.18), transparent),
    radial-gradient(ellipse 50% 60% at 10% 80%, rgba(59, 130, 246, 0.08), transparent),
    linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border-subtle);
}

.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.5;
  pointer-events: none;
}

.hero-content {
  position: relative;
  max-width: 560px;
}

.hero-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.hero-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.hero-subtitle {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 1.5rem;
  max-width: 480px;
}

.watch-now-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--duration-fast), transform var(--duration-fast), box-shadow var(--duration-fast);
  box-shadow: var(--shadow-accent);
}

.watch-now-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 12px 40px rgba(229, 9, 20, 0.35);
}

.watch-now-btn:active {
  transform: translateY(0);
}


/* ── Battle promo (home) ──────────────────────────────────────── */

.battle-promo {
  margin-top: var(--section-gap);
}

.battle-promo-inner {
  display: grid;
  grid-template-columns: 1fr min(280px, 100%);
  gap: 1.5rem;
  padding: 1.75rem;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(229, 9, 20, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
  border: 1px solid var(--border-subtle);
}

.battle-promo-head {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
}

.battle-promo-icon {
  font-size: 1.75rem;
  line-height: 1;
  flex-shrink: 0;
}

.battle-promo-eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.15rem;
}

.battle-promo-title {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.battle-promo-desc {
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 0.85rem;
  font-size: 0.9375rem;
}

.battle-promo-points {
  margin: 0 0 1.25rem;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.6;
}

.battle-promo-points li {
  list-style: disc;
  margin-bottom: 0.25rem;
}

.battle-start-btn,
.battle-promo-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: background var(--duration-fast), box-shadow var(--duration-fast), transform var(--duration-fast);
}

.battle-start-btn:hover,
.battle-promo-btn:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-accent);
}

.battle-start-btn:active,
.battle-promo-btn:active {
  transform: scale(0.98);
}

.battle-home-top,
.battle-promo-top {
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
}

.battle-home-top-title {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.battle-home-top-meta {
  font-size: 0.8125rem;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.battle-home-top-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.battle-home-top-list li {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 500;
}

.battle-home-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.battle-home-section {
  text-align: center;
  padding: 2rem 1.5rem;
}

.battle-home-desc {
  color: var(--text-secondary);
  max-width: 520px;
  margin: 0.75rem auto 1.5rem;
  line-height: 1.55;
}

.battle-page-section .battle-start-btn {
  margin-top: 0.5rem;
}


/* ── Movie list section ───────────────────────────────────────── */

.movie-list-section {
  scroll-margin-top: calc(var(--header-height) + 1rem);
}

.list-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.list-header-top {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.list-header-title-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.65rem;
}

.list-header-controls {
  justify-content: center;
}

.list-count {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.list-header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.list-view-toggle {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.list-view-btn {
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--duration-fast), background var(--duration-fast);
}

.list-view-btn:hover {
  color: var(--text-secondary);
}

.list-view-btn--active {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.media-tabs {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.media-tab {
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--duration-fast), background var(--duration-fast);
}

.media-tab:hover {
  color: var(--text-secondary);
}

.media-tab--active {
  background: var(--accent-soft);
  color: #ff8a8a;
}

.list-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.list-search {
  flex: 1 1 220px;
  min-width: 180px;
  max-width: 360px;
  padding: 0.55rem 0.85rem 0.55rem 2.25rem;
  border-radius: var(--radius-pill);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.75rem center;
}

.release-filter {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.release-filter-btn {
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--duration-fast), background var(--duration-fast);
}

.release-filter-btn:hover {
  color: var(--text-secondary);
}

.release-filter-btn--active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

.add-series-btn {
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px dashed var(--border-default);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: border-color var(--duration-fast), color var(--duration-fast), background var(--duration-fast);
}

.add-series-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.filters select {
  width: auto;
  min-width: 130px;
  padding: 0.45rem 2rem 0.45rem 0.65rem;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
}

.reset-filters-btn {
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(229, 9, 20, 0.35);
  background: var(--accent-soft);
  color: #ff8a8a;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}

.reset-filters-btn:hover {
  background: rgba(229, 9, 20, 0.22);
  border-color: rgba(229, 9, 20, 0.5);
}

.empty-message {
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}


/* ── Status groups (grid view) ──────────────────────────────────── */

.status-group {
  margin-bottom: 2rem;
}

.status-group-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.65rem 0;
  margin-bottom: 0.85rem;
  border: none;
  background: none;
  cursor: pointer;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  transition: border-color var(--duration-fast);
}

.status-group-header:hover {
  border-color: var(--border-default);
}

.status-group-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.status-group-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
}

.status-group[data-status="want"] .status-group-title { color: var(--status-want); }
.status-group[data-status="want"] .status-group-count { background: var(--status-want-soft); color: var(--status-want); }
.status-group[data-status="watching"] .status-group-title { color: var(--status-watching); }
.status-group[data-status="watching"] .status-group-count { background: var(--status-watching-soft); color: var(--status-watching); }
.status-group[data-status="watched"] .status-group-title { color: var(--status-watched); }
.status-group[data-status="watched"] .status-group-count { background: var(--status-watched-soft); color: var(--status-watched); }

.status-group-chevron {
  margin-left: auto;
  color: var(--text-dim);
  font-size: 0.875rem;
  transition: transform var(--duration-normal);
}

.status-group--collapsed .status-group-chevron {
  transform: rotate(-90deg);
}

.status-group--collapsed .status-group-grid {
  display: none;
}

.status-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 1rem;
}

.status-group-empty {
  grid-column: 1 / -1;
  padding: 1.5rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.875rem;
  border-radius: var(--radius-md);
  border: 1px dashed var(--border-subtle);
}

/* ── Movie list containers ──────────────────────────────────────── */

.movie-list {
  display: contents;
}

.movie-list--grid {
  display: contents;
}

.movie-list--list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.movie-list-flat {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}


/* ── Movie cards — grid view ────────────────────────────────────── */

.movie-card {
  position: relative;
  list-style: none;
}

.movie-card--grid {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  transition: transform var(--duration-normal), box-shadow var(--duration-normal), border-color var(--duration-normal);
}

.movie-card--grid:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-default);
}

.movie-card--grid.movie-card--menu-open {
  overflow: visible;
  z-index: calc(var(--z-dropdown) + 2);
  transform: none;
  box-shadow: var(--shadow-md);
  border-color: var(--border-default);
}

.movie-card--grid.movie-card--menu-open .movie-card-menu-btn {
  opacity: 1;
}

.movie-card--grid.movie-card--unreleased {
  opacity: 0.85;
}

.movie-card--grid.movie-card--unreleased .movie-grid-poster-wrap::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(8, 8, 10, 0.7));
  pointer-events: none;
}

.movie-grid-poster-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--bg-elevated);
  overflow: hidden;
}

.movie-poster-link--grid {
  display: block;
  width: 100%;
  height: 100%;
}

.movie-poster--grid {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow);
}

.movie-card--grid:hover .movie-poster--grid {
  transform: scale(1.04);
}

.movie-poster--empty.movie-poster--grid {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 2.5rem;
  opacity: 0.35;
  background: var(--bg-elevated);
}

.movie-grid-body {
  padding: 0.65rem 0.75rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.movie-grid-title {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color var(--duration-fast);
}

.movie-grid-title:hover {
  color: var(--accent);
}

.movie-grid-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.movie-grid-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.media-badge {
  display: inline-flex;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-pill);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.media-badge--tv {
  background: rgba(139, 92, 246, 0.15);
  color: #a78bfa;
}

.media-badge--grid {
  font-size: 0.5625rem;
}

.release-badge {
  display: inline-flex;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-pill);
  font-size: 0.625rem;
  font-weight: 600;
}

.release-badge--upcoming {
  background: rgba(245, 158, 11, 0.15);
  color: var(--status-watching);
}

/* Grid card menu */
.movie-card-menu--grid {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  z-index: var(--z-dropdown);
}

.movie-card-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: rgba(8, 8, 10, 0.75);
  backdrop-filter: blur(8px);
  color: var(--text-primary);
  font-size: 1rem;
  line-height: 1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  opacity: 0;
  transition: opacity var(--duration-fast), background var(--duration-fast);
}

.movie-card--grid:hover .movie-card-menu-btn,
.movie-card--menu-open .movie-card-menu-btn {
  opacity: 1;
}

.movie-card-menu-btn:hover {
  background: rgba(8, 8, 10, 0.9);
}

.movie-card-menu-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 190px;
  max-height: min(70vh, 24rem);
  overflow-y: auto;
  padding: 0.35rem;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  z-index: calc(var(--z-dropdown) + 1);
}

.movie-card-menu-section {
  padding: 0.35rem 0.65rem 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.movie-card-menu-divider {
  height: 1px;
  margin: 0.25rem 0;
  background: var(--border-subtle);
}

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  transition: background var(--duration-fast), color var(--duration-fast);
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.menu-item--active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.menu-item--status[data-status="want"].menu-item--active { color: var(--status-want); }
.menu-item--status[data-status="watching"].menu-item--active { color: var(--status-watching); }
.menu-item--status[data-status="watched"].menu-item--active { color: var(--status-watched); }

.menu-item--danger {
  color: #f87171;
}

.menu-item--danger:hover {
  background: rgba(248, 113, 113, 0.12);
  color: #fca5a5;
}


/* ── Movie cards — list view ────────────────────────────────────── */

.movie-card--list {
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  transition: border-color var(--duration-normal), box-shadow var(--duration-normal);
}

.movie-card--list:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
}

.movie-card--list.movie-card--unreleased {
  border-left: 3px solid var(--status-watching);
}

.movie-card__body {
  display: grid;
  grid-template-columns: 120px 1fr auto;
  gap: 1.25rem;
  padding: 1.25rem;
  align-items: start;
}

.movie-poster-link {
  display: block;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.movie-poster {
  width: 120px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.movie-poster--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  opacity: 0.35;
}

.movie-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.movie-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.movie-title-link {
  transition: color var(--duration-fast);
}

.movie-title-link:hover {
  color: var(--accent);
}

.movie-original-title {
  display: block;
  width: 100%;
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-muted);
  font-style: italic;
}

.movie-watch-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--accent);
  transition: opacity var(--duration-fast);
}

.movie-watch-link:hover {
  opacity: 0.8;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.movie-meta-line {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.movie-people-line {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.person-link {
  color: #93c5fd;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  transition: color var(--duration-fast);
}

.person-link:hover {
  color: #bfdbfe;
}

.external-ratings {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  transition: opacity var(--duration-fast);
}

.rating-badge:hover {
  opacity: 0.85;
}

.rating-badge--imdb {
  background: rgba(245, 197, 24, 0.12);
  color: #f5c518;
}

.rating-badge--kp {
  background: rgba(255, 102, 0, 0.12);
  color: #ff8533;
}

.rating-badge__source {
  font-weight: 700;
  font-size: 0.6875rem;
  text-transform: uppercase;
}

.rating-badge__votes {
  color: var(--text-dim);
  font-weight: 400;
}

.status-badge {
  display: inline-flex;
  align-self: flex-start;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
}

.movie-card[data-status="want"] .status-badge {
  background: var(--status-want-soft);
  color: var(--status-want);
}

.movie-card[data-status="watching"] .status-badge {
  background: var(--status-watching-soft);
  color: var(--status-watching);
}

.movie-card[data-status="watched"] .status-badge {
  background: var(--status-watched-soft);
  color: var(--status-watched);
}

.rating {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.rating--personal strong {
  color: var(--text-primary);
  font-weight: 700;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.15rem;
}

.tag-chip {
  display: inline-flex;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-pill);
  font-size: 0.6875rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.movie-overview {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 0.25rem;
}

.overview-toggle {
  display: inline-block;
  margin-top: 0.25rem;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.overview-toggle:hover {
  color: var(--accent-hover);
}

.overview-full {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* List card actions */
.movie-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex-shrink: 0;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast);
}

.action-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.action-btn svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.movie-card__footer {
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem 1.25rem;
  border-top: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.02);
}

.footer-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: background var(--duration-fast), color var(--duration-fast);
}

.footer-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.footer-btn--delete:hover {
  background: rgba(248, 113, 113, 0.1);
  color: #f87171;
}


/* ── Recommendations row ────────────────────────────────────────── */

.recommendations-box {
  padding: 1.25rem 0;
}

.rec-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0 0.25rem;
}

.rec-refresh-btn,
.premiere-refresh-btn {
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: color var(--duration-fast), border-color var(--duration-fast), background var(--duration-fast);
}

.rec-refresh-btn:hover:not(:disabled),
.premiere-refresh-btn:hover:not(:disabled) {
  color: var(--text-primary);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
}

.rec-refresh-btn:disabled,
.premiere-refresh-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.content-row-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.content-row-scroll::-webkit-scrollbar {
  height: 6px;
}

.content-row-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.content-row-scroll::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-pill);
}

#recommendations-list {
  display: flex;
  gap: 1rem;
  padding: 0.25rem;
}

.rec-item {
  flex: 0 0 min(260px, 75vw);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: transform var(--duration-normal), border-color var(--duration-normal), box-shadow var(--duration-normal);
}

.rec-item:hover {
  transform: translateY(-2px);
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
}

.rec-poster {
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elevated);
}

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

.rec-poster--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  opacity: 0.35;
}

/* Кликабельные постер/название рекомендации → страница фильма. */
.rec-poster-link {
  display: block;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.rec-title-link {
  color: inherit;
  text-decoration: none;
}

.rec-title-link:hover strong {
  color: var(--accent);
  text-decoration: underline;
}

.rec-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
}

.rec-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
}

.rec-title-row strong {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
}

.rec-year,
.pick-year {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 400;
}

.rec-original-title,
.pick-original-title {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-style: italic;
}

.rec-reason,
.pick-reason {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.pick-why {
  font-size: 0.8125rem;
  color: #a8b4ff;
  line-height: 1.4;
  margin-top: 0.25rem;
}

.rec-add-btn,
.pick-add-btn,
.premiere-add-btn {
  align-self: flex-end;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1;
  transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast), transform var(--duration-fast);
}

.rec-add-btn:hover:not(:disabled),
.pick-add-btn:hover:not(:disabled),
.premiere-add-btn:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: rgba(229, 9, 20, 0.4);
  color: var(--accent);
  transform: scale(1.05);
}

.rec-add-btn--added,
.premiere-add-btn--added {
  background: var(--status-watched-soft);
  border-color: rgba(34, 197, 94, 0.35);
  color: var(--status-watched);
}

.rec-loading,
.rec-empty {
  padding: 1.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
  text-align: center;
  width: 100%;
  list-style: none;
}

.rec-loading .loading-ui {
  margin: 0 auto;
}

/* ── Unified loading animations ───────────────────────────────────── */

.loading-ui {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  padding: 0.25rem 0;
  color: var(--text-muted);
}

.loading-ui--inline {
  flex-direction: row;
  justify-content: center;
  gap: 0.65rem;
}

.loading-ui--compact {
  gap: 0.55rem;
  padding: 0;
}

.loading-ui--panel {
  padding: 3rem 1rem;
}

.loading-ui--thinking:not(.loading-ui--ai) {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.6rem;
  padding: 0;
}

.loading-ui--thinking.loading-ui--ai {
  align-items: stretch;
  padding: 0;
}

.loading-ui__spinner-wrap {
  position: relative;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.loading-ui__spinner-wrap--sm {
  width: 20px;
  height: 20px;
}

.loading-ui__spinner-wrap--lg {
  width: 36px;
  height: 36px;
}

.loading-ui__spinner {
  position: absolute;
  inset: 0;
  border: 2.5px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent, #6366f1);
  border-right-color: rgba(99, 102, 241, 0.45);
  border-radius: 50%;
  animation: loadingSpin 0.85s linear infinite;
  will-change: transform;
  box-shadow: 0 0 14px rgba(99, 102, 241, 0.35);
}

.loading-ui__spinner::after {
  content: '';
  position: absolute;
  inset: 5px;
  border: 2px solid transparent;
  border-bottom-color: rgba(167, 139, 250, 0.85);
  border-left-color: rgba(167, 139, 250, 0.35);
  border-radius: 50%;
  animation: loadingSpin 1.15s linear infinite reverse;
}

.loading-ui__spinner-wrap--sm .loading-ui__spinner {
  border-width: 2px;
}

.loading-ui__spinner-wrap--sm .loading-ui__spinner::after {
  inset: 3px;
  border-width: 1.5px;
}

.loading-ui__spinner-wrap--lg .loading-ui__spinner {
  border-width: 3px;
}

.loading-ui__spinner-wrap--lg .loading-ui__spinner::after {
  inset: 6px;
  border-width: 2.5px;
}

.loading-ui--ai {
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  gap: 0.65rem;
}

.loading-ui--ai .loading-ui__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
}

.loading-ui--thinking .loading-ui__row {
  justify-content: flex-start;
}

.loading-ui__progress {
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.loading-ui__progress-fill {
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--accent, #6366f1), rgba(167, 139, 250, 0.95), transparent);
  animation: loadingProgress 1.35s ease-in-out infinite;
  will-change: transform;
}

.loading-ui-ai-block {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1rem;
  width: 100%;
}

.rec-loading--ai {
  padding: 1rem 0.75rem 1.25rem;
}

.rec-loading--ai .loading-ui-ai-block {
  gap: 0.85rem;
}

.rec-loading--ai .loading-ui--ai .loading-ui__row {
  justify-content: flex-start;
}

.loading-ui__dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  flex-shrink: 0;
}

.loading-ui__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent, #6366f1);
  animation: loadingDotBounce 1.2s ease-in-out infinite;
}

.loading-ui__dot:nth-child(2) { animation-delay: 0.15s; }
.loading-ui__dot:nth-child(3) { animation-delay: 0.3s; }

.loading-ui__text {
  font-size: 0.9375rem;
  line-height: 1.4;
}

.loading-ui__ellipsis::after {
  content: '';
  animation: loadingEllipsis 1.4s steps(4, end) infinite;
}

@keyframes loadingSpin {
  to { transform: rotate(360deg); }
}

@keyframes loadingDotBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.35; }
  40% { transform: translateY(-5px); opacity: 1; }
}

@keyframes loadingEllipsis {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

@keyframes loadingProgress {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

.loading-ui-skeleton-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.loading-ui-skeleton-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 1rem;
  padding: 1rem;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  animation: loadingFadeIn 0.35s ease both;
}

.loading-ui-skeleton-poster {
  width: 88px;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.1), rgba(255,255,255,0.04));
  background-size: 200% 100%;
  animation: loadingShimmer 1.2s infinite;
}

.loading-ui-skeleton-body {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  justify-content: center;
}

.loading-ui-skeleton-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.1), rgba(255,255,255,0.04));
  background-size: 200% 100%;
  animation: loadingShimmer 1.2s infinite;
}

.loading-ui-skeleton-line--title {
  height: 16px;
  width: 72%;
}

.loading-ui-skeleton-line--short {
  width: 45%;
}

.loading-ui-skeleton-block {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  width: 100%;
}

.loading-ui-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  width: 100%;
}

.loading-ui-stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 1rem 0.75rem;
  border-radius: var(--radius-md, 12px);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  animation: loadingFadeIn 0.35s ease both;
}

.loading-ui-stat-num {
  width: 48px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.1), rgba(255,255,255,0.04));
  background-size: 200% 100%;
  animation: loadingShimmer 1.2s infinite;
}

.loading-ui-stat-label {
  width: 72px;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  background-size: 200% 100%;
  animation: loadingShimmer 1.2s infinite;
  animation-delay: 0.15s;
}

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

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

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ── Pick results (collections, modals) ─────────────────────────── */

.pick-results {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.pick-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 0.85rem;
  align-items: start;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  transition: border-color var(--duration-fast), background var(--duration-fast);
}

.pick-item:hover {
  border-color: var(--border-default);
  background: rgba(255, 255, 255, 0.04);
}

.pick-poster {
  width: 56px;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elevated);
  flex-shrink: 0;
}

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

.pick-poster-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1.25rem;
  opacity: 0.35;
}

.pick-info {
  min-width: 0;
}

.pick-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}

.pick-title-row strong {
  font-size: 0.9375rem;
  font-weight: 600;
}

.from-list-badge {
  display: inline-flex;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-pill);
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--status-want-soft);
  color: var(--status-want);
}

.from-list-badge--new {
  background: var(--accent-soft);
  color: #ff8a8a;
}

/* Why toggle */
.why-toggle {
  margin-top: 0.35rem;
}

.why-toggle-btn {
  padding: 0;
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--duration-fast);
}

.why-toggle-btn:hover,
.why-toggle-btn--open {
  color: var(--text-muted);
}

.why-toggle-panel {
  margin-top: 0.35rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
}


/* ── Collections section ────────────────────────────────────────── */

.collections-section {
  padding: 1.5rem;
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.preset-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 1.25rem;
}

.preset-btn {
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast), transform var(--duration-fast);
}

.preset-btn:hover {
  background: var(--accent-soft);
  border-color: rgba(229, 9, 20, 0.35);
  color: #ffaaaa;
  transform: translateY(-1px);
}

.collection-free {
  display: flex;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.collection-free input {
  flex: 1;
  border-radius: var(--radius-pill);
  padding: 0.65rem 1rem;
}

.collection-free button {
  flex-shrink: 0;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: background var(--duration-fast);
}

.collection-free button:hover {
  background: var(--accent-hover);
}


/* ── Premiere suggest section ───────────────────────────────────── */

.premiere-suggest-section {
  padding: 1.25rem 0;
}

.premiere-suggest-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.premiere-hint {
  margin-bottom: 1rem;
}

.premiere-compact-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.premiere-compact-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 0.85rem;
  align-items: start;
  padding: 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.premiere-compact-item:hover {
  border-color: var(--border-default);
  box-shadow: var(--shadow-sm);
}

.premiere-compact-poster {
  width: 64px;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elevated);
}

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

.premiere-compact-poster--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  opacity: 0.35;
}

.premiere-compact-info {
  min-width: 0;
}

.premiere-compact-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
}

.premiere-compact-title-row strong {
  font-size: 0.9375rem;
  font-weight: 600;
}

.premiere-compact-year {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.premiere-compact-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.premiere-compact-reason {
  font-size: 0.8125rem;
  color: #a8b4ff;
  margin-top: 0.25rem;
  line-height: 1.4;
}

.premiere-compact-actions {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-end;
}

.premiere-sublist--empty {
  display: none;
}


/* ── Blacklist section ──────────────────────────────────────────── */

.blacklist-section {
  padding: 1.5rem;
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.blacklist-section--standalone {
  margin-top: var(--section-gap);
}

.blacklist-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem 1rem;
  margin-top: 1rem;
}

.blacklist-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.blacklist-form button[type="submit"] {
  grid-column: 1 / -1;
  justify-self: start;
}

/* ── Import / Export section ────────────────────────────────────── */

.import-section {
  padding: 1.5rem;
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.import-formats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 1rem 0 0.85rem;
}

.import-formats select {
  flex: 1 1 200px;
  max-width: 360px;
}

#import-text {
  width: 100%;
  min-height: 140px;
  margin-bottom: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.import-actions button {
  padding: 0.6rem 1.15rem;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background var(--duration-fast);
}

.import-actions button:hover {
  background: var(--accent-hover);
}

.import-actions button:last-child {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
}

.import-actions button:last-child:hover {
  background: rgba(255, 255, 255, 0.12);
}

.import-status {
  font-size: 0.875rem;
  color: var(--text-muted);
  min-height: 1.25rem;
  margin-top: 0.35rem;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.export-actions > span {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.export-btn {
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast);
}

.export-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  border-color: var(--border-strong);
}


/* ── Chat panel ─────────────────────────────────────────────────── */

.chat-panel {
  position: fixed;
  top: var(--header-height);
  right: 0;
  bottom: 0;
  width: var(--chat-width);
  z-index: var(--z-chat);
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.35);
  transform: translateX(100%);
  transition: transform var(--duration-normal) var(--ease-out);
}

.chat-panel--open {
  transform: translateX(0);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.chat-header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.875rem;
  flex-shrink: 0;
}

.chat-header h2 {
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.2;
}

.chat-header-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

.chat-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 0.875rem;
  transition: background var(--duration-fast), color var(--duration-fast);
  flex-shrink: 0;
}

.chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.chat-message {
  max-width: 92%;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  line-height: 1.5;
  animation: fadeSlideUp 0.25s var(--ease-out);
}

.chat-message--user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-message--bot {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 4px;
}

.chat-message--error {
  align-self: flex-start;
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: #fca5a5;
}

.chat-message--loading {
  opacity: 0.92;
}

.chat-message--loading .loading-ui--thinking {
  min-height: 1.25rem;
}

/* ── Карточки рекомендаций в чате ─────────────────────────────────── */
.chat-rec-message {
  max-width: 100%;
  align-self: stretch;
  background: transparent;
  border: none;
  padding: 0;
}

.chat-rec-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.chat-rec-card {
  display: flex;
  gap: 0.7rem;
  padding: 0.6rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  transition: border-color 0.2s var(--ease-out), opacity 0.2s var(--ease-out);
}

.chat-rec-card--done {
  opacity: 0.78;
  border-color: var(--accent);
}

.chat-rec-poster {
  flex: 0 0 64px;
  width: 64px;
  height: 96px;
  border-radius: var(--radius-md, 8px);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

/* Кликабельные постер/название карточки чата → страница фильма. */
.chat-rec-poster-link {
  flex: 0 0 64px;
  display: block;
}

.chat-rec-title-link {
  color: inherit;
  text-decoration: none;
}

.chat-rec-title-link:hover .chat-rec-title {
  color: var(--accent);
  text-decoration: underline;
}

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

.chat-rec-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.chat-rec-title-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.chat-rec-title {
  font-size: 0.9rem;
  line-height: 1.25;
}

.chat-rec-year {
  font-size: 0.78rem;
  color: var(--text-muted, #9ca3af);
}

.chat-rec-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
}

.chat-rec-tag,
.chat-rec-rating,
.chat-rec-genre {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-muted, #cbd5e1);
  white-space: nowrap;
}

.chat-rec-rating {
  color: #fbbf24;
  background: rgba(251, 191, 36, 0.12);
}

.chat-rec-reason {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--text-secondary, #cbd5e1);
  margin: 0;
}

.chat-rec-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.15rem;
}

.chat-rec-btn {
  font-size: 0.72rem;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary, #e5e7eb);
  cursor: pointer;
  transition: background 0.15s var(--ease-out), border-color 0.15s var(--ease-out), opacity 0.15s var(--ease-out);
}

.chat-rec-btn:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.chat-rec-btn--blacklist:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.85);
  border-color: rgba(248, 113, 113, 0.85);
}

.chat-rec-btn:disabled {
  cursor: default;
  opacity: 0.5;
}

.chat-rec-btn--active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  opacity: 1;
}

.chat-rec-notice {
  font-size: 0.72rem;
  min-height: 0.9rem;
}

.chat-rec-notice--ok {
  color: #4ade80;
}

.chat-rec-notice--warn {
  color: #fbbf24;
}

.chat-paragraph {
  margin: 0 0 0.5rem;
}

.chat-paragraph:last-child {
  margin-bottom: 0;
}

.chat-paragraph--muted {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.chat-list {
  margin: 0.35rem 0 0.5rem;
  padding-left: 1.1rem;
}

.chat-list--ul {
  list-style: disc;
}

.chat-list--ol {
  list-style: decimal;
}

.chat-list li {
  margin-bottom: 0.2rem;
  color: var(--text-secondary);
}

.chat-notice {
  margin: 0.35rem 0;
  padding: 0.45rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
}

.chat-notice--warn {
  background: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
}

.chat-notice--accent {
  background: var(--accent-soft);
  color: #ffaaaa;
}

.chat-movie-title {
  color: #ffaaaa;
  font-weight: 500;
}

.chat-inline-code {
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  font-family: var(--font-mono);
  font-size: 0.8125em;
}

.chat-form {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem 1.15rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  flex-shrink: 0;
}

.chat-form input {
  flex: 1;
  border-radius: var(--radius-pill);
  padding: 0.6rem 1rem;
}

.chat-form button {
  flex-shrink: 0;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  transition: background var(--duration-fast);
}

.chat-form button:hover:not(:disabled) {
  background: var(--accent-hover);
}

.chat-form button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-toggle-btn {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: calc(var(--z-chat) - 1);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
  box-shadow: var(--shadow-accent);
  transition: background var(--duration-fast), transform var(--duration-fast), box-shadow var(--duration-fast);
}

.chat-toggle-btn:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(229, 9, 20, 0.4);
}

.chat-toggle-btn--fixed {
  /* alias — same as .chat-toggle-btn */
}

.chat-panel--open ~ .chat-toggle-btn,
.chat-panel:not(.hidden).chat-panel--open ~ .chat-toggle-btn {
  display: none;
}


/* ── Modal overlay ──────────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg-overlay);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
  display: none !important;
}

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

.modal {
  width: min(640px, 100%);
  max-height: min(85vh, 800px);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn 0.3s var(--ease-out);
  overflow: hidden;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-header button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 0.875rem;
  flex-shrink: 0;
  transition: background var(--duration-fast), color var(--duration-fast);
}

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

.modal-body {
  padding: 1.25rem 1.35rem;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
}

/* Notes form */
.notes-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.notes-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.notes-form textarea {
  min-height: 72px;
}

/* History modal */
.history-modal {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.history-added,
.history-watched {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.history-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  font-size: 0.875rem;
}

.history-item time {
  grid-column: 1 / -1;
  font-size: 0.75rem;
  color: var(--text-dim);
}

.history-item strong {
  color: var(--text-primary);
  font-weight: 600;
}

.history-item span {
  color: var(--text-secondary);
}

.history-empty {
  padding: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* TMDB picker */
.tmdb-pick-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
  max-height: 50vh;
  overflow-y: auto;
}

.tmdb-pick {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 0.75rem;
  padding: 0.65rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: border-color var(--duration-fast), background var(--duration-fast);
}

.tmdb-pick:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.tmdb-pick img {
  width: 56px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.tmdb-pick-no-poster {
  width: 56px;
  aspect-ratio: 2 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-size: 1.25rem;
  opacity: 0.35;
}

.tmdb-pick strong {
  font-size: 0.9375rem;
}

.tmdb-pick small {
  display: block;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.tmdb-pick p {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  line-height: 1.4;
}

/* Duplicate modal */
.dup-modal {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dup-existing {
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Person modal */
.person-modal {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.person-photo {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--border-default);
}

.person-insight {
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  background: rgba(168, 180, 255, 0.08);
  border: 1px solid rgba(168, 180, 255, 0.15);
  color: #c4b5fd;
  font-size: 0.9375rem;
  line-height: 1.5;
}

/* Watch now modal */
.watch-now-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.watch-now-form fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
}

.watch-now-form label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9375rem;
  color: var(--text-primary);
  cursor: pointer;
  margin-bottom: 0;
}

.watch-now-form input[type="radio"] {
  width: auto;
  accent-color: var(--accent);
}

.watch-now-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
}

.watch-now-results-count {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}


/* ── Account page ───────────────────────────────────────────────── */

.account-hero {
  text-align: center;
  padding: 1.5rem 0 0.5rem;
}

.stats-section {
  padding: 1.5rem;
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 1.75rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 1.25rem 1rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  text-align: center;
  transition: border-color var(--duration-fast), transform var(--duration-fast);
}

.stat-card:hover {
  border-color: var(--border-default);
  transform: translateY(-2px);
}

.stat-num {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stats-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.stats-details h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-secondary);
}

.stats-details ul {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.stats-details ul li {
  font-size: 0.875rem;
  color: var(--text-secondary);
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border-subtle);
}

.stats-details ul li:last-child {
  border-bottom: none;
}

#stats-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.monthly-chart li {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  align-items: center;
  gap: 0.65rem;
}

.bar-wrap {
  height: 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #ff6b6b);
  transition: width 0.5s var(--ease-out);
}

.taste-section {
  padding: 1.5rem;
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
}

.taste-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.taste-analysis-content {
  margin-top: 1.25rem;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.taste-insights-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.taste-insights-list li {
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.03);
  border-left: 3px solid var(--accent);
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.5;
}


/* ── Battle overlay ─────────────────────────────────────────────── */

.battle-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-battle);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  transition: opacity 0.28s ease;
}

.battle-overlay.hidden {
  display: none !important;
}

.battle-overlay--visible {
  opacity: 1;
}

.battle-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 4, 8, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.battle-shell {
  position: relative;
  width: min(960px, 100%);
  max-height: min(92vh, 900px);
  z-index: 1;
}

.battle-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-height: min(92vh, 900px);
  overflow-y: auto;
  padding: 1.5rem;
  scrollbar-width: thin;
}

.battle-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.battle-header-left {
  min-width: 0;
}

.battle-header-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.battle-progress-label {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.battle-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 0.875rem;
  flex-shrink: 0;
  transition: background var(--duration-fast), color var(--duration-fast);
}

.battle-close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
}

.battle-fade-in {
  animation: fadeSlideUp 0.35s var(--ease-out);
}

.battle-mode-sections {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
}

.battle-mode-section-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.battle-mode-section-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.battle-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.battle-mode-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--duration-fast), background var(--duration-fast), transform var(--duration-fast), box-shadow var(--duration-fast);
}

.battle-mode-card:hover {
  border-color: var(--border-default);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.battle-mode-card--featured {
  border-color: rgba(229, 9, 20, 0.35);
  background: linear-gradient(135deg, var(--accent-soft), rgba(255, 255, 255, 0.02));
}

.battle-mode-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.battle-mode-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.battle-mode-hint {
  font-size: 0.75rem;
  color: var(--status-watching);
  margin-top: 0.25rem;
}

.battle-genre-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1rem;
  max-height: 50vh;
  overflow-y: auto;
}

.battle-genre-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--duration-fast), background var(--duration-fast);
}

.battle-genre-item:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.battle-genre-item--disabled,
.battle-genre-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.battle-genre-count {
  font-size: 0.8125rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

.battle-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
}

.battle-footer-actions,
.battle-final-actions,
.battle-notice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.battle-btn {
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast), transform var(--duration-fast);
}

.battle-btn--primary {
  border: none;
  background: var(--accent);
  color: #fff;
}

.battle-btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.battle-btn--primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.battle-btn--ghost {
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-secondary);
}

.battle-btn--ghost:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.battle-prompt {
  font-size: 1.125rem;
  font-weight: 600;
  text-align: center;
  margin-bottom: 0.35rem;
}

.battle-prompt-sub {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.battle-arena {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: stretch;
  margin-bottom: 1.25rem;
}

.battle-pair-enter {
  animation: battlePairEnter 0.4s var(--ease-out);
}

@keyframes battlePairEnter {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.battle-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 0.05em;
  flex-shrink: 0;
  width: 3rem;
}

.battle-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-subtle);
  background: var(--bg-card);
  overflow: hidden;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--duration-normal), transform var(--duration-normal), box-shadow var(--duration-normal), opacity var(--duration-normal);
  position: relative;
}

.battle-card:hover:not(:disabled):not(.battle-card--static) {
  border-color: rgba(229, 9, 20, 0.45);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.battle-card--static {
  cursor: default;
}

.battle-card--winner {
  border-color: var(--status-watched);
  box-shadow: 0 0 0 1px var(--status-watched), var(--shadow-md);
  transform: scale(1.02);
}

.battle-card--loser {
  opacity: 0.45;
  transform: scale(0.97);
  filter: grayscale(0.5);
}

.battle-card--pulse {
  animation: battlePulse 0.5s var(--ease-spring);
}

@keyframes battlePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.battle-media-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 2;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(8, 8, 10, 0.75);
  backdrop-filter: blur(6px);
  color: var(--text-primary);
}

.battle-card-poster-wrap {
  height: clamp(240px, 48vh, 380px);
  background: var(--bg-elevated);
  overflow: hidden;
}

.battle-card-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.battle-card-poster--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  opacity: 0.35;
}

.battle-card-body {
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
}

.battle-card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.25;
}

.battle-card-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.battle-card-rating {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.battle-card-rating strong {
  color: var(--text-primary);
}

.battle-card-ratings {
  font-size: 0.75rem;
  color: var(--text-dim);
}

.battle-card-overview {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.battle-card-pick {
  display: block;
  margin-top: auto;
  padding-top: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  text-align: center;
}

.battle-footer {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.battle-skip-btn {
  align-self: center;
}

.battle-progress-bar-wrap {
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.battle-progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #ff6b6b);
  transition: width 0.4s var(--ease-out);
}

.battle-results-title {
  text-align: center;
  font-size: 1.375rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.battle-results-podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
  min-height: 280px;
}

.battle-result-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.85rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  flex: 0 1 180px;
}

.battle-result-card--first {
  order: 2;
  transform: scale(1.08);
  border-color: rgba(229, 9, 20, 0.4);
  background: linear-gradient(180deg, var(--accent-soft), var(--bg-card));
  z-index: 1;
}

.battle-result-card--second {
  order: 1;
}

.battle-result-card--third {
  order: 3;
}

.battle-result-stagger {
  animation: fadeSlideUp 0.45s var(--ease-out) both;
}

.battle-result-card[data-place="1"] { animation-delay: 0.1s; }
.battle-result-card[data-place="2"] { animation-delay: 0.2s; }
.battle-result-card[data-place="3"] { animation-delay: 0.3s; }

.battle-result-place {
  font-size: 0.875rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 0.35rem;
}

.battle-result-poster {
  width: 100%;
  max-width: 120px;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elevated);
  margin-bottom: 0.5rem;
}

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

.battle-result-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  opacity: 0.35;
}

.battle-result-card h3 {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.25;
  margin-bottom: 0.25rem;
}

.battle-result-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.battle-result-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 0.2rem;
}

.battle-results-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  max-height: 50vh;
  overflow-y: auto;
}

.battle-results-row {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto auto auto;
  gap: 0.65rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  font-size: 0.875rem;
}

.battle-results-rank {
  font-weight: 800;
  color: var(--accent);
}

.battle-results-name {
  font-weight: 500;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-results-year,
.battle-results-score,
.battle-results-rating {
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.battle-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.battle-confetti-piece {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confettiFall 2.5s ease-in forwards;
}

@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(400px) rotate(720deg); opacity: 0; }
}

.battle-notice {
  text-align: center;
  padding: 1rem 0;
}

.battle-notice h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.battle-notice-body {
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 0.5rem;
}

.battle-notice-actions {
  justify-content: center;
}

.battle-confirm {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 8, 10, 0.75);
  backdrop-filter: blur(4px);
  z-index: 10;
  border-radius: inherit;
}

.battle-confirm-box {
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  max-width: 360px;
  text-align: center;
}

.battle-confirm-box p {
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.battle-save-error {
  text-align: center;
  color: #f87171;
  font-size: 0.875rem;
  margin-top: 0.75rem;
}


/* ── Battle: иконки и визуал ─────────────────────────────────────── */

.battle-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.battle-ico svg {
  width: 1.1em;
  height: 1.1em;
}

.battle-header-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.battle-header-title .battle-ico {
  color: var(--accent);
}

/* Hero на странице битвы */
.battle-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 2.25rem 1.5rem 0.5rem;
  overflow: hidden;
}

.battle-hero-glow {
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 90%);
  height: 280px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  filter: blur(20px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}

.battle-hero > *:not(.battle-hero-glow) {
  position: relative;
  z-index: 1;
}

.battle-hero-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4.5rem;
  height: 4.5rem;
  margin-bottom: 1rem;
  border-radius: 50%;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(229, 9, 20, 0.35);
  box-shadow: 0 8px 30px rgba(229, 9, 20, 0.25);
  animation: battleBadgeFloat 4s var(--ease-out) infinite;
}

.battle-hero-badge svg {
  width: 2.1rem;
  height: 2.1rem;
}

@keyframes battleBadgeFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.battle-hero-title {
  margin-bottom: 0;
}

.battle-start-icon {
  width: 1.05rem;
  height: 1.05rem;
}

/* Превью режимов на странице — в строчку */
.battle-modes-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  max-width: 760px;
  margin: 1.75rem auto 0;
}

.battle-preview-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.55rem;
  padding: 1.25rem 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  cursor: pointer;
  transition: border-color var(--duration-fast), background var(--duration-fast), transform var(--duration-fast), box-shadow var(--duration-fast);
}

.battle-preview-card:hover {
  border-color: var(--border-default);
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.battle-preview-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent);
}

.battle-preview-icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.battle-preview-card--full .battle-preview-icon {
  background: var(--status-watched-soft);
  color: var(--status-watched);
}

.battle-preview-card--genre .battle-preview-icon {
  background: var(--status-want-soft);
  color: var(--status-want);
}

.battle-preview-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.battle-preview-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
}

.battle-preview-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Карточки режимов в оверлее */
.battle-mode-card {
  position: relative;
  overflow: hidden;
}

.battle-mode-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  margin-bottom: 0.15rem;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent);
}

.battle-mode-icon svg {
  width: 1.3rem;
  height: 1.3rem;
}

.battle-mode-card--full .battle-mode-icon {
  background: var(--status-watched-soft);
  color: var(--status-watched);
}

.battle-mode-card--genre .battle-mode-icon {
  background: var(--status-want-soft);
  color: var(--status-want);
}

.battle-mode-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.battle-mode-section-title .battle-ico {
  color: var(--accent);
}

.battle-mode-section-count {
  margin-left: auto;
  padding: 0.1rem 0.55rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

/* Бейдж типа и оценки внутри карточек */
.battle-media-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.battle-media-badge .battle-ico svg {
  width: 0.85em;
  height: 0.85em;
}

.battle-card-ratings {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.battle-card-ratings .battle-ico {
  color: var(--status-watching);
}

.battle-card-pick {
  display: flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

/* Жанры */
.battle-genre-name {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.battle-genre-name .battle-ico {
  color: var(--accent);
}

/* VS-разделитель с мечами */
.battle-vs {
  flex-direction: column;
  gap: 0.35rem;
}

.battle-vs-icon {
  color: var(--accent);
  animation: battleVsPulse 1.8s var(--ease-out) infinite;
}

.battle-vs-icon svg {
  width: 1.6rem;
  height: 1.6rem;
}

.battle-vs-text {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

@keyframes battleVsPulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.12); opacity: 1; }
}

/* Медали на пьедестале */
.battle-result-card {
  position: relative;
}

.battle-result-medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  margin-bottom: 0.35rem;
}

.battle-result-medal svg {
  width: 1.6rem;
  height: 1.6rem;
}

.battle-result-medal--1 { color: #fbbf24; }
.battle-result-medal--2 { color: #cbd5e1; }
.battle-result-medal--3 { color: #d8975b; }

.battle-result-card--first .battle-result-medal {
  animation: battleBadgeFloat 3s var(--ease-out) infinite;
}

.battle-results-title {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
}

.battle-results-title .battle-ico {
  color: var(--accent);
}

/* Иконки в кнопках и блоке топа */
.battle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.battle-btn .battle-ico svg {
  width: 1em;
  height: 1em;
}

.battle-home-top-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.battle-home-top-title .battle-ico {
  color: var(--accent);
}

@media (max-width: 520px) {
  .battle-modes-preview {
    grid-template-columns: 1fr;
    max-width: 420px;
  }

  .battle-preview-card {
    flex-direction: row;
    text-align: left;
    align-items: center;
  }

  .battle-preview-icon {
    flex-shrink: 0;
  }

  .battle-preview-text {
    align-items: flex-start;
  }
}


/* Psych / visual test promo blocks on home */
.psych-test-section,
.visual-test-section,
.short-visual-section {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1.5rem 1.25rem;
}

.psych-test-section {
  border-bottom: 1px solid var(--border-subtle);
}

.visual-test-section {
  border-bottom: 1px solid var(--border-subtle);
}

.short-visual-section {
  padding-bottom: 1.5rem;
}

.psych-home-card,
.visual-home-card {
  min-height: 14.75rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.psych-home-text,
.visual-home-text {
  flex: 0 1 auto;
}

.psych-home-actions,
.visual-home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  align-self: center;
  flex: 0 0 auto;
}

@media (max-width: 640px) {
  .psych-home-card,
  .visual-home-card {
    min-height: 0;
    align-items: stretch;
  }

  .psych-home-actions,
  .visual-home-actions {
    width: 100%;
    align-self: stretch;
  }

  .psych-home-actions .btn-primary,
  .visual-home-actions .btn-primary {
    width: 100%;
  }
}

/* ── PWA install prompt and app navigation ─────────────────────── */

.pwa-install-banner {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: calc(var(--z-modal) + 80);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.85rem;
  width: min(560px, calc(100vw - 1.5rem));
  padding: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  background: rgba(15, 15, 18, 0.94);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(229, 9, 20, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

.pwa-install-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(229, 9, 20, 0.9), rgba(127, 9, 16, 0.85));
  font-size: 1.35rem;
  box-shadow: var(--shadow-accent);
  color: #fff;
}

.pwa-install-icon img,
.pwa-install-icon svg {
  width: 28px;
  height: 28px;
  display: block;
}

.pwa-install-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.2rem;
}

.pwa-install-copy strong {
  font-size: 0.95rem;
  line-height: 1.2;
}

.pwa-install-copy span {
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.35;
}

.pwa-install-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.pwa-install-btn {
  padding: 0.62rem 0.9rem;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.pwa-install-close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border-default);
  color: var(--text-muted);
}

.pwa-install-banner--instructions {
  border-color: rgba(229, 9, 20, 0.35);
}

.mobile-app-nav {
  position: fixed;
  left: 50%;
  bottom: calc(0.65rem + env(safe-area-inset-bottom));
  z-index: calc(var(--z-header) + 20);
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.25rem;
  width: min(430px, calc(100vw - 1rem));
  padding: 0.45rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 22px;
  background: rgba(12, 12, 16, 0.9);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

.mobile-app-nav__item {
  display: flex;
  min-width: 0;
  min-height: 48px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.18rem;
  border-radius: 16px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.mobile-app-nav__item span {
  font-size: 1rem;
  line-height: 1;
}

.mobile-app-nav__item--active {
  background: var(--accent-soft);
  color: var(--text-primary);
}

/* ── Web Discover / swipe recommendations ─────────────────────── */

.discover-section {
  overflow: hidden;
}

.discover-shell {
  position: relative;
  padding: 1.25rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 20% 10%, rgba(229, 9, 20, 0.16), transparent 38%),
    linear-gradient(145deg, rgba(24, 24, 28, 0.96), rgba(11, 11, 14, 0.98));
  box-shadow: var(--shadow-md);
}

.discover-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.discover-eyebrow {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.discover-tabs {
  display: flex;
  justify-content: center;
  gap: 0.55rem;
  margin-bottom: 1rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
}

.discover-tab {
  flex: 0 0 auto;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 700;
  transition: background var(--duration-fast), border-color var(--duration-fast), color var(--duration-fast);
}

.discover-tab--active {
  border-color: rgba(229, 9, 20, 0.55);
  background: var(--accent-soft);
  color: var(--text-primary);
}

.discover-stack {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 540px;
  margin: 0 auto;
}

.discover-card {
  position: absolute;
  width: min(390px, 92vw);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 28px;
  background: #121216;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.46);
  transform: translateY(calc(var(--stack-offset, 0) * 16px)) scale(calc(1 - var(--stack-offset, 0) * 0.04));
  transition: transform 0.24s var(--ease-out), opacity 0.24s var(--ease-out);
  touch-action: pan-y;
  user-select: none;
}

.discover-card--behind {
  opacity: 0.62;
  pointer-events: none;
}

.discover-card--top {
  position: relative;
  cursor: grab;
}

.discover-card--dragging {
  cursor: grabbing;
  transition: none;
}

.discover-card--out-like {
  transform: translateX(130vw) rotate(14deg) !important;
  opacity: 0;
}

.discover-card--out-skip {
  transform: translateX(-130vw) rotate(-14deg) !important;
  opacity: 0;
}

.discover-badge {
  position: absolute;
  top: 1rem;
  z-index: 3;
  padding: 0.45rem 0.75rem;
  border: 2px solid currentColor;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.35);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  opacity: 0;
  text-transform: uppercase;
}

.discover-badge--like {
  left: 1rem;
  color: #22c55e;
  transform: rotate(-8deg);
}

.discover-badge--skip {
  right: 1rem;
  color: #f87171;
  transform: rotate(8deg);
}

.discover-card--like .discover-badge--like,
.discover-card--skip .discover-badge--skip {
  opacity: 1;
}

.discover-poster {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(229, 9, 20, 0.18), rgba(255, 255, 255, 0.04));
}

.discover-poster::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 45%;
  background: linear-gradient(180deg, transparent, rgba(18, 18, 22, 0.95));
}

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

.discover-poster--empty span {
  font-size: 4rem;
}

/* Рейтинг и подпись поверх постера (оверлеи), чтобы баннер был виден целиком */
.discover-rating {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.32rem 0.6rem;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.62);
  color: #ffd25e;
  font-size: 0.82rem;
  font-weight: 800;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.discover-rating--site {
  right: auto;
  left: 0.85rem;
  color: #8ec5ff;
}

.discover-rating small {
  font-size: 0.62rem;
  font-weight: 700;
  opacity: 0.8;
}

.discover-poster-gradient {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 2.6rem 1.1rem 1.1rem;
  background: linear-gradient(180deg, transparent, rgba(10, 10, 14, 0.95));
}

.discover-card-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.2;
  color: #fff;
}

.discover-card-meta {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.78);
}

.discover-card-info {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1rem 1.05rem 1.1rem;
}

.discover-card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.discover-card-title-row h3 {
  font-size: 1.25rem;
  line-height: 1.18;
}

.discover-saved-pill {
  flex: 0 0 auto;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-pill);
  background: rgba(34, 197, 94, 0.14);
  color: #86efac;
  font-size: 0.72rem;
  font-weight: 800;
}

.discover-original-title,
.discover-meta,
.discover-reason {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.discover-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.discover-genres span {
  padding: 0.28rem 0.5rem;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
}

.discover-desc-btn {
  align-self: flex-start;
  color: var(--accent);
  font-size: 0.86rem;
  font-weight: 800;
}

.discover-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-top: 1rem;
}

.discover-action {
  min-width: 0;
  flex: 0 1 auto;
  padding: 0.8rem 1.1rem;
  border-radius: var(--radius-pill);
  font-weight: 800;
  white-space: nowrap;
}

.discover-action:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.discover-action--skip {
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fca5a5;
}

.discover-action--watched {
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
}

.discover-action--like {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-accent);
}

.discover-status {
  min-height: 1.25rem;
  margin-top: 0.75rem;
  color: var(--text-muted);
  font-size: 0.86rem;
  text-align: center;
}

.discover-status--success {
  color: #86efac;
}

.discover-status--error {
  color: #fca5a5;
}

.discover-empty {
  display: flex;
  width: min(390px, 92vw);
  min-height: 260px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.5rem;
  border: 1px dashed var(--border-default);
  border-radius: 26px;
  color: var(--text-secondary);
  text-align: center;
}


/* ── Responsive: large desktop ──────────────────────────────────── */

@media (min-width: 1440px) {
  :root {
    --content-max: 1480px;
    --section-gap: 3rem;
  }

  .status-group-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }

  .hero-section {
    padding: 3.5rem 2.5rem;
  }
}

@media (min-width: 1200px) {
  .app-layout:has(.chat-panel--open) .main-content {
    padding-right: 0.5rem;
  }

  .battle-promo-inner {
    grid-template-columns: 1fr 300px;
  }
}

/* ── Responsive: tablet ─────────────────────────────────────────── */

@media (max-width: 1024px) {
  :root {
    --chat-width: 340px;
  }

  .battle-arena {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .battle-vs {
    width: auto;
    padding: 0.35rem 0;
    font-size: 1rem;
  }

  .battle-card--left,
  .battle-card--right {
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
  }

  .movie-card__body {
    grid-template-columns: 100px 1fr;
  }

  .movie-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .stats-details {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  .header-nav {
    display: none;
  }

  body {
    padding-bottom: calc(5.6rem + env(safe-area-inset-bottom));
  }

  .mobile-app-nav {
    display: grid;
  }

  .pwa-install-banner {
    bottom: calc(5.6rem + env(safe-area-inset-bottom));
  }

  .battle-promo-inner {
    grid-template-columns: 1fr;
  }

  .battle-promo-top {
    order: -1;
  }

  .premiere-ribbon-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .collection-free {
    flex-direction: column;
  }

  .collection-free button {
    width: 100%;
  }
}

/* ── Responsive: mobile landscape / small tablet ────────────────── */

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
    --section-gap: 2rem;
  }

  .header-inner {
    padding: 0 1rem;
  }

  .main-content,
  .page-content {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .hero-section {
    padding: 2rem 1.25rem;
    margin-top: 1rem;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .list-header-top {
    flex-direction: column;
    align-items: center;
  }

  .list-header-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .list-search {
    /* В колоночной раскладке flex-basis применяется к высоте, из-за чего поле
       растягивалось до 220px. Сбрасываем flex, чтобы высота шла от контента. */
    flex: 0 0 auto;
    max-width: none;
    padding: 0.5rem 0.85rem 0.5rem 2.1rem;
    font-size: 0.875rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-default);
    background-size: 15px 15px;
  }

  .list-search:focus {
    border-color: var(--accent);
  }

  .filters {
    width: 100%;
  }

  .filters select {
    flex: 1;
    min-width: 0;
  }

  .status-group-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
  }

  .movie-card__body {
    grid-template-columns: 80px 1fr;
    gap: 0.85rem;
    padding: 1rem;
  }

  .movie-poster {
    width: 80px;
  }

  .movie-title-row {
    font-size: 1rem;
  }

  .chat-panel {
    width: 100%;
    top: 0;
    z-index: calc(var(--z-modal) + 10);
  }

  .chat-toggle-btn {
    bottom: calc(5.35rem + env(safe-area-inset-bottom));
    right: 1rem;
    padding: 0.65rem 1rem;
    font-size: 0.875rem;
  }

  .modal {
    max-height: 92vh;
    border-radius: var(--radius-lg);
  }

  .modal-overlay {
    padding: 0.75rem;
    align-items: flex-end;
  }

  .battle-panel {
    border-radius: var(--radius-lg);
    padding: 1.15rem;
  }

  .battle-shell {
    max-height: 95vh;
  }

  .battle-results-podium {
    flex-direction: column;
    align-items: center;
    min-height: auto;
  }

  .battle-result-card--first {
    order: 1;
    transform: none;
  }

  .battle-result-card--second { order: 2; }
  .battle-result-card--third { order: 3; }

  .battle-results-row {
    grid-template-columns: 2rem 1fr;
    gap: 0.25rem 0.5rem;
  }

  .battle-results-year,
  .battle-results-score,
  .battle-results-rating {
    grid-column: 2;
    font-size: 0.75rem;
  }

  .blacklist-form {
    grid-template-columns: 1fr;
  }

  .stats-details {
    grid-template-columns: 1fr;
  }

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

  .pick-item {
    grid-template-columns: 48px 1fr auto;
    gap: 0.65rem;
  }

  .premiere-compact-item {
    grid-template-columns: 56px 1fr;
  }

  .premiere-compact-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: flex-end;
  }
}

/* ── Responsive: mobile portrait ────────────────────────────────── */

@media (max-width: 480px) {
  .pwa-install-banner {
    grid-template-columns: auto 1fr;
    align-items: flex-start;
    padding: 0.8rem;
  }

  .pwa-install-actions {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: space-between;
  }

  .pwa-install-btn {
    flex: 1;
  }

  .discover-shell {
    padding: 1rem 0.75rem;
    border-radius: 22px;
  }

  .discover-head {
    flex-direction: column;
  }

  .discover-head .rec-refresh-btn {
    width: 100%;
  }

  .discover-stack {
    min-height: 500px;
  }

  .discover-card {
    width: min(340px, 88vw);
    border-radius: 24px;
  }

  .discover-poster {
    max-height: 345px;
  }

  .discover-actions {
    flex-direction: column;
  }

  .discover-action {
    width: 100%;
  }

  .login-card {
    padding: 2rem 1.25rem;
  }

  .login-card > h1 {
    font-size: 1.5rem;
  }

  .site-logo {
    font-size: 1.5rem;
  }

  .header-brand-text h1 {
    font-size: 1rem;
  }

  .user-greeting {
    display: none;
  }

  .logout-btn {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
  }

  .section-heading {
    font-size: 1.125rem;
  }

  .premiere-ribbon-card {
    flex: 0 0 min(280px, 88vw);
  }

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

  .list-view-toggle,
  .media-tabs,
  .release-filter {
    width: 100%;
    justify-content: center;
  }

  .list-header-controls {
    width: 100%;
    flex-direction: column;
  }

  .rec-item {
    flex: 0 0 min(220px, 85vw);
  }

  .export-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .battle-mode-grid {
    grid-template-columns: 1fr;
  }

  .dup-actions {
    flex-direction: column;
  }

  .dup-actions button {
    width: 100%;
  }

  .taste-section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .chat-form {
    flex-direction: column;
  }

  .chat-form button {
    width: 100%;
  }
}

/* ── Responsive: very small screens ─────────────────────────────── */

@media (max-width: 360px) {
  .status-group-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .stat-num {
    font-size: 1.5rem;
  }

  .hero-subtitle {
    font-size: 0.9375rem;
  }

  .watch-now-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ── Reduced motion ─────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .loading-ui__spinner,
  .loading-ui__spinner::after {
    animation-duration: 0.85s !important;
    animation-iteration-count: infinite !important;
  }

  .loading-ui__spinner::after {
    animation-duration: 1.15s !important;
  }

  .loading-ui__dot {
    animation-duration: 1.2s !important;
    animation-iteration-count: infinite !important;
  }

  .loading-ui__ellipsis::after {
    animation-duration: 1.4s !important;
    animation-iteration-count: infinite !important;
  }

  .loading-ui__progress-fill {
    animation-duration: 1.35s !important;
    animation-iteration-count: infinite !important;
  }

  .loading-ui-skeleton-poster,
  .loading-ui-skeleton-line,
  .loading-ui-stat-num,
  .loading-ui-stat-label {
    animation-duration: 1.2s !important;
    animation-iteration-count: infinite !important;
  }

  .movie-card--grid:hover .movie-poster--grid {
    transform: none;
  }

  .battle-confetti-piece {
    display: none;
  }
}

/* ── High contrast mode support ─────────────────────────────────── */

@media (prefers-contrast: more) {
  :root {
    --border-subtle: rgba(255, 255, 255, 0.2);
    --border-default: rgba(255, 255, 255, 0.35);
  }

  .movie-card--grid,
  .movie-card--list,
  .rec-item {
    border-width: 2px;
  }

  .status-badge {
    font-weight: 700;
  }
}

/* ── Print styles ───────────────────────────────────────────────── */

@media print {
  .app-header,
  .premiere-ribbon,
  .hero-section,
  .chat-panel,
  .chat-toggle-btn,
  .battle-promo,
  .recommendations-box,
  .collections-section,
  .premiere-suggest-section,
  .blacklist-section,
  .import-section,
  .psych-test-section,
  .visual-test-section,
  .login-overlay,
  .modal-overlay,
  .battle-overlay {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .movie-card--list {
    break-inside: avoid;
    border: 1px solid #ccc;
    margin-bottom: 0.5rem;
  }
}


/* ── Global scrollbar styling (WebKit) ──────────────────────────── */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ── End of stylesheet ────────────────────────────────────────── */

.status-group[data-status="want"] .status-group-header:focus-visible {
  outline-color: var(--status-want);
}

.movie-card[data-status="want"]:focus-within {
  border-color: rgba(255, 255, 255, 0.12);
}

.menu-item--status[data-status="want"]:hover {
  color: var(--status-want);
}

.status-group[data-status="watching"] .status-group-header:focus-visible {
  outline-color: var(--status-watching);
}

.movie-card[data-status="watching"]:focus-within {
  border-color: rgba(255, 255, 255, 0.12);
}

.menu-item--status[data-status="watching"]:hover {
  color: var(--status-watching);
}

.status-group[data-status="watched"] .status-group-header:focus-visible {
  outline-color: var(--status-watched);
}

.movie-card[data-status="watched"]:focus-within {
  border-color: rgba(255, 255, 255, 0.12);
}

.menu-item--status[data-status="watched"]:hover {
  color: var(--status-watched);
}

/* ── Component touch-target & spacing fine-tuning ─────────────── */

@media (max-width: 1280px) {
  .movie-card--grid { --bp-ref: 1280; }
  .movie-card--list { --bp-ref: 1280; }
  .rec-item { --bp-ref: 1280; }
  .pick-item { --bp-ref: 1280; }
  .status-group { --bp-ref: 1280; }
  .battle-card { --bp-ref: 1280; }
  .premiere-ribbon-card { --bp-ref: 1280; }
  .stat-card { --bp-ref: 1280; }
  .hero-section { --bp-ref: 1280; }
  .collections-section { --bp-ref: 1280; }
  .chat-message { --bp-ref: 1280; }
  .modal { --bp-ref: 1280; }
  .premiere-compact-item { --bp-ref: 1280; }
  .battle-mode-card { --bp-ref: 1280; }
  .battle-result-card { --bp-ref: 1280; }
}

@media (max-width: 1100px) {
  .movie-card--grid { --bp-ref: 1100; }
  .movie-card--list { --bp-ref: 1100; }
  .rec-item { --bp-ref: 1100; }
  .pick-item { --bp-ref: 1100; }
  .status-group { --bp-ref: 1100; }
  .battle-card { --bp-ref: 1100; }
  .premiere-ribbon-card { --bp-ref: 1100; }
  .stat-card { --bp-ref: 1100; }
  .hero-section { --bp-ref: 1100; }
  .collections-section { --bp-ref: 1100; }
  .chat-message { --bp-ref: 1100; }
  .modal { --bp-ref: 1100; }
  .premiere-compact-item { --bp-ref: 1100; }
  .battle-mode-card { --bp-ref: 1100; }
  .battle-result-card { --bp-ref: 1100; }
}

@media (max-width: 960px) {
  .movie-card--grid { --bp-ref: 960; }
  .movie-card--list { --bp-ref: 960; }
  .rec-item { --bp-ref: 960; }
  .pick-item { --bp-ref: 960; }
  .status-group { --bp-ref: 960; }
  .battle-card { --bp-ref: 960; }
  .premiere-ribbon-card { --bp-ref: 960; }
  .stat-card { --bp-ref: 960; }
  .hero-section { --bp-ref: 960; }
  .collections-section { --bp-ref: 960; }
  .chat-message { --bp-ref: 960; }
  .modal { --bp-ref: 960; }
  .premiere-compact-item { --bp-ref: 960; }
  .battle-mode-card { --bp-ref: 960; }
  .battle-result-card { --bp-ref: 960; }
}

@media (max-width: 840px) {
  .movie-card--grid { --bp-ref: 840; }
  .movie-card--list { --bp-ref: 840; }
  .rec-item { --bp-ref: 840; }
  .pick-item { --bp-ref: 840; }
  .status-group { --bp-ref: 840; }
  .battle-card { --bp-ref: 840; }
  .premiere-ribbon-card { --bp-ref: 840; }
  .stat-card { --bp-ref: 840; }
  .hero-section { --bp-ref: 840; }
  .collections-section { --bp-ref: 840; }
  .chat-message { --bp-ref: 840; }
  .modal { --bp-ref: 840; }
  .premiere-compact-item { --bp-ref: 840; }
  .battle-mode-card { --bp-ref: 840; }
  .battle-result-card { --bp-ref: 840; }
}

@media (max-width: 720px) {
  .movie-card--grid { --bp-ref: 720; }
  .movie-card--list { --bp-ref: 720; }
  .rec-item { --bp-ref: 720; }
  .pick-item { --bp-ref: 720; }
  .status-group { --bp-ref: 720; }
  .battle-card { --bp-ref: 720; }
  .premiere-ribbon-card { --bp-ref: 720; }
  .stat-card { --bp-ref: 720; }
  .hero-section { --bp-ref: 720; }
  .collections-section { --bp-ref: 720; }
  .chat-message { --bp-ref: 720; }
  .modal { --bp-ref: 720; }
  .premiere-compact-item { --bp-ref: 720; }
  .battle-mode-card { --bp-ref: 720; }
  .battle-result-card { --bp-ref: 720; }
}

@media (max-width: 600px) {
  .movie-card--grid { --bp-ref: 600; }
  .movie-card--list { --bp-ref: 600; }
  .rec-item { --bp-ref: 600; }
  .pick-item { --bp-ref: 600; }
  .status-group { --bp-ref: 600; }
  .battle-card { --bp-ref: 600; }
  .premiere-ribbon-card { --bp-ref: 600; }
  .stat-card { --bp-ref: 600; }
  .hero-section { --bp-ref: 600; }
  .collections-section { --bp-ref: 600; }
  .chat-message { --bp-ref: 600; }
  .modal { --bp-ref: 600; }
  .premiere-compact-item { --bp-ref: 600; }
  .battle-mode-card { --bp-ref: 600; }
  .battle-result-card { --bp-ref: 600; }
}

@media (max-width: 520px) {
  .movie-card--grid { --bp-ref: 520; }
  .movie-card--list { --bp-ref: 520; }
  .rec-item { --bp-ref: 520; }
  .pick-item { --bp-ref: 520; }
  .status-group { --bp-ref: 520; }
  .battle-card { --bp-ref: 520; }
  .premiere-ribbon-card { --bp-ref: 520; }
  .stat-card { --bp-ref: 520; }
  .hero-section { --bp-ref: 520; }
  .collections-section { --bp-ref: 520; }
  .chat-message { --bp-ref: 520; }
  .modal { --bp-ref: 520; }
  .premiere-compact-item { --bp-ref: 520; }
  .battle-mode-card { --bp-ref: 520; }
  .battle-result-card { --bp-ref: 520; }
}

@media (max-width: 400px) {
  .movie-card--grid { --bp-ref: 400; }
  .movie-card--list { --bp-ref: 400; }
  .rec-item { --bp-ref: 400; }
  .pick-item { --bp-ref: 400; }
  .status-group { --bp-ref: 400; }
  .battle-card { --bp-ref: 400; }
  .premiere-ribbon-card { --bp-ref: 400; }
  .stat-card { --bp-ref: 400; }
  .hero-section { --bp-ref: 400; }
  .collections-section { --bp-ref: 400; }
  .chat-message { --bp-ref: 400; }
  .modal { --bp-ref: 400; }
  .premiere-compact-item { --bp-ref: 400; }
  .battle-mode-card { --bp-ref: 400; }
  .battle-result-card { --bp-ref: 400; }
}

/* Профиль пользователя */
.profile-subheading {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 0.85rem;
}

.profile-section--visual {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 0.5rem;
}

.profile-section--short-visual {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 0.5rem;
}

.profile-section--visual .section-heading,
.profile-section--short-visual .section-heading {
  margin-top: 0.5rem;
}

.profile-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.profile-info-item {
  padding: 1rem 1.15rem;
  border-radius: var(--radius-md, 12px);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.profile-info-label {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.profile-info-value {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.profile-result-card,
.profile-empty-card,
.profile-dynamics-card {
  padding: 1.35rem 1.5rem;
  border-radius: var(--radius-lg, 16px);
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.1), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.profile-result-card--short-visual {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(255, 255, 255, 0.02));
  border-color: rgba(245, 158, 11, 0.2);
}

.profile-result-test {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.profile-result-test strong {
  color: var(--text-secondary);
  font-weight: 600;
}

.profile-result-label {
  color: var(--text-muted);
  font-size: 0.8125rem;
  margin-right: 0.35rem;
}

.profile-result-card--short-visual .profile-result-profile strong,
.profile-short-visual-result {
  color: #fbbf24;
  font-weight: 700;
}

.profile-short-visual-genres,
.profile-short-visual-meta {
  margin: 0 0 0.75rem;
  line-height: 1.6;
}

.profile-short-visual-genres .short-visual-meta-chip {
  margin-right: 0.35rem;
  margin-bottom: 0.25rem;
}

.short-visual-history-table .profile-short-visual-result {
  font-weight: 600;
}

.short-visual-history-table .short-visual-meta-chip {
  margin-right: 0.25rem;
}

.profile-empty-title {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}

.profile-result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.profile-result-profile {
  font-size: 1.05rem;
  margin: 0 0 0.65rem;
}

.profile-result-desc {
  color: var(--text-secondary);
  margin: 0 0 1.15rem;
  line-height: 1.55;
}

.profile-result-actions,
.profile-history-actions,
.profile-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.15rem;
}

.profile-btn-secondary {
  padding: 0.65rem 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.profile-btn-secondary:hover {
  border-color: rgba(255, 255, 255, 0.35);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
}

.profile-scales {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.profile-scales--compact {
  gap: 0.5rem;
  margin-top: 0.65rem;
}

.profile-scale-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  margin-bottom: 0.3rem;
}

.profile-scale-name { color: var(--text-secondary); }
.profile-scale-meta { color: var(--text-muted); }

.profile-scale-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.profile-scale-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #5865f2, #e50914);
  transition: width 0.4s ease;
}

.profile-dynamics-title {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
}

.profile-dynamics-summary {
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0 0 1.15rem;
}

.profile-dynamics-compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.profile-dynamics-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.profile-history-intro {
  margin-bottom: 1rem;
}

.profile-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.profile-history-item {
  padding: 1rem 1.15rem;
  border-radius: var(--radius-md, 12px);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: border-color 0.2s, background 0.2s;
}

.profile-history-item:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.profile-history-head time {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.profile-history-profile {
  margin: 0.35rem 0 0.25rem;
}

.profile-history-scales {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0;
}

.profile-chart-wrap {
  margin-top: 1.25rem;
  overflow-x: auto;
}

.profile-chart-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.profile-chart-table th,
.profile-chart-table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: left;
}

.profile-chart-table th {
  color: var(--text-muted);
  font-weight: 500;
}

.profile-svg-chart {
  margin-top: 1rem;
}

.profile-chart-caption {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem;
}

.profile-chart-svg {
  width: 100%;
  max-width: 420px;
  height: auto;
}

.profile-detail-meta {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin: 0 0 0.5rem;
}

.profile-detail-profile {
  font-size: 1.1rem;
  margin: 0 0 0.65rem;
}

.profile-detail-desc {
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0 0 1rem;
}

.profile-detail h4 {
  font-size: 0.9375rem;
  margin: 1rem 0 0.5rem;
}

.profile-detail ul {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--text-secondary);
}

.profile-answer {
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.profile-answer-q {
  font-size: 0.875rem;
  color: var(--text-primary);
  margin: 0 0 0.25rem;
}

.profile-answer-a {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0;
}

.profile-skeleton .profile-sk-line,
.profile-sk-line,
.profile-skeleton .loading-ui-skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  background-size: 200% 100%;
  animation: profileShimmer 1.2s infinite;
  margin-bottom: 0.65rem;
}

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

.profile-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  background: var(--bg-elevated, #141418);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  font-size: 0.875rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 1300;
}

.profile-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.profile-toast--error {
  border-color: rgba(239, 68, 68, 0.4);
}

.profile-toast--success {
  border-color: rgba(34, 197, 94, 0.4);
}

.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s, transform 0.2s;
}

.theme-toggle-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--bg-card-hover);
  transform: scale(1.05);
}

.theme-toggle-icon {
  display: block;
  line-height: 1;
}

@media (max-width: 640px) {
  .profile-result-actions,
  .profile-history-actions,
  .profile-detail-actions {
    flex-direction: column;
  }

  .profile-result-actions .btn-primary,
  .profile-history-actions .btn-primary {
    width: 100%;
  }
}

/* ==========================================================================
   Спокойный плоский интерфейс — без «ИИшных» градиентов
   Переопределяем фоновые градиенты на ровные поверхности.
   ========================================================================== */
.login-overlay { background: var(--bg-overlay); }
.hero-section { background: var(--bg-surface); }
.battle-promo { background: var(--bg-surface); }
.premiere-ribbon { background: transparent; }
.battle-mode-card--featured { background: var(--accent-soft); }
.battle-result-card--first { background: var(--bg-card); }
.pwa-install-icon { background: var(--accent); }
.discover-shell { background: var(--bg-surface); }
.discover-poster { background: var(--bg-elevated); }
.header-avatar { background: var(--accent); }
.bar { background: var(--accent); }
.profile-scale-fill { background: var(--accent); }
.profile-result-card,
.profile-empty-card,
.profile-dynamics-card { background: var(--bg-card); }
.profile-result-card--short-visual { background: var(--bg-card); }

/* ── Кнопка «Назад» в шапке отдельных страниц ─────────────────── */
.header-back {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.45rem 0.8rem 0.45rem 0.6rem;
  margin-right: 0.5rem;
  border: 1px solid var(--border-default);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--duration-fast), border-color var(--duration-fast);
}
.header-back:hover { background: var(--bg-card-hover); border-color: var(--border-strong); }
.header-back svg { width: 18px; height: 18px; }

/* ── Упрощённый вход: имя + код ───────────────────────────────── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.auth-form input {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 1rem;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
}
.auth-form button[type="submit"] {
  margin-top: 0.25rem;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--duration-fast);
}
.auth-form button[type="submit"]:hover:not(:disabled) { background: var(--accent-hover); }
.auth-form button[type="submit"]:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-hint {
  margin-top: 0.85rem;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}
.auth-guest-btn {
  display: block;
  width: 100%;
  margin-top: 1rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border-default);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--duration-fast), color var(--duration-fast);
}
.auth-guest-btn:hover { background: var(--bg-card-hover); color: var(--text-primary); }

.auth-code-row { margin-top: 0.6rem; }
.auth-code-row.hidden { display: none; }

.auth-recovery {
  margin-top: 0.5rem;
  padding: 1rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  text-align: center;
}
.auth-recovery.hidden { display: none; }
.auth-recovery-title { margin: 0 0 0.35rem; font-weight: 700; color: var(--text-primary); }
.auth-recovery-text { margin: 0 0 0.6rem; font-size: 0.875rem; color: var(--text-secondary); }
.auth-recovery-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: 0.35em;
  padding: 0.6rem 0.5rem 0.6rem 0.85rem;
  margin: 0 auto 0.6rem;
  display: inline-block;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px dashed var(--border-strong, var(--border-default));
  color: var(--accent);
}
.auth-recovery-hint { margin: 0 0 0.9rem; font-size: 0.8125rem; color: var(--text-muted); }
.auth-recovery-btn {
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}
.auth-recovery-btn:hover { background: var(--accent-hover); }

/* ── Лента тестов: компактные горизонтальные карточки ─────────── */
.tests-ribbon-wrap { margin: 0; padding: 1.25rem 1rem 0.75rem; }
.tests-ribbon-head { margin: 0 0 0.9rem; }
.tests-ribbon-title { font-size: 1.35rem; font-weight: 800; margin: 0 0 0.3rem; }
.tests-ribbon-sub {
  font-size: 0.9rem; color: var(--text-secondary); margin: 0; max-width: 640px; line-height: 1.4;
}
.tests-ribbon {
  display: flex;
  align-items: stretch;
  gap: 0.85rem;
  overflow-x: auto;
  padding: 0.25rem 0 0.75rem;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}
.tests-ribbon::-webkit-scrollbar { height: 6px; }
.tests-ribbon::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }
/* Секции-обёртки растворяются — карточки становятся прямыми flex-элементами ленты */
.tests-ribbon-item { display: contents; margin: 0 !important; }

/* Единый вид всех карточек тестов — горизонтальная лента одинаковых карточек */
.tests-ribbon .psych-home-card,
.tests-ribbon .visual-home-card,
.tests-ribbon .short-visual-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 0.55rem;
  flex: 0 0 240px;
  width: 240px;
  min-height: 200px;
  scroll-snap-align: start;
  margin: 0;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  box-shadow: none;
}
.tests-ribbon .psych-home-text,
.tests-ribbon .visual-home-text,
.tests-ribbon .section-heading,
.tests-ribbon .panel-hint { text-align: left; }

/* Иконка теста */
.tests-ribbon .test-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 12px;
  background: rgba(229, 9, 20, 0.12);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  margin-bottom: 0.1rem;
}
.tests-ribbon .test-icon svg { width: 24px; height: 24px; display: block; }

.tests-ribbon .section-heading,
.tests-ribbon .short-visual-card-title { font-size: 1rem; margin: 0; }
.tests-ribbon .panel-hint,
.tests-ribbon .short-visual-card-desc {
  font-size: 0.85rem; color: var(--text-secondary); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.tests-ribbon .short-visual-card-meta { font-size: 0.78rem; color: var(--text-muted); margin: 0; }

.tests-ribbon .psych-home-text,
.tests-ribbon .visual-home-text {
  flex: initial; width: 100%;
  display: flex; flex-direction: column; gap: 0.45rem;
}

/* Действия прижаты к низу карточки — сетка остаётся ровной */
.tests-ribbon .psych-home-actions,
.tests-ribbon .visual-home-actions,
.tests-ribbon .short-visual-card-actions {
  width: 100%; display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin-top: auto; padding-top: 0.4rem;
}
.tests-ribbon .btn-primary,
.tests-ribbon .psych-home-secondary,
.tests-ribbon .visual-home-secondary,
.tests-ribbon .short-visual-btn-secondary { font-size: 0.825rem; padding: 0.5rem 0.9rem; }

.tests-ribbon .psych-home-date,
.tests-ribbon .visual-home-date,
.tests-ribbon .short-visual-card-done { font-size: 0.78rem; color: var(--text-muted); }
.tests-ribbon .psych-home-profile,
.tests-ribbon .visual-home-profile { font-size: 0.85rem; margin: 0; }

/* ── Профиль: лёгкая карточка пользователя ────────────────────── */
.profile-card-section { padding: 0; background: transparent; border: none; }
.profile-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}
.profile-card-avatar {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
}
.profile-card-name { font-size: 1.25rem; font-weight: 700; margin: 0; }
.profile-card-sub { font-size: 0.9rem; color: var(--text-secondary); margin: 0.15rem 0 0; }
.profile-card-meta { font-size: 0.8125rem; color: var(--text-muted); margin: 0.15rem 0 0; }
.profile-card-split { font-size: 0.85rem; color: var(--text-secondary); margin: 0.3rem 0 0; }
.profile-archetypes { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.profile-archetype {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.stats-genres { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.stats-genres .tag-chip small { opacity: 0.6; font-weight: 600; margin-left: 0.2rem; }

/* ── Профиль: краткие результаты тестов ───────────────────────── */
.profile-tests-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}
.profile-test-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}
.profile-test-head { display: flex; align-items: center; gap: 0.5rem; }
.profile-test-icon { font-size: 1.15rem; }
.profile-test-title { font-size: 0.95rem; font-weight: 600; margin: 0; }
.profile-test-result { font-size: 1.05rem; font-weight: 700; margin: 0; color: var(--text-primary); }
.profile-test-status { font-size: 0.875rem; color: var(--text-muted); margin: 0; }
.profile-test-desc {
  font-size: 0.825rem; color: var(--text-secondary); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.profile-test-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: auto; padding-top: 0.5rem; }
.profile-test-actions .btn-primary,
.profile-test-actions .profile-btn-secondary { font-size: 0.8125rem; padding: 0.5rem 0.85rem; }

/* ── Простая статистика по тестам ─────────────────────────────── */
.profile-tests-summary-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.profile-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  padding: 0.9rem 0.75rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  text-align: center;
}
.profile-stat-num { font-size: 1.5rem; font-weight: 800; line-height: 1.1; color: var(--text-primary); }
.profile-stat-num--sm { font-size: 0.95rem; font-weight: 700; }
.profile-stat-of { font-size: 0.95rem; font-weight: 700; color: var(--text-muted); }
.profile-stat-label { font-size: 0.75rem; color: var(--text-secondary); }
.profile-tests-hint {
  margin: 0 0 1rem;
  padding: 0.9rem 1.1rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.profile-test-meta { font-size: 0.78rem; color: var(--text-muted); margin: 0; }
.profile-test-scales { display: flex; flex-direction: column; gap: 0.5rem; margin: 0.2rem 0; }
.profile-scale { display: flex; flex-direction: column; gap: 0.25rem; }
.profile-scale-top { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.profile-scale-name { font-size: 0.8rem; color: var(--text-secondary); }
.profile-scale-lvl { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; }
.profile-scale-track {
  height: 6px;
  border-radius: 999px;
  background: var(--border-subtle);
  overflow: hidden;
}
.profile-scale-fill { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
