:root {
  color-scheme: light;
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-2: #eef3ef;
  --surface-3: #f8fbf8;
  --text: #15211e;
  --muted: #66746f;
  --line: #d8e2dc;
  --line-strong: #b7c8bf;
  --accent: #247568;
  --accent-strong: #15584d;
  --accent-soft: #dcefeb;
  --accent-2: #d89a2b;
  --danger: #b94040;
  --shadow: 0 16px 34px rgba(26, 44, 39, 0.12);
  --button-hover: #a9beb5;
  --board-water: #cfe7e2;
  --board-line: rgba(245, 248, 247, 0.72);
  --board-token-bg: #fffff7;
  --board-token-text: #18231f;
  --board-token-line: rgba(25, 35, 31, 0.18);
  --board-token-halo: rgba(255, 255, 255, 0.62);
  --board-token-pips: rgba(21, 33, 30, 0.64);
  --hex-stroke: rgba(255, 255, 255, 0.9);
  --terrain-text: rgba(17, 28, 25, 0.72);
  --terrain-icon: rgba(15, 25, 22, 0.56);
  --terrain-hills: #bf7253;
  --terrain-forest: #2f7458;
  --terrain-fields: #dcb85a;
  --terrain-pasture: #a9c96d;
  --terrain-mountains: #858d94;
  --terrain-desert: #cfaa70;
  --resource-brick: #b75d47;
  --resource-timber: #4f8762;
  --resource-grain: #c99f35;
  --resource-wool: #70a75e;
  --resource-ore: #707982;
  --chip-bg: #fbf7ed;
  --chip-icon: #ffffff;
  --port-bg: rgba(255, 255, 255, 0.96);
  --port-text: #2d3432;
  --port-line: rgba(82, 90, 87, 0.58);
  --port-border: rgba(82, 90, 87, 0.5);
  --active-row: #eef7f3;
  --active-row-line: #8bbdaf;
  --toast-bg: #fff6db;
  --toast-line: #e8c86e;
  --empty-node: rgba(238, 242, 240, 0.82);
  --empty-node-line: rgba(95, 101, 99, 0.44);
  --target-node: rgba(202, 208, 205, 0.72);
  --target-line: rgba(88, 96, 92, 0.66);
  --target-ghost: rgba(190, 197, 194, 0.22);
  --target-halo: rgba(203, 210, 207, 0.34);
  --placement-button-bg: rgba(255, 255, 255, 0.94);
  --placement-button-line: rgba(35, 48, 43, 0.34);
  --placement-shade: rgba(15, 26, 23, 0.24);
  --placement-shade-line: rgba(15, 26, 23, 0.3);
  --piece-outline: rgba(255, 255, 255, 0.24);
  --piece-detail: rgba(16, 24, 21, 0.72);
  --piece-halo: rgba(255, 255, 255, 0.44);
  --piece-road-outline: rgba(255, 255, 255, 0.24);
  --piece-road-glow: rgba(255, 255, 255, 0.52);
  --dice-bg: #15211e;
  --dice-text: #ffffff;
  --control-strong-bg: #15211e;
  --control-strong-text: #ffffff;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #050706;
  --surface: #0b0f0e;
  --surface-2: #111816;
  --surface-3: #070b0a;
  --text: #f3fbf8;
  --muted: #96aaa3;
  --line: #22302c;
  --line-strong: #385049;
  --accent: #15967f;
  --accent-strong: #35e0c0;
  --accent-soft: #082d27;
  --accent-2: #efb852;
  --danger: #ff7b73;
  --shadow: 0 22px 48px rgba(0, 0, 0, 0.58);
  --button-hover: #4d6b62;
  --board-water: #08282d;
  --board-line: rgba(235, 242, 239, 0.48);
  --board-token-bg: #f5f4e9;
  --board-token-text: #15211e;
  --board-token-line: rgba(255, 255, 255, 0.2);
  --board-token-halo: rgba(245, 244, 233, 0.28);
  --board-token-pips: rgba(21, 33, 30, 0.68);
  --hex-stroke: rgba(5, 9, 8, 0.86);
  --terrain-text: rgba(12, 22, 19, 0.76);
  --terrain-icon: rgba(10, 20, 17, 0.58);
  --terrain-hills: #c27156;
  --terrain-forest: #2f765c;
  --terrain-fields: #d6b350;
  --terrain-pasture: #a2c965;
  --terrain-mountains: #8d96a2;
  --terrain-desert: #bd9258;
  --resource-brick: #c76f59;
  --resource-timber: #62a67d;
  --resource-grain: #d8ad42;
  --resource-wool: #86bd6d;
  --resource-ore: #8d99a4;
  --chip-bg: #0f1513;
  --chip-icon: #0f1715;
  --port-bg: rgba(7, 9, 9, 0.94);
  --port-text: #f4f6f5;
  --port-line: rgba(232, 238, 236, 0.56);
  --port-border: rgba(232, 238, 236, 0.5);
  --active-row: #0d201c;
  --active-row-line: #1aa98f;
  --toast-bg: #1d1608;
  --toast-line: #6d5218;
  --empty-node: rgba(188, 198, 194, 0.62);
  --empty-node-line: rgba(238, 242, 240, 0.34);
  --target-node: rgba(186, 196, 192, 0.54);
  --target-line: rgba(212, 222, 218, 0.56);
  --target-ghost: rgba(204, 214, 210, 0.16);
  --target-halo: rgba(194, 206, 201, 0.2);
  --placement-button-bg: rgba(8, 13, 12, 0.94);
  --placement-button-line: rgba(230, 240, 236, 0.3);
  --placement-shade: rgba(0, 0, 0, 0.32);
  --placement-shade-line: rgba(255, 255, 255, 0.16);
  --piece-outline: rgba(255, 255, 255, 0.22);
  --piece-detail: rgba(4, 8, 7, 0.82);
  --piece-halo: rgba(255, 255, 255, 0.38);
  --piece-road-outline: rgba(255, 255, 255, 0.2);
  --piece-road-glow: rgba(255, 255, 255, 0.34);
  --dice-bg: #050706;
  --dice-text: #f3fbf8;
  --control-strong-bg: #050706;
  --control-strong-text: #f3fbf8;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  min-height: 42px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

button:not(:disabled):hover {
  border-color: var(--button-hover);
}

select {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 36px;
  background: var(--surface);
  color: var(--text);
  padding: 0 8px;
  font-weight: 650;
}

.app-shell {
  min-height: 100vh;
  padding: 0 0 12px;
}

.app-shell.is-home {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  width: 100%;
  margin: 0 0 14px;
  min-height: 58px;
  padding: 8px 22px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 12px 30px rgba(15, 26, 22, 0.1);
  backdrop-filter: blur(12px);
}

.brand-block {
  min-width: 0;
  display: flex;
  align-items: center;
}

.topbar h1 {
  margin: 0;
  font-size: 21px;
  line-height: 1.05;
  letter-spacing: 0;
}

.topbar-center {
  justify-self: center;
  display: flex;
  align-items: center;
}

.topbar-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-self: end;
  flex: 0 0 auto;
}

.nav-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  border-radius: 8px;
  background: var(--surface);
  white-space: nowrap;
}

.nav-button.icon-only {
  width: 40px;
  padding: 0;
}

.nav-button svg {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-button span {
  font-size: 13px;
  font-weight: 900;
}

.theme-button {
  color: var(--accent-strong);
}

.settings-button {
  color: var(--muted);
}

.new-game-button {
  background: var(--control-strong-bg);
  border-color: var(--line-strong);
  color: var(--control-strong-text);
}

.home-screen {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 12px;
  flex: 1;
  display: grid;
  align-items: center;
}

.home-hero {
  min-height: calc(100vh - 118px);
  display: grid;
  grid-template-columns: minmax(300px, 0.82fr) minmax(420px, 1.18fr);
  gap: 24px;
  align-items: center;
}

.home-copy {
  max-width: 580px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-copy h2 {
  margin: 0;
  max-width: 13.5ch;
  font-size: clamp(40px, 5.4vw, 68px);
  line-height: 1;
  letter-spacing: 0;
}

.home-copy > p:not(.eyebrow) {
  margin: 18px 0 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.hero-start {
  min-width: 0;
  width: auto;
  min-height: 46px;
  padding: 0 18px;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
}

.home-board-card {
  position: relative;
  margin: 0;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--board-water);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.home-board-visual {
  position: relative;
  background: var(--board-water);
}

.home-board-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  transition: background 160ms ease;
}

.home-board-visual .hero-start {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.home-board-preview {
  display: block;
  width: 100%;
  aspect-ratio: 1.2;
  background: var(--board-water);
}

.home-board-preview .edge-hit,
.home-board-preview .vertex-hit {
  display: none;
}

.home-board-preview .vertex-target {
  pointer-events: none;
}

.home-board-card figcaption {
  padding: 10px 14px 12px;
  border-top: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.home-info,
.home-options,
.home-footer {
  margin-top: 22px;
}

.home-section-head {
  max-width: 620px;
}

.home-section-head h2,
.home-options h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.08;
  letter-spacing: 0;
}

.home-info-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.home-info-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(15, 26, 22, 0.06);
}

.home-info-card strong {
  display: block;
  font-size: 15px;
}

.home-info-card p,
.home-options p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.home-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.home-options > div {
  max-width: 680px;
}

.home-options .primary {
  flex: 0 0 auto;
}

.home-footer {
  margin-top: 26px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface-2) 86%, transparent));
  box-shadow: 0 14px 34px rgba(15, 26, 22, 0.08);
}

.footer-brand {
  max-width: 460px;
}

.footer-brand strong {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.footer-brand p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.footer-links {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.footer-links h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.footer-links a,
.footer-links button {
  min-height: 0;
  width: fit-content;
  display: block;
  margin-top: 8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
  text-decoration: none;
}

.footer-links a:hover,
.footer-links button:hover {
  color: var(--accent-strong);
  transform: none;
}

.footer-bottom {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.setup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(8px);
}

.setup-modal {
  width: min(760px, 100%);
  max-height: min(780px, calc(100vh - 36px));
  max-height: min(780px, calc(100dvh - 36px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.34);
}

.setup-head,
.setup-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
}

.setup-head {
  flex: 0 0 auto;
  border-bottom: 1px solid var(--line);
}

.setup-head h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.setup-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 12px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px;
}

.setup-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
}

.setup-card.wide {
  grid-column: 1 / -1;
}

.settings-modal {
  width: min(620px, 100%);
}

.settings-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 16px;
}

.setup-card.is-disabled {
  opacity: 0.72;
}

.setup-card h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.setup-card small,
.setup-note,
.setting-block small {
  display: block;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.setting-block {
  display: grid;
  gap: 0;
}

.setup-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.setup-row > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.harbor-count {
  margin-top: 12px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 6px;
}

.segmented button,
.stepper button {
  min-height: 36px;
  padding: 0 10px;
  background: var(--surface);
}

.segmented button.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.stepper {
  display: inline-grid;
  grid-template-columns: 38px minmax(38px, auto) 38px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.stepper button {
  border: 0;
  border-radius: 0;
}

.stepper button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stepper strong {
  min-width: 36px;
  text-align: center;
  font-size: 15px;
}

.setup-actions {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.icon-button {
  width: 44px;
  padding: 0;
  display: grid;
  place-items: center;
}

.icon-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.game-layout {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 16px;
  align-items: start;
}

.game-layout.is-board-width-custom {
  grid-template-columns: minmax(360px, var(--board-column-width)) minmax(320px, 1fr);
}

.board-panel {
  min-width: 0;
  background: var(--board-water);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.board-stage {
  --board-floating-inset: 14px;
  position: relative;
  height: var(--board-height, calc(100vh - 96px));
  min-height: 340px;
  background: var(--board-water);
}

.board-svg {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  background: var(--board-water);
  cursor: grab;
  touch-action: pan-x pan-y;
  user-select: none;
}

.board-svg:active {
  cursor: grabbing;
}

.board-stage.is-locked .board-svg,
.board-stage.is-locked .board-svg:active {
  cursor: default;
}

.board-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 7px;
  z-index: 5;
  pointer-events: auto;
}

.board-control {
  width: 38px;
  min-height: 38px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 18px rgba(10, 22, 18, 0.13);
}

.board-control:disabled {
  opacity: 0.5;
}

.board-lock-toggle {
  position: absolute;
  left: var(--board-floating-inset);
  bottom: var(--board-floating-inset);
  z-index: 7;
  width: 42px;
  min-height: 42px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  color: var(--text);
  box-shadow: 0 12px 28px rgba(10, 22, 18, 0.16);
  backdrop-filter: blur(12px);
}

.board-lock-toggle.is-locked {
  background: var(--control-strong-bg);
  border-color: var(--line-strong);
  color: var(--control-strong-text);
}

.board-lock-toggle.is-unlocked {
  color: var(--accent-strong);
}

.turn-badge-dot {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.18) 36%, rgba(0, 0, 0, 0.18) 100%),
    var(--turn-color);
  border: 2px solid color-mix(in srgb, var(--turn-text) 72%, transparent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.24);
}

.board-turn-controls {
  --dice-size: 34px;
  --dice-space: 6px;
  --dice-collapsed-width: calc((var(--dice-size) * 2) + (var(--dice-space) * 3));
  --dice-prompt-width: 214px;
  position: absolute;
  right: var(--board-floating-inset);
  bottom: var(--board-floating-inset);
  z-index: 6;
  display: grid;
  gap: 8px;
  justify-items: end;
  pointer-events: none;
}

.board-end-turn,
.board-dice {
  pointer-events: auto;
}

.board-end-turn {
  min-height: 0;
  min-width: var(--dice-collapsed-width);
  width: var(--dice-collapsed-width);
  height: calc(var(--dice-size) + (var(--dice-space) * 2) + 2px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 1px solid color-mix(in srgb, var(--turn-color) 62%, transparent);
  border-radius: 10px;
  color: var(--turn-text);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), rgba(0, 0, 0, 0.16)),
    var(--turn-color);
  box-shadow:
    0 12px 26px color-mix(in srgb, var(--turn-color) 28%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition:
    opacity 160ms ease,
    filter 160ms ease,
    box-shadow 160ms ease;
}

.board-end-turn span {
  max-width: 100%;
  overflow: visible;
  text-align: center;
  white-space: normal;
  font-size: 12px;
  line-height: 1.02;
  font-weight: 900;
  letter-spacing: 0;
}

.board-end-turn:disabled {
  cursor: default;
  opacity: 0.52;
  filter: grayscale(0.45) saturate(0.65);
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.board-end-turn.is-ready:not(:disabled):hover,
.board-end-turn.is-ready:not(:disabled):focus-visible {
  outline: none;
  box-shadow:
    0 14px 30px color-mix(in srgb, var(--turn-color) 34%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.board-dice {
  min-height: 0;
  padding: var(--dice-space);
  display: flex;
  gap: var(--dice-space);
  align-items: center;
  border-radius: 7px;
  border: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.28), rgba(0, 0, 0, 0.16)),
    var(--turn-color);
  color: var(--turn-text);
  box-shadow: 0 12px 28px rgba(10, 22, 18, 0.18);
  backdrop-filter: blur(12px);
  cursor: pointer;
  touch-action: manipulation;
  transition:
    max-width 220ms ease,
    min-width 220ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease,
    opacity 140ms ease;
  overflow: hidden;
}

.board-dice.is-roll-prompt {
  width: max-content;
  min-width: 0;
  max-width: min(320px, calc(100% - 32px));
}

.board-dice.is-human-roll:not(.is-rolling) {
  animation: dice-ready-pulse 1600ms ease-in-out infinite;
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--turn-color) 18%, transparent),
    0 12px 28px rgba(10, 22, 18, 0.18),
    0 0 22px color-mix(in srgb, var(--turn-color) 34%, transparent);
}

.board-dice.is-collapsed {
  width: var(--dice-collapsed-width);
  min-width: var(--dice-collapsed-width);
  max-width: var(--dice-collapsed-width);
  gap: 0;
}

.board-dice.is-settling {
  width: var(--dice-collapsed-width);
  min-width: var(--dice-collapsed-width);
  max-width: var(--dice-prompt-width);
  pointer-events: none;
  animation: dice-settle-shell 560ms cubic-bezier(0.2, 0.78, 0.18, 1) both;
}

.board-dice.is-rolled:disabled {
  cursor: default;
  opacity: 0.62;
  filter: grayscale(0.52) saturate(0.68);
  box-shadow:
    0 8px 18px rgba(0, 0, 0, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.board-dice.is-rolled .die {
  opacity: 0.86;
  filter: saturate(0.82);
}

.dice-prompt {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  overflow: hidden;
  white-space: nowrap;
  transform-origin: left center;
  transition:
    max-width 220ms ease,
    opacity 150ms ease,
    margin 220ms ease,
    transform 220ms ease;
}

.dice-prompt strong {
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 18px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: 0;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.22);
}

.board-dice.is-roll-prompt .dice-prompt {
  max-width: 190px;
  opacity: 1;
}

.board-dice.is-collapsed .dice-prompt {
  max-width: 0;
  opacity: 0;
}

.board-dice.is-settling .dice-prompt {
  animation: dice-prompt-exit 560ms cubic-bezier(0.22, 0.72, 0.18, 1) both;
}

.dice-pair {
  display: flex;
  flex: 0 0 auto;
  gap: var(--dice-space);
  align-items: center;
  transform-origin: right center;
}

.board-dice.is-settling .dice-pair {
  animation: dice-pair-settle 560ms cubic-bezier(0.2, 0.78, 0.18, 1) both;
}

.board-resize-handle {
  position: absolute;
  z-index: 7;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  opacity: 0.54;
  touch-action: none;
}

.board-resize-handle:hover,
.board-resize-handle:focus-visible {
  opacity: 1;
  outline: none;
}

.board-resize-handle:disabled {
  cursor: default;
  opacity: 0;
}

.board-resize-x {
  top: 62px;
  right: 0;
  bottom: 86px;
  width: 14px;
  cursor: ew-resize;
}

.board-resize-x::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 4px;
  width: 4px;
  height: 58px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line-strong) 84%, transparent);
  transform: translateY(-50%);
}

.board-resize-y {
  right: 108px;
  bottom: 0;
  left: 74px;
  height: 14px;
  cursor: ns-resize;
}

.board-resize-y::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 4px;
  left: 0;
  height: 4px;
  max-width: 90px;
  margin: 0 auto;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line-strong) 84%, transparent);
}

.board-resize-corner {
  right: 2px;
  bottom: 2px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 0;
  cursor: nwse-resize;
}

.resize-corner-icon {
  width: 15px;
  height: 15px;
  display: block;
  fill: none;
  stroke: color-mix(in srgb, var(--text) 62%, transparent);
  stroke-width: 2.15;
  stroke-linecap: round;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.16));
  pointer-events: none;
}

body.is-board-resizing {
  cursor: nwse-resize;
  user-select: none;
}

.board-dice:disabled {
  cursor: default;
  opacity: 0.88;
}

.board-dice.is-rolling {
  opacity: 1;
}

.board-dice:not(:disabled):hover,
.board-dice:not(:disabled):focus-visible {
  box-shadow: 0 14px 34px rgba(10, 22, 18, 0.24);
  outline: none;
}

.board-die {
  width: var(--dice-size);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 3px;
  padding: 6px;
  border-radius: 7px;
  background: var(--board-token-bg);
  border: 1.5px solid var(--board-token-line);
  box-shadow:
    inset 0 -3px 0 rgba(21, 33, 30, 0.08),
    0 4px 9px rgba(0, 0, 0, 0.12);
}

.die-pip {
  width: 5px;
  height: 5px;
  place-self: center;
  border-radius: 999px;
  background: transparent;
}

.die-pip.is-on {
  background: var(--board-token-text);
}

.board-dice.is-rolling .board-die {
  animation: dice-tumble 420ms ease-in-out infinite;
}

.board-dice.is-rolling .board-die:nth-child(2) {
  animation-direction: reverse;
}

.board-dice.is-settling .board-die {
  animation: dice-land 560ms cubic-bezier(0.2, 0.78, 0.18, 1) both;
}

.board-dice.is-settling .board-die:nth-child(2) {
  animation-delay: 45ms;
}

@keyframes dice-tumble {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  28% {
    transform: translateY(-3px) rotate(-9deg);
  }
  56% {
    transform: translateY(2px) rotate(8deg);
  }
  100% {
    transform: translateY(0) rotate(0deg);
  }
}

@keyframes dice-settle-shell {
  0% {
    width: var(--dice-prompt-width);
    min-width: var(--dice-prompt-width);
    max-width: var(--dice-prompt-width);
    gap: var(--dice-space);
    opacity: 1;
    filter: saturate(1.08);
  }
  58% {
    width: calc(var(--dice-collapsed-width) + 46px);
    min-width: calc(var(--dice-collapsed-width) + 46px);
    max-width: calc(var(--dice-collapsed-width) + 46px);
    gap: calc(var(--dice-space) * 0.6);
  }
  100% {
    width: var(--dice-collapsed-width);
    min-width: var(--dice-collapsed-width);
    max-width: var(--dice-collapsed-width);
    gap: 0;
    opacity: 0.88;
    filter: grayscale(0.52) saturate(0.68);
  }
}

@keyframes dice-prompt-exit {
  0% {
    max-width: 190px;
    opacity: 1;
    transform: translateX(0) scaleX(1);
  }
  44% {
    opacity: 0.55;
  }
  100% {
    max-width: 0;
    opacity: 0;
    transform: translateX(-10px) scaleX(0.88);
  }
}

@keyframes dice-pair-settle {
  0% {
    transform: translateX(0) scale(1.04);
  }
  58% {
    transform: translateX(-4px) scale(1.06);
  }
  100% {
    transform: translateX(0) scale(1);
  }
}

@keyframes dice-land {
  0% {
    transform: translateY(-6px) rotate(-8deg) scale(1.08);
    filter: saturate(1.2);
  }
  54% {
    transform: translateY(2px) rotate(3deg) scale(1.02);
  }
  100% {
    transform: translateY(0) rotate(0deg) scale(1);
    filter: saturate(0.82);
  }
}

@keyframes dice-ready-pulse {
  0%,
  100% {
    transform: scale(1);
    filter: saturate(1);
  }
  50% {
    transform: scale(1.035);
    filter: saturate(1.08);
  }
}

@keyframes setup-node-glow {
  0%,
  100% {
    r: 6px;
    opacity: 0.58;
    stroke-width: 2;
    filter: drop-shadow(0 0 0 color-mix(in srgb, var(--target-line) 0%, transparent));
  }
  50% {
    r: 9px;
    opacity: 0.78;
    stroke-width: 3;
    filter: drop-shadow(0 0 6px color-mix(in srgb, var(--target-line) 34%, transparent));
  }
}

@keyframes setup-road-glow {
  0%,
  100% {
    stroke-width: 9;
    opacity: 0.74;
    filter: drop-shadow(0 0 3px color-mix(in srgb, var(--target-line) 22%, transparent));
  }
  50% {
    stroke-width: 13;
    opacity: 0.96;
    filter:
      drop-shadow(0 0 8px color-mix(in srgb, var(--target-line) 52%, transparent))
      drop-shadow(0 0 14px color-mix(in srgb, var(--target-line) 24%, transparent));
  }
}

@keyframes setup-road-aura {
  0%,
  100% {
    stroke-width: 18;
    opacity: 0.16;
  }
  50% {
    stroke-width: 25;
    opacity: 0.34;
  }
}

@keyframes piece-place-pop {
  0% {
    transform: translateY(-18px) scale(0.96);
    opacity: 0.3;
  }
  74% {
    transform: translateY(2px) scale(1.02);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes road-place-glow {
  0% {
    opacity: 0;
    stroke-width: 26;
  }
  100% {
    opacity: 0.34;
    stroke-width: 18;
  }
}

@keyframes road-place-body {
  0% {
    opacity: 0.2;
    stroke-width: 7;
  }
  100% {
    opacity: 1;
    stroke-width: 12;
  }
}

.board-context-menu {
  position: absolute;
  z-index: 12;
  min-width: 136px;
  padding: 5px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(12px);
}

.board-context-menu button {
  width: 100%;
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.board-context-menu button:hover,
.board-context-menu button:focus-visible {
  background: var(--surface-2);
  outline: none;
}

.board-context-menu svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sea {
  fill: var(--board-water);
}

.hex polygon {
  stroke: var(--hex-stroke);
  stroke-width: 5;
  cursor: default;
}

.terrain-hills {
  fill: var(--terrain-hills);
}

.terrain-forest {
  fill: var(--terrain-forest);
}

.terrain-fields {
  fill: var(--terrain-fields);
}

.terrain-pasture {
  fill: var(--terrain-pasture);
}

.terrain-mountains {
  fill: var(--terrain-mountains);
}

.terrain-desert {
  fill: var(--terrain-desert);
}

.hex.is-clickable polygon {
  cursor: pointer;
  stroke: var(--accent-strong);
  stroke-width: 6;
  stroke-dasharray: 10 8;
}

.hex.is-placement-focus .terrain-fill {
  stroke: color-mix(in srgb, var(--accent-strong) 52%, var(--hex-stroke));
  stroke-width: 6;
}

.terrain-placement-shade {
  fill: var(--placement-shade);
  stroke: var(--placement-shade-line);
  stroke-width: 4;
  pointer-events: none;
}

.terrain-icon,
.resource-glyph,
.resource-symbol {
  color: currentColor;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.terrain-icon {
  color: var(--terrain-icon);
  pointer-events: none;
}

.terrain-icon .soft-fill,
.resource-glyph .soft-fill,
.resource-symbol .soft-fill {
  fill: currentColor;
  stroke: none;
  opacity: 0.5;
}

.terrain-icon .grain-kernel,
.terrain-icon .grain-stem,
.resource-glyph .grain-kernel,
.resource-glyph .grain-stem,
.resource-symbol .grain-kernel,
.resource-symbol .grain-stem {
  stroke-width: 3;
}

.terrain-icon .sheep-fill,
.resource-glyph .sheep-fill,
.resource-symbol .sheep-fill {
  fill: currentColor;
  stroke: none;
  opacity: 0.2;
}

.terrain-icon .sheep-outline,
.resource-glyph .sheep-outline,
.resource-symbol .sheep-outline {
  stroke-width: 2.85;
}

.terrain-icon .sheep-mark,
.resource-glyph .sheep-mark,
.resource-symbol .sheep-mark {
  fill: currentColor;
  stroke: none;
}

.terrain-label {
  text-anchor: middle;
  font-size: 12px;
  font-weight: 800;
  fill: var(--terrain-text);
  pointer-events: none;
}

.number-chip .chip-halo {
  fill: none;
  stroke: var(--board-token-halo);
  stroke-width: 4;
  opacity: 0;
}

.number-chip .chip-core {
  fill: var(--board-token-bg);
  stroke: transparent;
  stroke-width: 1.5;
}

.number-chip.rolled .chip-halo {
  opacity: 1;
}

.number-chip.rolled .chip-core {
  stroke: var(--board-token-line);
}

.number-chip.rolled.hot .chip-halo {
  stroke: rgba(183, 52, 52, 0.18);
}

.number-chip text {
  text-anchor: middle;
  dominant-baseline: middle;
  font-size: 19px;
  font-weight: 900;
  fill: var(--board-token-text);
}

.number-chip .pips {
  font-size: 8px;
  letter-spacing: 0;
  fill: var(--board-token-pips);
}

.number-chip.hot text {
  fill: #b73434;
}

.robber {
  opacity: 0.82;
}

.robber-body,
.robber-head,
.robber-hat,
.robber-hat-brim {
  fill: url("#robberBodyGradient");
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 1.2;
  stroke-linejoin: round;
}

.robber-hat,
.robber-hat-brim {
  fill: rgba(0, 0, 0, 0.74);
}

.robber-face-line {
  fill: none;
  stroke: rgba(255, 255, 255, 0.42);
  stroke-width: 2.2;
  stroke-linecap: round;
}

.edge-base {
  stroke: var(--board-line);
  stroke-width: 5;
  stroke-linecap: round;
}

.edge.has-road {
  transform-box: fill-box;
  transform-origin: center;
  cursor: pointer;
  transition:
    filter 220ms ease,
    transform 220ms ease;
}

.edge-road-outline,
.edge-road-glow,
.edge-road {
  stroke-linecap: round;
  pointer-events: none;
}

.edge-road-outline {
  stroke: var(--road-outline-color, var(--piece-road-outline));
  stroke-width: 15;
  opacity: 1;
}

.edge-road-glow {
  stroke: var(--road-color);
  stroke-width: 17;
  opacity: 0;
  filter:
    drop-shadow(0 0 3px color-mix(in srgb, var(--road-color) 68%, transparent))
    drop-shadow(0 0 6px color-mix(in srgb, var(--road-color) 28%, transparent));
  transition: opacity 220ms ease;
}

.edge-road {
  stroke-width: 11;
  transition: stroke-width 220ms ease;
}

.edge.has-road.is-own-road:hover,
.edge.has-road.is-own-road:focus-within {
  transform: scale(1.018);
  filter:
    drop-shadow(0 0 3px color-mix(in srgb, var(--road-color) 56%, transparent))
    drop-shadow(0 0 7px color-mix(in srgb, var(--road-color) 22%, transparent));
}

.edge.has-road.is-own-road:hover .edge-road-glow,
.edge.has-road.is-own-road:focus-within .edge-road-glow {
  opacity: 0.38;
}

.edge.has-road.is-own-road:hover .edge-road,
.edge.has-road.is-own-road:focus-within .edge-road {
  stroke-width: 12.4;
}

.edge.has-road.is-rival-road:hover .edge-road-outline,
.edge.has-road.is-rival-road:focus-within .edge-road-outline {
  stroke-width: 16;
}

.edge-road-choice,
.edge-road-choice-aura {
  stroke: var(--target-line);
  stroke-linecap: round;
  pointer-events: none;
}

.edge-road-choice-aura {
  stroke-width: 18;
  opacity: 0.2;
  animation: setup-road-aura 3000ms ease-in-out infinite;
  filter: blur(1px);
}

.edge-road-choice {
  stroke-width: 9;
  opacity: 0.86;
  animation: setup-road-glow 3000ms ease-in-out infinite;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--target-line) 38%, transparent));
}

.edge-hit {
  stroke: transparent;
  stroke-width: 28;
  stroke-linecap: round;
  cursor: pointer;
  pointer-events: stroke;
}

.edge.has-road .edge-road {
  stroke-width: 12;
}

.edge.has-road .edge-road-glow {
  stroke-width: 16;
}

.edge.is-selected .edge-road-choice-aura {
  opacity: 0.36;
  stroke-width: 22;
}

.edge.is-selected .edge-road-choice {
  opacity: 1;
  stroke: color-mix(in srgb, var(--target-line) 62%, var(--accent-strong));
  stroke-width: 11;
}

.board-item-info {
  pointer-events: none;
  filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.3));
}

.board-item-info rect {
  fill: color-mix(in srgb, var(--surface) 92%, transparent);
  stroke: var(--panel-line);
  stroke-width: 2;
}

.board-item-info text {
  fill: var(--text);
  font-weight: 900;
  letter-spacing: 0;
  dominant-baseline: middle;
}

.board-item-info-owner {
  font-size: 12px;
}

.board-item-info-type {
  font-size: 13px;
  opacity: 0.72;
}

.placement-picker {
  pointer-events: all;
  filter:
    drop-shadow(0 9px 9px rgba(0, 0, 0, 0.24))
    drop-shadow(0 0 9px color-mix(in srgb, var(--target-line) 28%, transparent));
}

.placement-option {
  cursor: pointer;
}

.placement-option-hit {
  fill: var(--placement-button-bg);
  stroke: var(--placement-button-line);
  stroke-width: 2;
}

.placement-option-icon {
  transform-box: fill-box;
  transform-origin: center;
  pointer-events: none;
}

.placement-option:hover .placement-option-hit,
.placement-option:focus-visible .placement-option-hit {
  fill: color-mix(in srgb, var(--placement-button-bg) 86%, var(--accent-soft));
  stroke: color-mix(in srgb, var(--target-line) 62%, var(--accent-strong));
  stroke-width: 3;
}

.placement-piece-body {
  fill: var(--target-line);
  stroke: color-mix(in srgb, var(--surface) 38%, transparent);
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.placement-piece-detail {
  fill: none;
  stroke: var(--surface);
  stroke-width: 2.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.placement-option:hover .placement-piece-body,
.placement-option:focus-visible .placement-piece-body {
  fill: color-mix(in srgb, var(--target-line) 82%, var(--accent-strong));
  stroke-width: 2;
}

.placement-option:hover .placement-piece-detail,
.placement-option:focus-visible .placement-piece-detail {
  stroke-width: 3.1;
}

.placement-road-outline,
.placement-road-body {
  stroke-linecap: round;
}

.placement-road-outline {
  stroke: color-mix(in srgb, var(--surface) 78%, transparent);
  stroke-width: 11;
}

.placement-road-body {
  stroke: var(--target-line);
  stroke-width: 7;
}

.placement-option:hover .placement-road-body,
.placement-option:focus-visible .placement-road-body {
  stroke: color-mix(in srgb, var(--target-line) 82%, var(--accent-strong));
  stroke-width: 8;
}

.vertex-target {
  cursor: default;
  pointer-events: all;
}

.vertex-target.is-valid {
  cursor: pointer;
}

.vertex-hit {
  fill: rgba(255, 255, 255, 0.001);
  stroke: transparent;
  pointer-events: all;
}

.vertex-node {
  fill: var(--empty-node);
  stroke: var(--empty-node-line);
  stroke-width: 2;
}

.vertex-focus-ring {
  fill: color-mix(in srgb, var(--target-node) 42%, var(--accent-soft));
  stroke: color-mix(in srgb, var(--target-line) 54%, var(--accent-strong));
  stroke-width: 3;
  opacity: 0;
  pointer-events: none;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--target-line) 32%, transparent));
  transition: opacity 140ms ease;
}

.vertex-target.is-muted .vertex-node {
  opacity: 0.58;
}

.vertex-target.is-valid .vertex-node {
  fill: var(--target-node);
  stroke: var(--target-line);
  stroke-width: 2;
  opacity: 0.82;
  animation: setup-node-glow 3000ms ease-in-out infinite;
}

.vertex-target.is-valid:hover .vertex-node {
  fill: color-mix(in srgb, var(--target-node) 50%, var(--accent-soft));
  opacity: 1;
  stroke: color-mix(in srgb, var(--target-line) 52%, var(--accent-strong));
  stroke-width: 3.5;
  r: 8px;
}

.vertex-target.is-valid:hover .vertex-focus-ring,
.vertex-target.is-selected .vertex-focus-ring {
  opacity: 1;
}

.vertex-target.is-selected .vertex-node {
  fill: color-mix(in srgb, var(--target-node) 42%, var(--accent-strong));
  stroke: color-mix(in srgb, var(--target-line) 58%, var(--accent-strong));
  stroke-width: 4;
  opacity: 1;
  r: 8.5px;
}

.piece-halo {
  display: none;
  fill: none;
  stroke: transparent;
  stroke-width: 0;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.piece {
  transform-box: fill-box;
  transform-origin: center;
  cursor: pointer;
  transition:
    filter 220ms ease,
    transform 220ms ease;
}

.piece-hit {
  fill: rgba(255, 255, 255, 0.001);
  stroke: transparent;
  pointer-events: all;
}

.piece.is-own-piece:hover,
.piece.is-own-piece:focus-within {
  transform: scale(1.035);
  filter:
    drop-shadow(0 0 3px color-mix(in srgb, var(--piece-color) 58%, transparent))
    drop-shadow(0 0 7px color-mix(in srgb, var(--piece-color) 22%, transparent));
}

.piece.is-rival-piece:hover,
.piece.is-rival-piece:focus-within {
  transform: scale(1.018);
}

.piece-body {
  stroke: var(--piece-outline-color);
  stroke-width: 2.6;
  stroke-linejoin: round;
  transition:
    stroke-width 220ms ease,
    filter 220ms ease;
}

.piece-shine {
  fill: url("#pieceShine");
  stroke: none;
  pointer-events: none;
  mix-blend-mode: screen;
}

.piece-detail {
  fill: none;
  stroke: var(--piece-detail-color);
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  transition: stroke-width 220ms ease;
}

.piece.city .piece-body {
  stroke-width: 2.6;
}

.piece.city .piece-detail {
  stroke-width: 2.6;
}

.city-upgrade-halo {
  fill: color-mix(in srgb, var(--piece-color) 18%, transparent);
  stroke: color-mix(in srgb, var(--piece-color) 72%, transparent);
  stroke-width: 3;
  stroke-dasharray: 7 5;
  opacity: 0;
  transition: opacity 220ms ease;
}

.piece.valid-city .piece-body {
  cursor: pointer;
}

.piece.valid-city:hover .city-upgrade-halo,
.piece.valid-city:focus-within .city-upgrade-halo {
  opacity: 0.72;
}

.piece.is-own-piece:hover .piece-body,
.piece.is-own-piece:focus-within .piece-body {
  stroke-width: 2.9;
}

.piece.is-own-piece:hover .piece-detail,
.piece.is-own-piece:focus-within .piece-detail {
  stroke-width: 3;
}

.piece.is-rival-piece:hover .piece-body,
.piece.is-rival-piece:focus-within .piece-body {
  stroke-width: 2.9;
}

.port line {
  stroke: var(--port-line);
  stroke-width: 3;
}

.port-badge rect {
  fill: var(--port-bg);
  stroke: var(--port-border);
  stroke-width: 2;
}

.port text {
  fill: var(--port-text);
  pointer-events: none;
}

.port-name {
  font-size: 12px;
  font-weight: 950;
}

.port-rate {
  font-size: 12px;
  font-weight: 950;
}

.port .resource-glyph {
  color: var(--port-text);
  stroke-width: 2.6;
}

.side-panel {
  display: grid;
  gap: 12px;
}

.panel-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15, 26, 22, 0.09);
  padding: 14px;
}

.panel-card h2,
.mini-section h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.panel-card-head,
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}

.panel-card-head small,
.section-head small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.1;
  text-align: right;
}

.section-head h3 {
  margin: 0;
  font-size: 13px;
  line-height: 1.2;
}

.prompt-card {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 30%, transparent), transparent 56%),
    var(--surface);
}

.prompt-head {
  display: grid;
  gap: 4px;
}

.prompt-head span {
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.prompt-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.build-card,
.hand-card,
.trade-summary-card {
  display: grid;
  gap: 10px;
}

.cost-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.cost-card {
  min-width: 0;
  min-height: 66px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px;
  text-align: left;
  background: var(--surface-3);
}

.cost-card.is-selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.cost-card.is-short:not(:disabled) {
  opacity: 0.76;
}

.cost-card-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent);
}

.build-symbol,
.dev-symbol {
  width: 28px;
  height: 28px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.build-symbol path {
  stroke: var(--piece-outline);
  stroke-width: 2.7;
  stroke-linejoin: round;
}

.build-symbol-road line {
  stroke: currentColor;
  stroke-width: 8;
  stroke-linecap: round;
}

.build-symbol-detail {
  fill: none;
  stroke: var(--piece-detail);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dev-symbol rect,
.dev-symbol circle,
.dev-symbol path {
  vector-effect: non-scaling-stroke;
}

.dev-symbol-victory path {
  fill: currentColor;
  stroke-width: 1.4;
}

.cost-card-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.cost-card-main strong {
  font-size: 13px;
  line-height: 1.1;
}

.cost-pips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.cost-pip {
  min-width: 24px;
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 2px 4px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
}

.cost-pip .resource-symbol {
  width: 14px;
  height: 14px;
}

.cost-pip strong {
  font-size: 11px;
  line-height: 1;
}

.hand-resource-grid,
.dev-hand-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(54px, 68px));
  justify-content: start;
  gap: 8px;
}

.hand-resource-card,
.dev-hand-card {
  min-width: 0;
  aspect-ratio: 0.72;
  min-height: 78px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 4px;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--chip-bg);
  text-align: center;
}

.hand-resource-card.is-empty {
  opacity: 0.58;
}

.hand-card-icon,
.dev-hand-icon,
.dev-detail-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--chip-icon);
}

.hand-card-icon .resource-symbol {
  width: 20px;
  height: 20px;
}

.hand-resource-card.brick .hand-card-icon {
  background: var(--resource-brick);
}

.hand-resource-card.timber .hand-card-icon {
  background: var(--resource-timber);
}

.hand-resource-card.grain .hand-card-icon {
  background: var(--resource-grain);
}

.hand-resource-card.wool .hand-card-icon {
  background: var(--resource-wool);
}

.hand-resource-card.ore .hand-card-icon {
  background: var(--resource-ore);
}

.hand-resource-card strong,
.dev-hand-card strong {
  font-size: 18px;
  line-height: 1;
}

.hand-resource-card small,
.dev-hand-card small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  line-height: 1;
}

.dev-hand {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.dev-hand-grid {
  grid-template-columns: repeat(auto-fill, minmax(60px, 68px));
}

.dev-hand-card {
  cursor: pointer;
}

.dev-hand-card.is-selected,
.dev-hand-card:not(:disabled):hover,
.dev-hand-card:not(:disabled):focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.dev-hand-icon,
.dev-detail-icon {
  background: var(--surface);
  color: var(--accent);
}

.dev-hand-icon .dev-symbol {
  width: 22px;
  height: 22px;
}

.dev-card-detail {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: 8px;
  background: var(--surface-2);
}

.dev-detail-head {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
}

.dev-detail-head strong,
.dev-detail-head small {
  display: block;
  min-width: 0;
}

.dev-detail-head strong {
  font-size: 13px;
}

.dev-detail-head small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.dev-detail-close {
  width: 28px;
  min-height: 28px;
  border-radius: 999px;
}

.dev-detail-close svg {
  width: 14px;
  height: 14px;
}

.dev-card-detail p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.trade-rate-list {
  display: grid;
  gap: 6px;
}

.trade-rate-row {
  min-height: 36px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
}

.trade-rate-row.is-improved {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 58%, var(--surface-3));
}

.trade-rate-resource {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.trade-rate-resource .resource-symbol {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.trade-rate-resource strong {
  font-size: 12px;
}

.trade-rate-value {
  min-width: 40px;
  min-height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 950;
}

.trade-rate-row small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
}

.status-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.status-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.dice {
  min-width: 92px;
  min-height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--dice-bg);
  color: var(--dice-text);
  border: 1px solid var(--line);
  font-weight: 900;
}

.toast {
  border-radius: 8px;
  background: var(--toast-bg);
  border: 1px solid var(--toast-line);
  padding: 9px 10px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 750;
}

.resource-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin: 10px 0;
}

.resource-chip {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--chip-bg);
  padding: 8px 6px;
  display: grid;
  gap: 2px;
  justify-items: center;
}

.resource-chip span {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--chip-icon);
  font-weight: 900;
  font-size: 12px;
}

.resource-chip svg,
.perk-icon svg,
.trade-card-icon svg,
.trade-toggle-icon svg {
  width: 19px;
  height: 19px;
}

.resource-chip strong {
  font-size: 18px;
  line-height: 1;
}

.resource-chip small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.resource-chip.brick span {
  background: var(--resource-brick);
}

.resource-chip.timber span {
  background: var(--resource-timber);
}

.resource-chip.grain span {
  background: var(--resource-grain);
}

.resource-chip.wool span {
  background: var(--resource-wool);
}

.resource-chip.ore span {
  background: var(--resource-ore);
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.action-button {
  min-height: 58px;
  display: grid;
  gap: 3px;
  align-content: center;
  text-align: left;
}

.action-button span {
  font-size: 14px;
}

.action-button small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.action-button.is-selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.secondary {
  background: var(--control-strong-bg);
  border-color: var(--line-strong);
  color: var(--control-strong-text);
}

.wide {
  width: 100%;
  margin-top: 10px;
}

.hint,
.empty,
.bot-thinking {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.bot-thinking {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  font-weight: 800;
}

.mini-section {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 12px;
}

.port-perks {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 4px 0 10px;
}

.empty-perks {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.3;
}

.port-perk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  padding: 4px 7px;
}

.perk-icon {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--accent);
}

.port-perk strong,
.port-perk small {
  font-size: 11px;
  line-height: 1;
}

.port-perk small {
  color: var(--muted);
  font-weight: 850;
}

.card-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.dev-card {
  min-height: 52px;
  display: grid;
  align-content: center;
  text-align: left;
}

.dev-card span {
  font-size: 13px;
}

.dev-card small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.trade-section {
  display: grid;
  gap: 8px;
}

.trade-toggle {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  text-align: left;
  background: var(--surface-2);
}

.trade-toggle-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
}

.trade-toggle strong,
.trade-toggle small {
  display: block;
}

.trade-toggle strong {
  font-size: 14px;
}

.trade-toggle small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.2;
}

.trade-toggle-chevron {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
}

.trade-builder {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.trade-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.trade-tabs button {
  min-height: 36px;
  background: var(--surface);
  font-size: 13px;
}

.trade-tabs button.is-selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-strong);
}

.trade-builder-grid {
  display: grid;
  gap: 9px;
}

.trade-card-group {
  display: grid;
  gap: 7px;
}

.trade-card-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 8px;
}

.trade-card-head strong {
  font-size: 13px;
}

.trade-card-head span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
}

.trade-card-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.trade-card {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 7px 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--chip-bg);
}

.trade-card.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.trade-card.is-blocked:not(.is-selected) {
  opacity: 0.62;
}

.trade-card-main {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.trade-card-main strong,
.trade-card-main small {
  display: block;
  min-width: 0;
}

.trade-card-main strong {
  font-size: 10.5px;
  line-height: 1.1;
}

.trade-card-main small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1.1;
}

.trade-card-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--chip-icon);
}

.trade-card-icon.brick {
  background: var(--resource-brick);
}

.trade-card-icon.timber {
  background: var(--resource-timber);
}

.trade-card-icon.grain {
  background: var(--resource-grain);
}

.trade-card-icon.wool {
  background: var(--resource-wool);
}

.trade-card-icon.ore {
  background: var(--resource-ore);
}

.trade-card-counter {
  display: grid;
  grid-template-columns: 24px minmax(18px, 1fr) 24px;
  align-items: center;
  gap: 3px;
}

.trade-card-counter button {
  min-height: 24px;
  width: 24px;
  padding: 0;
  border-radius: 7px;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.trade-card-counter strong {
  text-align: center;
  font-size: 13px;
}

.trade-submit {
  margin-top: 0;
}

.discard-grid {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.discard-row {
  display: grid;
  grid-template-columns: 1fr 38px 34px 38px;
  gap: 6px;
  align-items: center;
}

.discard-row span {
  font-weight: 800;
}

.discard-row button {
  min-height: 34px;
  padding: 0;
}

.discard-row strong {
  text-align: center;
}

.piece-legend {
  position: relative;
}

.legend-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.piece-info-wrap {
  position: relative;
  display: grid;
  place-items: center;
}

.legend-info-button {
  width: 30px;
  min-height: 30px;
  border-radius: 999px;
  color: var(--muted);
}

.legend-info-button svg {
  width: 17px;
  height: 17px;
}

.piece-info-popover {
  position: absolute;
  top: 38px;
  right: 0;
  z-index: 15;
  width: min(286px, calc(100vw - 44px));
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  color: var(--text);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-4px);
  transition:
    opacity 120ms ease,
    transform 120ms ease,
    visibility 120ms ease;
}

.piece-info-wrap:hover .piece-info-popover,
.piece-info-wrap:focus-within .piece-info-popover,
.piece-info-wrap.is-open .piece-info-popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.piece-info-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.piece-info-head strong {
  font-size: 13px;
}

.piece-info-close {
  width: 26px;
  min-height: 26px;
  border-radius: 999px;
}

.piece-info-close svg {
  width: 14px;
  height: 14px;
}

.piece-info-popover p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.legend-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.legend-item {
  min-width: 0;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
}

.legend-item strong,
.legend-item span {
  display: block;
  min-width: 0;
}

.legend-item strong {
  font-size: 12px;
  line-height: 1.1;
}

.legend-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 750;
  line-height: 1.15;
}

.legend-icon {
  width: 34px;
  height: 34px;
  overflow: visible;
}

.legend-road-outline {
  stroke: var(--piece-road-outline);
  stroke-width: 12;
  stroke-linecap: round;
}

.legend-road-body {
  stroke-width: 7;
  stroke-linecap: round;
}

.legend-piece-halo {
  fill: none;
  stroke: var(--piece-halo);
  stroke-width: 7;
  stroke-linejoin: round;
}

.legend-piece-body {
  stroke: var(--piece-outline);
  stroke-width: 3.2;
  stroke-linejoin: round;
}

.legend-piece-detail {
  fill: none;
  stroke: var(--piece-detail);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.victim-list,
.resource-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.players {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.player-row {
  display: grid;
  grid-template-columns: 58px minmax(86px, 1fr) minmax(112px, 0.9fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-3);
}

.player-row.active {
  background: var(--active-row);
  border-color: var(--active-row-line);
}

.player-avatar-wrap {
  display: grid;
  justify-items: center;
  gap: 4px;
}

.player-avatar {
  width: 42px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.18) 34%, rgba(0, 0, 0, 0.18) 100%),
    var(--player-color);
  border: 2px solid color-mix(in srgb, var(--player-color) 50%, var(--surface));
  box-shadow:
    0 8px 16px rgba(0, 0, 0, 0.16),
    inset 0 0 0 2px rgba(255, 255, 255, 0.36);
}

.player-avatar span {
  color: #fff;
  font-size: 18px;
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.46);
}

.player-vp {
  min-width: 42px;
  min-height: 24px;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-weight: 950;
}

.player-vp small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
}

.player-row strong {
  display: block;
  font-size: 14px;
}

.player-row small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.player-holdings {
  display: grid;
  grid-template-columns: repeat(2, minmax(48px, 1fr));
  gap: 6px;
}

.holding-card {
  min-width: 0;
  min-height: 58px;
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 1px;
  padding: 6px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  overflow: hidden;
}

.holding-card svg {
  width: 23px;
  height: 23px;
  color: var(--accent);
  stroke-width: 2.3;
}

.holding-card strong {
  position: absolute;
  top: 4px;
  right: 5px;
  min-width: 20px;
  min-height: 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--control-strong-bg);
  color: var(--control-strong-text);
  font-size: 12px;
  line-height: 1;
}

.holding-card small {
  font-size: 9px;
  font-weight: 850;
  line-height: 1;
}

.player-piece-stats {
  display: grid;
  grid-template-columns: repeat(3, 36px);
  gap: 5px;
  color: var(--muted);
}

.player-piece-stats span {
  display: grid;
  justify-items: center;
  gap: 1px;
}

.player-piece-stats svg {
  width: 28px;
  height: 22px;
  overflow: visible;
}

.player-piece-stats svg line,
.player-piece-stats svg path {
  fill: color-mix(in srgb, var(--muted) 42%, transparent);
  stroke: var(--muted);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.player-piece-stats strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1;
}

.player-piece-stats small {
  font-size: 8.5px;
  font-weight: 850;
  line-height: 1;
}

.award-row {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.log-card ol {
  margin: 10px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
}

.log-card li {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

@media (max-width: 1020px) {
  .app-shell {
    padding: 0 0 10px;
  }

  .topbar {
    top: 0;
  }

  .game-layout {
    grid-template-columns: 1fr;
  }

  .game-layout.is-board-width-custom {
    grid-template-columns: 1fr;
  }

  .board-panel {
    min-height: auto;
  }

  .board-stage {
    height: var(--board-height, min(72vh, 680px));
    min-height: 340px;
  }

  .board-resize-x,
  .board-resize-corner {
    display: none;
  }

  .board-svg {
    height: 100%;
    min-height: 0;
  }

  .side-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 6px;
    padding: 8px 10px;
  }

  .topbar h1 {
    font-size: 18px;
  }

  .topbar-center {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
  }

  .topbar-actions {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }

  .nav-button {
    min-width: 0;
    padding: 0 9px;
  }

  .new-game-button {
    width: auto;
  }

  .nav-button.icon-only {
    width: 36px;
    min-height: 36px;
  }

  .nav-button span {
    font-size: 12px;
  }

  .board-svg {
    height: 100%;
    min-height: 0;
  }

  .board-stage {
    --board-floating-inset: 10px;
    height: var(--board-height, 58vh);
    min-height: 320px;
  }

  .board-controls {
    top: 8px;
    right: 8px;
    gap: 6px;
  }

  .board-control {
    width: 36px;
    min-height: 36px;
  }

  .board-turn-controls {
    --dice-size: 30px;
    --dice-space: 5px;
    --dice-prompt-width: 184px;
  }

  .board-end-turn {
    height: calc(var(--dice-size) + (var(--dice-space) * 2) + 0.5px);
  }

  .board-dice.is-roll-prompt {
    min-width: 0;
    max-width: calc(100% - 16px);
  }

  .board-dice.is-collapsed {
    min-width: var(--dice-collapsed-width);
    max-width: var(--dice-collapsed-width);
  }

  .dice-prompt strong {
    font-size: 15px;
  }

  .turn-badge-dot {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
  }

  .board-lock-toggle {
    left: var(--board-floating-inset);
    bottom: var(--board-floating-inset);
    width: 38px;
    min-height: 38px;
  }

  .board-resize-y {
    left: 56px;
    right: 96px;
  }

  .board-die {
    gap: 2px;
    padding: 5px;
  }

  .die-pip {
    width: 4.5px;
    height: 4.5px;
  }

  .resource-strip {
    grid-template-columns: repeat(5, minmax(54px, 1fr));
    overflow-x: auto;
  }

  .action-grid,
  .card-list,
  .victim-list,
  .resource-picker {
    grid-template-columns: 1fr;
  }

  .trade-card-grid {
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  }

  .player-row {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .player-holdings,
  .player-piece-stats {
    grid-column: 1 / -1;
  }

  .player-piece-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .home-screen {
    align-items: start;
  }

  .home-hero {
    min-height: 0;
    grid-template-columns: 1fr;
    padding: 18px 0 28px;
  }

  .home-copy h2 {
    max-width: 14ch;
    font-size: 42px;
  }

  .home-board-card {
    order: 0;
  }

  .home-copy {
    order: -1;
  }

  .home-board-visual::after {
    background: rgba(0, 0, 0, 0.22);
  }

  .home-info-grid {
    grid-template-columns: 1fr;
  }

  .home-options {
    align-items: stretch;
    flex-direction: column;
  }

  .home-options .primary {
    align-self: flex-start;
  }
}

@media (max-width: 620px) {
  .home-copy h2 {
    max-width: 15ch;
    font-size: 34px;
  }

  .home-copy > p:not(.eyebrow) {
    font-size: 15px;
  }

  .home-board-visual .hero-start {
    min-height: 42px;
    padding: 0 15px;
  }

  .home-section-head h2,
  .home-options h2 {
    font-size: 23px;
  }

  .home-options {
    padding: 14px 0;
  }

  .home-footer {
    padding: 16px;
  }

  .footer-links {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .footer-links h3 {
    font-size: 11px;
  }

  .footer-links a,
  .footer-links button {
    font-size: 12px;
    line-height: 1.25;
  }

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
  }

  .setup-backdrop {
    align-items: end;
    padding: 10px;
  }

  .setup-modal {
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
  }

  .setup-grid {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .setup-head,
  .setup-actions {
    padding: 12px;
  }

  .setup-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}
