:root {
  --bg: #f1e8d5;
  --bg-deep: #1a2319;
  --panel: rgba(255, 248, 233, 0.86);
  --ink: #1f1c17;
  --muted: #655a4c;
  --line: rgba(50, 39, 23, 0.14);
  --accent: #a53d2d;
  --forest: #486438;
  --safe: #3f7b53;
  --danger: #b24a37;
  --warning: #cb8f1a;
  --shadow: 0 18px 42px rgba(30, 24, 15, 0.18);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 225, 163, 0.25), transparent 22%),
    radial-gradient(circle at 82% 8%, rgba(122, 159, 98, 0.16), transparent 24%),
    linear-gradient(160deg, #122017 0%, #26392a 44%, #6f775a 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Bahnschrift", "Trebuchet MS", Verdana, sans-serif;
  line-height: 1.45;
  background:
    linear-gradient(rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.02)),
    radial-gradient(circle at 50% 0%, rgba(255, 245, 207, 0.15), transparent 26%);
}

code {
  padding: 0.14rem 0.38rem;
  border-radius: 999px;
  background: rgba(55, 45, 27, 0.08);
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.92em;
}

.shell {
  width: min(1460px, calc(100vw - 28px));
  margin: 20px auto 28px;
}

.hero,
.panel,
.metric-card {
  backdrop-filter: blur(16px);
}

.hero {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 22px;
  padding: 28px 30px;
  border: 1px solid rgba(255, 243, 222, 0.2);
  border-radius: calc(var(--radius) + 4px);
  color: #f9f3e8;
  background:
    linear-gradient(135deg, rgba(24, 31, 24, 0.82), rgba(53, 70, 53, 0.62)),
    radial-gradient(circle at top right, rgba(202, 144, 89, 0.24), transparent 26%);
  box-shadow: var(--shadow);
}

.eyebrow,
.panel-kicker,
.metric-label {
  margin: 0 0 8px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: rgba(255, 241, 219, 0.72);
}

.hero h1,
.panel h2,
.metric-value {
  margin: 0;
  font-family: "Georgia", "Palatino Linotype", "Book Antiqua", serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero h1 {
  max-width: 10ch;
  font-size: clamp(2.2rem, 4vw, 3.6rem);
  line-height: 0.95;
}

.hero-text {
  max-width: 68ch;
  margin: 14px 0 0;
  color: rgba(255, 241, 219, 0.86);
  font-size: 1rem;
}

.hero-actions {
  display: grid;
  gap: 12px;
  align-content: start;
  justify-items: stretch;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 18px 0;
}

.metric-card,
.panel {
  border: 1px solid rgba(255, 252, 245, 0.35);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 18px 20px;
}

.metric-label {
  color: rgba(41, 31, 19, 0.62);
}

.metric-value {
  display: block;
  font-size: 1.7rem;
}

.metric-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.workspace {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 18px;
}

.panel {
  padding: 22px;
}

.panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.panel-kicker {
  color: rgba(56, 43, 28, 0.56);
}

.panel-inline {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.36rem 0.72rem;
  border-radius: 999px;
  background: rgba(65, 83, 46, 0.1);
  color: #384827;
  font-size: 0.84rem;
  font-weight: 700;
}

.badge.muted {
  background: rgba(51, 39, 23, 0.08);
  color: var(--muted);
}

.controls-panel {
  grid-column: 2;
}

.combat-panel,
.city-panel,
.actor-panel,
.conflict-panel,
.economy-panel,
.log-panel,
.docs-panel {
  grid-column: 1 / span 2;
}

.scene-frame {
  position: relative;
  min-height: 420px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(52, 40, 25, 0.12);
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 236, 177, 0.22), transparent 24%),
    linear-gradient(180deg, rgba(201, 219, 230, 0.35), rgba(226, 212, 182, 0.18));
}

.scene-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 28%),
    radial-gradient(circle at 50% 120%, rgba(29, 20, 12, 0.28), transparent 46%);
  pointer-events: none;
}

#scene-stage {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 7;
}

.scene-caption {
  padding: 12px 14px 14px;
  color: rgba(37, 29, 18, 0.92);
  font-size: 0.96rem;
  line-height: 1.45;
  background: linear-gradient(180deg, rgba(255, 250, 242, 0.28), rgba(255, 248, 235, 0.74));
  border-top: 1px solid rgba(69, 53, 32, 0.08);
}

.panel-header.compact {
  margin-top: 18px;
  margin-bottom: 12px;
}

.panel-header.compact h2 {
  font-size: 1.1rem;
}

.stage-panel .map-frame {
  min-height: 280px;
}

.map-frame {
  min-height: 560px;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(52, 40, 25, 0.12);
  background:
    radial-gradient(circle at 18% 22%, rgba(124, 165, 82, 0.22), transparent 26%),
    radial-gradient(circle at 72% 18%, rgba(78, 98, 74, 0.2), transparent 28%),
    radial-gradient(circle at 75% 78%, rgba(91, 121, 126, 0.2), transparent 28%),
    linear-gradient(180deg, rgba(243, 234, 214, 0.95), rgba(228, 215, 188, 0.95));
  position: relative;
}

.map-frame::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      145deg,
      rgba(87, 69, 38, 0.04) 0,
      rgba(87, 69, 38, 0.04) 2px,
      transparent 2px,
      transparent 18px
    );
  mix-blend-mode: multiply;
  pointer-events: none;
}

#world-map {
  width: 100%;
  height: 100%;
  display: block;
}

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

.legend-chip {
  display: inline-block;
  width: 18px;
  height: 10px;
  margin-right: 8px;
  vertical-align: middle;
  border-radius: 999px;
}

.settlement-chip {
  background: var(--accent);
}

.lair-chip {
  background: #2e2b44;
}

.safe-route-chip {
  background: var(--safe);
}

.danger-route-chip {
  background: var(--danger);
}

.mountain-chip {
  background: #8f847d;
}

.fog-chip {
  background: rgba(88, 78, 63, 0.38);
}

.actor-chip {
  background: #3b6475;
}

.creature-chip {
  background: #6c2a21;
}

.player-chip {
  background: #1f4f87;
}

.button {
  appearance: none;
  border: 1px solid rgba(48, 34, 17, 0.16);
  border-radius: 14px;
  background: rgba(255, 250, 240, 0.82);
  color: var(--ink);
  font: inherit;
  padding: 0.78rem 1rem;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
  border-color: rgba(48, 34, 17, 0.28);
}

.button:disabled {
  cursor: default;
  opacity: 0.55;
  transform: none;
}

.button.primary {
  background: linear-gradient(135deg, #bf513d, #8d2d22);
  border-color: rgba(255, 237, 222, 0.16);
  color: #fff8f1;
}

.button.ghost {
  background: rgba(55, 41, 25, 0.08);
}

.button.small {
  padding: 0.48rem 0.72rem;
  font-size: 0.88rem;
}

.button.action {
  text-align: left;
}

.inspector-body,
.city-life-board,
.snapshot-summary,
.event-log,
.table-wrap,
.doc-links {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.7);
}

.inspector-body {
  padding: 16px;
  min-height: 460px;
}

.inspector-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.detail-card {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 247, 232, 0.85);
  border: 1px solid rgba(55, 43, 27, 0.08);
}

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

.detail-value {
  display: block;
  margin-top: 4px;
  font-size: 1.08rem;
  font-weight: 700;
}

.stock-list,
.route-list,
.impact-list,
.diff-list {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.stock-row,
.route-row,
.impact-item,
.diff-item {
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 248, 238, 0.9);
  border: 1px solid rgba(56, 41, 20, 0.08);
}

.stock-top,
.route-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.stock-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(74, 58, 34, 0.12);
  overflow: hidden;
}

.stock-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--warning), var(--forest));
}

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

.city-life-board {
  padding: 14px;
}

.city-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(280px, 1.05fr);
  gap: 14px;
}

.city-map-frame {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 248, 237, 0.95);
  border: 1px solid rgba(56, 41, 20, 0.08);
}

.city-map {
  width: 100%;
  aspect-ratio: 21 / 16;
  display: block;
  border-radius: 14px;
  border: 1px solid rgba(61, 46, 28, 0.12);
  background:
    radial-gradient(circle at 20% 15%, rgba(177, 145, 97, 0.12), transparent 24%),
    linear-gradient(180deg, #f6eddc, #eadcc1);
}

.city-map-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.city-district-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.district-card {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 249, 239, 0.92);
  border: 1px solid rgba(56, 41, 20, 0.08);
  display: grid;
  gap: 8px;
}

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

.district-name {
  font-weight: 700;
}

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

.district-purpose,
.district-state {
  color: var(--muted);
  font-size: 0.92rem;
}

.district-occupants {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.actor-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.34rem 0.58rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  background: rgba(56, 43, 28, 0.08);
}

.actor-pill.role-governor { background: rgba(186, 146, 58, 0.18); color: #8b6520; }
.actor-pill.role-guard { background: rgba(59, 100, 117, 0.16); color: #284a56; }
.actor-pill.role-clergy { background: rgba(171, 148, 112, 0.2); color: #6f5532; }
.actor-pill.role-mage { background: rgba(74, 123, 157, 0.18); color: #2f5670; }
.actor-pill.role-trader,
.actor-pill.role-caravan { background: rgba(173, 109, 47, 0.18); color: #835125; }
.actor-pill.role-peasant,
.actor-pill.role-peasant_group,
.actor-pill.role-miller { background: rgba(94, 132, 64, 0.18); color: #476229; }
.actor-pill.role-artisan { background: rgba(124, 95, 71, 0.18); color: #61432a; }
.actor-pill.role-creature { background: rgba(108, 42, 33, 0.18); color: #6c2a21; }

.snapshot-tools {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0 12px;
}

.snapshot-summary {
  padding: 14px 16px;
  min-height: 120px;
  color: var(--muted);
}

.combat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.85fr);
  gap: 14px;
}

.combat-stage-wrap,
.combat-card {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.76);
}

.combat-stage-wrap {
  padding: 12px;
}

.combat-stage-stack {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 5;
  border-radius: 14px;
  border: 1px solid rgba(56, 41, 20, 0.08);
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 26%, rgba(137, 157, 95, 0.16), transparent 22%),
    linear-gradient(180deg, rgba(232, 223, 200, 0.95), rgba(214, 201, 170, 0.95));
}

#combat-stage-3d,
#combat-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#combat-stage-3d {
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.combat-stage-stack.webgpu-ready #combat-stage-3d {
  opacity: 1;
}

#combat-stage {
  background: transparent;
}

.combat-status {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

.combat-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.combat-sidebar {
  display: grid;
  gap: 12px;
}

.combat-card {
  padding: 12px 14px;
}

.combat-card-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.combat-roster-list,
.combat-log-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.combat-roster-row {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 248, 238, 0.92);
  border: 1px solid rgba(56, 41, 20, 0.08);
}

.combat-roster-note,
.combat-empty-copy {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.conflict-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.7);
}

.conflict-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(56, 41, 20, 0.08);
  background: rgba(255, 249, 239, 0.92);
}

.conflict-card.active {
  box-shadow: inset 0 0 0 1px rgba(178, 74, 55, 0.18);
}

.conflict-card.aftermath {
  box-shadow: inset 0 0 0 1px rgba(203, 143, 26, 0.18);
}

.conflict-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.conflict-title {
  font-weight: 700;
}

.conflict-meta {
  color: var(--muted);
  font-size: 0.84rem;
}

.conflict-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.conflict-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.24rem 0.56rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}

.conflict-pill.active {
  background: rgba(178, 74, 55, 0.14);
  color: var(--danger);
}

.conflict-pill.aftermath {
  background: rgba(203, 143, 26, 0.14);
  color: #8c6411;
}

.conflict-pill.resolved {
  background: rgba(63, 123, 83, 0.12);
  color: var(--safe);
}

.conflict-list {
  margin: 0;
  padding-left: 1rem;
  color: var(--muted);
}

.settlement-table {
  width: 100%;
  border-collapse: collapse;
}

.settlement-table th,
.settlement-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(56, 41, 20, 0.08);
  text-align: left;
}

.settlement-table th {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.settlement-table tbody tr:hover {
  background: rgba(110, 83, 48, 0.06);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.28rem 0.58rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.pill.safe {
  background: rgba(63, 123, 83, 0.12);
  color: var(--safe);
}

.pill.warn {
  background: rgba(203, 143, 26, 0.14);
  color: #8c6411;
}

.pill.danger {
  background: rgba(178, 74, 55, 0.14);
  color: var(--danger);
}

.event-log {
  display: grid;
  gap: 10px;
  padding: 14px;
  max-height: 420px;
  overflow: auto;
}

.event-item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(56, 41, 20, 0.08);
  background: rgba(255, 248, 239, 0.88);
}

.event-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.event-item.admin {
  border-left: 5px solid var(--accent);
}

.event-item.warning {
  border-left: 5px solid var(--warning);
}

.event-item.danger {
  border-left: 5px solid var(--danger);
}

.event-item.recovery {
  border-left: 5px solid var(--safe);
}

.doc-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  padding: 14px;
}

.doc-link {
  display: block;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 249, 239, 0.92);
  border: 1px solid rgba(56, 41, 20, 0.08);
  text-decoration: none;
  color: var(--ink);
}

.doc-link span {
  display: block;
}

.doc-link-label {
  font-weight: 700;
}

.doc-link-path {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.docs-note {
  margin: 12px 2px 0;
  color: var(--muted);
}

.map-area {
  stroke: rgba(47, 33, 17, 0.15);
  stroke-width: 2;
  cursor: pointer;
  transition: opacity 160ms ease;
}

.map-camera-fill {
  fill: rgba(236, 225, 200, 0.86);
}

.map-chunk-frame {
  fill: rgba(239, 229, 205, 0.24);
  stroke: rgba(88, 72, 50, 0.08);
  stroke-width: 1;
}

.map-chunk-frame.undiscovered {
  fill: rgba(97, 84, 63, 0.16);
  stroke: rgba(97, 84, 63, 0.18);
  stroke-dasharray: 5 5;
}

.terrain-cell {
  stroke: rgba(68, 51, 29, 0.08);
  stroke-width: 0.8;
}

.terrain-ridge {
  fill: none;
  stroke: rgba(78, 63, 58, 0.68);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.terrain-wood {
  fill: rgba(49, 79, 40, 0.3);
  stroke: rgba(49, 79, 40, 0.44);
  stroke-width: 1.4;
}

.terrain-marsh-mark,
.terrain-water-mark {
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.terrain-marsh-mark {
  stroke: rgba(78, 99, 88, 0.68);
}

.terrain-water-mark {
  stroke: rgba(71, 104, 127, 0.7);
}

.map-area-overlay {
  stroke: rgba(47, 33, 17, 0.1);
  stroke-width: 2;
  cursor: pointer;
  opacity: 0.22;
}

.map-route {
  fill: none;
  stroke-linecap: round;
  cursor: pointer;
}

.route-label {
  fill: rgba(49, 37, 24, 0.74);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.map-node,
.map-lair {
  cursor: pointer;
}

.map-actor {
  cursor: pointer;
}

.map-player {
  cursor: pointer;
}

.node-core {
  fill: var(--accent);
  stroke: rgba(255, 247, 235, 0.92);
  stroke-width: 4;
}

.node-ring {
  fill: none;
  stroke: rgba(165, 61, 45, 0.2);
  stroke-width: 10;
}

.lair-core {
  fill: #3a314e;
  stroke: rgba(255, 247, 235, 0.94);
  stroke-width: 4;
}

.map-label {
  fill: rgba(38, 29, 18, 0.92);
  font-family: "Bahnschrift", "Trebuchet MS", Verdana, sans-serif;
  font-size: 16px;
  font-weight: 700;
}

.map-label.area {
  font-family: "Georgia", "Palatino Linotype", serif;
  fill: rgba(55, 42, 26, 0.52);
  font-size: 28px;
  letter-spacing: 0.04em;
}

.actor-core {
  stroke: rgba(255, 247, 235, 0.9);
  stroke-width: 2.5;
}

.actor-human {
  fill: #3b6475;
}

.actor-creature {
  fill: #6c2a21;
}

.actor-label {
  fill: rgba(37, 27, 15, 0.84);
  font-size: 12px;
  font-weight: 700;
}

.player-halo {
  fill: rgba(31, 79, 135, 0.14);
  stroke: rgba(31, 79, 135, 0.36);
  stroke-width: 2;
}

.player-halo.combat-ready {
  fill: rgba(178, 74, 55, 0.14);
  stroke: rgba(178, 74, 55, 0.52);
}

.player-core {
  fill: #1f4f87;
  stroke: rgba(255, 247, 235, 0.94);
  stroke-width: 2.5;
}

.player-label {
  fill: rgba(23, 35, 59, 0.92);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.city-map-bg {
  fill: rgba(245, 236, 214, 0.96);
}

.city-road {
  fill: none;
  stroke: rgba(128, 103, 64, 0.62);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.city-road.ring {
  stroke-width: 5;
  stroke: rgba(145, 116, 71, 0.56);
}

.city-river-bank {
  fill: none;
  stroke: rgba(86, 128, 156, 0.42);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.city-wall-fill {
  fill: rgba(242, 228, 196, 0.72);
}

.city-wall {
  fill: none;
  stroke: rgba(86, 68, 44, 0.86);
  stroke-width: 5;
  stroke-linejoin: round;
}

.city-gate {
  fill: #8a5d32;
  stroke: rgba(255, 245, 226, 0.88);
  stroke-width: 1.5;
}

.city-district-fill {
  stroke-width: 2.4;
  opacity: 0.92;
}

.city-building {
  fill: rgba(88, 67, 43, 0.22);
  stroke: rgba(89, 66, 38, 0.52);
  stroke-width: 1;
}

.city-district-label {
  fill: rgba(55, 40, 22, 0.94);
  font-family: "Georgia", "Palatino Linotype", serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-anchor: middle;
}

.city-center-plaza {
  fill: rgba(184, 144, 84, 0.48);
  stroke: rgba(107, 77, 39, 0.68);
  stroke-width: 2;
}

.city-occupant-pin {
  fill: #3b6475;
  stroke: rgba(255, 247, 235, 0.88);
  stroke-width: 1.4;
}

.combat-arena-bg {
  fill: rgba(235, 226, 197, 0.96);
}

.combat-midline {
  stroke: rgba(89, 69, 42, 0.18);
  stroke-width: 2;
  stroke-dasharray: 8 8;
}

.combat-obstacle {
  fill: rgba(104, 84, 56, 0.55);
  stroke: rgba(76, 58, 37, 0.72);
  stroke-width: 2;
  rx: 8;
}

.combat-projectile {
  pointer-events: none;
}

.combat-projectile .combat-projectile-shaft,
.combat-projectile .combat-projectile-fletch {
  fill: none;
  stroke-linecap: round;
}

.combat-projectile .combat-projectile-shaft {
  stroke-width: 2;
}

.combat-projectile .combat-projectile-head,
.combat-projectile .combat-projectile-core {
  stroke-width: 1.4;
}

.combat-projectile.player .combat-projectile-shaft,
.combat-projectile.player .combat-projectile-fletch {
  stroke: #356f9a;
}

.combat-projectile.player .combat-projectile-head,
.combat-projectile.player .combat-projectile-core {
  fill: #356f9a;
  stroke: rgba(255, 247, 235, 0.9);
}

.combat-projectile.enemy .combat-projectile-shaft,
.combat-projectile.enemy .combat-projectile-fletch {
  stroke: #9a4d3f;
}

.combat-projectile.enemy .combat-projectile-head,
.combat-projectile.enemy .combat-projectile-core {
  fill: #9a4d3f;
  stroke: rgba(255, 247, 235, 0.86);
}

.combat-projectile.bolt .combat-projectile-shaft {
  stroke-width: 2.8;
}

.combat-projectile.arcane .combat-projectile-shaft {
  stroke: rgba(124, 230, 255, 0.92);
  stroke-width: 3.2;
}

.combat-projectile.arcane .combat-projectile-core {
  fill: rgba(132, 242, 255, 0.96);
  stroke: rgba(234, 252, 255, 0.98);
  filter: drop-shadow(0 0 8px rgba(81, 222, 255, 0.92));
}

.combat-projectile-glow {
  fill: rgba(95, 220, 255, 0.2);
  filter: drop-shadow(0 0 10px rgba(95, 220, 255, 0.86));
}

.combat-swing {
  pointer-events: none;
  stroke-width: 2;
}

.combat-swing.player {
  fill: rgba(77, 155, 194, 0.22);
  stroke: rgba(175, 227, 252, 0.92);
}

.combat-swing.enemy {
  fill: rgba(180, 93, 75, 0.2);
  stroke: rgba(248, 191, 177, 0.88);
}

.combat-hit-area {
  fill: rgba(0, 0, 0, 0.001);
  stroke: none;
}

.combatant {
  cursor: pointer;
}

.combatant .combatant-ring {
  fill: none;
  stroke: rgba(50, 40, 24, 0.16);
  stroke-width: 2;
}

.combatant.player .combatant-core {
  fill: #3b6475;
  stroke: rgba(255, 247, 235, 0.94);
  stroke-width: 2.4;
}

.combatant.enemy .combatant-core {
  fill: #8f4637;
  stroke: rgba(255, 247, 235, 0.94);
  stroke-width: 2.4;
}

.combatant.controlled .combatant-ring {
  stroke: rgba(31, 79, 135, 0.72);
  stroke-width: 4;
}

.combatant.focused .combatant-ring {
  stroke: rgba(178, 74, 55, 0.84);
  stroke-width: 4;
}

.combatant.state-windup .combatant-ring {
  stroke-width: 4.6;
}

.combatant.player.state-windup .combatant-ring,
.combatant.player.state-reload .combatant-ring {
  stroke: rgba(77, 155, 194, 0.86);
}

.combatant.enemy.state-windup .combatant-ring,
.combatant.enemy.state-reload .combatant-ring {
  stroke: rgba(188, 96, 77, 0.88);
}

.combatant.hit .combatant-core {
  filter: brightness(1.2);
}

.combatant-eye {
  fill: rgba(255, 248, 238, 0.9);
}

.combatant-name {
  fill: rgba(40, 29, 16, 0.9);
  font-size: 11px;
  font-weight: 700;
}

.combat-bar.hp-bg,
.combat-bar.poise-bg {
  fill: rgba(65, 52, 35, 0.16);
}

.combat-bar.hp-fill {
  fill: #5f9a55;
}

.combat-bar.poise-fill {
  fill: #d0a13f;
}

.combat-empty-label {
  fill: rgba(74, 59, 41, 0.84);
  font-family: "Georgia", "Palatino Linotype", serif;
  font-size: 22px;
  font-weight: 700;
}

.scene-sky-glow,
.scene-sky-haze,
.scene-ridge-fill,
.scene-floor-fade {
  pointer-events: none;
}

.scene-ridge-line {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scene-tile {
  opacity: 0.96;
}

.scene-tile.current {
  filter: drop-shadow(0 0 10px rgba(31, 79, 135, 0.18));
}

.scene-tile-shade {
  opacity: 0.22;
}

.scene-crag-line,
.scene-field-mark,
.scene-marsh-grass,
.scene-water-ripple {
  fill: none;
  stroke-linecap: round;
}

.scene-crag-line {
  stroke: rgba(248, 239, 224, 0.72);
  stroke-width: 2;
}

.scene-field-mark {
  stroke: rgba(95, 78, 42, 0.48);
  stroke-width: 1.6;
}

.scene-marsh-grass {
  stroke: rgba(78, 98, 83, 0.68);
  stroke-width: 1.8;
}

.scene-water-ripple {
  stroke: rgba(232, 244, 252, 0.72);
  stroke-width: 1.6;
}

.scene-route-shadow,
.scene-route {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scene-route-shadow {
  stroke: rgba(71, 55, 33, 0.16);
  stroke-width: 12;
}

.scene-route {
  stroke-width: 6;
  opacity: 0.82;
}

.scene-hud-panel {
  fill: rgba(255, 248, 236, 0.84);
  stroke: rgba(63, 48, 28, 0.12);
  stroke-width: 1.2;
}

.scene-hud-title,
.scene-hud-meta,
.scene-entity-label,
.scene-party-initial {
  font-family: "Bahnschrift", "Trebuchet MS", Verdana, sans-serif;
}

.scene-hud-title {
  fill: rgba(35, 26, 16, 0.94);
  font-size: 14px;
  font-weight: 800;
}

.scene-hud-meta {
  fill: rgba(67, 53, 33, 0.74);
  font-size: 11px;
  font-weight: 700;
}

.scene-entity {
  cursor: pointer;
}

.scene-entity-shadow,
.scene-party-shadow {
  fill: rgba(34, 25, 15, 0.18);
}

.scene-settlement-ring {
  fill: rgba(165, 61, 45, 0.12);
  stroke: rgba(165, 61, 45, 0.44);
  stroke-width: 2;
}

.scene-settlement-core {
  fill: rgba(165, 61, 45, 0.92);
  stroke: rgba(255, 247, 235, 0.9);
  stroke-width: 2;
}

.scene-settlement-keep {
  fill: rgba(112, 47, 36, 0.94);
}

.scene-lair-icon {
  fill: #3a314e;
  stroke: rgba(255, 247, 235, 0.9);
  stroke-width: 2;
}

.scene-lair-mouth {
  fill: none;
  stroke: rgba(222, 213, 239, 0.8);
  stroke-width: 2;
}

.scene-conflict-ring {
  fill: rgba(178, 74, 55, 0.14);
  stroke: rgba(178, 74, 55, 0.78);
  stroke-width: 2.4;
}

.scene-conflict-blade {
  stroke: rgba(255, 244, 232, 0.92);
  stroke-width: 3.2;
  stroke-linecap: round;
}

.scene-creature-body,
.scene-creature-head {
  fill: #8f4637;
  stroke: rgba(255, 247, 235, 0.9);
  stroke-width: 2;
}

.scene-creature-horn {
  stroke: rgba(255, 247, 235, 0.82);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.scene-actor-head,
.scene-actor-body {
  fill: none;
  stroke: #325d6f;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scene-actor-head {
  fill: #3b6475;
  stroke: rgba(255, 247, 235, 0.86);
}

.scene-entity-label {
  fill: rgba(33, 24, 14, 0.92);
  font-size: 11px;
  font-weight: 700;
}

.scene-party-token {
  fill: #315f84;
  stroke: rgba(255, 247, 235, 0.94);
  stroke-width: 2;
}

.scene-party-token.leader {
  fill: #1f4f87;
  stroke: rgba(255, 247, 235, 0.98);
  stroke-width: 2.6;
}

.scene-party-token.hurt {
  fill: #8c5c42;
}

.scene-party-initial {
  fill: rgba(255, 247, 235, 0.94);
  font-size: 9px;
  font-weight: 800;
}

.selected {
  filter: drop-shadow(0 0 10px rgba(165, 61, 45, 0.3));
}

.map-incident {
  fill: rgba(178, 74, 55, 0.92);
  stroke: rgba(255, 244, 232, 0.9);
  stroke-width: 2;
}

.dialogue-panel {
  grid-column: 2;
  align-self: start;
}

.dialogue-provider,
.dialogue-subpanel,
.dialogue-compose {
  border: 1px solid rgba(89, 63, 38, 0.14);
  border-radius: 16px;
  background: rgba(255, 250, 243, 0.74);
  padding: 14px;
}

.dialogue-provider,
.dialogue-subpanel {
  margin-bottom: 14px;
}

.dialogue-provider-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dialogue-field {
  display: grid;
  gap: 6px;
  font-size: 0.78rem;
  color: rgba(58, 42, 27, 0.74);
}

.dialogue-field input,
.dialogue-compose textarea {
  width: 100%;
  border: 1px solid rgba(110, 81, 52, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  padding: 10px 12px;
  font: inherit;
  color: #2e2116;
}

.dialogue-compose textarea {
  min-height: 96px;
  resize: vertical;
}

.dialogue-subhead {
  margin: 0 0 10px;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(61, 44, 27, 0.58);
}

.dialogue-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.dialogue-status {
  font-size: 0.82rem;
  color: rgba(71, 51, 31, 0.7);
}

.resource-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.resource-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(88, 65, 41, 0.08);
  border: 1px solid rgba(88, 65, 41, 0.12);
  font-size: 0.82rem;
}

.dialogue-card,
.dialogue-line {
  border: 1px solid rgba(89, 63, 38, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  padding: 12px;
}

.dialogue-card + .dialogue-card,
.dialogue-line + .dialogue-line {
  margin-top: 10px;
}

.dialogue-card p,
.dialogue-line p {
  margin: 8px 0 0;
  line-height: 1.45;
}

.dialogue-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.dialogue-meta {
  margin-top: 8px;
  font-size: 0.84rem;
  color: rgba(64, 48, 33, 0.72);
}

.dialogue-log {
  max-height: 360px;
  overflow: auto;
  display: grid;
  gap: 10px;
}

.dialogue-line.player {
  border-color: rgba(86, 119, 101, 0.22);
  background: rgba(240, 249, 242, 0.84);
}

.dialogue-line.npc {
  border-color: rgba(120, 84, 58, 0.18);
}

.dialogue-line.system {
  border-color: rgba(93, 93, 93, 0.16);
  background: rgba(244, 244, 244, 0.76);
}

.dialogue-speaker {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(66, 47, 29, 0.58);
}

.dialogue-empty {
  font-size: 0.9rem;
  color: rgba(67, 49, 31, 0.64);
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.72;
  }
  50% {
    transform: scale(1.25);
    opacity: 1;
  }
}

@media (max-width: 1180px) {
  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .dialogue-panel,
  .controls-panel,
  .city-panel,
  .actor-panel,
  .conflict-panel,
  .economy-panel,
  .log-panel,
  .docs-panel {
    grid-column: 1;
  }
}

@media (max-width: 920px) {
  .control-grid,
  .inspector-grid,
  .dialogue-provider-grid {
    grid-template-columns: 1fr;
  }

  .combat-layout,
  .city-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .shell {
    width: min(100vw - 16px, 100%);
    margin: 8px auto 18px;
  }

  .hero,
  .panel {
    padding: 18px;
  }

  .status-strip {
    grid-template-columns: 1fr;
  }

  .map-frame {
    min-height: 420px;
  }

  .stage-panel .map-frame {
    min-height: 220px;
  }

  .scene-frame {
    min-height: 320px;
  }
}

body {
  overflow-x: hidden;
}

.hero-copy {
  display: grid;
  gap: 10px;
}

.player-workspace {
  grid-template-columns: 1fr;
  align-items: start;
}

.primary-stage {
  grid-column: 1;
}

.primary-stage .map-frame {
  min-height: 520px;
}

.expedition-panel {
  grid-column: 1;
  position: static;
  display: grid;
  gap: 12px;
}

.sheet-title {
  margin: 0 0 12px;
  font-family: "Georgia", "Palatino Linotype", "Book Antiqua", serif;
  font-size: 1.2rem;
}

.sheet-section {
  border: 1px solid rgba(57, 44, 28, 0.1);
  border-radius: 18px;
  background: rgba(255, 252, 246, 0.6);
  overflow: hidden;
}

.sheet-section + .sheet-section {
  margin-top: 2px;
}

.sheet-section > summary,
.provider-shell > summary,
.debug-summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 16px;
  font-weight: 700;
  color: var(--ink);
}

.sheet-section > summary::-webkit-details-marker,
.provider-shell > summary::-webkit-details-marker,
.debug-summary::-webkit-details-marker {
  display: none;
}

.sheet-section > summary::after,
.provider-shell > summary::after,
.debug-summary::after {
  content: "+";
  float: right;
  color: var(--muted);
}

.sheet-section[open] > summary::after,
.provider-shell[open] > summary::after,
.debug-panel[open] > .debug-summary::after {
  content: "−";
}

.sheet-section-body {
  padding: 0 16px 16px;
}

.provider-shell {
  margin-bottom: 14px;
  border: 1px solid rgba(57, 44, 28, 0.1);
  border-radius: 18px;
  background: rgba(255, 252, 246, 0.6);
  overflow: hidden;
}

.provider-shell .dialogue-provider {
  padding: 0 16px 16px;
}

.expedition-panel .city-map-frame {
  padding: 10px;
}

.expedition-panel .city-map-note {
  font-size: 0.84rem;
}

.expedition-panel .city-map {
  max-height: 260px;
}

.expedition-events {
  max-height: 280px;
  overflow: auto;
}

.contextual-panel {
  grid-column: 1;
}

.combat-panel {
  display: none;
}

body.combat-active .combat-panel {
  display: block;
}

.dialogue-panel {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(460px, calc(100vw - 28px));
  max-height: min(78vh, 860px);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition:
    opacity 140ms ease,
    transform 140ms ease;
  overflow: auto;
}

body.dialogue-active .dialogue-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.dialogue-panel .panel-header {
  position: sticky;
  top: 0;
  padding-top: 2px;
  background: linear-gradient(180deg, rgba(255, 248, 233, 0.98), rgba(255, 248, 233, 0.92));
  z-index: 2;
}

.dialogue-panel .dialogue-log {
  max-height: 220px;
}

.debug-panel {
  grid-column: 1;
  padding: 0;
  overflow: hidden;
}

.debug-panel[open] {
  padding-bottom: 18px;
}

.debug-panel > .debug-summary {
  padding: 18px 22px;
  border-bottom: 1px solid rgba(57, 44, 28, 0.08);
}

.debug-grid {
  display: grid;
  gap: 18px;
  padding: 18px 22px 4px;
}

.debug-block {
  border: 1px solid rgba(57, 44, 28, 0.1);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 252, 246, 0.58);
}

.debug-block .panel-header.compact {
  margin-top: 0;
}

.debug-block .snapshot-tools {
  margin-bottom: 12px;
}

@media (max-width: 1180px) {
  .primary-stage,
  .expedition-panel,
  .contextual-panel,
  .debug-panel {
    grid-column: 1;
  }

  .expedition-panel {
    position: static;
  }
}

@media (max-width: 920px) {
  .dialogue-panel {
    right: 10px;
    left: 10px;
    bottom: 10px;
    width: auto;
    max-height: 72vh;
  }

  .primary-stage .map-frame {
    min-height: 320px;
  }
}

/* === Version Stamp === */
.version-stamp {
  position: fixed;
  top: 10px;
  right: 14px;
  z-index: 9999;
  font-family: "Georgia", "Palatino Linotype", serif;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: rgba(255, 248, 233, 0.86);
  background: rgba(20, 14, 6, 0.55);
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 248, 233, 0.16);
  pointer-events: none;
  user-select: none;
}

.version-stamp-sep {
  margin: 0 6px;
  opacity: 0.6;
}

/* === Campaign HUD === */
.campaign-hud {
  margin: 0 0 12px;
}

.campaign-hud-banner {
  background: linear-gradient(140deg, rgba(72, 100, 56, 0.92), rgba(165, 61, 45, 0.82));
  color: #fff8e9;
  padding: 12px 18px;
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(20, 16, 8, 0.28);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.campaign-hud-banner--won {
  background: linear-gradient(135deg, #3f7b53, #a07b29);
}

.campaign-hud-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  font-family: "Georgia", "Palatino Linotype", serif;
}

.campaign-hud-act {
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

.campaign-hud-dots {
  margin-left: auto;
  letter-spacing: 4px;
  font-size: 1rem;
}

.campaign-dot {
  opacity: 0.55;
}

.campaign-dot--current {
  opacity: 1;
  color: #ffe7a4;
}

.campaign-dot--done {
  color: #c8eecb;
  opacity: 1;
}

.campaign-hud-intent {
  font-size: 0.92rem;
  opacity: 0.94;
}

.campaign-hud-objs {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 0.86rem;
  opacity: 0.94;
}

.campaign-hud-objs li {
  background: rgba(20, 14, 6, 0.18);
  padding: 3px 9px;
  border-radius: 12px;
}

.campaign-hud-objs .campaign-obj--done {
  background: rgba(63, 123, 83, 0.55);
  color: #f3ffe9;
}

/* === Inspector CTA (Engage Lair button) === */
.inspector-cta {
  display: inline-block;
  margin: 8px 0;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff8e9;
  border: none;
  border-radius: 14px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: filter 120ms ease, transform 120ms ease;
}

.inspector-cta:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}

.inspector-cta--done {
  background: rgba(63, 123, 83, 0.78);
  color: #f3ffe9;
  cursor: default;
}

/* === Quest Journal === */
.quest-journal {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quest-journal-empty {
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
}

.quest-journal-card {
  background: rgba(255, 248, 233, 0.92);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  box-shadow: 0 4px 10px rgba(30, 24, 15, 0.07);
}

.quest-journal-card--ready {
  border-color: var(--safe);
  box-shadow: 0 0 0 2px rgba(63, 123, 83, 0.22), 0 4px 14px rgba(30, 24, 15, 0.1);
}

.quest-journal-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.quest-journal-summary {
  margin: 6px 0;
  font-size: 0.9rem;
  color: var(--ink);
}

.quest-journal-issuer {
  display: inline-block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.quest-journal-objectives {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.84rem;
}

.quest-journal-objectives li {
  color: var(--ink);
}

.quest-journal-objectives .quest-objective--done {
  color: var(--safe);
  text-decoration: line-through;
  opacity: 0.78;
}

.quest-journal-actions {
  margin-top: 8px;
}

/* === Dialogue claim button === */
.dialogue-card--ready {
  border: 1px solid var(--safe);
  box-shadow: 0 0 0 2px rgba(63, 123, 83, 0.18);
}
