:root {
  --bg: #e4e9e5;
  --surface: #fbfdfb;
  --surface-2: #e6eee7;
  --ink: #142019;
  --muted: #5c6c61;
  --line: #223128;
  --light-square: #e6edd1;
  --dark-square: #78a46f;
  --selected: #f1c84b;
  --last-action-light-tint: rgba(239, 219, 92, .76);
  --last-action-dark-tint: rgba(239, 219, 92, .52);
  --move-indicator: #5f6a64;
  --money: #16884a;
  --white-piece: #fffdf7;
  --black-piece: #151815;
  --focus: rgba(36, 134, 74, .28);
  --side-rail: 48px;
  --gap: 6px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
summary {
  font: inherit;
}

button,
summary {
  cursor: pointer;
}

.app {
  width: min(1180px, 100%);
  height: 100dvh;
  margin: 0 auto;
  padding: 8px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  overflow: hidden;
}

.top-bar,
.bottom-bar {
  width: 100%;
  border: 1px solid rgba(34, 49, 40, .16);
  border-radius: 8px;
  background: rgba(246, 248, 246, .94);
  box-shadow: 0 4px 14px rgba(20, 32, 25, .05);
}

.top-bar {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 7px;
}

.brand h1,
.wordmark {
  margin: 0;
  font-family: ui-rounded, "SF Pro Rounded", "Avenir Next Rounded", "Arial Rounded MT Bold", system-ui, sans-serif;
  font-size: 1.08rem;
  line-height: .95;
  letter-spacing: 0;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 950;
  text-rendering: geometricPrecision;
}

.pickle-word,
.chess-word {
  display: inline-block;
}

.pickle-word {
  color: #24864a;
  font-weight: 1000;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .5);
}

.pickle-word span {
  display: inline-block;
  transform-origin: 50% 78%;
}

.pickle-word span:nth-child(4) { transform: rotate(-10deg); }

.chess-word {
  margin-left: 1px;
  color: var(--ink);
  font-size: .96em;
  font-weight: 900;
}

.room-actions,
.game-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.room-actions {
  flex: 1;
  justify-content: center;
}

.game-actions {
  justify-content: flex-end;
}

.btn,
.icon-btn,
.rules-menu summary,
.action-menu summary {
  min-height: 31px;
  border: 1px solid rgba(34, 49, 40, .62);
  border-radius: 7px;
  padding: 4px 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: .86rem;
  font-weight: 850;
  transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, opacity .12s ease;
}

.btn.primary {
  background: #f3cd55;
}

.btn:not(:disabled):hover,
.icon-btn:not(:disabled):hover,
.rules-menu summary:hover,
.action-menu summary:hover {
  border-color: rgba(34, 49, 40, .78);
  background: #f7f9f6;
}

.btn.primary:not(:disabled):hover,
.btn.new-game-action:not(:disabled):hover {
  background: #efc64e;
}

.btn.compact {
  padding-inline: 7px;
}

.btn.danger {
  border-color: rgba(124, 62, 47, .62);
  color: #7c3e2f;
}

.btn.new-game-action {
  border-color: rgba(34, 49, 40, .72);
  background: #f3cd55;
  box-shadow: 0 2px 0 rgba(34, 49, 40, .18);
  color: var(--ink);
  font-weight: 950;
}

.btn:disabled,
.icon-btn:disabled,
.menu-action:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.btn:focus-visible,
.icon-btn:focus-visible,
.rules-menu summary:focus-visible,
.action-menu summary:focus-visible,
.shop-button:focus-visible,
.square:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.icon-btn,
.rules-menu summary,
.action-menu summary {
  width: 31px;
  padding: 0;
  display: grid;
  place-items: center;
}

.room-input {
  width: 72px;
  height: 31px;
  min-width: 0;
  border: 1px solid rgba(34, 49, 40, .45);
  border-radius: 7px;
  padding: 4px 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: .86rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-align: center;
  text-transform: uppercase;
  transition: border-color .12s ease, box-shadow .12s ease, background-color .12s ease;
}

.room-input::placeholder {
  color: rgba(92, 108, 97, .78);
}

.room-input:focus {
  border-color: rgba(36, 134, 74, .62);
  box-shadow: 0 0 0 3px var(--focus);
  outline: 0;
}

.budget-control {
  height: 31px;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(34, 49, 40, .45);
  border-radius: 7px;
  padding: 3px 5px;
  background: var(--surface);
}

.budget-control span {
  color: var(--muted);
  font-size: .62rem;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.budget-control input {
  width: 38px;
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--money);
  font-weight: 950;
  text-align: center;
}

.budget-control input:focus {
  outline: 0;
}

.rules-menu,
.action-menu {
  position: relative;
}

.rules-menu summary,
.action-menu summary {
  list-style: none;
}

.rules-menu summary::-webkit-details-marker,
.action-menu summary::-webkit-details-marker {
  display: none;
}

.rules {
  display: none;
  position: absolute;
  right: 0;
  top: 38px;
  z-index: 20;
  width: min(284px, calc(100vw - 20px));
  margin: 0;
  padding: 12px 14px 12px 28px;
  border: 1px solid rgba(34, 49, 40, .2);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 16px 34px rgba(20, 32, 25, .16);
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.35;
}

.rules-menu[open] .rules {
  display: block;
}

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(20, 32, 25, .24);
  backdrop-filter: blur(3px);
}

.settings-overlay.is-hidden {
  display: none;
}

.settings-panel {
  width: min(440px, 100%);
  max-height: min(620px, calc(100dvh - 36px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(34, 49, 40, .18);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 22px 54px rgba(20, 32, 25, .26);
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 12px 8px 16px;
  border-bottom: 1px solid rgba(34, 49, 40, .1);
}

.settings-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 950;
  line-height: 1.05;
}

.settings-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 720;
}

.settings-play-btn {
  min-width: 66px;
}

.settings-body {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  overflow: hidden auto;
}

.settings-defaults {
  min-height: 22px;
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 780;
  line-height: 1.28;
}

.settings-advanced {
  min-width: 0;
}

.settings-advanced summary {
  width: max-content;
  list-style: none;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 850;
}

.settings-advanced summary::-webkit-details-marker {
  display: none;
}

.settings-advanced summary::before {
  content: ">";
  display: inline-block;
  margin-right: 5px;
  transition: transform .12s ease;
}

.settings-advanced[open] summary::before {
  transform: rotate(90deg);
}

.settings-fields {
  display: grid;
  gap: 14px;
  padding-top: 12px;
}

.settings-field {
  min-width: 0;
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  border: 0;
}

.settings-field > span,
.settings-field legend {
  padding: 0;
  color: var(--ink);
  font-size: .78rem;
  font-weight: 900;
}

.settings-field input[type="text"] {
  width: 92px;
  min-height: 36px;
  border: 1px solid rgba(34, 49, 40, .3);
  border-radius: 7px;
  padding: 5px 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 950;
  text-align: center;
  transition: border-color .12s ease, background-color .12s ease;
}

.settings-field input[type="text"]:focus {
  border-color: rgba(34, 49, 40, .65);
  background: #fff;
  outline: 0;
}

.settings-time-field {
  gap: 9px;
}

.settings-time-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

.time-input-group {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.time-input-group span {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 850;
}

.time-input-group input[type="text"] {
  width: 86px;
  min-height: 34px;
  font-size: 1rem;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.segmented-control label {
  min-width: 0;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(34, 49, 40, .28);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .78rem;
  font-weight: 850;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease;
}

.segmented-control input:checked + span {
  border-color: rgba(34, 49, 40, .65);
  background: #f3cd55;
  color: var(--ink);
}

.segmented-control input:focus-visible + span {
  box-shadow: 0 0 0 3px var(--focus);
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(34, 49, 40, .1);
}

.game-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: var(--side-rail) minmax(0, auto) var(--side-rail);
  gap: var(--gap);
  align-items: center;
  justify-content: center;
}

.board-column {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
}

.board-frame {
  width: min(
    calc(100vw - 16px - (2 * var(--side-rail)) - (2 * var(--gap))),
    calc((100dvh - 146px) * 5 / 6),
    560px
  );
  aspect-ratio: 5 / 6;
}

.board {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(0, 1fr));
  border: 3px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(20, 32, 25, .18);
}

.square {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 0;
  display: grid;
  place-items: center;
  padding: 0;
  font-weight: 900;
}

.square.light { background: var(--light-square); }
.square.dark { background: var(--dark-square); }
.square.shop-target { background: var(--selected); }
.square.light.last-action { background: linear-gradient(var(--last-action-light-tint), var(--last-action-light-tint)), var(--light-square); }
.square.dark.last-action { background: linear-gradient(var(--last-action-dark-tint), var(--last-action-dark-tint)), var(--dark-square); }

.square.legal-move::after,
.square.legal-capture::after,
.square.king-capture::after,
.square.placement::after {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 8px;
  pointer-events: none;
}

.square.legal-move::after,
.square.legal-capture::after,
.square.king-capture::after,
.square.placement::after {
  border: 4px dashed var(--move-indicator);
}

.square:focus-visible {
  outline-offset: -3px;
  z-index: 1;
}

.piece {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  line-height: 1;
  user-select: none;
  contain: strict;
}

.piece-icon {
  display: block;
  width: 96%;
  height: 96%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.coord {
  position: absolute;
  left: 4px;
  bottom: 3px;
  color: rgba(20, 32, 25, .5);
  font-size: .52rem;
  font-weight: 900;
}

.player-rail,
.choice-panel {
  width: var(--side-rail);
  height: min(
    calc((100vw - 16px - (2 * var(--side-rail)) - (2 * var(--gap))) * 6 / 5),
    calc(100dvh - 146px),
    672px
  );
  min-height: 0;
}

.player-rail {
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 8px;
}

.player-card {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  border-radius: 8px;
  color: var(--muted);
  overflow: hidden;
}

.player-card:first-child {
  justify-content: flex-start;
}

.player-card:last-child {
  justify-content: flex-end;
}

.player-heading {
  min-width: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.player-card:last-child .player-heading {
  flex-direction: column-reverse;
}

.player-color {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  overflow: hidden;
  border: 1px solid rgba(34, 49, 40, .32);
  border-radius: 50%;
  box-shadow:
    0 1px 2px rgba(20, 32, 25, .18),
    inset 0 1px 0 rgba(255, 255, 255, .55);
}

.player-color[data-side="white"] {
  background: linear-gradient(145deg, #fffef7, #e4e8df);
}

.player-color[data-side="black"] {
  background: linear-gradient(145deg, #343b36, #111713);
  border-color: rgba(20, 32, 25, .45);
  box-shadow:
    0 1px 2px rgba(20, 32, 25, .22),
    inset 0 1px 0 rgba(255, 255, 255, .12);
}

.budget-value {
  flex: 0 0 auto;
  min-height: 17px;
  color: var(--money);
  font-size: .78rem;
  font-weight: 900;
  text-align: center;
}

.clock-value {
  flex: 0 0 auto;
  min-height: 17px;
  color: var(--ink);
  font-size: .76rem;
  font-weight: 900;
  line-height: 1.05;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.clock-value.is-running {
  color: #24342a;
}

.clock-value.is-low {
  color: #8b5e13;
}

.clock-value.is-critical {
  color: #9d3327;
}

.money::before,
.shop-cost::before {
  content: "$";
  color: var(--muted);
  font-weight: 800;
}

.budget-value .money,
.budget-value .money::before,
.choice-meta .money,
.choice-meta .money::before {
  color: var(--money);
}

.captured-strip {
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  overflow: hidden auto;
  scrollbar-width: none;
}

.player-card:last-child .captured-strip {
  flex-direction: column-reverse;
}

.captured-strip::-webkit-scrollbar {
  display: none;
}

.mini-piece {
  flex: 0 0 auto;
  width: 28px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: rgba(251, 253, 251, .76);
  line-height: 1;
}

.mini-piece .piece-icon {
  width: 24px;
  height: 24px;
}

.choice-panel {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  transition: opacity .12s ease, visibility .12s ease;
}

.choice-panel.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.shop {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: hidden auto;
  scrollbar-width: thin;
}

.shop-button {
  position: relative;
  flex: 0 0 48px;
  min-width: 0;
  height: 48px;
  min-height: 48px;
  display: grid;
  place-items: start center;
  border: 1px solid rgba(34, 49, 40, .38);
  border-radius: 8px;
  padding: 4px 3px 12px;
  background: var(--surface);
  color: var(--ink);
  transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, opacity .12s ease;
}

.shop-button:not(:disabled):hover,
.shop-button:not(:disabled):focus-visible {
  border-color: var(--line);
  box-shadow: 0 0 0 2px rgba(34, 49, 40, .08);
}

.shop-button:disabled {
  cursor: not-allowed;
  opacity: .42;
}

.shop-button.unavailable,
.shop-button.invalid-target {
  background: var(--surface-2);
}

.shop-button.selected {
  outline: 3px solid var(--selected);
  outline-offset: -3px;
}

.shop-symbol {
  width: 86%;
  height: calc(100% - 8px);
  display: grid;
  place-items: center;
  line-height: 1;
}

.shop-symbol .piece-icon {
  width: 100%;
  height: 100%;
}

.shop-cost {
  position: absolute;
  right: 4px;
  bottom: 3px;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 900;
}

.setup-action {
  background: #f4f1df;
  border-color: rgba(116, 104, 58, .56);
}

.setup-action-mark {
  margin-top: 3px;
  color: #74683a;
  font-size: 1.45rem;
  font-weight: 950;
  line-height: 1;
}

.setup-action-label {
  position: absolute;
  bottom: 2px;
  display: grid;
  gap: 0;
  color: #74683a;
  font-size: .48rem;
  font-weight: 900;
  line-height: .92;
  text-transform: uppercase;
}

.bottom-bar {
  min-height: 38px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
}

.bottom-bar.log-empty {
  grid-template-columns: minmax(0, 1fr) auto;
}

.bottom-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.bottom-actions .btn {
  white-space: nowrap;
}

.action-menu-popover {
  position: absolute;
  right: 0;
  bottom: 38px;
  z-index: 25;
  width: 136px;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(34, 49, 40, .2);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 16px 34px rgba(20, 32, 25, .18);
}

.action-menu:not([open]) .action-menu-popover {
  display: none;
}

.menu-action {
  min-height: 31px;
  border: 0;
  border-radius: 6px;
  padding: 5px 8px;
  background: transparent;
  color: var(--ink);
  font-size: .82rem;
  font-weight: 850;
  text-align: left;
  transition: background-color .12s ease, color .12s ease, opacity .12s ease;
}

.menu-action:not(:disabled):hover,
.menu-action:not(:disabled):focus-visible {
  background: var(--surface-2);
}

.menu-action:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.menu-action.danger {
  color: #7c3e2f;
}

.status-card {
  min-width: 108px;
  max-width: min(48vw, 260px);
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  align-items: center;
  column-gap: 6px;
}

.bottom-bar.log-empty .status-card {
  max-width: min(100%, 540px);
}

.status-icon {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(92, 108, 97, .14);
  box-shadow: inset 0 0 0 1.5px rgba(92, 108, 97, .38);
}

.status-active .status-icon {
  background: #2e8350;
  box-shadow: 0 0 0 2px rgba(46, 131, 80, .16);
}

.status-problem .status-icon {
  background: #b65a3f;
  box-shadow: 0 0 0 2px rgba(182, 90, 63, .18);
}

.status-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.status-main {
  color: var(--ink);
  font-size: .86rem;
  font-weight: 900;
  line-height: 1.05;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-sub {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 760;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rejoin-panel {
  grid-column: 2;
  display: flex;
  gap: 4px;
  margin-top: 3px;
}

.rejoin-seat {
  min-height: 24px;
  padding: 2px 6px;
  font-size: .68rem;
}

.log-tape {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: auto hidden;
  white-space: nowrap;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .84rem;
  line-height: 1.15;
  scrollbar-width: none;
}

.log-tape::-webkit-scrollbar {
  display: none;
}

.tape-entry {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
}

.notation-action {
  display: inline-flex;
  align-items: center;
  gap: 1px;
}

.notation-action + .notation-action {
  margin-left: .48em;
}

.notation-piece {
  width: 1.15em;
  height: 1.15em;
  display: inline-grid;
  place-items: center;
  vertical-align: -.18em;
}

.notation-piece-icon {
  display: block;
  width: 1.15em;
  height: 1.15em;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

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

@media (min-width: 760px) {
  :root {
    --side-rail: 76px;
    --gap: 10px;
  }

  .app {
    padding: 14px;
    gap: 12px;
  }

  .top-bar,
  .bottom-bar {
    width: min(920px, 100%);
    justify-self: center;
  }

  .brand h1 {
    font-size: 1.35rem;
  }

  .board-frame {
    width: min(
      calc(100vw - 28px - (2 * var(--side-rail)) - (2 * var(--gap))),
      calc((100dvh - 158px) * 5 / 6),
      560px
    );
  }

  .player-rail,
  .choice-panel {
    height: min(
      calc((100vw - 28px - (2 * var(--side-rail)) - (2 * var(--gap))) * 6 / 5),
      calc(100dvh - 158px),
      672px
    );
  }

  .player-color {
    width: 17px;
    height: 17px;
  }

  .budget-value {
    font-size: .95rem;
  }

  .mini-piece {
    width: 34px;
    height: 29px;
  }

  .mini-piece .piece-icon {
    width: 29px;
    height: 29px;
  }

  .shop-button {
    width: 100%;
    height: auto;
    min-height: 0;
    flex: 0 0 auto;
    aspect-ratio: 1 / 1;
    place-items: center;
    padding: 5px 3px 13px;
  }

  .shop-symbol {
    width: 78%;
    height: 78%;
  }

  .shop-cost {
    font-size: .78rem;
  }

  .coord {
    font-size: .62rem;
  }

  .status-card {
    min-width: 132px;
  }

  .status-main {
    font-size: .95rem;
  }
}

@media (max-height: 670px) {
  .app {
    gap: 6px;
  }

  .top-bar {
    min-height: 36px;
  }

  .bottom-bar {
    min-height: 34px;
  }

  .board-frame {
    width: min(
      calc(100vw - 16px - (2 * var(--side-rail)) - (2 * var(--gap))),
      calc((100dvh - 130px) * 5 / 6),
      520px
    );
  }

  .player-rail,
  .choice-panel {
    height: min(
      calc((100vw - 16px - (2 * var(--side-rail)) - (2 * var(--gap))) * 6 / 5),
      calc(100dvh - 130px),
      624px
    );
  }
}

@media (max-width: 430px) {
  .app {
    --mobile-board-size: min(calc(100vw - 20px), calc((100dvh - 234px) * 5 / 6), 430px);
    padding: 6px;
    gap: 6px;
  }

  .settings-overlay {
    padding: 8px;
  }

  .settings-header {
    padding: 12px 12px 10px;
  }

  .settings-body {
    gap: 12px;
    padding: 12px;
  }

  .settings-actions {
    padding: 10px 12px 12px;
  }

  .top-bar {
    min-height: 36px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 4px;
    padding: 4px;
    flex-wrap: nowrap;
  }

  .brand,
  .room-actions,
  .game-actions {
    order: initial;
  }

  .brand h1 {
    font-size: .94rem;
  }

  .room-actions {
    flex: 0 1 auto;
    flex-basis: auto;
    justify-content: center;
    gap: 3px;
  }

  .game-actions {
    justify-content: flex-end;
    gap: 3px;
  }

  .btn,
  .rules-menu summary,
  .action-menu summary,
  .room-input,
  .budget-control {
    height: 28px;
    min-height: 28px;
    border-radius: 6px;
    font-size: .72rem;
  }

  .btn {
    padding: 3px 6px;
  }

  .btn:focus-visible,
  .icon-btn:focus-visible,
  .rules-menu summary:focus-visible,
  .action-menu summary:focus-visible,
  .shop-button:focus-visible {
    outline-width: 2px;
  }

  .btn.compact {
    padding-inline: 6px;
  }

  .bottom-actions {
    gap: 3px;
  }

  .bottom-actions .btn {
    padding-inline: 5px;
  }

  .action-menu-popover {
    bottom: 34px;
    width: 126px;
  }

  .menu-action {
    min-height: 28px;
    padding: 4px 7px;
    font-size: .72rem;
  }

  .room-input {
    width: 55px;
    padding-inline: 4px;
  }

  .budget-control {
    gap: 3px;
    padding: 2px 4px;
  }

  .budget-control span {
    font-size: .48rem;
  }

  .budget-control input {
    width: 24px;
    font-size: .84rem;
  }

  .game-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    gap: 5px;
    align-content: center;
    justify-content: center;
    justify-items: center;
  }

  .player-rail {
    display: contents;
  }

  #topPlayerPanel {
    grid-row: 1;
  }

  .board-column {
    grid-row: 2;
    width: var(--mobile-board-size);
  }

  #bottomPlayerPanel {
    grid-row: 3;
  }

  .choice-panel {
    grid-row: 4;
  }

  .board-frame,
  .player-card,
  .choice-panel {
    width: var(--mobile-board-size);
  }

  .board-frame {
    max-width: var(--mobile-board-size);
  }

  .player-card {
    height: 26px;
    max-height: 26px;
    min-height: 26px;
    align-items: stretch;
    justify-content: center;
    overflow: hidden;
  }

  .player-heading,
  .player-card:last-child .player-heading {
    height: 100%;
    max-height: none;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
  }

  .player-color {
    width: 14px;
    height: 14px;
  }

  .budget-value {
    min-height: 0;
    font-size: .78rem;
  }

  .clock-value {
    min-height: 0;
    font-size: .76rem;
  }

  .captured-strip,
  .player-card:last-child .captured-strip {
    flex: 1 1 auto;
    flex-direction: row;
    align-items: center;
    gap: 3px;
    overflow: auto hidden;
  }

  .mini-piece {
    width: 22px;
    height: 22px;
  }

  .mini-piece .piece-icon {
    width: 21px;
    height: 21px;
  }

  .choice-panel {
    height: 62px;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 1fr;
    align-items: stretch;
    gap: 0;
  }

  .shop {
    min-width: 0;
    flex-direction: row;
    gap: 5px;
    overflow: auto hidden;
    scrollbar-width: none;
  }

  .shop::-webkit-scrollbar {
    display: none;
  }

  .shop-button {
    flex: 0 0 50px;
    width: 50px;
    min-width: 50px;
    height: 50px;
    min-height: 50px;
    padding: 3px 3px 11px;
  }

  .shop-symbol {
    width: 88%;
    height: calc(100% - 7px);
  }

  .shop-cost {
    right: 3px;
    bottom: 2px;
    font-size: .6rem;
  }

  .setup-action {
    flex-basis: 50px;
    min-width: 50px;
  }

  .setup-action-label {
    font-size: .5rem;
  }
}
