:root {
  --bg: #0b0f14;
  --panel: #121923;
  --accent: #4da3ff;
  --text: #e6eefc;
  --muted: #8aa0b6;

  --btn: #151f2e;
  --btn-border: #2b3a4e;
  --btn-hover: #1b2a3f;

  --danger: #3b2225;
  --danger-border: #7d3a40;

  --primary: #1c3350;
  --primary-border: #375985;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

#map {
  position: absolute;
  inset: 0;
}

.leaflet-container {
  background: #05101c;
}

.leaflet-control-attribution,
.leaflet-control-zoom {
  display: none !important;
}

.map-img {
  image-rendering: auto;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  -ms-interpolation-mode: nearest-neighbor;
}

.toolbar {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(18, 25, 35, 0.9);
  padding: 8px 10px;
  border: 1px solid #1f2a39;
  border-radius: 12px;
  backdrop-filter: blur(6px);
}

.btn {
  border: 1px solid var(--btn-border);
  background: var(--btn);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}

.btn:hover {
  background: var(--btn-hover);
}

.btn.primary {
  background: var(--primary);
  border-color: var(--primary-border);
}

.btn.danger {
  background: var(--danger);
  border-color: var(--danger-border);
  color: #ffdede;
}

.hint {
  color: var(--muted);
  margin-left: 6px;
  max-width: 40vw;
}

.panel {
  position: fixed;
  right: 12px;
  top: 12px;
  width: 380px;
  max-height: calc(100% - 24px);
  background: var(--panel);
  border: 1px solid #1f2a39;
  border-radius: 14px;
  padding: 12px;
  overflow: auto;
  z-index: 1000;
  display: none;
}

.panel h2 {
  margin: 4px 0 8px;
  font-size: 16px;
}

.panel .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.panel label {
  font-size: 12px;
  color: var(--muted);
  display: block;
  margin-top: 6px;
}

.panel input,
.panel select,
.panel textarea {
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #2b3a4e;
  background: #0e1520;
  color: var(--text);
  font-size: 13px;
}

.panel textarea {
  min-height: 60px;
  max-height: 100px;
  resize: vertical;
  line-height: 1.3;
  scrollbar-width: thin;
}

.coords {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  margin-bottom: 4px;
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.badge {
  background: #0e223c;
  border: 1px solid #2b3a4e;
  padding: 4px 6px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
}

.pal-wrap {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background: rgba(77, 163, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.pal-wrap img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  pointer-events: none;
}

.credit {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 1100;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: rgba(18, 25, 35, 0.9);
  border: 1px solid #1f2a39;
  border-radius: 12px;
  color: var(--muted);
  font-size: 12px;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.credit a {
  color: var(--accent);
  text-decoration: none;
}

.credit a:hover {
  text-decoration: underline;
}

.credit .dot {
  opacity: 0.8;
}

.credit.minimized {
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
}

@media (max-width: 560px) {
  .credit {
    left: 12px;
    right: 12px;
    justify-content: center;
    font-size: 11px;
  }
}

.panel .skill-links {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.panel .skill-ref {
  flex: 1 1 0;
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  text-align: center;
  font-weight: 600;
  font-size: 12px;
  text-decoration: none;
  background: rgba(77, 163, 255, 0.18);
  border: 1px solid #60a5fa;
  color: #d9ebff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.2) inset;
  transition: transform 0.06s ease, box-shadow 0.12s ease, background-color 0.12s ease, filter 0.12s ease;
}

.panel .skill-ref:hover {
  transform: translateY(-0.5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  filter: brightness(1.04);
}

.panel .skill-ref:active {
  transform: translateY(0);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12);
  filter: none;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  user-select: none;
}

.toggle input[type="checkbox"] {
  width: 32px;
  height: 18px;
  appearance: none;
  background: #1b2a3f;
  border: 1px solid #2b3a4e;
  border-radius: 18px;
  position: relative;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.toggle input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 1px;
  left: 1px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e6eefc;
  transition: transform 0.25s ease, background-color 0.25s ease;
}

.toggle input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: #5fb3ff;
}

.toggle input[type="checkbox"]:checked::before {
  transform: translateX(14px);
  background: #fff;
}

.toggle span {
  font-size: 12px;
  color: var(--muted);
  min-width: 36px;
  text-align: left;
  letter-spacing: 0.3px;
}

.leaflet-container,
.leaflet-grab,
.leaflet-dragging .leaflet-container,
.leaflet-dragging .leaflet-grab,
.leaflet-interactive {
  cursor: default !important;
}

.donation-bar {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 1100;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(18, 25, 35, 0.9);
  border-radius: 999px;
  border: 1px solid #1f2a39;
  color: var(--muted);
  font-size: 12px;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  cursor: pointer;
  transition: padding 0.15s ease, border-radius 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}

.donation-bar .donation-icon {
  font-size: 14px;
}

.donation-bar .donation-label {
  color: var(--text);
}

.donation-bar.minimized {
  padding-inline: 10px;
}

.donation-bar.minimized .donation-label {
  display: none;
}

@media (max-width: 560px) {
  .donation-bar {
    max-width: 70vw;
  }
}
