/* Layout: a cinema front at night. A bulb-lit letterboard marquee announces
   the leading movie and the date; under it the program of trailer cards,
   sorted by tickets; the box office (suggest a movie) closes the page.
   One deliberate dark theme: the room is dark when the trailer plays. */
:root {
  --ink: #16121b;        /* the dark house */
  --stage: #211a28;      /* cards and panels */
  --stage-2: #2c2334;    /* inputs, raised */
  --paper: #f4ecdc;      /* letterboard and ticket stock */
  --bulb: #ffc45c;       /* marquee bulbs: the one accent */
  --text: #efe7f2;
  --muted: #ab9fb6;
  --line: rgba(244, 236, 220, 0.13);
  --danger: #ff9b9b;

  --font-display: "Big Shoulders Display", "Oswald", "Arial Narrow", Impact, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "DM Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --radius: 10px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: var(--ink); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 90% 50% at 50% -8%, rgba(150, 48, 78, 0.38), transparent 70%),
    var(--ink);
  color: var(--text);
  font: 400 16px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
img { max-width: 100%; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
button, input { font: inherit; color: inherit; }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

:focus-visible { outline: 2px solid var(--bulb); outline-offset: 2px; }

.page {
  max-width: 1180px;
  margin: 0 auto;
  padding-block: 24px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid;
  gap: 36px;
}

/* ---------------------------------------------------------------- marquee */

.top { display: grid; gap: 14px; }

.marquee {
  padding: 16px;
  border-radius: 14px;
  background:
    radial-gradient(circle, var(--bulb) 0 2.4px, rgba(255, 196, 92, 0.28) 3.4px, transparent 5px) 0 0 / 16px 16px,
    #3a1d2a;
  box-shadow: 0 0 60px rgba(255, 196, 92, 0.13), inset 0 0 0 1px rgba(0, 0, 0, 0.4);
  animation: chase 1.4s steps(2) infinite;
}
@keyframes chase { to { background-position: 16px 0, 0 0; } }

.board {
  background:
    repeating-linear-gradient(to bottom, transparent 0 30px, rgba(22, 18, 27, 0.1) 30px 32px),
    var(--paper);
  color: #141016;
  border-radius: 4px;
  padding: 18px clamp(12px, 3vw, 28px) 20px;
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.18);
}
.board-line {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.18em 0.45em;
  font-family: var(--font-display);
  font-weight: 900;
  text-transform: uppercase;
  line-height: 1;
}
.board-line.small { font-size: clamp(0.95rem, 2.4vw, 1.2rem); letter-spacing: 0.14em; color: #4a3d4f; }
.board-line.big { font-size: clamp(2rem, 7vw, 4.2rem); }
.word { display: inline-flex; gap: 0.05em; }
.tile {
  display: inline-block;
  min-width: 0.5em;
  padding: 0.04em 0.05em 0;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 2px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.16);
}
.board-line.small .tile { background: none; box-shadow: none; padding: 0; min-width: 0; }

.night {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px 18px;
  color: var(--muted);
  font-size: 0.95rem;
}
.night strong { color: var(--text); font-weight: 500; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, transform 0.1s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: 0.55; }
.btn-bulb { background: var(--bulb); color: var(--ink); }
.btn-bulb:hover:not(:disabled) { background: #ffd384; }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ink:hover:not(:disabled) { background: #2e2436; }
.btn-quiet { background: var(--stage-2); color: var(--text); border: 1px solid var(--line); }
.btn-quiet:hover:not(:disabled) { background: #382d42; }

.link-btn {
  background: none;
  border: 0;
  padding: 4px 2px;
  color: var(--muted);
  font-size: 0.875rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn:hover { color: var(--text); }
.link-btn.danger { color: var(--danger); }

/* A ticket stub: notched on both short sides. */
.ticket-btn {
  --notch: radial-gradient(circle at 0 50%, transparent 7px, #000 7.5px) left / 51% 100% no-repeat,
           radial-gradient(circle at 100% 50%, transparent 7px, #000 7.5px) right / 51% 100% no-repeat;
  -webkit-mask: var(--notch);
  mask: var(--notch);
  min-height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 4px;
  background: var(--bulb);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.ticket-btn:hover:not(:disabled) { background: #ffd384; }
.ticket-btn:focus-visible { outline: none; box-shadow: inset 0 0 0 3px var(--ink); text-decoration: underline; }
.ticket-btn.given { background: var(--paper); }
.ticket-btn.given:hover { background: #fff7e8; }
.ticket-btn:disabled { background: var(--stage-2); color: var(--muted); cursor: not-allowed; }

/* ---------------------------------------------------------------- me */

.me {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 14px 18px;
  background: var(--stage);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.me-name { font-weight: 700; }
.chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 196, 92, 0.16);
  color: var(--bulb);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: 2px;
  margin-left: 6px;
}
.stubs { display: flex; gap: 6px; }
.stub {
  width: 30px;
  height: 18px;
  border-radius: 2px;
  background: var(--bulb);
  -webkit-mask:
    radial-gradient(circle at 0 50%, transparent 4px, #000 4.5px) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% 50%, transparent 4px, #000 4.5px) right / 51% 100% no-repeat;
  mask:
    radial-gradient(circle at 0 50%, transparent 4px, #000 4.5px) left / 51% 100% no-repeat,
    radial-gradient(circle at 100% 50%, transparent 4px, #000 4.5px) right / 51% 100% no-repeat;
}
.stub.spent { background: rgba(244, 236, 220, 0.16); }
.me-count { color: var(--muted); }
.me-count strong { color: var(--text); font-family: var(--font-mono); font-weight: 500; }

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

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 16px;
}
.section-head h2 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.9rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.hint { margin: 0; color: var(--muted); font-size: 0.9rem; }

/* ---------------------------------------------------------------- program */

.program {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 20px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--stage);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.card.leading {
  border-color: rgba(255, 196, 92, 0.6);
  box-shadow: 0 0 0 1px rgba(255, 196, 92, 0.22), 0 14px 40px rgba(0, 0, 0, 0.4);
}

.thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  background: #000;
  cursor: pointer;
  overflow: hidden;
}
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease, opacity 0.2s; }
.thumb:hover img { transform: scale(1.03); opacity: 0.85; }
.play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: rgba(22, 18, 27, 0.72);
  border: 2px solid var(--paper);
  transition: background-color 0.15s, border-color 0.15s;
}
.play::after {
  content: "";
  position: absolute;
  left: 24px;
  top: 18px;
  border-left: 18px solid var(--paper);
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
}
.thumb:hover .play, .thumb:focus-visible .play { background: var(--bulb); border-color: var(--bulb); }
.thumb:hover .play::after, .thumb:focus-visible .play::after { border-left-color: var(--ink); }
.thumb:focus-visible { outline-offset: -3px; }

.poster {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 16px;
  text-align: center;
  cursor: default;
  background: linear-gradient(150deg, hsl(var(--hue, 330) 42% 30%), hsl(calc(var(--hue, 330) + 40) 48% 14%));
}
.poster-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.8rem;
  line-height: 1;
  text-transform: uppercase;
  color: var(--paper);
}
.poster .link-btn { color: var(--paper); }

.flag {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 10px;
  border-radius: 3px;
  background: var(--bulb);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.card-body { display: grid; gap: 6px; padding: 16px 18px 0; }
.card-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.55rem;
  line-height: 1.05;
  letter-spacing: 0.01em;
}
.year { font-family: var(--font-mono); font-size: 0.85rem; font-weight: 400; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.by { margin: 0; color: var(--muted); font-size: 0.875rem; }
.note { margin: 2px 0 0; font-size: 0.95rem; overflow-wrap: anywhere; }
.note::before { content: "\201C"; }
.note::after { content: "\201D"; }

.card-foot {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  margin-top: auto;
  padding: 16px 18px;
}
.count { display: grid; justify-items: center; line-height: 1; }
.count-num { font-family: var(--font-mono); font-weight: 500; font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.count-label { color: var(--muted); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; margin-top: 4px; }
.voters { margin: 0; color: var(--muted); font-size: 0.875rem; line-height: 1.35; overflow-wrap: anywhere; }

.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  padding: 10px 18px 12px;
  border-top: 1px solid var(--line);
}

.inline-edit { display: grid; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }
.inline-row { display: flex; flex-wrap: wrap; gap: 8px; }
.inline-row input { flex: 1 1 200px; }

.empty {
  grid-column: 1 / -1;
  padding: 40px 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  text-align: center;
  color: var(--muted);
}
.empty strong { display: block; color: var(--text); font-size: 1.1rem; margin-bottom: 4px; }

/* ---------------------------------------------------------------- forms */

label { display: block; font-size: 0.85rem; font-weight: 500; margin-bottom: 6px; }
.optional { color: var(--muted); font-weight: 400; }
input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  background: var(--stage-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
input::placeholder { color: rgba(171, 159, 182, 0.65); }
input:focus { border-color: var(--bulb); outline: none; box-shadow: 0 0 0 3px rgba(255, 196, 92, 0.2); }

/* Sign in with Discord, and Discord pictures */
.server-icon { width: 56px; height: 56px; border-radius: 16px; margin-bottom: 14px; box-shadow: 0 4px 14px rgba(22, 18, 27, 0.25); }
.btn-discord { background: #5865f2; color: #fff; }
.btn-discord:hover { background: #4752c4; }
.admit .form-error { margin-top: 10px; }
.fine { margin: 2px 0 0; color: #6b5a70; font-size: 0.8rem; }
.avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; background: var(--stage-2); flex: none; }
.me-avatar { width: 30px; height: 30px; }
.me-who { display: inline-flex; align-items: center; gap: 10px; }
.faces { display: inline-flex; margin-right: 6px; vertical-align: middle; }
.faces .avatar { border: 2px solid var(--stage); margin-left: -6px; }
.faces .avatar:first-child { margin-left: 0; }

.box-office, .host {
  padding: 22px;
  background: var(--stage);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.add-form {
  display: grid;
  grid-template-columns: 2fr 0.6fr 1.6fr;
  gap: 14px 16px;
  align-items: end;
}
.field-note { grid-column: 1 / 3; }
.add-form .btn { grid-column: 3; }

.night-form { display: grid; grid-template-columns: 1fr 1.6fr auto; gap: 14px 16px; align-items: end; }

.form-error { min-height: 1.3em; margin: 0; color: #a1263a; font-size: 0.875rem; }

/* ---------------------------------------------------------------- watched */

.watched details { border-top: 1px solid var(--line); padding-top: 16px; }
.watched summary { cursor: pointer; color: var(--muted); font-weight: 500; }
.watched summary:hover { color: var(--text); }
.watched ul { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 2px; }
.watched li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.watched li .when { color: var(--muted); font-size: 0.85rem; margin-left: auto; }

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; color: var(--muted); font-size: 0.85rem; }
.foot p { margin: 0; }

/* ---------------------------------------------------------------- login */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding-block: 32px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.admit {
  display: grid;
  grid-template-columns: 64px 1fr;
  width: min(100%, 520px);
  background: var(--paper);
  color: var(--ink);
  border-radius: 10px;
  box-shadow: 0 0 80px rgba(255, 196, 92, 0.12), 0 24px 60px rgba(0, 0, 0, 0.5);
}
.admit-stub {
  display: grid;
  place-items: center;
  border-right: 2px dashed rgba(22, 18, 27, 0.3);
  background: var(--bulb);
  border-radius: 10px 0 0 10px;
}
.admit-stub span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.5rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.admit-body { padding: 28px clamp(18px, 5vw, 36px) 30px; display: grid; }
.eyebrow { margin: 0 0 4px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: #6b5a70; }
.admit h1 { font-family: var(--font-display); font-weight: 900; font-size: 2.6rem; line-height: 1; text-transform: uppercase; }
.lede { margin: 10px 0 18px; color: #4a3d4f; }
.admit input { background: #fffaf0; border-color: rgba(22, 18, 27, 0.25); color: var(--ink); margin-bottom: 14px; }
.admit input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(22, 18, 27, 0.15); }
.admit :focus-visible { outline-color: var(--ink); }
.admit .btn { margin-top: 6px; justify-self: start; }

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

dialog {
  width: min(96vw, 1100px);
  max-width: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #000;
  color: var(--text);
}
dialog::backdrop { background: rgba(8, 6, 10, 0.86); }
.trailer-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 12px 16px;
  background: var(--stage);
}
.trailer-head h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.4rem; margin-right: auto; }
.trailer-head a { color: var(--muted); font-size: 0.875rem; }
.close {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--stage-2);
  cursor: pointer;
}
.trailer-frame { aspect-ratio: 16 / 9; width: 100%; }
.trailer-frame iframe { display: block; width: 100%; height: 100%; border: 0; }

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px);
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #ffd6d6; }

.noscript { padding: 24px; text-align: center; }

/* ---------------------------------------------------------------- narrow */

@media (max-width: 760px) {
  .add-form, .night-form { grid-template-columns: 1fr 1fr; }
  .field-title, .field-trailer, .field-note, .field-stream { grid-column: 1 / -1; }
  .add-form .btn, .night-form .btn { grid-column: 1 / -1; }
  .card-foot { grid-template-columns: auto 1fr; }
  .card-foot .ticket-btn { grid-column: 1 / -1; width: 100%; }
}

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