/* Modalità notte: tema scuro e attenuato per tenere la mappa su un secondo schermo mentre si gioca.
   Si attiva con la classe "notte" su <html> (la mette notte.js). Per toglierla basta togliere il <link> da index.html. */

/* Sfondo della mappa: niente tramonto rosa, solo blu notte molto scuro */
html.notte, html.notte body { background: #050508; }
html.notte .map-workspace,
html.notte .atlas-map-canvas {
  background:
    radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.8) 135%),
    linear-gradient(180deg, #07060f 0%, #0d0a1a 60%, #120c1c 100%);
}

/* Cartografia attenuata; i marker restano a piena luminosità per essere leggibili */
html.notte .leaflet-tile-pane,
html.notte .leaflet-overlay-pane .atlas-source-basemap,
html.notte .leaflet-image-layer {
  filter: brightness(0.55) saturate(0.7) contrast(1.05);
}
html.notte .leaflet-marker-pane { filter: brightness(0.9); }

/* Pannelli, barre e fogli: più scuri e opachi, meno riflessi */
html.notte {
  --surface: rgba(6, 5, 12, 0.9);
  --surface-raised: rgba(255, 255, 255, 0.04);
  --accent: #c0619f;
  --muted: rgba(255, 255, 255, 0.45);
  --border: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(4, 3, 9, 0.88);
  --glass-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  color: rgba(235, 230, 240, 0.78);
}
html.notte .sidebar,
html.notte .detail-panel,
html.notte .xf-panel,
html.notte .rc-panel,
html.notte .tp-panel,
html.notte .xf-cats,
html.notte .guida-dialog,
html.notte [role="dialog"] {
  background: rgba(4, 3, 9, 0.92) !important;
  border-color: rgba(255, 255, 255, 0.07) !important;
  color: rgba(235, 230, 240, 0.78);
}
html.notte .button,
html.notte .icon-button {
  background: rgba(10, 8, 18, 0.88);
  border-color: rgba(255, 255, 255, 0.08);
  color: rgba(235, 230, 240, 0.8);
  box-shadow: none;
}
html.notte .button.primary,
html.notte .button-primary { background: #7a2f64; color: #f1dbe9; }
html.notte input, html.notte select, html.notte textarea {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.07);
  color: rgba(235, 230, 240, 0.85);
}

/* Pulsante "Modalità notte" nella barra in alto */
.nt-chip svg { flex: none; }
html.notte .nt-chip { color: #e7b3d6; border-color: rgba(231, 179, 214, 0.35); }

@media (width <= 599px) {
  .map-actions .nt-chip > span { display: none; }
}
