/* Popcorn Parliament: a small private film club. Dark green, cream, one brick red. */

:root {
  --ink: #0f231a;
  --ink-2: #13291f;
  --ink-3: #173326;
  --cream: #f2ecd9;
  --cream-dim: rgba(242, 236, 217, 0.62);
  --cream-faint: rgba(242, 236, 217, 0.46);
  --line: rgba(242, 236, 217, 0.16);
  --line-strong: rgba(242, 236, 217, 0.34);
  --brick: #a84332;
  --brick-soft: rgba(168, 67, 50, 0.16);
  --serif: Georgia, "Iowan Old Style", "Times New Roman", Times, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 4px;
  --radius-lg: 10px;

  /* Glass. Solid values first: these are also the no-backdrop-filter fallback,
     and they sit close to the flat look they replace. */
  --glass: rgba(23, 51, 38, 0.72);
  --glass-strong: rgba(26, 58, 43, 0.78);
  --glass-well: rgba(0, 0, 0, 0.26);
  --glass-border: rgba(242, 236, 217, 0.15);
  --glass-edge: rgba(255, 255, 255, 0.20);   /* top edge catching the light */
  --glass-lift: 0 18px 40px -20px rgba(0, 0, 0, 0.7), 0 2px 10px rgba(0, 0, 0, 0.22);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: #0b1a13;
  color: var(--cream);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* Something for the glass to refract: slow, large-scale glows in the deep
   greens. Fixed pseudo-elements rather than background-attachment: fixed,
   which is markedly cheaper to composite on mobile. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(1100px 720px at 16% -10%, rgba(63, 128, 98, 0.34), transparent 62%),
    radial-gradient(920px 640px at 88% 4%, rgba(31, 88, 66, 0.30), transparent 64%),
    radial-gradient(1000px 820px at 52% 110%, rgba(24, 70, 51, 0.36), transparent 66%);
}

/* A whisper of grain so the large flat areas aren't glassy-smooth. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; line-height: 1.2; }

a { color: var(--cream); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--cream); }

.wrap {
  max-width: 660px;
  margin: 0 auto;
  padding: 34px 20px 80px;
}
.wrap--wide { max-width: 720px; }

/* ---------- masthead ---------- */

.brand {
  font-family: var(--serif);
  font-size: 14px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--cream-dim);
  margin: 0 0 26px;
}
.brand a { text-decoration: none; }

.hero { text-align: center; padding: 26px 0 34px; }
.hero h1 {
  font-size: clamp(30px, 8.2vw, 58px);
  letter-spacing: 0.05em;
  line-height: 1.08;
}
/* Two words, each unbreakable: one line on desktop, two tidy centred lines on a phone. */
.hero h1 span { white-space: nowrap; display: inline-block; }
.hero .rule {
  width: 72px; height: 1px; background: var(--line-strong);
  margin: 20px auto;
}
.tagline { color: var(--cream-dim); font-family: var(--serif); font-style: italic; font-size: 17px; margin: 0; }

.roomhead { margin-bottom: 28px; }
.roomhead h1 { font-size: clamp(26px, 7vw, 34px); }
.roomhead .sub { color: var(--cream-dim); font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; }

.code {
  font-family: var(--serif);
  font-size: clamp(40px, 13vw, 60px);
  letter-spacing: 0.16em;
  margin: 4px 0 0;
}

/* ---------- panels ---------- */

.card {
  position: relative;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin: 0 0 22px;
  box-shadow: inset 0 1px 0 var(--glass-edge), var(--glass-lift);
}
.card > h2 {
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-family: var(--sans);
  color: var(--cream-dim);
  margin: 0 0 16px;
}
.card--quiet { background: transparent; box-shadow: none; border-color: var(--line); }

.muted { color: var(--cream-dim); }
.small { font-size: 13px; }
.empty {
  color: var(--cream-faint);
  font-family: var(--serif);
  font-style: italic;
  padding: 6px 0;
}
.stack > * + * { margin-top: 14px; }

/* ---------- form ---------- */

label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cream-dim);
  margin: 0 0 6px;
}
label .hint { text-transform: none; letter-spacing: 0; font-style: italic; font-family: var(--serif); }

/* Inputs read as wells cut into the glass: darker, with the light on the top edge. */
input[type="text"] {
  width: 100%;
  padding: 12px 13px;
  background: var(--glass-well);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  color: var(--cream);
  font-family: var(--serif);
  font-size: 17px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.32);
}
input[type="text"]::placeholder { color: var(--cream-faint); font-style: italic; }
input[type="text"]:focus { outline: none; border-color: var(--line-strong); background: rgba(0, 0, 0, 0.36); }
input[type="text"]:disabled { opacity: 0.65; cursor: not-allowed; }

.row { display: flex; gap: 10px; align-items: stretch; }
.row > input { flex: 1 1 auto; min-width: 0; }

button {
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0.08em;
  padding: 12px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line-strong);
  background: rgba(242, 236, 217, 0.05);
  color: var(--cream);
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10);
  transition: background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}
button:hover:not(:disabled) { background: rgba(242, 236, 217, 0.11); border-color: var(--cream); }
button:disabled { opacity: 0.38; cursor: not-allowed; }

/* The one solid surface: the primary action stays fully opaque for contrast. */
.btn-primary {
  background: var(--cream);
  color: var(--ink);
  border-color: var(--cream);
  font-weight: 600;
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.7);
}
.btn-primary:hover:not(:disabled) { background: #fff9e9; }

.btn-big { width: 100%; padding: 16px; font-size: 15px; letter-spacing: 0.16em; text-transform: uppercase; }

.btn-small { padding: 7px 11px; font-size: 12px; }

.btn-veto { border-color: rgba(168, 67, 50, 0.7); color: #e08a78; }
.btn-veto:hover:not(:disabled) { background: var(--brick-soft); border-color: var(--brick); }
.btn-veto-yes { background: var(--brick); border-color: var(--brick); color: #fff2ec; }
.btn-veto-yes:hover:not(:disabled) { background: #bb4c39; }

.btn-x {
  border: none; background: none; box-shadow: none; color: var(--cream-faint);
  padding: 6px 8px; font-size: 18px; line-height: 1;
}
.btn-x:hover:not(:disabled) { color: var(--brick); background: none; }

.linkish {
  background: none; border: none; box-shadow: none; padding: 0;
  color: var(--cream-dim); font-size: 13px;
  text-decoration: underline; text-underline-offset: 3px; letter-spacing: 0;
}
.linkish:hover:not(:disabled) { background: none; color: var(--cream); }

/* ---------- status line ---------- */

.status { font-size: 13px; min-height: 20px; color: var(--cream-dim); margin-top: 10px; }
.status:empty { min-height: 0; margin-top: 0; }
.status.is-error { color: #e8a293; }
.status.is-ok { color: #9fc9a8; }

/* ---------- lists ---------- */

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.list li:first-child { border-top: none; }
.list .name { flex: 1 1 auto; min-width: 0; font-family: var(--serif); font-size: 18px; }
.list .meta { font-size: 12px; color: var(--cream-faint); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }

.dot {
  width: 8px; height: 8px; border-radius: 50%;
  border: 1px solid var(--line-strong);
  flex: 0 0 auto;
}
.dot.on { background: var(--cream); border-color: var(--cream); }

.claim-list button {
  width: 100%; text-align: left;
  font-family: var(--serif); font-size: 19px; letter-spacing: 0;
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
}
.claim-list button + button { margin-top: 8px; }
.claim-list .meta { font-family: var(--sans); }

/* ---------- films on the table ---------- */

.film { display: flex; align-items: baseline; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.film:first-child { border-top: none; }
.film .who { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cream-dim); flex: 0 0 100%; }
.film .title { font-family: var(--serif); font-size: 20px; flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.film.vetoed .title { text-decoration: line-through; text-decoration-color: var(--brick); text-decoration-thickness: 2px; color: var(--cream-dim); }

.stamp {
  font-size: 11px; font-weight: 700; letter-spacing: 0.22em;
  color: #e2705b;
  border: 1px solid var(--brick);
  background: var(--brick-soft);
  padding: 3px 8px; border-radius: 2px;
  transform: rotate(-3deg);
  display: inline-block;
  white-space: nowrap;
}

.confirm { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.confirm .q { font-size: 13px; color: var(--cream-dim); }

/* ---------- share link ---------- */

.share input { font-family: var(--sans); font-size: 14px; }

/* ---------- wheel ---------- */

.wheel-wrap { max-width: 340px; margin: 0 auto; }
.wheel-wrap canvas { width: 100%; display: block; }
.wheel-status { text-align: center; color: var(--cream-dim); font-size: 14px; margin-top: 14px; min-height: 21px; }

/* ---------- result banner ---------- */

.banner {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  background: var(--glass-strong);
  padding: 26px 22px;
  text-align: center;
  margin-top: 22px;
  box-shadow: inset 0 1px 0 var(--glass-edge), 0 24px 60px -22px rgba(0, 0, 0, 0.75);
}
.banner .k { font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--cream-dim); }
.banner .who { font-family: var(--serif); font-size: clamp(30px, 9vw, 42px); margin: 6px 0 4px; }
/* Deliberately NOT .film: that class is the "on the table" row (a flex
   container with a top rule), which would left-align this and add a stray line. */
.banner .result-film {
  font-family: var(--serif); font-style: italic;
  font-size: clamp(24px, 7vw, 32px);
  margin: 6px auto 0;
  max-width: 100%;
  text-align: center;
  overflow-wrap: anywhere;
  text-wrap: balance;
}
/* The verdict: a label, with the usual VETOED stamp landing beside it. */
.verdict {
  margin: 22px 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.banner--veto { border-color: rgba(168, 67, 50, 0.55); }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------- the reveal, staged as beats ---------- */

.beat { opacity: 0; }
.beat.shown { opacity: 1; }                       /* already-known result, shown calmly */
.beat.beat-in { animation: rise 0.55s ease-out both; }

/* One hairline separates each section of the card, so it reads as a single
   centred composition rather than a stack of differently-ruled blocks. */
.finale {
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* The stamp doesn't rise like the other beats, it comes down hard: oversized
   and turned, then thumps onto the card with a small overshoot. It settles at
   the same -3deg the stamps elsewhere sit at. */
.verdict.beat-in { animation: none; opacity: 1; }
.verdict.beat-in .stamp {
  animation: stampSlap 0.42s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}
@keyframes stampSlap {
  0%   { opacity: 0; transform: rotate(-14deg) scale(2.7); }
  55%  { opacity: 1; transform: rotate(-3deg) scale(0.93); }
  75%  { transform: rotate(-3deg) scale(1.07); }
  100% { opacity: 1; transform: rotate(-3deg) scale(1); }
}

/* The film title is the finale: it arrives, blooms, and settles. */
.film-arrive { animation: filmArrive 0.95s cubic-bezier(0.2, 0.9, 0.25, 1.12) both; }
@keyframes filmArrive {
  0%   { opacity: 0; transform: scale(0.86); text-shadow: none; }
  55%  { opacity: 1; transform: scale(1.045); text-shadow: 0 0 30px rgba(242, 236, 217, 0.5); }
  100% { opacity: 1; transform: scale(1); text-shadow: 0 0 16px rgba(242, 236, 217, 0.15); }
}

/* A row of marquee bulbs that light up under the title, once. */
.bulbs { display: flex; justify-content: center; gap: 11px; margin-top: 18px; }
.bulbs span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--cream); opacity: 0.18;
}
.beat-in .bulbs span { animation: bulbOn 0.5s ease-out both; }
.shown .bulbs span { opacity: 0.72; }   /* reload after the fact: lit, without the show */
.beat-in .bulbs span:nth-child(1) { animation-delay: 0.55s; }
.beat-in .bulbs span:nth-child(2) { animation-delay: 0.67s; }
.beat-in .bulbs span:nth-child(3) { animation-delay: 0.79s; }
.beat-in .bulbs span:nth-child(4) { animation-delay: 0.91s; }
.beat-in .bulbs span:nth-child(5) { animation-delay: 1.03s; }
@keyframes bulbOn {
  0%   { opacity: 0.18; box-shadow: none; }
  60%  { opacity: 1; box-shadow: 0 0 12px 2px rgba(217, 180, 106, 0.7); }
  100% { opacity: 0.72; box-shadow: 0 0 7px 1px rgba(217, 180, 106, 0.32); }
}

/* ---------- glass ----------
   Everything above is the solid fallback. Where backdrop-filter is supported,
   the same surfaces become translucent and blur what's behind them. Only a
   handful of large panels are blurred, never the small controls and never
   the wheel canvas, so the spin and the confetti stay smooth. */

@supports ((-webkit-backdrop-filter: blur(2px)) or (backdrop-filter: blur(2px))) {
  .card {
    background: rgba(236, 244, 238, 0.055);
    -webkit-backdrop-filter: blur(14px) saturate(1.3);
    backdrop-filter: blur(14px) saturate(1.3);
  }
  .card--quiet {
    background: rgba(236, 244, 238, 0.03);
    -webkit-backdrop-filter: blur(8px) saturate(1.15);
    backdrop-filter: blur(8px) saturate(1.15);
  }
  .banner {
    background: rgba(236, 244, 238, 0.075);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    backdrop-filter: blur(20px) saturate(1.4);
  }
  input[type="text"] {
    background: rgba(0, 0, 0, 0.22);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
  }
  input[type="text"]:focus { background: rgba(0, 0, 0, 0.3); }
  /* Full-width secondary buttons only. The small ones stay unblurred. */
  .btn-big,
  .claim-list button {
    -webkit-backdrop-filter: blur(8px) saturate(1.2);
    backdrop-filter: blur(8px) saturate(1.2);
  }
  .btn-primary { -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ---------- confetti overlay ---------- */

.confetti-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  pointer-events: none;   /* never eats a click */
  z-index: 90;
}

@media (prefers-reduced-motion: reduce) {
  .beat.beat-in { animation: none; opacity: 1; }
  .film-arrive { animation: none; }
  .beat-in .bulbs span { animation: none; opacity: 0.72; }
  /* Stamp still appears, it just doesn't slap. */
  .verdict.beat-in .stamp { animation: none; opacity: 1; }
}

/* ---------- how it works ---------- */

.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li {
  counter-increment: s;
  padding: 14px 0 14px 44px;
  position: relative;
  border-top: 1px solid var(--line);
  color: var(--cream-dim);
  font-size: 15px;
}
.steps li:first-child { border-top: none; }
.steps li::before {
  content: counter(s);
  position: absolute; left: 0; top: 13px;
  width: 26px; height: 26px; line-height: 25px; text-align: center;
  border: 1px solid var(--line-strong); border-radius: 50%;
  font-family: var(--serif); font-size: 13px; color: var(--cream);
}

.footnote { text-align: center; color: var(--cream-faint); font-size: 13px; margin-top: 30px; }

@media (min-width: 620px) {
  .wrap { padding-top: 48px; }
  .card { padding: 26px 28px; }
  .film .who { flex: 0 0 auto; min-width: 120px; }
}
