:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #070a12;
  color: #eef2ff;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

html, body {
  min-height: 100%;
  margin: 0;
  padding: 0;
  background: #0a1020;
}

body {
  color: #e6edf9;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at top, rgba(84, 105, 255, 0.16), transparent 34%),
    radial-gradient(circle at 22% 18%, rgba(74, 153, 255, 0.1), transparent 20%),
    linear-gradient(180deg, #0b1224 0%, #0a1020 42%, #070b16 100%);
  pointer-events: none;
  z-index: -1;
}

body.has-taste-overlay {
  overflow: hidden;
}

button, input, select {
  font: inherit;
}

.app-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 20px 64px;
  transition: filter 0.25s ease, transform 0.25s ease, opacity 0.25s ease;
}

.app-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 28px;
  padding: 18px 4px 0;
  color: #90a0cb;
}

.app-footer-copy {
  display: grid;
  gap: 4px;
}

.app-footer-copy p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
}

.app-footer-copy a {
  color: inherit;
  text-decoration: none;
}

.app-footer-copy a:hover {
  text-decoration: underline;
}

.site-footer-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: #7f8db7;
  font-size: 0.84rem;
}

.site-footer-line a {
  color: inherit;
  text-decoration: none;
}

.site-footer-line a:hover {
  text-decoration: underline;
}

.tmdb-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.tmdb-badge-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #01d277, #01b4e4);
  color: #062133;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body.has-taste-overlay .app-shell {
  filter: blur(20px);
  transform: scale(0.985);
  opacity: 0.45;
  pointer-events: none;
  user-select: none;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.brand {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 12px;
  color: #7c8bb8;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.82rem;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
}

.subtitle {
  margin: 0;
  color: #b8c3db;
  max-width: 700px;
}

.header-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 22px;
}

.panel-header h3 {
  margin: 0;
}

.panel-header-copy {
  display: grid;
  gap: 6px;
}

.panel-header-copy p {
  margin: 0;
  color: #97a6d2;
  font-size: 0.92rem;
  line-height: 1.45;
}

.panel-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

.panel-actions .secondary-button {
  padding: 10px 14px;
  border-radius: 14px;
}

.panel-primary-action {
  min-height: 48px;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 16px 34px rgba(86, 118, 255, 0.24);
}

.panel-secondary-action {
  min-height: 48px;
  white-space: nowrap;
}

.panel {
  background: rgba(18, 24, 44, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.2);
}

.card {
  margin-bottom: 24px;
}

.main-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

#main-screen {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.results-panel {
  grid-column: 2;
}

#filter-panel {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.hidden {
  display: none !important;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

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

label, .provider-label {
  font-size: 0.95rem;
  color: #c5d1f0;
}

select, input {
  width: 100%;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(10, 14, 33, 0.95);
  color: #eef2ff;
  padding: 14px 16px;
  outline: none;
}

#country-input {
  cursor: text;
}

.country-picker {
  position: relative;
}

.country-suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: grid;
  gap: 6px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(9, 13, 30, 0.98);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.32);
  z-index: 20;
}

.country-suggestion {
  border: none;
  border-radius: 14px;
  padding: 12px 14px;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  color: #eef2ff;
}

.country-suggestion:hover {
  background: rgba(96, 124, 230, 0.22);
  transform: none;
}

input::placeholder {
  color: #7c8bb8;
}

button {
  border: none;
  cursor: pointer;
  border-radius: 16px;
  padding: 14px 18px;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary-button {
  background: linear-gradient(135deg, #5a7ff1, #a669ff);
  color: #fff;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.08);
  color: #e6edf9;
}

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

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

.provider-picker {
  display: grid;
  gap: 12px;
}

.provider-grid-more {
  margin-top: 10px;
}

.provider-more {
  display: grid;
  gap: 8px;
}

.provider-more summary {
  cursor: pointer;
  color: #aebbe4;
  font-size: 0.9rem;
  list-style: none;
}

.provider-more summary::-webkit-details-marker {
  display: none;
}

.provider-more summary::after {
  content: ' +';
  color: #7d9cff;
}

.provider-more[open] summary::after {
  content: ' -';
}

.provider-option {
  display: block;
  cursor: pointer;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 24px;
  padding: 0;
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.provider-option:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.16);
}

.provider-option.is-selected {
  background:
    radial-gradient(circle at top, rgba(115, 144, 255, 0.22), transparent 68%),
    linear-gradient(180deg, rgba(34, 44, 92, 0.95), rgba(23, 29, 55, 0.96));
  border-color: rgba(129, 156, 255, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 1px rgba(116, 145, 255, 0.12),
    0 18px 38px rgba(19, 27, 58, 0.34);
}

.provider-option-copy {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  min-width: 0;
  min-height: 112px;
  padding: 16px 10px 14px;
  font-size: 0.82rem;
  line-height: 1.25;
  text-align: center;
  overflow: hidden;
}

.provider-option-copy span:last-child {
  max-width: 100%;
  color: #d9e1fb;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-wrap: pretty;
}

.provider-option-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.service-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 10px;
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.08);
}

.service-logo-image {
  width: min(100%, 64px);
  height: 40px;
  object-fit: contain;
  display: block;
}

.service-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 88px);
  height: 40px;
}

.service-logo-mark svg {
  width: 100%;
  height: 100%;
  display: block;
}

.setup-actions, .form-actions {
  display: flex;
  justify-content: flex-end;
}

.sidebar-setup-form {
  margin-bottom: 28px;
}

#filter-panel h3 {
  margin-top: 0;
}

#filter-panel > h3 {
  margin-top: 6px;
}

.sticky-panel {
  position: sticky;
  top: 24px;
}

.results-panel {
  display: grid;
  gap: 18px;
  min-width: 0;
  padding: 18px;
  border-radius: 28px;
  background:
    radial-gradient(circle at top, rgba(93, 125, 255, 0.08), transparent 36%),
    rgba(6, 10, 24, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.results-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.results-filters {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
  overflow: visible;
}

.filter-chip {
  position: relative;
}

.filter-chip[open] {
  z-index: 20;
}

.filter-chip-trigger {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #e6edf9;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}

.filter-chip-trigger::-webkit-details-marker {
  display: none;
}

.filter-chip[open] .filter-chip-trigger {
  background:
    radial-gradient(circle at top, rgba(115, 144, 255, 0.18), transparent 70%),
    rgba(90, 127, 241, 0.18);
  box-shadow:
    inset 0 0 0 1px rgba(116, 145, 255, 0.2),
    0 14px 32px rgba(20, 31, 69, 0.22);
}

.filter-chip-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  padding: 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(11, 16, 37, 0.98);
  box-shadow: 0 22px 48px rgba(0, 0, 0, 0.3);
}

.filter-option-list {
  display: grid;
  gap: 8px;
}

#filter-genre.filter-option-list {
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.filter-option {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(7, 11, 26, 0.94);
  color: #dce5ff;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.filter-option.is-selected {
  background:
    radial-gradient(circle at top, rgba(115, 144, 255, 0.16), transparent 80%),
    rgba(90, 127, 241, 0.18);
  border-color: rgba(116, 145, 255, 0.18);
}

.results-stage {
  position: relative;
  min-height: 420px;
  border-radius: 24px;
  overflow: hidden;
}

.results-meta {
  color: #b8c3db;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.98rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  align-items: stretch;
  min-height: 100%;
}

.results-loading {
  position: fixed;
  display: grid;
  justify-items: center;
  align-content: center;
  padding: 24px;
  z-index: 80;
  pointer-events: none;
  background: rgba(6, 10, 24, 0.38);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.results-loading:not(.hidden) {
  opacity: 1;
}

.results-loading-content {
  display: grid;
  justify-items: center;
  gap: 18px;
  text-align: center;
  padding: 12px;
  filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.28));
}

.results-loading-ring {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 6px solid rgba(142, 162, 223, 0.16);
  border-top-color: #8ea2df;
  border-right-color: #7ea9ff;
  animation: spin 0.9s linear infinite;
}

.results-loading-label {
  max-width: 320px;
  color: #d7e1ff;
  font-size: 1rem;
  text-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

.result-card {
  background: rgba(7, 11, 24, 0.98);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
  border-radius: 24px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.poster {
  width: 100%;
  min-height: 420px;
  background-size: cover;
  background-position: center;
  position: relative;
}

.poster:empty {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(47, 54, 82, 0.9), rgba(24, 30, 53, 0.95));
  color: #99a6cc;
  text-align: center;
  padding: 32px 16px;
}

.result-card-content {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.result-card h3 {
  margin: 0;
  font-size: 1.18rem;
}

.result-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: #8b9cd7;
  font-size: 0.92rem;
}

.genre-list,
.provider-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.genre-pill,
.provider-pill {
  background: rgba(255, 255, 255, 0.06);
  color: #c8d4ff;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.82rem;
}

.card-copy {
  color: #ced6f5;
  font-size: 0.95rem;
  flex: 1;
}

.card-actions {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.card-actions a {
  color: #fff;
  text-decoration: none;
}

.service-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.results-state {
  color: #9aa3c7;
  min-height: 2rem;
}

.loading-indicator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.loading-indicator-ring {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(142, 162, 223, 0.22);
  border-top-color: #8ea2df;
  animation: spin 0.8s linear infinite;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 16, 0.9);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 999;
}

.taste-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(2, 5, 16, 0.42);
}

.taste-dialog {
  width: min(1180px, 100%);
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 32px;
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    radial-gradient(circle at top, rgba(93, 125, 255, 0.2), transparent 32%),
    linear-gradient(180deg, rgba(9, 13, 31, 0.98), rgba(8, 11, 24, 0.98));
  box-shadow: 0 36px 120px rgba(0, 0, 0, 0.45);
}

.taste-dialog-header {
  margin-bottom: 20px;
}

.taste-dialog-header h2 {
  margin: 0 0 10px;
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  line-height: 1.05;
}

.taste-copy {
  margin: 0;
  max-width: 720px;
  color: #bcc8e8;
}

.taste-progress {
  margin-bottom: 18px;
  color: #8ea2df;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.84rem;
}

.taste-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  min-height: 420px;
}

.taste-card {
  overflow: hidden;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(5, 9, 23, 0.96);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.28);
  display: flex;
  flex-direction: column;
}

.taste-poster {
  min-height: 350px;
  background-size: cover;
  background-position: center;
}

.taste-poster:empty {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(47, 54, 82, 0.9), rgba(24, 30, 53, 0.95));
  color: #99a6cc;
  text-align: center;
  padding: 32px 16px;
}

.taste-card-body {
  display: grid;
  gap: 16px;
  padding: 20px;
  flex: 1;
  align-content: start;
}

.taste-card-copy h3 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  min-height: 2.8em;
}

.taste-card-copy p {
  margin: 0;
  color: #8ea0d5;
}

.taste-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: auto;
  align-items: stretch;
}

.taste-button {
  min-height: 52px;
  background: linear-gradient(135deg, #6e8fff, #92a5ff);
  color: #061022;
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1;
}

.taste-button-neutral {
  background: rgba(255, 255, 255, 0.08);
  color: #eef2ff;
  font-size: 0.95rem;
}

.taste-button-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #eef2ff;
}

.taste-button.is-selected {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.14), 0 12px 28px rgba(89, 119, 255, 0.24);
}

.taste-status {
  margin-top: 18px;
}

.taste-completion {
  grid-column: 1 / -1;
  min-height: 420px;
  display: grid;
  width: 100%;
  align-content: center;
  justify-items: center;
  justify-content: center;
  gap: 18px;
  text-align: center;
  padding: 48px 24px;
  margin: 0 auto;
}

.taste-completion h3 {
  margin: 0;
  font-size: clamp(1.6rem, 2.4vw, 2.2rem);
}

.taste-completion p {
  margin: 0;
  max-width: 560px;
  color: #b9c6e6;
}

.taste-completion-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

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

.modal-card {
  width: min(1120px, 100%);
  max-height: min(92vh, 860px);
  overflow: hidden;
  background: rgba(11, 16, 37, 0.99);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  padding: 22px;
  position: relative;
}

@media (max-width: 960px) {
  #main-screen {
    grid-template-columns: 1fr;
  }

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

  .results-panel,
  #filter-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .sticky-panel {
    position: static;
  }

  .results-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .results-filters {
    align-self: flex-end;
    flex-wrap: wrap;
  }

  .filter-chip-menu {
    left: 0;
    right: auto;
  }

  .taste-grid {
    grid-template-columns: 1fr;
  }
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.06);
  color: #eef2ff;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
}

.modal-content-grid {
  display: grid;
  gap: 18px;
}

.modal-header {
  display: grid;
  gap: 20px;
  align-items: start;
}

.modal-poster {
  width: 100%;
  min-height: 300px;
  background-size: cover;
  background-position: center;
  border-radius: 20px;
}

.modal-hero-media {
  width: 100%;
}

.modal-details {
  display: grid;
  gap: 12px;
}

.trailer-block {
  display: grid;
  gap: 10px;
}

.trailer-frame {
  position: relative;
  width: 100%;
  padding-top: 42%;
  overflow: hidden;
  border-radius: 20px;
  background: rgba(4, 7, 18, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.trailer-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.modal-details h2 {
  margin: 0;
  font-size: clamp(1.5rem, 2.4vw, 2.1rem);
}

.modal-info {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: #a9b4dc;
}

@media (min-width: 900px) {
  .main-content {
    grid-template-columns: 320px 1fr;
  }

  #setup-screen,
  #main-screen {
    grid-column: span 2;
  }

  .modal-header {
    grid-template-columns: 380px 1fr;
  }
}

@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
  }

  .form-grid.compact {
    grid-template-columns: 1fr;
  }

  .sticky-panel {
    position: static;
  }

  .panel-actions {
    grid-template-columns: 1fr;
  }

  .results-filters {
    width: 100%;
    justify-content: flex-start;
  }

  .app-footer {
    gap: 12px;
  }

  .site-footer-line {
    flex-wrap: wrap;
  }

  .filter-chip-menu {
    min-width: min(220px, calc(100vw - 40px));
  }

  .taste-dialog {
    padding: 24px 18px;
  }

  .taste-actions {
    grid-template-columns: 1fr;
  }
}
