:root {
  --bg: #0d1117;
  --panel: #171f2b;
  --line: rgba(255, 255, 255, 0.09);
  --text: #e9edf4;
  --muted: #97a4b8;
  --gold: #d8b26a;
  --gold-bright: #f2d79c;
  --danger: #e25757;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1100px 650px at 12% -12%, rgba(216, 178, 106, 0.11), transparent 60%),
    radial-gradient(900px 600px at 102% 0%, rgba(79, 140, 255, 0.12), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 1480px;
  margin: 0 auto;
  padding: 22px clamp(14px, 2.4vw, 32px) 48px;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

button:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

.hidden {
  display: none !important;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 14px 18px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(31, 41, 56, 0.92), rgba(19, 26, 36, 0.92));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  font-size: 20px;
  color: #1a1408;
  background: linear-gradient(145deg, #f0d7a0, #c99b4b);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

.brand h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 20px;
  letter-spacing: 0.02em;
}

.brand p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

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

.stat {
  min-width: 76px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(9, 13, 19, 0.55);
}

.stat-label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-stock {
  min-width: 196px;
}

.stock-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 7px;
  padding-top: 2px;
}

.stock-chip {
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stock-chip.is-empty {
  font-weight: 500;
  color: var(--muted);
  opacity: 0.6;
}

.actions {
  display: flex;
  gap: 8px;
}

.primary {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 700;
  color: #20180a;
  background: linear-gradient(180deg, #f0d9a3, #d2a85d);
  box-shadow: 0 6px 16px rgba(210, 168, 93, 0.22);
}

.primary:hover {
  filter: brightness(1.05);
}

.primary.danger {
  color: #2a0c0c;
  background: linear-gradient(180deg, #f08a8a, #cf4f4f);
  box-shadow: 0 6px 16px rgba(207, 79, 79, 0.24);
}

.ghost {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
}

/* ---------- Layout ---------- */
main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
}

/* ---------- Map ---------- */
.map-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(circle at 25% 8%, rgba(216, 178, 106, 0.07), transparent 55%),
    linear-gradient(180deg, rgba(21, 28, 39, 0.94), rgba(15, 21, 30, 0.94));
}

.turn-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(8, 12, 18, 0.45);
}

.player-chip::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--owner, var(--gold));
  box-shadow: 0 0 10px var(--owner, var(--gold));
}

.turn-hint {
  font-size: 12.5px;
  color: var(--muted);
}

.coach {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin: 0 0 12px;
  padding: 12px 40px 12px 14px;
  border: 1px solid rgba(216, 178, 106, 0.35);
  border-radius: 12px;
  background: linear-gradient(120deg, rgba(216, 178, 106, 0.12), rgba(8, 12, 18, 0.55));
}

.coach-copy {
  flex: 1 1 320px;
  min-width: 0;
}

.coach-kicker {
  display: block;
  margin-bottom: 3px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-bright);
}

.coach-copy strong {
  display: block;
  font-family: var(--serif);
  font-size: 16px;
  color: #f3e7cd;
}

.coach-copy p {
  margin: 3px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: #c3cddd;
}

.coach-copy b {
  color: #fff3d5;
}

.coach-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding-top: 2px;
}

.coach-step {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px 4px 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.coach-step i {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  font-style: normal;
  font-size: 9px;
  font-weight: 700;
}

.coach-step.is-active {
  border-color: rgba(216, 178, 106, 0.55);
  color: #f3e7cd;
  background: rgba(216, 178, 106, 0.1);
}

.coach-step.is-active i {
  background: var(--gold-bright);
  color: #20180a;
}

.coach-step.is-done {
  color: #9fdab8;
}

.coach-step.is-done i {
  background: rgba(99, 199, 143, 0.22);
  color: #a8e7c4;
}

.coach-close {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.coach-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.map-stage {
  position: relative;
}

.map-tools {
  display: flex;
  width: fit-content;
  align-items: center;
  gap: 3px;
  margin: 0 0 8px auto;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 10px;
  background: rgba(7, 11, 17, 0.78);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px);
}

.map-tool {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #dfe8f5;
  font-size: 17px;
  line-height: 1;
}

.map-tool:hover {
  background: rgba(255, 255, 255, 0.1);
}

.map-zoom {
  min-width: 32px;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
}

.map-scroll {
  position: relative;
  padding: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    radial-gradient(circle at 45% 35%, rgba(38, 62, 78, 0.55), transparent 65%),
    radial-gradient(circle at 82% 82%, rgba(24, 42, 54, 0.6), transparent 60%),
    #0c141b;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.55);
}

.map-board {
  display: block;
  width: 100%;
  height: auto;
  min-width: 0;
  touch-action: none;
  user-select: none;
}

.map-board.is-pannable {
  cursor: grab;
}

.map-board.is-dragging {
  cursor: grabbing;
}

.map-board.is-dragging .province {
  cursor: grabbing;
}

.map-hover {
  position: absolute;
  z-index: 6;
  width: 246px;
  padding: 10px 12px;
  border: 1px solid rgba(216, 178, 106, 0.34);
  border-radius: 11px;
  background: rgba(12, 18, 27, 0.96);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.hover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.hover-head strong {
  overflow: hidden;
  color: #f3f6fc;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.hover-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--owner, #888);
  box-shadow: 0 0 8px var(--owner, #888);
}

.hover-owner {
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--muted);
}

.hover-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px 8px;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 10.5px;
  color: #c3cddd;
}

.hover-grid b {
  color: #fff3d5;
}

.hover-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 7px;
}

.hover-badge {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 9px;
  color: #dfe8f5;
}

.hover-badge.is-capital {
  border-color: rgba(240, 217, 163, 0.45);
  color: #f3e7cd;
}

.hover-badge.is-objective {
  border-color: rgba(138, 180, 255, 0.4);
  color: #cfe0ff;
}

.graticule line {
  stroke: rgba(157, 198, 224, 0.08);
  stroke-width: 0.7;
  vector-effect: non-scaling-stroke;
}

.graticule .equator {
  stroke: rgba(157, 198, 224, 0.18);
  stroke-dasharray: 5 6;
  stroke-width: 1;
}

.ocean-label {
  fill: rgba(142, 181, 205, 0.27);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-anchor: middle;
  pointer-events: none;
}

.sea-routes-layer {
  pointer-events: none;
}

.sea-link {
  fill: none;
  stroke: rgba(103, 215, 255, 0.24);
  stroke-width: 1;
  stroke-dasharray: 3 5;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  transition: stroke 0.15s ease, stroke-width 0.15s ease, opacity 0.15s ease;
}

.sea-link.is-active {
  stroke: rgba(103, 215, 255, 0.82);
  stroke-width: 1.8;
  stroke-dasharray: 5 4;
}

.sea-link.is-target {
  stroke: #b6f1ff;
  stroke-width: 2.4;
  stroke-dasharray: none;
  filter: drop-shadow(0 0 3px rgba(103, 215, 255, 0.65));
}

.map-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.map-meta::before {
  content: "🗺️";
  font-size: 12px;
}

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

/* ---------- Provinciekaart ---------- */
.province {
  cursor: pointer;
}

.province-base {
  fill: #35422f;
  stroke: rgba(8, 12, 18, 0.9);
  stroke-width: 1.6;
  stroke-linejoin: round;
  transition: filter 0.15s ease;
}

.province--woud .province-base {
  fill: #2c4033;
}

.province--bergen .province-base {
  fill: #3d424c;
}

.province--kust .province-base {
  fill: #2d4b58;
}

.province-owner {
  fill: var(--owner, #888);
  fill-opacity: 0.32;
  stroke: var(--owner, #888);
  stroke-opacity: 0.7;
  stroke-width: 1.2;
  stroke-linejoin: round;
  pointer-events: none;
}

.province-label {
  pointer-events: none;
}

.province:hover .province-base {
  filter: brightness(1.15) saturate(1.05);
}

.province.is-selected {
  filter: drop-shadow(0 0 7px rgba(242, 215, 156, 0.65));
}

.province.is-selected .province-owner {
  stroke: var(--gold-bright);
  stroke-width: 4.5;
  stroke-opacity: 1;
}

.province.is-neighbor .province-owner {
  stroke: #f08a8a;
  stroke-width: 3.5;
  stroke-dasharray: 9 7;
  stroke-opacity: 1;
  animation: dash 1.4s linear infinite;
}

.province.is-sea-neighbor .province-owner {
  stroke: #67d7ff;
  stroke-width: 3.5;
  stroke-dasharray: 3 7;
  stroke-opacity: 1;
  animation: dash 1.8s linear infinite;
}

.province.is-target .province-owner {
  stroke: #ff8a8a;
  stroke-width: 5;
  stroke-opacity: 1;
}

.province:focus-visible {
  outline: none;
}

.province:focus-visible .province-owner {
  stroke: var(--gold-bright);
  stroke-width: 4.5;
  stroke-opacity: 1;
}

.province-name {
  fill: #f3f6fc;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(5, 8, 12, 0.88);
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
}

.province-terrain,
.province-resource {
  font-size: 14px;
  text-anchor: middle;
  opacity: 0.9;
  pointer-events: none;
}

.morale-track {
  fill: rgba(5, 8, 12, 0.55);
}

.morale-fill {
  fill: #63c78f;
}

.morale-fill.is-warn {
  fill: #e0b04a;
}

.morale-fill.is-low {
  fill: #e25757;
}

.province-builds {
  fill: #e6edf8;
  font-size: 12.5px;
  text-anchor: middle;
  pointer-events: none;
  opacity: 0.95;
}

.province-fleets {
  fill: #8fe4ff;
  font-size: 11px;
  font-weight: 800;
  text-anchor: middle;
  pointer-events: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7));
}

.troop-badge {
  pointer-events: none;
}

.troop-badge circle {
  fill: rgba(7, 10, 15, 0.82);
  stroke: var(--owner, #888);
  stroke-width: 3;
}

.troop-text {
  fill: #fff;
  font-size: 16px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-anchor: middle;
  dominant-baseline: central;
}

.map-board.is-dense .province-builds {
  display: none;
}

.map-board.is-dense .province-resource {
  display: none;
}

.map-board.is-dense .province-name {
  letter-spacing: -0.015em;
}

.map-board.is-dense .province.label-hidden .province-name {
  display: none;
}

.compass {
  pointer-events: none;
}

@keyframes dash {
  to {
    stroke-dashoffset: -32;
  }
}

.province.is-fortify-source .province-owner {
  stroke: #7fd1ff;
  stroke-width: 4.5;
  stroke-opacity: 1;
}

.province.is-fortify-target .province-owner {
  stroke: #7fd1ff;
  stroke-width: 3.5;
  stroke-dasharray: 4 6;
  stroke-opacity: 1;
  animation: dash 1.4s linear infinite;
}

.province.is-fortify-target .province-base {
  filter: brightness(1.15);
}

/* ---------- Sidebar ---------- */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(25, 33, 46, 0.94), rgba(18, 24, 34, 0.94));
}

.panel h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-head p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--owner, #888);
  box-shadow: 0 0 10px var(--owner, #888);
}

.section-title {
  margin: 14px 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-title:first-child {
  margin-top: 0;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 4px;
}

.stat-strip.is-four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.stat-strip.is-four div {
  padding: 7px 6px;
}

.stat-strip.is-four strong {
  font-size: 14px;
}

.stat-strip div {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 12, 18, 0.5);
}

.stat-strip span {
  display: block;
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-strip strong {
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.morale-value.is-good {
  color: #79d3a4;
}

.morale-value.is-warn {
  color: #e6c166;
}

.morale-value.is-low {
  color: #f07a7a;
}

.button-row {
  display: flex;
  gap: 8px;
  margin: 10px 0 4px;
}

.button-row button {
  flex: 1;
  padding: 9px 10px;
  font-size: 12px;
}

.button-row .ghost {
  flex: 0 0 auto;
}

.button-row .primary {
  flex: 1;
}

.wide {
  width: 100%;
  margin-top: 8px;
  padding: 9px 10px;
  font-size: 12px;
}

.build-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fleet-box {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
  padding: 8px;
  border: 1px solid rgba(103, 215, 255, 0.28);
  border-radius: 9px;
  background: rgba(24, 91, 118, 0.14);
}

.fleet-icon {
  font-size: 16px;
  color: #8fe4ff;
}

.fleet-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
  font-size: 11px;
  color: var(--muted);
}

.fleet-copy strong {
  color: var(--text);
}

.fleet-copy .lvl {
  color: #8fe4ff;
  font-variant-numeric: tabular-nums;
}

.build-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(8, 12, 18, 0.4);
}

.build-icon {
  font-size: 15px;
}

.build-info strong {
  display: block;
  font-size: 12.5px;
}

.build-info .lvl {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.build-info span {
  display: block;
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted);
}

.build-info .build-cost {
  color: #d9c08a;
  font-variant-numeric: tabular-nums;
}

.pips {
  display: flex;
  gap: 3px;
}

.pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}

.pip.is-on {
  background: var(--gold);
}

.mini {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.mini:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
}

.mini.is-muted {
  color: #d99a9a;
}

.sea-route {
  margin: 8px 0 12px;
  padding: 8px 10px;
  border: 1px solid rgba(103, 215, 255, 0.35);
  border-radius: 10px;
  background: rgba(24, 91, 118, 0.22);
  color: #bdeeff;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.sea-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin: -4px 0 12px;
}

.sea-preview > div {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid rgba(103, 215, 255, 0.22);
  border-radius: 9px;
  background: rgba(24, 91, 118, 0.14);
}

.sea-preview span,
.sea-preview small {
  display: block;
  font-size: 9.5px;
  line-height: 1.25;
  color: var(--muted);
}

.sea-preview span {
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sea-preview strong {
  display: block;
  margin: 2px 0;
  font-size: 18px;
  line-height: 1.1;
  color: #d8f5ff;
  font-variant-numeric: tabular-nums;
}

.sea-preview > div:nth-child(2) strong {
  color: #ffd98a;
}

.interception-line {
  margin: -4px 0 12px;
  padding: 7px 9px;
  border: 1px solid rgba(103, 215, 255, 0.28);
  border-radius: 9px;
  background: rgba(24, 91, 118, 0.16);
  color: #bdeeff;
  font-size: 11px;
  line-height: 1.35;
}

.interception-line b {
  color: #fff0bd;
}

.versus {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  margin: 8px 0 12px;
}

.vs-side {
  padding: 10px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 12, 18, 0.45);
}

.vs-side span {
  display: block;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.vs-side strong {
  display: block;
  font-size: 26px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.vs-side small {
  font-size: 10.5px;
  color: var(--muted);
}

.vs-mark {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.battle-panel {
  border-color: rgba(216, 178, 106, 0.35);
}

.dice-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.dice-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dice-label {
  width: 84px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.die {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(91, 147, 255, 0.5);
  border-radius: 8px;
  background: rgba(91, 147, 255, 0.2);
  font-size: 13px;
  font-weight: 700;
}

.die.is-def {
  border-color: rgba(226, 87, 87, 0.5);
  background: rgba(226, 87, 87, 0.18);
}

.battle-line {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text);
}

.fortify-box {
  margin: 10px 0 4px;
  padding: 10px 12px;
  border: 1px solid rgba(127, 209, 255, 0.28);
  border-radius: 12px;
  background: rgba(127, 209, 255, 0.07);
}

.fortify-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.fortify-head strong {
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
}

.fortify-box input[type="range"] {
  width: 100%;
  accent-color: #7fd1ff;
}

.fortify-scale {
  display: flex;
  justify-content: space-between;
  font-size: 10.5px;
  color: var(--muted);
}

.hint {
  margin: 10px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--muted);
}

.empty-state {
  padding: 10px 4px;
  text-align: center;
}

.empty-glyph {
  display: block;
  margin-bottom: 8px;
  font-size: 30px;
  opacity: 0.9;
}

.empty-state h2 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 17px;
}

.empty-state p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.player-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) 40px 50px 44px 42px;
  gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border-radius: 8px;
}

.player-row + .player-row {
  margin-top: 2px;
}

.player-row.is-active {
  background: rgba(216, 178, 106, 0.1);
  box-shadow: inset 0 0 0 1px rgba(216, 178, 106, 0.25);
}

.player-row.is-out {
  opacity: 0.45;
}

.player-name {
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.player-stat {
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.player-stat small {
  display: block;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.player-stat.is-good {
  color: #79d3a4;
}

.player-stat.is-warn {
  color: #e6c166;
}

.player-stat.is-low {
  color: #f07a7a;
}

.capital-lost {
  color: #f07a7a;
  font-size: 10px;
}

.log {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 250px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.log li {
  padding-left: 9px;
  border-left: 2px solid rgba(255, 255, 255, 0.1);
  font-size: 11.5px;
  line-height: 1.45;
  color: #c3cddd;
}

.log li.log-conquest {
  border-color: var(--gold);
  color: #f3e7cd;
}

.log li.log-battle {
  border-color: var(--danger);
}

.log li.log-build {
  border-color: #6fae8b;
}

.log li.log-income {
  border-color: #5b93ff;
}

.log li.log-warn {
  border-color: #e0a13a;
}

.log li.log-move {
  border-color: #6fd3ff;
}

.log li.log-objective {
  border-color: #d8b26a;
  color: #f3e7cd;
}

.log li b {
  font-weight: 700;
}

.res {
  font-weight: 700;
  color: var(--gold-bright);
}

.pool {
  font-weight: 700;
  color: #8ab4ff;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.tag.is-fleet {
  border-color: rgba(103, 215, 255, 0.38);
  color: #c8f3ff;
}

.tag {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(8, 12, 18, 0.45);
  font-size: 10.5px;
  color: #c3cddd;
}

.tag.is-empty {
  color: var(--muted);
}

/* ---------- Overwinning en doelen ---------- */
.goal-markers {
  pointer-events: none;
}

.objective-marker,
.capital-marker {
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(5, 8, 12, 0.9);
  stroke-width: 3px;
  stroke-linejoin: round;
}

.province.is-objective .province-base {
  stroke: rgba(216, 178, 106, 0.9);
  stroke-width: 2.6;
}

.province.is-capital .province-base {
  stroke: #f0d9a3;
  stroke-width: 3.2;
}

.goal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -4px 0 10px;
}

.goal-badge {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.03em;
}

.goal-badge.is-capital {
  border-color: rgba(240, 217, 163, 0.55);
  color: #f3e7cd;
  background: rgba(216, 178, 106, 0.12);
}

.goal-badge.is-objective {
  border-color: rgba(138, 180, 255, 0.45);
  color: #cfe0ff;
  background: rgba(91, 147, 255, 0.1);
}

.victory-panel {
  border-color: rgba(216, 178, 106, 0.28);
  background: linear-gradient(180deg, rgba(35, 33, 24, 0.92), rgba(18, 24, 34, 0.94));
}

.victory-morale-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.victory-morale {
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.victory-morale-row div {
  display: flex;
  flex-direction: column;
}

.victory-morale-row strong {
  font-size: 12px;
}

.victory-morale-row small {
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--muted);
}

.morale-meter {
  height: 6px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(5, 8, 12, 0.6);
}

.morale-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #63c78f;
  transition: width 0.25s ease;
}

.morale-meter span.is-warn {
  background: #e0b04a;
}

.morale-meter span.is-low {
  background: #e25757;
}

.victory-alert {
  margin: 10px 0 0;
  padding: 7px 9px;
  border-left: 2px solid #e0a13a;
  border-radius: 6px;
  background: rgba(224, 161, 58, 0.08);
  font-size: 11px;
  line-height: 1.45;
  color: #f0d7a0;
}

.victory-alert.is-good {
  border-color: #63c78f;
  background: rgba(99, 199, 143, 0.08);
  color: #a8e7c4;
}

.victory-block {
  margin-top: 13px;
}

.victory-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.victory-label strong {
  color: var(--gold-bright);
  font-size: 11px;
  letter-spacing: 0;
}

.objective-list,
.capital-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 7px 0 0;
  padding: 0;
  list-style: none;
}

.objective-row,
.capital-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(8, 12, 18, 0.42);
}

.objective-row.is-held,
.capital-row.is-held {
  border-color: rgba(216, 178, 106, 0.35);
  background: rgba(216, 178, 106, 0.09);
}

.objective-row > span:last-child,
.capital-row > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.objective-row strong,
.capital-row strong {
  font-size: 11.5px;
}

.objective-row small,
.capital-row small {
  font-size: 10px;
  color: var(--muted);
}

.objective-star,
.capital-icon {
  font-size: 13px;
}

.streak-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  font-size: 10px;
  color: var(--muted);
}

.streak-row small {
  margin-left: auto;
  font-size: 9.5px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.streak-dots {
  display: flex;
  gap: 3px;
}

.streak-dot {
  width: 8px;
  height: 8px;
  border: 1px solid rgba(216, 178, 106, 0.75);
  border-radius: 50%;
}

.streak-dot.is-filled {
  background: var(--gold-bright);
  box-shadow: 0 0 6px rgba(242, 215, 156, 0.6);
}

.goal-options {
  margin-bottom: 18px;
}

.goal-options .segmented {
  margin-bottom: 8px;
}

.goal-hint {
  margin: 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}

.goal-block .goal-description {
  margin: 7px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: #b7c2d4;
}

.goal-meter {
  height: 7px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(5, 8, 12, 0.6);
}

.goal-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8ab4ff, #f0d9a3);
  transition: width 0.25s ease;
}

.goal-copy {
  margin: 8px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}

.score-round-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.score-round-line strong {
  color: var(--gold-bright);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.score-table {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
}

.score-row {
  display: grid;
  grid-template-columns: 17px 10px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  padding: 6px 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(8, 12, 18, 0.42);
}

.score-row.is-active {
  border-color: rgba(216, 178, 106, 0.3);
  background: rgba(216, 178, 106, 0.09);
}

.score-row.is-out {
  opacity: 0.5;
}

.score-rank {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.score-name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.score-total {
  color: var(--gold-bright);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.score-breakdown {
  grid-column: 3 / -1;
  overflow: hidden;
  font-size: 9.5px;
  line-height: 1.3;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.end-standings {
  margin: 0 0 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.end-score-title {
  margin-bottom: 7px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

.end-score-row {
  display: grid;
  grid-template-columns: 17px 10px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  padding: 6px 7px;
  border-radius: 8px;
}

.end-score-row + .end-score-row {
  margin-top: 2px;
}

.end-score-row.is-winner {
  background: rgba(216, 178, 106, 0.1);
  box-shadow: inset 0 0 0 1px rgba(216, 178, 106, 0.28);
}

.end-score-name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.end-score-name small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

.end-score-row strong {
  color: var(--gold-bright);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.end-score-breakdown {
  grid-column: 3 / -1;
  overflow: hidden;
  font-size: 9.5px;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------- Overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 9, 14, 0.78);
  backdrop-filter: blur(6px);
}

#handoff-overlay {
  background: rgba(6, 9, 14, 0.96);
  backdrop-filter: blur(12px);
}

.handoff-dialog {
  width: min(460px, 100%);
  text-align: center;
  border-color: color-mix(in srgb, var(--owner, #d8b26a) 45%, transparent);
}

.handoff-dialog .lede strong {
  font-weight: 800;
}

.dialog {
  width: min(580px, 100%);
  max-height: 88vh;
  padding: 30px;
  overflow-y: auto;
  border: 1px solid rgba(216, 178, 106, 0.25);
  border-radius: 22px;
  background: linear-gradient(180deg, #1c2534, #141a24);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

.dialog h1 {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-size: 34px;
  letter-spacing: 0.01em;
}

.lede {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.55;
  color: #b7c2d4;
}

.save-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 20px;
  padding: 12px 14px;
  border: 1px solid rgba(216, 178, 106, 0.35);
  border-radius: 14px;
  background: rgba(216, 178, 106, 0.08);
}

.save-banner .label {
  margin-bottom: 4px;
  color: var(--gold);
}

.save-info {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: #cbd5e4;
}

.save-banner .primary {
  padding: 9px 14px;
  white-space: nowrap;
}

@media (max-width: 560px) {
  .save-banner {
    flex-direction: column;
    align-items: stretch;
  }
}

.rule-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.rule-grid.is-single {
  grid-template-columns: 1fr;
}

.rule {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 12, 18, 0.45);
  font-size: 12px;
  line-height: 1.5;
  color: #b7c2d4;
}

.rule b {
  display: block;
  margin-bottom: 2px;
  color: var(--text);
}

.label {
  margin: 0 0 8px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.segmented {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(8, 12, 18, 0.5);
}

.segmented button {
  width: 44px;
  padding: 7px 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.segmented button.is-active {
  color: var(--gold-bright);
  background: rgba(216, 178, 106, 0.16);
  box-shadow: inset 0 0 0 1px rgba(216, 178, 106, 0.4);
}

.segmented-wide button {
  width: auto;
  min-width: 64px;
  padding: 7px 12px;
}

.seed-row {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.seed-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 12, 18, 0.55);
  color: var(--text);
  font: inherit;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.seed-row input:focus-visible {
  outline: 2px solid rgba(216, 178, 106, 0.5);
  outline-offset: 1px;
}

.seed-row .ghost {
  padding: 10px 14px;
  font-size: 16px;
  line-height: 1;
}

.big {
  width: 100%;
  padding: 13px;
  font-size: 14px;
}

/* ---------- Animaties ---------- */
.province.is-hit .province-owner {
  animation: hit-flash 0.46s ease-out;
}

@keyframes hit-flash {
  0% {
    fill-opacity: 0.8;
    stroke-width: 6;
  }
  100% {
    fill-opacity: 0.32;
    stroke-width: 2;
  }
}

.province.is-captured .province-owner {
  animation: capture-flash 0.8s ease-out;
}

@keyframes capture-flash {
  0% {
    fill-opacity: 0.9;
    stroke-width: 7;
  }
  55% {
    fill-opacity: 0.62;
  }
  100% {
    fill-opacity: 0.32;
    stroke-width: 2;
  }
}

.troop-badge.is-bumped circle {
  transform-box: fill-box;
  transform-origin: center;
  animation: badge-pop 0.4s cubic-bezier(0.2, 0.8, 0.3, 1);
}

.troop-badge.is-bumped text {
  transform-box: fill-box;
  transform-origin: center;
  animation: badge-pop-text 0.4s cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes badge-pop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.32);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes badge-pop-text {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.24);
  }
  100% {
    transform: scale(1);
  }
}

.fx-strike {
  stroke: rgba(255, 255, 255, 0.72);
  stroke-width: 3;
  stroke-linecap: round;
}

.fx-projectile {
  filter: drop-shadow(0 0 8px rgba(255, 212, 121, 0.85));
}

.fx-ring {
  fill: none;
  stroke-width: 3.5;
  filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.55));
}

.map-fx {
  pointer-events: none;
}

.die {
  animation: die-in 0.42s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

@keyframes die-in {
  0% {
    transform: translateY(-12px) rotate(-28deg) scale(0.5);
    opacity: 0;
  }
  60% {
    transform: translateY(2px) rotate(4deg) scale(1.08);
    opacity: 1;
  }
  100% {
    transform: none;
  }
}

.overlay:not(.hidden) {
  animation: overlay-in 0.24s ease-out;
}

.overlay:not(.hidden) .dialog {
  animation: dialog-in 0.32s cubic-bezier(0.2, 0.8, 0.3, 1);
}

@keyframes overlay-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes dialog-in {
  from {
    transform: translateY(14px) scale(0.98);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  main {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .log-panel {
    grid-column: 1 / -1;
  }
}

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

  .coach {
    flex-direction: column;
    gap: 8px;
  }

  .coach-copy {
    flex: 0 0 auto;
  }

  .coach-steps {
    padding-top: 0;
  }

  .brand p {
    display: none;
  }
}

@media (max-width: 560px) {
  .status {
    width: 100%;
    flex-wrap: wrap;
    justify-content: space-between;
  }

  .stat {
    flex: 1;
    min-width: 0;
    padding: 6px 8px;
  }

  .stat-stock {
    flex: 1 0 100%;
  }

  .actions {
    width: 100%;
  }

  .actions button {
    flex: 1;
  }

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

  .dialog {
    padding: 22px;
  }

  .dialog h1 {
    font-size: 28px;
  }
}
