:root {
  --paper: #efe5cf;
  --ink: #1c1a16;
  --north: #294c7a;
  --south: #8b2f2f;
  --accent: #8a6a2f;
  --forest: #44623f;
  --river: #79b9d9;
  --hill: #9f8d70;
  --village: #ba8f64;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Libre Baskerville", Georgia, serif;
  background:
    radial-gradient(1200px 650px at 10% 0%, #f5efe3 0%, transparent 70%),
    radial-gradient(900px 620px at 95% 95%, #ded1b4 0%, transparent 75%),
    linear-gradient(165deg, #e8dcc2 0%, #d1bf9f 100%);
  min-height: 100vh;
}

.hero {
  text-align: center;
  padding: 1.75rem 1rem 1rem;
}

.hero h1 {
  margin: 0;
  font-family: "Cinzel", serif;
  font-size: clamp(1.9rem, 2.4vw, 2.8rem);
  letter-spacing: 0.05em;
}

.hero p {
  margin: 0.75rem auto 0;
  max-width: 65ch;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.9fr);
  gap: 1rem;
  padding: 0 1rem 1rem;
}

.board-panel,
.card {
  background: color-mix(in srgb, var(--paper) 84%, white 16%);
  border: 1px solid #7d6948;
  box-shadow: 0 10px 26px rgba(44, 30, 8, 0.16);
}

.board-panel {
  border-radius: 16px;
  padding: 0.8rem;
}

.board-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.board-head h2,
.card h3,
.card h4 {
  margin: 0;
  font-family: "Cinzel", serif;
}

.badge {
  border: 1px solid #775c2c;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font-size: 0.9rem;
  background: #efe1c4;
}

.map-status {
  margin: 0.15rem 0 0.6rem;
  font-size: 0.88rem;
  color: #5f4e30;
}

#board {
  width: 100%;
  height: auto;
  border-radius: 12px;
  background:
    radial-gradient(circle at 24% 32%, #d9cfaf 0%, #d9cfaf 20%, transparent 45%),
    radial-gradient(circle at 80% 27%, #d2c4a2 0%, #d2c4a2 18%, transparent 44%),
    linear-gradient(#e7dcc3, #ddccab);
}

.hud {
  display: grid;
  gap: 0.8rem;
}

.card {
  border-radius: 12px;
  padding: 0.8rem;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.btn {
  width: 100%;
  margin-top: 0.45rem;
  padding: 0.48rem 0.6rem;
  border: 1px solid #73551f;
  border-radius: 8px;
  background: #f0e1c2;
  font-family: inherit;
  cursor: pointer;
}

.btn.primary {
  background: #ceb174;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-bottom: 0.45rem;
}

.unit-library {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.unit-card {
  border: 1px solid #7d6948;
  border-radius: 10px;
  background: #f2e4c4;
  padding: 0.55rem;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}

.unit-card:active {
  cursor: grabbing;
}

.unit-card.empty {
  opacity: 0.45;
  cursor: not-allowed;
}

.unit-name {
  margin: 0;
  font-family: "Cinzel", serif;
  font-size: 0.95rem;
}

.unit-meta {
  margin: 0.15rem 0 0;
  font-size: 0.8rem;
}

.log-card {
  min-height: 230px;
}

#logList {
  margin: 0.5rem 0 0;
  padding-left: 1.1rem;
  max-height: 150px;
  overflow: auto;
}

.site-footer {
  text-align: center;
  padding: 0.2rem 1rem 1rem;
  opacity: 0.9;
}

.hex {
  stroke: #5d4d31;
  stroke-width: 1.2;
}

.terrain-hex {
  stroke: none;
}

.terrain-wilderness {
  fill: rgba(236, 225, 198, 0.08);
}

.terrain-outpost,
.terrain-village,
.terrain-glade,
.terrain-farmland {
  fill: rgba(245, 237, 222, 0.07);
}

.terrain-forest {
  fill: rgba(79, 113, 66, 0.11);
}

.terrain-hills {
  fill: rgba(128, 111, 81, 0.12);
}

.terrain-river {
  fill: rgba(86, 159, 204, 0.3);
}

.terrain-bridge {
  fill: rgba(162, 116, 62, 0.34);
}

.grid-hex {
  fill: rgba(0, 0, 0, 0.001);
  stroke: rgba(80, 56, 24, 0.45);
  stroke-width: 0.75;
}

.highlight-selected {
  fill: rgba(243, 209, 130, 0.26);
  stroke: rgba(220, 164, 43, 0.95);
  stroke-width: 2;
}

.highlight-target {
  fill: rgba(187, 40, 53, 0.09);
  stroke: rgba(190, 40, 53, 0.72);
  stroke-width: 1;
}

.district-label {
  font-family: "Cinzel", serif;
  font-size: 10px;
  font-weight: 700;
  fill: rgba(40, 28, 14, 0.88);
  paint-order: stroke;
  stroke: rgba(247, 239, 224, 0.66);
  stroke-width: 1;
}

.landmark-label {
  font-family: "Cinzel", serif;
  font-size: 9px;
  fill: rgba(28, 22, 14, 0.84);
  paint-order: stroke;
  stroke: rgba(246, 236, 220, 0.7);
  stroke-width: 1;
}

.bridge-label {
  font-size: 8px;
}

#board.map-mode .hex {
  fill: rgba(242, 234, 216, 0.06);
  stroke: rgba(80, 56, 24, 0.48);
}

.hex.farmland {
  fill: #dbc68e;
}

.hex.outpost {
  fill: #b4b9a0;
}

.hex.village {
  fill: #d6af87;
}

.hex.river {
  fill: var(--river);
}

.hex.forest {
  fill: #96b090;
}

.hex.bridge {
  fill: #a68456;
}

#board.map-mode .hex.river {
  fill: rgba(88, 168, 207, 0.26);
}

#board.map-mode .hex.bridge {
  fill: rgba(160, 117, 63, 0.32);
}

#board.map-mode .hex.forest,
#board.map-mode .hex.village,
#board.map-mode .hex.outpost,
#board.map-mode .hex.farmland {
  fill: rgba(245, 236, 221, 0.05);
}

.hex.selected {
  stroke: #f3d182;
  stroke-width: 3;
}

.hex.target {
  stroke: #be2835;
  stroke-width: 3;
}

.unit {
  font-family: "Cinzel", serif;
  font-size: 14px;
  font-weight: 700;
  paint-order: stroke;
  stroke: #191510;
  stroke-width: 0.8;
}

.unit.north {
  fill: #9fc6f0;
}

.unit.south {
  fill: #f2adad;
}

.order-mark {
  font-size: 11px;
  font-weight: 700;
  fill: #201a14;
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }
}