:root {
  --ink: #24362b;
  --muted: #6a765f;
  --panel: #fff7e6;
  --panel-2: #f7eed9;
  --edge: rgba(72, 98, 68, 0.22);
  --green: #2f7d56;
  --deep-green: #174d3f;
  --mint: #a9d6a1;
  --grass: #badd8f;
  --grass-dark: #82b866;
  --field: #d8c57c;
  --water: #75bdd3;
  --mountain: #9d9181;
  --brick: #c05a43;
  --roof: #e2af42;
  --blue: #236f94;
  --danger: #d95a4f;
  --gold: #f0c657;
  --shadow: 0 18px 40px rgba(46, 67, 43, 0.18);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(52, 102, 64, 0.055) 1px, transparent 1px),
    linear-gradient(0deg, rgba(52, 102, 64, 0.055) 1px, transparent 1px),
    linear-gradient(135deg, #dcefcf 0%, #c7ddb3 42%, #f2e4c2 100%);
  background-size: 28px 28px, 28px 28px, auto;
  font-family: "Gowun Dodum", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

button,
select {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid rgba(36, 54, 43, 0.18);
  border-radius: 8px;
  color: var(--ink);
  background: linear-gradient(180deg, #fffaf0, #efe2c9);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.85), 0 6px 0 rgba(88, 111, 72, 0.15);
  cursor: pointer;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(1px);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.85), 0 3px 0 rgba(88, 111, 72, 0.18);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.54;
  transform: none;
  filter: grayscale(0.35);
}

select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  color: var(--ink);
  background: #fffdf5;
  padding: 0 12px;
  font-weight: 800;
}

.game-shell {
  width: min(1880px, calc(100vw - 22px));
  height: 100vh;
  margin: 0 auto;
  padding: 10px 0;
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr);
  gap: 10px;
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(146px, 1fr)) auto 46px 46px 46px;
  gap: 10px;
  align-items: center;
  min-height: 0;
  margin-bottom: 0;
}

.hud-card,
.hud-controls,
.icon-button,
.world-panel,
.command-panel,
.advisor-bar {
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: rgba(255, 247, 230, 0.92);
  box-shadow: var(--shadow);
}

.hud-card {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.hud-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.hud-card strong {
  display: block;
  margin-top: 2px;
  color: #1c2a21;
  font-size: 22px;
  line-height: 1;
}

.hud-icon {
  position: relative;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #eac663;
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.6), 0 4px rgba(76, 94, 65, 0.12);
}

.hud-icon::before,
.hud-icon::after {
  content: "";
  position: absolute;
}

.hud-icon.coin::before {
  inset: 7px;
  border: 3px solid #9b6d1c;
  border-radius: 50%;
}

.hud-icon.ledger {
  background: #9fc7dd;
}

.hud-icon.ledger::before {
  left: 8px;
  top: 6px;
  width: 12px;
  height: 16px;
  border: 2px solid #37657c;
  border-radius: 2px;
}

.hud-icon.calendar {
  background: #efcfb2;
}

.hud-icon.calendar::before {
  left: 7px;
  top: 8px;
  width: 14px;
  height: 12px;
  border: 2px solid #9a6542;
  border-radius: 2px;
}

.hud-icon.star {
  background: #fff2a2;
}

.hud-icon.star::before {
  left: 8px;
  top: 6px;
  width: 12px;
  height: 12px;
  background: #c69222;
  clip-path: polygon(50% 0, 62% 35%, 100% 36%, 70% 58%, 82% 96%, 50% 73%, 18% 96%, 30% 58%, 0 36%, 38% 35%);
}

.reputation-card > div:last-child {
  width: 100%;
}

.reputation-track {
  height: 10px;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid rgba(36, 54, 43, 0.14);
  border-radius: 999px;
  background: #e8dec9;
}

.reputation-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e2c45d, #62a96d, #227d5c);
}

.hud-controls {
  min-height: 48px;
  display: grid;
  grid-template-columns: 42px repeat(3, 44px);
  gap: 6px;
  padding: 6px;
}

.icon-button,
.speed-button {
  min-height: 36px;
  padding: 0;
  font-size: 12px;
  font-weight: 1000;
}

.speed-button.active {
  color: #fff;
  background: linear-gradient(180deg, #2e8761, #176049);
}

.icon-button {
  position: relative;
  width: 46px;
  color: var(--deep-green);
}

.icon-button.save::before,
.icon-button.load::before,
.icon-button.reset::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 10px;
  width: 18px;
  height: 20px;
  border-radius: 3px;
  background: var(--deep-green);
}

.icon-button.save::after {
  content: "";
  position: absolute;
  left: 18px;
  top: 12px;
  width: 10px;
  height: 6px;
  background: #fff5d9;
}

.icon-button.load::before {
  border-radius: 50%;
  background: transparent;
  border: 4px solid var(--deep-green);
  border-top-color: transparent;
}

.icon-button.load::after {
  content: "";
  position: absolute;
  left: 16px;
  top: 9px;
  width: 10px;
  height: 10px;
  border-left: 4px solid var(--deep-green);
  border-bottom: 4px solid var(--deep-green);
  transform: rotate(-45deg);
}

.icon-button.reset::before {
  width: 20px;
  height: 20px;
  border: 4px solid var(--deep-green);
  border-left-color: transparent;
  background: transparent;
  border-radius: 50%;
}

.play-layout {
  display: grid;
  grid-template-columns: minmax(720px, 1fr) 330px;
  gap: 12px;
  min-height: 0;
}

.world-panel {
  position: relative;
  height: auto;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(242, 250, 230, 0.86), rgba(210, 230, 186, 0.92));
}

.map-ribbon {
  position: absolute;
  z-index: 10;
  left: 16px;
  top: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(47, 125, 86, 0.22);
  border-radius: 999px;
  background: rgba(255, 252, 239, 0.94);
  color: var(--deep-green);
  font-size: 13px;
  font-weight: 1000;
  box-shadow: 0 8px 20px rgba(36, 54, 43, 0.1);
}

.map-ribbon kbd {
  border: 0;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-size: 11px;
}

.route-mark {
  width: 18px;
  height: 12px;
  background: linear-gradient(90deg, #2f7d56 0 50%, #dfbf4f 50%);
  transform: rotate(45deg) skew(-10deg);
}

.world-viewport {
  position: absolute;
  inset: 0 0 68px 0;
  overflow: hidden;
}

.iso-world {
  position: relative;
  width: 980px;
  height: 620px;
  margin: 24px auto 0;
  transform: scale(1.08);
  transform-origin: 50% 18%;
}

.tile-layer,
.asset-layer,
.train-layer,
.rail-svg {
  position: absolute;
  inset: 0;
  width: 980px;
  height: 620px;
}

.asset-layer,
.train-layer {
  pointer-events: none;
}

.rail-svg {
  z-index: 3;
  pointer-events: none;
  overflow: visible;
}

.tile-layer {
  z-index: 1;
  pointer-events: auto;
}

.asset-layer {
  z-index: 4;
}

.train-layer {
  z-index: 5;
}

.iso-tile {
  position: absolute;
  width: 72px;
  height: 72px;
  min-height: 0;
  padding: 0;
  transform: translate(-50%, -50%) rotate(45deg) scaleY(0.58);
  border: 1px solid rgba(51, 92, 48, 0.14);
  border-radius: 8px;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.42);
  cursor: default;
}

.track-build-mode .iso-tile {
  cursor: crosshair;
}

.iso-tile.selected-tile {
  outline: 4px solid rgba(238, 200, 73, 0.72);
  outline-offset: 2px;
  z-index: 80 !important;
}

.iso-tile.track-tile {
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.42), 0 0 0 3px rgba(113, 87, 63, 0.18);
}

.terrain-grass {
  background: linear-gradient(135deg, #bae292, #96ce73);
}

.terrain-forest {
  background: linear-gradient(135deg, #a9d789, #78b761);
}

.terrain-field {
  background:
    repeating-linear-gradient(90deg, rgba(145, 117, 45, 0.16) 0 7px, transparent 7px 14px),
    linear-gradient(135deg, #ddcc86, #c8ba72);
}

.terrain-water {
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.22) 0 5px, transparent 5px 13px),
    linear-gradient(135deg, #82cbe1, #55a9c1);
}

.terrain-mountain {
  background: linear-gradient(135deg, #b9ab95, #867967);
}

.terrain-town {
  background: linear-gradient(135deg, #cde7a6, #abc879);
}

.rail-path {
  fill: none;
  stroke: #775c4a;
  stroke-width: 10;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 4px 2px rgba(52, 65, 43, 0.2));
}

.rail-ties {
  fill: none;
  stroke: #f4e7c8;
  stroke-width: 3;
  stroke-dasharray: 3 12;
  stroke-linecap: round;
}

.rail-double {
  stroke-width: 14;
  stroke: #85674f;
}

.rail-planned {
  fill: none;
  stroke: rgba(217, 90, 79, 0.78);
  stroke-width: 8;
  stroke-dasharray: 12 10;
  stroke-linecap: round;
}

.rail-planned-marker {
  fill: rgba(239, 201, 84, 0.76);
  stroke: rgba(48, 87, 62, 0.45);
  stroke-width: 3;
}

.tree,
.mountain,
.city-node,
.train-unit {
  position: absolute;
}

.tree {
  width: 0;
  height: 0;
  transform: translate(-50%, -100%);
}

.tree::before {
  content: "";
  position: absolute;
  left: -11px;
  top: -26px;
  width: 22px;
  height: 28px;
  background: linear-gradient(180deg, #2f8b58, #1e6846);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  filter: drop-shadow(0 4px 1px rgba(46, 67, 43, 0.18));
}

.tree::after {
  content: "";
  position: absolute;
  left: -3px;
  top: -4px;
  width: 6px;
  height: 10px;
  border-radius: 2px;
  background: #7d5735;
}

.tree.small::before {
  left: -8px;
  top: -20px;
  width: 16px;
  height: 22px;
}

.mountain {
  width: 54px;
  height: 52px;
  transform: translate(-50%, -82%);
  background: linear-gradient(135deg, #8f8575, #5f5a50);
  clip-path: polygon(50% 4%, 98% 94%, 2% 94%);
  filter: drop-shadow(0 8px 2px rgba(46, 67, 43, 0.18));
}

.mountain::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 8px;
  width: 18px;
  height: 16px;
  background: #f5ecd8;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.city-node {
  width: 132px;
  height: 104px;
  border: 0;
  background: transparent;
  box-shadow: none;
  transform: translate(-50%, -78%);
  pointer-events: auto;
  padding: 0;
}

.city-node:hover {
  transform: translate(-50%, -80%);
}

.city-node:focus-visible {
  outline: 3px solid #f2cc54;
}

.city-shadow {
  position: absolute;
  left: 36px;
  top: 61px;
  width: 60px;
  height: 22px;
  border-radius: 50%;
  background: rgba(51, 75, 45, 0.18);
  transform: rotate(-8deg);
}

.building {
  position: absolute;
  left: 43px;
  top: 28px;
  width: 44px;
  height: 36px;
  border: 2px solid rgba(67, 65, 51, 0.3);
  border-radius: 5px;
  background: linear-gradient(180deg, #f5d58a, #cf8752);
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.35);
}

.building::before {
  content: "";
  position: absolute;
  left: -6px;
  top: -16px;
  width: 54px;
  height: 24px;
  background: linear-gradient(135deg, #d75343, #8f2f2d);
  clip-path: polygon(50% 0, 100% 72%, 88% 100%, 12% 100%, 0 72%);
}

.building::after {
  content: "";
  position: absolute;
  left: 14px;
  bottom: 0;
  width: 13px;
  height: 18px;
  border-radius: 3px 3px 0 0;
  background: #4c3c31;
}

.city-node.harbor .building {
  background: linear-gradient(180deg, #e8cb80, #b77845);
}

.city-node.harbor .building::before {
  background: linear-gradient(135deg, #2b82a4, #1f5a75);
}

.city-node.industry .building {
  background: linear-gradient(180deg, #d7d2c5, #91897d);
}

.city-node.industry .building::before {
  background: linear-gradient(135deg, #c45a3e, #6f3c32);
}

.city-node.capital .building {
  width: 52px;
  left: 39px;
  background: linear-gradient(180deg, #f7d77e, #c96a45);
}

.station-flag {
  position: absolute;
  left: 73px;
  top: 14px;
  width: 14px;
  height: 28px;
  border-left: 3px solid #5c4b3a;
}

.station-flag::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 20px;
  height: 12px;
  border-radius: 2px;
  background: #f1cf54;
  box-shadow: 0 2px rgba(77, 65, 48, 0.18);
}

.city-label {
  position: absolute;
  left: var(--label-x, 50%);
  top: var(--label-y, 82px);
  min-width: 78px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(36, 54, 43, 0.15);
  border-radius: 999px;
  padding: 5px 8px 6px;
  color: #25372d;
  background: rgba(255, 252, 237, 0.96);
  box-shadow: 0 8px 18px rgba(46, 67, 43, 0.13);
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
}

.city-label strong {
  display: block;
  font-size: 12px;
  line-height: 1;
}

.city-label span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1;
}

.station-level {
  position: absolute;
  left: 73px;
  top: 55px;
  min-width: 20px;
  height: 18px;
  border: 2px solid rgba(44, 70, 52, 0.18);
  border-radius: 999px;
  color: #174d3f;
  background: #fff3a6;
  font-size: 10px;
  font-weight: 1000;
  line-height: 14px;
  text-align: center;
  box-shadow: 0 4px 8px rgba(45, 62, 42, 0.13);
}

.city-node.selected .city-label {
  border-color: #e34f45;
  box-shadow: 0 0 0 4px rgba(227, 79, 69, 0.22), 0 8px 18px rgba(46, 67, 43, 0.13);
}

.city-node.target .city-label {
  border-color: #287fa2;
  box-shadow: 0 0 0 4px rgba(40, 127, 162, 0.2), 0 8px 18px rgba(46, 67, 43, 0.13);
}

.train-unit {
  width: 52px;
  height: 16px;
  display: flex;
  align-items: center;
  gap: 3px;
  filter: drop-shadow(0 5px 0 rgba(47, 69, 44, 0.16)) drop-shadow(0 0 3px rgba(255, 250, 231, 0.9));
  transform-origin: center;
}

.train-engine,
.train-car {
  height: 14px;
  border: 2px solid rgba(35, 46, 36, 0.42);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.38);
}

.train-engine {
  position: relative;
  width: 21px;
  border-radius: 5px 9px 9px 5px;
  background: linear-gradient(90deg, #1e4d68 0 34%, #2b7ba0 34% 72%, #f1c650 72%);
}

.train-engine::before {
  content: "";
  position: absolute;
  left: 5px;
  top: -7px;
  width: 6px;
  height: 6px;
  border-radius: 2px 2px 0 0;
  background: #263936;
}

.train-car {
  width: 13px;
  border-radius: 4px;
  background: linear-gradient(180deg, #eac255, #bd8b35);
}

.train-car:nth-child(3) {
  background: linear-gradient(180deg, #d85f4e, #a84439);
}

.advisor-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 10px;
  min-height: 52px;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
}

.station-master {
  position: relative;
  width: 42px;
  height: 42px;
  border: 2px solid rgba(91, 65, 39, 0.2);
  border-radius: 50%;
  background: #b98045;
}

.station-master::before,
.station-master::after,
.station-master span::before,
.station-master span::after {
  content: "";
  position: absolute;
}

.station-master::before {
  left: 9px;
  top: 14px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3c2a1a;
  box-shadow: 16px 0 #3c2a1a;
}

.station-master::after {
  left: 12px;
  top: 25px;
  width: 16px;
  height: 6px;
  border-radius: 0 0 999px 999px;
  background: #624020;
}

.station-master span::before {
  left: 4px;
  top: -2px;
  width: 34px;
  height: 14px;
  border-radius: 12px 12px 4px 4px;
  background: #caa45d;
}

.advisor-bar strong {
  display: block;
  font-size: 12px;
}

.advisor-bar p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.advisor-bar b {
  justify-self: end;
  border-radius: 999px;
  padding: 6px 10px;
  background: #f4e6cf;
  color: #8a6840;
  font-size: 12px;
}

.command-panel {
  position: relative;
  height: auto;
  min-height: 0;
  overflow: auto;
  padding: 10px;
  background: linear-gradient(180deg, #1e6c56, #185643 178px, #f7eedc 178px);
}

.panel-toggle {
  display: none;
}

.brand {
  min-height: 78px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  color: #f8ffe9;
  padding: 7px 4px 0;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1;
}

.brand p {
  margin: 4px 0 0;
  color: rgba(248, 255, 233, 0.72);
  font-size: 10px;
  font-weight: 1000;
}

#networkBadge {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 5px 8px;
  background: rgba(0, 0, 0, 0.12);
  font-size: 11px;
  font-weight: 1000;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0 0 10px;
}

.tab {
  min-height: 38px;
  color: rgba(255, 255, 255, 0.74);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
  border-color: rgba(255, 255, 255, 0.12);
  font-weight: 1000;
}

.tab.active {
  color: #24362b;
  background: linear-gradient(180deg, #ffe57e, #f0bd48);
}

.command-section,
.log-panel {
  border: 1px solid rgba(92, 82, 62, 0.16);
  border-radius: 8px;
  background: rgba(255, 251, 239, 0.96);
  box-shadow: 0 8px 20px rgba(67, 77, 51, 0.08);
}

.command-section {
  display: none;
  padding: 10px;
}

.command-section.active {
  display: block;
}

.primary-action {
  width: 100%;
  min-height: 46px;
  margin-bottom: 10px;
  color: #fff7e1;
  background: linear-gradient(180deg, #e96e5e, #c9473e);
  box-shadow: inset 0 2px rgba(255, 255, 255, 0.28), 0 6px 0 rgba(119, 51, 43, 0.18);
  font-weight: 1000;
}

.city-panel {
  display: grid;
  gap: 8px;
  min-height: 116px;
  margin-bottom: 10px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  padding: 10px;
  background: #fff6e4;
}

.city-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
  font-weight: 1000;
}

.city-title small {
  color: var(--green);
  font-weight: 1000;
}

.city-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag {
  border-radius: 999px;
  padding: 4px 8px;
  color: #fffdf4;
  background: var(--green);
  font-size: 11px;
  font-weight: 1000;
}

.tag.demand {
  background: var(--blue);
}

.field {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 1000;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-grid button,
.danger-action {
  font-weight: 1000;
}

.danger-action {
  width: 100%;
  margin-top: 10px;
  color: #fff7e1;
  background: linear-gradient(180deg, #d75a4e, #9f332f);
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.panel-title h2 {
  margin: 0;
  font-size: 15px;
}

.panel-title span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 1000;
}

.train-list,
.ledger-list,
.check-list,
.log-list,
.route-list,
.contract-list,
.research-list {
  display: grid;
  gap: 7px;
}

.train-card,
.route-card,
.contract-card,
.research-card,
.ledger-row,
.check-item,
.log-line,
.objective-card {
  border: 1px solid rgba(92, 82, 62, 0.14);
  border-radius: 8px;
  background: #fff8e9;
}

.train-card {
  padding: 9px;
}

.route-card,
.contract-card,
.research-card {
  padding: 9px;
}

.train-card strong,
.train-card small,
.route-card strong,
.route-card small,
.contract-card strong,
.contract-card small,
.research-card strong,
.research-card small {
  display: block;
}

.train-card small,
.route-card small,
.contract-card small,
.research-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.route-actions,
.research-actions {
  display: grid;
  grid-template-columns: 1fr;
  margin-top: 8px;
}

.route-actions button,
.research-actions button {
  min-height: 32px;
  font-size: 12px;
  font-weight: 1000;
}

.train-profit {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-weight: 1000;
}

.meter {
  height: 8px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6dcc7;
}

.meter i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #50a66f, #efc65c, #df5b4f);
}

.ledger-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  font-size: 13px;
}

.finance-subtitle {
  margin-top: 12px;
}

.ledger-row span {
  color: var(--muted);
  font-weight: 900;
}

.positive {
  color: #1c7a52;
}

.negative {
  color: #d6493f;
}

.objective-card {
  padding: 11px;
  margin-bottom: 10px;
}

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

.goal-head span {
  border-radius: 999px;
  padding: 4px 7px;
  background: #fae4ad;
  color: #856130;
  font-size: 11px;
  font-weight: 1000;
}

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

.goal-row {
  display: grid;
  gap: 5px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 1000;
}

.goal-row i {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5dbc5;
}

.goal-row b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #77bd74, #2d865e);
}

.check-item {
  position: relative;
  min-height: 34px;
  padding: 9px 10px 9px 34px;
  font-size: 12px;
  font-weight: 1000;
}

.check-item::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 9px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #dacfb8;
}

.check-item.done::before {
  background: #4b9d67;
}

.check-item.done::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 12px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.log-panel {
  margin-top: 10px;
  padding: 10px;
}

.log-list {
  max-height: 192px;
  overflow: auto;
  padding-right: 2px;
}

.log-line {
  padding: 8px 9px;
  color: #584d3b;
  font-size: 12px;
  line-height: 1.35;
}

.empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1220px) {
  .hud {
    grid-template-columns: repeat(2, minmax(140px, 1fr)) auto 46px 46px 46px;
  }

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

  .world-panel,
  .command-panel {
    min-height: auto;
    height: auto;
  }

  .world-panel {
    height: 690px;
  }

  .command-panel {
    background: linear-gradient(180deg, #1e6c56, #185643 168px, #f7eedc 168px);
  }
}

@media (max-width: 680px) {
  body {
    overflow: hidden;
  }

  .game-shell {
    width: 100vw;
    padding: 8px 6px;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .hud {
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
  }

  .hud-card {
    grid-column: span 3;
    min-height: 62px;
    padding: 8px;
  }

  .hud-card strong {
    font-size: 20px;
  }

  .hud-controls {
    grid-column: 1 / -1;
    min-height: 42px;
    grid-template-columns: 42px repeat(3, 1fr);
  }

  .icon-button.save,
  .icon-button.load,
  .icon-button.reset {
    width: 100%;
  }

  .icon-button.save {
    grid-column: 1 / 3;
  }

  .icon-button.load {
    grid-column: 3 / 5;
  }

  .icon-button.reset {
    grid-column: 5 / 7;
  }

  .icon-button.save::before {
    left: calc(50% - 9px);
  }

  .icon-button.save::after {
    left: calc(50% - 5px);
  }

  .icon-button.load::before {
    left: calc(50% - 9px);
  }

  .icon-button.load::after {
    left: calc(50% - 7px);
  }

  .icon-button.reset::before {
    left: calc(50% - 10px);
  }

  .play-layout {
    display: block;
    min-height: 0;
  }

  .world-panel {
    height: 100%;
    min-height: 0;
    border-radius: 8px;
  }

  .world-viewport {
    inset: 0 0 76px 0;
    overflow: auto;
    overscroll-behavior: contain;
  }

  .iso-world {
    width: 920px;
    height: 620px;
    margin: 18px 18px 0;
    transform: scale(0.95);
    transform-origin: 0 10%;
  }

  .advisor-bar {
    left: 8px;
    right: 8px;
    bottom: 8px;
    grid-template-columns: 42px 1fr;
    max-height: 68px;
    overflow: hidden;
  }

  .city-label {
    min-width: 64px;
    padding: 4px 7px 5px;
  }

  .city-label strong {
    font-size: 11px;
  }

  .city-label span {
    font-size: 9px;
  }

  .advisor-bar b {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .map-ribbon {
    left: 14px;
    right: 12px;
    align-items: flex-start;
    border-radius: 8px;
    font-size: 12px;
  }

  .command-panel {
    position: fixed;
    z-index: 50;
    left: 8px;
    right: 8px;
    bottom: 8px;
    height: min(62dvh, 520px);
    min-height: 0;
    border-radius: 14px;
    overflow: auto;
    padding: 34px 10px 10px;
    transition: height 180ms ease;
    box-shadow: 0 -12px 36px rgba(35, 54, 43, 0.26);
  }

  .command-panel.collapsed {
    height: 122px;
    overflow: hidden;
  }

  .panel-toggle {
    position: absolute;
    display: block;
    left: 50%;
    top: 6px;
    width: 132px;
    min-height: 24px;
    transform: translateX(-50%);
    border-radius: 999px;
    color: #fff8df;
    background: rgba(12, 57, 45, 0.42);
    box-shadow: none;
    font-size: 12px;
    font-weight: 1000;
  }

  .brand {
    min-height: 58px;
    padding-top: 0;
  }

  .brand h1 {
    font-size: 20px;
  }

  .brand p {
    font-size: 9px;
  }

  .tabs {
    gap: 5px;
    margin-bottom: 8px;
  }

  .tab {
    min-height: 34px;
  }

  .command-panel.collapsed .command-section,
  .command-panel.collapsed .log-panel {
    display: none;
  }

  .action-grid {
    grid-template-columns: 1fr;
  }
}
