[hidden] { display: none !important; }
:root { --bg: #1f3b2d; --fg: #f4f1e8; --accent: #e0a82e; --muted: #9bb3a4; }
html, body { margin: 0; height: 100%; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: #111; color: var(--fg); }
#map { position: absolute; inset: 0; }
#toolbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1000;
  display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(31, 59, 45, 0.92); backdrop-filter: blur(6px);
}
#toolbar button, #sheet .row button, #signin-sheet .row button, #spot-sheet .row button {
  flex: 1; padding: 14px 10px; font-size: 16px; border: 0; border-radius: 10px;
  background: #2f5440; color: var(--fg); cursor: pointer;
}
#toolbar button.primary, #sheet button.primary, #signin-sheet button.primary, #spot-sheet button.primary { background: var(--accent); color: #221a05; font-weight: 600; }
#toolbar button.active { outline: 2px solid var(--accent); }
#toolbar button:disabled { opacity: 0.5; }
#status {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 1000;
  max-width: 90vw; padding: 8px 14px; border-radius: 999px; font-size: 14px;
  background: rgba(0,0,0,0.75); color: var(--fg);
}
#btn-home {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 10px; z-index: 1000;
  width: 44px; height: 44px; border: 0; border-radius: 10px; font-size: 24px;
  background: rgba(31, 59, 45, 0.92); color: var(--fg); cursor: pointer;
}
#btn-menu {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px; z-index: 1000;
  width: 44px; height: 44px; border: 0; border-radius: 10px; font-size: 22px;
  background: rgba(31, 59, 45, 0.92); color: var(--fg); cursor: pointer;
}
#menu {
  position: absolute; top: calc(60px + env(safe-area-inset-top)); right: 10px; z-index: 1000;
  display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 12px;
  background: rgba(31, 59, 45, 0.96); box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
#menu button { padding: 12px 16px; font-size: 15px; border: 0; border-radius: 8px; background: #2f5440; color: var(--fg); text-align: left; cursor: pointer; }
#sheet, #signin-sheet, #spot-sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1100;
  background: var(--bg); color: var(--fg); border-radius: 16px 16px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 24px rgba(0,0,0,0.5);
}
#sheet h2, #signin-sheet h2, #spot-sheet h2 { margin: 0 0 4px; font-size: 18px; }
#sheet label, #signin-sheet label { display: block; margin: 10px 0 4px; font-size: 14px; color: var(--muted); }
#sheet input, #sheet textarea, #signin-sheet input {
  width: 100%; box-sizing: border-box; padding: 12px; font-size: 16px; border-radius: 8px;
  border: 1px solid #3f6a52; background: #142a1f; color: var(--fg);
}
#sheet .row, #signin-sheet .row, #spot-sheet .row { display: flex; gap: 8px; margin-top: 14px; }
.muted { color: var(--muted); font-size: 13px; margin: 0; }
.pin-label { background: rgba(31,59,45,0.9); color: var(--fg); border: 0; border-radius: 6px; padding: 2px 6px; font-weight: 600; box-shadow: none; }
.pin-label::before { display: none; }
.pin-label.pending { background: rgba(224,168,46,0.9); color: #221a05; }
.popup-actions { display: flex; gap: 6px; margin-top: 8px; }
.popup-actions button { flex: 1; padding: 8px; border: 0; border-radius: 6px; background: #2f5440; color: var(--fg); cursor: pointer; }
.popup-actions button.danger { background: #7a2e2e; }
.leaflet-popup-content { margin: 10px 12px; }
.leaflet-popup-content-wrapper { background: #1f3b2d; color: #f4f1e8; }
.leaflet-popup-tip { background: #1f3b2d; }

#menu { max-height: calc(100vh - 90px); overflow-y: auto; }
#menu-layers { display: flex; flex-direction: column; gap: 2px; padding: 4px 8px 8px; border-bottom: 1px solid rgba(255,255,255,0.15); margin-bottom: 4px; }
.layer-row { font-size: 14px; padding: 6px 4px; color: var(--fg); display: flex; align-items: center; gap: 8px; }
.layer-row input { width: 18px; height: 18px; }
/* Leaflet places the marker element with its own inline transform, so the
   centring goes on the text element inside it, never on the marker itself. */
.map-label { background: none; border: 0; font-weight: 500; text-shadow: 0 0 3px #000, 0 0 1px #000; white-space: nowrap; line-height: 1.15; width: 0; height: 0; overflow: visible; }
.map-label div { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); text-align: center; }
#btn-home.away { background: var(--accent); color: #221a05; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(224,168,46,0.7); } 50% { box-shadow: 0 0 0 10px rgba(224,168,46,0); } }
#toolbar button.teleport { background: #5a3d8a; outline: 2px solid #b388ff; }
body.teleported path[stroke="#1e88e5"] { stroke: #b388ff; }
.copyable { display: inline-block; margin: 0; padding: 4px 8px; border: 1px dashed #3f6a52; border-radius: 6px; background: transparent; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.copyable::after { content: "  copy"; opacity: 0.7; }
.map-label div { font-size: calc(var(--label-px, 14px) * var(--label-scale, 1)); }
.map-label.anchor-n div { transform: translate(-50%, 4px); }
.leaflet-container.labels-hidden .map-label { display: none; }
