:root {
  --bg: #0c0b0a;
  --bg-soft: #161412;
  --paper: #f2eadb;
  --paper-dim: rgba(242, 234, 219, 0.62);
  --gold: #c4a574;
  --gold-deep: #8d6b3e;
  --line: rgba(242, 234, 219, 0.14);
  --fill: #221e1a;
  --fill-hot: #322c26;
  --serif: "Palatino Linotype", "Songti SC", "STSong", "Microsoft YaHei", serif;
  --sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 2px;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 8;
  opacity: 0.035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.app {
  display: flex;
  min-height: 100%;
}

.stage {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 100vh;
}

.map-frame {
  position: absolute;
  inset: 0;
}

#map {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
  background: var(--bg);
}

#map.is-drag { cursor: grabbing; }

.ocean { fill: transparent; }

.city {
  fill: var(--fill);
  stroke: rgba(242, 234, 219, 0.34);
  stroke-width: 1px;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
}

.city.hot { fill: var(--fill-hot); stroke: var(--paper); }
.city.on { fill: var(--gold); stroke: #f6efe2; }
.city.on.hot { fill: #d7bc90; }
.city.hit { stroke: var(--paper); stroke-width: 2px; }
.city.flash { animation: flash 0.7s ease; }

.nine {
  fill: none;
  stroke: rgba(242, 234, 219, 0.7);
  stroke-width: 1.4px;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

body.dim-unvisited .city:not(.on) {
  fill: #12100e;
  stroke: rgba(242, 234, 219, 0.1);
}
body.dim-unvisited .city.hot:not(.on) {
  fill: #2a241e;
  stroke: var(--paper);
}

@keyframes flash {
  0%, 100% { stroke-width: 1px; }
  40% { stroke: #fff8ec; stroke-width: 3px; }
}

.caption {
  position: absolute;
  left: 28px;
  bottom: 24px;
  margin: 0;
  pointer-events: none;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.7);
}
.caption strong {
  display: block;
  font-family: var(--serif);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.caption span {
  display: block;
  margin-top: 4px;
  color: var(--paper-dim);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.zoom-tools {
  position: absolute;
  top: 22px;
  right: 22px;
  display: flex;
  gap: 8px;
}
.zoom-tools button,
.actions button,
.chip,
.prov-all,
.prov-name {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--paper-dim);
  letter-spacing: 0.04em;
}
.zoom-tools button:hover,
.actions button:hover,
.chip:hover,
.prov-all:hover,
.prov-name:hover { color: var(--paper); border-color: rgba(242, 234, 219, 0.4); }
.chip.is-active {
  color: var(--bg);
  background: var(--gold);
  border-color: var(--gold);
}

.panel {
  width: 360px;
  flex: none;
  max-height: 100vh;
  overflow: auto;
  padding: 28px 24px 40px;
  background: #100e0c;
  border-left: 1px solid var(--line);
  position: relative;
  z-index: 2;
}

.kicker {
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.22em;
  font-size: 12px;
}
h1 {
  margin: 8px 0 0;
  font-family: var(--serif);
  font-size: 48px;
  font-weight: 500;
  letter-spacing: 0.12em;
}
.lead {
  margin: 12px 0 0;
  color: var(--paper-dim);
  line-height: 1.6;
  font-size: 14px;
}

.stats {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 26px 0 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.stats b {
  font-family: var(--serif);
  font-size: 42px;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.04em;
}
.stats span { color: var(--paper-dim); font-size: 13px; line-height: 1.5; }

.search { display: block; margin-bottom: 14px; }
.search span {
  display: block;
  margin-bottom: 6px;
  color: var(--paper-dim);
  font-size: 12px;
  letter-spacing: 0.12em;
}
.search input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  border-radius: 0;
}
.search input::placeholder { color: rgba(242, 234, 219, 0.35); }

.filters { display: flex; gap: 8px; margin-bottom: 14px; }
.dim {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--paper-dim);
  font-size: 13px;
}
.dim input { accent-color: var(--gold); }

.actions { display: flex; gap: 8px; }
.status {
  min-height: 1.2em;
  margin: 8px 0 0;
  color: var(--gold);
  font-size: 12px;
}

.inset-block {
  margin: 18px 0 8px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.inset-label {
  display: flex;
  justify-content: space-between;
  color: var(--paper-dim);
  font-size: 12px;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
#inset {
  width: 100%;
  height: 230px;
  display: block;
  background: #0c0b0a;
  border: 1px solid var(--line);
  cursor: pointer;
}

.list { margin-top: 8px; }
.prov { margin-top: 16px; }
.prov-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.prov-name {
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--paper);
}
.prov-count {
  color: var(--paper-dim);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.prov-all { margin-left: auto; padding: 4px 10px; font-size: 12px; }
.city-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(242, 234, 219, 0.08);
  padding: 8px 2px;
  color: var(--paper-dim);
}
.city-row i {
  width: 8px;
  height: 8px;
  border: 1px solid rgba(242, 234, 219, 0.4);
  flex: none;
}
.city-row.is-on { color: var(--paper); }
.city-row.is-on i { background: var(--gold); border-color: var(--gold); }
.city-row em {
  margin-left: auto;
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(242, 234, 219, 0.4);
}
.city-row.is-hot { color: var(--gold); }
.empty {
  color: var(--paper-dim);
  font-size: 13px;
  line-height: 1.6;
}

.note {
  margin: 22px 0 0;
  color: rgba(242, 234, 219, 0.4);
  font-size: 12px;
  line-height: 1.7;
}

@media (max-width: 860px) {
  .app { flex-direction: column; }
  .stage { min-height: 70vh; height: 70vh; }
  .panel { width: 100%; max-height: none; border-left: 0; border-top: 1px solid var(--line); }
  .caption strong { font-size: 24px; }
  h1 { font-size: 40px; }
}
