:root {
  --bg: #121212;
  --panel: #202020;
  --panel-2: #393939;
  --border: #454545;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --accent-2: #f0883e;
  --hl: #3fb950;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
}
body { position: relative; }

a { color: var(--accent); }

.site-mesh-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 900px;
  pointer-events: none;
  z-index: 0;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
          mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 100%);
}
.site-mesh-bg svg {
  width: 100%;
  height: 100%;
  display: block;
}

.site-mesh-bg .hdr-mesh line { stroke-opacity: .35; }

.site-mesh-bg .hdr-nodes circle {
  filter: drop-shadow(0 0 6px rgba(88,166,255,.7));
}

.site-mesh-bg .hdr-pulse circle {
  animation: hdr-pulse 3s ease-out infinite;
}

@keyframes hdr-pulse {
  0%   { transform: scale(.1); opacity: 0; }
  10%  { opacity: 1;}
  40%  { opacity: 0; }
  100% { transform: scale(1.8); opacity: 0; }
}

.site-header {
  position: relative;
  z-index: 1;
  text-align: center;
}
.site-header-inner {
  position: relative;
  max-width: 1200px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 3rem;
}
.site-header h1 {
  margin: 0 0 .5rem;
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -.5px;
  line-height: 1.05;
  color: #ffffff;
}
.site-header-accent {
  color: #d92525;
}
.site-header p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}
@media (prefers-reduced-motion: reduce) {
  .site-mesh-bg .hdr-pulse circle { animation: none; }
}

main { max-width: 1200px; margin: 0 auto; padding: 1.5rem; position: relative; z-index: 1; }

section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
section h2 {
  margin: 0 0 1rem;
  font-size: 1.4rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: .5rem;
}
section h2 a {
  color: inherit;
  text-decoration: none;
}

.muted { color: var(--muted); margin: 0; }

.platform-links {
  color: var(--accent-2);
  margin: .25rem 0 1.25rem;
}
.platform-links a {
  color: var(--accent);
  font-weight: 500;
}

table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .5rem .75rem; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; }

.map-wrap {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

#map {
  position: relative;
  width: auto;
  height: 560px;
  margin: 0 -1.5rem;
  background: #111;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
#map .leaflet-container { background: #111; }

/* Per-region farver paa GeoJSON-laget. Sat via JS-stylefunktion paa Leaflet pathOptions. */
.mcdk-region {
  cursor: pointer;
}
.map-hint {
  position: absolute;
  top: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: #fff;
  color: #141414;
  padding: 0.2rem 1rem;
  border-radius: 3px;
  font-size: 0.95rem;
  white-space: nowrap;
  text-shadow: 0px 0px 2px rgba(0,0,0,0.5);
  pointer-events: none;
}
.map-hint[hidden] {
  display: none;
}
.mcdk-city-marker {
  background: var(--accent-2);
  border: 2px solid #0a1830;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  box-shadow: 0 0 0 2px rgba(240,136,62,.25);
}
.mcdk-city-popup-body h4 { margin: 0 0 .35rem; color: var(--accent-2); font-size: 1rem; }
.mcdk-city-popup-body dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: .2rem .6rem; font-size: .88rem; }
.mcdk-city-popup-body dt { color: var(--muted); }
.mcdk-city-popup-body dd { margin: 0; }
.mcdk-city-popup-body p { margin: .4rem 0 0; font-size: .85rem; }
.leaflet-popup-content-wrapper {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0,0,0,.45);
  padding: 0;
}
.leaflet-popup-tip {
  background: var(--panel-2);
  border: 1px solid var(--border);
  box-shadow: none;
}
.leaflet-popup-content {
  margin: .75rem .9rem;
  font-family: inherit;
  line-height: 1.5;
}
.leaflet-popup-content code {
  background: var(--bg);
  color: var(--text);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: .9em;
}
.leaflet-popup-close-button {
  color: var(--muted) !important;
  font-size: 20px !important;
  padding: 4px 6px 0 0 !important;
}
.leaflet-popup-close-button:hover { color: var(--text) !important; }
.leaflet-popup-content-wrapper a.leaflet-popup-close-button { background: transparent; }
.leaflet-control-attribution {
  background: rgba(32,32,32,.85) !important;
  color: var(--muted) !important;
}
.leaflet-control-attribution a { color: var(--accent) !important; }

/* ---- Editor (edit.html) ---- */
.editor-body main { max-width: 1400px; }
.editor-map {
  width: auto;
  height: 70vh;
  min-height: 480px;
  margin: 1rem -1.5rem 0;
  background: #111;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.editor-toolbar {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
}
.editor-toolbar button {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .45rem .9rem;
  font: inherit;
  cursor: pointer;
}
.editor-toolbar button:hover { background: var(--border); }
.editor-toolbar button.primary {
  background: var(--accent-2);
  color: #000;
  border-color: var(--accent-2);
}
.editor-status {
  color: var(--hl);
  font-size: .9rem;
}
.editor-handoff { margin-top: .75rem; font-size: .9rem; }

/* Match Geoman buttons to Leaflet's default white zoom controls. */

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.25rem 1.4rem;
  max-width: 420px;
  width: calc(100% - 2rem);
  color: var(--text);
}
.modal h3 { margin: 0 0 .5rem; color: var(--accent-2); }
.modal p { margin: 0 0 .75rem; }
.modal select,
.modal input[type="text"],
.modal textarea {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .4rem .5rem;
  font: inherit;
}
.modal textarea { resize: vertical; }
.modal label {
  display: block;
  margin-top: .6rem;
  margin-bottom: .25rem;
  color: var(--muted);
  font-size: .9rem;
}
.modal .error { color: #e85a5a; min-height: 1.2em; }
.modal-actions {
  margin-top: 1rem;
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
}
.modal-actions button {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .45rem .9rem;
  font: inherit;
  cursor: pointer;
}
.modal-actions button:hover {
  background: var(--border);
}
.modal-actions .primary {
  background: var(--accent-2);
  color: #000;
  border-color: var(--accent-2);
}
.modal-actions .primary:hover { background: var(--accent-2); filter: brightness(1.1); }

#regionTitle { margin: 0; color: #fff; font-size: 1rem; }
#regionCli { margin: 0; display: flex; flex-direction: column; gap: .8rem; }
.cli-block { display: flex; flex-direction: column; gap: .3rem; }
.cli-label { color: var(--muted); font-size: .8rem; }
#regionCli pre { margin: 0; background: var(--bg); padding: .6rem .8rem; border-radius: 4px; overflow-x: auto; font-size: .85rem; }
#regionCli code { background: transparent; padding: 0; }

.social-links {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1rem;
}
.social-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem 1.1rem;
  border-radius: 4px;
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  transition: background .15s ease, border-color .15s ease;
  cursor: pointer;
}
.social-btn:hover,
.social-btn:focus-visible {
  background: var(--border);
  border-color: var(--muted);
}
.social-btn.discord:hover,
.social-btn.discord:focus-visible {
  background: #5865f2;
  border-color: #5865f2;
  color: #fff;
}
.social-btn.editor:hover,
.social-btn.editor:focus-visible {
  background: var(--accent-2);
  border-color: var(--accent-2);
  color: #000;
}
.social-btn.git:hover,
.social-btn.git:focus-visible {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}
.social-btn.facebook:hover,
.social-btn.facebook:focus-visible {
  background: #1877f2;
  border-color: #1877f2;
  color: #fff;
}

.social-btn.meshview:hover,
.social-btn.meshview:focus-visible {
  background: #0f0f23;
  border-color: #0f0f23;
  color: #fff;
}
.social-btn svg {
  flex-shrink: 0;
}

code {
  background: var(--panel-2);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 1.1em;
}

.profile-grid {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.profile-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .9rem 1.1rem;
  display: grid;
  grid-template-columns: minmax(160px, 200px) 1fr auto;
  align-items: center;
  gap: 1.25rem;
}
.profile-card header { display: flex; flex-direction: column; gap: .15rem; }
.profile-card h3 { margin: 0; color: var(--accent-2); font-size: 1.05rem; letter-spacing: .5px; }
.profile-card header span { color: var(--muted); font-size: .85rem; }
.profile-card .profile-body p { margin: 0; font-size: .92rem; }
.profile-card .profile-examples { color: var(--muted); font-size: .85rem; margin-top: .2rem; }
.profile-card pre {
  margin: 0;
  background: var(--bg);
  padding: .6rem .8rem;
  border-radius: 4px;
  overflow-x: auto;
  font-size: .85rem;
}
.profile-card pre code { background: transparent; padding: 0; }

.setting {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .9rem 1.1rem;
  margin-bottom: .75rem;
}
.setting h3 { margin: 0 0 .5rem; color: var(--accent-2); font-size: 1rem; }
.setting ul { margin: 0; padding-left: 1.2rem; }
.setting li { font-size: .92rem; margin-bottom: .2rem; }
.setting code { background: var(--bg); }
.setting pre {
  margin: .75rem 0 0;
  background: var(--bg);
  padding: .6rem .8rem;
  border-radius: 4px;
  overflow-x: auto;
  font-size: .85rem;
}
.setting pre code { background: transparent; padding: 0; }
.setting table { margin-top: .75rem; }
.setting-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .25rem .75rem;
  margin: 0 0 .75rem;
  padding: .5rem .75rem;
  background: var(--bg);
  border-radius: 4px;
  font-size: .88rem;
}
.setting-meta dt { color: var(--muted); font-weight: 600; }
.setting-meta dd { margin: 0; }
#indstillinger > h3 { margin: 1.5rem 0 .5rem; font-size: 1.05rem; }

.screenshot-grid {
  --shot-min: 200px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(max(var(--shot-min), calc((100% - 2 * .75rem) / 3)), 1fr));
  gap: .75rem;
  margin: 1rem 0 .5rem;
}
.screenshot-grid-wrap {
  position: relative;
  margin-bottom: 1rem;
}
.screenshot-grid.collapsed {
  max-height: calc(var(--row-h, 9999px) * 0.6);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 40%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0, #000 40%, transparent 100%);
}
.screenshot-grid a { display: block; }
.screenshot-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 20;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.screenshot-expand {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 25%);
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  min-height: 48px;
  padding: .75rem 1.5rem;
  background: #1f6feb;
  color: #fff;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  letter-spacing: .01em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
  z-index: 2;
  white-space: nowrap;
}
.screenshot-expand::after {
  content: "";
  width: .55em;
  height: .55em;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
}
.screenshot-expand:hover,
.screenshot-expand:focus-visible {
  filter: brightness(1.05);
  outline: none;
}
.screenshot-expand:active {
  transform: translate(-50%, 25%) translateY(1px);
  filter: brightness(0.95);
}
@media (max-width: 480px) {
  .screenshot-grid { --shot-min: 120px; gap: .5rem; }
}
