@font-face {
  font-family: "Outfit";
  src: url("/static/fonts/outfit-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Outfit";
  src: url("/static/fonts/outfit-560.woff2") format("woff2");
  font-weight: 560;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fraunces";
  src: url("/static/fonts/fraunces-560.woff2") format("woff2");
  font-weight: 560;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fraunces";
  src: url("/static/fonts/fraunces-650.woff2") format("woff2");
  font-weight: 650;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #e7dcc8;
  --bg-deep: #ddcfb6;
  --ink: #241c15;
  --muted: #6b5e52;
  --card: #fbf6ee;
  --line: rgba(36, 28, 21, 0.12);
  --brass: #8a5a2a;
  --brass-soft: #e6d3a3;
  --good: #1d6b45;
  --good-soft: #d7efe2;
  --evil: #8e2f2a;
  --evil-soft: #f3d2cf;
  --felt: #1a3330;
  --felt-ink: #f4efe4;
  --shadow: 0 18px 50px rgba(70, 46, 20, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(255, 250, 240, 0.9), transparent 55%),
    linear-gradient(180deg, #efe4d2 0%, var(--bg) 280px);
  font-family: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.45;
  border-top: 6px solid var(--brass);
}

a { color: inherit; }

h1, h2, h3 {
  font-family: "Fraunces", "Iowan Old Style", Palatino, serif;
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

h1 { font-size: clamp(2.4rem, 6vw, 4.4rem); margin: 0 0 12px; }
h2 { font-size: 1.7rem; margin: 0 0 12px; }
h3 { font-size: 1.05rem; margin: 0 0 8px; }

p { margin: 0 0 12px; }

.wrap {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header, .site-header nav, .room-head, .room-tools, .row-actions, .vote-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-header {
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 18px 0 8px;
}

.site-header nav form { margin: 0; }

.wordmark {
  font-family: "Fraunces", Palatino, serif;
  font-weight: 650;
  font-size: 1.45rem;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.who { color: var(--muted); }

.site-footer {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 28px 0 36px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--brass);
  font-size: 0.82rem;
  font-weight: 560;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.lede { font-size: 1.12rem; max-width: 42rem; color: var(--ink); }

.hero { padding: 28px 0 8px; }
.hero.slim { padding-top: 18px; }

.hint { color: var(--muted); font-size: 0.95rem; }
.standout { margin-top: 18px; }

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.game-card {
  display: flex;
  flex-direction: column;
  min-height: 240px;
  padding: 22px;
  background: var(--card);
  border-radius: 18px;
  text-decoration: none;
  box-shadow: var(--shadow);
}

.game-card p { flex: 1; }

.go {
  font-weight: 560;
  color: var(--brass);
}

.game-card:hover { transform: translateY(-2px); }

.block { margin-top: 28px; }

.table-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.table-list a {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 12px 14px;
  background: var(--card);
  border-radius: 12px;
  text-decoration: none;
}

.table-list strong {
  font-family: "Fraunces", Palatino, serif;
  letter-spacing: 0.08em;
}

.empty {
  padding: 16px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 12px;
}

.auth-card {
  max-width: 440px;
  margin-top: 18px;
  padding: 22px;
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.auth-card h1 { font-size: 2.4rem; }

.stack { display: grid; gap: 12px; }

label { display: grid; gap: 6px; font-size: 0.92rem; font-weight: 560; }

input[type="text"], input[type="password"], input:not([type]) {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font: inherit;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  background: var(--ink);
  color: #f6f1e7;
  font: inherit;
  font-weight: 560;
  cursor: pointer;
  text-decoration: none;
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(36, 28, 21, 0.28);
}

.btn:disabled, .btn[disabled] {
  cursor: default;
  opacity: 0.55;
}

.btn-approve { background: var(--good-soft); color: #123c28; }
.btn-reject { background: var(--evil-soft); color: #6d221d; }
.btn-brass { background: var(--brass-soft); color: #2a2116; }

.inline-form { display: inline; margin: 0; }

.form-error { color: var(--evil); font-weight: 560; }

.room-head {
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  padding-top: 12px;
}

.room-head h1 { font-size: clamp(2rem, 4vw, 3rem); }

.live {
  margin: 0;
  color: var(--good);
  font-size: 0.9rem;
  font-weight: 560;
}

.text-link { text-decoration: none; font-weight: 560; }

.ttt { max-width: 560px; }

.phase {
  font-family: "Fraunces", Palatino, serif;
  font-size: 1.6rem;
  margin: 8px 0 12px;
}

.ttt-names {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}

.ttt-name {
  flex: 1;
  padding: 10px 12px;
  background: var(--card);
  border-radius: 12px;
  border: 1px solid transparent;
}

.ttt-name.is-turn { border-color: var(--brass); }

.board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: min(420px, 100%);
  aspect-ratio: 1;
}

.cell {
  border: 0;
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-family: "Fraunces", Palatino, serif;
  font-size: clamp(2.4rem, 8vw, 4rem);
  color: var(--ink);
  cursor: pointer;
}

.cell:disabled { cursor: default; opacity: 1; }
.cell.is-win { background: var(--good-soft); }
.cell.is-last { outline: 2px solid var(--brass); outline-offset: -6px; }

.mark { font-family: "Fraunces", Palatino, serif; }
.mark-x { color: var(--ink); }
.mark-o { color: var(--brass); }

.row-actions, .vote-actions { margin-top: 16px; flex-wrap: wrap; }

.avalon-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
  margin-top: 8px;
}

.felt {
  background:
    radial-gradient(800px 240px at 20% 0%, rgba(255, 255, 255, 0.06), transparent 50%),
    var(--felt);
  color: var(--felt-ink);
  border-radius: 20px;
  padding: 18px;
  min-height: 420px;
}

.felt .phase { margin-top: 0; }

.scoreline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  color: rgba(244, 239, 228, 0.82);
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.quests {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 0 0 14px;
}

.quest {
  width: 92px;
  min-height: 88px;
  border-radius: 14px;
  border: 1px solid rgba(244, 239, 228, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.82rem;
}

.quest strong, .quest span { display: block; }
.quest strong { font-family: "Fraunces", Palatino, serif; font-size: 1.3rem; font-weight: 560; }
.quest.is-current { border-color: var(--brass-soft); }
.quest.is-success { background: var(--good); border-color: transparent; }
.quest.is-fail { background: var(--evil); border-color: transparent; }

.pips { display: flex; gap: 6px; align-items: center; }
.pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 1px solid rgba(244, 239, 228, 0.45);
}
.pip.is-on { background: #e07a72; border-color: #e07a72; }

.seats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.seat {
  border-radius: 12px;
  border: 1px solid rgba(244, 239, 228, 0.16);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  text-align: left;
  padding: 10px 12px;
  font: inherit;
}

button.seat { cursor: pointer; }
.seat.is-leader { border-color: var(--brass-soft); }
.seat.is-team { background: rgba(230, 211, 163, 0.14); }
.seat.is-selected { background: rgba(230, 211, 163, 0.32); }
.seat.is-you { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35); }

.seat .meta {
  display: block;
  margin-top: 4px;
  color: rgba(244, 239, 228, 0.72);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hammer {
  background: var(--evil-soft);
  color: #6d221d;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 8px 0 12px;
  font-weight: 560;
}

.panel {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(244, 239, 228, 0.12);
}

.vote-list, .history, .knowledge, .role-pills, .setup-quests {
  list-style: none;
  padding: 0;
  margin: 0;
}

.vote-list li, .history li { padding: 5px 0; }

.history {
  max-height: 220px;
  overflow: auto;
}

.history li { border-top: 1px solid rgba(244, 239, 228, 0.08); font-size: 0.92rem; }

.choice-approve { color: #b7e4cb; }
.choice-reject { color: #f0b2ad; }

.dossier {
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 12px;
}

.seal {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 560;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.seal-good { background: var(--good-soft); color: var(--good); }
.seal-evil { background: var(--evil-soft); color: var(--evil); }

.dossier h2 { font-size: 2rem; }

.knowledge li { padding: 6px 0; border-top: 1px solid var(--line); }

.role-pills, .setup-quests { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }

.pill, .setup-quests li {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--bg-deep);
  font-size: 0.85rem;
}

.pill.evil { background: var(--evil-soft); }
.pill.good { background: var(--good-soft); }

.rules summary { cursor: pointer; font-weight: 560; }
.rules li { margin: 8px 0; }

.reveal li { padding: 4px 0; }
.loyalty-good { color: var(--good); }
.loyalty-evil { color: var(--evil); }

.lobby-live .seat-list { padding-left: 18px; }
.setup {
  margin: 14px 0;
  padding: 14px;
  background: var(--card);
  border-radius: 16px;
}

.barricade-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
  margin-top: 8px;
}

.barricade-board {
  position: relative;
  width: min(100%, 760px);
  aspect-ratio: 1;
  margin: 0 auto;
  background:
    radial-gradient(420px 220px at 50% 18%, rgba(255, 255, 255, 0.35), transparent 60%),
    #efe2cc;
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.barricade-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.barricade-lines line {
  stroke: rgba(36, 28, 21, 0.35);
  stroke-width: 0.12;
}

.bspace {
  position: absolute;
  width: 4.3%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(36, 28, 21, 0.35);
  background: #fbf6ee;
  transform: translate(-50%, -50%);
  padding: 0;
  display: grid;
  place-items: center;
}

button.bspace { cursor: pointer; font: inherit; color: inherit; }
.bspace.is-bottom { background: #e4d3b4; }
.bspace.is-finish {
  background: #c4a35a;
  border: 2px solid #6d431c;
}
.bspace.is-ready { box-shadow: inset 0 0 0 2px var(--brass); }
.bspace.is-selected { box-shadow: 0 0 0 3px var(--ink); }
.bspace.is-legal { box-shadow: 0 0 0 3px var(--good); background: var(--good-soft); }
.bspace.is-place { box-shadow: 0 0 0 3px var(--brass); background: var(--brass-soft); }

.bpawn {
  width: 68%;
  height: 68%;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}
.pawn-red { background: #b23b2e; }
.pawn-green { background: #2f6b45; }
.pawn-yellow { background: #e0b000; }
.pawn-blue { background: #2d5f8a; }

.btoken {
  width: 74%;
  height: 22%;
  background: #f7f3ea;
  border: 2px solid #241c15;
  border-radius: 2px;
}

.barricade-side {
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.die-face {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--line);
  font-family: "Fraunces", Palatino, serif;
  font-size: 2.2rem;
  margin: 8px 0 12px;
}

.color-dot {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: -1px;
}

.seat-row { padding: 4px 0; }
.seat-row.is-turn { font-weight: 560; }

#toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #f6f1e7;
  padding: 12px 16px;
  border-radius: 999px;
  z-index: 20;
  max-width: min(520px, calc(100% - 24px));
}

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}

@media (max-width: 860px) {
  .avalon-layout, .barricade-layout { grid-template-columns: 1fr; }
  .dossier, .barricade-side { position: static; }
}

@media (max-width: 720px) {
  .game-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .game-card:hover { transform: none; }
}
