:root {
  --bg: #0f0f14;
  --surface: #1a1a22;
  --surface-2: #23232e;
  --fg: #f2f2f5;
  --muted: #9a9aa5;
  --accent: #e5308a;
  --like: #2ecc71;
  --dislike: #e74c3c;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100dvh;
}

#app {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 1rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0 0.5rem;
}
.topbar h1 {
  margin: 0;
  font-size: 1.4rem;
  color: var(--accent);
}
.user-badge {
  font-size: 0.85rem;
  color: var(--muted);
  background: var(--surface);
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
}

#content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0.5rem 0;
}

.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
}
.hidden {
  display: none !important;
}

h2 {
  margin: 0.3rem 0 0.6rem;
}
h3 {
  margin: 0 0 0.5rem;
}
.muted {
  color: var(--muted);
  margin: 0.3rem 0;
}
.mt {
  margin-top: 1rem;
}

.input,
select.input {
  width: 100%;
  padding: 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--surface-2);
  background: var(--surface);
  color: var(--fg);
  font-size: 1rem;
}

.btn {
  width: 100%;
  padding: 0.8rem;
  border-radius: var(--radius);
  border: 1px solid var(--surface-2);
  background: var(--surface-2);
  color: var(--fg);
  font-size: 1rem;
  cursor: pointer;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn:active {
  transform: scale(0.98);
}
.btn-link {
  background: none;
  border: none;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.9rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.chip {
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--surface-2);
  cursor: pointer;
  font-size: 0.9rem;
}
.chip.like {
  border-color: var(--accent);
  color: var(--fg);
}
.chip.love {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.hint {
  font-size: 0.8rem;
  opacity: 0.8;
}

.card-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}
.toggle {
  display: flex;
  gap: 0.3rem;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 0.2rem;
}
.toggle-opt {
  border: none;
  background: none;
  color: var(--fg);
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
}
.toggle-opt.active {
  background: var(--accent);
  color: #fff;
}
.check-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.7rem;
  color: var(--muted);
}

.error {
  color: var(--dislike);
  min-height: 1.2em;
  font-size: 0.9rem;
}

/* Swipe */
.room-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}
.code {
  font-family: ui-monospace, monospace;
  letter-spacing: 2px;
  background: var(--surface);
  padding: 0.3rem 0.6rem;
  border-radius: 8px;
}
.ws-status {
  color: var(--dislike);
  font-size: 0.8rem;
}
.ws-status.live {
  color: var(--like);
}

.invite-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}
.chip-btn {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--surface-2);
  background: var(--surface);
  color: var(--fg);
  font-size: 0.8rem;
  cursor: pointer;
}
.chip-btn:active {
  transform: scale(0.96);
}
.rating-row {
  font-size: 0.85rem;
  color: var(--accent);
  margin: 0.2rem 0;
  min-height: 1em;
}

.deck-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60dvh;
}
.movie-card {
  width: 100%;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.poster {
  width: 100%;
  aspect-ratio: 2 / 3;
  background-size: cover;
  background-position: center;
  background-color: var(--surface-2);
}
.poster.big {
  max-width: 220px;
  border-radius: var(--radius);
  margin: 0.5rem auto;
}
.card-info {
  padding: 0.9rem;
}
.overview {
  font-size: 0.9rem;
  color: var(--muted);
  max-height: 6.5em;
  overflow: auto;
}

.swipe-actions {
  display: flex;
  justify-content: center;
  gap: 2rem;
  padding: 1rem 0;
}
.round-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: #fff;
}
.round-btn.like {
  background: var(--like);
}
.round-btn.dislike {
  background: var(--dislike);
}
.round-btn:active {
  transform: scale(0.92);
}

/* Match */
.toggle.small {
  padding: 0.15rem;
}
.toggle.small .toggle-opt {
  padding: 0.25rem 0.5rem;
  font-size: 0.95rem;
}

.match-title {
  text-align: center;
  color: var(--accent);
}
.match-reason {
  color: var(--fg);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
  max-width: 320px;
}
.providers {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin: 0.3rem 0 0.6rem;
}
.providers-label {
  font-size: 0.8rem;
}
.provider img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: block;
}
.provider {
  font-size: 0.8rem;
  color: var(--muted);
}
#screen-match,
#screen-matches {
  align-items: center;
  text-align: center;
}

.matches-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.match-item {
  display: flex;
  gap: 0.7rem;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.6rem;
  text-align: left;
}
.match-item .poster {
  width: 54px;
  aspect-ratio: 2 / 3;
  border-radius: 8px;
  flex-shrink: 0;
}

.attribution {
  padding: 0.75rem 0;
  font-size: 0.7rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}
.attribution a {
  color: var(--muted);
}

.toast {
  position: fixed;
  bottom: 5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--like);
  color: #fff;
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  z-index: 10;
  animation: fade 2.2s forwards;
}
@keyframes fade {
  0%, 80% { opacity: 1; }
  100% { opacity: 0; }
}
