/* Dave's Game — a small cinema: velvet curtain at the top, marquee bulbs
   under the title, gold on a dark auditorium, and a ticket stub for the
   result. Green stays for confirmed facts, red for a "no". */

:root {
  --house: #141118;
  --house-deep: #0d0b10;
  --surface: #1d1922;
  --surface-alt: #262029;
  --line: #3a3340;
  --text: #f1e9dc;
  --muted: #9a8fa3;
  --gold: #e0b44c;
  --velvet: #8e2328;
  --velvet-light: #b8343a;
  --velvet-glow: #e0666b;
  --moss: #7fb069;
  --radius: 3px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 44px 80px;
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--house);
  /* The house lights, dimmed. */
  background-image: radial-gradient(ellipse at 50% 0%, #241d2b 0%, var(--house) 55%, var(--house-deep) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* ---------- the projection booth ---------- */

/* Film running down both margins: sprocket holes on black stock. */
body::before,
body::after {
  content: "";
  position: fixed;
  top: 0;
  bottom: 0;
  width: 26px;
  z-index: 1;
  pointer-events: none;
  background-color: #000;
  background-image:
    linear-gradient(to bottom, rgba(224, 180, 76, 0.12), rgba(224, 180, 76, 0.12)),
    repeating-linear-gradient(
      to bottom,
      transparent 0 9px,
      rgba(236, 230, 220, 0.82) 9px 23px,
      transparent 23px 32px
    );
  background-size: 100% 100%, 12px 32px;
  background-position: center, center;
  background-repeat: no-repeat, repeat-y;
  /* Keep the holes clear of the stock's edges. */
  background-clip: border-box;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.9);
}

body::before { left: 0; }
body::after { right: 0; }

/* The beam from the booth, and the flicker in it. */
html::before,
html::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

html::before {
  background:
    radial-gradient(ellipse 60% 40% at 50% -8%, rgba(224, 180, 76, 0.16), transparent 70%),
    radial-gradient(ellipse at 50% 45%, transparent 45%, rgba(0, 0, 0, 0.55) 100%);
}

/* Dust and gate weave: a slow, barely-there flicker. */
html::after {
  background-image: repeating-radial-gradient(
    circle at 37% 29%,
    rgba(255, 255, 255, 0.045) 0 1px,
    transparent 1px 3px
  );
  opacity: 0.5;
  animation: flicker 4s steps(3, end) infinite;
}

@keyframes flicker {
  0%, 100% { opacity: 0.42; }
  35% { opacity: 0.62; }
  70% { opacity: 0.5; }
}

@media (prefers-reduced-motion: reduce) {
  html::after { animation: none; }
}

main {
  position: relative;
  z-index: 3;
  max-width: 560px;
  margin: 0 auto;
  padding-top: 44px;
}

/* ---------- header: the clapperboard ---------- */

header {
  position: relative;
  margin-bottom: 36px;
  padding: 0 18px 22px;
  text-align: center;
  background: linear-gradient(to bottom, #211c27, #171320);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* The clapstick, hinged open at the left. */
.clapstick {
  height: 30px;
  margin: 0 -18px 20px;
  background: repeating-linear-gradient(
    114deg,
    #f3efe6 0 22px,
    #15121a 22px 44px
  );
  border-bottom: 2px solid var(--gold);
  transform-origin: 0 100%;
  transform: rotate(-1.6deg);
}

h1 {
  margin: 20px 0 0;
  font-size: 2.3rem;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: 0.04em;
  color: var(--gold);
  text-transform: uppercase;
  text-shadow: 0 0 18px rgba(224, 180, 76, 0.35);
}

/* Marquee bulbs. */
h1::after {
  content: "";
  display: block;
  width: 190px;
  height: 7px;
  margin: 14px auto 0;
  background-image: radial-gradient(circle, var(--gold) 0 2.2px, transparent 2.6px);
  background-size: 16px 7px;
  opacity: 0.85;
}

.tagline {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1rem;
  font-style: italic;
}

.meta {
  margin: 14px 0 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--velvet-glow);
}

/* ---------- input ---------- */

form {
  display: flex;
  gap: 8px;
}

input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 13px 14px;
  font-family: var(--serif);
  font-size: 1.02rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(224, 180, 76, 0.18);
}

input[type="text"]::placeholder {
  color: #6f6577;
  font-style: italic;
}

input[type="text"]:disabled {
  background: transparent;
  border-style: dashed;
  color: var(--muted);
  cursor: not-allowed;
}

button {
  padding: 13px 20px;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--house-deep);
  background: var(--gold);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  cursor: pointer;
}

/* background-color, not the shorthand: the shorthand would reset the sizing of
   any button carrying a background image, such as the trailer thumbnail. */
button:hover:not(:disabled) { background-color: #f0c868; border-color: #f0c868; }
button:disabled { opacity: 0.3; cursor: not-allowed; }

button.ghost {
  color: var(--muted);
  background: none;
  border-color: var(--line);
}

button.ghost:hover:not(:disabled) {
  color: var(--text);
  background: var(--velvet);
  border-color: var(--velvet-light);
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

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

.status {
  min-height: 22px;
  margin-top: 16px;
  font-size: 0.97rem;
  font-style: italic;
  color: var(--muted);
}

.status.win { color: var(--moss); font-style: normal; font-weight: 600; }
.status.lose { color: var(--velvet-glow); font-style: normal; font-weight: 600; }

.thinking {
  display: none;
  align-items: center;
  gap: 9px;
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.thinking.show { display: flex; }

.spinner {
  width: 12px;
  height: 12px;
  border: 2px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ---------- sections ---------- */

section { margin-top: 36px; }

h2 {
  margin: 0 0 14px;
  padding-bottom: 7px;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  border-bottom: 1px solid var(--line);
}

ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ---------- transcript ---------- */

#log li {
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

#log li.q,
#log li.guess {
  padding-bottom: 0;
  border-bottom: none;
  color: var(--muted);
}

#log li.q::before,
#log li.guess::before {
  content: "— ";
  color: var(--line);
}

#log li.yes { color: var(--moss); font-weight: 600; }
#log li.no { color: var(--velvet-glow); font-weight: 600; }

#log li.note {
  font-size: 0.86rem;
  font-style: italic;
  color: var(--muted);
}

/* ---------- facts & hints ---------- */

#facts li,
#hints li {
  padding: 10px 14px;
  margin-bottom: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--moss);
  border-radius: 0 var(--radius) var(--radius) 0;
}

#hints li {
  border-left-color: var(--gold);
  font-style: italic;
}

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

/* The ticket stub, torn down one side. */
#result {
  display: none;
  position: relative;
  margin-top: 36px;
  padding: 30px 24px;
  text-align: center;
  background: var(--surface-alt);
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  box-shadow: 0 0 36px rgba(224, 180, 76, 0.12);
}

#result::before,
#result::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  background: var(--house);
  border: 1px solid var(--gold);
  border-radius: 50%;
}

#result::before { left: -10px; }
#result::after { right: -10px; }

#result-title {
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.15;
  margin-bottom: 8px;
  color: var(--gold);
}

#result-score {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

#result-grid {
  margin: 20px 0;
  font-size: 1.3rem;
  letter-spacing: 5px;
}

#countdown {
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- trailer ---------- */

/* Up on the screen: 16:9, gold-framed, click to roll it. */
#trailer {
  position: relative;
  margin: 0 0 20px;
  aspect-ratio: 16 / 9;
  background: var(--house-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

#trailer iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.trailer-poster {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  padding: 0;
  background-color: var(--house-deep);
  background-position: center;
  background-size: cover;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  /* Dim the thumbnail so the play control stays legible. */
  box-shadow: inset 0 0 0 100vmax rgba(13, 11, 16, 0.55);
}

.trailer-poster:hover:not(:disabled) {
  background-color: var(--house-deep);
  background-position: center;
  background-size: cover;
  box-shadow: inset 0 0 0 100vmax rgba(13, 11, 16, 0.35);
}

.trailer-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  padding-left: 4px;
  font-size: 1.2rem;
  color: var(--house-deep);
  background: var(--gold);
  border-radius: 50%;
}

.trailer-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text);
}

/* ---------- the reveal ---------- */

#film-info {
  display: flex;
  gap: 16px;
  margin: 0 0 20px;
  padding-top: 20px;
  text-align: left;
  border-top: 1px solid var(--line);
}

#film-info .poster {
  flex: 0 0 96px;
  width: 96px;
  height: auto;
  align-self: flex-start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
}

.film-body {
  flex: 1;
  min-width: 0;
}

.film-credits {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.scores {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}

/* Score chips: label above, figure below, like a review pull-quote. */
.score {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 10px;
  background: var(--house-deep);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
}

a.score:hover { border-color: var(--gold); }

.score-label {
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.score-value {
  font-family: var(--mono);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--gold);
}

.synopsis {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.55;
  color: var(--text);
}

@media (max-width: 480px) {
  #film-info { flex-direction: column; align-items: center; }
  #film-info .poster { flex-basis: auto; width: 120px; }
  .film-body { text-align: center; }
  .scores { justify-content: center; }
  .synopsis { text-align: left; }
}

/* ---------- footer ---------- */

footer {
  position: relative;
  z-index: 3;
  max-width: 560px;
  margin: 60px auto 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.9;
  color: var(--muted);
}

footer a {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid rgba(224, 180, 76, 0.4);
}

footer a:hover { border-bottom-color: var(--gold); }

.hidden { display: none !important; }

@media (max-width: 480px) {
  body {
    padding: 0 34px 60px;
  }
  /* Narrower stock so the film doesn't eat the screen. */
  body::before,
  body::after {
    width: 18px;
    background-size: 100% 100%, 9px 26px;
  }
  main { padding-top: 28px; }
  h1 { font-size: 1.7rem; }
}

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

/* Sits above everything, but must never swallow a click. */
.confetti {
  position: fixed;
  inset: 0;
  z-index: 100;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
