:root {
  color-scheme: dark;
  --bg: #1c1814;
  --bg-raise: #2a241e;
  --ink: #f3ead8;
  --muted: #c4b8a4;
  --line: #4a4034;
  --accent: #c9a227;
  --accent-ink: #1c1814;
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at top, #3a3228 0%, var(--bg) 55%),
    var(--bg);
  color: var(--ink);
}

.page {
  max-width: 40rem;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

.page--wide {
  max-width: 68rem;
}

.kicker {
  margin: 0 0 0.35rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--accent);
  font-family: ui-sans-serif, system-ui, sans-serif;
}

h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  font-weight: 600;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}

.brand-mark {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 0.7rem;
  flex-shrink: 0;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--line);
}

.brand--compact {
  margin: 0 0 0.65rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.brand--compact .brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 0.4rem;
}

h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}

h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.lede,
.how p,
.card p {
  color: var(--muted);
  line-height: 1.5;
}

.lede {
  margin: 0;
  font-size: 1.15rem;
}

.how,
.actions {
  margin-top: 2.5rem;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.actions > h2 {
  margin-bottom: 0;
}

ol {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--muted);
  line-height: 1.55;
}

.note {
  margin: 1rem 0 0;
  font-size: 0.95rem;
}

.status {
  margin: 0;
  color: var(--accent);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.9rem;
}

.status:empty {
  display: none;
}

.nickname-field {
  margin: 0;
}

.cards {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .cards {
    grid-template-columns: 1fr 1fr;
  }
}

.card {
  margin: 0;
  padding: 1.15rem 1.15rem 1.25rem;
  background: var(--bg-raise);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.85rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  color: var(--muted);
}

input {
  font: inherit;
  font-family: ui-sans-serif, system-ui, sans-serif;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
}

input:invalid:not(:placeholder-shown):not(:focus) {
  border-color: #c45c3a;
}

.input-code {
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

button {
  margin-top: auto;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.95rem;
  padding: 0.6rem 0.9rem;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  cursor: pointer;
}

button:hover,
button:focus-visible {
  filter: brightness(1.08);
}

button[hidden] {
  display: none;
}

.lobby h2 {
  margin-bottom: 0.35rem;
}

.player-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  line-height: 1.7;
  min-height: 1.7em;
}

.team-row {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
}

.lobby .team-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.team-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 2rem;
}

.team-row-head h3 {
  margin: 0;
}

.team-join {
  margin-top: 0;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
}

.team-empty {
  font-style: italic;
  opacity: 0.65;
}

.team-row--selected {
  background: rgb(201 162 39 / 8%);
  margin: 0 -0.5rem;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  border-radius: 6px;
}

button:disabled,
button:disabled:hover,
button:disabled:focus-visible {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}

.note a {
  color: var(--accent);
}

.game {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 840px) {
  .game {
    grid-template-columns: minmax(18rem, 32rem) minmax(12rem, 1fr);
    align-items: start;
  }
}

.board-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.turn-indicator {
  margin: 0;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.turn-indicator--waiting {
  color: var(--accent);
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.captured {
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 0.65rem;
  margin: 0;
  min-height: 1.35em;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.captured-name {
  font-size: 0.8rem;
  color: var(--muted);
}

.captured-pieces {
  font-size: 1.2rem;
  letter-spacing: 0.08em;
  line-height: 1;
}

.captured--w .captured-pieces {
  color: #f3ead8;
}

.captured--b .captured-pieces {
  color: #9a8f7c;
}

.board-wrap {
  position: relative;
  width: min(100%, 32rem);
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  padding: 1rem;
  text-align: center;
  background: rgb(28 24 20 / 82%);
  border-radius: 8px;
}

.game-overlay h2 {
  margin: 0;
}

.game-overlay p {
  margin: 0;
  color: var(--muted);
}

.button-secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  align-self: flex-start;
}

.history-empty,
.you-are {
  margin: 0;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.9rem;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-family: ui-sans-serif, system-ui, sans-serif;
  color: var(--muted);
}

.history-scroll {
  overflow-x: auto;
}

.history-table th,
.history-table td {
  text-align: left;
  padding: 0.25rem 0.45rem 0.25rem 0;
  font-weight: 400;
  vertical-align: middle;
}

.history-table thead th {
  color: var(--ink);
  font-weight: 600;
  font-size: 0.85rem;
}

.history-table thead th:first-child,
.history-table .history-num {
  width: 2.4rem;
}

.history-num {
  color: var(--accent);
}

.candidate {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
}

.candidate--picked {
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent);
}

.candidate--mine {
  color: var(--ink);
  background: rgb(93 173 226 / 22%);
}

.candidate--pending {
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.you-are {
  margin-top: 0.75rem;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.history-head h2 {
  margin: 0;
}

.history-sort {
  margin-top: 0;
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
}
