* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
  background: #0a1322;
}

.hidden { display: none !important; }

kbd {
  background: #e4dbc6;
  border: 1px solid #b3a687;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 5px;
  font-size: 12px;
  font-family: inherit;
}

/* ---------- Werkbalk (LSPD navy/gold) ---------- */
#toolbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 12px;
  background: linear-gradient(135deg, #0e2240 0%, #132c52 100%);
  border-bottom: 3px solid #b8892e;
  box-shadow: 0 2px 8px rgba(0,0,0,.5);
  color: #e8edf6;
}

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

#logo {
  font-weight: 700;
  letter-spacing: .5px;
  margin-right: 6px;
  white-space: nowrap;
  font-family: Georgia, serif;
}

.tb-btn {
  background: rgba(255,255,255,.08);
  color: #f0e9d8;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
  text-decoration: none;
  display: inline-block;
}
.tb-btn:hover { background: rgba(255,255,255,.17); }
.tb-btn.active { background: #b8892e; border-color: #caa14f; box-shadow: 0 0 6px rgba(202,161,79,.6); }
.tb-btn:disabled { opacity: .35; cursor: default; }
.tb-btn:disabled:hover { background: rgba(255,255,255,.08); }

.tb-sep { width: 1px; height: 22px; background: rgba(255,255,255,.2); margin: 0 4px; }

#plan-select {
  background: #0a1830;
  color: #e8edf6;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  max-width: 200px;
}

/* ---------- Kaartgebied ---------- */
#viewport {
  position: fixed;
  inset: 52px 0 0 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, #10203a 0%, #0a1322 70%),
    #0a1322;
  cursor: grab;
  touch-action: none;
}
#viewport.panning { cursor: grabbing; }
#viewport.tool-actief { cursor: crosshair; }

#world {
  position: absolute;
  top: 0; left: 0;
  width: 0; height: 0;
  transform-origin: 0 0;
}

#map-img {
  position: absolute;
  top: 0; left: 0;
  user-select: none;
  -webkit-user-drag: none;
  box-shadow: 0 0 60px rgba(0,0,0,.8);
}

#overlay {
  position: absolute;
  top: 0; left: 0;
  /* Niet 0x0: een SVG zonder afmeting wordt niet geschilderd */
  width: 2px; height: 2px;
  overflow: visible;
  pointer-events: none;
}
#overlay .pijl-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 16;
  pointer-events: stroke;
  cursor: pointer;
}
#overlay .pijl-lijn { fill: none; stroke-linecap: round; pointer-events: none; }
#overlay .pijl-kop { pointer-events: none; }
#overlay .pen-lijn {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .9;
  pointer-events: stroke;
  cursor: pointer;
}

/* ---------- Markers ---------- */
.marker {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  user-select: none;
}
.marker .dot {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 3px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 3px 10px rgba(0,0,0,.6);
}
.marker .lbl {
  background: rgba(10, 19, 34, .85);
  color: #fff;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 5px;
  padding: 1px 7px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  text-shadow: 0 1px 2px #000;
}
.marker:hover .dot { box-shadow: 0 0 0 3px rgba(202,161,79,.65), 0 3px 10px rgba(0,0,0,.6); }

/* ---------- Tekstlabels ---------- */
.map-text {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .5px;
  white-space: pre;
  cursor: pointer;
  user-select: none;
  text-shadow: 0 0 4px #000, 0 0 8px #000, 0 2px 3px #000;
}

/* ---------- Kleurenpalet ---------- */
#kleur-palet {
  position: absolute;
  top: 12px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(14, 34, 64, .95);
  border: 1px solid #b8892e;
  border-radius: 10px;
  z-index: 55;
  box-shadow: 0 4px 14px rgba(0,0,0,.5);
}
.kleur-swatch {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35);
  background: var(--sw);
  cursor: pointer;
}
.kleur-swatch.active {
  border-color: #caa14f;
  box-shadow: 0 0 6px rgba(202,161,79,.8);
}

/* ---------- Upload-hint (lege staat) ---------- */
#upload-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}
#upload-kader {
  text-align: center;
  color: #e8edf6;
  background: rgba(14, 34, 64, .8);
  border: 2px dashed rgba(202,161,79,.6);
  border-radius: 16px;
  padding: 44px 56px;
  max-width: 480px;
}
#upload-kader .uh-icon { font-size: 54px; }
#upload-kader h2 { font-family: Georgia, serif; margin: 12px 0 10px; }
#upload-kader p { color: #93a2bd; font-size: 14px; line-height: 1.55; margin: 0 0 20px; }
#upload-hint-btn {
  background: linear-gradient(135deg, #b8892e, #caa14f);
  border: 1px solid #b8892e;
  color: #fffbef;
  border-radius: 9px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
#upload-hint-btn:hover { filter: brightness(1.07); }

/* ---------- Zoom & hint ---------- */
#zoom-controls {
  position: absolute;
  right: 14px; bottom: 44px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 50;
}
#zoom-controls button {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(14, 34, 64, .92);
  color: #f0e9d8;
  font-size: 16px;
  cursor: pointer;
}
#zoom-controls button:hover { background: #132c52; }

#hint-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: rgba(8, 15, 27, .88);
  color: #93a2bd;
  font-size: 12px;
  text-align: center;
  padding: 6px 10px;
  pointer-events: none;
  z-index: 50;
}

/* ---------- Modals ---------- */
#modal-overlay, #help-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
}
#modal, #help {
  background: #f7f2e7;
  border-radius: 10px;
  width: min(440px, 92vw);
  max-height: 86vh;
  overflow-y: auto;
  padding: 20px 22px;
  box-shadow: 0 10px 40px rgba(0,0,0,.5);
  color: #33291c;
}
#modal h2, #help h2 { margin: 0 0 14px; font-size: 18px; }
#help ul { padding-left: 18px; line-height: 1.55; font-size: 14px; }

.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #6b5a40;
}
.field input[type="text"], .field select {
  width: 100%;
  border: 1px solid #c9bda3;
  border-radius: 6px;
  padding: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fffdf7;
}

#modal-actions { display: flex; gap: 8px; margin-top: 16px; align-items: center; }
#modal-actions .spacer { flex: 1; }
#modal-actions button {
  border: 1px solid #b3a687;
  background: #efe8d8;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
}
#modal-actions button:hover { background: #e4dbc6; }
#modal-actions .primary { background: #2e6b3f; border-color: #24552f; color: #fff; }
#modal-actions .primary:hover { background: #37804c; }
#modal-actions .danger { background: #b03a2e; border-color: #8c2c22; color: #fff; }
#modal-actions .danger:hover { background: #c74838; }
