:root {
  --ink: #201a15;
  --ink-soft: #3a2f26;
  --paper: #f3e9d2;
  --paper-soft: #ece0c4;
  --accent-yellow: #f2c14e;
  --accent-pink: #e8607a;
  --accent-teal: #41b4b1;
  --accent-orange: #ef7d3b;
  --shadow: 0 6px 18px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--ink);
  font-family: 'Work Sans', sans-serif;
  color: var(--paper);
  overscroll-behavior: none;
}

#map {
  position: fixed;
  inset: 0;
  background: var(--ink);
}

/* Effet "vieille carte" sur les tuiles */
.leaflet-tile-pane {
  filter: sepia(35%) saturate(65%) brightness(78%) contrast(105%);
}

.leaflet-control-attribution {
  background: rgba(32, 26, 21, 0.75) !important;
  color: var(--paper-soft) !important;
  font-family: 'Work Sans', sans-serif;
}
.leaflet-control-attribution a { color: var(--accent-yellow) !important; }

.leaflet-control-zoom a {
  background: var(--paper) !important;
  color: var(--ink) !important;
  border: none !important;
}

/* Barre du haut */
#topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: 14px 18px 22px;
  background: linear-gradient(to bottom, rgba(32,26,21,0.92), rgba(32,26,21,0));
  pointer-events: none;
  text-align: center;
}
#topbar h1 {
  font-family: 'Permanent Marker', cursive;
  font-size: 28px;
  margin: 0;
  color: var(--accent-yellow);
  text-shadow: 2px 2px 0 var(--ink);
  letter-spacing: 0.5px;
  transform: rotate(-1.5deg);
}
#topbar p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--paper-soft);
  letter-spacing: 0.5px;
}

/* Astuce discrète en bas */
#hint {
  position: fixed;
  bottom: 18px; left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: var(--ink-soft);
  color: var(--paper-soft);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow);
  pointer-events: none;
  transition: opacity 0.4s;
}
#hint.hidden { opacity: 0; }

/* Marqueurs "sticker" */
.sticker-marker {
  width: 34px;
  height: 34px;
  border-radius: 50% 50% 50% 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: var(--shadow);
  border: 2px solid rgba(255,255,255,0.85);
  cursor: pointer;
}

/* Modales */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 16, 12, 0.72);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.modal-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; }
}

.modal-card {
  background: var(--paper);
  color: var(--ink);
  width: 100%;
  max-width: 420px;
  max-height: 86vh;
  overflow-y: auto;
  border-radius: 18px 18px 0 0;
  padding: 24px 22px 28px;
  transform: translateY(24px);
  transition: transform 0.25s ease;
  box-shadow: 0 -8px 30px rgba(0,0,0,0.4);
}
.modal-backdrop.visible .modal-card { transform: translateY(0); }
@media (min-width: 640px) {
  .modal-card { border-radius: 18px; transform: scale(0.96); }
  .modal-backdrop.visible .modal-card { transform: scale(1); }
}

.modal-card h2 {
  font-family: 'Permanent Marker', cursive;
  font-size: 22px;
  margin: 0 0 4px;
  color: var(--ink);
}
.modal-card .subtitle {
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0 0 18px;
  opacity: 0.75;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 14px 0 6px;
  color: var(--ink-soft);
}
input[type="text"], textarea {
  width: 100%;
  border: 2px solid var(--ink);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: 'Work Sans', sans-serif;
  font-size: 15px;
  background: #fff;
  color: var(--ink);
  resize: vertical;
}
textarea { min-height: 70px; }

input[type="file"] {
  font-size: 13px;
  width: 100%;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}
button {
  font-family: 'Work Sans', sans-serif;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  cursor: pointer;
  flex: 1;
}
.btn-primary {
  background: var(--accent-teal);
  color: #fff;
}
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-secondary {
  background: transparent;
  color: var(--ink-soft);
  border: 2px solid var(--ink-soft);
}

.error-msg {
  color: var(--accent-pink);
  font-size: 13px;
  margin-top: 10px;
  display: none;
}
.error-msg.visible { display: block; }

/* Toggle poseur / spectateur */
.role-toggle {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}
.role-toggle button {
  flex: 1;
  background: transparent;
  color: var(--ink-soft);
  border: 2px solid var(--ink-soft);
  padding: 10px;
}
.role-toggle button.active {
  background: var(--accent-teal);
  border-color: var(--accent-teal);
  color: #fff;
}

/* Fiche d'un point existant */
.info-status {
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 12px;
}
.info-status b { color: var(--accent-teal); }
.info-date {
  font-size: 12px;
  color: var(--ink-soft);
  opacity: 0.7;
  margin: 0 0 14px;
}
.info-desc {
  font-size: 15px;
  line-height: 1.5;
  margin: 0 0 14px;
  white-space: pre-wrap;
}

.photo-gallery {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0 0 14px;
}
.photo-gallery figure {
  margin: 0;
}
.photo-gallery img {
  width: 100%;
  border-radius: 10px;
  display: block;
  border: 3px solid var(--ink);
  transform: rotate(-0.6deg);
}
.photo-gallery figcaption {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 6px;
  opacity: 0.85;
}
.photo-gallery figcaption b { color: var(--ink); }

#counter-badge {
  position: fixed;
  top: 16px; right: 16px;
  z-index: 1000;
  background: var(--accent-teal);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  transform: rotate(3deg);
}
