:root {
  --bg: #fafaf7;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --border: #d7d7d2;
  --accent: #7a3b2e;
  --wolf: #9c2323;
  --god: #3b5998;
  --villager: #3f7a3f;
  --public: #e8efe7;
  --wolves-bg: #f7e2e1;
  --seer-bg: #e1eaf7;
  --witch-bg: #efe1f7;
  --guard-bg: #e3f0ef;
  --cupid-bg: #f9e3ee;
  --lovers-bg: #fceff3;
  --dead-bg: #ede7e3;
  --mono-bg: #f3efe6;
  --perform-bg: #ffffff;
  --perform-border: #aeaea8;
  --font-sans: -apple-system, "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); font-family: var(--font-sans); }
body { line-height: 1.6; }

/* Toolbar */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.tb-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.tb-row + .tb-row { margin-top: 8px; }
.tb-row-sub .tb-label, .tb-row-sub .tb-status { color: var(--muted); font-size: 13px; }
.tb-field { display: flex; align-items: center; gap: 6px; }
.tb-label { font-size: 13px; color: var(--muted); }
.tb-select, .tb-btn {
  font-family: inherit;
  font-size: 14px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
  color: var(--fg);
}
.tb-btn { cursor: pointer; background: #f1efea; }
.tb-btn:hover { background: #e7e4dc; }
.tb-hidden { display: none !important; }
.tb-status { color: var(--muted); font-size: 13px; }

/* Prod-mode credit / AI-disclaimer banner. Hidden unless server reports prod. */
.prod-banner { display: none; }
body.prod .prod-banner {
  display: block;
  max-width: 960px;
  margin: 10px auto 0;
  padding: 0 20px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
body.prod .prod-banner a { color: var(--accent); text-decoration: none; }
body.prod .prod-banner a:hover { text-decoration: underline; }
body.prod .prod-banner-sep { margin: 0 6px; }

/* Main content */
main#app {
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}
.placeholder { color: var(--muted); text-align: center; padding: 40px 0; }

/* Chronicle header */
.chronicle-header { margin-bottom: 12px; }
.chronicle-header h1 { font-size: 20px; margin: 0 0 4px; }
.view-label { color: var(--muted); font-size: 13px; }

/* Config line */
.config-line {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  margin: 12px 0 20px;
  color: var(--muted);
  font-size: 13px;
}

/* Seating */
.seating { margin-bottom: 20px; }
.seating h2 { font-size: 15px; margin: 12px 0 8px; color: var(--muted); font-weight: 600; }
.seating-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 14px;
}
.seating-table th, .seating-table td {
  padding: 6px 10px;
  border: 1px solid var(--border);
  text-align: left;
}
.seating-table th { background: #f6f3ec; font-weight: 600; }
.seating-table td.muted { color: var(--muted); }

/* Reveal table (Shape G) — inherits seating-table layout */
.reveal-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 14px;
  margin: 4px 0 12px;
}
.reveal-table th, .reveal-table td {
  padding: 6px 10px;
  border: 1px solid var(--border);
  text-align: left;
}
.reveal-table th { background: #f6f3ec; font-weight: 600; }
.reveal-table td.reveal-alive { color: #2a7b4a; font-weight: 600; }
.reveal-table td.reveal-dead { color: var(--muted); }
.reveal-table td.reveal-role .role { margin-left: 0; }
.role-prefix-wolf, .role-suffix-lover { font-size: 12px; }

/* Reveal sub-sections */
h4.reveal-sub-h {
  margin: 10px 0 4px;
  font-size: 14px;
  font-weight: 600;
}
ul.reveal-sub {
  margin: 0 0 6px 0;
  padding-left: 22px;
  font-size: 14px;
  line-height: 1.55;
}
ul.reveal-sub li { padding: 1px 0; }
.reveal-verdict-wolf { color: var(--wolf); }
.reveal-verdict-good { color: #2a7b4a; }
.reveal-action-poison { color: #b1412d; font-weight: 600; }
.reveal-action-save { color: #2a7b4a; font-weight: 600; }
.reveal-wolf-detail { font-size: 12px; }

/* Role chip */
.role {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12px;
  background: #eee;
  color: #333;
  margin-left: 4px;
}
.role-wolf { background: var(--wolf); color: #fff; }
.role-god { background: var(--god); color: #fff; }
.role-villager { background: var(--villager); color: #fff; }
.role-idiot { background: #d99a32; color: #fff; }
.role-hidden { background: transparent; color: var(--muted); }

/* First impressions */
.section-first_impressions ul.impressions {
  list-style: none;
  padding: 0;
  margin: 8px 0;
}
.section-first_impressions li {
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
}
.section-first_impressions li:last-child { border-bottom: none; }

/* Phase */
.phase { margin-top: 28px; }
.phase h2 {
  font-size: 18px;
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--accent);
  color: var(--accent);
}

/* Section */
.section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 14px;
}
.section-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.section-head h3 { font-size: 15px; margin: 0; font-weight: 600; }
.scope-chip {
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 9px;
  background: #eee;
}
.scope-chip-wolves { background: var(--wolves-bg); color: var(--wolf); }
.scope-chip-seer { background: var(--seer-bg); color: var(--god); }
.scope-chip-witch { background: var(--witch-bg); color: #6b3d8d; }
.scope-chip-guard { background: var(--guard-bg); color: #2d6b60; }
.scope-chip-cupid { background: var(--cupid-bg); color: #b24a74; }
.scope-chip-lovers { background: var(--lovers-bg); color: #b24a74; }
.scope-chip-dead { background: var(--dead-bg); color: #666; }
.scope-chip-mixed { background: #f0ebdd; color: #7a6a3b; }

.section.scope-wolves { background: #fcf4f3; }
.section.scope-seer { background: #f4f7fc; }
.section.scope-witch { background: #f7f4fc; }
.section.scope-guard { background: #f3f8f7; }
.section.scope-cupid { background: #fcf3f7; }
.section.scope-lovers { background: #fdf5f8; }
.section.scope-dead { background: #f5f1ee; }

/* Entry */
.entry { padding: 8px 0; border-top: 1px dashed var(--border); }
.entry:first-of-type { border-top: 0; }
.speaker {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  font-size: 14px;
  margin-bottom: 4px;
}
.speaker-seat {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  background: #f4f1ea;
  padding: 1px 6px;
  border-radius: 3px;
}
.speaker-name { font-weight: 600; }
.entry-label { color: var(--muted); font-size: 13px; }
.vote-target { color: var(--muted); font-size: 13px; margin-left: 4px; }

/* Monologue */
details.monologue {
  background: var(--mono-bg);
  border-left: 3px solid #bfa989;
  padding: 4px 10px;
  margin: 4px 0;
  border-radius: 0 4px 4px 0;
}
details.monologue summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  list-style: none;
  user-select: none;
}
details.monologue summary::before {
  content: '▸';
  display: inline-block;
  width: 1em;
  color: #a8946b;
  transition: transform 0.15s;
}
details.monologue[open] summary::before {
  content: '▾';
}
details.monologue .mono-body {
  padding-top: 4px;
  padding-left: 1em;
  font-size: 13px;
  color: #444;
}
details.monologue .mono-line {
  white-space: pre-wrap;
  margin: 2px 0;
}

/* Perform block (speech) */
blockquote.perform {
  background: var(--perform-bg);
  border-left: 3px solid var(--perform-border);
  padding: 6px 12px;
  margin: 4px 0;
  font-size: 14px;
}
blockquote.perform .perform-line {
  white-space: pre-wrap;
  margin: 2px 0;
}

/* Events */
.event {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 2px 0;
  font-size: 14px;
}
.event-bullet { color: var(--muted); }
.event-text { flex: 1; }
.event-peaceful_night .event-text { color: #3f7a3f; }
.event-final_deaths .event-text { color: var(--wolf); font-weight: 500; }
.event-heartbreak .event-text { color: #b24a74; }
.event-detonate .event-text { color: var(--wolf); }
.event-idiot_reveal .event-text { color: #d99a32; }
.event-endgame_result .event-text { color: var(--accent); font-weight: 600; }
.event-sheriff_auto_elected .event-text { color: var(--god); font-weight: 500; }
.event-sheriff_no_election .event-text { color: var(--muted); font-style: italic; }
.check-wolf { color: var(--wolf); font-weight: 600; }
.check-not_wolf { color: var(--villager); font-weight: 600; }

.seat-ref { font-weight: 500; }
.seat-ref .seat-num { color: var(--muted); font-size: 12px; }

/* Vote block */
.vote-block { margin-top: 8px; }
.vote-detail-table {
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 13px;
}
.vote-detail-table td {
  padding: 2px 8px;
  vertical-align: middle;
}
.vote-detail-table .arrow { color: var(--muted); }
.vote-detail-table .abstain { color: var(--muted); font-style: italic; }
.vote-block .tally { font-size: 13px; color: #444; margin: 4px 0; }
.vote-block .result { margin-top: 4px; }
.vote-result { font-size: 14px; }
.vr-lynched, .vr-pk_eliminated { color: var(--wolf); }
.vr-sheriff_elected, .vr-sheriff_pk_winner { color: var(--god); }

.wolf-vote-result { margin-top: 4px; font-size: 14px; color: var(--wolf); }
