/* "Styr et land": selvstændigt stylesheet, kun indlæst på verden.html.
   Holdt adskilt fra css/style.css, dels fordi det visuelle sprog (kort,
   statistiklinjer, log-panel) er markant anderledes end resten af sitet,
   dels for at style.css ikke skal vokse med regler, kun denne ene side
   bruger. */

:root {
  --world-player: #b23b3b;
  --world-ally: #3f7d5c;
  --world-neutral: #55606b;
  --world-neutral-rebel: #8a7a4a;
  --world-enemy: #7a1f1f;
}

#world-app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

.world-screen h1 {
  font-size: 1.8rem;
  margin: 0 0 4px;
}
.world-subtitle {
  color: var(--ink-soft-on-dark);
  margin: 0 0 20px;
}

.world-content-box {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 20px;
}
.world-content-box h3 {
  margin-top: 18px;
  color: var(--ink);
  text-shadow: none;
}
.world-content-box ul { padding-left: 20px; }
.world-content-box li { margin-bottom: 8px; }
.world-disclaimer {
  border-top: 1px dashed var(--border);
  padding-top: 12px;
  margin-top: 16px;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

/* ---------------------------------------------------------------------
   Spilskærm: kort til venstre, sidepanel til højre.
--------------------------------------------------------------------- */

.world-playing {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 20px;
  align-items: start;
}

.world-map-wrap {
  grid-column: 1;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
  background: #0c1c28;
  cursor: grab;
  /* Forhindrer browserens egen touch-scroll/zoom i at konkurrere med vores
     egen finger-panorering og knibe-zoom på kortet. */
  touch-action: none;
  user-select: none;
}
.world-map-wrap.world-map-dragging {
  cursor: grabbing;
}
.world-map-credit {
  grid-column: 1;
  margin: 4px 0 0;
  font-size: 0.75rem;
  color: var(--ink-soft-on-dark);
  opacity: 0.7;
}
.world-map-credit a {
  color: inherit;
}
.world-map-svg {
  display: block;
  width: 100%;
  height: auto;
  transform-origin: 0 0;
  will-change: transform;
}
/* Ingen glidende overgang, mens der aktivt trækkes: kortet skal følge
   musen/fingeren 1:1 uden forsinkelse. Knapperne og dobbeltklik/scroll
   beholder den bløde overgang, det er her "lækkert" reelt mærkes. */
.world-map-wrap:not(.world-map-dragging) .world-map-svg {
  transition: transform 0.2s ease-out;
}
.world-map-loading {
  padding: 120px 20px;
  text-align: center;
  color: var(--ink-soft-on-dark);
  font-style: italic;
}

.world-map-controls {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
}
.world-map-zoom-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(12, 28, 40, 0.85);
  color: #f6f2e7;
  font-family: inherit;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: background 0.15s ease, transform 0.15s ease;
}
.world-map-zoom-btn:hover {
  background: rgba(178, 59, 59, 0.85);
  transform: scale(1.08);
}
.world-map-zoom-reset {
  font-size: 0.95rem;
}
.world-map-hint {
  position: absolute;
  left: 12px;
  bottom: 10px;
  margin: 0;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(8, 15, 22, 0.65);
  color: rgba(246, 242, 231, 0.75);
  font-size: 0.72rem;
  z-index: 2;
  pointer-events: none;
}

/* Alle lande i selve kortfilen, som ikke er en del af spillets 36, beholder
   denne dæmpede standardfarve og er ikke klikbare. De spilbare lande får
   deres egen farve og klasse indsat direkte i renderMapSvg(). */
.world-map-svg path,
.world-map-svg g {
  fill: #1c3547;
  stroke: #0c1c28;
  stroke-width: 0.4;
}

.world-territory {
  stroke: rgba(0, 0, 0, 0.45);
  stroke-width: 0.7;
  transition: filter 0.15s ease;
}
.world-territory-player {
  stroke: #f6f2e7;
  stroke-width: 1.4;
}
.world-territory-targetable {
  cursor: pointer;
  stroke: var(--fictional);
  stroke-width: 1.2;
  stroke-dasharray: 2 1.5;
}
.world-territory-targetable:hover {
  filter: brightness(1.3);
}
.world-territory-contested {
  stroke-dasharray: 3 2;
  animation: world-front-march 0.9s linear infinite;
}
@keyframes world-front-march {
  to { stroke-dashoffset: -10; }
}

.world-edges {
  pointer-events: none;
}
.world-edge {
  stroke: rgba(246, 242, 231, 0.12);
  stroke-width: 0.35;
  stroke-dasharray: 1.2 1;
}

/* Alliance-/krigslinjer: tegnet oven på de dæmpede grænselinjer, så hele
   verdens diplomati bliver synligt direkte på kortet, ikke kun i
   sidepanelets navnelister. */
.world-alliance-lines,
.world-war-lines {
  pointer-events: none;
}
.world-alliance-line {
  stroke: var(--world-ally);
  stroke-width: 1;
  opacity: 0.85;
}
.world-war-line {
  stroke: var(--world-enemy);
  stroke-width: 1;
  stroke-dasharray: 2 1.4;
  opacity: 0.9;
}

.world-labels {
  pointer-events: none;
}
.world-territory-label {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 6.5px;
  fill: #f6f2e7;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(8, 8, 8, 0.8);
  stroke-width: 1.2px;
}
.world-territory-occupation-label {
  font-size: 5px;
  font-weight: bold;
  fill: var(--fictional);
}

/* ---------------------------------------------------------------------
   Sidepanel
--------------------------------------------------------------------- */

.world-sidebar {
  grid-column: 2;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.world-status-card,
.world-actions,
.world-offer,
.world-dilemma,
.world-diplomacy-card,
.world-log-panel {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 18px;
}

.world-status-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
}
.world-status-title h2 {
  margin: 0;
  font-size: 1.25rem;
  color: var(--ink);
  text-shadow: none;
}
.world-color-swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.3);
  flex: none;
}
.world-status-sub {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0 0 12px;
}

.world-stat { margin-bottom: 10px; }
.world-stat-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: bold;
  margin-bottom: 3px;
}
.world-stat-track {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.world-stat-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s ease;
}
.world-effective-military {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: -6px 0 10px;
}
.world-economy-line {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: -6px 0 10px;
}
.world-tax-control {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -4px 0 10px;
  flex-wrap: wrap;
}
.world-tax-control-label {
  font-size: 0.78rem;
  font-weight: bold;
  color: var(--ink-soft);
}
.world-tax-buttons {
  display: flex;
  gap: 4px;
}
.world-tax-btn {
  font-family: inherit;
  font-size: 0.75rem;
  padding: 3px 9px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--ink-soft);
  cursor: pointer;
}
.world-tax-btn:hover {
  border-color: var(--primary);
}
.world-tax-btn-active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: bold;
}

.world-alliance-list,
.world-enemy-list {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 10px 0 0;
}
.world-enemy-list {
  color: var(--world-enemy);
  font-weight: bold;
}
.world-leader-trait {
  font-size: 0.82rem;
  color: var(--accent);
  margin: 2px 0 6px;
  cursor: help;
}
.world-traits {
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin: 2px 0 12px;
}

.world-diplomacy-card h3 {
  margin: 0 0 8px;
  color: var(--ink);
  text-shadow: none;
  font-size: 1rem;
}
.world-diplomacy-empty,
.world-diplomacy-total {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin: 0;
}
.world-diplomacy-sub {
  font-size: 0.78rem;
  font-weight: bold;
  margin: 10px 0 4px;
}
.world-diplomacy-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.world-diplomacy-list li {
  font-size: 0.8rem;
  color: var(--ink-soft);
  border-left: 3px solid var(--border);
  padding: 2px 0 2px 8px;
}
.world-diplomacy-fronts li {
  border-left-color: var(--fictional);
  font-weight: bold;
  color: var(--ink);
}

.world-warning {
  color: var(--world-enemy);
  font-weight: bold;
}

.world-actions h3 {
  margin: 0 0 12px;
  color: var(--ink);
  text-shadow: none;
  font-size: 1rem;
}
.world-action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.world-action-grid .btn {
  width: 100%;
  font-size: 0.9rem;
  padding: 12px 8px;
}
.world-action-grid .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}
.world-btn-cost {
  display: block;
  font-size: 0.75rem;
  opacity: 0.85;
}
.world-btn-peace {
  border: 2px solid var(--accent);
}

.world-target-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  max-height: 260px;
  overflow-y: auto;
}
.world-target-btn {
  font-family: inherit;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.world-target-btn:hover { border-color: var(--primary); }
.world-target-btn span {
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.world-offer {
  border-left: 6px solid var(--fictional);
}
.world-offer p { margin: 0 0 10px; }
.world-offer-actions {
  display: flex;
  gap: 10px;
}
.world-offer-actions .btn { flex: 1; }
.world-intervention {
  border-left: 6px solid var(--world-enemy);
}

.world-dilemma {
  border-left: 6px solid var(--accent);
}
.world-dilemma h3 {
  margin: 0 0 8px;
  color: var(--ink);
  text-shadow: none;
  font-size: 1.05rem;
}
.world-dilemma p {
  margin: 0 0 12px;
  color: var(--ink-soft);
}

.world-log-panel h3 {
  margin: 0 0 10px;
  color: var(--ink);
  text-shadow: none;
  font-size: 1rem;
}
.world-log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.world-log-list li {
  font-size: 0.85rem;
  border-left: 3px solid var(--border);
  padding: 4px 0 4px 10px;
  color: var(--ink-soft);
}
.world-log-round {
  font-weight: bold;
  color: var(--ink);
  margin-right: 4px;
}
.world-log-victory { border-left-color: var(--good); }
.world-log-defeat { border-left-color: var(--bad); }
.world-log-elimination { border-left-color: var(--crisis-afsat); }
.world-log-betrayal { border-left-color: var(--bad); }
.world-log-alliance { border-left-color: var(--world-ally); }
.world-log-rebellion { border-left-color: var(--fictional); }
.world-log-event { border-left-color: var(--bar-legitimitet); }
.world-log-election-won { border-left-color: var(--good); }
.world-log-election-lost { border-left-color: var(--bad); }
.world-log-peace { border-left-color: var(--world-ally); }
.world-log-dilemma { border-left-color: var(--accent); }

/* ---------------------------------------------------------------------
   Game over
--------------------------------------------------------------------- */

.world-standings {
  padding-left: 20px;
}
.world-standings li { margin-bottom: 4px; }
.world-standing-player {
  font-weight: bold;
  color: var(--primary);
}
.world-end-title {
  border-left: 4px solid var(--accent);
  padding: 10px 14px;
  margin: 14px 0;
  background: rgba(0, 0, 0, 0.04);
}
.world-end-title strong {
  display: block;
  margin-bottom: 4px;
}
.world-end-title p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .world-playing {
    grid-template-columns: 1fr;
  }
  .world-sidebar {
    grid-column: 1;
    grid-row: auto;
  }
}

@media (max-width: 520px) {
  #world-app { padding: 20px 14px 60px; }
  .world-action-grid { grid-template-columns: 1fr; }
}
