:root {
  --bg: #0e141f;
  --panel: rgba(11, 21, 33, 0.72);
  --panel-soft: rgba(19, 34, 53, 0.7);
  --line: rgba(170, 197, 222, 0.2);
  --text: #f2f8ff;
  --muted: #98adbf;
  --accent: #22c55e;
  --danger: #f97316;
  --warning: #f87171;
  --chip: rgba(167, 201, 232, 0.15);
  --shadow: 0 20px 60px rgba(2, 8, 22, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: radial-gradient(circle at 16% 10%, #1d3552 0, #0e141f 45%),
    radial-gradient(circle at 90% 86%, #2b173d 0, transparent 45%),
    var(--bg);
  font-family: 'Bricolage Grotesque', sans-serif;
  overflow-x: hidden;
}

.bg-shape {
  position: fixed;
  border-radius: 999px;
  filter: blur(40px);
  pointer-events: none;
  opacity: 0.45;
}

.bg-shape-a {
  width: 320px;
  height: 320px;
  background: #2dd4bf;
  top: -90px;
  right: -70px;
}

.bg-shape-b {
  width: 260px;
  height: 260px;
  background: #f97316;
  left: -60px;
  bottom: -80px;
}

.layout {
  width: min(1120px, calc(100vw - 2rem));
  margin: 1rem auto;
  display: grid;
  gap: 1rem;
  grid-template-columns: 380px 1fr;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.panel-setup {
  padding: 1.5rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.78rem;
  color: #75ebca;
  margin: 0;
}

h1 {
  margin: 0.3rem 0 0;
  font-size: 2.3rem;
  line-height: 0.95;
  font-family: 'Syne', sans-serif;
}

.subhead {
  margin: 0.7rem 0 1.2rem;
  color: var(--muted);
}

.ui-language-picker {
  display: block;
  margin-bottom: 1rem;
}

.join-form {
  display: grid;
  gap: 0.9rem;
}

label,
legend {
  font-weight: 600;
  font-size: 0.92rem;
  color: #d7e6f4;
}

input,
select {
  width: 100%;
  margin-top: 0.32rem;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 0.68rem 0.72rem;
  border-radius: 10px;
  font-size: 0.96rem;
}

input:focus,
select:focus {
  outline: 2px solid #34d399;
  outline-offset: 0;
}

.filter-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(11, 26, 40, 0.46);
  overflow: hidden;
}

.filter-group > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.72rem 0.78rem;
  font-weight: 600;
  color: #d7e6f4;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.filter-group > summary::-webkit-details-marker {
  display: none;
}

.filter-group > summary::after {
  content: '▾';
  color: var(--muted);
  transition: transform 180ms ease;
}

.filter-group:not([open]) > summary::after {
  transform: rotate(-90deg);
}

.filter-group[open] > summary {
  border-bottom: 1px solid var(--line);
}

.service-grid {
  margin-top: 0;
  padding: 0.65rem 0.75rem 0.75rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.genre-grid {
  margin-top: 0;
  padding: 0.65rem 0.75rem 0.75rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.service-option {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  background: rgba(89, 127, 167, 0.14);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.52rem;
  font-size: 0.86rem;
  color: #d2deeb;
}

.service-option input {
  margin: 0;
  width: auto;
}

.service-option-wide {
  grid-column: 1 / -1;
}

.hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
}

button {
  border: 0;
  cursor: pointer;
  font-family: inherit;
}

#join-btn {
  margin-top: 0.25rem;
  background: linear-gradient(120deg, #22c55e, #14b8a6);
  color: #00120d;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
}

.error {
  margin: 0.2rem 0 0;
  min-height: 1.2em;
  color: var(--warning);
  font-size: 0.88rem;
}

.room-meta {
  margin-top: 1rem;
  padding: 0.8rem;
  border-radius: 12px;
  background: rgba(20, 42, 66, 0.5);
  border: 1px solid var(--line);
}

#room-status {
  margin: 0;
  font-weight: 700;
}

#shared-services {
  margin: 0.38rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

#participants {
  margin: 0.7rem 0 0;
  padding-left: 1rem;
  color: #cfe0f1;
}

.panel-swipe {
  padding: 1rem;
  display: grid;
  gap: 0.9rem;
  grid-template-rows: minmax(0, 560px) auto minmax(0, 1fr);
  align-content: start;
  min-height: 0;
}

.card-shell {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0.75rem;
}

.movie-card {
  border-radius: 22px;
  background: rgba(11, 26, 40, 0.82);
  border: 1px solid var(--line);
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 240ms ease, opacity 240ms ease;
  touch-action: pan-y;
}

.movie-card.fly-left {
  transform: translateX(-72px) rotate(-8deg);
  opacity: 0;
}

.movie-card.fly-right {
  transform: translateX(72px) rotate(8deg);
  opacity: 0;
}

.movie-card img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-bottom: 1px solid var(--line);
  background: #0f172a;
}

.movie-card img[hidden] {
  display: none;
}

.movie-content {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.movie-meta {
  margin: 0;
  color: #9fc2e4;
  font-size: 0.88rem;
}

h2 {
  margin: 0.3rem 0 0.5rem;
  font-size: 1.85rem;
  line-height: 1.04;
  font-family: 'Syne', sans-serif;
}

#movie-blurb {
  margin: 0;
  color: #d5e5f4;
  line-height: 1.4;
  white-space: normal;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.46rem;
  margin-top: 0.9rem;
}

.chips span {
  border-radius: 999px;
  padding: 0.32rem 0.68rem;
  background: var(--chip);
  border: 1px solid var(--line);
  font-size: 0.78rem;
}

.chips-provider span {
  background: rgba(34, 197, 94, 0.17);
}

.empty-note {
  margin-top: 0.75rem;
  color: var(--muted);
  text-align: center;
}

.actions {
  display: flex;
  gap: 0.7rem;
  position: sticky;
  bottom: 0;
  z-index: 2;
}

.actions button {
  flex: 1;
  border-radius: 12px;
  padding: 0.75rem;
  font-weight: 800;
  font-size: 0.95rem;
}

.btn-no {
  background: rgba(249, 115, 22, 0.2);
  color: #ffd6ba;
  border: 1px solid rgba(251, 146, 60, 0.4);
}

.btn-yes {
  background: rgba(34, 197, 94, 0.22);
  color: #c8fddf;
  border: 1px solid rgba(74, 222, 128, 0.5);
}

.actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.matches {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(10, 21, 33, 0.6);
  padding: 0.85rem;
  min-height: 0;
  max-height: 220px;
  overflow-y: auto;
}

.matches h3 {
  margin: 0;
  font-size: 1rem;
}

#match-list {
  margin: 0.6rem 0 0;
  padding-left: 1rem;
}

#match-list li {
  margin: 0.26rem 0;
}

.muted {
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: min(340px, calc(100vw - 2rem));
  border-radius: 14px;
  background: linear-gradient(120deg, rgba(34, 197, 94, 0.95), rgba(20, 184, 166, 0.95));
  color: #032019;
  box-shadow: 0 15px 40px rgba(5, 21, 14, 0.4);
  padding: 0.85rem 1rem;
  animation: rise 280ms ease;
}

.toast p {
  margin: 0;
}

#toast-title {
  font-weight: 900;
}

#toast-body {
  margin-top: 0.22rem;
  font-weight: 600;
}

.tmdb-note {
  width: min(1120px, calc(100vw - 2rem));
  margin: 0 auto 1rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
}

.site-footer {
  width: min(1120px, calc(100vw - 2rem));
  margin: 0 auto 1rem;
  text-align: center;
  font-size: 0.85rem;
}

.site-footer a {
  color: #8fd4c1;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.site-footer a:hover {
  border-bottom-color: rgba(143, 212, 193, 0.65);
}

@keyframes rise {
  from {
    transform: translateY(12px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 920px) {
  .layout {
    grid-template-columns: 1fr;
    width: min(700px, calc(100vw - 1rem));
  }

  .panel-setup,
  .panel-swipe {
    padding: 1rem;
  }

  .panel-swipe {
    grid-template-rows: minmax(0, 480px) auto minmax(0, 1fr);
  }

  .tmdb-note {
    width: min(700px, calc(100vw - 1rem));
    text-align: left;
    margin-bottom: 0.55rem;
  }

  .site-footer {
    width: min(700px, calc(100vw - 1rem));
    margin-bottom: 0.8rem;
  }

  .card-shell,
  .movie-card {
    min-height: 0;
    height: 100%;
  }

  .movie-card img {
    height: 230px;
  }

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