:root {
  --bg: #0d0f14;
  --panel: #161a22;
  --ink: #e8e6df;
  --muted: #8b94a3;
  --gold: #d8b56a;
  --rail: #2a2f3a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Georgia", "Times New Roman", serif;
}
.centered { display: flex; align-items: center; justify-content: center; padding: 1.5rem; }
h1 { font-size: 2rem; margin: 0 0 0.5rem; letter-spacing: 0.04em; }
.tagline { color: var(--muted); font-style: italic; }
.panel {
  background: var(--panel);
  border: 1px solid var(--rail);
  border-radius: 14px;
  padding: 2rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
}
.actions { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1.5rem; }
.btn {
  display: inline-block;
  background: var(--gold);
  color: #1a1408;
  text-decoration: none;
  border: none;
  border-radius: 10px;
  padding: 0.9rem 1.2rem;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
}
.btn-secondary { background: transparent; color: var(--gold); border: 1px solid var(--gold); }
.host { padding: 2.5rem; text-align: center; }
.code-row { display: flex; gap: 2rem; align-items: center; justify-content: center; flex-wrap: wrap; margin: 1.5rem 0; }
.code-box { display: flex; flex-direction: column; gap: 0.5rem; }
.label { color: var(--muted); text-transform: uppercase; letter-spacing: 0.2em; font-size: 0.8rem; }
.code { font-size: 5rem; letter-spacing: 0.5rem; color: var(--gold); font-family: monospace; }
.qr { width: 180px; height: 180px; background: #fff; border-radius: 10px; }
.players { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; max-width: 480px; margin: 1rem auto; }
.players li { background: var(--panel); border: 1px solid var(--rail); border-radius: 8px; padding: 0.6rem 1rem; font-size: 1.2rem; }
form { display: flex; flex-direction: column; gap: 1rem; text-align: left; }
label { display: flex; flex-direction: column; gap: 0.4rem; color: var(--muted); font-size: 0.9rem; }
input {
  padding: 0.8rem; font-size: 1.2rem; border-radius: 8px;
  border: 1px solid var(--rail); background: #0f1219; color: var(--ink);
}
#code { text-transform: uppercase; letter-spacing: 0.3em; text-align: center; }
.error { color: #e07a5f; min-height: 1.2em; margin: 0; }
.options { list-style: none; padding: 0; display: grid; gap: 0.6rem; max-width: 640px; margin: 1rem auto; }
.options li { background: var(--panel); border: 1px solid var(--rail); border-radius: 8px; padding: 0.8rem 1rem; font-size: 1.3rem; text-align: left; }
.answers { display: grid; gap: 0.75rem; margin-top: 1rem; }
.btn.answer { width: 100%; background: var(--panel); color: var(--ink); border: 1px solid var(--gold); }
.btn.answer.picked { background: var(--gold); color: #1a1408; }
.btn.answer:disabled { opacity: 0.6; cursor: default; }
#startBtn, #nextBtn { margin-top: 1.5rem; }

.roster { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; margin: 1rem auto; max-width: 900px; }
.roster-card { display: flex; flex-direction: column; align-items: center; width: 120px; transition: transform 0.6s ease, opacity 0.4s ease; }
.roster-card .avatar { width: 100px; height: 100px; object-fit: contain; }
.roster-card .rname { font-size: 1.1rem; }
.roster-card .rchar { color: var(--muted); font-size: 0.85rem; }
.roster-card.uncoupled { opacity: 0.35; filter: grayscale(1); }
.lobby-stage-wrap {
  position: relative;
  min-height: 280px;
  margin: 1rem auto 1.5rem;
  max-width: 960px;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--rail);
  background: linear-gradient(180deg, rgba(22, 26, 34, 0.95) 0%, rgba(13, 15, 20, 0.98) 100%);
  transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.lobby-stage-wrap.stage-zoomed { transform: scale(1.04); }
.roster-stage { margin: 1.5rem auto; padding: 0.5rem; }
.board-spotlight {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.board-spotlight .spotlight-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(8, 10, 14, 0.2) 0%, rgba(8, 10, 14, 0.92) 72%);
  opacity: 0;
  transition: opacity 0.5s ease;
}
.board-spotlight.active .spotlight-vignette { opacity: 1; }
.spotlight-frame {
  position: relative;
  z-index: 1;
  text-align: center;
  transform: scale(0.55);
  opacity: 0;
  transition: transform 0.85s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.45s ease;
}
.board-spotlight.active .spotlight-frame {
  transform: scale(1);
  opacity: 1;
}
.spotlight-img {
  width: min(42vw, 320px);
  height: min(42vw, 320px);
  object-fit: contain;
  filter: drop-shadow(0 12px 40px rgba(0, 0, 0, 0.55));
}
.spotlight-name {
  margin: 0.75rem 0 0.15rem;
  font-size: 1.6rem;
  color: var(--gold);
  letter-spacing: 0.04em;
}
.spotlight-char {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
  font-style: italic;
}
.spotlight-tag {
  margin: 0.5rem 0 0;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(216, 181, 106, 0.75);
}
.cars { display: flex; gap: 1.5rem; justify-content: center; margin: 1.5rem 0; }
.car { width: 140px; height: 90px; border: 2px solid var(--gold); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; background: var(--panel); }
#startDeathBtn, #smoothNextBtn, #resolveBtn { margin-top: 1.5rem; }
.avatar-lg { width: 160px; height: 160px; object-fit: contain; margin: 0 auto 0.5rem; display: block; }

/* --- Landing (index.html) --- */
body.landing {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Inter", system-ui, sans-serif;
  overflow-x: hidden;
}
.landing-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(90deg, rgba(6, 8, 12, 0.92) 0%, rgba(6, 8, 12, 0.55) 42%, rgba(6, 8, 12, 0.15) 68%, transparent 100%),
    url("/images/last_train_bg.png") center / cover no-repeat;
}
.landing-panel {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 28rem;
  padding: clamp(2rem, 8vw, 4rem) clamp(1.5rem, 6vw, 4rem);
}
.landing-brand { margin-bottom: 2.25rem; }
.landing-eyebrow {
  margin: 0;
  font-family: "Cinzel", "Georgia", serif;
  font-size: 0.95rem;
  letter-spacing: 0.35em;
  color: #f0ebe0;
  text-transform: uppercase;
}
.landing-title {
  margin: 0.15rem 0 0;
  font-family: "Cinzel", "Georgia", serif;
  font-size: clamp(3.25rem, 10vw, 4.5rem);
  font-weight: 700;
  line-height: 0.95;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-transform: uppercase;
}
.landing-rule {
  width: 3.5rem;
  height: 2px;
  margin: 1rem 0 1.1rem;
  background: linear-gradient(90deg, var(--gold), transparent);
}
.landing-tagline {
  margin: 0;
  font-family: "Cinzel", "Georgia", serif;
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  color: #d8d2c6;
  text-transform: uppercase;
}
.landing-label {
  display: block;
  margin-bottom: 0.65rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--gold);
  text-transform: uppercase;
}
.landing-join { margin: 0; }
.code-field {
  position: relative;
  margin-bottom: 1rem;
}
.code-field input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: text;
  border: none;
  background: transparent;
}
.code-slots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(216, 181, 106, 0.55);
  border-radius: 4px;
  background: rgba(8, 10, 14, 0.72);
}
.code-slot {
  font-family: "Cinzel", "Georgia", serif;
  font-size: 1.35rem;
  letter-spacing: 0.12em;
  text-align: center;
  color: rgba(216, 181, 106, 0.45);
}
.code-slot.filled { color: #f0ebe0; }
body.landing .btn {
  display: block;
  width: 100%;
  border-radius: 4px;
  padding: 0.95rem 1.2rem;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}
body.landing .btn-join {
  border: none;
  background: var(--gold);
  color: #1a1408;
}
body.landing .btn-join:hover { filter: brightness(1.05); }
body.landing .btn-create {
  background: rgba(8, 10, 14, 0.55);
  color: var(--gold);
  border: 1px solid rgba(216, 181, 106, 0.65);
}
body.landing .btn-create:hover {
  background: rgba(216, 181, 106, 0.08);
}
.landing-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.35rem 0;
  color: rgba(216, 181, 106, 0.55);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: lowercase;
}
.landing-divider::before,
.landing-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(216, 181, 106, 0.35);
}
.landing-error {
  min-height: 1.2rem;
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: #e07a5f;
}
.landing-footer {
  margin: auto 0 0;
  padding-top: 3rem;
  font-size: 0.72rem;
  font-style: italic;
  letter-spacing: 0.04em;
  color: rgba(139, 148, 163, 0.85);
}
@media (max-width: 520px) {
  .landing-panel { justify-content: flex-start; padding-top: 3rem; }
  .landing-bg {
    background:
      linear-gradient(180deg, rgba(6, 8, 12, 0.94) 0%, rgba(6, 8, 12, 0.72) 55%, rgba(6, 8, 12, 0.35) 100%),
      url("/images/last_train_bg.png") 70% center / cover no-repeat;
  }
}
