:root {
  --grund: #16181c;
  --tafel: rgba(24, 26, 30, 0.94);
  --rand: rgba(214, 188, 138, 0.22);
  --schrift: #e8e3d8;
  --schrift-leise: #9d978a;
  --gold: #d6bc8a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--grund);
  color: var(--schrift);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  overflow: hidden;
}

#karte {
  position: absolute;
  inset: 0;
  background: var(--grund);
}

/* Beim Hineinzoomen ueber die native Aufloesung hinaus lieber harte Blockkanten
   als weichgerechnete Pixel - das Bild hat nun mal nur einen Pixel je Block. */
.leaflet-tile { image-rendering: pixelated; }

.leaflet-container { background: var(--grund); }

/* ---- Kopf ---------------------------------------------------------------- */
.kopf {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 500;
  padding: 14px 20px;
  display: flex;
  align-items: baseline;
  gap: 12px;
  pointer-events: none;
  background: linear-gradient(to bottom, rgba(12,13,16,0.75), rgba(12,13,16,0));
}
.kopf-name {
  font-size: 20px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}
.kopf-zusatz {
  font-size: 13px;
  color: var(--schrift-leise);
  font-style: italic;
}

/* ---- Seitentafel --------------------------------------------------------- */
.tafel {
  position: absolute;
  top: 0; left: 0; bottom: 0;
  z-index: 900;
  width: min(390px, 88vw);
  padding: 56px 28px 32px;
  background: var(--tafel);
  border-right: 1px solid var(--rand);
  backdrop-filter: blur(6px);
  overflow-y: auto;
  animation: herein 0.22s ease-out;
}
.tafel[hidden] { display: none; }
@keyframes herein { from { transform: translateX(-14px); opacity: 0; } }

.tafel-zu {
  position: absolute;
  top: 14px; right: 16px;
  width: 32px; height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--schrift-leise);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.tafel-zu:hover { color: var(--schrift); background: rgba(255,255,255,0.06); }

.tafel-marken { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.marke {
  font-family: system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 9px;
  border: 1px solid var(--rand);
  border-radius: 3px;
  color: var(--schrift-leise);
}
.marke-art { color: var(--gold); border-color: rgba(214,188,138,0.45); }

.tafel-name {
  margin: 0 0 4px;
  font-size: 30px;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.01em;
}
/* ---- Bilderschieber ------------------------------------------------------
   Ein Bild zur Zeit, zwischen Namen und Halter. Der Text bleibt die
   Hauptsache, die Bilder sind der erste Eindruck. */
.schieber {
  position: relative;
  margin: 0 0 14px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(12, 13, 16, 0.6);
  border: 1px solid var(--rand);
}
.schieber[hidden] { display: none; }
.schieber-bild {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  background: rgba(12, 13, 16, 0.8);
}
.schieber-pfeil {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 44px;
  border: 0;
  background: rgba(12, 13, 16, 0.55);
  color: var(--schrift);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease-out;
}
.schieber-pfeil:hover { background: rgba(12, 13, 16, 0.85); color: var(--gold); }
.schieber-pfeil[hidden] { display: none; }
.schieber-pfeil.zurueck { left: 0; border-radius: 0 4px 4px 0; }
.schieber-pfeil.vor { right: 0; border-radius: 4px 0 0 4px; }
.schieber-fuss {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 9px;
  font-size: 11.5px;
  color: var(--schrift-leise);
  background: rgba(12, 13, 16, 0.5);
}
.schieber-titel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.schieber-punkte { flex: 0 0 auto; font-family: ui-monospace, Consolas, monospace; }

/* Der Wiki-Text bringt Ueberschriften und Listen mit. */
.tafel-text h3, .tafel-text h4, .tafel-text h5 {
  margin: 18px 0 6px;
  font-size: 15px;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.02em;
}
.tafel-text ul, .tafel-text ol { margin: 0 0 14px; padding-left: 20px; }
.tafel-text li { margin-bottom: 4px; }
.tafel-text a { color: var(--gold); }
.tafel-text code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
  color: var(--gold);
}

/* Wer haelt dieses Gebiet - die erste Frage auf einer politischen Karte. */
.tafel-halter {
  font-size: 13.5px;
  color: var(--schrift-leise);
  font-style: italic;
  margin-bottom: 6px;
}
.tafel-halter.gehalten { color: var(--schrift); font-style: normal; }
.tafel-halter b { color: var(--gold); font-weight: 500; font-style: normal; }
.halter-trenner { opacity: 0.5; margin: 0 6px; }

/* Regung: zwei Zahlen und ein Balken, der sie einordnet. */
.tafel-regung {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--schrift-leise);
  margin-bottom: 10px;
}
.tafel-regung[hidden] { display: none; }
.regung-trenner { opacity: 0.5; }
.regung-balken {
  flex: 1 1 60px;
  min-width: 60px;
  height: 4px;
  border-radius: 2px;
  background: rgba(214, 188, 138, 0.16);
  overflow: hidden;
}
.regung-balken i {
  display: block;
  height: 100%;
  background: var(--gold);
  opacity: 0.75;
}

.tafel-ort {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  color: var(--schrift-leise);
  margin-bottom: 18px;
}
.tafel-text { font-size: 15.5px; line-height: 1.62; color: #d9d4c8; }
.tafel-text p { margin: 0 0 14px; }
.tafel-hinweis {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--rand);
  font-size: 12.5px;
  font-style: italic;
  color: var(--schrift-leise);
}

/* ---- Marker -------------------------------------------------------------- */
.punkt {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid rgba(20,22,26,0.85);
  box-shadow: 0 0 0 1px rgba(214,188,138,0.5), 0 2px 6px rgba(0,0,0,0.6);
  transition: transform 0.12s ease-out;
}
.punkt-stadt { border-radius: 2px; transform: rotate(45deg); }
.punkt:hover { transform: scale(1.35); }
.punkt-stadt:hover { transform: rotate(45deg) scale(1.35); }

.punkt-schild {
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--schrift);
  font-size: 13px;
  letter-spacing: 0.05em;
  text-shadow: 0 1px 3px #000, 0 0 8px #000;
  white-space: nowrap;
}
.leaflet-tooltip-left.punkt-schild::before,
.leaflet-tooltip-right.punkt-schild::before { border: 0; }

/* ---- Spielerpunkte ------------------------------------------------------- */
.spieler {
  fill: #e8d9b0;
  filter: drop-shadow(0 0 5px rgba(232, 217, 176, 0.55));
}

/* ---- Fußzeile ------------------------------------------------------------ */
.fuss {
  position: absolute;
  right: 12px; bottom: 12px;
  z-index: 500;
  pointer-events: none;
  display: flex;
  gap: 8px;
  align-items: center;
}
.ort-spieler[hidden] { display: none; }
.ort-spieler {
  font-family: inherit;
  font-style: italic;
  letter-spacing: 0.02em;
}
.ort[hidden] { display: none; }
.ort {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  color: var(--schrift-leise);
  background: rgba(18,20,24,0.72);
  border: 1px solid var(--rand);
  border-radius: 3px;
  padding: 4px 9px;
}

/* ---- Rahmen um das Kartenblatt ------------------------------------------- */
.weltrahmen { filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.65)); }

/* ---- Fenster mit der angeklickten Koordinate ----------------------------- */
.ortfenster .leaflet-popup-content-wrapper {
  background: rgba(18, 20, 24, 0.92);
  border: 1px solid var(--rand);
  border-radius: 3px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  color: var(--schrift);
  backdrop-filter: blur(4px);
}
.ortfenster .leaflet-popup-content { margin: 9px 12px; line-height: 1.2; }
.ortfenster .leaflet-popup-tip {
  background: rgba(18, 20, 24, 0.92);
  box-shadow: none;
}
.ortfenster-wert {
  display: flex;
  gap: 12px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  color: var(--gold);
  white-space: nowrap;
}
.ortfenster-kopie {
  display: block;
  width: 100%;
  margin-top: 7px;
  padding: 3px 8px;
  background: transparent;
  border: 1px solid var(--rand);
  border-radius: 3px;
  color: var(--schrift-leise);
  font-family: system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.06em;
  cursor: pointer;
}
.ortfenster-kopie:hover { color: var(--gold); border-color: rgba(214, 188, 138, 0.5); }
.ortfenster-getan { color: var(--gold); }

/* Stilumschalter oben rechts */
.leaflet-control-layers {
  background: rgba(18, 20, 24, 0.86) !important;
  border: 1px solid var(--rand) !important;
  border-radius: 3px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  color: var(--schrift);
  backdrop-filter: blur(4px);
}
.leaflet-control-layers-expanded { padding: 8px 12px 8px 10px; }
.leaflet-control-layers label {
  font-family: system-ui, sans-serif;
  font-size: 12px;
  letter-spacing: 0.04em;
  margin: 2px 0;
  cursor: pointer;
}
.leaflet-control-layers label:hover { color: var(--gold); }
.leaflet-control-layers input { accent-color: var(--gold); margin-right: 6px; }
/* Trennstrich zwischen Kartenstil und dem Schalter fuer die Grenzen */
.leaflet-control-layers-separator {
  border-top: 1px solid rgba(214, 188, 138, 0.25) !important;
  margin: 6px 0 !important;
}

/* Die Zoomknoepfe stehen unten rechts, direkt ueber der Fusszeile mit der
   Koordinatenanzeige - nicht darauf. Links waeren sie unter der Gebietstafel
   begraben, sobald man etwas anklickt. */
.leaflet-bottom.leaflet-right .leaflet-control-zoom { margin: 0 12px 44px 0; }

.leaflet-control-zoom a {
  background: rgba(18,20,24,0.88);
  color: var(--schrift);
  border-color: var(--rand);
}
.leaflet-control-zoom a:hover { background: rgba(38,41,47,0.95); color: var(--gold); }
.leaflet-control-attribution {
  background: rgba(18,20,24,0.72) !important;
  color: var(--schrift-leise) !important;
  font-family: system-ui, sans-serif;
  font-size: 11px;
}

@media (max-width: 640px) {
  .tafel { top: auto; right: 0; width: 100%; max-height: 58%; border-right: 0; border-top: 1px solid var(--rand); }
  .kopf-zusatz { display: none; }
}
