/* MovieSwipe, "Paper" theme: follows the device's light / dark setting. */
:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface2: #f1f0ec;
  --ink: #111111;
  --ink-on: #fafaf9;       /* text on an ink-coloured button */
  --muted: #5b5b57;
  --line: #deddd7;
  --dots: #d6d5ce;
  --accent: #2b4bff;
  --accent-soft: rgba(43, 75, 255, .10);
  --yes: #1a8f4f;
  --yes-soft: rgba(26, 143, 79, .12);
  --no: #c8372d;
  --no-soft: rgba(200, 55, 45, .10);
  --shadow: 0 1px 0 rgba(17,17,17,.04), 0 10px 30px rgba(17,17,17,.08);
  --radius: 14px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110;
    --surface: #1a1a19;
    --surface2: #232321;
    --ink: #f3f3f0;
    --ink-on: #111110;
    --muted: #a3a39d;
    --line: #2e2e2b;
    --dots: #262624;
    --accent: #7b8fff;
    --accent-soft: rgba(123, 143, 255, .14);
    --yes: #4cc38a;
    --yes-soft: rgba(76, 195, 138, .14);
    --no: #ff7a70;
    --no-soft: rgba(255, 122, 112, .12);
    --shadow: 0 1px 0 rgba(0,0,0,.4), 0 12px 34px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.5 var(--sans);
  min-height: 100dvh;
  overscroll-behavior-y: none;
  background-image: radial-gradient(var(--dots) 1px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app { min-height: 100dvh; }
.screen {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(18px + var(--safe-t)) 20px calc(28px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 100dvh;
}

/* ---------- type ---------- */
.brand {
  font-family: var(--mono);
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--muted);
}
.title {
  font-size: clamp(36px, 10.5vw, 50px);
  line-height: 1.03;
  font-weight: 700;
  letter-spacing: -.035em;
}
.title em { color: var(--accent); font-style: normal; }
.lead { color: var(--muted); font-size: 17px; }
.label {
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; line-height: 1.4; }
.explain { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.center { text-align: center; }
h2 { font-size: 20px; letter-spacing: -.02em; }

/* ---------- buttons ---------- */
.btn {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-weight: 600;
  background: var(--surface);
  color: var(--ink);
  transition: transform .08s ease, opacity .15s ease, background .15s ease;
  text-align: center;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--ink-on); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.yes { background: var(--yes); border-color: var(--yes); color: #fff; }
.btn.danger { background: transparent; color: var(--no); border-color: var(--no); }
.btn.ghost { background: transparent; }
.btn.link { background: none; border: 0; padding: 8px 4px; color: var(--muted); font-weight: 500; }
.btn.block { width: 100%; }
.btn.small { padding: 9px 14px; font-size: 14px; border-radius: 11px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }

/* ---------- form bits ---------- */
.field {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 15px;
  outline: none;
}
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.field {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%;
  background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  appearance: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--ink-on); }
.chip.static { cursor: default; font-size: 12.5px; padding: 4px 10px; color: var(--muted); background: transparent; }
.chip img { width: 22px; height: 22px; border-radius: 6px; }
.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--surface2); border: 1px solid var(--line); border-radius: var(--radius); padding: 3px; gap: 3px;
}
.seg button { appearance: none; border: 0; background: transparent; border-radius: 11px; padding: 9px 6px; font-weight: 600; color: var(--muted); font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 1px 3px rgba(0,0,0,.08); }
.section { display: flex; flex-direction: column; gap: 9px; }
.emojis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.emojis button { appearance: none; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; font-size: 24px; padding: 8px 0; }
.emojis button[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.err { color: var(--no); font-size: 14px; }
.note { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; font-size: 14px; color: var(--muted); }
.note.accent { border-color: var(--accent); background: var(--accent-soft); color: var(--ink); }

/* ---------- home ---------- */
.hero { margin-top: 5vh; display: flex; flex-direction: column; gap: 14px; }
.joinbox { display: flex; gap: 10px; }
.joinbox .field { text-transform: uppercase; letter-spacing: .3em; text-align: center; font-weight: 600; font-size: 20px; font-family: var(--mono); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.steps { display: grid; gap: 10px; counter-reset: s; margin: 0; padding: 0; }
.steps li { list-style: none; display: flex; gap: 12px; align-items: baseline; color: var(--muted); font-size: 15px; }
.steps li::before { counter-increment: s; content: counter(s); font-family: var(--mono); color: var(--accent); font-weight: 500; width: 18px; flex: none; }
.footer { margin-top: auto; padding-top: 12px; display: flex; justify-content: center; gap: 8px; }

/* ---------- filters ---------- */
.countline { font-family: var(--mono); font-size: 13px; color: var(--muted); min-height: 20px; }
.countline.low { color: var(--no); }
.sticky-actions { position: sticky; bottom: 0; padding-top: 10px; padding-bottom: calc(8px + var(--safe-b)); background: linear-gradient(to top, var(--bg) 72%, transparent); margin-top: auto; display: flex; flex-direction: column; gap: 10px; }

/* ---------- lobby ---------- */
.codebox { display: flex; gap: 8px; justify-content: center; }
.codebox span {
  width: 50px; height: 62px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  font-family: var(--mono); font-size: 30px; font-weight: 500;
}
.qr { align-self: center; background: #fff; padding: 10px; border-radius: 14px; line-height: 0; border: 1px solid var(--line); }
.qr svg { width: 160px; height: 160px; display: block; }
.players { display: flex; flex-direction: column; gap: 8px; }
.player { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 12px; }
.player .av { width: 38px; height: 38px; font-size: 21px; }
.player .nm { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 500; padding: 3px 8px; border-radius: 999px; background: var(--surface2); color: var(--muted); }
.tag.host { color: var(--accent); background: var(--accent-soft); }
.tag.ready { background: var(--yes-soft); color: var(--yes); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--yes); flex: none; }
.dot.off { background: var(--line); }
.av { width: 34px; height: 34px; border-radius: 50%; background: var(--surface2); display: inline-grid; place-items: center; font-size: 18px; position: relative; flex: none; border: 2px solid var(--surface); }
.av .star { position: absolute; right: -5px; top: -6px; font-size: 12px; }
.av.auto { opacity: .5; }

/* ---------- swipe ---------- */
.swipe { padding-bottom: calc(14px + var(--safe-b)); gap: 10px; height: 100dvh; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 10px; }
.bar { height: 5px; background: var(--line); border-radius: 99px; overflow: hidden; flex: 1; }
.bar > i { display: block; height: 100%; background: var(--ink); border-radius: 99px; transition: width .25s ease; }
.count { font-family: var(--mono); font-weight: 500; min-width: 54px; text-align: right; font-size: 13px; }
.supertag { font-family: var(--mono); font-size: 12px; font-weight: 500; padding: 4px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.supertag.used { background: var(--surface2); color: var(--muted); }
.subbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; }
.finished { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.finished .av { width: 24px; height: 24px; font-size: 13px; margin-left: -6px; }
.finished .av:first-of-type { margin-left: 0; }
.chipbtn { appearance: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 11px; font-size: 13px; font-weight: 600; font-family: var(--mono); display: inline-flex; gap: 6px; align-items: center; }
.chipbtn.pulse { animation: bump .5s ease; border-color: var(--accent); }
.deck { position: relative; flex: 1; min-height: 0; }
.card {
  position: absolute; inset: 0;
  border-radius: 22px; overflow: hidden;
  background: #1a1a19; color: #fff;
  box-shadow: var(--shadow);
  touch-action: none; user-select: none; -webkit-user-select: none;
  will-change: transform;
}
.card.next { transform: scale(.95) translateY(10px); filter: brightness(.7); pointer-events: none; }
.card .poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.card .ph { position: absolute; inset: 0; display: grid; place-items: center; padding: 30px; text-align: center; font-weight: 700; font-size: 28px; line-height: 1.1; }
.card .shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(8,8,10,.96) 0%, rgba(8,8,10,.8) 30%, rgba(8,8,10,0) 62%); pointer-events: none; }
.card .info { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 18px 18px; display: flex; flex-direction: column; gap: 8px; }
.card .ttl { font-size: 25px; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.card .meta { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; font-size: 13px; color: #d8d8d4; }
.card .meta .rate { color: #fff; font-weight: 600; font-family: var(--mono); }
.card .gen { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,.14); }
.card .ov { font-size: 14px; color: #e4e4e0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card.open .ov { -webkit-line-clamp: unset; display: block; }
.card .foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: #b9b9b4; }
.card .trailer { color: #fff; font-weight: 600; text-decoration: none; padding: 5px 11px; border-radius: 999px; background: rgba(255,255,255,.16); font-size: 12.5px; }
.stamp { position: absolute; top: 28px; padding: 6px 14px; border: 4px solid; border-radius: 10px; font-weight: 800; font-size: 28px; letter-spacing: .06em; opacity: 0; pointer-events: none; font-family: var(--mono); }
.stamp.yes { left: 20px; color: #5ee0a0; border-color: #5ee0a0; transform: rotate(-14deg); }
.stamp.no { right: 20px; color: #ff8a80; border-color: #ff8a80; transform: rotate(14deg); }
.stamp.super { left: 50%; top: 22%; color: #a9b6ff; border-color: #a9b6ff; transform: translateX(-50%) rotate(-4deg); }
.actions { display: flex; justify-content: center; align-items: center; gap: 22px; padding-top: 2px; }
.round { appearance: none; border: 1px solid var(--line); border-radius: 50%; width: 62px; height: 62px; display: grid; place-items: center; font-size: 26px; background: var(--surface); transition: transform .08s ease; box-shadow: var(--shadow); }
.round:active { transform: scale(.92); }
.round.no { color: var(--no); }
.round.yes { color: var(--yes); }
.round.super { width: 52px; height: 52px; font-size: 22px; color: var(--accent); }
.round:disabled { opacity: .35; transform: none; box-shadow: none; }
.wait { display: grid; place-items: center; text-align: center; height: 100%; color: var(--muted); gap: 8px; }
.hintbar { font-size: 12.5px; color: var(--muted); text-align: center; }
.hintcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; font-size: 13.5px; color: var(--muted); display: flex; gap: 10px; align-items: flex-start; }
.hintcard button { margin-left: auto; }

/* ---------- results / picks ---------- */
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 500; color: var(--muted); }
.pill.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.4s infinite; }
.pill.done { color: var(--yes); }
@keyframes pulse { 50% { opacity: .25; } }
.result { display: grid; grid-template-columns: 68px 1fr; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px; cursor: pointer; text-align: left; width: 100%; }
.result .th { width: 68px; aspect-ratio: 2 / 3; border-radius: 8px; object-fit: cover; background: var(--surface2); display: grid; place-items: center; text-align: center; font-size: 11px; font-weight: 600; padding: 4px; overflow: hidden; color: #fff; }
.result .rt { font-weight: 600; line-height: 1.2; }
.result .sub { font-size: 13px; color: var(--muted); }
.result .votes { display: flex; align-items: center; gap: 0; margin-top: 4px; flex-wrap: wrap; }
.result .votes .av { margin-left: -8px; width: 28px; height: 28px; font-size: 15px; }
.result .votes .av:first-child { margin-left: 0; }
.result .tally { font-family: var(--mono); font-size: 12.5px; font-weight: 500; margin-left: 10px; color: var(--muted); }
.result.match { border-color: var(--accent); background: linear-gradient(135deg, var(--accent-soft), var(--surface) 65%); }
.result.match .tally { color: var(--accent); }
.result.sel { border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.result .ovx { grid-column: 1 / -1; font-size: 14px; color: var(--muted); }
.result .links { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; }
.result .links a, .linkish { color: var(--accent); font-size: 13.5px; font-weight: 600; text-decoration: none; }
.group { display: flex; flex-direction: column; gap: 10px; }
.gtitle { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
details summary { cursor: pointer; color: var(--muted); font-weight: 500; padding: 6px 0; }
details ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.winner { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 6px 0 2px; }
.winner img, .winner .ph { width: 190px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 16px; box-shadow: 0 0 0 3px var(--accent), var(--shadow); background: var(--surface2); display: grid; place-items: center; font-weight: 700; padding: 10px; color: #fff; }
.winner h1 { font-size: 30px; letter-spacing: -.03em; line-height: 1.1; }
.badge { font-family: var(--mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.pickers { display: flex; justify-content: center; flex-wrap: wrap; }
.pickers .av { margin-left: -6px; }
.pickers .av:first-child { margin-left: 0; }
.lockrow { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lockrow .who { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.lockrow .who .av { width: 24px; height: 24px; font-size: 13px; }
.lockrow .who.ok { color: var(--yes); }

/* ---------- overlay: banner, sheets, snacks ---------- */
#overlay { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
.banner {
  position: absolute; left: 50%; top: calc(12px + var(--safe-t)); transform: translateX(-50%);
  width: min(92vw, 420px); pointer-events: none;
  background: var(--ink); color: var(--ink-on); border-radius: 16px;
  padding: 10px 14px; display: flex; gap: 12px; align-items: center;
  box-shadow: var(--shadow); animation: drop .3s cubic-bezier(.2,1.2,.4,1);
}
.banner.out { opacity: 0; transform: translate(-50%, -14px); transition: all .25s ease; }
.banner .bth { width: 36px; aspect-ratio: 2 / 3; border-radius: 5px; object-fit: cover; background: #444; flex: none; }
.banner .bt { font-weight: 600; line-height: 1.2; }
.banner .bs { font-size: 12.5px; opacity: .7; }
.snack { position: absolute; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: var(--ink-on); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; pointer-events: auto; max-width: min(92vw, 420px); text-align: center; animation: fade .2s ease; }
.modal { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 22px; background: rgba(10,10,10,.5); pointer-events: auto; animation: fade .15s ease; }
.modal.bottom { align-items: flex-end; padding: 0; }
.modal .sheet { background: var(--bg); border: 1px solid var(--line); border-radius: 20px; padding: 22px; max-width: 440px; width: 100%; display: flex; flex-direction: column; gap: 14px; max-height: 86dvh; overflow: auto; box-shadow: var(--shadow); }
.modal.bottom .sheet { border-radius: 22px 22px 0 0; max-width: 520px; padding-bottom: calc(22px + var(--safe-b)); }
.modal h3 { font-size: 20px; letter-spacing: -.02em; }
.modal ul.how { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: 14.5px; color: var(--muted); }
.modal ul.how b { color: var(--ink); font-weight: 600; }
@keyframes fade { from { opacity: 0; } }
@keyframes drop { from { transform: translate(-50%, -30px); opacity: 0; } }
@keyframes bump { 40% { transform: scale(1.18); } }

.net { position: fixed; top: calc(10px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 60; background: var(--surface); color: var(--ink); border: 1px solid var(--line); padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow); }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
