/* Secret Hitler online. Mobile first: big targets, one main thing per screen. */

:root {
  --paper: #efece3;
  --paper-deep: #e2ddd0;
  --ink: #232a28;
  --muted: #5f6d69;
  --felt: #1d4b43;
  --felt-light: #2a6357;
  --liberal: #2f6fa5;
  --liberal-pale: #d6e4f0;
  --fascist: #a8382b;
  --fascist-pale: #f1d9d4;
  --brass: #c89b2c;
  --danger: #a8382b;
  --radius-big: 14px;
  --radius-small: 6px;
  --tap: 56px;
  --heading: "Rockwell", "Roboto Slab", "Zilla Slab", "DejaVu Serif", Georgia, serif;
  --text: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-height: 68px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.45 var(--text);
}

h1, h2, h3 {
  font-family: var(--heading);
  line-height: 1.15;
  margin: 0 0 0.5em;
}
h1 { font-size: 2rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 0.8em; }
a { color: var(--felt); }

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

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ------------------------------------------------------------ buttons */

button, .button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: var(--tap);
  padding: 0.6em 1.2em;
  border: 2px solid var(--felt);
  border-radius: var(--radius-big);
  background: var(--felt);
  color: var(--paper);
  font: 600 1.1rem/1.2 var(--text);
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
button:disabled { opacity: 0.45; cursor: default; }
button.secondary, .button.secondary { background: transparent; color: var(--felt); }
button.quiet {
  min-height: 44px;
  border-color: transparent;
  background: transparent;
  color: var(--felt);
  font-weight: 500;
  text-decoration: underline;
}
button.wide, .button.wide { width: 100%; }
button.danger { background: var(--danger); border-color: var(--danger); }

.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

input[type="text"], select {
  width: 100%;
  min-height: var(--tap);
  padding: 0 14px;
  border: 2px solid var(--muted);
  border-radius: var(--radius-big);
  background: #fff;
  color: var(--ink);
  font: 1.15rem var(--text);
}
label { display: block; font-weight: 600; margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 0.95rem; }

/* ------------------------------------------------------------- screens */

.screen {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 18px calc(var(--nav-height) + 28px);
}
.screen.no-nav { padding-bottom: 32px; }

.home {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  text-align: center;
}
.home h1 { font-size: 2.6rem; }
.home .lead { font-size: 1.15rem; color: var(--muted); }

/* Top banner: what is happening now. */
.banner {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 12px 18px;
  background: var(--felt);
  color: var(--paper);
  font-family: var(--heading);
  font-size: 1.15rem;
  text-align: center;
}

/* Bottom tab bar. */
.tabs {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 5;
  display: flex;
  height: calc(var(--nav-height) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--paper-deep);
  border-top: 1px solid #c9c2b1;
}
.tabs a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}
.tabs a .icon { font-size: 1.5rem; line-height: 1; }
.tabs a[aria-current="page"] { color: var(--felt); }
.tabs a[aria-current="page"] .icon {
  background: var(--paper);
  border-radius: 999px;
  padding: 3px 16px;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-height) + 18px);
  z-index: 10;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: var(--radius-big);
  background: var(--ink);
  color: var(--paper);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
#toast.shown { opacity: 1; transform: translate(-50%, 0); }

.empty { color: var(--muted); text-align: center; padding: 32px 0; }

/* ------------------------------------------------------------- lobby */

.seats {
  list-style: none;
  counter-reset: seat;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.seat-row {
  counter-increment: seat;
  display: flex;
  align-items: center;
  gap: 8px;
}
.seat-row::before {
  content: counter(seat);
  width: 1.6em;
  text-align: right;
  color: var(--muted);
  font-family: var(--heading);
}
.seat-row .seat-name {
  flex: 1;
  justify-content: flex-start;
  background: #fff;
  color: var(--ink);
  border-color: var(--paper-deep);
}
.seat-row .arrow { width: var(--tap); padding: 0; flex: none; }
.count { text-align: center; color: var(--muted); margin: 0; }
.count.ready { color: var(--felt); font-weight: 600; }

/* ------------------------------------------------------------- table */

.circle { width: 100%; max-width: 440px; display: block; margin: 0 auto; }
.circle .felt { fill: var(--felt); }
.circle .felt-inner { fill: var(--felt-light); }
.circle .pill { fill: var(--paper); stroke: var(--paper-deep); stroke-width: 2; }
.circle .name { text-anchor: middle; font: 600 15px var(--text); fill: var(--ink); }
.circle .president .pill, .circle .chancellor .pill { stroke: var(--brass); stroke-width: 4; }
.circle .limited .pill { stroke: var(--muted); stroke-dasharray: 5 4; fill: var(--paper-deep); }
.circle .dead .pill { fill: #7d8582; stroke: #7d8582; }
.circle .dead .name { fill: #e6e6e6; }
.circle .strike { stroke: var(--paper); stroke-width: 2; }
.circle .role-liberal .pill { fill: var(--liberal-pale); stroke: var(--liberal); stroke-width: 3; }
.circle .role-fascist .pill, .circle .role-hitler .pill {
  fill: var(--fascist-pale); stroke: var(--fascist); stroke-width: 3;
}
.circle .badge { fill: var(--brass); stroke: var(--paper); stroke-width: 2; }
.circle .badge.hitler { fill: var(--fascist); }
.circle .badge-text { text-anchor: middle; font: 700 13px var(--text); fill: #fff; }
.circle .voted { fill: var(--brass); stroke: var(--paper); stroke-width: 2; }
.circle .ja { fill: var(--paper); stroke: var(--felt); stroke-width: 2; }
.circle .nein { fill: var(--ink); }
.circle .vote-text { text-anchor: middle; font: 700 13px var(--text); fill: var(--felt); }
.circle .nein + .vote-text { fill: var(--paper); }
.circle .tracker { fill: none; stroke: var(--paper); stroke-width: 2; opacity: 0.7; }
.circle .tracker.on { fill: var(--brass); stroke: var(--brass); opacity: 1; }
.circle .centre-label { text-anchor: middle; font: 600 14px var(--text); fill: var(--paper); }
.circle .centre-label.small { font-size: 12px; font-weight: 400; opacity: 0.85; }
.circle-legend { text-align: center; margin: 8px 0 0; }

.tracks h3 { margin: 18px 0 8px; }
.track { display: grid; gap: 6px; }
.track.liberal { grid-template-columns: repeat(5, 1fr); }
.track.fascist { grid-template-columns: repeat(6, 1fr); }
.slot {
  aspect-ratio: 3 / 4;
  display: grid;
  place-items: center;
  border-radius: var(--radius-small);
  border: 2px dashed #b9b19f;
  font-size: 1.3rem;
}
.track.liberal .slot { background: var(--liberal-pale); }
.track.fascist .slot { background: var(--fascist-pale); }
.track .slot.hitler-zone { border-color: var(--fascist); }
.slot.filled { border-style: solid; }
.slot.filled.liberal { background: var(--liberal); border-color: var(--liberal); }
.slot.filled.fascist { background: var(--fascist); border-color: var(--fascist); }
.legend { list-style: none; padding: 0; margin: 10px 0 0; color: var(--muted); font-size: 0.95rem; }
.legend li { margin: 2px 0; }

@media (min-width: 900px) {
  .table-view {
    max-width: 1200px;
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 40px;
    align-items: start;
  }
}

/* -------------------------------------------------------------- play */

.player-button { justify-content: space-between; }
.player-button.dead { opacity: 0.55; text-decoration: line-through; }
.tag {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--brass);
  color: var(--ink);
  font-size: 0.85rem;
}
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.panel-head h2 { margin: 0; overflow-wrap: anywhere; }

.action {
  padding: 18px;
  border: 3px solid var(--brass);
  border-radius: var(--radius-big);
  background: #fff;
}
.action h3, .vote-box h3 { margin: 0; }
.vote-box { padding: 4px 0; }
.waiting { padding: 18px; border-radius: var(--radius-big); background: var(--paper-deep); text-align: center; }
.warning { padding: 12px 14px; border-left: 5px solid var(--brass); background: #fff; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { min-height: 64px; overflow-wrap: anywhere; }
.choice.chosen { background: var(--brass); border-color: var(--brass); color: var(--ink); }

.ballots { gap: 14px; }
.ballot {
  min-height: 84px;
  font: 700 1.6rem var(--heading);
  background: #fff;
  color: var(--ink);
  border: 3px solid var(--paper-deep);
}
.ballot.ja.marked { background: var(--felt); border-color: var(--felt); color: var(--paper); }
.ballot.nein.marked { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.ballot.marked::after { content: "✓"; font-size: 1.1rem; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.policy {
  aspect-ratio: 3 / 4;
  min-height: 0;
  padding: 6px;
  border-radius: var(--radius-small);
  font: 700 1rem var(--heading);
  color: #fff;
  text-transform: capitalize;
}
.policy:disabled { opacity: 1; }
.policy.liberal { background: var(--liberal); border-color: var(--liberal); }
.policy.fascist { background: var(--fascist); border-color: var(--fascist); }
.policy.chosen { outline: 5px solid var(--brass); outline-offset: 3px; transform: translateY(-6px); }
.notes .cards { margin-top: 8px; }

.role-card {
  padding: 26px 22px;
  border-radius: var(--radius-big);
  color: #fff;
  text-align: center;
}
.role-card.liberal { background: var(--liberal); }
.role-card.fascist { background: var(--fascist); }
.role-card.hitler { background: #6d1f17; }
.role-card .role-owner { opacity: 0.85; }
.role-card .role-name { font: 700 2.8rem/1.1 var(--heading); margin: 6px 0 14px; }
.role-card h3 { margin-top: 18px; }
.team { list-style: none; padding: 0; margin: 0; font-size: 1.15rem; }

.notes { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.note { padding: 14px; border-radius: var(--radius-big); background: #fff; }
.note.liberal { border-left: 6px solid var(--liberal); }
.note.fascist { border-left: 6px solid var(--fascist); }

/* ----------------------------------------------------------- history */

.role-views ul, .timeline, .timeline ul { list-style: none; margin: 0; padding: 0; }
.role-views li { padding: 10px 0; border-bottom: 1px solid var(--paper-deep); }
.role-views li.several { padding: 10px 12px; border-left: 5px solid var(--brass); background: #fff; }
.timeline > li { padding: 12px 0; border-top: 2px solid var(--paper-deep); }
.timeline h3 { margin-bottom: 6px; }
.timeline ul li { padding: 4px 0; }
.timeline .minor { color: var(--muted); font-size: 0.95rem; }
.timeline .end { font-size: 1.1rem; }
.chip {
  display: inline-block;
  padding: 0 10px;
  border-radius: 999px;
  color: #fff;
  font-weight: 600;
  text-transform: capitalize;
}
.chip.liberal { background: var(--liberal); }
.chip.fascist { background: var(--fascist); }

/* -------------------------------------------------------------- more */

.qr { display: block; width: min(240px, 70vw); height: auto; margin: 0 auto; background: #fff; border-radius: var(--radius-small); }
.link { margin: 0; text-align: center; overflow-wrap: anywhere; color: var(--muted); font-size: 0.95rem; }
hr { width: 100%; border: 0; border-top: 2px solid var(--paper-deep); margin: 10px 0; }
.language { margin-top: 24px; }
.language select { min-height: 48px; font-size: 1rem; }

/* A device lying in the middle of the table: the board only. */
.table-mode .screen { padding-bottom: 32px; }
.table-mode .exit-table-mode { display: block; margin: 16px auto 0; }
@media (min-width: 900px) {
  .table-mode .banner { font-size: 1.6rem; padding: 18px; }
}

/* ---------------------------------------------------------- game over */

.result {
  grid-column: 1 / -1;
  padding: 24px 20px;
  border-radius: var(--radius-big);
  color: #fff;
  text-align: center;
  animation: arrive 0.5s ease-out;
}
.result.liberal { background: var(--liberal); }
.result.fascist { background: var(--fascist); }
.result h1 { font-size: 2.4rem; }
.result .roles-legend { opacity: 0.9; font-size: 0.95rem; }
.result button { background: var(--paper); color: var(--ink); border-color: var(--paper); margin-top: 8px; }
@keyframes arrive { from { transform: scale(0.92); opacity: 0; } to { transform: none; opacity: 1; } }
.circle .dead[class*="role-"] .name { fill: var(--ink); opacity: 0.7; }
.circle .dead[class*="role-"] .strike { stroke: var(--ink); }

/* ------------------------------------------------------------- rules */

.rules .back { align-self: flex-start; padding-left: 0; }
.rules .lead { color: var(--muted); }
.rule { border-radius: var(--radius-big); background: #fff; }
.rule summary {
  min-height: var(--tap);
  display: flex;
  align-items: center;
  padding: 0 18px;
  font: 700 1.2rem var(--heading);
  cursor: pointer;
  list-style: none;
}
.rule summary::-webkit-details-marker { display: none; }
.rule summary::after { content: "+"; margin-left: auto; font-size: 1.6rem; color: var(--felt); }
.rule[open] summary::after { content: "−"; }
.rule img { display: block; width: 100%; max-width: 320px; height: auto; margin: 0 auto; padding: 0 18px; }
.rule ul { margin: 12px 0 0; padding: 0 18px 18px 38px; }
.rule li { margin-bottom: 8px; }
