:root {
  --bg: #060913;
  --bg-soft: #101828;
  --panel: rgba(12, 20, 38, 0.88);
  --panel-strong: rgba(18, 29, 52, 0.96);
  --border: rgba(88, 136, 255, 0.5);
  --border-strong: rgba(120, 177, 255, 0.9);
  --text: #f4f7ff;
  --muted: #9cb0d7;
  --gold: #ffc85a;
  --danger: #ff7d7d;
  --success: #72e68d;
  --shadow: 0 28px 64px rgba(0, 0, 0, 0.4);
  --accent: #4fd6ff;
  --plains: #4f9546;
  --forest: #295333;
  --mountain: #667085;
  --water: #2651b1;
  --road: #d4a24f;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(79, 214, 255, 0.16), transparent 36%),
    radial-gradient(circle at bottom left, rgba(255, 200, 90, 0.12), transparent 32%),
    linear-gradient(180deg, #091121 0%, #04060d 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1600px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.screen {
  display: block;
}

.menu-screen {
  min-height: calc(100vh - 64px);
}

.menu-scene {
  position: relative;
  min-height: calc(100vh - 72px);
  border-radius: 34px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(2, 12, 34, 0.06), rgba(3, 12, 24, 0.2)),
    url("assets/menu-lake.png") center center / cover no-repeat;
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.38);
}

.menu-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(4, 9, 22, 0.18)),
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.16), transparent 34%);
  pointer-events: none;
}

.menu-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(22px, 3vw, 42px);
}

.menu-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.menu-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(20px, 3vw, 40px);
  align-items: end;
  min-height: 100%;
  padding: clamp(24px, 6vw, 72px) 0 clamp(12px, 2vw, 20px);
}

.menu-copy {
  max-width: 620px;
  align-self: center;
  display: grid;
  gap: 18px;
  padding-top: clamp(40px, 11vh, 140px);
}

.menu-eyebrow {
  margin: 0;
  color: rgba(255, 255, 255, 0.92);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.82rem;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.22);
}

.menu-title {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 0.08em;
  font-size: clamp(3.4rem, 9vw, 6.8rem);
  line-height: 0.82;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-shadow: 0 12px 30px rgba(3, 16, 34, 0.24);
}

.menu-title-kingdom {
  display: block;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.menu-title-power {
  display: inline-grid;
  place-items: center;
  min-width: 0.74em;
  min-height: 0.74em;
  margin-top: -0.08em;
  padding: 0.03em 0.12em 0.08em;
  border: 0.045em solid rgba(255, 255, 255, 0.82);
  border-radius: 0.12em;
  font-family: "Impact", "Arial Black", "Trebuchet MS", sans-serif;
  font-weight: 900;
  font-size: 0.46em;
  line-height: 1;
  color: #ffffff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.08)),
    rgba(17, 46, 82, 0.2);
  box-shadow:
    inset 0 0.05em 0 rgba(255, 255, 255, 0.22),
    0 0.09em 0 rgba(17, 46, 82, 0.78),
    0 0.22em 0.32em rgba(3, 16, 34, 0.24);
  text-shadow:
    0 0.05em 0 rgba(17, 46, 82, 0.78),
    0 0.14em 0.24em rgba(3, 16, 34, 0.26);
}

.menu-tagline {
  max-width: 32ch;
  margin: 0;
  color: rgba(242, 248, 255, 0.92);
  font-size: clamp(1rem, 2.1vw, 1.24rem);
  line-height: 1.6;
  text-shadow: 0 2px 18px rgba(2, 10, 21, 0.24);
}

.menu-action-stack {
  display: grid;
  gap: 14px;
  max-width: 520px;
}

.menu-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.menu-launch-button,
.menu-option-button {
  backdrop-filter: blur(8px);
  box-shadow: 0 16px 34px rgba(2, 10, 21, 0.18);
}

.menu-launch-button {
  justify-self: start;
  min-width: 220px;
  padding-inline: 26px;
  font-size: 1rem;
}

.menu-option-button {
  min-width: 150px;
}

.menu-sidecard {
  align-self: end;
  display: grid;
  gap: 16px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(17, 29, 54, 0.84), rgba(11, 17, 32, 0.82));
}

.menu-status {
  display: grid;
  gap: 4px;
  min-width: 118px;
  padding: 12px 14px;
  border-radius: 18px;
  background: rgba(5, 14, 34, 0.28);
  backdrop-filter: blur(10px);
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(1, 4, 12, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 14px 26px rgba(4, 11, 24, 0.18);
}

.menu-status-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.92;
}

.menu-status-value {
  font-size: 1.1rem;
  letter-spacing: 0.04em;
}

.menu-footer-version {
  align-self: flex-start;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.98rem;
  letter-spacing: 0.06em;
  text-shadow: 0 2px 12px rgba(2, 10, 21, 0.22);
}

.shop-menu-button {
  position: absolute;
  right: clamp(10px, 1.5vw, 22px);
  bottom: clamp(10px, 1.5vw, 22px);
  z-index: 4;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-width: 132px;
  min-height: 54px;
  padding: 12px 20px;
  border: 2px solid rgba(255, 255, 255, 0.74);
  border-radius: 18px;
  color: #13202c;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background:
    linear-gradient(180deg, #fff4b8 0%, #ffd267 52%, #f0a532 100%);
  box-shadow:
    0 12px 0 rgba(143, 86, 22, 0.72),
    0 22px 32px rgba(4, 12, 24, 0.28);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.shop-menu-button:hover {
  transform: translateY(-2px);
  box-shadow:
    0 14px 0 rgba(143, 86, 22, 0.72),
    0 26px 34px rgba(4, 12, 24, 0.3);
}

.menu-sidecard .portrait-canvas {
  width: min(100%, 220px);
  justify-self: center;
}

.menu-sidecard .stats-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.hidden {
  display: none !important;
}

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

.panel {
  background: linear-gradient(180deg, rgba(17, 29, 54, 0.98), rgba(11, 17, 32, 0.95));
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.hero-panel {
  display: grid;
  grid-template-columns: 1.35fr 0.85fr;
  gap: 24px;
  padding: 32px;
  overflow: hidden;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.82rem;
}

.hero-copy h1 {
  margin: 0 0 16px;
  font-size: clamp(3rem, 6vw, 5.5rem);
  line-height: 0.95;
}

.hero-text {
  max-width: 60ch;
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.65;
}

.hero-actions,
.form-button-row,
.topbar-actions,
.card-header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-actions {
  margin-top: 28px;
}

.primary-button,
.secondary-button,
.ghost-button {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 12px 18px;
  font-weight: 700;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.primary-button {
  color: #05111d;
  background: linear-gradient(135deg, var(--gold), #ffe39d);
}

.secondary-button {
  color: var(--text);
  background: linear-gradient(135deg, rgba(79, 214, 255, 0.22), rgba(79, 214, 255, 0.08));
  border-color: rgba(79, 214, 255, 0.55);
}

.ghost-button {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.compact-button {
  padding: 10px 14px;
  font-size: 0.92rem;
}

.full-width-button {
  width: 100%;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.tile:hover,
.candidate-card button:hover,
.worker-card button:hover,
.tech-node-button:hover {
  transform: translateY(-1px);
}

.leader-preview-card {
  display: grid;
  gap: 16px;
  align-content: center;
  padding: 12px;
}

.portrait-canvas {
  width: min(100%, 320px);
  aspect-ratio: 1 / 1;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(135deg, rgba(79, 214, 255, 0.18), rgba(255, 200, 90, 0.15));
  image-rendering: pixelated;
}

.small-portrait {
  width: 100%;
  max-width: 220px;
}

.leader-preview-summary,
.leader-card-summary,
.selection-details,
.kingdom-summary,
.tech-summary,
.candidate-list,
.event-log,
.tech-node-details,
.info-copy {
  color: var(--muted);
  line-height: 1.6;
}

.menu-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.menu-card {
  padding: 22px;
}

.menu-card h2,
.panel h2 {
  margin: 0 0 14px;
  font-size: 1.2rem;
}

.tech-preview-image {
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(120, 177, 255, 0.28);
  background: #000;
}

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

.stats-grid dt {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stats-grid dd {
  margin: 6px 0 0;
  color: var(--text);
  font-size: 1.3rem;
  font-weight: 700;
}

.topbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, auto)) 1fr;
  gap: 12px;
  align-items: center;
  padding: 16px 20px;
}

.topbar-group {
  display: grid;
  gap: 2px;
}

.topbar-label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.game-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 360px;
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

.sidebar,
.board-column {
  display: grid;
  gap: 20px;
}

.leader-panel,
.workers-panel,
.tech-summary-panel,
.selection-panel,
.kingdom-panel,
.log-panel,
.objective-strip,
.legend {
  padding: 20px;
}

.leader-panel-body {
  display: grid;
  gap: 16px;
  justify-items: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.82rem;
  font-weight: 700;
}

.status-player {
  color: #06111d;
  background: linear-gradient(135deg, var(--success), #b9f3c7);
}

.status-ai {
  color: #1c0810;
  background: linear-gradient(135deg, #ff9b9b, #ffd1d1);
}

.workers-grid {
  display: grid;
  gap: 12px;
}

.worker-card,
.candidate-card {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(255, 255, 255, 0.04);
  padding: 14px;
}

.worker-card.locked {
  opacity: 0.7;
}

.worker-card h3,
.candidate-card h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.worker-card p,
.candidate-card p,
.selection-details p,
.kingdom-summary p,
.leader-preview-summary p,
.leader-card-summary p,
.tech-summary p,
.tech-node-details p,
.event-entry p,
.info-copy p {
  margin: 0 0 10px;
}

.candidate-list {
  display: grid;
  gap: 12px;
}

.candidate-list h3 {
  margin: 0;
  color: var(--text);
}

.board-column {
  min-width: 0;
}

.objective-strip {
  color: var(--muted);
  font-size: 0.98rem;
}

.board {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 7px;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 28px 30px 38px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.55), transparent 34%),
    linear-gradient(180deg, #c9ecff 0%, #8ab8ff 24%, #4d72bf 100%);
  border: 2px solid rgba(255, 255, 255, 0.34);
  border-radius: 34px;
  box-shadow:
    0 24px 58px rgba(3, 10, 26, 0.38),
    inset 0 2px 0 rgba(255, 255, 255, 0.42);
  transform: perspective(1800px) rotateX(18deg);
  transform-origin: center top;
  transform-style: preserve-3d;
}

.tile {
  --tile-top: #8ade63;
  --tile-mid: #68c04c;
  --tile-edge: #4d983d;
  --tile-shadow: #346b2d;
  position: relative;
  min-width: 0;
  aspect-ratio: 1 / 1;
  border: 0;
  border-radius: 7px;
  background: linear-gradient(145deg, var(--tile-top) 0%, var(--tile-mid) 62%, var(--tile-edge) 100%);
  overflow: visible;
  color: var(--text);
  box-shadow:
    0 10px 0 var(--tile-shadow),
    0 18px 20px rgba(3, 10, 22, 0.24);
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.tile::before {
  content: "";
  position: absolute;
  inset: 3px 3px 12px;
  border-radius: 5px;
  opacity: 0.9;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.32), transparent 44%, rgba(0, 0, 0, 0.06));
  pointer-events: none;
  z-index: 0;
}

.tile::after {
  content: "";
  position: absolute;
  inset: auto 5px -11px 8px;
  height: 12px;
  border-radius: 0 0 6px 6px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.08), var(--tile-shadow));
  clip-path: polygon(0 0, 100% 0, 92% 100%, 8% 100%);
  pointer-events: none;
  z-index: 0;
}

.tile[data-terrain="plains"] {
  --tile-top: #8ee35b;
  --tile-mid: #6fca4d;
  --tile-edge: #4ea23c;
  --tile-shadow: #346f2d;
}

.tile[data-terrain="forest"] {
  --tile-top: #56b15d;
  --tile-mid: #2f8644;
  --tile-edge: #1f5a31;
  --tile-shadow: #153823;
}

.tile[data-terrain="mountain"] {
  --tile-top: #d7dde5;
  --tile-mid: #aeb8c6;
  --tile-edge: #7d8da2;
  --tile-shadow: #5c697a;
}

.tile[data-terrain="water"] {
  --tile-top: #6fc7ff;
  --tile-mid: #3f93ef;
  --tile-edge: #2668cc;
  --tile-shadow: #194898;
}

.tile.selected {
  transform: translateY(-4px);
  outline: 3px solid rgba(255, 212, 102, 0.92);
  outline-offset: 2px;
  z-index: 4;
}

.tile.reachable {
  filter: saturate(1.06) brightness(1.02);
  box-shadow:
    0 10px 0 var(--tile-shadow),
    0 0 0 3px rgba(114, 230, 141, 0.7),
    0 18px 20px rgba(3, 10, 22, 0.24);
}

.tile.attackable {
  box-shadow:
    0 10px 0 var(--tile-shadow),
    0 0 0 3px rgba(255, 125, 125, 0.8),
    0 18px 20px rgba(3, 10, 22, 0.24);
}

.tile.player-territory {
  filter: saturate(1.06);
}

.tile.enemy-territory {
  filter: saturate(0.96);
}

.tile-coord,
.terrain-prop,
.resource-badge,
.city-crest,
.city-badge,
.unit-badge,
.hp-badge,
.road-mark {
  position: absolute;
  z-index: 1;
}

.tile-coord {
  display: none;
  top: 6px;
  right: 8px;
  font-size: 0.62rem;
  color: rgba(255, 255, 255, 0.6);
  opacity: 0;
  transition: opacity 120ms ease;
}

.tile:hover .tile-coord,
.tile.selected .tile-coord {
  opacity: 1;
}

.terrain-prop {
  inset: auto 7% 16% 7%;
  height: 54%;
  pointer-events: none;
}

.terrain-prop span,
.resource-badge span,
.city-crest span,
.unit-badge span {
  position: absolute;
}

.terrain-prop::after {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: -2px;
  height: 12%;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.12);
  filter: blur(1px);
}

.terrain-prop.plains .tuft {
  bottom: 3%;
  clip-path: polygon(14% 38%, 58% 0, 100% 34%, 90% 100%, 0 100%, 0 58%);
}

.terrain-prop.plains .tuft-one {
  left: 14%;
  width: 38%;
  height: 24%;
  background: linear-gradient(135deg, #c8f7a1, #77c652 56%, #4f973d 100%);
}

.terrain-prop.plains .tuft-two {
  left: 48%;
  width: 30%;
  height: 34%;
  background: linear-gradient(135deg, #dbffb6, #8cdb68 58%, #5fa847 100%);
}

.terrain-prop.forest .tree {
  bottom: 4%;
  width: 24%;
  clip-path: polygon(50% 0, 100% 54%, 82% 56%, 82% 100%, 18% 100%, 18% 56%, 0 54%);
}

.terrain-prop.forest .tree-back {
  left: 16%;
  height: 48%;
  background: linear-gradient(180deg, #2b7d3b, #184923 78%);
}

.terrain-prop.forest .tree-mid {
  left: 39%;
  height: 66%;
  background: linear-gradient(180deg, #69cf61, #2a7a38 72%, #164821 100%);
}

.terrain-prop.forest .tree-front {
  left: 60%;
  height: 42%;
  background: linear-gradient(180deg, #3f964c, #1d552a 78%);
}

.terrain-prop.mountain .peak {
  bottom: 0;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.terrain-prop.mountain .peak-back {
  left: 8%;
  width: 44%;
  height: 56%;
  background: linear-gradient(180deg, #eef3f8, #b5bfcd 58%, #7b8798 100%);
}

.terrain-prop.mountain .peak-front {
  left: 42%;
  width: 44%;
  height: 78%;
  background: linear-gradient(180deg, #fcfeff, #cad2dc 56%, #8f9caf 100%);
}

.terrain-prop.mountain .peak::after {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  top: 14%;
  height: 28%;
  background: rgba(255, 255, 255, 0.92);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.terrain-prop.water .ripple {
  left: 50%;
  transform: translateX(-50%);
  clip-path: polygon(0 46%, 16% 28%, 44% 24%, 70% 0, 100% 26%, 84% 70%, 58% 82%, 26% 100%, 0 72%);
}

.terrain-prop.water .ripple-one {
  bottom: 18%;
  width: 56%;
  height: 22%;
  background: linear-gradient(135deg, rgba(222, 248, 255, 0.96), rgba(147, 219, 255, 0.5));
}

.terrain-prop.water .ripple-two {
  bottom: 4%;
  width: 38%;
  height: 14%;
  background: linear-gradient(135deg, rgba(215, 245, 255, 0.92), rgba(116, 196, 255, 0.42));
}

.resource-badge,
.city-badge,
.hp-badge {
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 4px 7px;
}

.resource-badge {
  top: 8px;
  left: 8px;
  width: 30px;
  height: 30px;
  padding: 0;
  background: transparent;
  border: 0;
  opacity: 1;
}

.resource-farm .field {
  bottom: 2px;
  width: 14px;
  height: 10px;
  clip-path: polygon(0 28%, 50% 0, 100% 28%, 100% 100%, 0 100%);
}

.resource-farm .field-left {
  left: 1px;
  background: linear-gradient(135deg, #ffd972, #d4a042 68%, #9d6e24 100%);
}

.resource-farm .field-right {
  left: 13px;
  background: linear-gradient(135deg, #ffe59c, #e8bd55 68%, #ae7a29 100%);
}

.resource-farm .farm-house {
  left: 10px;
  top: 4px;
  width: 10px;
  height: 11px;
  background: linear-gradient(180deg, #fff6e7, #d9ceb8);
  border-radius: 2px 2px 3px 3px;
}

.resource-farm .farm-house::before {
  content: "";
  position: absolute;
  inset: -5px -2px auto;
  height: 6px;
  background: linear-gradient(180deg, #ff8b67, #d45a39);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.resource-ore .resource-shard {
  bottom: 3px;
  width: 9px;
  background: linear-gradient(180deg, #ffffff, #d1deff 58%, #7da3ff 100%);
  clip-path: polygon(50% 0, 100% 35%, 74% 100%, 22% 100%, 0 35%);
}

.resource-ore .resource-shard:nth-child(1) {
  left: 2px;
  height: 13px;
}

.resource-ore .resource-shard:nth-child(2) {
  left: 10px;
  height: 19px;
}

.resource-ore .resource-shard:nth-child(3) {
  left: 19px;
  height: 12px;
}

.resource-wood .resource-log {
  width: 16px;
  height: 7px;
  border-radius: 5px;
  background: linear-gradient(180deg, #d6a465, #a96f31);
  border: 1px solid rgba(88, 52, 29, 0.42);
}

.resource-wood .resource-log:nth-child(1) {
  left: 3px;
  top: 11px;
  transform: rotate(-18deg);
}

.resource-wood .resource-log:nth-child(2) {
  left: 11px;
  top: 16px;
  transform: rotate(16deg);
}

.resource-fish .resource-fish-body {
  left: 5px;
  top: 11px;
  width: 14px;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff, #d5f3ff 72%, #84d6ff 100%);
}

.resource-fish .resource-fish-tail {
  left: 18px;
  top: 10px;
  width: 9px;
  height: 11px;
  background: #d7f0ff;
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
}

.city-crest {
  inset: auto auto 16px 50%;
  width: 48px;
  height: 38px;
  transform: translateX(-50%);
}

.city-tower {
  bottom: 0;
  width: 14px;
  border-radius: 4px 4px 3px 3px;
  background: linear-gradient(180deg, #f7f9fc, #cbd2dd 100%);
  box-shadow: 0 3px 0 rgba(56, 63, 79, 0.18);
}

.city-left::before,
.city-right::before {
  content: "";
  position: absolute;
  inset: -6px -1px auto;
  height: 7px;
  background: linear-gradient(180deg, #ffdc77, #d8a443);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.city-left {
  left: 2px;
  height: 18px;
}

.city-center {
  left: 17px;
  height: 30px;
}

.city-right {
  right: 2px;
  height: 20px;
}

.city-center::before {
  content: "";
  position: absolute;
  inset: -8px 2px auto;
  height: 10px;
  background: linear-gradient(180deg, #ffe387, #d8a443);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.player-city .city-tower {
  background: linear-gradient(180deg, #ffffff, #d9deea 100%);
}

.player-city .city-center::before,
.player-city .city-left::before,
.player-city .city-right::before {
  background: linear-gradient(180deg, #6fd7ff, #2e89cc);
}

.enemy-settlement .city-tower {
  background: linear-gradient(180deg, #ffe3e3, #d5a8a8 100%);
}

.enemy-settlement .city-center::before,
.enemy-settlement .city-left::before,
.enemy-settlement .city-right::before {
  background: linear-gradient(180deg, #ffb0b0, #ce5d5d);
}

.neutral-settlement .city-tower {
  background: linear-gradient(180deg, #faf7ed, #d7d0be 100%);
}

.neutral-settlement .city-center::before,
.neutral-settlement .city-left::before,
.neutral-settlement .city-right::before {
  background: linear-gradient(180deg, #e9cf9c, #ab8244);
}

.capital-settlement {
  transform: translateX(-50%) scale(1.05);
}

.village-settlement .city-center {
  height: 17px;
}

.village-settlement .city-left,
.village-settlement .city-right {
  height: 14px;
}

.village-settlement .city-center::before,
.village-settlement .city-left::before,
.village-settlement .city-right::before {
  background: linear-gradient(180deg, #d3b47e, #9e7741);
}

.city-badge {
  top: 4px;
  right: 4px;
  left: auto;
  bottom: auto;
  background: rgba(255, 247, 224, 0.95);
  color: #4c3412;
  font-size: 0.48rem;
  letter-spacing: 0.08em;
  padding: 3px 5px;
  box-shadow: 0 2px 0 rgba(38, 20, 3, 0.14);
}

.city-badge.enemy-city {
  background: rgba(255, 125, 125, 0.92);
  color: #2d0910;
}

.city-badge.neutral-city {
  background: rgba(255, 255, 255, 0.86);
  color: #0e1321;
}

.unit-badge {
  top: 51%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: block;
  width: 56px;
  height: 56px;
  min-width: 56px;
  min-height: 56px;
  background: transparent;
  border: 0;
  box-shadow: none;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.28));
  z-index: 2;
}

.unit-badge::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid transparent;
  z-index: 0;
}

.unit-badge span {
  z-index: 1;
}

.unit-base {
  left: 14px;
  right: 14px;
  bottom: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(7, 12, 22, 0.28);
  filter: blur(1px);
}

.unit-body {
  left: 17px;
  bottom: 16px;
  width: 22px;
  height: 18px;
  background: var(--unit-primary);
  clip-path: polygon(50% 0, 100% 22%, 84% 100%, 16% 100%, 0 22%);
}

.unit-head {
  left: 18px;
  top: 10px;
  width: 20px;
  height: 20px;
  background: var(--unit-skin);
  clip-path: polygon(22% 0, 78% 0, 100% 26%, 100% 78%, 72% 100%, 28% 100%, 0 76%, 0 24%);
}

.unit-hair {
  left: 16px;
  top: 6px;
  width: 24px;
  height: 14px;
  background: var(--unit-hair);
  clip-path: polygon(18% 8%, 82% 0, 100% 38%, 86% 100%, 52% 62%, 18% 100%, 0 38%);
}

.unit-gear {
  left: 14px;
  top: 24px;
  width: 28px;
  height: 8px;
  background: var(--unit-trim);
  clip-path: polygon(14% 0, 86% 0, 100% 50%, 86% 100%, 14% 100%, 0 50%);
}

.unit-weapon {
  right: 8px;
  top: 15px;
  width: 6px;
  height: 24px;
  background: var(--unit-trim);
  border-radius: 4px;
  transform: rotate(16deg);
}

.unit-mount {
  display: none;
}

.unit-badge.friendly .unit-base {
  background: rgba(79, 214, 255, 0.28);
}

.unit-badge.friendly::after {
  border-color: rgba(79, 214, 255, 0.42);
}

.unit-badge.enemy .unit-base {
  background: rgba(255, 125, 125, 0.28);
}

.unit-badge.enemy::after {
  border-color: rgba(255, 125, 125, 0.42);
}

.unit-badge[data-unit="defender"] .unit-hair,
.unit-badge[data-unit="knight"] .unit-hair {
  top: 4px;
  height: 16px;
  background: linear-gradient(180deg, var(--unit-highlight), var(--unit-hair));
  clip-path: polygon(18% 18%, 50% 0, 82% 18%, 100% 62%, 76% 100%, 24% 100%, 0 62%);
}

.unit-badge[data-unit="archer"] .unit-hair,
.unit-badge[data-unit="scout"] .unit-hair {
  top: 5px;
  height: 18px;
  background: var(--unit-primary);
  clip-path: polygon(50% 0, 94% 36%, 82% 100%, 18% 100%, 6% 36%);
}

.unit-badge[data-unit="wizard"] .unit-hair {
  top: 1px;
  left: 15px;
  width: 20px;
  height: 22px;
  background: linear-gradient(180deg, var(--unit-highlight), var(--unit-hair));
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.unit-badge[data-unit="rider"] .unit-mount,
.unit-badge[data-unit="knight"] .unit-mount {
  display: block;
  left: 8px;
  bottom: 11px;
  width: 34px;
  height: 16px;
  background: var(--unit-secondary);
  clip-path: polygon(8% 42%, 30% 18%, 60% 20%, 90% 0, 100% 40%, 86% 70%, 70% 100%, 14% 100%, 0 66%);
}

.unit-badge[data-unit="rider"] .unit-body,
.unit-badge[data-unit="knight"] .unit-body {
  bottom: 18px;
}

.unit-badge[data-unit="catapult"] .unit-head,
.unit-badge[data-unit="catapult"] .unit-hair,
.unit-badge[data-unit="catapult"] .unit-gear {
  display: none;
}

.unit-badge[data-unit="catapult"] .unit-body {
  left: 8px;
  bottom: 13px;
  width: 34px;
  height: 14px;
  background: #9e7447;
  clip-path: polygon(0 60%, 12% 10%, 82% 10%, 100% 60%, 90% 100%, 10% 100%);
}

.unit-badge[data-unit="catapult"] .unit-weapon {
  right: 8px;
  top: 4px;
  width: 4px;
  height: 28px;
  background: #d3b17d;
  transform: rotate(52deg);
  transform-origin: bottom center;
}

.unit-badge[data-unit="boat"] .unit-head,
.unit-badge[data-unit="battleship"] .unit-head,
.unit-badge[data-unit="airship"] .unit-head,
.unit-badge[data-unit="boat"] .unit-hair,
.unit-badge[data-unit="battleship"] .unit-hair,
.unit-badge[data-unit="airship"] .unit-hair,
.unit-badge[data-unit="boat"] .unit-gear,
.unit-badge[data-unit="battleship"] .unit-gear,
.unit-badge[data-unit="airship"] .unit-gear {
  display: none;
}

.unit-badge[data-unit="boat"] .unit-body,
.unit-badge[data-unit="battleship"] .unit-body {
  left: 8px;
  bottom: 13px;
  width: 34px;
  height: 18px;
  background: linear-gradient(180deg, var(--unit-highlight), var(--unit-primary));
  clip-path: polygon(10% 0, 90% 0, 100% 42%, 74% 100%, 26% 100%, 0 42%);
}

.unit-badge[data-unit="boat"] .unit-weapon,
.unit-badge[data-unit="battleship"] .unit-weapon {
  right: 21px;
  top: 4px;
  width: 10px;
  height: 24px;
  background: linear-gradient(180deg, var(--unit-trim), #ffffff);
  clip-path: polygon(0 0, 100% 18%, 64% 100%, 0 78%);
  transform: rotate(0deg);
}

.unit-badge[data-unit="battleship"] .unit-weapon {
  right: 9px;
  top: 10px;
  width: 22px;
  height: 6px;
  background: var(--unit-trim);
  clip-path: polygon(0 50%, 18% 0, 100% 0, 100% 100%, 18% 100%);
}

.unit-badge[data-unit="airship"] .unit-body {
  left: 7px;
  top: 12px;
  width: 36px;
  height: 20px;
  background: linear-gradient(180deg, #eef6ff, var(--unit-primary));
  border-radius: 999px;
}

.unit-badge[data-unit="airship"] .unit-weapon {
  right: 15px;
  top: 30px;
  width: 18px;
  height: 10px;
  background: var(--unit-trim);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  transform: rotate(0deg);
}

.unit-badge[data-unit="giant"] {
  width: 56px;
  height: 56px;
}

.unit-badge[data-unit="giant"] .unit-head {
  left: 15px;
  top: 6px;
  width: 24px;
  height: 24px;
}

.unit-badge[data-unit="giant"] .unit-hair {
  left: 13px;
  top: 2px;
  width: 28px;
  height: 17px;
}

.unit-badge[data-unit="giant"] .unit-body {
  left: 13px;
  bottom: 12px;
  width: 28px;
  height: 22px;
}

.unit-badge[data-unit="giant"] .unit-weapon {
  right: 5px;
  top: 12px;
  width: 8px;
  height: 28px;
}

.unit-badge[data-unit="archer"] .unit-weapon {
  right: 4px;
  top: 14px;
  width: 14px;
  height: 18px;
  background: transparent;
  border: 2px solid var(--unit-trim);
  border-left-width: 3px;
  border-radius: 50%;
  transform: rotate(12deg);
}

.unit-badge[data-unit="defender"] .unit-weapon {
  right: 4px;
  top: 15px;
  width: 12px;
  height: 18px;
  background: var(--unit-secondary);
  border-radius: 12px 12px 6px 6px;
  transform: rotate(0deg);
}

.unit-badge[data-unit="wizard"] .unit-weapon {
  right: 8px;
  top: 10px;
  width: 5px;
  height: 24px;
  background: var(--unit-highlight);
  transform: rotate(0deg);
}

.unit-badge[data-unit="warrior"] .unit-weapon,
.unit-badge[data-unit="rider"] .unit-weapon,
.unit-badge[data-unit="knight"] .unit-weapon,
.unit-badge[data-unit="scout"] .unit-weapon {
  background: linear-gradient(180deg, var(--unit-highlight), var(--unit-trim));
}

.hp-badge {
  right: 3px;
  bottom: 3px;
  background: rgba(6, 9, 19, 0.62);
  font-size: 0.46rem;
  padding: 2px 4px;
  z-index: 3;
}

.road-mark {
  inset: 63% 8px auto;
  height: 12%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(223, 185, 109, 0.08), rgba(223, 185, 109, 0.98), rgba(223, 185, 109, 0.08));
  box-shadow: 0 1px 0 rgba(112, 73, 16, 0.18);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.legend-swatch {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  box-shadow: 0 4px 0 rgba(8, 15, 30, 0.18);
}

.legend-swatch.plains {
  background: var(--plains);
}

.legend-swatch.forest {
  background: var(--forest);
}

.legend-swatch.mountain {
  background: var(--mountain);
}

.legend-swatch.water {
  background: var(--water);
}

.legend-swatch.road {
  background: var(--road);
}

.game-layout {
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 18px;
}

.board-column {
  display: block;
}

.board-stage {
  position: relative;
  width: min(100%, 1120px);
  margin: 0 auto;
}

.board {
  gap: 2px;
  width: 100%;
  padding: 18px 22px 24px;
  background: #000000;
  border: 0;
  border-radius: 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.tile {
  border-radius: 3px;
  overflow: visible;
  box-shadow: none;
}

.tile::before {
  inset: 0;
  border-radius: 3px;
  opacity: 0.22;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 52%);
}

.tile::after {
  display: none;
}

.tile[data-terrain="plains"] {
  --tile-top: #d7de52;
  --tile-mid: #bfd744;
  --tile-edge: #a9c138;
  --tile-shadow: #89992b;
}

.tile[data-terrain="forest"] {
  --tile-top: #4f8c63;
  --tile-mid: #356b4c;
  --tile-edge: #224c38;
  --tile-shadow: #18392a;
}

.tile[data-terrain="mountain"] {
  --tile-top: #bcc2cb;
  --tile-mid: #939eac;
  --tile-edge: #707d90;
  --tile-shadow: #5c6472;
}

.tile[data-terrain="water"] {
  --tile-top: #7dcbff;
  --tile-mid: #4d97ea;
  --tile-edge: #3675cf;
  --tile-shadow: #25539b;
}

.tile.player-territory {
  box-shadow: inset 0 0 0 2px rgba(74, 222, 255, 0.32);
}

.tile.enemy-territory {
  box-shadow: inset 0 0 0 2px rgba(255, 191, 84, 0.32);
}

.terrain-prop {
  inset: auto 9% 13% 9%;
  height: 50%;
}

.terrain-prop::after {
  opacity: 0.22;
}

.terrain-prop.plains .tuft-one,
.terrain-prop.plains .tuft-two {
  bottom: 8%;
  height: 18%;
}

.terrain-prop.forest .tree {
  width: 20%;
  bottom: 6%;
}

.terrain-prop.forest .tree-back {
  left: 14%;
  height: 42%;
}

.terrain-prop.forest .tree-mid {
  left: 39%;
  height: 58%;
}

.terrain-prop.forest .tree-front {
  left: 63%;
  height: 38%;
}

.terrain-prop.mountain .peak-back {
  height: 48%;
}

.terrain-prop.mountain .peak-front {
  height: 64%;
}

.terrain-prop.water .ripple-one,
.terrain-prop.water .ripple-two {
  border-radius: 999px;
}

.resource-badge {
  top: auto;
  left: auto;
  right: 6px;
  bottom: 6px;
  width: 28px;
  height: 28px;
}

.resource-farm .field {
  height: 11px;
}

.resource-farm .farm-house {
  top: 2px;
}

.resource-wood .resource-log:nth-child(1) {
  left: 2px;
  top: 10px;
}

.resource-wood .resource-log:nth-child(2) {
  left: 10px;
  top: 15px;
}

.city-crest {
  inset: auto auto 10px 50%;
  width: 58px;
  height: 52px;
}

.city-tower {
  box-shadow: 0 2px 0 rgba(71, 77, 92, 0.22);
}

.capital-settlement .city-left,
.capital-settlement .city-right {
  bottom: 4px;
  width: 16px;
  height: 16px;
  border-radius: 2px 2px 6px 6px;
  background: linear-gradient(180deg, #f6f9ff, #d6e4f2 100%);
}

.capital-settlement .city-left {
  left: 2px;
}

.capital-settlement .city-right {
  right: 2px;
}

.capital-settlement .city-left::before,
.capital-settlement .city-right::before {
  inset: -9px -1px auto;
  height: 10px;
  background: linear-gradient(180deg, #62c0ff, #2f82d0);
  clip-path: ellipse(52% 66% at 50% 100%);
}

.capital-settlement .city-center {
  left: 18px;
  width: 22px;
  height: 36px;
  border-radius: 2px 2px 6px 6px;
  background: linear-gradient(180deg, #ffffff, #d5e7f4 100%);
}

.capital-settlement .city-center::before {
  inset: -12px 3px auto;
  height: 13px;
  background: linear-gradient(180deg, #ffea9a, #e0b94f);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.capital-settlement .city-center::after {
  content: "";
  position: absolute;
  top: -14px;
  left: 10px;
  width: 2px;
  height: 8px;
  background: #8fbce0;
  box-shadow: -15px 6px 0 #8fbce0, 15px 6px 0 #8fbce0;
}

.city-left,
.city-right {
  bottom: 6px;
  width: 14px;
  height: 14px;
  border-radius: 2px 2px 5px 5px;
  background: linear-gradient(180deg, #ffffff, #dfe4eb 100%);
}

.city-left::before,
.city-right::before {
  inset: -6px -1px auto;
  height: 7px;
  background: linear-gradient(180deg, #ff9a66, #d45834);
}

.city-center {
  width: 16px;
  height: 18px;
  left: 20px;
  bottom: 6px;
  border-radius: 2px 2px 5px 5px;
  background: linear-gradient(180deg, #ffffff, #e3e8ee 100%);
}

.city-center::before {
  inset: -7px 0 auto;
  height: 8px;
  background: linear-gradient(180deg, #ff8f5d, #cf5834);
}

.player-city .city-left::before,
.player-city .city-right::before,
.player-city .city-center::before {
  background: linear-gradient(180deg, #65c8ff, #2d84cf);
}

.enemy-settlement .city-left::before,
.enemy-settlement .city-right::before,
.enemy-settlement .city-center::before {
  background: linear-gradient(180deg, #ffb56c, #df7c2f);
}

.village-settlement {
  width: 42px;
  height: 36px;
}

.village-settlement .city-left,
.village-settlement .city-right {
  display: none;
}

.village-settlement .city-center {
  left: 12px;
  width: 18px;
  height: 16px;
}

.city-badge {
  top: auto;
  right: auto;
  left: 50%;
  bottom: -2px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(243, 226, 176, 0.96);
  color: #503f18;
  font-size: 0.5rem;
  letter-spacing: 0;
  box-shadow: 0 2px 0 rgba(55, 42, 12, 0.18);
}

.city-badge-name {
  max-width: 54px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-weight: 700;
}

.city-badge-level {
  display: inline-grid;
  place-items: center;
  min-width: 14px;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #2d2410;
  font-size: 0.48rem;
}

.unit-badge {
  top: 58%;
  width: 36px;
  height: 40px;
  min-width: 36px;
  min-height: 40px;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.22));
}

.unit-badge::after {
  display: none;
}

.unit-base {
  left: 9px;
  right: 9px;
  bottom: 1px;
  height: 4px;
  background: rgba(7, 12, 22, 0.2);
}

.unit-head {
  left: 12px;
  top: 7px;
  width: 12px;
  height: 11px;
  border-radius: 1px;
  clip-path: none;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.12);
}

.unit-hair {
  left: 11px;
  top: 4px;
  width: 14px;
  height: 7px;
  clip-path: polygon(0 42%, 18% 0, 82% 0, 100% 42%, 100% 100%, 0 100%);
}

.unit-body {
  left: 10px;
  bottom: 10px;
  width: 14px;
  height: 15px;
  clip-path: polygon(12% 0, 88% 0, 100% 100%, 0 100%);
}

.unit-body::before,
.unit-body::after {
  content: "";
  position: absolute;
  top: 4px;
  width: 4px;
  height: 9px;
  background: inherit;
}

.unit-body::before {
  left: -3px;
  transform: skewY(16deg);
}

.unit-body::after {
  right: -3px;
  transform: skewY(-16deg);
}

.unit-gear {
  left: 11px;
  top: auto;
  bottom: 4px;
  width: 12px;
  height: 7px;
  background: #24314b;
  clip-path: polygon(0 0, 42% 0, 42% 100%, 0 100%, 58% 0, 100% 0, 100% 100%, 58% 100%);
}

.unit-weapon {
  right: 4px;
  top: 10px;
  width: 4px;
  height: 18px;
  border-radius: 1px;
  transform: rotate(10deg);
}

.unit-badge.friendly .unit-base,
.unit-badge.enemy .unit-base {
  background: rgba(7, 12, 22, 0.2);
}

.unit-badge[data-unit="archer"] .unit-weapon {
  right: 2px;
  top: 10px;
  width: 11px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid var(--unit-trim);
  border-left-width: 3px;
  background: transparent;
}

.unit-badge[data-unit="defender"] .unit-weapon {
  right: 1px;
  top: 11px;
  width: 10px;
  height: 13px;
  border-radius: 3px 3px 6px 6px;
}

.unit-badge[data-unit="wizard"] .unit-hair {
  top: 2px;
  height: 10px;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.unit-badge[data-unit="wizard"] .unit-weapon {
  top: 8px;
  right: 5px;
  height: 20px;
  transform: rotate(0deg);
}

.unit-badge[data-unit="rider"] .unit-mount,
.unit-badge[data-unit="knight"] .unit-mount {
  left: 3px;
  bottom: 6px;
  width: 24px;
  height: 11px;
  border-radius: 5px 6px 4px 4px;
  clip-path: polygon(0 44%, 24% 12%, 62% 18%, 100% 0, 90% 66%, 64% 100%, 18% 100%);
}

.unit-badge[data-unit="rider"] .unit-body,
.unit-badge[data-unit="knight"] .unit-body {
  bottom: 14px;
}

.unit-badge[data-unit="catapult"] .unit-body {
  left: 5px;
  bottom: 8px;
  width: 25px;
  height: 10px;
}

.unit-badge[data-unit="catapult"] .unit-weapon {
  top: 1px;
  right: 6px;
  width: 3px;
  height: 22px;
  transform: rotate(45deg);
}

.unit-badge[data-unit="boat"] .unit-body,
.unit-badge[data-unit="battleship"] .unit-body {
  left: 4px;
  bottom: 8px;
  width: 28px;
  height: 12px;
  clip-path: polygon(6% 0, 94% 0, 100% 50%, 74% 100%, 26% 100%, 0 50%);
}

.unit-badge[data-unit="boat"] .unit-weapon,
.unit-badge[data-unit="battleship"] .unit-weapon {
  right: 14px;
  top: 2px;
  width: 8px;
  height: 18px;
  clip-path: polygon(0 0, 100% 18%, 62% 100%, 0 74%);
  transform: rotate(0deg);
}

.unit-badge[data-unit="airship"] .unit-body {
  left: 3px;
  top: 10px;
  width: 30px;
  height: 15px;
}

.unit-badge[data-unit="airship"] .unit-weapon {
  top: 24px;
  right: 10px;
  width: 14px;
  height: 8px;
  transform: rotate(0deg);
}

.unit-badge[data-unit="giant"] {
  width: 42px;
  height: 46px;
}

.unit-badge[data-unit="giant"] .unit-head {
  left: 13px;
  width: 16px;
  height: 14px;
}

.unit-badge[data-unit="giant"] .unit-body {
  left: 10px;
  width: 20px;
  height: 18px;
}

.hp-badge {
  right: -1px;
  bottom: 12px;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(11, 15, 26, 0.8);
}

.selection-details,
.kingdom-summary,
.tech-summary,
.event-log {
  display: grid;
  gap: 12px;
}

.action-panel {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.map-selection-panel {
  position: fixed;
  top: 112px;
  right: 24px;
  width: min(320px, calc(100vw - 48px));
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(126, 197, 255, 0.34);
  background: rgba(5, 10, 18, 0.9);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(10px);
  z-index: 30;
}

.map-selection-panel.hidden {
  display: none;
}

.game-data-cache.hidden {
  display: none;
}

.action-button {
  width: 100%;
  text-align: left;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-weight: 700;
}

.action-button:disabled,
.ghost-button:disabled,
.secondary-button:disabled,
.primary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.event-entry {
  border-left: 2px solid rgba(79, 214, 255, 0.35);
  padding-left: 12px;
}

.event-entry strong {
  display: block;
  color: var(--text);
  margin-bottom: 4px;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 4, 9, 0.72);
  backdrop-filter: blur(8px);
  z-index: 100;
}

.modal-card {
  width: min(1280px, calc(100vw - 40px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 26px;
}

.leader-modal-card {
  width: min(980px, calc(100vw - 40px));
}

.team-modal-card {
  width: min(860px, calc(100vw - 40px));
  border-color: rgba(120, 177, 255, 0.46);
  background:
    radial-gradient(circle at 16% 12%, rgba(93, 208, 255, 0.18), transparent 30%),
    radial-gradient(circle at 90% 6%, rgba(255, 210, 103, 0.16), transparent 28%),
    linear-gradient(180deg, rgba(20, 36, 66, 0.98), rgba(7, 13, 26, 0.98));
}

.team-kicker {
  margin: 0 0 8px;
  color: #ffd267;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.team-modal-card h2 {
  margin: 0;
}

.team-form {
  display: grid;
  gap: 22px;
}

.team-fieldset {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025)),
    rgba(5, 11, 22, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.team-section-heading {
  display: grid;
  gap: 4px;
}

.team-section-heading h3 {
  margin: 0;
}

.team-section-heading p,
.team-preview-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.team-name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.team-name-field,
.team-custom-color-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.team-name-field input {
  width: 100%;
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-weight: 800;
}

.team-random-button {
  min-height: 52px;
  white-space: nowrap;
}

.team-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
}

.team-color-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(5, 10, 18, 0.82);
  color: var(--text);
  font-weight: 900;
  text-align: left;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.team-color-option:hover,
.team-color-option.selected {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.26);
  box-shadow:
    inset 0 0 0 2px var(--team-choice, #2f6ea5),
    0 14px 24px rgba(0, 0, 0, 0.2);
}

.team-color-dot {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: var(--team-choice, #2f6ea5);
  border: 2px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.22);
}

.team-custom-color-field input[type="color"] {
  width: 100%;
  min-height: 54px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 6px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
}

.team-preview-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding: 18px;
  border-radius: 22px;
  background:
    radial-gradient(circle at 16% 0%, color-mix(in srgb, var(--team-preview, #2f6ea5) 42%, transparent), transparent 42%),
    rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.team-preview-swatch {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.34), transparent 38%),
    var(--team-preview, #2f6ea5);
  border: 3px solid rgba(255, 255, 255, 0.64);
  box-shadow: 0 16px 26px rgba(0, 0, 0, 0.24);
}

.team-preview-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.team-preview-card strong {
  display: block;
  margin: 4px 0 6px;
  font-size: 1.35rem;
}

.team-footer {
  justify-content: flex-end;
}

.campaign-color-modal-card {
  width: min(960px, calc(100vw - 40px));
}

.info-modal-card {
  width: min(760px, calc(100vw - 40px));
}

.shop-modal-card {
  width: min(1040px, calc(100vw - 40px));
  border-color: rgba(255, 210, 103, 0.62);
  background:
    radial-gradient(circle at 16% 12%, rgba(255, 222, 121, 0.24), transparent 28%),
    radial-gradient(circle at 88% 0%, rgba(93, 208, 255, 0.18), transparent 32%),
    linear-gradient(180deg, rgba(31, 50, 91, 0.98), rgba(9, 16, 31, 0.97));
}

.shop-modal-header {
  align-items: flex-start;
}

.shop-modal-header h2 {
  margin: 0;
  font-size: clamp(2.2rem, 6vw, 4.2rem);
  line-height: 0.9;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-shadow: 0 5px 0 rgba(9, 21, 42, 0.42);
}

.shop-kicker {
  margin: 0 0 8px;
  color: #ffd267;
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.shop-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 20px;
}

.shop-tabs {
  display: grid;
  align-content: start;
  gap: 12px;
}

.shop-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  padding: 10px 12px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  color: rgba(244, 247, 255, 0.84);
  font-weight: 900;
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.shop-tab:hover,
.shop-tab.active {
  transform: translateY(-1px);
  border-color: rgba(255, 210, 103, 0.74);
  color: #ffffff;
  background: linear-gradient(135deg, rgba(255, 210, 103, 0.3), rgba(79, 214, 255, 0.12));
}

.shop-panel {
  display: none;
}

.shop-panel.active {
  display: block;
}

.shop-empty-area {
  min-height: min(52vh, 420px);
  border: 2px dashed rgba(255, 255, 255, 0.14);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.025)),
    rgba(6, 13, 28, 0.56);
}

.mount-shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(174px, 1fr));
  gap: 14px;
  max-height: min(58vh, 520px);
  padding: 2px 4px 8px 2px;
  overflow: auto;
}

.mount-shop-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  color: #eef6ff;
  text-align: left;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.15), transparent 48%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(10, 18, 34, 0.72));
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.22);
  transition: transform 130ms ease, border-color 130ms ease, box-shadow 130ms ease;
}

.mount-shop-card:hover,
.mount-shop-card.selected {
  transform: translateY(-2px);
  border-color: rgba(255, 210, 103, 0.78);
  box-shadow: 0 22px 46px rgba(0, 0, 0, 0.32), 0 0 0 2px rgba(255, 210, 103, 0.16);
}

.mount-shop-card.locked {
  border-color: rgba(255, 255, 255, 0.08);
}

.mount-shop-card:disabled {
  cursor: not-allowed;
  opacity: 0.65;
  transform: none;
}
.trophy-balance, .victory-trophy {
  margin: 14px 0 8px;
  color: #ffdf80;
  font-size: 1.3rem;
  font-weight: 800;
}
.shop-reward-rule {
  max-width: 640px;
  margin: 0;
  line-height: 1.5;
  color: #d7e5f5;
}
#menu-trophy-balance { font-size: 0.85rem; }
.water-mounted-fallback { position: relative; display: block; }
.water-mount-symbol { position: absolute; font-size: 46px; transform: translate(-50%, -70%); }
.water-mounted-fallback .block-fighter-unit { translate: 0 -20px; scale: 0.7; }

.mount-shop-card.locked .mount-preview-image {
  opacity: 0.6;
  filter: grayscale(1) drop-shadow(0 16px 12px rgba(0, 0, 0, 0.42));
}

.mount-lock-badge {
  position: absolute;
  bottom: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  color: #fff0bc;
  background: rgba(6, 13, 28, 0.94);
  font-size: 0.76rem;
  font-weight: 800;
}

.mount-preview-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 132px;
  border-radius: 16px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(80, 143, 255, 0.22), rgba(255, 210, 103, 0.12)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 8px, transparent 8px 16px),
    rgba(4, 10, 22, 0.78);
}

.mount-preview-image {
  display: block;
  width: 100%;
  max-width: 190px;
  height: 138px;
  object-fit: contain;
  image-rendering: auto;
  filter: drop-shadow(0 16px 12px rgba(0, 0, 0, 0.42));
}

.mount-shop-meta {
  display: grid;
  gap: 3px;
}

.mount-shop-meta strong {
  font-size: 0.98rem;
  line-height: 1.1;
}

.mount-shop-meta span {
  color: rgba(220, 231, 255, 0.68);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.mount-selected-label {
  justify-self: start;
  padding: 7px 11px;
  border-radius: 999px;
  color: #07111f;
  font-size: 0.76rem;
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: linear-gradient(180deg, #ffdf80, #f1b942);
}

.mount-shop-card.locked .mount-selected-label {
  color: #f8fbff;
  background: linear-gradient(180deg, #287dff, #1450b9);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.leader-editor {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 26px;
}

.leader-form {
  display: grid;
  gap: 16px;
}

.character-controls {
  display: grid;
  gap: 18px;
}

.character-style-picker {
  display: grid;
  gap: 14px;
}

.character-style-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

.character-style-heading strong {
  color: var(--text);
  font-size: 0.96rem;
}

.character-style-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 14px;
}

.character-style-option {
  display: grid;
  gap: 10px;
  justify-items: center;
  min-height: 176px;
  padding: 14px 12px 12px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(4, 10, 21, 0.82);
  color: var(--text);
  text-align: center;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.character-style-option:hover {
  transform: translateY(-2px);
  border-color: rgba(120, 177, 255, 0.45);
  box-shadow: 0 16px 24px rgba(0, 0, 0, 0.2);
}

.character-style-option.selected {
  border-color: rgba(120, 177, 255, 0.8);
  box-shadow:
    inset 0 0 0 2px rgba(120, 177, 255, 0.7),
    0 18px 28px rgba(0, 0, 0, 0.22);
  background:
    linear-gradient(180deg, rgba(79, 214, 255, 0.16), rgba(255, 255, 255, 0.05)),
    rgba(7, 15, 28, 0.92);
}

.character-style-thumb {
  width: 100%;
  max-width: 112px;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.16), transparent 42%),
    linear-gradient(180deg, rgba(71, 102, 170, 0.42), rgba(9, 14, 24, 0.96));
  image-rendering: pixelated;
}

.character-style-label {
  font-size: 0.9rem;
  line-height: 1.25;
}

.leader-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

.leader-form input,
.leader-form select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.file-field input {
  padding: 10px;
}

.portrait-stage {
  display: grid;
  gap: 12px;
  justify-items: center;
  align-content: start;
}

.portrait-status,
.form-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.character-color-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.character-color-control {
  display: grid;
  gap: 8px;
}

.character-color-control input[type="color"] {
  width: 100%;
  min-height: 58px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 6px;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
}

.coming-soon-card {
  display: grid;
  gap: 4px;
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

.coming-soon-card strong {
  color: var(--text);
}

.mini-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 8px;
  border-radius: 999px;
  background: var(--swatch, #ffffff);
  border: 1px solid rgba(255, 255, 255, 0.42);
  vertical-align: middle;
}

.campaign-color-layout {
  display: grid;
  gap: 18px;
}

.campaign-setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) 300px;
  gap: 22px;
  align-items: start;
}

.campaign-setup-main {
  display: grid;
  gap: 22px;
}

.campaign-setup-section {
  display: grid;
  gap: 14px;
}

.campaign-setup-heading {
  display: grid;
  gap: 6px;
}

.campaign-setup-heading h3,
.campaign-preview-panel h3 {
  margin: 0;
  font-size: 1.05rem;
}

.campaign-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
}

.campaign-color-option {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 12px;
  min-height: 212px;
  padding: 18px 14px 16px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03)),
    rgba(5, 10, 18, 0.9);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.campaign-color-option::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 12px;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--campaign-choice, #4fd6ff);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.14);
}

.campaign-color-option:hover {
  transform: translateY(-2px);
  border-color: rgba(120, 177, 255, 0.42);
  box-shadow: 0 18px 28px rgba(0, 0, 0, 0.24);
}

.campaign-color-option.selected {
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow:
    inset 0 0 0 2px var(--campaign-choice, #4fd6ff),
    0 20px 30px rgba(0, 0, 0, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.04)),
    rgba(8, 15, 25, 0.95);
}

.campaign-color-option[aria-pressed="true"] {
  outline: none;
}

.campaign-color-preview {
  width: min(100%, 122px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, 0.24));
}

.campaign-color-label {
  font-weight: 800;
  letter-spacing: 0.03em;
  text-align: center;
}

.campaign-symbol-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 14px;
}

.campaign-symbol-option {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 16px 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    rgba(5, 10, 18, 0.86);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.campaign-symbol-option:hover {
  transform: translateY(-2px);
  border-color: rgba(120, 177, 255, 0.42);
  box-shadow: 0 18px 28px rgba(0, 0, 0, 0.22);
}

.campaign-symbol-option.selected {
  border-color: rgba(255, 255, 255, 0.26);
  box-shadow:
    inset 0 0 0 2px rgba(120, 177, 255, 0.9),
    0 18px 28px rgba(0, 0, 0, 0.22);
}

.campaign-symbol-badge {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
}

.campaign-symbol-svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.22));
}

.campaign-symbol-label {
  font-weight: 800;
  letter-spacing: 0.03em;
}

.campaign-camera-layout {
  display: grid;
  gap: 14px;
}

.campaign-camera-stage {
  position: relative;
  min-height: 240px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(120, 177, 255, 0.22);
  background:
    radial-gradient(circle at top, rgba(97, 138, 255, 0.12), transparent 42%),
    rgba(4, 10, 20, 0.92);
}

.campaign-camera-video,
.campaign-camera-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.campaign-camera-placeholder {
  min-height: 240px;
  display: grid;
  place-items: center;
  padding: 18px;
  text-align: center;
  color: var(--muted);
}

.campaign-camera-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.campaign-camera-status {
  min-height: 1.6em;
}

.campaign-preview-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top, rgba(104, 150, 255, 0.16), transparent 38%),
    rgba(8, 15, 28, 0.86);
  border: 1px solid rgba(120, 177, 255, 0.2);
}

.campaign-warrior-preview-canvas {
  width: 100%;
  max-width: 260px;
  justify-self: center;
  aspect-ratio: 1;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    rgba(6, 12, 24, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.campaign-color-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.campaign-color-name {
  margin: 0;
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.03em;
}

.campaign-warrior-traits {
  margin: 0;
}

.tech-tree-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 320px;
  gap: 24px;
}

.tech-art-frame {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(120, 177, 255, 0.25);
}

.tech-art-image {
  display: block;
  width: 100%;
  height: auto;
}

.tech-node-layer {
  position: absolute;
  inset: 0;
}

.tech-node-button {
  position: absolute;
  border: 1px solid transparent;
  border-radius: 18px;
  background: transparent;
  color: transparent;
}

.tech-node-button .tech-chip {
  position: absolute;
  right: 8px;
  bottom: 8px;
  border-radius: 999px;
  padding: 6px 8px;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  color: #05111d;
  background: rgba(255, 255, 255, 0.9);
}

.tech-node-button.unlocked .tech-chip {
  background: rgba(114, 230, 141, 0.95);
}

.tech-node-button.available .tech-chip {
  background: rgba(255, 200, 90, 0.96);
}

.tech-node-button.locked .tech-chip {
  background: rgba(255, 255, 255, 0.92);
}

.tech-node-button.selected-node {
  box-shadow: inset 0 0 0 2px rgba(255, 200, 90, 0.9);
}

.tech-inspector {
  padding: 20px;
  align-self: start;
}

.tech-inspector h3 {
  margin: 0 0 12px;
  font-size: 1.35rem;
}

.tech-inspector ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.info-copy {
  display: grid;
  gap: 16px;
}

/* Refreshed map presentation: original, but much closer to a toy-board tactics feel. */
.game-layout {
  margin-top: 10px;
}

.board-stage {
  width: min(100%, 980px);
}

.board {
  gap: 1px;
  width: min(100%, 940px);
  padding: 24px 24px 28px;
  background:
    radial-gradient(circle at 50% 12%, rgba(255, 255, 255, 0.08), transparent 30%),
    #050505;
  border-radius: 30px;
  box-shadow:
    0 26px 54px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.tile {
  border-radius: 0;
  background: transparent;
  isolation: isolate;
}

.tile::before {
  content: "";
  position: absolute;
  inset: 14% 12% 2%;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  background: rgba(0, 0, 0, 0.3);
  transform: translateY(8%);
  filter: blur(1px);
  z-index: 0;
}

.tile::after {
  display: none;
}

.tile-face,
.tile-inner {
  position: absolute;
  inset: 0;
}

.tile-face {
  clip-path: polygon(50% 3%, 97% 50%, 50% 97%, 3% 50%);
  background: linear-gradient(180deg, var(--tile-top) 0%, var(--tile-mid) 62%, var(--tile-edge) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 10px 14px rgba(255, 255, 255, 0.15),
    inset 0 -10px 12px rgba(0, 0, 0, 0.12);
  z-index: 1;
}

.tile-inner {
  z-index: 2;
  transform: translateY(-4%) scale(0.96);
}

.tile:hover .tile-face {
  filter: brightness(1.03) saturate(1.05);
}

.tile.selected .tile-face {
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.96),
    0 0 0 2px rgba(255, 255, 255, 0.12);
}

.tile.reachable .tile-face {
  filter: brightness(1.08) saturate(1.12);
}

.tile.attackable .tile-face {
  box-shadow:
    inset 0 0 0 2px rgba(255, 111, 111, 0.9),
    0 0 0 2px rgba(255, 111, 111, 0.14);
}

.tile[data-terrain="plains"] {
  --tile-top: #d7df52;
  --tile-mid: #c1d63f;
  --tile-edge: #a7bf35;
  --tile-shadow: #819629;
}

.tile[data-terrain="forest"] {
  --tile-top: #4f8f5f;
  --tile-mid: #346d49;
  --tile-edge: #245138;
  --tile-shadow: #183524;
}

.tile[data-terrain="mountain"] {
  --tile-top: #d9dee6;
  --tile-mid: #b4bdcb;
  --tile-edge: #8794a7;
  --tile-shadow: #667386;
}

.tile[data-terrain="water"] {
  --tile-top: #89d1ff;
  --tile-mid: #58a9f1;
  --tile-edge: #3279d1;
  --tile-shadow: #25559e;
}

.tile.player-territory .tile-face {
  box-shadow:
    inset 0 0 0 2px rgba(82, 220, 255, 0.34),
    inset 0 10px 14px rgba(255, 255, 255, 0.15),
    inset 0 -10px 12px rgba(0, 0, 0, 0.12);
}

.tile.enemy-territory .tile-face {
  box-shadow:
    inset 0 0 0 2px rgba(255, 184, 95, 0.3),
    inset 0 10px 14px rgba(255, 255, 255, 0.14),
    inset 0 -10px 12px rgba(0, 0, 0, 0.12);
}

.terrain-prop {
  inset: auto 11% 16% 11%;
  height: 44%;
}

.terrain-prop::after {
  opacity: 0.16;
}

.terrain-prop.plains .tuft-one,
.terrain-prop.plains .tuft-two {
  bottom: 10%;
  width: 15%;
  height: 15%;
  border-radius: 10px 10px 2px 2px;
}

.terrain-prop.forest .tree {
  width: 18%;
  bottom: 8%;
  background: linear-gradient(180deg, #2a7e45, #164c2b);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.terrain-prop.forest .tree-back {
  left: 12%;
  height: 42%;
}

.terrain-prop.forest .tree-mid {
  left: 39%;
  height: 58%;
}

.terrain-prop.forest .tree-front {
  left: 64%;
  height: 40%;
}

.terrain-prop.mountain .peak-back {
  height: 48%;
  background: linear-gradient(180deg, #cfd6e2, #96a4b6);
}

.terrain-prop.mountain .peak-front {
  height: 66%;
  background: linear-gradient(180deg, #edf2f8, #b4c1d0);
}

.terrain-prop.water .ripple-one,
.terrain-prop.water .ripple-two {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  height: 10%;
}

.resource-badge {
  right: 8px;
  bottom: 8px;
  width: 30px;
  height: 30px;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.resource-farm .field {
  bottom: 2px;
  width: 11px;
  height: 10px;
  background: linear-gradient(180deg, #93c73f, #67942c);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.16),
    0 -3px 0 rgba(201, 176, 84, 0.8);
}

.resource-farm .field-left {
  left: 2px;
}

.resource-farm .field-right {
  right: 2px;
}

.resource-farm .farm-house {
  top: 2px;
  left: 9px;
  width: 12px;
  height: 12px;
  background: linear-gradient(180deg, #fff9e1, #eadfbf);
  clip-path: polygon(50% 0, 100% 40%, 100% 100%, 0 100%, 0 40%);
}

.resource-farm .farm-house::before {
  content: "";
  position: absolute;
  inset: -4px -1px auto;
  height: 6px;
  background: linear-gradient(180deg, #ff9452, #d35a31);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.resource-ore .resource-shard {
  background: linear-gradient(180deg, #f6fbff, #bfcde0);
}

.resource-wood .resource-log {
  background: linear-gradient(180deg, #b87f45, #895829);
}

.resource-fish .resource-fish-body {
  background: linear-gradient(180deg, #ffffff, #d7f0ff);
}

.road-mark {
  position: absolute;
  inset: auto 14% 42%;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, #c28a4c, #8c5d31);
  transform: rotate(-18deg);
  z-index: 2;
}

.city-crest {
  inset: auto auto 12px 50%;
  width: 62px;
  height: 56px;
}

.city-tower {
  box-shadow: 0 2px 0 rgba(71, 77, 92, 0.18);
}

.capital-settlement .city-left,
.capital-settlement .city-right {
  bottom: 6px;
  width: 17px;
  height: 17px;
  border-radius: 2px 2px 6px 6px;
  background: linear-gradient(180deg, #fefefe, #d8e5f3);
}

.capital-settlement .city-left::before,
.capital-settlement .city-right::before {
  inset: -9px -2px auto;
  height: 10px;
  background: linear-gradient(180deg, #66c2ff, #2d7fcd);
  clip-path: ellipse(54% 68% at 50% 100%);
}

.capital-settlement .city-center {
  left: 18px;
  width: 24px;
  height: 38px;
  border-radius: 2px 2px 7px 7px;
  background: linear-gradient(180deg, #ffffff, #d7e8f4);
}

.capital-settlement .city-center::before {
  inset: -12px 3px auto;
  height: 13px;
  background: linear-gradient(180deg, #ffe79b, #dbb452);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.city-left,
.city-right {
  bottom: 7px;
  width: 15px;
  height: 15px;
  border-radius: 2px 2px 6px 6px;
  background: linear-gradient(180deg, #ffffff, #dfe8ef);
}

.city-left::before,
.city-right::before {
  inset: -7px -1px auto;
  height: 8px;
  background: linear-gradient(180deg, #f3905d, #cf5e39);
}

.city-center {
  left: 20px;
  bottom: 7px;
  width: 18px;
  height: 20px;
  border-radius: 2px 2px 6px 6px;
  background: linear-gradient(180deg, #ffffff, #e2ebf2);
}

.city-center::before {
  inset: -7px 0 auto;
  height: 8px;
  background: linear-gradient(180deg, #f3905d, #cf5e39);
}

.player-city .city-left::before,
.player-city .city-right::before,
.player-city .city-center::before {
  background: linear-gradient(180deg, #69c8ff, #2b80cf);
}

.enemy-settlement .city-left::before,
.enemy-settlement .city-right::before,
.enemy-settlement .city-center::before {
  background: linear-gradient(180deg, #ffb870, #df7d31);
}

.village-settlement {
  width: 44px;
  height: 38px;
}

.city-badge {
  bottom: -1px;
  gap: 5px;
  padding: 2px 8px;
  background: rgba(245, 234, 191, 0.95);
  color: #4d3c18;
  font-size: 0.5rem;
  box-shadow: 0 2px 0 rgba(55, 42, 12, 0.16);
}

.city-badge-name {
  max-width: 60px;
}

.city-badge-level {
  min-width: 14px;
  height: 14px;
  background: rgba(255, 255, 255, 0.84);
}

.unit-badge {
  top: 56%;
  width: 38px;
  height: 42px;
  min-width: 38px;
  min-height: 42px;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.24));
}

.unit-head {
  left: 12px;
  top: 6px;
  width: 12px;
  height: 11px;
  border-radius: 1px;
}

.unit-hair {
  left: 10px;
  top: 3px;
  width: 15px;
  height: 8px;
}

.unit-body {
  left: 10px;
  bottom: 10px;
  width: 15px;
  height: 16px;
}

.unit-gear {
  left: 10px;
  bottom: 4px;
  width: 14px;
  height: 8px;
}

.hp-badge {
  right: 2px;
  bottom: 14px;
  padding: 2px 5px;
  background: rgba(12, 17, 29, 0.84);
}

.map-selection-panel {
  top: 96px;
  right: 18px;
  width: min(300px, calc(100vw - 36px));
  border-radius: 18px;
  border: 1px solid rgba(112, 186, 255, 0.28);
  background: rgba(7, 12, 21, 0.92);
}

@media (max-width: 1240px) {
  .menu-hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

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

  .board {
    transform: none;
  }

  .leader-editor,
  .tech-tree-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .menu-topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .menu-copy {
    padding-top: clamp(20px, 8vh, 72px);
  }

  .hero-panel,
  .menu-rail {
    grid-template-columns: 1fr;
  }

  .topbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

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

  .shop-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .team-name-row {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 18px, 100%);
    padding-top: 16px;
  }

  .menu-scene,
  .menu-screen {
    min-height: calc(100vh - 36px);
  }

  .menu-overlay {
    padding: 18px;
  }

  .menu-title {
    font-size: clamp(2.6rem, 15vw, 4rem);
  }

  .menu-action-row {
    flex-direction: column;
  }

  .team-color-grid {
    grid-template-columns: 1fr;
  }

  .team-preview-card {
    grid-template-columns: 1fr;
  }

  .team-preview-swatch {
    width: 58px;
    height: 58px;
  }

  .menu-launch-button,
  .menu-option-button {
    width: 100%;
  }

  .shop-menu-button {
    right: 18px;
    bottom: 18px;
    min-width: 112px;
    min-height: 48px;
    padding: 10px 14px;
    border-radius: 16px;
  }

  .shop-modal-card {
    padding: 18px;
  }

  .shop-tabs {
    gap: 8px;
  }

  .shop-tab {
    min-height: 58px;
    padding: 8px;
    font-size: 0.82rem;
  }

  .hero-panel,
  .menu-card,
  .leader-panel,
  .workers-panel,
  .tech-summary-panel,
  .selection-panel,
  .kingdom-panel,
  .log-panel,
  .objective-strip,
  .legend {
    padding: 18px;
  }

  .board {
    gap: 5px;
    padding: 16px 16px 24px;
  }

  .character-color-grid {
    grid-template-columns: 1fr;
  }

  .map-selection-panel {
    position: static;
    width: 100%;
    margin-top: 14px;
  }

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

  .campaign-color-grid,
  .campaign-symbol-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .campaign-color-option {
    min-height: 184px;
    padding-inline: 12px;
  }

  .campaign-color-preview {
    width: min(100%, 104px);
  }

  .campaign-symbol-badge {
    width: 68px;
    height: 68px;
  }
}

/* Final map direction based on the user's isometric reference image. */
body.game-active {
  background: #000000;
}

body.game-active .app-shell {
  width: 100vw;
  margin: 0;
  padding: 0 0 20px;
}

body.game-active #game-screen {
  min-height: 100vh;
}

body.game-active .topbar {
  display: none !important;
}

body.game-active .topbar-group:nth-child(1),
body.game-active .topbar-group:nth-child(2) {
  display: none;
}

body.game-active .topbar-group {
  gap: 0;
}

body.game-active .topbar-label {
  font-size: 0.62rem;
  color: rgba(240, 248, 255, 0.62);
}

body.game-active .topbar strong {
  font-size: 0.95rem;
}

body.game-active .topbar-actions {
  gap: 8px;
}

body.game-active .compact-button {
  padding: 8px 12px;
  font-size: 0.82rem;
}

body.game-active .status-pill {
  padding: 6px 10px;
  font-size: 0.74rem;
}

body.game-active .game-layout {
  margin-top: 0;
}

body.game-active .board-stage {
  width: min(1420px, calc(100vw - 20px));
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow: hidden;
  padding: 8px 8px 20px;
  user-select: none;
  touch-action: none;
  cursor: grab;
  overscroll-behavior: contain;
}

body.game-active .board-stage.model-board-stage {
  position: relative;
  width: 100vw;
  max-width: none;
  height: 100vh;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  overflow: hidden;
}

body.game-active .board-stage.camera-dragging {
  cursor: grabbing;
}

body.game-active .model-board-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #020408;
  cursor: grab;
  touch-action: none;
}

body.game-active .model-interaction-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.model-interaction-layer.hidden {
  display: none !important;
}

body.game-active .model-unit-hitbox,
body.game-active .model-target-hitbox,
body.game-active .model-wildlife-hitbox,
body.game-active .model-castle-hitbox {
  position: absolute;
  border: 0;
  padding: 0;
  background: transparent;
  color: transparent;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
}

body.game-active .model-unit-hitbox {
  width: 128px;
  height: 136px;
  border-radius: 32px;
}

body.game-active .model-castle-hitbox {
  width: 64px;
  height: 70px;
  border-radius: 8px;
}

body.game-active .model-castle-hitbox:not(.attackable):hover,
body.game-active .model-castle-hitbox:focus-visible,
body.game-active .model-castle-hitbox.selected {
  outline: 2px solid #ffd267;
  outline-offset: 2px;
  background: rgba(255, 210, 103, 0.12);
}
body.game-active .model-castle-hitbox .castle-team-label { top: calc(100% + var(--castle-label-offset, 4px)); }

body.game-active .model-target-hitbox {
  width: 116px;
  height: 78px;
  border-radius: 999px;
}

body.game-active .water-move-target {
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

body.game-active .model-target-hitbox::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(126, 220, 255, 0.7), rgba(20, 124, 255, 0.5));
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  box-shadow:
    inset 0 0 0 2px rgba(210, 245, 255, 0.85),
    0 0 12px rgba(38, 149, 255, 0.44);
  pointer-events: none;
}

body.game-active .model-target-hitbox:hover::before,
body.game-active .model-target-hitbox:focus-visible::before {
  background:
    linear-gradient(135deg, rgba(166, 237, 255, 0.86), rgba(39, 152, 255, 0.68));
  box-shadow:
    inset 0 0 0 2px rgba(240, 252, 255, 0.95),
    0 0 16px rgba(42, 160, 255, 0.58);
}

body.game-active .model-wildlife-hitbox {
  width: 112px;
  height: 82px;
  border-radius: 999px;
}

body.game-active .model-wildlife-hitbox.attackable {
  width: 132px;
  height: 96px;
}

body.game-active .model-wildlife-hitbox.attackable::before {
  content: "";
  position: absolute;
  inset: 12% 8%;
  background:
    linear-gradient(135deg, rgba(143, 226, 255, 0.68), rgba(26, 131, 255, 0.5));
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  box-shadow:
    inset 0 0 0 2px rgba(225, 247, 255, 0.88),
    0 0 14px rgba(54, 159, 255, 0.5);
  pointer-events: none;
}

body.game-active .model-wildlife-hitbox.attackable:hover::before,
body.game-active .model-wildlife-hitbox.attackable:focus-visible::before {
  background:
    linear-gradient(135deg, rgba(180, 241, 255, 0.82), rgba(48, 158, 255, 0.66));
}

body.game-active .board-stage.camera-dragging .model-board-canvas {
  cursor: grabbing;
}

body.game-active .model-board-canvas.hidden,
body.game-active .board.hidden {
  display: none !important;
}

.map-zoom-controls {
  display: none;
}

body.game-active .map-zoom-controls {
  display: grid;
  gap: 8px;
  position: fixed;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(112px, calc(104px + env(safe-area-inset-bottom)));
  z-index: 70;
}

.map-zoom-controls button {
  width: 48px;
  height: 48px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 14px;
  background: #294b32;
  color: #fff;
  font: 700 30px/1 system-ui, sans-serif;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  touch-action: manipulation;
}

.map-zoom-controls button:disabled {
  opacity: 0.45;
  cursor: default;
}

.map-zoom-controls button:focus-visible {
  outline: 3px solid #ffe89a;
  outline-offset: 3px;
}

@media (pointer: coarse) {
  body.game-active .model-target-hitbox::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 8px;
    height: 8px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #137bd0;
    transform: translate(-50%, -50%);
    pointer-events: none;
  }
}

.turn-controls {
  display: none;
}

body.game-active .turn-controls {
  display: flex;
  gap: 12px;
  position: fixed;
  left: 50%;
  bottom: clamp(18px, 3.5vh, 34px);
  z-index: 70;
  transform: translateX(-50%);
  width: min(380px, calc(100vw - 24px));
}

body.game-active .turn-control-button {
  flex: 1;
  min-width: 0;
  min-height: 58px;
  padding: 14px 10px 16px;
  border: 3px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  background:
    linear-gradient(180deg, #ffe89a 0%, #ffd267 54%, #e3a83d 100%);
  color: #33220a;
  font-weight: 950;
  font-size: clamp(0.8rem, 3.5vw, 1rem);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  box-shadow:
    0 8px 0 rgba(115, 75, 18, 0.96),
    0 18px 34px rgba(0, 0, 0, 0.34),
    inset 0 2px 0 rgba(255, 255, 255, 0.62);
  cursor: pointer;
}

body.game-active .turn-control-button:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow:
    0 10px 0 rgba(115, 75, 18, 0.96),
    0 22px 38px rgba(0, 0, 0, 0.36),
    inset 0 2px 0 rgba(255, 255, 255, 0.72);
}

body.game-active .turn-control-button:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow:
    0 4px 0 rgba(115, 75, 18, 0.96),
    0 12px 26px rgba(0, 0, 0, 0.3),
    inset 0 2px 0 rgba(255, 255, 255, 0.52);
}

body.game-active .turn-control-button:disabled {
  filter: grayscale(0.45);
  opacity: 0.68;
  cursor: not-allowed;
}

body.game-active .board {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: auto;
  height: auto;
  margin: 0 auto;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

body.game-active .tile {
  --tile-top: #a8db49;
  --tile-mid: #89cb3b;
  --tile-edge: #6da62f;
  --tile-shadow: #507c23;
  position: absolute;
  min-width: 0;
  aspect-ratio: auto;
  border: 0;
  padding: 0;
  background: transparent;
  overflow: visible;
  color: var(--text);
  transform: translateZ(0);
  transition: transform 120ms ease, filter 120ms ease;
}

body.game-active .tile::before {
  content: "";
  position: absolute;
  left: 0;
  top: calc(var(--tile-top-height) / 2);
  width: 50%;
  height: var(--tile-depth);
  clip-path: polygon(100% 0, 100% 100%, 0 58%, 0 0);
  background: linear-gradient(180deg, var(--tile-edge), var(--tile-shadow));
  z-index: 1;
}

body.game-active .tile::after {
  content: "";
  position: absolute;
  right: 0;
  top: calc(var(--tile-top-height) / 2);
  width: 50%;
  height: var(--tile-depth);
  clip-path: polygon(0 0, 100% 0, 100% 58%, 0 100%);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), var(--tile-edge));
  z-index: 1;
}

body.game-active .tile-outline {
  position: absolute;
  inset: -2px 0 auto;
  width: 100%;
  height: var(--tile-top-height);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  background: rgba(8, 14, 26, 0.44);
  transform: scale(1.04);
  opacity: 0.24;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.22));
  pointer-events: none;
  z-index: 2;
  transition: opacity 120ms ease, transform 120ms ease, background 120ms ease, filter 120ms ease;
}

body.game-active .tile-face {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: var(--tile-top-height);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  background: linear-gradient(180deg, var(--tile-top) 0%, var(--tile-mid) 56%, var(--tile-edge) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -6px 10px rgba(0, 0, 0, 0.12);
  z-index: 3;
}

body.game-active .tile-inner {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: var(--tile-top-height);
  inset: 0 auto auto 0;
  transform: none;
  z-index: 4;
}

body.game-active .tile[data-terrain="plains"] {
  --tile-top: #addd51;
  --tile-mid: #93cf41;
  --tile-edge: #76b234;
  --tile-shadow: #578524;
}

body.game-active .tile[data-terrain="forest"] {
  --tile-top: #4da246;
  --tile-mid: #2f7f32;
  --tile-edge: #245f2a;
  --tile-shadow: #18431f;
}

body.game-active .tile[data-terrain="mountain"] {
  --tile-top: #dfe5ea;
  --tile-mid: #bdc8d5;
  --tile-edge: #96a3b3;
  --tile-shadow: #6e7b8d;
}

body.game-active .tile[data-terrain="water"] {
  --tile-top: #58b0ff;
  --tile-mid: #3492f4;
  --tile-edge: #2a72cb;
  --tile-shadow: #22569e;
}

body.game-active .tile[data-biome="snow"][data-terrain="plains"],
body.game-active .tile[data-biome="snow"][data-terrain="forest"] {
  --tile-top: #f2fbff;
  --tile-mid: #dceeff;
  --tile-edge: #bed5ea;
  --tile-shadow: #8ea9c2;
}

body.game-active .tile[data-biome="snow"][data-terrain="mountain"] {
  --tile-top: #ffffff;
  --tile-mid: #e7eef6;
  --tile-edge: #cbd7e3;
  --tile-shadow: #95a5b8;
}

body.game-active .tile[data-biome="snow"][data-terrain="water"] {
  --tile-top: #89cbff;
  --tile-mid: #61aff3;
  --tile-edge: #4b8fd4;
  --tile-shadow: #34659e;
}

body.game-active .tile[data-biome="desert"][data-terrain="plains"] {
  --tile-top: #ffe58c;
  --tile-mid: #f0d26d;
  --tile-edge: #d0b257;
  --tile-shadow: #a38339;
}

body.game-active .tile[data-biome="desert"][data-terrain="forest"] {
  --tile-top: #8ab24f;
  --tile-mid: #65903d;
  --tile-edge: #4c6e2f;
  --tile-shadow: #33501f;
}

body.game-active .tile[data-biome="desert"][data-terrain="mountain"] {
  --tile-top: #ddd2c4;
  --tile-mid: #b9a99a;
  --tile-edge: #998877;
  --tile-shadow: #726456;
}

body.game-active .tile[data-shore="1"][data-terrain="plains"]:not([data-biome="snow"]) .tile-face {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -6px 10px rgba(0, 0, 0, 0.12),
    inset 0 0 0 2px rgba(255, 234, 166, 0.28);
}

body.game-active .tile[data-depth="deep"][data-terrain="water"] {
  --tile-top: #4b9fff;
  --tile-mid: #2a83ea;
  --tile-edge: #215fac;
  --tile-shadow: #183d74;
}

body.game-active .tile[data-depth="shallow"][data-terrain="water"] {
  --tile-top: #73c4ff;
  --tile-mid: #49a7ef;
  --tile-edge: #327ece;
  --tile-shadow: #245798;
}

body.game-active .tile.player-territory .tile-face {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -6px 10px rgba(0, 0, 0, 0.12);
}

body.game-active .tile.enemy-territory .tile-face {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    inset 0 -6px 10px rgba(0, 0, 0, 0.12);
}

body.game-active .tile:hover .tile-outline {
  opacity: 0.58;
  background: rgba(255, 255, 255, 0.32);
}

body.game-active .tile.selected {
  transform: translateY(-4px);
}

body.game-active .tile.selected .tile-outline {
  opacity: 1;
  background: rgba(255, 255, 255, 0.96);
  transform: scale(1.09);
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

body.game-active .tile.selected .tile-face {
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.95),
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 -6px 10px rgba(0, 0, 0, 0.12);
}

body.game-active .tile.reachable .tile-outline {
  opacity: 0.9;
  background: rgba(124, 255, 156, 0.9);
}

body.game-active .tile.reachable .tile-face {
  filter: saturate(1.08) brightness(1.05);
}

body.game-active .tile.attackable .tile-outline {
  opacity: 0.94;
  background: rgba(255, 104, 104, 0.94);
}

body.game-active .tile.attackable .tile-face {
  box-shadow:
    inset 0 0 0 2px rgba(255, 104, 104, 0.95),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -6px 10px rgba(0, 0, 0, 0.12);
}

body.game-active .terrain-prop,
body.game-active .resource-badge,
body.game-active .city-crest,
body.game-active .unit-badge,
body.game-active .hp-badge,
body.game-active .road-mark {
  z-index: 3;
}

body.game-active .terrain-prop {
  inset: auto 12% 8% 12%;
  height: 72%;
}

body.game-active .terrain-prop::after {
  left: 16%;
  right: 16%;
  bottom: 4%;
  height: 10%;
  background: rgba(0, 0, 0, 0.1);
}

body.game-active .terrain-prop.plains .tuft-one,
body.game-active .terrain-prop.plains .tuft-two {
  width: 22%;
  height: 18%;
  bottom: 16%;
}

body.game-active .terrain-prop.forest .tree {
  width: 22%;
  bottom: 10%;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

body.game-active .terrain-prop.forest .tree-back {
  left: 12%;
  height: 48%;
}

body.game-active .terrain-prop.forest .tree-mid {
  left: 38%;
  height: 68%;
}

body.game-active .terrain-prop.forest .tree-front {
  left: 64%;
  height: 46%;
}

body.game-active .tile[data-biome="snow"] .terrain-prop.forest .tree {
  background: linear-gradient(180deg, #4a8c59, #245738 68%, #eff9ff 100%);
}

body.game-active .terrain-prop.mountain .peak-back {
  left: 4%;
  width: 42%;
  height: 54%;
}

body.game-active .terrain-prop.mountain .peak-front {
  left: 30%;
  width: 50%;
  height: 76%;
}

body.game-active .tile[data-biome="snow"] .terrain-prop.mountain .peak-back,
body.game-active .tile[data-biome="snow"] .terrain-prop.mountain .peak-front {
  background: linear-gradient(180deg, #ffffff, #d8e5f1 62%, #a5b4c5 100%);
}

body.game-active .terrain-prop.water .ripple-one,
body.game-active .terrain-prop.water .ripple-two {
  border-radius: 999px;
}

body.game-active .resource-badge {
  right: 10px;
  bottom: 10px;
  top: auto;
  left: auto;
  width: 22px;
  height: 22px;
  border-radius: 0;
  box-shadow: none;
}

body.game-active .resource-farm .field {
  width: 9px;
  height: 7px;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  background: linear-gradient(180deg, #8fc950 0%, #648f2e 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    0 -2px 0 rgba(198, 169, 83, 0.72);
}

body.game-active .resource-farm .farm-house {
  left: 6px;
  top: 2px;
  width: 9px;
  height: 9px;
  background: linear-gradient(150deg, #fff4d8 0%, #e3d3ac 100%);
  clip-path: polygon(0 16%, 20% 0, 100% 0, 100% 100%, 0 100%);
}

body.game-active .resource-farm .farm-house::before {
  inset: -3px 0 auto 0;
  height: 4px;
  background: linear-gradient(180deg, #ff9050 0%, #cb5a32 100%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

body.game-active .resource-ore .resource-shard {
  width: 6px;
  clip-path: polygon(0 18%, 18% 0, 100% 0, 100% 82%, 82% 100%, 0 100%);
  background: linear-gradient(150deg, #f7fbff 0%, #c8d3e1 46%, #8f9bab 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 2px 3px rgba(0, 0, 0, 0.12);
}

body.game-active .resource-ore .resource-shard:nth-child(1) {
  left: 2px;
  height: 8px;
}

body.game-active .resource-ore .resource-shard:nth-child(2) {
  left: 8px;
  height: 12px;
}

body.game-active .resource-ore .resource-shard:nth-child(3) {
  left: 14px;
  height: 8px;
}

body.game-active .resource-wood .resource-log {
  width: 10px;
  height: 5px;
  border-radius: 0;
  clip-path: polygon(0 18%, 86% 0, 100% 82%, 14% 100%);
  background: linear-gradient(150deg, #ba8248 0%, #885827 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 1px 2px rgba(0, 0, 0, 0.12);
}

body.game-active .resource-fish .resource-fish-body {
  left: 4px;
  top: 8px;
  width: 11px;
  height: 7px;
  border-radius: 0;
  clip-path: polygon(0 14%, 78% 0, 100% 34%, 100% 66%, 78% 100%, 0 86%);
  background: linear-gradient(150deg, #ffffff 0%, #cfe8f7 100%);
}

body.game-active .resource-fish .resource-fish-tail {
  right: 3px;
  top: 8px;
  width: 5px;
  height: 7px;
  border-radius: 0;
  clip-path: polygon(0 0, 100% 20%, 100% 80%, 0 100%, 34% 50%);
  background: linear-gradient(150deg, #d4edf7 0%, #87c7dc 100%);
}

body.game-active .road-mark {
  inset: 52% 10px auto;
  height: 10%;
}

body.game-active .city-crest {
  inset: auto auto 8px 50%;
  width: 34px;
  height: 34px;
  transform: translateX(-50%);
}

body.game-active .capital-settlement {
  transform: translateX(-50%) scale(1.08);
}

body.game-active .city-left,
body.game-active .city-right {
  width: 10px;
  height: 11px;
  bottom: 5px;
}

body.game-active .city-center {
  left: 12px;
  width: 11px;
  height: 18px;
  bottom: 5px;
}

body.game-active .city-center::before,
body.game-active .city-left::before,
body.game-active .city-right::before {
  height: 6px;
}

body.game-active .city-badge {
  display: none;
}

body.game-active .unit-badge {
  top: 34%;
  width: 26px;
  height: 32px;
  min-width: 26px;
  min-height: 32px;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.24));
}

body.game-active .unit-badge::after {
  display: none;
}

body.game-active .unit-base {
  left: 6px;
  right: 6px;
  bottom: 1px;
  height: 4px;
}

body.game-active .unit-head {
  left: 8px;
  top: 4px;
  width: 10px;
  height: 10px;
}

body.game-active .unit-hair {
  left: 7px;
  top: 2px;
  width: 12px;
  height: 7px;
}

body.game-active .unit-body {
  left: 7px;
  bottom: 8px;
  width: 11px;
  height: 13px;
}

body.game-active .unit-gear {
  left: 7px;
  top: auto;
  bottom: 3px;
  width: 11px;
  height: 6px;
}

body.game-active .unit-weapon {
  right: 2px;
  top: 8px;
  width: 4px;
  height: 15px;
}

body.game-active .unit-badge[data-unit="rider"] .unit-mount,
body.game-active .unit-badge[data-unit="knight"] .unit-mount {
  left: 2px;
  bottom: 5px;
  width: 20px;
  height: 10px;
}

body.game-active .unit-badge[data-unit="catapult"] .unit-body,
body.game-active .unit-badge[data-unit="boat"] .unit-body,
body.game-active .unit-badge[data-unit="battleship"] .unit-body,
body.game-active .unit-badge[data-unit="airship"] .unit-body {
  left: 2px;
  width: 22px;
}

body.game-active .unit-badge[data-unit="giant"] {
  width: 30px;
  height: 34px;
}

body.game-active .unit-badge[data-unit="giant"] .unit-head {
  left: 8px;
  width: 13px;
  height: 12px;
}

body.game-active .unit-badge[data-unit="giant"] .unit-body {
  left: 7px;
  width: 14px;
  height: 15px;
}

body.game-active .unit-badge.block-warrior-unit {
  top: 35%;
  width: calc(var(--tile-width) * 0.48);
  height: calc(var(--tile-width) * 0.7);
  min-width: calc(var(--tile-width) * 0.48);
  min-height: calc(var(--tile-width) * 0.7);
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.22));
}

body.game-active .unit-badge.block-warrior-unit .unit-base,
body.game-active .unit-badge.block-warrior-unit .block-leg,
body.game-active .unit-badge.block-warrior-unit .block-foot,
body.game-active .unit-badge.block-warrior-unit .block-body,
body.game-active .unit-badge.block-warrior-unit .block-arm,
body.game-active .unit-badge.block-warrior-unit .block-hand,
body.game-active .unit-badge.block-warrior-unit .block-head,
body.game-active .unit-badge.block-warrior-unit .block-hair,
body.game-active .unit-badge.block-warrior-unit .block-helmet,
body.game-active .unit-badge.block-warrior-unit .block-helmet-crest,
body.game-active .unit-badge.block-warrior-unit .block-eye,
body.game-active .unit-badge.block-warrior-unit .block-shield,
body.game-active .unit-badge.block-warrior-unit .block-weapon {
  position: absolute;
}

body.game-active .unit-badge.block-warrior-unit .unit-base {
  display: none;
}

body.game-active .unit-badge.block-warrior-unit .block-leg {
  bottom: 6%;
  width: 15%;
  height: 22%;
  background: linear-gradient(180deg, var(--block-boots) 0%, color-mix(in srgb, var(--block-boots) 76%, black) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body.game-active .unit-badge.block-warrior-unit .block-leg-left {
  left: 31%;
}

body.game-active .unit-badge.block-warrior-unit .block-leg-right {
  right: 31%;
}

body.game-active .unit-badge.block-warrior-unit .block-foot {
  bottom: 1%;
  width: 19%;
  height: 8%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--block-boots) 92%, white) 0%, color-mix(in srgb, var(--block-boots) 74%, black) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

body.game-active .unit-badge.block-warrior-unit .block-foot-left {
  left: 27%;
  clip-path: polygon(0 15%, 86% 0, 100% 100%, 0 100%);
}

body.game-active .unit-badge.block-warrior-unit .block-foot-right {
  right: 27%;
  clip-path: polygon(14% 0, 100% 15%, 100% 100%, 0 100%);
}

body.game-active .unit-badge.block-warrior-unit .block-body {
  left: 25%;
  bottom: 25%;
  width: 50%;
  height: 30%;
  background: linear-gradient(180deg, var(--block-body) 0%, var(--block-body-dark) 100%);
  clip-path: polygon(4% 0, 96% 0, 100% 100%, 0 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}

body.game-active .unit-badge.block-warrior-unit .block-body::before,
body.game-active .unit-badge.block-warrior-unit .block-body::after {
  content: "";
  position: absolute;
}

body.game-active .unit-badge.block-warrior-unit .block-body::before {
  left: 16%;
  right: 16%;
  top: 14%;
  height: 16%;
  background: var(--block-trim);
  opacity: 0.92;
}

body.game-active .unit-badge.block-warrior-unit .block-body::after {
  left: 44%;
  top: 8%;
  bottom: 0;
  width: 12%;
  background: rgba(255, 255, 255, 0.18);
}

body.game-active .unit-badge.block-warrior-unit .block-arm {
  bottom: 27%;
  width: 13%;
  height: 27%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--block-body) 88%, white) 0%, var(--block-body-dark) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

body.game-active .unit-badge.block-warrior-unit .block-arm-left {
  left: 11%;
  transform: rotate(-17deg);
  transform-origin: top center;
}

body.game-active .unit-badge.block-warrior-unit .block-arm-right {
  right: 11%;
  transform: rotate(17deg);
  transform-origin: top center;
}

body.game-active .unit-badge.block-warrior-unit .block-hand {
  bottom: 23%;
  width: 8%;
  height: 9%;
  background: linear-gradient(180deg, var(--block-hands) 0%, color-mix(in srgb, var(--block-hands) 82%, black) 100%);
}

body.game-active .unit-badge.block-warrior-unit .block-hand-left {
  left: 10%;
  transform: rotate(-17deg);
}

body.game-active .unit-badge.block-warrior-unit .block-hand-right {
  right: 10%;
  transform: rotate(17deg);
}

body.game-active .unit-badge.block-warrior-unit .block-head {
  left: 28%;
  top: 13%;
  width: 44%;
  height: 30%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--block-skin) 92%, white) 0%, var(--block-skin) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

body.game-active .unit-badge.block-warrior-unit .block-hair {
  left: 25%;
  top: 8%;
  width: 50%;
  height: 17%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--block-hair) 90%, white) 0%, var(--block-hair) 100%);
  clip-path: polygon(0 18%, 100% 0, 100% 76%, 82% 76%, 82% 94%, 52% 84%, 28% 100%, 28% 78%, 0 78%);
}

body.game-active .unit-badge.block-warrior-unit .block-eye {
  top: 25%;
  width: 7%;
  height: 10%;
  background: #111827;
}

body.game-active .unit-badge.block-warrior-unit .block-eye-left {
  left: 39%;
}

body.game-active .unit-badge.block-warrior-unit .block-eye-right {
  right: 39%;
}

body.game-active .unit-badge.block-warrior-unit .block-helmet {
  left: 24%;
  top: 7%;
  width: 52%;
  height: 22%;
  background: linear-gradient(180deg, var(--block-metal) 0%, var(--block-metal-dark) 100%);
  clip-path: polygon(0 32%, 28% 0, 78% 0, 100% 28%, 92% 100%, 8% 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

body.game-active .unit-badge.block-warrior-unit .block-helmet-crest {
  left: 43%;
  top: 2%;
  width: 14%;
  height: 15%;
  background: linear-gradient(180deg, var(--block-trim) 0%, color-mix(in srgb, var(--block-trim) 68%, black) 100%);
  clip-path: polygon(0 100%, 26% 0, 100% 18%, 74% 100%);
}

body.game-active .unit-badge.block-warrior-unit .block-shield {
  left: 3%;
  top: 44%;
  width: 25%;
  height: 28%;
  background: linear-gradient(145deg, var(--block-metal) 0%, var(--block-metal-dark) 100%);
  clip-path: polygon(0 12%, 88% 0, 100% 70%, 42% 100%, 0 80%);
  box-shadow:
    inset 0 0 0 4px var(--block-trim),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  z-index: 5;
}

body.game-active .unit-badge.block-warrior-unit .block-weapon {
  right: 2%;
  top: 26%;
  width: 10%;
  height: 42%;
  transform: rotate(16deg);
  transform-origin: 50% 86%;
  z-index: 4;
}

body.game-active .unit-badge.block-warrior-unit .block-weapon::before,
body.game-active .unit-badge.block-warrior-unit .block-weapon::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

body.game-active .unit-badge.block-warrior-unit .block-weapon::before {
  top: 0;
  width: 74%;
  height: 78%;
  background: linear-gradient(90deg, var(--block-metal-dark) 0%, var(--block-metal) 46%, #f7fbff 100%);
  clip-path: polygon(50% 0, 100% 12%, 82% 100%, 18% 100%, 0 12%);
}

body.game-active .unit-badge.block-warrior-unit .block-weapon::after {
  bottom: 0;
  width: 160%;
  height: 20%;
  background: linear-gradient(180deg, #d9a441 0%, #9a651f 100%);
  clip-path: polygon(0 20%, 100% 0, 92% 100%, 8% 100%);
}

body.game-active .unit-badge.block-warrior-unit.knight-model .block-body::before {
  background: linear-gradient(90deg, transparent 0 20%, var(--block-trim) 20% 80%, transparent 80% 100%);
}

body.game-active .unit-badge.block-warrior-unit.knight-model .block-shield {
  box-shadow:
    inset 0 0 0 4px var(--block-trim),
    inset 0 0 0 8px rgba(255, 255, 255, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

body.game-active .camera-orthographic .unit-sprite-button:has(.block-warrior-unit)::after {
  display: none;
}

body.game-active .hp-badge {
  right: -2px;
  bottom: 8px;
  padding: 1px 4px;
  font-size: 0.42rem;
}

body.game-active .map-selection-panel {
  display: none !important;
  position: fixed;
  top: 16px;
  right: 16px;
  left: auto;
  bottom: auto;
  width: min(340px, calc(100vw - 32px));
  margin: 0;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 90;
}

body.game-active .map-selection-panel.barracks-open {
  display: block !important;
}

body.game-active .map-selection-panel.barracks-open {
  max-height: calc(100dvh - 32px);
}

.selection-close-button {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid #536378;
  border-radius: 10px;
  background: #172737;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}
.barracks-open .selection-details {
  display: grid;
  gap: 10px;
}
.barracks-open .selection-details h2 {
  margin: 0 32px 4px 0;
  color: #fff;
  font-size: 1.4rem;
}
.barracks-open .selection-details p,
.barracks-open .action-panel p {
  margin: 0;
  line-height: 1.45;
}
.barracks-balance strong { color: #ffdf80; }

.barracks-open .action-panel {
  margin-top: 12px;
}

body.game-active .selection-details,
body.game-active .action-panel {
  gap: 8px;
}

body.game-active .selection-details p {
  font-size: 0.9rem;
}

body.game-active .action-button {
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.06);
}

@media (max-width: 980px) {
  body.game-active .topbar {
    left: 10px;
    right: 10px;
    grid-template-columns: repeat(3, auto);
  }

  body.game-active .topbar-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  body.game-active .board-stage {
    padding-top: 8px;
  }

  body.game-active .map-selection-panel {
    display: none !important;
  }
}

/* Exact image-backed board mode */
body.game-active .board.reference-board {
  position: relative;
  display: block;
  margin: 0 auto;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: visible;
}

body.game-active .reference-map-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  z-index: 0;
  filter: drop-shadow(0 28px 32px rgba(0, 0, 0, 0.34));
}

body.game-active .reference-board .tile {
  position: absolute;
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
  overflow: visible;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  cursor: pointer;
  transform: none;
  filter: none;
}

body.game-active .reference-board .tile::before,
body.game-active .reference-board .tile::after,
body.game-active .reference-board .tile-face,
body.game-active .reference-board .tile-inner {
  display: none;
  content: none;
}

body.game-active .reference-board .reference-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  display: block;
  clip-path: inherit;
  background: transparent;
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 120ms ease, transform 120ms ease, background 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

body.game-active .reference-board .reference-tile:hover::before {
  opacity: 1;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.42);
}

body.game-active .reference-board .reference-tile.selected::before {
  opacity: 1;
  background: rgba(255, 255, 255, 0.14);
  transform: scale(1.02);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.98);
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.34));
}

body.game-active .reference-board .reference-tile.reachable::before {
  opacity: 1;
  box-shadow: inset 0 0 0 2px rgba(124, 255, 156, 0.9);
}

body.game-active .reference-board .reference-tile.attackable::before {
  opacity: 1;
  box-shadow: inset 0 0 0 2px rgba(255, 111, 111, 0.92);
}

body.game-active .reference-site-marker,
body.game-active .reference-unit-marker,
body.game-active .reference-hp-badge {
  position: absolute;
  z-index: 2;
}

body.game-active .reference-site-marker {
  left: 50%;
  top: 40%;
  width: 8px;
  height: 18px;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(223, 232, 244, 0.96));
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.18),
    0 2px 6px rgba(0, 0, 0, 0.18);
}

body.game-active .reference-player-city {
  background: linear-gradient(180deg, #66d1ff, #ffffff 72%);
}

body.game-active .reference-enemy-city {
  background: linear-gradient(180deg, #ffb26f, #ffffff 72%);
}

body.game-active .reference-village-marker {
  width: 7px;
  height: 15px;
  background: linear-gradient(180deg, #fff6cf, #ffffff 78%);
}

body.game-active .reference-unit-marker {
  left: 50%;
  top: 52%;
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%);
}

body.game-active .reference-unit-core {
  position: absolute;
  left: 4px;
  top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #ffffff;
  box-shadow: 0 0 0 1px rgba(8, 12, 20, 0.24);
}

body.game-active .reference-unit-marker.friendly .reference-unit-core {
  background: #5dd0ff;
}

body.game-active .reference-unit-marker.enemy .reference-unit-core {
  background: #ff9d6b;
}

body.game-active .reference-unit-banner {
  position: absolute;
  left: 6px;
  top: 1px;
  width: 2px;
  height: 10px;
  background: rgba(255, 255, 255, 0.9);
}

body.game-active .reference-unit-banner::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 0;
  width: 6px;
  height: 5px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 25%, 0 100%);
}

body.game-active .reference-unit-marker.friendly {
  color: #53cfff;
}

body.game-active .reference-unit-marker.enemy {
  color: #ff996b;
}

body.game-active .reference-hp-badge {
  right: -4px;
  bottom: -2px;
  min-width: 14px;
  padding: 1px 3px;
  border-radius: 999px;
  background: rgba(5, 9, 14, 0.85);
  color: #ffffff;
  font-size: 0.42rem;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

body.game-active .board.square-board {
  position: relative;
  display: grid;
  grid-auto-rows: 28px;
  gap: 1px;
  margin: 0 auto;
  padding: 1px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}

body.game-active .square-board .square-tile {
  position: static;
  min-width: 28px;
  width: 28px;
  height: 28px;
  border: 0;
  padding: 0;
  background: #ffffff;
  clip-path: none;
  box-shadow: none;
  transform: none;
  transition: background 120ms ease, box-shadow 120ms ease;
}

body.game-active .square-board .square-tile::before,
body.game-active .square-board .square-tile::after {
  display: none;
  content: none;
}

body.game-active .square-board .square-tile:hover {
  background: #f1f1f1;
}

body.game-active .square-board .square-tile.selected {
  background: #ffffff;
  transform: none;
  box-shadow: inset 0 0 0 2px #4da3ff;
}

body.game-active .square-board .square-tile.reachable {
  background: #f5fff5;
}

body.game-active .square-board .square-tile.attackable {
  background: #fff2f2;
  box-shadow: inset 0 0 0 2px #ff7c7c;
}

body.game-active .board.prism-board {
  position: relative;
  display: block;
  margin: 0 auto;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
  isolation: isolate;
}

body.game-active .board.camera-orthographic {
  transform: translateZ(0);
}

body.game-active .camera-orthographic .prism-tile {
  position: absolute;
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
  overflow: visible;
  transform: translateZ(0);
  cursor: inherit;
  transition: transform 120ms ease;
}

body.game-active .camera-orthographic .prism-tile::before {
  content: "";
  position: absolute;
  left: 0;
  top: calc(var(--tile-top-height) / 2);
  width: 50%;
  height: var(--tile-depth);
  clip-path: polygon(100% 0, 100% 100%, 0 58%, 0 0);
  background: linear-gradient(180deg, #906536, #69451f);
  z-index: 1;
}

body.game-active .camera-orthographic .prism-tile::after {
  content: "";
  position: absolute;
  right: 0;
  top: calc(var(--tile-top-height) / 2);
  width: 50%;
  height: var(--tile-depth);
  clip-path: polygon(0 0, 100% 0, 100% 58%, 0 100%);
  background: linear-gradient(180deg, #764c24, #523216);
  z-index: 1;
}

body.game-active .camera-orthographic .prism-outline,
body.game-active .camera-orthographic .prism-top {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: var(--tile-top-height);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  pointer-events: none;
}

body.game-active .camera-orthographic .prism-outline {
  background: rgba(18, 22, 12, 0.22);
  transform: scale(1.03);
  opacity: 0.42;
  z-index: 2;
  transition: opacity 120ms ease, transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

body.game-active .camera-orthographic .prism-top {
  background: linear-gradient(180deg, #fcf8df 0%, #f3efcf 62%, #ddd6b6 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -2px 5px rgba(0, 0, 0, 0.08);
  z-index: 3;
}

body.game-active .camera-orthographic .prism-top::before {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 44%, rgba(0, 0, 0, 0.08) 100%);
}

body.game-active .camera-orthographic .prism-top::after {
  content: "";
  position: absolute;
  inset: 0;
  clip-path: inherit;
  background: conic-gradient(
    from 90deg at 50% 50%,
    rgba(255, 255, 255, 0.2) 0deg 90deg,
    rgba(0, 0, 0, 0.06) 90deg 180deg,
    rgba(255, 255, 255, 0.08) 180deg 270deg,
    rgba(0, 0, 0, 0.1) 270deg 360deg
  );
  opacity: 0.58;
}

body.game-active .camera-orthographic .prism-tile[data-palette="grass"]::before,
body.game-active .camera-orthographic .prism-tile[data-palette="green"]::before {
  background: linear-gradient(180deg, #8c6730, #654220);
}

body.game-active .camera-orthographic .prism-tile[data-palette="grass"]::after,
body.game-active .camera-orthographic .prism-tile[data-palette="green"]::after {
  background: linear-gradient(180deg, #785026, #4f2f14);
}

body.game-active .camera-orthographic .prism-tile[data-palette="grass"] .prism-top,
body.game-active .camera-orthographic .prism-tile[data-palette="green"] .prism-top {
  background: linear-gradient(180deg, #d7fb7a 0%, #a8e156 54%, #7fbe36 100%);
}

body.game-active .camera-orthographic .prism-tile[data-palette="snow"]::before {
  background: linear-gradient(180deg, #cfdce8, #b3c0cf);
}

body.game-active .camera-orthographic .prism-tile[data-palette="snow"]::after {
  background: linear-gradient(180deg, #bac7d5, #9daab8);
}

body.game-active .camera-orthographic .prism-tile[data-palette="snow"] .prism-top {
  background: linear-gradient(180deg, #ffffff 0%, #edf7ff 54%, #d7ebfb 100%);
}

body.game-active .camera-orthographic .prism-tile[data-palette="sand"]::before {
  background: linear-gradient(180deg, #b07a3e, #875929);
}

body.game-active .camera-orthographic .prism-tile[data-palette="sand"]::after {
  background: linear-gradient(180deg, #9b6832, #6e461f);
}

body.game-active .camera-orthographic .prism-tile[data-palette="sand"] .prism-top {
  background: linear-gradient(180deg, #ffeeb4 0%, #efcf7f 54%, #dcb45f 100%);
}

body.game-active .camera-orthographic .prism-tile[data-palette="water"]::before {
  background: linear-gradient(180deg, #4aa4df, #2d6ba7);
}

body.game-active .camera-orthographic .prism-tile[data-palette="water"]::after {
  background: linear-gradient(180deg, #388fd2, #214f85);
}

body.game-active .camera-orthographic .prism-tile[data-palette="water"] .prism-top {
  background:
    url("assets/polytopia-water-tile.png") center center / cover no-repeat,
    linear-gradient(180deg, #74c8ff 0%, #479fe8 54%, #2f86d0 100%);
}

body.game-active .camera-orthographic .prism-tile[data-palette="water"] .prism-top::before,
body.game-active .camera-orthographic .prism-tile[data-palette="water"] .prism-top::after {
  display: none;
}

body.game-active .camera-orthographic .prism-structure {
  position: absolute;
  left: 50%;
  top: calc(50% - (var(--tile-depth) / 2));
  pointer-events: none;
  z-index: 4;
}

body.game-active .camera-orthographic .prism-structure.forest {
  width: calc(var(--tile-width) * 0.66);
  height: calc(var(--tile-width) * 0.8);
  transform: translate(-50%, -58%);
}

body.game-active .camera-orthographic .prism-structure.forest::before {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: 0;
  height: 10%;
  background: rgba(16, 26, 14, 0.15);
  clip-path: polygon(6% 100%, 18% 40%, 82% 40%, 94% 100%);
}

body.game-active .camera-orthographic .forest-tree {
  position: absolute;
  bottom: 0;
  width: 18%;
  clip-path: polygon(50% 0, 66% 6%, 74% 18%, 82% 34%, 90% 56%, 84% 78%, 66% 100%, 34% 100%, 16% 78%, 10% 56%, 18% 34%, 26% 18%, 34% 6%);
  background: linear-gradient(150deg, #7fd36e 0%, #489652 34%, #2d663c 66%, #1b4428 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 2px 4px rgba(0, 0, 0, 0.16);
}

body.game-active .camera-orthographic .forest-tree::before,
body.game-active .camera-orthographic .forest-tree::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

body.game-active .camera-orthographic .forest-tree::before {
  left: 0;
  top: 0;
  bottom: 0;
  width: 54%;
  clip-path: polygon(50% 0, 60% 8%, 66% 18%, 72% 36%, 74% 58%, 62% 100%, 0 100%, 0 54%, 16% 32%, 30% 16%, 40% 6%);
  background: linear-gradient(155deg, rgba(190, 244, 162, 0.92), rgba(104, 198, 112, 0.78) 52%, rgba(39, 88, 52, 0.14) 100%);
}

body.game-active .camera-orthographic .forest-tree::after {
  left: 39%;
  bottom: -6%;
  width: 16%;
  height: 12%;
  border-radius: 0;
  background: linear-gradient(180deg, #8b643f, #664222);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

body.game-active .camera-orthographic .forest-tree.tree-left-back {
  left: 4%;
  bottom: 12%;
  width: 16%;
  height: 42%;
  opacity: 0.96;
}

body.game-active .camera-orthographic .forest-tree.tree-left-front {
  left: 16%;
  bottom: 4%;
  width: 18%;
  height: 58%;
}

body.game-active .camera-orthographic .forest-tree.tree-center-back {
  left: 38%;
  bottom: 10%;
  width: 19%;
  height: 74%;
  z-index: 3;
}

body.game-active .camera-orthographic .forest-tree.tree-center-front {
  left: 48%;
  bottom: 4%;
  width: 17%;
  height: 62%;
  z-index: 4;
}

body.game-active .camera-orthographic .forest-tree.tree-right {
  right: 8%;
  bottom: 6%;
  width: 18%;
  height: 58%;
  z-index: 3;
}

body.game-active .camera-orthographic .prism-structure.mountain {
  width: calc(var(--tile-width) * 0.86);
  height: calc(var(--tile-width) * 0.74);
  transform: translate(-50%, -52%);
}

body.game-active .camera-orthographic .prism-structure.mountain::before {
  display: none;
}

body.game-active .camera-orthographic .exact-mountain .mountain-image {
  position: absolute;
  inset: 0;
  background: url("assets/polytopia-imperius-mountain.png") center bottom / contain no-repeat;
  image-rendering: auto;
  filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.18));
}

body.game-active .camera-orthographic .prism-structure.ruins {
  width: calc(var(--tile-width) * 0.58);
  height: calc(var(--tile-width) * 0.46);
  transform: translate(-50%, -42%);
}

body.game-active .camera-orthographic .ruin-plinth,
body.game-active .camera-orthographic .ruin-platform,
body.game-active .camera-orthographic .ruin-wall,
body.game-active .camera-orthographic .ruin-column,
body.game-active .camera-orthographic .ruin-cap,
body.game-active .camera-orthographic .ruin-rubble {
  position: absolute;
  border-radius: 0;
  background: linear-gradient(180deg, #f7fbff 0%, #d9e2ea 58%, #b0bcc8 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 2px 4px rgba(0, 0, 0, 0.12);
}

body.game-active .camera-orthographic .ruin-plinth {
  left: 18%;
  right: 18%;
  bottom: 0;
  height: 14%;
  clip-path: polygon(0 18%, 100% 0, 100% 100%, 0 100%);
}

body.game-active .camera-orthographic .ruin-platform {
  left: 23%;
  right: 23%;
  bottom: 11%;
  height: 10%;
  clip-path: polygon(0 10%, 100% 0, 94% 100%, 6% 100%);
}

body.game-active .camera-orthographic .ruin-wall {
  bottom: 22%;
}

body.game-active .camera-orthographic .ruin-wall-back {
  left: 34%;
  width: 28%;
  height: 28%;
  clip-path: polygon(0 100%, 0 14%, 24% 0, 66% 0, 84% 18%, 100% 10%, 100% 100%);
}

body.game-active .camera-orthographic .ruin-wall-left {
  left: 20%;
  width: 18%;
  height: 20%;
  clip-path: polygon(0 100%, 0 26%, 34% 0, 100% 12%, 100% 100%);
}

body.game-active .camera-orthographic .ruin-wall-right {
  right: 20%;
  width: 18%;
  height: 18%;
  clip-path: polygon(0 100%, 0 12%, 66% 0, 100% 24%, 100% 100%);
}

body.game-active .camera-orthographic .ruin-column {
  bottom: 18%;
  width: 10%;
  height: 22%;
  clip-path: polygon(8% 0, 100% 0, 94% 100%, 0 100%);
}

body.game-active .camera-orthographic .ruin-column-left {
  left: 29%;
}

body.game-active .camera-orthographic .ruin-column-right {
  right: 29%;
  height: 18%;
}

body.game-active .camera-orthographic .ruin-cap {
  bottom: 37%;
  width: 12%;
  height: 6%;
  clip-path: polygon(0 18%, 100% 0, 90% 100%, 0 100%);
}

body.game-active .camera-orthographic .ruin-cap-left {
  left: 28%;
}

body.game-active .camera-orthographic .ruin-cap-right {
  right: 28%;
  bottom: 31%;
}

body.game-active .camera-orthographic .ruin-rubble {
  bottom: 13%;
  width: 10%;
  height: 10%;
  clip-path: polygon(0 72%, 24% 18%, 62% 0, 100% 34%, 86% 100%, 18% 100%);
}

body.game-active .camera-orthographic .ruin-rubble-left {
  left: 18%;
  width: 12%;
  height: 12%;
}

body.game-active .camera-orthographic .ruin-rubble-center {
  left: 44%;
  width: 8%;
  height: 8%;
}

body.game-active .camera-orthographic .ruin-rubble-right {
  right: 17%;
}

body.game-active .camera-orthographic .prism-tile[data-biome="snow"] .forest-tree {
  background: linear-gradient(150deg, #8eb89d 0%, #547867 38%, #385347 68%, #23342d 100%);
}

body.game-active .camera-orthographic .prism-tile[data-biome="snow"] .forest-tree::before {
  background: linear-gradient(155deg, rgba(224, 242, 232, 0.92), rgba(138, 186, 165, 0.74) 52%, rgba(59, 92, 79, 0.18) 100%);
}

body.game-active .camera-orthographic .prism-tile[data-biome="snow"] .forest-tree::after {
  background: linear-gradient(180deg, #89684a, #654827);
}

body.game-active .camera-orthographic .prism-tile[data-biome="snow"] .exact-mountain .mountain-image {
  filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.14)) brightness(1.04);
}

body.game-active .camera-orthographic .prism-tile[data-biome="snow"] .ruin-plinth,
body.game-active .camera-orthographic .prism-tile[data-biome="snow"] .ruin-platform,
body.game-active .camera-orthographic .prism-tile[data-biome="snow"] .ruin-wall,
body.game-active .camera-orthographic .prism-tile[data-biome="snow"] .ruin-column,
body.game-active .camera-orthographic .prism-tile[data-biome="snow"] .ruin-cap,
body.game-active .camera-orthographic .prism-tile[data-biome="snow"] .ruin-rubble {
  background: linear-gradient(180deg, #e4edf4 0%, #c3ced9 62%, #9ea9b8 100%);
}

body.game-active .camera-orthographic .prism-tile[data-biome="desert"] .forest-tree {
  background: linear-gradient(150deg, #90a966 0%, #607640 38%, #455930 68%, #2c3d21 100%);
}

body.game-active .camera-orthographic .prism-tile[data-biome="desert"] .forest-tree::before {
  background: linear-gradient(155deg, rgba(218, 230, 160, 0.88), rgba(148, 176, 95, 0.66) 52%, rgba(78, 96, 44, 0.18) 100%);
}

body.game-active .camera-orthographic .prism-tile[data-biome="desert"] .forest-tree::after {
  background: linear-gradient(180deg, #926740, #694821);
}

body.game-active .camera-orthographic .prism-tile[data-biome="desert"] .exact-mountain .mountain-image {
  filter: drop-shadow(0 4px 5px rgba(0, 0, 0, 0.16)) saturate(0.82) sepia(0.12) hue-rotate(-10deg);
}

body.game-active .camera-orthographic .prism-tile[data-biome="desert"] .ruin-plinth,
body.game-active .camera-orthographic .prism-tile[data-biome="desert"] .ruin-platform,
body.game-active .camera-orthographic .prism-tile[data-biome="desert"] .ruin-wall,
body.game-active .camera-orthographic .prism-tile[data-biome="desert"] .ruin-column,
body.game-active .camera-orthographic .prism-tile[data-biome="desert"] .ruin-cap,
body.game-active .camera-orthographic .prism-tile[data-biome="desert"] .ruin-rubble {
  background: linear-gradient(180deg, #ddc39b 0%, #bf9d72 60%, #957453 100%);
}

body.game-active .camera-orthographic .unit-sprite-button {
  --unit-facing-transform: scaleX(1);
  position: absolute;
  width: calc(var(--tile-width) * 0.82);
  height: calc(var(--tile-width) * 0.82);
  padding: 0;
  border: 0;
  background: transparent;
  transform: translate(-50%, -50%);
  cursor: pointer;
  touch-action: manipulation;
  outline: none;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
  overflow: visible;
}

body.game-active .camera-orthographic .unit-sprite-button[data-facing="east"] {
  --unit-facing-transform: scaleX(-1) rotate(0deg);
}

body.game-active .camera-orthographic .unit-sprite-button[data-facing="southeast"] {
  --unit-facing-transform: scaleX(-1) rotate(8deg) scale(1.01);
}

body.game-active .camera-orthographic .unit-sprite-button[data-facing="northeast"] {
  --unit-facing-transform: scaleX(-1) rotate(-14deg) scale(0.98);
}

body.game-active .camera-orthographic .unit-sprite-button[data-facing="west"] {
  --unit-facing-transform: scaleX(1) rotate(0deg);
}

body.game-active .camera-orthographic .unit-sprite-button[data-facing="southwest"] {
  --unit-facing-transform: scaleX(1) rotate(8deg) scale(1.01);
}

body.game-active .camera-orthographic .unit-sprite-button[data-facing="northwest"] {
  --unit-facing-transform: scaleX(1) rotate(-14deg) scale(0.98);
}

body.game-active .camera-orthographic .unit-sprite-button[data-facing="north"] {
  --unit-facing-transform: scaleX(1) rotate(-8deg) scale(0.96);
}

body.game-active .camera-orthographic .unit-sprite-button[data-facing="south"] {
  --unit-facing-transform: scaleX(-1) rotate(8deg) scale(1.02);
}

body.game-active .camera-orthographic .unit-sprite-button.selected {
  filter: drop-shadow(0 0 0.55rem rgba(77, 163, 255, 0.55));
}

body.game-active .camera-orthographic .unit-sprite-button:hover,
body.game-active .camera-orthographic .unit-sprite-button:focus-visible {
  transform: translate(-50%, -50%);
}

body.game-active .camera-orthographic .unit-sprite-button:focus,
body.game-active .camera-orthographic .unit-sprite-button:focus-visible,
body.game-active .camera-orthographic .move-target-button:focus,
body.game-active .camera-orthographic .move-target-button:focus-visible {
  outline: none;
  box-shadow: none;
}

body.game-active .camera-orthographic .unit-sprite-button::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 56%;
  width: calc(var(--tile-width) * 0.28);
  height: calc(var(--tile-top-height) * 0.22);
  transform: translate(-50%, -50%);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  background: rgba(12, 22, 36, 0.28);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
  pointer-events: none;
  z-index: 1;
}

body.game-active .camera-orthographic .unit-sprite-button.selected::after {
  background: rgba(74, 164, 255, 0.32);
  box-shadow:
    0 0 0 2px rgba(74, 164, 255, 0.96),
    0 2px 8px rgba(8, 18, 28, 0.24);
}

body.game-active .camera-orthographic .unit-sprite-button .unit-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) var(--unit-facing-transform);
  transform-origin: 50% 85%;
  transition: transform 140ms ease;
  pointer-events: none;
}

body.game-active .camera-orthographic .unit-sprite-button .unit-badge.block-warrior-unit {
  top: 50%;
  transform: translate(-50%, -96%) var(--unit-facing-transform);
}

body.game-active .camera-orthographic .wildlife-sprite {
  --wildlife-facing-transform: scaleX(1);
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--tile-width) * 0.84);
  height: calc(var(--tile-width) * 0.66);
  pointer-events: none;
  transform: translate(-50%, -88%) var(--wildlife-facing-transform);
  transform-origin: 50% 84%;
  filter: drop-shadow(0 5px 7px rgba(0, 0, 0, 0.22));
  transition: transform 160ms ease;
}

body.game-active .camera-orthographic .deer-model,
body.game-active .camera-orthographic .deer-model span {
  position: absolute;
  display: block;
}

body.game-active .camera-orthographic .deer-model {
  inset: 0;
}

body.game-active .camera-orthographic .deer-shadow {
  left: 18%;
  right: 12%;
  bottom: 0;
  height: 14%;
  background: rgba(18, 25, 16, 0.22);
  clip-path: polygon(8% 48%, 26% 12%, 74% 0, 100% 38%, 84% 82%, 28% 100%, 0 78%);
}

body.game-active .camera-orthographic .deer-body,
body.game-active .camera-orthographic .deer-chest,
body.game-active .camera-orthographic .deer-rump,
body.game-active .camera-orthographic .deer-neck,
body.game-active .camera-orthographic .deer-head,
body.game-active .camera-orthographic .deer-snout,
body.game-active .camera-orthographic .deer-tail,
body.game-active .camera-orthographic .deer-ear,
body.game-active .camera-orthographic .deer-leg {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset -2px -2px 0 rgba(55, 31, 13, 0.16);
}

body.game-active .camera-orthographic .deer-body {
  left: 28%;
  top: 45%;
  width: 38%;
  height: 20%;
  background: linear-gradient(145deg, #c18a51 0%, #9c6933 48%, #744a23 100%);
  clip-path: polygon(4% 26%, 22% 0, 82% 8%, 100% 34%, 88% 100%, 12% 88%);
}

body.game-active .camera-orthographic .deer-chest {
  left: 56%;
  top: 42%;
  width: 18%;
  height: 22%;
  background: linear-gradient(145deg, #bb8349 0%, #906030 58%, #744a23 100%);
  clip-path: polygon(0 18%, 78% 0, 100% 40%, 72% 100%, 10% 90%);
}

body.game-active .camera-orthographic .deer-rump {
  left: 20%;
  top: 46%;
  width: 18%;
  height: 19%;
  background: linear-gradient(145deg, #a8753f 0%, #7f5428 100%);
  clip-path: polygon(20% 0, 100% 12%, 92% 92%, 0 100%, 10% 38%);
}

body.game-active .camera-orthographic .deer-tail {
  left: 13%;
  top: 43%;
  width: 12%;
  height: 12%;
  background: linear-gradient(145deg, #f3eee2, #d9cab1 70%, #9c6933);
  clip-path: polygon(24% 14%, 100% 0, 86% 78%, 0 100%);
}

body.game-active .camera-orthographic .deer-neck {
  left: 63%;
  top: 32%;
  width: 14%;
  height: 25%;
  background: linear-gradient(145deg, #bb8349 0%, #906030 55%, #744a23 100%);
  clip-path: polygon(18% 100%, 0 18%, 42% 0, 100% 86%);
}

body.game-active .camera-orthographic .deer-head {
  left: 72%;
  top: 25%;
  width: 19%;
  height: 19%;
  background: linear-gradient(145deg, #c79258 0%, #9c6933 55%, #744a23 100%);
  clip-path: polygon(4% 26%, 44% 0, 100% 18%, 88% 82%, 26% 100%, 0 68%);
}

body.game-active .camera-orthographic .deer-snout {
  left: 86%;
  top: 34%;
  width: 14%;
  height: 9%;
  background: linear-gradient(145deg, #eadab8 0%, #ddcaa4 64%, #9c6933 100%);
  clip-path: polygon(0 18%, 84% 0, 100% 54%, 72% 100%, 4% 86%);
}

body.game-active .camera-orthographic .deer-snout::after {
  content: "";
  position: absolute;
  right: 8%;
  top: 38%;
  width: 18%;
  height: 28%;
  background: #1b1512;
  clip-path: polygon(0 0, 100% 24%, 86% 100%, 18% 86%);
}

body.game-active .camera-orthographic .deer-eye {
  left: 82%;
  top: 31%;
  width: 4%;
  height: 6%;
  background: #151515;
  box-shadow: -2px 0 0 #f4f2eb;
}

body.game-active .camera-orthographic .deer-ear {
  top: 19%;
  width: 6%;
  height: 12%;
  background: linear-gradient(145deg, #bb8349 0%, #906030 62%, #744a23 100%);
  clip-path: polygon(48% 0, 100% 88%, 10% 100%);
}

body.game-active .camera-orthographic .deer-ear-left {
  left: 73%;
  transform: rotate(-14deg);
}

body.game-active .camera-orthographic .deer-ear-right {
  left: 82%;
  transform: rotate(16deg);
}

body.game-active .camera-orthographic .deer-antler {
  top: 6%;
  width: 4%;
  height: 22%;
  background: #be9159;
  clip-path: polygon(34% 100%, 48% 38%, 0 38%, 0 24%, 54% 24%, 66% 0, 100% 4%, 78% 100%);
}

body.game-active .camera-orthographic .deer-antler-left {
  left: 76%;
  transform: rotate(-10deg);
}

body.game-active .camera-orthographic .deer-antler-right {
  left: 84%;
  transform: scaleX(-1) rotate(-10deg);
}

body.game-active .camera-orthographic .deer-leg {
  top: 60%;
  width: 6%;
  height: 26%;
  background: linear-gradient(180deg, #9c6933 0%, #7f5428 64%, #3f2b1a 65%, #312113 100%);
  clip-path: polygon(18% 0, 100% 8%, 82% 100%, 0 92%);
}

body.game-active .camera-orthographic .deer-leg-back-left {
  left: 28%;
}

body.game-active .camera-orthographic .deer-leg-back-right {
  left: 38%;
  top: 62%;
}

body.game-active .camera-orthographic .deer-leg-front-left {
  left: 58%;
  top: 61%;
}

body.game-active .camera-orthographic .deer-leg-front-right {
  left: 67%;
  top: 60%;
}

body.game-active .camera-orthographic .prism-tile:hover .prism-outline {
  opacity: 0.62;
  background: rgba(255, 255, 255, 0.7);
}

body.game-active .camera-orthographic .prism-tile,
body.game-active .camera-orthographic .prism-tile.selected,
body.game-active .camera-orthographic .prism-tile:hover {
  outline: none;
  outline-offset: 0;
}

body.game-active .camera-orthographic .prism-tile.selected {
  transform: none;
}

body.game-active .camera-orthographic .prism-tile.selected .prism-outline {
  opacity: 1;
  transform: scale(1.08);
  background: rgba(77, 163, 255, 0.42);
  box-shadow: inset 0 0 0 2px #4da3ff;
}

body.game-active .camera-orthographic .prism-tile.selected .prism-top {
  box-shadow:
    inset 0 0 0 2px rgba(77, 163, 255, 0.94),
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -2px 5px rgba(0, 0, 0, 0.08);
}

body.game-active .camera-orthographic .prism-tile.move-target-tile .prism-outline {
  opacity: 1;
  background: rgba(74, 164, 255, 0.44);
  box-shadow: inset 0 0 0 3px rgba(74, 164, 255, 0.98);
}

body.game-active .camera-orthographic .prism-tile.move-target-tile .prism-top {
  box-shadow:
    inset 0 0 0 2px rgba(120, 203, 255, 0.94),
    inset 0 0 22px rgba(74, 164, 255, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    inset 0 -2px 5px rgba(0, 0, 0, 0.08);
}

body.game-active .camera-orthographic .move-target-marker {
  position: absolute;
  left: 50%;
  top: calc(50% - (var(--tile-depth) / 2));
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.game-active .camera-orthographic .selected-unit-marker {
  position: absolute;
  left: 50%;
  top: calc(50% - (var(--tile-depth) / 2));
  width: 20px;
  height: 20px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
}

body.game-active .camera-orthographic .selected-unit-marker::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(13, 36, 64, 0.36);
  border: 2px solid rgba(255, 255, 255, 0.96);
  box-shadow:
    0 0 0 2px rgba(74, 164, 255, 0.96),
    0 0 14px rgba(74, 164, 255, 0.34);
}

body.game-active .camera-orthographic .selected-unit-core {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 0 0 2px rgba(74, 164, 255, 0.9);
}

body.game-active .camera-orthographic .move-target-marker::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(74, 164, 255, 0.28);
  border: 3px solid rgba(74, 164, 255, 0.96);
  box-shadow: 0 0 0 2px rgba(8, 18, 28, 0.24);
}

body.game-active .camera-orthographic .move-target-core {
  position: relative;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #f7fcff;
  box-shadow: 0 0 0 3px rgba(74, 164, 255, 0.58);
}

body.game-active .camera-orthographic .move-target-button {
  position: absolute;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  outline: none;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
}

body.game-active .camera-orthographic .move-target-button:hover .move-target-marker::before,
body.game-active .camera-orthographic .move-target-button:focus-visible .move-target-marker::before {
  transform: scale(1.08);
  background: rgba(74, 164, 255, 0.42);
}

body.game-active .camera-orthographic .prism-tile.attackable .prism-outline {
  opacity: 1;
  background: rgba(255, 124, 124, 0.42);
  box-shadow: inset 0 0 0 2px rgba(255, 124, 124, 0.95);
}

/* Ranged targeting and projectile effects. */
body.game-active .model-unit-hitbox.attackable::before,
body.game-active .model-castle-hitbox.attackable::before,
body.game-active .model-wildlife-hitbox.attackable::before {
  content: "";
  position: absolute;
  inset: 24% 12% 10%;
  border: 2px solid #ff7056;
  border-radius: 50%;
  background: rgba(235, 56, 32, 0.18);
  box-shadow: 0 0 16px rgba(255, 75, 32, 0.75), inset 0 0 12px rgba(255, 86, 42, 0.2);
  clip-path: none;
  pointer-events: none;
}
body.game-active .model-unit-hitbox.attackable:hover::before,
body.game-active .model-unit-hitbox.attackable:focus-visible::before,
body.game-active .model-castle-hitbox.attackable:hover::before,
body.game-active .model-castle-hitbox.attackable:focus-visible::before,
body.game-active .model-wildlife-hitbox.attackable:hover::before,
body.game-active .model-wildlife-hitbox.attackable:focus-visible::before {
  background: rgba(255, 86, 42, 0.35);
  border-color: #ffe1b8;
}
.model-range-label {
  position: absolute;
  left: 50%;
  top: 85%;
  transform: translateX(-50%);
  padding: 3px 6px;
  border-radius: 5px;
  background: rgba(5, 13, 22, 0.85);
  color: #fff;
  font: 600 11px/1.3 system-ui, sans-serif;
  white-space: nowrap;
  pointer-events: none;
}
.ranged-projectile {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  border-radius: 50%;
  will-change: left, top, transform;
}
.ranged-projectile.fireball {
  background: radial-gradient(circle at 65% 50%, #ffffd4 0 20%, #ffd548 35%, #ff7a13 65%, #e83b0b 90%);
  box-shadow: 0 0 12px 5px #ff8b16, 0 0 26px 10px rgba(255, 70, 10, 0.6);
}
.ranged-projectile.fireball::before {
  content: "";
  position: absolute;
  right: 55%;
  top: 10%;
  width: 220%;
  height: 80%;
  border-radius: 70% 10% 10% 70%;
  background: linear-gradient(90deg, transparent, #f45b13 55%, #ffd45a);
  filter: blur(2px);
  z-index: -1;
}
.ranged-projectile.stone {
  border: 2px solid #51463a;
  border-radius: 35% 45% 30% 40%;
  background: linear-gradient(135deg, #e6dbca 5%, #9f9585 45%, #62594f 80%);
  box-shadow: 2px 5px 4px rgba(0, 0, 0, 0.5);
}
.ranged-projectile.impact {
  animation: ranged-impact 220ms ease-out forwards;
}
.ranged-projectile.impact::before { display: none; }
.ranged-projectile.stone.impact {
  border-color: #bdab89;
  background: rgba(198, 177, 135, 0.65);
  box-shadow: 0 0 14px 6px rgba(198, 177, 135, 0.6);
}
@keyframes ranged-impact {
  from { scale: 1; opacity: 1; }
  to { scale: 3.5; opacity: 0; }
}
#ranged-practice-panel {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 60;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  width: min(620px, calc(100vw - 32px));
  padding: 14px 18px;
  box-sizing: border-box;
  border: 1px solid #35526c;
  border-radius: 16px;
  background: rgba(6, 16, 26, 0.95);
  color: #dceaff;
  font: 14px/1.45 system-ui, sans-serif;
}
#ranged-practice-panel strong { color: #fff; }
#ranged-practice-panel span { flex-basis: 100%; }
#ranged-practice-panel a { color: #97d9ff; }
#ranged-practice-panel .action-button {
  width: auto;
  padding: 8px 10px;
}
.castle-team-label {
  position: absolute;
  left: 50%;
  top: 88%;
  display: inline-grid;
  grid-template-columns: 7px auto;
  align-items: center;
  gap: 5px;
  transform: translateX(-50%);
  padding: 3px 6px;
  border: 1px solid var(--castle-team-color);
  border-radius: 6px;
  background: rgba(5, 13, 22, 0.9);
  color: #fff;
  font: 600 11px/1.3 system-ui, sans-serif;
  white-space: nowrap;
  pointer-events: auto;
}
.castle-team-label::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--castle-team-color);
}

.castle-health-track {
  grid-column: 1 / -1;
  height: 4px;
  border-radius: 3px;
  overflow: hidden;
  background: #492d2d;
}
.castle-health-track > span {
  display: block;
  height: 100%;
  background: #7fe094;
}
.castle-fallback-button {
  position: absolute;
  transform: translate(-50%, -85%);
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 48px;
  cursor: pointer;
}
.castle-fallback-button.attackable { filter: drop-shadow(0 0 8px #ff7056); }
