/* =========================================================
   Kingdoms — Storybook of the Realm (Dark)
   Candlelit storybook: deep midnight ink with gold filigree,
   role-coded panel frames inspired by Wilds of Eldraine cards.
   ========================================================= */

:root {
  /* Deep midnight palette — the candlelit table */
  --bg-deep: #0c0907;
  --bg-base: #14100a;
  --bg-raised: #1d1810;
  --bg-card: #251f14;
  --bg-card-2: #2c2517;

  /* Type — warm cream/gold tones, easy on the eye against the dark base */
  --ink: #ecdbac;
  --ink-mid: #b9a778;
  --ink-soft: #8a7a55;
  --ink-faint: #5a4f3a;

  /* Gold (signature accent — the candlelight and filigree) */
  --gold: #d4a857;
  --gold-bright: #f0c674;
  --gold-deep: #8a6c2a;
  --gold-dim: #5a4519;

  /* Role colors — brightened from the cards so they read on dark */
  --king-gold: #d4a857;
  --king-gold-deep: #8a6c2a;
  --knight-sage: #c8c4b0;
  --knight-deep: #6a6450;
  --assassin-purple: #b294c9;
  --assassin-deep: #4a2f5c;
  --bandit-red: #d45050;
  --bandit-deep: #6a1f1f;
  --renegade-blue: #6ab0d4;
  --renegade-deep: #1f4a6a;

  /* Danger / destructive action color (distinct from Bandit role red) */
  --danger: #b03434;
  --danger-deep: #6a1a1a;

  /* Active "frame" — swapped per role */
  --frame: var(--king-gold);
  --frame-deep: var(--king-gold-deep);
  --frame-soft: rgba(212, 168, 87, 0.12);

  /* Lines */
  --line: rgba(212, 168, 87, 0.18);
  --line-strong: rgba(212, 168, 87, 0.4);

  --radius-card: 14px;
  --radius-small: 4px;
  --shadow-card:
    0 4px 22px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(212, 168, 87, 0.1) inset;
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "EB Garamond", Garamond, Georgia, serif;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.55;

  /* Layered nighttime background:
     - Warm candlelight glow at top
     - Cooler shadow at bottom
     - Faint paper grain noise overlay
     - Deep base
  */
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(
      ellipse 90% 60% at 50% 0%,
      rgba(140, 100, 40, 0.18),
      transparent 65%
    ),
    radial-gradient(
      ellipse 80% 80% at 50% 100%,
      rgba(40, 20, 60, 0.1),
      transparent 60%
    ),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' seed='4'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 0.85  0 0 0 0 0.5  0 0 0 0.04 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 0 18px env(safe-area-inset-bottom, 18px);
}

/* =========================================================
   Topbar
   ========================================================= */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 4px 16px;
  position: relative;
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--gold-deep) 30%,
    var(--gold) 50%,
    var(--gold-deep) 70%,
    transparent 100%
  );
  opacity: 0.4;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.brand-mark {
  width: 22px;
  height: 22px;
  color: var(--gold);
  filter: drop-shadow(0 0 4px rgba(212, 168, 87, 0.4));
}
.brand-text {
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.05em;
  color: var(--ink);
  font-style: italic;
}
.link-btn {
  background: none;
  border: none;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-style: italic;
  font-size: 17px;
  color: var(--ink-mid);
  cursor: pointer;
  padding: 6px 10px;
  border-bottom: 1px solid transparent;
  transition:
    border-color 0.2s,
    color 0.2s;
}
.link-btn:hover {
  color: var(--gold-bright);
  border-bottom-color: var(--gold);
}

/* =========================================================
   Typography
   ========================================================= */
h1,
h2,
h3,
h4 {
  font-family: "Cormorant Garamond", serif;
  color: var(--ink);
  margin: 0 0 12px;
  font-weight: 600;
  line-height: 1.1;
}
h1 {
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
h2 {
  font-size: 28px;
  font-style: italic;
  font-weight: 500;
}
h3 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--gold);
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
}
h4 {
  font-size: 18px;
  font-style: italic;
  font-weight: 600;
}

.subtitle {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-weight: 500;
  font-size: 21px;
  color: var(--ink-mid);
  margin: -6px 0 22px;
  line-height: 1.3;
}

p {
  margin: 0 0 12px;
}

/* =========================================================
   Card frame — the central visual motif
   ========================================================= */
.card-frame {
  position: relative;
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-raised) 100%);
  border-radius: var(--radius-card);
  padding: 24px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-card);
  outline: 1px solid var(--gold-deep);
  outline-offset: -8px;
}
.card-frame::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid var(--gold-dim);
  border-radius: calc(var(--radius-card) - 4px);
  pointer-events: none;
}
.card-frame .corner {
  position: absolute;
  width: 38px;
  height: 38px;
  color: var(--frame);
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 0 3px rgba(212, 168, 87, 0.3));
}
.card-frame .corner-tl {
  top: -2px;
  left: -2px;
}
.card-frame .corner-tr {
  top: -2px;
  right: -2px;
  transform: scaleX(-1);
}
.card-frame .corner-bl {
  bottom: -2px;
  left: -2px;
  transform: scaleY(-1);
}
.card-frame .corner-br {
  bottom: -2px;
  right: -2px;
  transform: scale(-1, -1);
}

/* Role-tinted frames */
.frame-king {
  --frame: var(--king-gold);
  --frame-deep: var(--king-gold-deep);
  --frame-soft: rgba(212, 168, 87, 0.14);
}
.frame-knight {
  --frame: var(--knight-sage);
  --frame-deep: var(--knight-deep);
  --frame-soft: rgba(168, 184, 154, 0.14);
}
.frame-assassin {
  --frame: var(--assassin-purple);
  --frame-deep: var(--assassin-deep);
  --frame-soft: rgba(178, 148, 201, 0.14);
}
.frame-bandit {
  --frame: var(--bandit-red);
  --frame-deep: var(--bandit-deep);
  --frame-soft: rgba(212, 80, 80, 0.14);
}
.frame-renegade {
  --frame: var(--renegade-blue);
  --frame-deep: var(--renegade-deep);
  --frame-soft: rgba(106, 176, 212, 0.14);
}

/* =========================================================
   Title banner — mimics the card-name banner
   ========================================================= */
.title-banner {
  position: relative;
  text-align: center;
  padding: 14px 28px;
  margin: -8px -8px 18px;
  background: linear-gradient(180deg, var(--bg-card-2) 0%, var(--bg-card) 100%);
  border: 1px solid var(--gold-deep);
  border-radius: 6px;
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: 30px;
  color: var(--ink);
  letter-spacing: 0.01em;
  box-shadow:
    0 1px 0 rgba(212, 168, 87, 0.15) inset,
    0 2px 8px rgba(0, 0, 0, 0.5);
}
.title-banner::before,
.title-banner::after {
  content: "";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path d='M8 1 L9 6 L14 8 L9 10 L8 15 L7 10 L2 8 L7 6 Z' fill='%23d4a857'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.85;
}
.title-banner::before {
  left: 8px;
}
.title-banner::after {
  right: 8px;
}

/* =========================================================
   Divider
   ========================================================= */
.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 28px 0 22px;
  color: var(--ink-soft);
}
.divider .line {
  flex: 1;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--gold-deep),
    transparent
  );
}
.divider .ornament {
  width: 18px;
  height: 18px;
  color: var(--gold);
  opacity: 0.9;
}
.divider .label {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 15px;
  color: var(--ink-mid);
  letter-spacing: 0.06em;
}

/* =========================================================
   Forms
   ========================================================= */
.field {
  display: block;
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-style: italic;
  font-size: 16px;
  color: var(--ink-mid);
  margin-bottom: 6px;
  padding-left: 2px;
}
input[type="text"],
select {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-deep);
  border: 1px solid var(--gold-dim);
  border-radius: var(--radius-small);
  color: var(--ink);
  font-family: "EB Garamond", Garamond, serif;
  font-size: 18px;
  -webkit-appearance: none;
  appearance: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) inset;
}
input[type="text"]::placeholder {
  color: var(--ink-faint);
}
input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow:
    0 0 0 3px rgba(212, 168, 87, 0.18),
    0 2px 6px rgba(0, 0, 0, 0.3) inset;
}
select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path d='M1 1 L6 6 L11 1' stroke='%23d4a857' stroke-width='1.5' fill='none'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px 8px;
  padding-right: 36px;
}
input.code-input {
  text-transform: uppercase;
  letter-spacing: 0.4em;
  text-align: center;
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: 26px;
  padding: 16px 14px;
  color: var(--gold-bright);
}

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 22px;
  background: linear-gradient(180deg, #d8b14a 0%, #a8821e 100%);
  color: #1a120a;
  border: 1px solid var(--gold-deep);
  border-radius: var(--radius-small);
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition:
    transform 0.05s,
    background 0.18s,
    box-shadow 0.18s;
  width: 100%;
  text-shadow: 0 1px 0 rgba(255, 240, 200, 0.35);
  box-shadow:
    0 1px 0 rgba(255, 240, 200, 0.4) inset,
    0 -1px 0 rgba(0, 0, 0, 0.2) inset,
    0 3px 8px rgba(0, 0, 0, 0.45);
}
.btn:hover {
  background: linear-gradient(180deg, #e6c258 0%, #b8902a 100%);
}
.btn:active {
  transform: translateY(1px);
  box-shadow:
    0 1px 0 rgba(255, 240, 200, 0.3) inset,
    0 1px 4px rgba(0, 0, 0, 0.45);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: linear-gradient(180deg, #4a3f28 0%, #3a3220 100%);
  border-color: var(--ink-faint);
  color: var(--ink-soft);
  text-shadow: none;
}

/* Primary alias (alphabetic for clarity in markup) */
.btn-gold {
  /* same as .btn */
}

.btn-secondary {
  background: linear-gradient(180deg, var(--bg-card-2) 0%, var(--bg-card) 100%);
  color: var(--ink);
  border: 1px solid var(--gold-deep);
  text-shadow: none;
  box-shadow:
    0 1px 0 rgba(212, 168, 87, 0.1) inset,
    0 -1px 0 rgba(0, 0, 0, 0.2) inset,
    0 2px 6px rgba(0, 0, 0, 0.35);
}
.btn-secondary:hover {
  background: linear-gradient(180deg, var(--bg-raised) 0%, var(--bg-base) 100%);
  border-color: var(--gold);
  color: var(--gold-bright);
}

.btn-danger {
  background: linear-gradient(
    180deg,
    var(--danger) 0%,
    var(--danger-deep) 100%
  );
  border-color: var(--danger-deep);
  color: #f5e3d8;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}
.btn-danger:hover {
  background: linear-gradient(180deg, #c44444 0%, #7a2a2a 100%);
}

.btn-row {
  display: flex;
  gap: 10px;
}
.btn-row .btn {
  flex: 1;
}

/* Announce button — a torchlit "reveal yourself" action.
   Sits between secondary (passive) and gold (primary CTA) — purposeful but not destructive. */
.btn-announce {
  background: linear-gradient(180deg, #c89a4a 0%, #6a4a18 100%);
  border-color: var(--gold-deep);
  color: var(--bg-deep);
  text-shadow: 0 1px 0 rgba(255, 230, 180, 0.4);
  box-shadow:
    0 1px 0 rgba(255, 240, 200, 0.4) inset,
    0 -1px 0 rgba(0, 0, 0, 0.15) inset,
    0 3px 10px rgba(120, 90, 30, 0.5),
    0 0 28px rgba(212, 168, 87, 0.3);
  position: relative;
}
.btn-announce::before {
  content: "✦";
  margin-right: 6px;
  font-size: 14px;
}
.btn-announce::after {
  content: "✦";
  margin-left: 6px;
  font-size: 14px;
}
.btn-announce:hover {
  background: linear-gradient(180deg, #d4a857 0%, #7a5a1f 100%);
  box-shadow:
    0 1px 0 rgba(255, 240, 200, 0.5) inset,
    0 -1px 0 rgba(0, 0, 0, 0.15) inset,
    0 3px 12px rgba(120, 90, 30, 0.6),
    0 0 36px rgba(212, 168, 87, 0.45);
}

/* Player list — tappable when their card is viewable (announced/eliminated/king) */
.player-list li.tappable {
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.player-list li.tappable:hover {
  background: linear-gradient(180deg, var(--bg-card-2) 0%, var(--bg-card) 100%);
  border-color: var(--frame, var(--gold));
}
.player-list li.tappable::after {
  content: "›";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-soft);
  font-size: 22px;
  font-family: "Cormorant Garamond", serif;
}
.player-list li {
  position: relative; /* needed for the ›  positioning above */
}
.player-list li.tappable .badges {
  margin-right: 18px; /* leave room for the chevron */
}

/* "Announced" badge style — gold, distinct from "role revealed by elimination" */
.badge-announced {
  background: rgba(240, 198, 116, 0.18);
  color: var(--gold-bright);
  border-color: var(--gold-bright);
}

/* Card viewer modal — when tapping another player's revealed card */
.card-viewer {
  text-align: center;
}
.card-viewer .viewer-name {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 18px;
  color: var(--ink-mid);
  margin-bottom: 10px;
}
.card-viewer .viewer-status {
  font-family: "Cormorant Garamond", serif;
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--frame, var(--gold));
  margin-bottom: 12px;
}
.card-viewer img {
  width: 100%;
  max-width: 360px;
  height: auto;
  border-radius: 16px;
  display: block;
  margin: 0 auto;
  box-shadow:
    0 12px 30px rgba(0, 0, 0, 0.6),
    0 0 0 1px var(--frame, var(--gold)),
    0 0 0 4px var(--bg-deep),
    0 0 0 5px var(--frame-deep, var(--gold-deep)),
    0 0 40px var(--frame-soft, rgba(212, 168, 87, 0.18));
}
.card-viewer .viewer-meta {
  margin-top: 14px;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  color: var(--ink-mid);
}
.card-viewer .viewer-meta .role-type {
  display: block;
  font-style: normal;
  font-weight: 700;
  color: var(--frame, var(--gold));
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 13px;
  margin-bottom: 4px;
}

/* =========================================================
   Hero (landing)
   ========================================================= */
.hero {
  text-align: center;
  padding: 38px 0 26px;
  position: relative;
}
.hero-crest {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  color: var(--gold);
  margin-bottom: 14px;
  filter: drop-shadow(0 0 12px rgba(212, 168, 87, 0.5));
}
.hero-crest svg {
  width: 100%;
  height: 100%;
}

.hero h1 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: 56px;
  line-height: 1;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  color: var(--ink);
  text-shadow: 0 0 30px rgba(212, 168, 87, 0.25);
}
.hero .hero-tag {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 20px;
  color: var(--ink-mid);
}
.hero .hero-flourish {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 14px 0 28px;
  color: var(--gold);
}
.hero .hero-flourish .line {
  width: 70px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.hero .hero-flourish svg {
  width: 14px;
  height: 14px;
}

.action-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* =========================================================
   Lobby code display
   ========================================================= */
.lobby-code-display {
  text-align: center;
  padding: 28px 16px 22px;
  position: relative;
  background: linear-gradient(
    180deg,
    var(--bg-card-2) 0%,
    var(--bg-raised) 100%
  );
  border: 1px solid var(--gold-deep);
  border-radius: var(--radius-card);
  margin-bottom: 18px;
  box-shadow: var(--shadow-card);
}
.lobby-code-display .label {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 16px;
  color: var(--ink-mid);
  margin-bottom: 6px;
}
.lobby-code-display .code {
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: 48px;
  letter-spacing: 0.18em;
  color: var(--gold-bright);
  line-height: 1;
  text-shadow: 0 0 24px rgba(240, 198, 116, 0.35);
  font-variant-numeric: lining-nums;
}

/* =========================================================
   Player list
   ========================================================= */
.player-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.player-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-raised) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  box-shadow:
    0 1px 0 rgba(212, 168, 87, 0.06) inset,
    0 1px 3px rgba(0, 0, 0, 0.4);
}
.player-list .name {
  font-family: "Cormorant Garamond", serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
}
.player-list .badges {
  display: flex;
  gap: 6px;
  align-items: center;
}
.badge {
  font-family: "Cormorant Garamond", serif;
  font-size: 12px;
  font-weight: 600;
  font-style: italic;
  letter-spacing: 0.05em;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--bg-card-2);
  color: var(--ink-mid);
  border: 1px solid var(--line);
}
.badge-host {
  background: rgba(212, 168, 87, 0.18);
  color: var(--gold-bright);
  border-color: var(--gold-deep);
}
.badge-you {
  background: var(--gold);
  color: #1a120a;
  border-color: var(--gold-deep);
}
.badge-role-king {
  background: rgba(212, 168, 87, 0.18);
  color: var(--king-gold);
  border-color: var(--king-gold-deep);
}
.badge-role-knight {
  background: rgba(168, 184, 154, 0.18);
  color: var(--knight-sage);
  border-color: rgba(168, 184, 154, 0.4);
}
.badge-role-assassin {
  background: rgba(178, 148, 201, 0.18);
  color: var(--assassin-purple);
  border-color: rgba(178, 148, 201, 0.4);
}
.badge-role-bandit {
  background: rgba(212, 80, 80, 0.18);
  color: var(--bandit-red);
  border-color: rgba(212, 80, 80, 0.4);
}
.badge-role-renegade {
  background: rgba(106, 176, 212, 0.18);
  color: var(--renegade-blue);
  border-color: rgba(106, 176, 212, 0.4);
}

.player-eliminated {
  opacity: 0.45;
}
.player-eliminated .name {
  text-decoration: line-through;
}

/* =========================================================
   Role reveal — centerpiece
   ========================================================= */
.role-reveal {
  text-align: center;
  padding: 8px 0 4px;
}
.role-image-wrap {
  max-width: 340px;
  margin: 8px auto 18px;
  position: relative;
}
.role-image-wrap::before {
  content: "";
  position: absolute;
  inset: -20px -24px -30px;
  background: radial-gradient(
    ellipse at center,
    var(--frame-soft),
    transparent 70%
  );
  z-index: 0;
  pointer-events: none;
}
.role-image-wrap img {
  position: relative;
  width: 100%;
  height: auto;
  border-radius: 16px;
  display: block;
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.7),
    0 0 0 1px var(--frame),
    0 0 0 4px var(--bg-base),
    0 0 0 5px var(--frame-deep),
    0 0 40px rgba(212, 168, 87, 0.15);
  z-index: 1;
}
.role-meta {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 17px;
  color: var(--ink-mid);
  margin-top: 8px;
}
.role-meta .role-type {
  font-style: normal;
  font-weight: 700;
  color: var(--frame);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 13px;
  margin-bottom: 4px;
  display: block;
}

.teammates {
  margin-top: 18px;
  padding: 16px 18px;
  background: var(--frame-soft);
  border: 1px solid var(--frame-deep);
  border-radius: var(--radius-small);
}
.teammates h3 {
  margin-bottom: 4px;
  color: var(--frame);
}
.teammates p {
  margin: 0;
  font-style: italic;
  font-size: 19px;
  color: var(--ink);
}

/* =========================================================
   Host options
   ========================================================= */
.options-section {
  margin-top: 12px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-raised) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  margin-bottom: 12px;
  cursor: pointer;
  user-select: none;
  font-size: 17px;
  color: var(--ink-mid);
}
.checkbox-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--gold);
  margin-top: 2px;
  flex-shrink: 0;
}
.checkbox-row .checkbox-label {
  font-family: "EB Garamond", serif;
  line-height: 1.4;
}
.checkbox-row .checkbox-label em {
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-style: italic;
  color: var(--gold-bright);
}

.role-filter {
  margin-top: 14px;
  border: 1px solid var(--gold-deep);
  border-radius: var(--radius-small);
  overflow: hidden;
}
.role-filter summary {
  padding: 14px 16px;
  background: linear-gradient(180deg, var(--bg-card-2) 0%, var(--bg-card) 100%);
  cursor: pointer;
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  list-style: none;
  position: relative;
}
.role-filter summary::-webkit-details-marker {
  display: none;
}
.role-filter summary::after {
  content: "▾";
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold);
  transition: transform 0.2s;
}
.role-filter[open] summary::after {
  transform: translateY(-50%) rotate(180deg);
}
.role-filter-body {
  padding: 14px 16px;
  background: var(--bg-base);
  border-top: 1px solid var(--gold-deep);
}
.role-group {
  margin-bottom: 20px;
}
.role-group:last-child {
  margin-bottom: 0;
}
.role-group .role-group-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.role-group .role-group-name {
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: 18px;
  font-style: italic;
  color: var(--frame);
}
.role-group .role-group-actions {
  display: flex;
  gap: 10px;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 14px;
}
.role-group .selectall {
  color: var(--ink-soft);
  text-decoration: underline;
  cursor: pointer;
}
.role-group .selectall:hover {
  color: var(--gold-bright);
}

.char-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.char-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  cursor: pointer;
  font-family: "EB Garamond", serif;
  font-size: 16px;
  color: var(--ink);
  user-select: none;
  transition: background 0.15s;
}
.char-toggle:hover {
  background: var(--bg-card-2);
  border-color: var(--gold-deep);
}
.char-toggle input {
  accent-color: var(--gold);
  flex-shrink: 0;
}
.char-toggle.disabled-row {
  opacity: 0.4;
  text-decoration: line-through;
  font-style: italic;
  color: var(--ink-soft);
}

/* =========================================================
   Mode pill
   ========================================================= */
.mode-pill {
  display: inline-block;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 14px;
  font-weight: 600;
  padding: 4px 12px;
  border: 1px solid var(--gold-deep);
  border-radius: 999px;
  color: var(--gold);
  background: rgba(212, 168, 87, 0.08);
  margin-bottom: 14px;
}

/* =========================================================
   Recent lobbies
   ========================================================= */
.recent-lobby {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-raised) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  margin-bottom: 8px;
}
.recent-lobby .lobby-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.recent-lobby .lobby-code {
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.18em;
  color: var(--gold-bright);
  font-variant-numeric: lining-nums;
}
.recent-lobby .lobby-meta {
  font-family: "EB Garamond", serif;
  font-style: italic;
  font-size: 14px;
  color: var(--ink-soft);
}
.recent-lobby .lobby-actions {
  display: flex;
  gap: 6px;
}
.recent-lobby .btn {
  width: auto;
  padding: 7px 14px;
  font-size: 14px;
}

/* =========================================================
   Rules modal
   ========================================================= */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 3, 1, 0.85);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 14px;
  overflow-y: auto;
}
.modal.hidden {
  display: none;
}
.modal-inner {
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-raised) 100%);
  border-radius: var(--radius-card);
  max-width: 640px;
  width: 100%;
  padding: 28px 26px;
  position: relative;
  box-shadow:
    0 16px 48px rgba(0, 0, 0, 0.8),
    0 0 0 1px var(--gold-deep);
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 14px;
  background: none;
  border: none;
  color: var(--ink-soft);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 4px 10px;
  font-family: "Cormorant Garamond", serif;
}
.modal-close:hover {
  color: var(--gold-bright);
}

.rules-content h2 {
  color: var(--ink);
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-style: normal;
  font-size: 26px;
  margin-top: 24px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line-strong);
}
.rules-content h2:first-child {
  margin-top: 0;
}
.rules-content h3 {
  color: var(--gold);
  margin-top: 16px;
  font-size: 13px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.rules-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  font-size: 15px;
  font-family: "EB Garamond", serif;
  color: var(--ink);
}
.rules-content th,
.rules-content td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.rules-content th {
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-style: italic;
  font-size: 15px;
  color: var(--gold);
  border-bottom: 2px solid var(--gold-deep);
}
.rules-content tr:nth-child(even) td {
  background: rgba(212, 168, 87, 0.05);
}
.rules-content ul {
  padding-left: 20px;
}
.rules-content li {
  margin-bottom: 6px;
  color: var(--ink);
}
.rules-content em {
  font-family: "Cormorant Garamond", serif;
}
.rules-content strong {
  color: var(--ink);
  font-weight: 700;
}

/* Role-tinted pills used inline in the rules */
.role-pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-style: normal;
  font-size: 16px;
  letter-spacing: 0.02em;
  margin-right: 2px;
}
.role-pill-king {
  background: rgba(212, 168, 87, 0.16);
  color: var(--king-gold);
  border: 1px solid rgba(212, 168, 87, 0.4);
}
.role-pill-knight {
  background: rgba(168, 184, 154, 0.16);
  color: var(--knight-sage);
  border: 1px solid rgba(168, 184, 154, 0.4);
}
.role-pill-assassin {
  background: rgba(178, 148, 201, 0.16);
  color: var(--assassin-purple);
  border: 1px solid rgba(178, 148, 201, 0.4);
}
.role-pill-bandit {
  background: rgba(212, 80, 80, 0.16);
  color: var(--bandit-red);
  border: 1px solid rgba(212, 80, 80, 0.4);
}
.role-pill-renegade {
  background: rgba(106, 176, 212, 0.16);
  color: var(--renegade-blue);
  border: 1px solid rgba(106, 176, 212, 0.4);
}

/* =========================================================
   Toast
   ========================================================= */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--gold);
  color: var(--ink);
  padding: 12px 22px;
  border-radius: var(--radius-small);
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 17px;
  z-index: 200;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6);
  max-width: calc(100vw - 32px);
}
.toast.hidden {
  display: none;
}
.toast.error {
  border-color: var(--danger);
  color: #e8a8a8;
}

/* =========================================================
   Footer signature
   ========================================================= */
.footsig {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 40px 0 24px;
  color: var(--gold);
  opacity: 0.4;
}
.footsig-line {
  flex: 0 1 60px;
  height: 1px;
  background: var(--gold);
}
.footsig-mark {
  width: 16px;
  height: 16px;
}

/* =========================================================
   Utilities
   ========================================================= */
.hidden {
  display: none !important;
}
.muted {
  color: var(--ink-soft);
  font-style: italic;
  font-size: 16px;
}
.tiny {
  font-size: 13px;
  color: var(--ink-faint);
  font-style: italic;
}
.center {
  text-align: center;
}
.mt {
  margin-top: 18px;
}
.mt-lg {
  margin-top: 28px;
}
.mt-sm {
  margin-top: 8px;
}

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 2px solid var(--line);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.fade-in {
  animation: fadeIn 0.4s ease-out;
}

@keyframes revealCard {
  from {
    opacity: 0;
    transform: scale(0.94) rotateY(8deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotateY(0);
  }
}
.reveal-card {
  animation: revealCard 0.6s ease-out;
}

/* Drop cap */
.dropcap::first-letter {
  font-family: "UnifrakturCook", "Cormorant Garamond", serif;
  font-size: 56px;
  float: left;
  line-height: 0.85;
  padding: 6px 10px 0 0;
  color: var(--gold);
  text-shadow: 0 0 20px rgba(212, 168, 87, 0.4);
}

/* Responsive tweaks */
@media (max-width: 380px) {
  .hero h1 {
    font-size: 44px;
  }
  .lobby-code-display .code {
    font-size: 38px;
  }
  .title-banner {
    font-size: 24px;
    padding: 12px 22px;
  }
  .char-grid {
    grid-template-columns: 1fr;
  }
}
