/* Traitors: candlelit castle. Stone, parchment, candle gold, blood, ivy. */
:root {
  --stone: #221e26;
  --stone-2: #2d2832;
  --stone-3: #3a3440;
  --parchment: #ecdcb9;
  --muted: #a89a85;
  --gold: #c9a24a;
  --blood: #b3262f;
  --ivy: #5c9a68;
  --line: rgba(236, 220, 185, 0.16);
  --radius-s: 6px;
  --radius-l: 14px;
  --display: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --body: 'EB Garamond', Garamond, Georgia, serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(120% 70% at 50% -10%, rgba(201, 162, 74, 0.13), transparent 60%),
    var(--stone);
  color: var(--parchment);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: 0.04em; line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.25rem; color: var(--gold); }
h3 { font-family: var(--body); font-weight: 600; letter-spacing: 0; font-size: 1.12rem; }
p { margin: 0 0 0.75em; }
a { color: var(--gold); }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.center { text-align: center; }
.hidden { display: none !important; }

.wrap { max-width: 640px; margin: 0 auto; padding: 16px 16px 80px; }
.wrap-wide { max-width: 1100px; }

.panel {
  background: var(--stone-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 16px;
  margin: 0 0 14px;
}
.panel.alert { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.panel.danger { border-color: var(--blood); }

button, .btn {
  font: 600 1rem var(--body);
  color: var(--parchment);
  background: var(--stone-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 12px 16px;
  min-height: 48px;
  cursor: pointer;
  touch-action: manipulation;
}
button:hover { border-color: var(--muted); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.primary { background: var(--gold); color: #1f1a12; border-color: var(--gold); }
button.blood { background: var(--blood); border-color: var(--blood); color: #fff; }
button.ghost { background: transparent; }
button.block { width: 100%; }
button.big { font-family: var(--display); font-size: 1.15rem; letter-spacing: 0.05em; min-height: 64px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1 1 auto; }
.stack > * + * { margin-top: 8px; }

input, select, textarea {
  font: 1rem var(--body);
  color: var(--parchment);
  background: var(--stone);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  min-height: 46px;
  width: 100%;
}
textarea { min-height: 80px; resize: vertical; }
label { display: block; margin: 0 0 4px; color: var(--muted); font-size: 0.92rem; }

/* Choice buttons (names, quiz options) */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.choice { text-align: center; }
.choice.on { background: var(--parchment); color: var(--stone); border-color: var(--parchment); }
.choice.traitor-on { background: var(--blood); border-color: var(--blood); color: #fff; }

/* Header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.top .who { font-family: var(--display); font-size: 1.1rem; }
.phase-line { color: var(--muted); font-size: 0.95rem; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.85rem; border: 1px solid var(--line); }
.pill.traitor { background: var(--blood); border-color: var(--blood); color: #fff; }
.pill.faithful { background: var(--ivy); border-color: var(--ivy); color: #fff; }
.pill.gold { border-color: var(--gold); color: var(--gold); }

/* Role card: hold to see */
.role-card {
  user-select: none; -webkit-user-select: none;
  border: 1px dashed var(--gold);
  border-radius: var(--radius-l);
  padding: 22px 16px;
  text-align: center;
  font-family: var(--display);
  letter-spacing: 0.06em;
  background: var(--stone-2);
  touch-action: none;
}
.role-card .shown { display: none; font-size: 2rem; }
.role-card.holding .hint { display: none; }
.role-card.holding .shown { display: block; }
.role-card.holding.traitor { background: var(--blood); border-color: var(--blood); color: #fff; }
.role-card.holding.faithful { background: var(--ivy); border-color: var(--ivy); color: #fff; }

/* Tabs */
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs button { flex: 1; min-height: 42px; }
.tabs button.on { background: var(--parchment); color: var(--stone); }

/* Chat */
.chat-log { max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.msg { background: var(--stone-3); border-radius: var(--radius-s); padding: 8px 10px; }
.msg b { color: var(--gold); font-weight: 600; }

/* Banner and toast */
.banner {
  position: sticky; top: 0; z-index: 5;
  background: var(--gold); color: #1f1a12;
  font-family: var(--display); text-align: center;
  padding: 14px; border-radius: var(--radius-s); margin-bottom: 14px;
}
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  background: var(--stone-3); border: 1px solid var(--gold);
  padding: 10px 16px; border-radius: var(--radius-s); z-index: 20; max-width: 90vw;
}
.toast.err { border-color: var(--blood); }

/* Font and colour pickers */
.font-grid, .color-grid { display: grid; gap: 8px; }
.font-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.font-grid button { font-weight: 400; font-size: 1.1rem; background: #000; line-height: 1.2; }
.color-grid { grid-template-columns: repeat(5, 1fr); }
.swatch { min-height: 48px; border-radius: var(--radius-s); border: 2px solid transparent; }
.swatch.on { border-color: var(--parchment); box-shadow: 0 0 0 2px var(--stone) inset; }
.slate-preview {
  background: #0d0d0d; border: 8px solid #6b4a2b; border-radius: 8px;
  text-align: center; padding: 18px 8px; font-size: 2rem; margin-top: 10px;
}

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 400; font-size: 0.9rem; }
.dead { opacity: 0.5; text-decoration: line-through; }

.timer { font-family: var(--display); font-size: 1.4rem; color: var(--gold); }
.shield-icon { font-size: 1.4rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
.row input { width: auto; flex: 1 1 140px; min-width: 0; }
