:root {
  --ink: #e8dfc3;
  --muted: #aaa184;
  --paper: #b7a273;
  --paper-dark: #796b4b;
  --panel: #211e18;
  --panel-2: #2c281f;
  --line: #5e543e;
  --gold: #c7a65c;
  --red: #a13b31;
  --shadow: #0d0b08;
}

* {
  box-sizing: border-box;
}

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

body {
  min-width: 1080px;
  overflow-x: auto;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    #15130f;
  background-size: 4px 4px;
  font-family: "Songti SC", "SimSun", "Noto Serif CJK SC", serif;
  font-size: 14px;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible {
  outline: 2px solid #eee0a9;
  outline-offset: 2px;
}

.crt-noise {
  position: fixed;
  z-index: 100;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  background: repeating-linear-gradient(0deg, transparent 0 2px, #000 3px);
  mix-blend-mode: multiply;
}

.topbar {
  position: relative;
  z-index: 2;
  height: 76px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 10px 18px;
  border-bottom: 3px double #82734f;
  background: linear-gradient(#27231b, #1b1813);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.45);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-block h1 {
  margin: 0;
  color: #ebdba7;
  font-size: 24px;
  letter-spacing: 0.18em;
  text-shadow: 2px 2px #000;
}

.brand-block p {
  margin: 4px 0 0;
  color: #958b70;
  font-size: 12px;
  letter-spacing: 0.12em;
}

.seal {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: #ead8a6;
  border: 2px solid #c45b49;
  background: #7d2c27;
  box-shadow: inset 0 0 0 3px #451915, 2px 3px #090806;
  font-size: 25px;
  font-weight: 700;
}

.turn-block {
  min-width: 220px;
  padding: 7px 22px;
  text-align: center;
  border: 1px solid #6d6044;
  background: #12100c;
  box-shadow: inset 0 0 10px #000;
}

.turn-block span {
  display: block;
}

#date-label {
  color: #ead8a6;
  font-size: 16px;
  letter-spacing: 0.12em;
}

#turn-label {
  margin-top: 3px;
  color: #877e69;
  font-size: 11px;
}

.top-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.small-button,
.primary-button,
.continue-button {
  cursor: pointer;
  border: 1px solid #796c4f;
  background: linear-gradient(#3b3528, #242019);
  box-shadow: inset 0 0 0 1px #17140f, 1px 2px #090806;
}

.small-button {
  min-height: 30px;
  padding: 5px 12px;
  color: #cfc4a5;
}

.small-button:hover,
.primary-button:hover,
.continue-button:hover {
  color: #fff1bd;
  border-color: #b9a268;
  background: linear-gradient(#4b422e, #2c261b);
}

.game-layout {
  height: calc(100vh - 220px);
  min-height: 560px;
  display: grid;
  grid-template-columns: 258px minmax(560px, 1fr) 272px;
  gap: 8px;
  padding: 8px;
}

.panel,
.map-panel,
.bottom-bar {
  border: 1px solid #544b38;
  background: var(--panel);
  box-shadow: inset 0 0 0 2px #15130f, 2px 3px 7px rgba(0, 0, 0, 0.5);
}

.panel {
  min-height: 0;
  overflow: hidden;
}

.panel-title {
  height: 39px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 11px;
  color: #dccb96;
  border-bottom: 1px solid #5e543e;
  background: linear-gradient(90deg, #393326, #242019);
  letter-spacing: 0.14em;
}

.panel-title i {
  height: 1px;
  flex: 1;
  background: #796b4a;
  box-shadow: 0 3px #17140f;
}

.faction-summary {
  min-height: 65px;
  padding: 12px;
  border-bottom: 1px solid #403a2d;
  background: #191712;
}

.faction-name-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.faction-swatch {
  width: 11px;
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  box-shadow: 1px 1px #000;
}

.faction-summary strong {
  color: #ead8a6;
  font-size: 17px;
}

.faction-summary small {
  display: block;
  margin-top: 5px;
  color: #8f866e;
}

.faction-summary .upkeep-preview {
  margin: 8px 0 0 20px;
  color: #c19b72;
}

.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid #4c4433;
}

.resource-item {
  padding: 9px 3px;
  text-align: center;
  border-right: 1px solid #403a2d;
  background: #29251d;
}

.resource-item:last-child {
  border-right: 0;
}

.resource-item span {
  display: block;
  color: #9a9074;
  font-size: 11px;
}

.resource-item b {
  display: block;
  margin-top: 3px;
  color: #e1cf96;
  font-family: Georgia, serif;
  font-size: 17px;
}

.section-heading {
  padding: 8px 10px 6px;
  color: #a89b79;
  font-size: 12px;
  letter-spacing: 0.13em;
}

.hero-list {
  height: calc(100% - 207px);
  min-height: 220px;
  padding: 0 8px 10px;
  overflow-y: auto;
  scrollbar-color: #655a40 #1a1813;
}

.hero-card {
  position: relative;
  width: 100%;
  margin-bottom: 7px;
  padding: 9px;
  cursor: pointer;
  text-align: left;
  border: 1px solid #4f4736;
  background: linear-gradient(120deg, #302b21, #252119);
  box-shadow: inset 0 0 0 1px #181611;
}

.hero-card:hover,
.hero-card.selected {
  border-color: #a58e58;
  background: linear-gradient(120deg, #443a28, #292319);
}

.hero-card.selected::before {
  position: absolute;
  top: 8px;
  left: -5px;
  width: 4px;
  height: calc(100% - 16px);
  content: "";
  background: #d0ae5d;
  box-shadow: 1px 0 #0c0a08;
}

.hero-card.moved {
  filter: saturate(0.45);
  opacity: 0.68;
}

.legend-line {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin: 6px 0 2px;
  color: #b8aa83;
  font-size: 11px;
}

.legend-tag {
  color: #79bbb0;
}

.hero-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.hero-head strong {
  color: #ebdcac;
  font-size: 15px;
}

.hero-head strong em {
  color: #a99a70;
  font-family: Georgia, serif;
  font-size: 10px;
  font-style: normal;
  font-weight: 400;
}

.hero-head small {
  color: #8e846b;
}

.hero-location {
  color: #b8ab88;
  font-size: 11px;
}

.stat-line,
.army-line {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  color: #998e73;
  font-size: 11px;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 6px;
}

.skill-tags span {
  padding: 1px 4px;
  color: #b8d0c1;
  border: 1px solid #435849;
  background: #1d2922;
  font-size: 9px;
}

.stat-line b {
  color: #c2b38e;
  font-weight: 400;
}

.army-line {
  padding-top: 6px;
  border-top: 1px dotted #554c38;
}

.army-line b {
  color: #d3bd80;
}

.map-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #171510;
}

.map-toolbar {
  height: 39px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 13px;
  color: #b3a785;
  border-bottom: 1px solid #5b513b;
  background: linear-gradient(#332e23, #221f18);
  font-size: 12px;
}

.map-board {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 48% 38%, rgba(154, 135, 85, 0.2), transparent 50%),
    #29251d;
}

.map-board::before {
  position: absolute;
  z-index: 1;
  inset: 0;
  content: "";
  pointer-events: none;
  border: 10px solid rgba(36, 31, 22, 0.45);
  box-shadow: inset 0 0 50px rgba(26, 19, 11, 0.75);
}

.map-shape {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: sepia(0.25);
}

.landmass {
  stroke: #584b31;
  stroke-width: 5;
}

.river {
  fill: none;
  stroke: #586c6e;
  stroke-width: 7;
  opacity: 0.63;
}

.river.thin {
  stroke-width: 4;
}

.route {
  stroke: #5a4f37;
  stroke-width: 3;
  stroke-dasharray: 8 6;
  opacity: 0.72;
}

.route.active {
  stroke: #f0d47b;
  stroke-width: 5;
  opacity: 0.96;
  animation: route-pulse 0.8s steps(2) infinite;
}

@keyframes route-pulse {
  50% { opacity: 0.42; }
}

.city-layer {
  position: absolute;
  z-index: 3;
  inset: 0;
}

.city-node {
  position: absolute;
  width: 61px;
  height: 48px;
  padding: 0;
  transform: translate(-50%, -50%);
  cursor: pointer;
  border: 0;
  background: transparent;
  text-align: center;
}

.city-node .flag {
  position: absolute;
  top: 0;
  left: 50%;
  width: 13px;
  height: 15px;
  transform: translateX(-50%);
  border: 1px solid #342c20;
  background: var(--faction-color);
  box-shadow: 2px 2px rgba(0, 0, 0, 0.33);
}

.city-node .flag::after {
  position: absolute;
  top: 11px;
  left: 5px;
  width: 2px;
  height: 11px;
  content: "";
  background: #3b3324;
}

.city-node .city-dot {
  position: absolute;
  top: 19px;
  left: 50%;
  width: 13px;
  height: 13px;
  transform: translateX(-50%) rotate(45deg);
  border: 2px solid #2c2519;
  background: #d4c18c;
  box-shadow: 1px 1px #0b0907;
}

.city-node .city-name {
  position: absolute;
  top: 33px;
  left: 50%;
  min-width: 50px;
  padding: 1px 4px;
  transform: translateX(-50%);
  color: #30281a;
  background: rgba(209, 191, 139, 0.83);
  box-shadow: 1px 1px rgba(26, 19, 12, 0.55);
  font-weight: 700;
  white-space: nowrap;
}

.city-node:hover .city-name,
.city-node.selected .city-name {
  color: #fff1ba;
  background: #493a24;
}

.city-node.selected .city-dot {
  outline: 3px solid rgba(255, 233, 157, 0.75);
  outline-offset: 2px;
}

.city-node.reachable .city-dot {
  background: #f8dd80;
  animation: node-pulse 0.8s steps(2) infinite;
}

.city-node.hostile .city-dot {
  background: #df7161;
}

.city-node.has-hero::after {
  position: absolute;
  top: 3px;
  right: 8px;
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  content: "将";
  color: #f0deb0;
  border: 1px solid #2c261c;
  border-radius: 50%;
  background: #2d2921;
  box-shadow: 1px 1px #000;
  font-size: 9px;
}

.city-node.protected::before {
  position: absolute;
  z-index: 2;
  top: 13px;
  left: 5px;
  width: 15px;
  height: 17px;
  display: grid;
  place-items: center;
  content: "盾";
  color: #e9e0bd;
  border: 1px solid #2d352f;
  border-radius: 7px 7px 5px 5px;
  background: #4f685e;
  box-shadow: 1px 1px #17140f;
  font-size: 8px;
}

.city-node.has-tavern .city-name::after {
  position: absolute;
  top: -8px;
  left: calc(100% - 2px);
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  content: "招";
  color: #fff0b4;
  border: 1px solid #4a3218;
  border-radius: 50%;
  background: #8a5423;
  box-shadow: 1px 1px #191008;
  font-size: 9px;
}

@keyframes node-pulse {
  50% { outline: 5px solid rgba(240, 211, 113, 0.38); }
}

.map-key {
  position: absolute;
  z-index: 4;
  right: auto;
  bottom: 14px;
  left: 14px;
  width: 132px;
  padding: 7px;
  color: #483e2b;
  border: 1px solid rgba(70, 57, 34, 0.7);
  background: rgba(190, 171, 119, 0.84);
  box-shadow: 2px 2px rgba(30, 23, 14, 0.45);
  font-size: 10px;
}

.key-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0;
}

.key-color {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border: 1px solid rgba(0, 0, 0, 0.45);
}

.city-detail {
  height: calc(100% - 39px);
  padding: 13px;
  overflow-y: auto;
}

.occupation-notice {
  margin-top: 9px;
  padding: 6px 8px;
  color: #c9d9c8;
  border: 1px solid #4f675b;
  background: #1d2923;
  font-size: 11px;
}

.empty-state {
  display: grid;
  place-content: center;
  color: #746c58;
  text-align: center;
  line-height: 1.8;
}

.empty-emblem {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 8px;
  border: 1px solid #554c38;
  border-radius: 50%;
  font-size: 28px;
}

.city-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid #514936;
}

.city-title h2 {
  margin: 0;
  color: #ead8a5;
  font-size: 24px;
  letter-spacing: 0.18em;
}

.owner-badge {
  padding: 3px 6px;
  color: #fff3c8;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: var(--faction-color);
  box-shadow: 1px 2px #0c0a08;
  font-size: 11px;
}

.detail-section {
  margin-top: 13px;
}

.detail-section h3 {
  margin: 0 0 7px;
  color: #9d9274;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid #4e4634;
}

.metric {
  padding: 7px;
  border-right: 1px solid #453e2f;
  border-bottom: 1px solid #453e2f;
  background: #29251d;
}

.metric:nth-child(2n) { border-right: 0; }
.metric:nth-last-child(-n + 2) { border-bottom: 0; }

.metric span {
  display: block;
  color: #89816d;
  font-size: 10px;
}

.metric strong {
  display: block;
  margin-top: 3px;
  color: #d8c690;
  font-size: 15px;
}

.troop-table {
  width: 100%;
  border-collapse: collapse;
  color: #bcb08f;
}

.troop-table td {
  padding: 5px 7px;
  border: 1px solid #4a4333;
  background: #29251d;
}

.troop-table td:last-child {
  color: #e0cf9b;
  text-align: right;
}

.troop-table small {
  margin-left: 4px;
  color: #7d8c7e;
  font-size: 9px;
}

.route-list {
  color: #b9ad8a;
  line-height: 1.65;
}

.route-list span {
  display: inline-block;
  margin: 0 4px 4px 0;
  padding: 2px 5px;
  border: 1px solid #514936;
  background: #29251d;
}

.action-box {
  margin-top: 14px;
  padding: 9px;
  border: 1px solid #5e5237;
  background: #191712;
}

.action-box h3 {
  margin-top: 0;
  color: #d7c48e;
}

.action-box h3:not(:first-child) {
  margin-top: 13px;
  padding-top: 9px;
  border-top: 1px solid #423b2c;
}

.action-box h3 small {
  float: right;
  color: #7e7662;
  font-size: 9px;
  font-weight: 400;
}

.legend-summary,
.legend-empty {
  margin-bottom: 7px;
  padding: 8px 9px;
  color: #bdb392;
  border: 1px solid #4e604f;
  background: linear-gradient(90deg, rgba(63, 117, 111, 0.18), rgba(28, 25, 19, 0.55));
}

.legend-summary b,
.legend-summary span {
  display: block;
}

.legend-summary b {
  margin-bottom: 3px;
  color: #9cd0c6;
}

.legend-button {
  color: #9f9a88;
  border-color: #4c5148;
  background: #26261f;
}

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

.building-card {
  min-width: 0;
  padding: 7px;
  cursor: pointer;
  text-align: left;
  color: #c9bc94;
  border: 1px solid #675e43;
  background: linear-gradient(135deg, #373126, #24211a);
}

.building-card:hover {
  color: #f0dfaa;
  border-color: #a18a58;
}

.building-card:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.building-card b,
.building-card span {
  display: block;
  overflow-wrap: anywhere;
}

.building-card b {
  margin-bottom: 3px;
}

.building-card em {
  color: #9b8d67;
  font-size: 9px;
  font-style: normal;
}

.building-card span {
  color: #8f8770;
  font-size: 9px;
  line-height: 1.45;
}

.recruit-grid {
  display: grid;
  gap: 6px;
}

.recruit-button,
.command-button {
  width: 100%;
  padding: 7px 8px;
  cursor: pointer;
  text-align: left;
  border: 1px solid #63583e;
  background: linear-gradient(#373126, #26221a);
}

.recruit-button:hover,
.command-button:hover {
  color: #ffefb8;
  border-color: #9b8554;
}

.recruit-button:disabled,
.command-button:disabled {
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: 0.42;
}

.recruit-button span {
  display: flex;
  justify-content: space-between;
}

.recruit-button em {
  color: #baa877;
  font-size: 10px;
  font-style: normal;
  font-weight: 400;
}

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

.candidate-button {
  width: 100%;
  padding: 7px;
  cursor: pointer;
  text-align: left;
  border: 1px solid #4d594d;
  background: linear-gradient(120deg, #29352c, #20241f);
}

.candidate-button:hover {
  border-color: #819277;
  background: #334137;
}

.candidate-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.8);
  opacity: 0.45;
}

.candidate-button b,
.candidate-button span,
.candidate-button small {
  display: block;
}

.candidate-button.featured {
  border-color: #947544;
  background: linear-gradient(120deg, #3c3927, #263127);
}

.candidate-button em {
  display: block;
  margin-top: 5px;
  color: #c28b75;
  font-size: 9px;
  font-style: normal;
}

.tavern-empty {
  padding: 8px;
  color: #817965;
  border: 1px dashed #4d4636;
  background: #1d1b16;
  font-size: 10px;
  line-height: 1.55;
}

.candidate-button b {
  color: #d6dbb1;
}

.candidate-button span {
  margin-top: 2px;
  color: #9eaa91;
  font-size: 10px;
}

.candidate-button small {
  margin-top: 4px;
  color: #82917f;
  font-size: 9px;
}

.recruit-button small,
.command-button small {
  display: block;
  margin-top: 3px;
  color: #8e846c;
}

.city-heroes {
  color: #b9ab87;
}

.city-heroes div {
  padding: 5px 0;
  border-bottom: 1px dotted #4e4635;
}

.bottom-bar {
  height: 136px;
  display: grid;
  grid-template-columns: 1fr 168px;
  gap: 9px;
  margin: 0 8px 8px;
  padding: 8px;
}

.dispatch-log {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #484130;
  background: #171510;
}

.dispatch-log .section-heading {
  padding: 5px 9px;
  border-bottom: 1px solid #40392b;
  background: #28241c;
}

#event-log {
  height: 77px;
  padding: 6px 9px;
  overflow-y: auto;
  color: #a99e81;
  font-size: 12px;
  line-height: 1.65;
}

.log-entry::before {
  margin-right: 7px;
  color: #6f6652;
  content: "◆";
  font-size: 8px;
}

.log-entry.important {
  color: #e1ca89;
}

.log-entry.danger {
  color: #df8978;
}

.end-turn-button {
  cursor: pointer;
  border: 1px solid #9b7742;
  background:
    linear-gradient(rgba(255, 255, 255, 0.05), transparent),
    #71352c;
  box-shadow: inset 0 0 0 3px #3f1c18, 2px 3px #080706;
}

.end-turn-button:hover {
  background-color: #914238;
}

.end-turn-button span,
.end-turn-button small {
  display: block;
}

.end-turn-button span {
  color: #f0ddb0;
  font-size: 19px;
  letter-spacing: 0.15em;
}

.end-turn-button small {
  margin-top: 6px;
  color: #c09a80;
  font-size: 11px;
}

.overlay {
  position: fixed;
  z-index: 90;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 30px;
  background: rgba(9, 8, 6, 0.84);
  backdrop-filter: blur(3px);
}

.overlay.active {
  display: flex;
}

.modal {
  position: relative;
  width: min(860px, 92vw);
  padding: 28px;
  border: 2px solid #8b7952;
  outline: 1px solid #211c13;
  outline-offset: -7px;
  background:
    linear-gradient(rgba(46, 39, 25, 0.97), rgba(24, 21, 16, 0.98)),
    #242018;
  box-shadow: 0 12px 55px #000, inset 0 0 55px rgba(0, 0, 0, 0.5);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.modal::before,
.modal::after {
  position: absolute;
  width: 14px;
  height: 14px;
  content: "";
  border: solid #b79a5d;
}

.modal::before {
  top: 11px;
  left: 11px;
  border-width: 2px 0 0 2px;
}

.modal::after {
  right: 11px;
  bottom: 11px;
  border-width: 0 2px 2px 0;
}

.modal-kicker {
  color: #9b8c6b;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.modal h2 {
  margin: 7px 0 8px;
  color: #ead7a2;
  font-size: 31px;
  letter-spacing: 0.16em;
}

.modal .lead {
  margin: 0;
  color: #bdb18f;
  line-height: 1.7;
}

.start-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 16px 0;
}

.start-rules span {
  padding: 4px 8px;
  color: #c9ba93;
  border: 1px solid #5e543e;
  background: #1a1813;
  font-size: 11px;
}

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

.faction-choice {
  display: grid;
  grid-template-columns: 12px 125px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  border: 1px solid #5b513b;
  background: #211e17;
}

.faction-choice:hover {
  border-color: #a9915a;
  background: #332d20;
}

.faction-choice i {
  width: 9px;
  height: 31px;
  background: var(--faction-color);
  box-shadow: 1px 1px #000;
}

.faction-choice strong {
  color: #dfcd98;
  font-size: 15px;
}

.faction-choice span {
  color: #8f866e;
  font-size: 11px;
  line-height: 1.5;
}

.continue-button,
.primary-button {
  min-width: 140px;
  margin-top: 15px;
  padding: 9px 18px;
  color: #e8d9ad;
}

.historical-note {
  margin: 16px 0 0;
  color: #726b59;
  font-size: 10px;
}

.dialog-modal {
  width: min(580px, 90vw);
}

.dialog-content {
  color: #bcb08f;
  line-height: 1.8;
}

.dialog-content ol {
  padding-left: 1.3em;
}

.dialog-content strong {
  color: #e3d09b;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 18px;
  padding-top: 13px;
  border-top: 1px solid #4c4331;
}

.dialog-actions .small-button,
.dialog-actions .primary-button {
  min-width: 0;
  min-height: 38px;
  max-width: 100%;
  flex: 1 1 180px;
  margin-top: 0;
  padding-right: 12px;
  padding-left: 12px;
  overflow-wrap: anywhere;
  text-align: center;
  white-space: normal;
}

.dialog-actions .primary-button {
  background: linear-gradient(#784036, #482620);
}

.battle-modal {
  width: min(880px, 94vw);
}

.battle-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.battle-summary div {
  padding: 9px;
  border: 1px solid #514936;
  background: #191712;
}

.battle-summary strong,
.battle-summary span {
  display: block;
}

.battle-summary strong {
  color: #d9c993;
}

.battle-summary span {
  margin-top: 4px;
  color: #998e72;
  font-size: 11px;
}

.battle-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.battle-options h3 {
  margin: 0 0 6px;
  color: #9e9272;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
}

.option-picker {
  display: grid;
  gap: 5px;
}

.option-button {
  min-height: 48px;
  padding: 7px 9px;
  cursor: pointer;
  text-align: left;
  border: 1px solid #514936;
  background: #211e17;
}

.option-button:hover,
.option-button.selected {
  border-color: #b09356;
  background: #3a3020;
}

.option-button.selected {
  box-shadow: inset 3px 0 #c5a556;
}

.option-button b,
.option-button span {
  display: block;
}

.option-button b {
  color: #ddcd9b;
  font-size: 12px;
}

.option-button span {
  margin-top: 3px;
  color: #8e846b;
  font-size: 10px;
  line-height: 1.45;
}

.battle-estimate {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 3px 12px;
  margin-top: 14px;
  padding: 10px;
  border: 1px solid #6e5b37;
  background: #191712;
}

.battle-estimate strong {
  grid-row: span 2;
  align-self: center;
  color: #e2c774;
  font-size: 16px;
}

.battle-estimate span {
  color: #c5b58c;
}

.battle-estimate small {
  color: #807764;
}

.battle-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.battle-actions .primary-button {
  margin-top: 0;
  background: linear-gradient(#773b31, #4f2923);
}

.hidden {
  display: none !important;
}

@media (max-height: 760px) {
  .topbar { height: 68px; }
  .game-layout { height: calc(100vh - 190px); min-height: 490px; }
  .bottom-bar { height: 114px; }
  #event-log { height: 56px; }
}

@media (min-width: 1500px) {
  .game-layout { grid-template-columns: 285px minmax(720px, 1fr) 300px; }
  body { font-size: 15px; }
}
