:root {
  color-scheme: dark;
  --header: #e05b2b;
  --header-deep: #b4431a;
  --header-hot: #e67a53;
  --wood: #372e25;
  --wood-light: #4d4945;
  --ink: #141414;
  --paper: #f3ead7;
  --muted: #bbbbbb;
  --liberal: #5a9ba6;
  --liberal-deep: #386f8b;
  --gold: #f6b53f;
  --danger: #8c1d18;
  font-family: Montserrat, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(224, 91, 43, 0.18), transparent 55%),
    linear-gradient(180deg, var(--wood-light), var(--wood) 28%, #241c16);
  color: white;
}

button, input { font: inherit; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--header);
  box-shadow: 0 4px 0 var(--header-deep);
}

.brand {
  margin: 0;
  font-family: "Germania One", cursive;
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 400;
  letter-spacing: 0.03em;
  line-height: 1;
}

.brand span { font-style: italic; }

.room-chip, .role-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(20, 20, 20, 0.28);
  border-radius: 999px;
  padding: 6px 8px 6px 14px;
  font-weight: 700;
}

.room-chip strong {
  font-family: "Germania One", cursive;
  font-size: 28px;
  letter-spacing: 0.12em;
  font-weight: 400;
}

.status {
  background: var(--ink);
  color: white;
  text-align: center;
  padding: 12px 16px;
  font-weight: 700;
  line-height: 1.35;
}

.banner {
  margin: 0;
  padding: 10px 16px;
  background: #5c1c14;
  color: #ffd7cc;
  text-align: center;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  padding: 14px;
  align-items: start;
}

.stage { min-width: 0; }

.home {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 16px 12px;
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  gap: 22px;
}

.panel, .rules, .modal, .chat {
  background: rgba(20, 20, 20, 0.78);
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}

.panel, .rules { padding: 22px; }

.panel h2, .rules h2, .modal h2 {
  font-family: "Germania One", cursive;
  font-weight: 400;
  font-size: 34px;
  margin: 0 0 8px;
}

.lede, .rules p, .modal p { color: var(--muted); line-height: 1.45; }

.stack { display: grid; gap: 10px; margin: 14px 0 18px; }

label { font-size: 13px; font-weight: 700; color: #ddd; }

input {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 12px 12px;
  background: white;
  color: #3a342e;
}

input:focus { outline: 3px solid var(--gold); }

.btn, .texty {
  font-family: "Germania One", cursive;
  font-size: 22px;
  color: white;
  background: var(--header);
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  box-shadow: 0 5px 0 var(--header-deep);
  cursor: pointer;
}

.btn:hover, .texty:hover { background: var(--header-hot); }
.btn:active, .texty:active { transform: translateY(5px); box-shadow: none; }
.btn:disabled { background: #928079; box-shadow: 0 5px 0 #766058; cursor: not-allowed; transform: none; }
.btn.alt { background: var(--liberal); box-shadow: 0 5px 0 var(--liberal-deep); }
.btn.ghost, .texty.ghost { background: transparent; box-shadow: none; color: var(--gold); font-family: Montserrat, sans-serif; font-size: 14px; font-weight: 700; }
.btn.small, .texty { font-size: 16px; padding: 7px 10px; box-shadow: 0 3px 0 var(--header-deep); }

.rules ol { margin: 0; padding-left: 18px; color: var(--muted); display: grid; gap: 8px; }
.rules li::marker { color: var(--header-hot); }

.table-top {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) 92px;
  gap: 8px;
  align-items: center;
  max-width: 980px;
  margin: 0 auto;
}

.board-wrap { position: relative; margin: 4px 0; }
.board-wrap .board { width: 100%; height: auto; display: block; }

.policy-tile {
  position: absolute;
  top: 30%;
  width: 10%;
  height: auto;
}

.tracker {
  position: absolute;
  top: 74%;
  width: 3.2%;
  height: auto;
}

.pile { position: relative; }
.pile img { width: 100%; height: auto; display: block; }
.pile span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 7%;
  text-align: center;
  font-family: "Germania One", cursive;
  font-size: 26px;
  color: white;
  text-shadow: 0 1px 2px #000;
}

.veto-flag {
  text-align: center;
  color: var(--gold);
  font-weight: 700;
  margin: 4px 0 0;
}

.players {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 18px 4px 8px;
  scroll-snap-type: x proximity;
}

.seat-wrap {
  width: 112px;
  flex: 0 0 auto;
  scroll-snap-align: start;
}

.seat {
  position: relative;
  width: 100%;
  border: 0;
  padding: 18px 0 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.remove {
  display: block;
  margin: 2px auto 0;
  background: transparent;
  border: 0;
  color: #e7b2a8;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.seat.selectable { cursor: pointer; }
.seat.selectable .base { filter: drop-shadow(0 0 7px var(--gold)); }
.seat.selected .base { filter: drop-shadow(0 0 8px #e46949); }
.seat.you .base { outline: 3px solid var(--gold); outline-offset: -8px; border-radius: 18px; }
.seat.dead { filter: grayscale(0.8) brightness(0.62); }
.seat .base { width: 100%; height: auto; display: block; }
.portrait {
  position: absolute;
  width: 82%;
  left: 9%;
  top: calc(6.3% + 18px);
  height: auto;
}
.name {
  position: absolute;
  top: calc(64% + 8px);
  left: 10%;
  width: 80%;
  text-align: center;
  color: #372e25;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.15;
}
.meta {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 4%;
  text-align: center;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #6b4a32;
}
.office {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  background: var(--header);
  color: white;
  font-family: "Germania One", cursive;
  font-size: 14px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.office.chancellor { background: var(--danger); }
.pip {
  position: absolute;
  width: 28%;
  left: 8%;
  top: 46%;
  height: auto;
}
.vote-pip {
  position: absolute;
  width: 58%;
  left: 21%;
  top: 34%;
  height: auto;
}
.executed {
  position: absolute;
  top: 38%;
  left: 6%;
  right: 6%;
  text-align: center;
  font-family: "Germania One", cursive;
  font-size: 22px;
  color: white;
  text-shadow: 0 2px #000;
}

.action-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin: 8px auto 0;
  max-width: 720px;
}

.chat {
  display: flex;
  flex-direction: column;
  min-height: 480px;
  max-height: calc(100vh - 150px);
  position: sticky;
  top: 12px;
}

.chat header, .chat form { padding: 12px; }
.chat header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: "Germania One", cursive;
  font-size: 26px;
}
.log {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg { font-size: 14px; line-height: 1.35; }
.msg .who { font-weight: 700; color: var(--gold); }
.msg .when { color: #8d8d8d; font-size: 11px; margin-left: 6px; white-space: nowrap; }
.msg.event { color: var(--header-hot); font-style: italic; }
.msg .dead-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #3a201c;
  color: #e7b2a8;
  font-size: 10px;
  font-style: normal;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.who.dead { text-decoration: line-through; }
.chat form { display: flex; gap: 8px; }
.chat input { flex: 1; }
.chat-toggle { display: none; }

.modal-back {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(20, 20, 20, 0.84);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal { padding: 18px 18px 22px; width: min(760px, 100%); max-height: min(92vh, 900px); overflow: auto; text-align: center; }
.cards { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 12px 0; }
.cards button { background: transparent; border: 0; padding: 0; cursor: pointer; border-radius: 10px; }
.cards button:hover, .cards button:focus-visible { transform: translateY(-4px); outline: none; }
.cards img, .modal .role-card, .victory { width: min(190px, 42vw); height: auto; border-radius: 10px; }
.modal .role-card { width: min(260px, 70vw); }
.victory { width: min(460px, 100%); }
.allies { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 0; margin: 8px 0 0; list-style: none; }
.allies li { background: #2a211b; border-radius: 999px; padding: 6px 10px; font-weight: 700; }
.choice-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.site-footer {
  padding: 18px 16px 28px;
  color: #b7aea4;
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}
.site-footer a { color: var(--header-hot); }

@media (max-width: 900px) {
  .home { grid-template-columns: 1fr; padding-top: 16px; }
  .layout { grid-template-columns: 1fr; }
  .table-top { grid-template-columns: 72px minmax(0, 1fr) 72px; }
  .chat {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 25;
    top: auto;
    max-height: 72vh;
    min-height: 0;
    height: 72vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(110%);
    transition: transform 0.2s ease;
  }
  .chat.open { transform: translateY(0); }
  .chat-toggle {
    display: block;
    position: fixed;
    right: 12px;
    bottom: 12px;
    z-index: 26;
  }
  .topbar { align-items: flex-start; }
  .room-chip { padding-left: 10px; }
  .seat-wrap { width: 96px; }
  .stage { padding-bottom: 72px; }
}

@media (max-width: 640px) {
  .table-top { grid-template-columns: 1fr 1fr; }
  .boards { grid-column: 1 / -1; order: -1; }
  .pile span { font-size: 24px; }
}
