:root {
  --bg-primary: #0e1117;
  --bg-secondary: #121826;
  --surface: #181d2a;
  --surface-elevated: #202638;
  --text-primary: #e7eaf2;
  --text-secondary: #a9b0c3;
  --text-muted: #737c92;
  --accent-primary: #8b7cff;
  --accent-primary-hover: #9b8cff;
  --accent-secondary: #f0b35a;
  --success: #55d6a5;
  --warning: #f0b35a;
  --error: #ff7a6b;
  --info: #7cb7ff;
  --border: #2a3142;
  --divider: #242b3a;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.45);
  --font-ui: "Inter", system-ui, sans-serif;
  --font-heading: "Manrope", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(139, 124, 255, 0.14), transparent 30%),
    radial-gradient(circle at 88% 8%, rgba(240, 179, 90, 0.08), transparent 24%),
    var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-ui);
}

button, input, select {
  font: inherit;
}

button {
  border: 0;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 88px 0 96px;
}

.site-header {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 50;
  width: min(1180px, calc(100% - 32px));
  height: 64px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 14px 0 18px;
  border: 1px solid rgba(42, 49, 66, 0.78);
  border-radius: 20px;
  background: rgba(14, 17, 23, 0.78);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow-md);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  text-decoration: none;
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
}

.brand-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent-primary), #6e5df7);
  color: var(--text-primary);
  box-shadow: 0 0 28px rgba(139, 124, 255, 0.26);
}

.brand-icon svg,
button svg,
.badge svg,
.chip svg,
.quick-card svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.9;
}

.desktop-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  position: relative;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: color 150ms var(--ease-out), background 150ms var(--ease-out);
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.045);
}

.nav-link.is-active::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 5px;
  height: 2px;
  border-radius: 999px;
  background: var(--accent-primary);
}

.hero-section {
  min-height: clamp(420px, 54vw, 620px);
  display: flex;
  align-items: center;
  margin-bottom: 24px;
  overflow: hidden;
  border-radius: 28px;
  background:
    linear-gradient(90deg, rgba(14, 17, 23, 0.96), rgba(14, 17, 23, 0.58), rgba(14, 17, 23, 0.16)),
    url("/static/images/hero-night-cinema.png");
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow-lg);
}

.hero-copy {
  max-width: 610px;
  padding: clamp(28px, 6vw, 72px);
}

.hero-copy h1,
.section-heading h2,
.games-hero h2 {
  margin: 12px 0 0;
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 0;
}

.hero-copy h1 {
  font-size: clamp(38px, 7vw, 72px);
  line-height: 1.02;
}

.hero-copy p,
.section-heading p,
.games-hero p {
  max-width: 620px;
  margin: 14px 0 0;
  color: var(--text-secondary);
  font-size: 17px;
  line-height: 1.6;
}

.hero-actions,
.random-actions,
.filter-actions,
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.button-primary,
.button-secondary,
.button-ghost,
.icon-button,
.quick-card,
.media-tab,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 150ms var(--ease-out), background 150ms var(--ease-out), border-color 150ms var(--ease-out), color 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
}

.button-primary,
.button-secondary {
  min-height: 44px;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  font-weight: 600;
}

.button-primary {
  background: var(--accent-primary);
  color: var(--text-primary);
  box-shadow: 0 0 24px rgba(139, 124, 255, 0.18);
}

.button-primary:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 0 32px rgba(139, 124, 255, 0.25);
}

.button-secondary {
  border: 1px solid var(--border);
  background: rgba(24, 29, 42, 0.62);
  color: var(--text-primary);
}

.button-secondary:hover {
  background: var(--surface-elevated);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
}

.button-ghost {
  min-height: 40px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  color: var(--text-secondary);
}

.icon-button:hover {
  background: var(--surface-elevated);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.badge,
.rating-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
}

.badge-primary {
  background: rgba(139, 124, 255, 0.12);
  color: var(--accent-primary-hover);
  border: 1px solid rgba(139, 124, 255, 0.28);
}

.badge-warm,
.rating-pill {
  background: rgba(240, 179, 90, 0.12);
  color: var(--accent-secondary);
  border: 1px solid rgba(240, 179, 90, 0.28);
}

.auth-panel,
.feed-panel,
.quick-panel,
.filter-panel,
.results-panel,
.random-shell,
#view-lists,
.games-hero {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: rgba(24, 29, 42, 0.76);
  box-shadow: var(--shadow-md);
}

.quick-panel {
  padding: 24px;
  margin-bottom: 24px;
}

.auth-panel {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  margin-bottom: 24px;
}

.auth-panel.is-active {
  display: flex;
}

.auth-panel.is-logged-in {
  border-color: rgba(85, 214, 165, 0.28);
}

.auth-panel h2 {
  margin: 5px 0 0;
  font-family: var(--font-heading);
  font-size: 22px;
}

.auth-panel p {
  margin: 6px 0 0;
  color: var(--text-secondary);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading.center {
  justify-content: center;
  text-align: center;
}

.section-heading h2,
.games-hero h2 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.1;
}

.eyebrow {
  color: var(--accent-secondary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.feed-panel {
  padding: 24px;
  margin-bottom: 24px;
  overflow: hidden;
}

.feed-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.feed-window {
  max-height: 760px;
  overflow: hidden;
  border-radius: var(--radius-xl);
}

.feed-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  animation: feedDrift 38s linear infinite;
  will-change: transform;
}

.feed-window:hover .feed-grid {
  animation-play-state: paused;
}

.quick-card {
  min-height: 98px;
  flex-direction: column;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-primary);
  font-weight: 700;
}

.quick-card svg {
  width: 24px;
  height: 24px;
  color: var(--accent-primary-hover);
}

.quick-card:hover {
  transform: translateY(-3px);
  background: var(--surface-elevated);
  border-color: rgba(139, 124, 255, 0.48);
}

.app-view {
  display: none;
}

.app-view.is-active {
  display: block;
  animation: viewIn 240ms var(--ease-out);
}

.home-only {
  display: none;
}

.home-only.is-active {
  display: block;
}

.auth-panel.home-only.is-active {
  display: flex;
}

.content-layout {
  grid-template-columns: 300px 1fr;
  gap: 20px;
}

.content-layout.is-active {
  display: grid;
}

.filter-panel {
  position: sticky;
  top: 92px;
  align-self: start;
  padding: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--text-primary);
  font-weight: 700;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
}

.media-tab {
  min-height: 38px;
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
}

.media-tab.is-active {
  background: var(--surface-elevated);
  color: var(--text-primary);
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 13px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}

.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

input,
select {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #111723;
  color: var(--text-primary);
  outline: none;
  transition: border-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out), background 150ms var(--ease-out);
}

input:focus,
select:focus {
  background: var(--surface-elevated);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(139, 124, 255, 0.16);
}

.results-panel {
  min-height: 520px;
  padding: 22px;
}

.result-zone {
  min-height: 160px;
}

.status,
.empty-state {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-secondary);
}

.empty-state {
  display: grid;
  grid-template-columns: 170px 1fr;
  align-items: center;
  gap: 20px;
}

.empty-state img {
  width: 100%;
  border-radius: var(--radius-lg);
}

.movie-card {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 22px;
  padding: 18px;
  border: 1px solid rgba(139, 124, 255, 0.45);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(139, 124, 255, 0.14);
  animation: resultReveal 420ms var(--ease-out);
}

.poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  object-fit: cover;
}

.movie-card h2 {
  margin: 0 0 10px;
  font-family: var(--font-heading);
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.14;
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.meta-pill,
.chip {
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(32, 38, 56, 0.65);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
}

.chip.is-selected,
.chip:hover {
  background: rgba(139, 124, 255, 0.18);
  color: var(--text-primary);
  border-color: rgba(139, 124, 255, 0.5);
}

.overview {
  color: var(--text-secondary);
  line-height: 1.65;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 16px;
}

.feed-card {
  cursor: pointer;
}

.feed-card .mini-card__poster {
  aspect-ratio: 2 / 2.75;
}

.release-date {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  color: var(--accent-secondary);
  font-size: 12px;
  font-weight: 700;
}

.mini-card {
  min-height: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
  transition: transform 180ms var(--ease-out), border-color 180ms var(--ease-out), background 180ms var(--ease-out);
}

.mini-card:hover {
  transform: translateY(-4px);
  background: var(--surface-elevated);
  border-color: rgba(139, 124, 255, 0.45);
}

.mini-card__poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: var(--bg-secondary);
}

.mini-card__body {
  padding: 13px;
}

.mini-card b {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-heading);
  line-height: 1.28;
}

.mini-card p,
.mini-card .meta {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.random-shell {
  padding: clamp(20px, 4vw, 34px);
}

.random-actions {
  justify-content: center;
  margin-bottom: 22px;
}

#view-lists {
  padding: 22px;
}

.list-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.list-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.games-hero {
  min-height: 360px;
  display: flex;
  align-items: center;
  padding: clamp(24px, 5vw, 46px);
  margin-bottom: 20px;
  background:
    linear-gradient(90deg, rgba(24, 29, 42, 0.98), rgba(24, 29, 42, 0.74), rgba(24, 29, 42, 0.22)),
    url("/static/images/games-night-frame.png");
  background-size: cover;
  background-position: center;
}

.game-card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
}

.game-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 88px;
  z-index: 80;
  max-width: min(420px, calc(100% - 28px));
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.bottom-nav {
  display: none;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 28px;
  padding: 18px 4px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.site-footer > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tmdb-mark {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 8px;
  background: linear-gradient(135deg, #01b4e4, #90cea1);
  color: #08111f;
  font-weight: 800;
  letter-spacing: 0;
}

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

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

@keyframes feedDrift {
  0% { transform: translateY(0); }
  45% { transform: translateY(-180px); }
  100% { transform: translateY(0); }
}

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 24px, 720px);
    padding-top: 82px;
  }

  .desktop-nav {
    display: none;
  }

  .content-layout.is-active {
    display: block;
  }

  .filter-panel {
    position: static;
    margin-bottom: 16px;
  }

  .quick-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .feed-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .auth-panel,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .movie-card,
  .empty-state {
    grid-template-columns: 1fr;
  }

  .movie-card {
    gap: 16px;
  }

  .poster {
    max-height: 560px;
  }

  .bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 10px;
    z-index: 60;
    width: min(560px, calc(100% - 18px));
    height: 66px;
    transform: translateX(-50%);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 6px;
    border: 1px solid rgba(42, 49, 66, 0.82);
    border-radius: 20px;
    background: rgba(14, 17, 23, 0.9);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-lg);
  }

  .bottom-link {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-radius: 15px;
    background: transparent;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
  }

  .bottom-link svg {
    width: 19px;
    height: 19px;
  }

  .bottom-link.is-active {
    background: rgba(139, 124, 255, 0.18);
    color: var(--text-primary);
  }
}

@media (max-width: 560px) {
  .site-header {
    top: 8px;
    width: calc(100% - 20px);
  }

  .brand-mark {
    font-size: 18px;
  }

  .hero-section {
    min-height: 520px;
    background:
      linear-gradient(180deg, rgba(14, 17, 23, 0.96), rgba(14, 17, 23, 0.64), rgba(14, 17, 23, 0.24)),
      url("/static/images/hero-night-cinema.png");
    background-size: cover;
    background-position: center;
  }

  .hero-copy {
    padding: 24px;
  }

  .quick-grid,
  .game-options,
  .two-cols {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .feed-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mini-card__body {
    padding: 10px;
  }

  .card-actions .button-secondary,
  .card-actions .button-primary,
  .card-actions .button-ghost {
    flex: 1 1 100%;
  }
}
