/* ═══════════════════════════════════════════════════════════════════════════
   ULTIMATE WEREWOLF — art direction
   Dark, candle-lit, high-contrast. Gold for the village, blood for the pack.
   Mobile-first: every size below is tuned for a phone in portrait first.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* surfaces */
  --bg: #06070d;
  --panel: rgba(19, 22, 35, 0.72);
  --panel-solid: #12151f;
  --panel-hi: rgba(255, 255, 255, 0.045);

  /* hairlines */
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.13);
  --gold-line: rgba(214, 172, 96, 0.34);

  /* ink */
  --text: #efedf5;
  --muted: #949ab2;
  --dim: #6d7288;

  /* accents */
  --gold: #d6ac60;
  --gold-hi: #f2d9a0;
  --gold-soft: rgba(214, 172, 96, 0.13);
  --blood: #c33d46;
  --blood-hi: #f0a1a6;
  --blood-soft: rgba(195, 61, 70, 0.14);
  --moon: #cfd7ff;
  --good: #56b98a;
  --good-soft: rgba(86, 185, 138, 0.13);

  --r: 18px;
  --r-sm: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  --display: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Noto Serif', Georgia,
    'Times New Roman', serif;
  --ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;

  --shadow-lift: 0 18px 44px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

/**
 * The UA rule for [hidden] is `display: none` at low specificity, so any class that sets
 * `display` silently defeats it and the element stays on screen. Everything here is
 * shown/hidden via the `hidden` property, so make it authoritative.
 */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--ui);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

.display {
  font-family: var(--display);
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ── atmosphere layers ────────────────────────────────────────────────── */
#atmos {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
  pointer-events: none;
}

/* Film grain. A tiny SVG turbulence tile, scaled — costs nothing, and it is the
   difference between "web page" and "photographed scene". */
.grain {
  position: fixed;
  inset: -50%;
  z-index: 1;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainshift 0.9s steps(3) infinite;
}
@keyframes grainshift {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-2%, 1.5%); }
  66% { transform: translate(1.5%, -1%); }
  100% { transform: translate(0, 0); }
}

#app {
  position: relative;
  z-index: 2;
  height: 100%;
}

.screen {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: calc(var(--safe-t) + 10px) 14px calc(var(--safe-b) + 10px);
  max-width: 760px;
  margin: 0 auto;
}
.scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 18px;
}
.scroll--center {
  justify-content: center;
}

/* ── title screen ─────────────────────────────────────────────────────── */
.titlecard {
  text-align: center;
  padding: 6px 0 2px;
  animation: riseIn 0.9s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
.crest {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 0 auto;
}
.crest__svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 26px rgba(190, 200, 255, 0.28));
  animation: breathe 7s ease-in-out infinite;
}
.crest__wolf {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 54px;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.8));
  transform: translateY(4px);
}
@keyframes breathe {
  50% { transform: scale(1.035); opacity: 0.92; }
}

h1.display {
  margin: 10px 0 8px;
  font-size: clamp(30px, 9vw, 40px);
  font-weight: 600;
  letter-spacing: 0.012em;
  background: linear-gradient(180deg, #fffaf0 12%, var(--gold) 88%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 2px 30px rgba(214, 172, 96, 0.16);
}

/* Ornamental divider — a hairline that fades out from a centred diamond. */
.rule {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-line) 22%, var(--gold-line) 78%, transparent);
  margin: 12px auto;
  max-width: 260px;
  position: relative;
}
.rule--ornate::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7px;
  height: 7px;
  background: var(--gold);
  transform: translate(-50%, -50%) rotate(45deg);
  opacity: 0.75;
  box-shadow: 0 0 12px rgba(214, 172, 96, 0.5);
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
}
.footnote {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--dim);
  text-align: center;
}

/* ── cards ────────────────────────────────────────────────────────────── */
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(30, 34, 51, 0.78), rgba(15, 18, 28, 0.8));
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 17px;
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  animation: riseIn 0.5s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
/* A one-pixel highlight along the top edge reads as light falling on a raised surface. */
.card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  border-radius: var(--r) var(--r) 0 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16) 30%, rgba(255, 255, 255, 0.16) 70%, transparent);
  pointer-events: none;
}
.card--elevated {
  box-shadow: var(--shadow-lift);
  border-color: var(--line-2);
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.card h2 {
  margin: 0 0 11px;
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.badge {
  font-size: 9px;
  letter-spacing: 0.12em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--gold);
  border: 1px solid var(--gold-line);
}
.lede {
  margin: 0 0 4px;
  font-size: 14.5px;
  color: var(--muted);
  line-height: 1.55;
}

.card--details {
  padding: 0;
}
.card--details summary {
  padding: 15px 17px;
  cursor: pointer;
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 700;
  list-style: none;
  display: flex;
  justify-content: space-between;
}
.card--details summary::-webkit-details-marker { display: none; }
.card--details summary::after { content: '＋'; opacity: 0.6; }
.card--details[open] summary::after { content: '－'; }
.card--details > *:not(summary) { padding: 0 17px 17px; }

/* ── form controls ────────────────────────────────────────────────────── */
.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 7px;
}
input {
  width: 100%;
  padding: 14px;
  font-size: 17px;
  color: var(--text);
  background: rgba(6, 8, 14, 0.72);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  outline: none;
  font-family: inherit;
  transition: border-color 0.18s, box-shadow 0.18s;
}
input::placeholder { color: #565b70; }
input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft), 0 0 22px rgba(214, 172, 96, 0.12) inset;
}
.codeinput {
  font-family: var(--display);
  text-transform: uppercase;
  letter-spacing: 0.34em;
  font-size: 32px !important;
  text-align: center;
  font-weight: 600;
  padding-left: 0.34em !important;
  color: var(--gold-hi);
}

.btn {
  appearance: none;
  position: relative;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, #232941, #171b2a);
  color: var(--text);
  padding: 13px 17px;
  border-radius: var(--r-sm);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.09s ease, filter 0.18s ease, box-shadow 0.18s ease;
}
.btn::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.22), transparent);
}
.btn:active { transform: translateY(1px) scale(0.985); filter: brightness(1.1); }
.btn:disabled { opacity: 0.34; cursor: not-allowed; }
.btn--primary {
  background: linear-gradient(180deg, #e8c274, #a67c2b);
  border-color: #f0d191;
  color: #241a05;
  box-shadow: 0 8px 26px rgba(214, 172, 96, 0.22), 0 1px 0 rgba(255, 255, 255, 0.35) inset;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn--primary:disabled { box-shadow: none; }
.btn--ghost { background: rgba(255, 255, 255, 0.045); }
.btn--ghost.is-off {
  background: var(--blood-soft);
  border-color: rgba(195, 61, 70, 0.5);
  color: var(--blood-hi);
}
.btn--big { width: 100%; padding: 17px; font-size: 18px; }
.btn--sm { padding: 10px 15px; font-size: 14px; }
.btn--spaced { margin-top: 12px; }
.row { display: flex; gap: 10px; margin-top: 13px; }
.row .btn { flex: 1; }

.iconbtn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex: none;
  transition: transform 0.09s, opacity 0.2s;
}
.iconbtn:active { transform: scale(0.92); }
.iconbtn.is-off { opacity: 0.42; }

.tabs {
  display: flex;
  gap: 5px;
  background: rgba(6, 8, 14, 0.6);
  padding: 4px;
  border-radius: var(--r-sm);
  margin-bottom: 14px;
  border: 1px solid var(--line);
}
.tab {
  flex: 1;
  padding: 11px;
  border: 0;
  background: transparent;
  color: var(--dim);
  border-radius: 9px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.tab.is-active {
  background: linear-gradient(180deg, #2c3350, #232941);
  color: var(--text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.check {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  font-size: 13px;
  color: var(--dim);
}
.check input { width: 18px; height: 18px; flex: none; accent-color: var(--gold); }
.hint { font-size: 13px; color: var(--muted); margin: 10px 0 0; line-height: 1.5; }
.hint:empty { display: none; }
.hint.is-error { color: var(--blood-hi); }
.muted { color: var(--muted); }

/* ── top bars ─────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 15px;
  background: linear-gradient(180deg, rgba(30, 34, 51, 0.8), rgba(14, 17, 26, 0.82));
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  margin-bottom: 10px;
  flex: none;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.4);
}
.topbar__right { display: flex; align-items: center; gap: 9px; }
.topbar__label {
  display: block;
  font-size: 9.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 1px;
}
.topbar__code {
  font-size: 30px;
  letter-spacing: 0.26em;
  color: var(--gold-hi);
  line-height: 1.1;
  text-shadow: 0 0 26px rgba(214, 172, 96, 0.35);
}
.topbar__phase { font-size: 23px; line-height: 1.15; }
.pill {
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  color: var(--muted);
  flex: none;
}

/* Circular countdown */
.timer { position: relative; width: 46px; height: 46px; flex: none; }
.timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.timer__track { fill: none; stroke: rgba(255, 255, 255, 0.09); stroke-width: 3; }
.timer__fill {
  fill: none;
  stroke: var(--moon);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.3s linear, stroke 0.4s;
  filter: drop-shadow(0 0 5px rgba(190, 200, 255, 0.5));
}
.timer__num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 700;
  color: var(--moon);
}
.timer.is-urgent .timer__fill { stroke: var(--blood); }
.timer.is-urgent .timer__num { color: var(--blood-hi); }
.timer.is-urgent { animation: urgentPulse 1s ease-in-out infinite; }
@keyframes urgentPulse {
  50% { transform: scale(1.09); }
}

.statusline {
  font-size: 12.5px;
  text-align: center;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  flex: none;
}
.statusline.is-good { color: #a5dfc4; border-color: rgba(86, 185, 138, 0.3); background: var(--good-soft); }
.statusline.is-bad { color: var(--blood-hi); border-color: rgba(195, 61, 70, 0.4); background: var(--blood-soft); }

/* ── video grid ───────────────────────────────────────────────────────── */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid--few { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 560px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
  .grid--few { grid-template-columns: repeat(2, 1fr); }
}

.tile {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  overflow: hidden;
  background: #0a0d16;
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  transition: box-shadow 0.28s, border-color 0.28s, transform 0.28s;
  animation: riseIn 0.45s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
.tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #05060a;
  position: relative;
  z-index: 0;
}
/* inner vignette so faces sit in the frame rather than floating on a bright rectangle */
.tile::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.55);
  border-radius: inherit;
}
.tile.is-self { border-color: var(--gold-line); }

/* Active speaker: the clearest signal in any video UI. */
.tile.is-speaking {
  border-color: rgba(214, 172, 96, 0.85);
  box-shadow: 0 0 0 2px rgba(214, 172, 96, 0.5), 0 0 26px rgba(214, 172, 96, 0.35);
  transform: translateY(-2px);
}

.tile__name {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px 8px 6px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
.tile__badge {
  position: absolute;
  z-index: 3;
  top: 6px;
  left: 6px;
  font-size: 8.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  border: 1px solid var(--line-2);
  backdrop-filter: blur(4px);
  max-width: calc(100% - 12px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tile__mic {
  position: absolute;
  z-index: 3;
  top: 6px;
  right: 6px;
  font-size: 11px;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
}
.tile.is-away { opacity: 0.45; }
.tile.is-dead { filter: grayscale(1) brightness(0.42) contrast(1.1); }
.tile.is-dead .tile__badge { background: var(--blood); border-color: var(--blood); color: #fff; }
.tile.is-novideo::after {
  content: attr(data-initial);
  position: absolute;
  z-index: 1;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--display);
  font-size: 34px;
  font-weight: 600;
  color: #3a4059;
  background: radial-gradient(circle at 50% 42%, #171c2c, #0a0d16 70%);
}

/* ── narration ────────────────────────────────────────────────────────── */
.narration {
  position: relative;
  border-left: 2px solid var(--gold);
  background: linear-gradient(90deg, var(--gold-soft), transparent 85%);
  padding: 13px 15px;
  border-radius: 0 10px 10px 0;
  font-family: var(--display);
  font-size: 16.5px;
  line-height: 1.5;
  margin-bottom: 10px;
  flex: none;
  animation: narrIn 0.6s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
@keyframes narrIn {
  from { opacity: 0; transform: translateX(-10px); }
  to { opacity: 1; transform: none; }
}
.narration.tone-bad { border-color: var(--blood); background: linear-gradient(90deg, var(--blood-soft), transparent 85%); }
.narration.tone-good { border-color: var(--good); background: linear-gradient(90deg, var(--good-soft), transparent 85%); }

/* ── lobby setup ──────────────────────────────────────────────────────── */
.cfg {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.cfg:last-child { border-bottom: 0; }
.cfg__name { flex: 1; font-size: 15.5px; }
.cfg__count { font-weight: 700; color: var(--muted); padding-right: 44px; }
.stepper { display: flex; align-items: center; gap: 5px; }
.stepper button {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, #232941, #171b2a);
  color: var(--text);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}
.stepper button:active { transform: scale(0.94); }
.stepper button:disabled { opacity: 0.28; }
.stepper span {
  min-width: 26px;
  text-align: center;
  font-weight: 700;
  font-family: var(--display);
  font-size: 18px;
  color: var(--gold-hi);
  font-variant-numeric: tabular-nums;
}
.timers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.timers label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 10px;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.timers input { padding: 10px 4px !important; font-size: 15px !important; text-align: center; }
.timers .footnote { grid-column: 1 / -1; margin-top: -2px; }

.catalog { display: flex; flex-direction: column; gap: 11px; }
.catalog__role { display: flex; gap: 11px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.catalog__role b { color: var(--text); }
.catalog__role .em { font-size: 21px; line-height: 1.15; flex: none; }

/* ── role card ────────────────────────────────────────────────────────── */
.rolecard {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  border: 1px solid var(--gold-line);
  border-radius: var(--r);
  padding: 15px;
  background: linear-gradient(180deg, rgba(214, 172, 96, 0.09), rgba(15, 18, 28, 0.82));
  box-shadow: var(--shadow-lift);
  animation: riseIn 0.5s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
.rolecard.team-wolves {
  border-color: rgba(195, 61, 70, 0.5);
  background: linear-gradient(180deg, rgba(195, 61, 70, 0.14), rgba(15, 18, 28, 0.85));
}
.rolecard__em { font-size: 34px; line-height: 1.05; flex: none; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.6)); }
.rolecard h3 { margin: 0 0 4px; font-size: 19px; font-family: var(--display); font-weight: 600; }
.rolecard p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.rolecard__pack { margin-top: 7px !important; color: var(--blood-hi) !important; font-weight: 600; }

/* ── night ────────────────────────────────────────────────────────────── */
.night { text-align: center; padding: 30px 18px; }
.night__icon {
  font-size: 46px;
  margin-bottom: 10px;
  filter: drop-shadow(0 0 24px rgba(160, 175, 255, 0.35));
  animation: breathe 5s ease-in-out infinite;
}
.night h3 { margin: 0 0 8px; font-size: 23px; font-family: var(--display); font-weight: 600; }
.night p { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.6; }
.zzz {
  letter-spacing: 0.4em;
  color: var(--moon);
  opacity: 0.5;
  font-size: 21px;
  margin-top: 16px;
  animation: zfade 3.6s ease-in-out infinite;
}
@keyframes zfade {
  50% { opacity: 0.12; letter-spacing: 0.7em; }
}

/* ── targets / voting ─────────────────────────────────────────────────── */
.targets { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 13px; }
.target {
  position: relative;
  padding: 15px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(35, 41, 65, 0.8), rgba(16, 19, 30, 0.85));
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-align: center;
  overflow: hidden;
  transition: transform 0.09s, border-color 0.2s, box-shadow 0.2s;
}
.target:active { transform: scale(0.97); }
.target.is-picked {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(214, 172, 96, 0.22), rgba(214, 172, 96, 0.06));
  color: var(--gold-hi);
  box-shadow: 0 0 0 1px var(--gold) inset, 0 0 22px rgba(214, 172, 96, 0.25);
}
.target--wide { grid-column: 1 / -1; }

/* ── wolf chat ────────────────────────────────────────────────────────── */
.chat { margin-top: 12px; }
.chat__log {
  max-height: 172px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: rgba(6, 8, 14, 0.72);
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  font-size: 14px;
  margin-top: 10px;
}
.chat__line b { color: var(--blood-hi); }
.chat__row { display: flex; gap: 8px; margin-top: 9px; }
.chat__row input { flex: 1; font-size: 16px; padding: 11px; }

/* ── seer results ─────────────────────────────────────────────────────── */
.result {
  margin-top: 8px;
  padding: 13px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: rgba(6, 8, 14, 0.6);
  font-size: 14.5px;
  line-height: 1.5;
  font-family: var(--display);
}
.result.is-wolf { border-color: rgba(195, 61, 70, 0.6); background: var(--blood-soft); color: var(--blood-hi); }

/* ── tally ────────────────────────────────────────────────────────────── */
.tally { list-style: none; padding: 0; margin: 13px 0 0; display: flex; flex-direction: column; gap: 9px; }
.tally li { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.tally .who { min-width: 92px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tally .bar { flex: 1; height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.tally .bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold), #8a6620);
  box-shadow: 0 0 12px rgba(214, 172, 96, 0.4);
  animation: growBar 0.7s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
@keyframes growBar { from { width: 0 !important; } }
.tally li.is-out .bar-fill { background: linear-gradient(90deg, var(--blood), #7a1f26); box-shadow: 0 0 12px rgba(195, 61, 70, 0.45); }
.tally .num { min-width: 16px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.ballots { font-size: 12px; color: var(--dim); margin-top: 13px; line-height: 1.7; }

/* ── chronicle ────────────────────────────────────────────────────────── */
.log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 13.5px;
  color: var(--muted);
  max-height: 210px;
  overflow-y: auto;
  line-height: 1.5;
  font-family: var(--display);
}
.log li { padding-left: 11px; border-left: 2px solid var(--line-2); }
.log li.tone-bad { border-color: var(--blood); color: #e7b5b8; }
.log li.tone-good { border-color: var(--good); color: #a9dcc3; }

/* ── end screen ───────────────────────────────────────────────────────── */
.banner {
  text-align: center;
  padding: 28px 18px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(30, 34, 51, 0.8), rgba(14, 17, 26, 0.85));
  box-shadow: var(--shadow-lift);
}
.banner--wolves { border-color: rgba(195, 61, 70, 0.5); background: linear-gradient(180deg, rgba(195, 61, 70, 0.18), rgba(14, 17, 26, 0.88)); }
.banner--village { border-color: rgba(86, 185, 138, 0.42); background: linear-gradient(180deg, rgba(86, 185, 138, 0.15), rgba(14, 17, 26, 0.88)); }
.banner__mark { font-size: 54px; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, 0.7)); animation: breathe 5s ease-in-out infinite; }
.banner h2 {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 600;
  margin: 8px 0;
  color: var(--text);
  letter-spacing: 0.01em;
  text-transform: none;
  display: block;
}
.banner p { margin: 0; color: var(--muted); font-size: 14.5px; }

.endroles { display: flex; flex-direction: column; gap: 7px; }
.endrole {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 13px;
  border-radius: var(--r-sm);
  background: rgba(6, 8, 14, 0.5);
  border: 1px solid var(--line);
  font-size: 15px;
  animation: riseIn 0.5s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
.endrole.team-wolves { border-color: rgba(195, 61, 70, 0.45); background: var(--blood-soft); }
.endrole__em { font-size: 19px; }
.endrole__nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.endrole .rn { margin-left: auto; font-size: 12.5px; color: var(--muted); flex: none; }

/* ── action bar ───────────────────────────────────────────────────────── */
.actionbar { display: flex; gap: 9px; justify-content: center; padding-top: 10px; flex: none; }
.actionbar .btn { min-width: 132px; }

/* ═══ CINEMATIC TITLE CARDS ═══════════════════════════════════════════════ */
.titlecard-fx {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 30px;
  text-align: center;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, rgba(6, 7, 13, 0.86), rgba(3, 4, 8, 0.97));
  opacity: 0;
}
.titlecard-fx.is-in { animation: tcIn 0.7s cubic-bezier(0.2, 0.9, 0.25, 1) forwards; }
.titlecard-fx.is-out { animation: tcOut 0.6s ease forwards; }
@keyframes tcIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes tcOut { from { opacity: 1; } to { opacity: 0; } }

.tc__kicker {
  font-size: 11px;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 6px;
  animation: tcRise 0.8s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
.tc__title {
  font-family: var(--display);
  font-size: clamp(30px, 10vw, 46px);
  font-weight: 600;
  line-height: 1.12;
  color: #fff;
  letter-spacing: 0.012em;
  text-shadow: 0 4px 40px rgba(0, 0, 0, 0.9);
  animation: tcRise 0.9s 0.06s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
.tc__sub {
  margin-top: 10px;
  font-size: 14.5px;
  color: var(--muted);
  max-width: 30ch;
  line-height: 1.5;
  animation: tcRise 0.9s 0.14s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
.tc__rule {
  width: min(64vw, 300px);
  height: 1px;
  margin: 16px 0;
  background: linear-gradient(90deg, transparent, var(--gold-line), transparent);
  animation: tcWipe 0.9s 0.1s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
@keyframes tcRise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes tcWipe { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.titlecard-fx.tone-night .tc__title { color: var(--moon); }
.titlecard-fx.tone-night .tc__kicker { color: #9fb0ff; }
.titlecard-fx.tone-bad .tc__title { color: #ffd9db; }
.titlecard-fx.tone-bad .tc__kicker { color: var(--blood-hi); }
.titlecard-fx.tone-bad .tc__rule { background: linear-gradient(90deg, transparent, rgba(195, 61, 70, 0.6), transparent); }
.titlecard-fx.tone-blood .tc__title { color: #ffcfd2; }
.titlecard-fx.tone-blood .tc__kicker { color: var(--blood-hi); }
.titlecard-fx.tone-good .tc__title { color: #d7f3e4; }
.titlecard-fx.tone-good .tc__kicker { color: #7fd6ab; }

/* ═══ ROLE REVEAL CEREMONY ════════════════════════════════════════════════ */
.reveal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px;
  background: radial-gradient(circle at 50% 45%, rgba(10, 12, 22, 0.93), rgba(2, 3, 6, 0.985));
  animation: tcIn 0.5s ease both;
  perspective: 1400px;
}
.reveal__stage {
  width: min(78vw, 310px);
  transform-style: preserve-3d;
  animation: dealIn 0.85s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
.reveal__card {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4.4;
  transform-style: preserve-3d;
  transition: transform 1s cubic-bezier(0.3, 0.9, 0.25, 1);
}
.reveal__card.is-flipped { transform: rotateY(180deg); }
@keyframes dealIn {
  from { opacity: 0; transform: translateY(70px) rotate(-9deg) scale(0.86); }
  to { opacity: 1; transform: none; }
}
.reveal__face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 20px;
  border: 1px solid var(--gold-line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 26px 22px;
  text-align: center;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.75), 0 0 60px rgba(214, 172, 96, 0.12);
}
.reveal__back {
  background:
    repeating-linear-gradient(45deg, rgba(214, 172, 96, 0.055) 0 9px, transparent 9px 18px),
    linear-gradient(180deg, #1a1f33, #0b0e18);
}
.reveal__backmark { font-size: 74px; filter: drop-shadow(0 8px 22px rgba(0, 0, 0, 0.8)); opacity: 0.92; }
.reveal__backtext {
  margin-top: 14px;
  font-size: 11px;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--gold);
}
.reveal__front {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, rgba(214, 172, 96, 0.16), #0c0f1a 62%);
}
.reveal__front.team-wolves {
  border-color: rgba(195, 61, 70, 0.65);
  background: linear-gradient(180deg, rgba(195, 61, 70, 0.26), #0c0f1a 62%);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.75), 0 0 60px rgba(195, 61, 70, 0.2);
}
.reveal__em { font-size: 62px; filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.75)); }
.reveal__role { font-size: 32px; margin-top: 10px; color: #fff; }
.reveal__team {
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 8px;
}
.reveal__front.team-wolves .reveal__team { color: var(--blood-hi); }
.reveal__desc { font-size: 13.5px; color: var(--muted); line-height: 1.55; margin: 14px 0 0; }
.reveal__pack {
  margin-top: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--blood-hi);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 11px;
}
.reveal__hint {
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0;
  animation: hintPulse 2.2s ease-in-out infinite;
}
@keyframes hintPulse { 50% { opacity: 0.3; } }

/* ── overlays ─────────────────────────────────────────────────────────── */
.tapaudio {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 76px);
  transform: translateX(-50%);
  z-index: 70;
  border: 1px solid var(--gold-hi);
  background: linear-gradient(180deg, #e8c274, #a67c2b);
  color: #241a05;
  font-weight: 700;
  font-size: 15px;
  font-family: inherit;
  padding: 13px 22px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--safe-b) + 18px);
  transform: translateX(-50%);
  background: rgba(30, 20, 36, 0.96);
  border: 1px solid #533a5a;
  color: #ffdcdf;
  padding: 13px 17px;
  border-radius: var(--r-sm);
  font-size: 14px;
  line-height: 1.45;
  max-width: 90%;
  z-index: 75;
  box-shadow: var(--shadow-lift);
  backdrop-filter: blur(8px);
  animation: riseIn 0.35s ease both;
}

/* ── reduced motion ───────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.06s !important;
  }
  .grain { display: none; }
}

/* ── new-role UI ──────────────────────────────────────────────────────── */
.card--urgent {
  border-color: rgba(195, 61, 70, 0.6);
  background: linear-gradient(180deg, rgba(195, 61, 70, 0.16), rgba(15, 18, 28, 0.85));
  box-shadow: 0 0 34px rgba(195, 61, 70, 0.22), var(--shadow-lift);
  animation: urgentIn 0.5s cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
@keyframes urgentIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: none; }
}
.target--option {
  font-size: 14px;
  line-height: 1.4;
  padding: 14px 12px;
  background: linear-gradient(180deg, rgba(86, 185, 138, 0.14), rgba(16, 19, 30, 0.85));
  border-color: rgba(86, 185, 138, 0.4);
}
.target--skip {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-weight: 500;
}
.targets__label {
  grid-column: 1 / -1;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  margin-top: 4px;
}
.rolecard__lover {
  margin-top: 7px !important;
  color: #f0a8c6 !important;
  font-weight: 600;
}
.cfg__em { opacity: 0.9; }

/* ── graveyard ────────────────────────────────────────────────────────── */
.card--grave {
  border-color: rgba(150, 160, 200, 0.28);
  background: linear-gradient(180deg, rgba(90, 100, 140, 0.12), rgba(10, 12, 20, 0.86));
}
.card--grave .chat__line b { color: #b9c2e6; }
.grave-reveal {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.grave-reveal summary {
  cursor: pointer;
  font-size: 11.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 700;
  list-style: none;
}
.grave-reveal summary::-webkit-details-marker { display: none; }
.grave-reveal summary::after { content: ' ＋'; opacity: 0.6; }
.grave-reveal[open] summary::after { content: ' －'; }
.grave-reveal .endroles { margin-top: 11px; }

/* ── host toggles ─────────────────────────────────────────────────────── */
.toggles {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.toggle {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  font-size: 14.5px;
  cursor: pointer;
}
.toggle input {
  width: 20px;
  height: 20px;
  flex: none;
  margin-top: 1px;
  accent-color: var(--gold);
}
.toggle__help {
  display: block;
  font-size: 12px;
  color: var(--dim);
  line-height: 1.45;
  margin-top: 2px;
}

/* ── post-mortem ──────────────────────────────────────────────────────── */
.card--recap { margin-top: 12px; }
.recap__h {
  margin: 4px 0 10px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 700;
}
.timeline { display: flex; flex-direction: column; gap: 7px; margin-bottom: 18px; }
.timeline__row { display: flex; gap: 10px; align-items: baseline; font-size: 13.5px; }
.timeline__tag {
  flex: none;
  min-width: 62px;
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  padding-top: 2px;
}
.timeline__text { color: var(--muted); line-height: 1.45; }
.recap__table { display: flex; flex-direction: column; gap: 6px; }
.recap__row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: rgba(6, 8, 14, 0.5);
  border: 1px solid var(--line);
  font-size: 14px;
}
.recap__row.team-wolves { border-color: rgba(195, 61, 70, 0.4); background: var(--blood-soft); }
.recap__em { font-size: 17px; flex: none; }
.recap__who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recap__role { color: var(--dim); font-size: 12.5px; }
.recap__num {
  margin-left: auto;
  flex: none;
  font-size: 12px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

/* Wolf vision: the one grid that appears while everyone else is in the dark. */
.packlabel {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--blood-hi);
  text-align: center;
  padding: 7px 10px;
  border: 1px solid rgba(195, 61, 70, 0.4);
  background: var(--blood-soft);
  border-radius: 999px;
  flex: none;
}

/* Camera troubleshooting — deliberately loud; a quiet failure here is useless. */
.fixlist {
  margin: 12px 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}
.fixlist li::marker { color: var(--gold); }
.fixlist b { color: var(--gold-hi); }
.fixlist code,
#media-help .footnote code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.4);
  padding: 1px 5px;
  border-radius: 5px;
}
#media-help .footnote {
  margin-top: 14px;
  text-align: left;
  word-break: break-all;
}

/* ── camera check on the join screen ──────────────────────────────────── */
.precheck {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: rgba(6, 8, 14, 0.5);
}
.precheck.is-live { border-color: rgba(86, 185, 138, 0.45); }
.precheck__view {
  position: relative;
  width: 78px;
  height: 100px;
  flex: none;
  border-radius: 10px;
  overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #171c2c, #0a0d16 70%);
}
.precheck__view video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scaleX(-1);
}
.precheck__ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 24px;
  opacity: 0.35;
}
.precheck.is-live .precheck__ph { display: none; }
.precheck__side { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.precheck__side strong { font-size: 14.5px; }
.precheck__msg { font-size: 12.5px; color: var(--dim); line-height: 1.45; }
.precheck__side .btn { margin-top: 4px; }

/* ── procedural crest behind an off camera ────────────────────────────── */
.tile.is-novideo::after {
  background-image: var(--sigil);
  background-size: cover;
  background-position: center;
  color: rgba(255, 255, 255, 0.5);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.85);
  font-size: 30px;
}

/* ── the moment someone dies ──────────────────────────────────────────── */
.tile.just-died {
  animation: dieShake 0.75s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
.tile.just-died::before {
  animation: dieFlash 1.1s ease-out both;
}
@keyframes dieShake {
  0% { transform: translate(0, 0); }
  12% { transform: translate(-3px, 1px) rotate(-0.7deg); }
  28% { transform: translate(3px, -1px) rotate(0.6deg); }
  46% { transform: translate(-2px, 1px) rotate(-0.4deg); }
  66% { transform: translate(2px, 0) rotate(0.3deg); }
  100% { transform: translate(0, 0); }
}
@keyframes dieFlash {
  0% { box-shadow: inset 0 0 0 rgba(195, 61, 70, 0); }
  18% { box-shadow: inset 0 0 60px rgba(195, 61, 70, 0.95); }
  100% { box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.55); }
}

/* ── quick reactions ──────────────────────────────────────────────────── */
.emotes {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding-top: 8px;
  flex: none;
}
.emote-btn {
  width: 46px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.045);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.2s;
}
.emote-btn:active { transform: scale(0.86); background: var(--gold-soft); }

.emote {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 14%;
  font-size: 30px;
  pointer-events: none;
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.8));
  animation: emoteFloat 1.8s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}
@keyframes emoteFloat {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.5); }
  18% { opacity: 1; transform: translate(-50%, -6px) scale(1.18); }
  32% { transform: translate(calc(-50% + var(--dx, 0px) * 0.4), -26px) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), -92px) scale(0.9); }
}

/* Room codes are longer on public deployments; keep them on one line on small phones. */
@media (max-width: 380px) {
  .codeinput {
    font-size: 26px !important;
    letter-spacing: 0.22em;
    padding-left: 0.22em !important;
  }
  .topbar__code { font-size: 25px; letter-spacing: 0.18em; }
}
