:root {
  --bg: #0d0d0d;
  --card: #1c1c1c;
  --card-hover: #222222;
  --panel: #27272a;
  --panel-light: #323238;
  --border: #333333;
  --border-light: #444444;
  --ink: #ffffff;
  --muted: #a1a1aa;
  --muted-dark: #71717a;
  
  /* BlogRaffo Signature Accents */
  --accent: #b02020;
  --accent-hot: #e32e0a;
  --accent-glow: rgba(227, 46, 10, 0.25);
  --gold: #fcb900;
  --gold-glow: rgba(252, 185, 0, 0.25);
  --chrome: #d5e0eb;
  
  /* Weather Metrics Specific */
  --temp-hot: #ef4444;
  --temp-warm: #f97316;
  --temp-cool: #06b6d4;
  --temp-cold: #38bdf8;
  --rain: #38bdf8;

  /* Positive & GPS Accents */
  --accent-green: #22c55e;
  --accent-green-bg: rgba(34, 197, 94, 0.15);
  --accent-green-border: rgba(34, 197, 94, 0.35);
  --accent-green-glow: rgba(34, 197, 94, 0.25);
  
  --radius: 0.75rem;
  --radius-sm: 0.5rem;
  --radius-lg: 1rem;
  --pad: 1.25rem;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --font-main: "Open Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  margin: 0;
  padding: 0;
  background-color: var(--bg);
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-main);
  background-color: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
}

/* Signature BlogRaffo top gradient bar */
body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  z-index: 1000;
  pointer-events: none;
  background: linear-gradient(to right, #000 0%, var(--accent-hot) 100%);
}

.wrap {
  width: min(100%, 64rem);
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Header & Brand */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand a.home {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.brand-logo {
  display: block;
  width: auto;
  height: auto;
  max-height: 3.5rem;
  object-fit: contain;
}

.brand-title {
  display: flex;
  flex-direction: column;
}

.brand-title h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink);
  line-height: 1.2;
}

.brand-title .tagline {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.9rem;
  font-size: 0.875rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  background: var(--panel-light);
  border-color: var(--muted-dark);
  color: var(--ink);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-hot));
  border-color: var(--accent-hot);
  color: #fff;
  box-shadow: 0 2px 10px var(--accent-glow);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-hot), #ff4820);
  border-color: #ff4820;
  box-shadow: 0 4px 14px var(--accent-glow);
}

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

.btn-gold:hover {
  background: rgba(252, 185, 0, 0.1);
  color: #ffe066;
}

.btn-sm {
  padding: 0.35rem 0.65rem;
  font-size: 0.8rem;
}

.btn-icon-only {
  padding: 0.55rem;
  border-radius: var(--radius-sm);
}

.btn-altimeter {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: var(--chrome);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: var(--transition);
}

.btn-altimeter:hover {
  background: rgba(252, 185, 0, 0.15);
  border-color: var(--gold);
  color: var(--gold);
  box-shadow: 0 0 14px rgba(252, 185, 0, 0.25);
  transform: translateY(-1px);
}

/* Search and Location Selector Card */
.location-selector {
  background: linear-gradient(180deg, #19191e 0%, #131316 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 3px solid #3b82f6;
  border-radius: var(--radius);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  position: relative;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.search-row {
  display: flex;
  gap: 0.6rem;
  position: relative;
  align-items: center;
}

.search-input-wrap {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
  display: flex;
  align-items: center;
}

.search-input {
  width: 100%;
  background: #121212;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 0.95rem;
  font-family: inherit;
  padding: 0.65rem 2.2rem 0.65rem 2.5rem;
  outline: none;
  transition: var(--transition);
}

.search-input:focus {
  border-color: var(--accent-hot);
  box-shadow: 0 0 0 2px var(--accent-glow);
  background: #171717;
}

.search-clear-btn {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.25rem;
  display: none;
}

.search-clear-btn:hover {
  color: var(--ink);
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #18181b;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  z-index: 500;
  max-height: 280px;
  overflow-y: auto;
  display: none;
}

.autocomplete-dropdown.open {
  display: block;
}

.autocomplete-item {
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: var(--transition);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
  background: var(--panel-light);
}

.autocomplete-city {
  font-weight: 600;
  color: var(--ink);
}

.autocomplete-region {
  font-size: 0.8rem;
  color: var(--muted);
  margin-left: 0.5rem;
}

.autocomplete-country {
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: var(--chrome);
}

/* Saved Favorites Chips Bar */
.favorites-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.favorites-label {
  color: var(--muted);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-right: 0.25rem;
}

.favorites-chips {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  flex: 1;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.3rem 0.7rem;
  font-size: 0.82rem;
  color: var(--chrome);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.chip:hover {
  background: var(--panel-light);
  border-color: var(--gold);
  color: #fff;
}

.chip.active {
  background: rgba(252, 185, 0, 0.12);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 600;
}

.chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0 0.1rem;
  transition: var(--transition);
}

.chip-remove:hover {
  color: var(--accent-hot);
}

.btn-reset-favs {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--muted);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
}

.btn-reset-favs:hover {
  border-color: var(--accent-hot);
  color: var(--accent-hot);
}

/* Main Cards Base */
.card {
  background: linear-gradient(180deg, #1c1c22 0%, #151518 100%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}

/* Card 1 Specific: Previsioni Meteo */
.card-forecast {
  border-top: 4px solid var(--accent-hot);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 24px rgba(227, 46, 10, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Card 2 Specific: Confronto Climatico Storico */
.card-history {
  border-top: 4px solid var(--gold);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 24px rgba(252, 185, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Card Identity Headers & Badges */
.card-identity-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding-bottom: 0.35rem;
}

.card-num-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  line-height: 1.2;
}

.chip-forecast {
  background: rgba(227, 46, 10, 0.18);
  color: #ff5533;
  border: 1px solid rgba(227, 46, 10, 0.4);
}

.chip-history {
  background: rgba(252, 185, 0, 0.18);
  color: var(--gold);
  border: 1px solid rgba(252, 185, 0, 0.4);
}

.chip-search {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.chip-guide {
  background: rgba(255, 255, 255, 0.08);
  color: var(--chrome);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.card-folder-hint {
  font-size: 0.73rem;
  color: var(--muted);
  font-weight: 600;
}

.card-header-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.location-meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.location-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.location-name {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge-source {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.22rem 0.65rem;
  border-radius: 4px;
  background: var(--accent-green-bg);
  color: var(--accent-green);
  border: 1px solid var(--accent-green-border);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
}

.badge-source.badge-gps {
  background: var(--accent-green-bg);
  color: var(--accent-green);
  border-color: var(--accent-green-border);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.18);
}

.badge-source.badge-manual {
  background: rgba(255, 255, 255, 0.08);
  color: var(--chrome);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: none;
}

.badge-source.badge-detecting {
  background: rgba(252, 185, 0, 0.15);
  color: var(--gold);
  border-color: rgba(252, 185, 0, 0.35);
  box-shadow: 0 0 8px rgba(252, 185, 0, 0.15);
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  background-color: currentColor;
}

.badge-dot.pulse {
  animation: badgeDotPulse 1.2s infinite ease-in-out;
}

@keyframes badgeDotPulse {
  0% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.3); opacity: 1; }
  100% { transform: scale(0.8); opacity: 0.5; }
}

.location-coords {
  font-size: 0.8rem;
  color: var(--muted);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Current Weather Hero */
.weather-hero {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1.5rem;
  align-items: center;
  background: linear-gradient(145deg, #141417, #1e1e24);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

@media (max-width: 768px) {
  .weather-hero {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 1rem;
  }
}

.hero-primary {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .hero-primary {
    justify-content: center;
  }
}

.weather-icon-lg {
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.weather-icon-lg svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.4));
}

.temp-primary-wrap {
  display: flex;
  flex-direction: column;
}

.temp-now {
  font-size: clamp(2.8rem, 7vw, 4.2rem);
  font-weight: 800;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.03em;
}

.temp-unit {
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--muted);
  vertical-align: super;
}

.condition-desc {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--chrome);
  margin-top: 0.25rem;
}

.hero-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

@media (max-width: 768px) {
  .hero-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.metric-box {
  background: #16161a;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  transition: var(--transition);
}

.metric-box:hover {
  background: #1c1c22;
  border-color: rgba(255, 255, 255, 0.16);
}

.metric-label {
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.metric-value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

/* Folder Section Title & Tabs System */
.folder-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.5rem;
  margin-bottom: -0.5rem;
}

.folder-tabs-header {
  display: flex;
  align-items: center;
  background: #111114;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
  margin-top: 0.25rem;
}

.folder-tab {
  flex: 1;
  background: transparent;
  color: var(--muted);
  border: none;
  padding: 0.65rem 0.75rem;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: 8px;
  transition: var(--transition);
  white-space: nowrap;
}

.folder-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
}

.folder-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-hot));
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(227, 46, 10, 0.4);
}

.folder-tab-badge {
  font-size: 0.68rem;
  padding: 0.12rem 0.4rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--muted);
}

.folder-tab.active .folder-tab-badge {
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
}

/* Tab Panels */
.tab-panel {
  display: none;
  animation: fadeIn 0.25s ease-in-out;
}

.tab-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hourly Timeline (24 Ore) */
.hourly-scroll {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.hourly-scroll::-webkit-scrollbar {
  height: 6px;
}

.hourly-scroll::-webkit-scrollbar-track {
  background: #141414;
  border-radius: 4px;
}

.hourly-scroll::-webkit-scrollbar-thumb {
  background: var(--panel-light);
  border-radius: 4px;
}

.hourly-card {
  flex: 0 0 94px;
  scroll-snap-align: start;
  background: #17171b;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.hourly-card.now {
  background: linear-gradient(180deg, rgba(227, 46, 10, 0.22), #17171b);
  border: 1px solid var(--accent-hot);
  box-shadow: 0 4px 14px rgba(227, 46, 10, 0.3);
}

.hourly-time {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--chrome);
}

.hourly-card.now .hourly-time {
  color: var(--accent-hot);
}

.hourly-icon {
  width: 34px;
  height: 34px;
}

.hourly-temp {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

.hourly-rain {
  font-size: 0.72rem;
  color: var(--rain);
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-weight: 600;
}

.hourly-wind {
  font-size: 0.7rem;
  color: var(--muted);
}

/* Weekly List (7 Giorni) */
.weekly-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.weekly-row {
  display: grid;
  grid-template-columns: 130px 42px 1fr 210px 85px 32px;
  align-items: center;
  gap: 0.75rem;
  background: #17171b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: var(--transition);
  cursor: pointer;
  user-select: none;
}

.weekly-row:hover,
.weekly-row:focus-visible {
  background: #202026;
  border-color: rgba(252, 185, 0, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4), 0 0 14px rgba(252, 185, 0, 0.08);
  outline: none;
}

.weekly-row.today {
  border: 1px solid rgba(227, 46, 10, 0.5);
  background: linear-gradient(90deg, rgba(227, 46, 10, 0.15), #17171b);
}

.weekly-row.today:hover {
  background: linear-gradient(90deg, rgba(227, 46, 10, 0.25), #202026);
}

.weekly-date-group {
  display: flex;
  flex-direction: column;
}

.weekly-day-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
}

.weekly-date-sub {
  font-size: 0.75rem;
  color: var(--muted);
}

.weekly-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.weekly-condition-text {
  font-size: 0.85rem;
  color: var(--chrome);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.weekly-temp-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  font-weight: 600;
}

.weekly-temp-bar {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

.weekly-temp-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8 0%, #06b6d4 30%, #f97316 75%, #ef4444 100%);
  box-shadow: 0 0 8px rgba(249, 115, 22, 0.35);
  transition: width 0.3s ease, margin-left 0.3s ease;
}

.temp-min-val {
  color: var(--temp-cool);
  font-variant-numeric: tabular-nums;
  min-width: 26px;
  text-align: right;
  font-weight: 700;
}

.temp-max-val {
  color: var(--temp-hot);
  font-variant-numeric: tabular-nums;
  min-width: 26px;
  text-align: left;
  font-weight: 700;
}

.weekly-rain-wrap {
  font-size: 0.75rem;
  color: var(--rain);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  justify-content: flex-end;
}

.weekly-action-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: var(--transition);
}

.weekly-row:hover .weekly-action-hint {
  color: var(--gold);
  transform: translateX(3px);
}

@media (max-width: 768px) {
  .weekly-row {
    grid-template-columns: 85px 34px 1fr auto auto;
    grid-template-areas:
      "date icon condition rain action"
      "temp temp temp temp temp";
    row-gap: 0.6rem;
    padding: 0.75rem 0.85rem;
  }
  .weekly-date-group { grid-area: date; }
  .weekly-icon { grid-area: icon; }
  .weekly-condition-text { grid-area: condition; font-size: 0.8rem; }
  .weekly-rain-wrap { grid-area: rain; }
  .weekly-action-hint { grid-area: action; }
  .weekly-temp-bar-wrap {
    grid-area: temp;
    display: flex;
    width: 100%;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }
}

/* Monthly Tab (Mese / 16-30 Giorni) */
.monthly-header-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.summary-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.summary-card-title {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-card-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
}

.monthly-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
  gap: 0.65rem;
}

.monthly-day-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  text-align: center;
  font-size: 0.8rem;
  transition: var(--transition);
  cursor: pointer;
  user-select: none;
  min-height: 180px;
}

.monthly-day-card:hover,
.monthly-day-card:focus-visible {
  background: #232329;
  border-color: rgba(252, 185, 0, 0.45);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45), 0 0 12px rgba(252, 185, 0, 0.1);
  outline: none;
}

.monthly-day-card.projected {
  border-style: dashed;
  opacity: 0.88;
  background: rgba(30, 30, 35, 0.6);
}

.monthly-day-card.projected:hover {
  opacity: 1;
  background: #232329;
}

.monthly-card-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}

.monthly-day-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
}

.monthly-weekday {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: capitalize;
}

.monthly-icon-wrap {
  margin: 0.15rem 0;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.monthly-wmo-text {
  font-size: 0.74rem;
  color: var(--chrome);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Microcard Temperature Range Bar */
.monthly-temp-trend-block {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.monthly-temp-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0 0.1rem;
}

.monthly-temp-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.monthly-temp-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #38bdf8 0%, #06b6d4 30%, #f97316 75%, #ef4444 100%);
  box-shadow: 0 0 6px rgba(249, 115, 22, 0.3);
  transition: width 0.3s ease, margin-left 0.3s ease;
}

.monthly-card-foot {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  padding-top: 0.3rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.monthly-rain-chip {
  color: var(--rain);
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-weight: 600;
}

.monthly-detail-pill {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  transition: var(--transition);
}

.monthly-day-card:hover .monthly-detail-pill {
  color: var(--gold);
}

.monthly-detail-pill.projected {
  color: var(--muted-dark);
}

/* ============================================================
   MODAL: DETTAGLIO PREVISIONI GIORNALIERE ED ORARIE
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-overlay.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 880px;
  max-height: 90vh;
  background: #16161a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75), 0 0 35px rgba(252, 185, 0, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.95) translateY(12px);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-header {
  padding: 1.15rem 1.4rem;
  background: #121215;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.modal-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.modal-badge-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.modal-date-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  background: rgba(252, 185, 0, 0.15);
  color: var(--gold);
  border: 1px solid rgba(252, 185, 0, 0.3);
}

.modal-loc-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--chrome);
}

.modal-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}

.modal-subtitle {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.modal-close-btn:hover {
  background: rgba(227, 46, 10, 0.2);
  color: #ff6b6b;
  border-color: rgba(227, 46, 10, 0.4);
  transform: rotate(90deg);
}

.modal-body {
  padding: 1.25rem 1.4rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  -webkit-overflow-scrolling: touch;
}

.modal-body::-webkit-scrollbar {
  width: 6px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--panel-light);
  border-radius: 4px;
}

/* Modal Hero Summary */
.modal-hero-summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.25rem;
  align-items: center;
  background: linear-gradient(135deg, #1b1b22, #15151a);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 1.15rem 1.3rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

@media (max-width: 640px) {
  .modal-hero-summary {
    grid-template-columns: 1fr;
    text-align: center;
  }
}

.modal-hero-icon-block {
  display: flex;
  align-items: center;
  gap: 1rem;
}

@media (max-width: 640px) {
  .modal-hero-icon-block {
    justify-content: center;
  }
}

.modal-hero-icon {
  width: 64px;
  height: 64px;
}

.modal-hero-condition {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
}

.modal-hero-temps {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.35rem;
  margin-top: 0.2rem;
}

/* Modal KPI Grid */
.modal-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.6rem;
}

.modal-kpi-card {
  background: #111114;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.modal-kpi-label {
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.modal-kpi-val {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

/* Hourly Section in Modal */
.modal-section-title-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.modal-section-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.modal-section-badge {
  font-size: 0.7rem;
  color: var(--gold);
  background: rgba(252, 185, 0, 0.12);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(252, 185, 0, 0.25);
}

/* 24h Temperature SVG Curve Container */
.modal-chart-box {
  background: #111114;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  padding: 0.85rem 0.6rem 0.4rem 0.6rem;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}

.modal-curve-svg {
  width: 100%;
  height: auto;
  display: block;
}

/* Modal Hourly Cards Scroll */
.modal-hourly-scroll {
  display: flex;
  gap: 0.65rem;
  overflow-x: auto;
  padding-bottom: 0.65rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.modal-hourly-scroll::-webkit-scrollbar {
  height: 6px;
}

.modal-hourly-scroll::-webkit-scrollbar-thumb {
  background: var(--panel-light);
  border-radius: 4px;
}

.modal-hour-card {
  flex: 0 0 88px;
  scroll-snap-align: start;
  background: #111114;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.45rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-align: center;
  font-size: 0.78rem;
  transition: var(--transition);
}

.modal-hour-card:hover {
  background: #1d1d24;
  border-color: rgba(252, 185, 0, 0.3);
}

.modal-hour-card.current {
  border-color: var(--accent-hot);
  background: linear-gradient(180deg, rgba(227, 46, 10, 0.2), #111114);
  box-shadow: 0 0 12px rgba(227, 46, 10, 0.25);
}

.modal-hour-time {
  font-weight: 700;
  color: var(--chrome);
}

.modal-hour-card.current .modal-hour-time {
  color: var(--accent-hot);
}

.modal-hour-icon {
  width: 32px;
  height: 32px;
  margin: 0.1rem 0;
}

.modal-hour-temp {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--ink);
}

.modal-hour-rain {
  font-size: 0.7rem;
  color: var(--rain);
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-weight: 600;
}

.modal-hour-wind {
  font-size: 0.68rem;
  color: var(--muted);
}

/* Projection Information Notice Box */
.modal-projection-notice {
  background: rgba(252, 185, 0, 0.08);
  border: 1px solid rgba(252, 185, 0, 0.25);
  border-radius: var(--radius);
  padding: 1.25rem 1.4rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.modal-projection-icon {
  color: var(--gold);
  flex-shrink: 0;
  margin-top: 0.2rem;
}

.modal-projection-content h4 {
  margin: 0 0 0.4rem 0;
  font-size: 1.05rem;
  color: var(--gold);
}

.modal-projection-content p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--chrome);
  line-height: 1.5;
}

/* Card 2: Clima & Medie Storiche vs Anno Corrente */
.climate-subtitle {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

.chart-wrapper {
  position: relative;
  width: 100%;
  min-height: 380px;
  background: #101013;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 1rem;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}

.chart-legend-custom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding: 0.5rem 0;
  font-size: 0.85rem;
  color: var(--chrome);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.legend-badge {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
}

.legend-badge.line-hot {
  height: 4px;
  border-radius: 2px;
  background: var(--accent-hot);
}

.legend-badge.line-cool {
  height: 4px;
  border-radius: 2px;
  background: var(--temp-cool);
}

.climate-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.climate-kpi-box {
  background: #16161b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.kpi-title {
  font-size: 0.75rem;
  color: var(--muted);
}

.kpi-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

.kpi-value.anomaly-plus {
  color: var(--accent-hot);
}

.kpi-value.anomaly-minus {
  color: var(--temp-cool);
}

.kpi-desc {
  font-size: 0.72rem;
  color: var(--muted-dark);
}

/* Informative & SEO Guide Section */
.seo-guide-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.seo-guide-section h2 {
  font-size: 1.25rem;
  color: var(--ink);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.seo-guide-section h3 {
  font-size: 1.05rem;
  color: var(--chrome);
  margin: 0.75rem 0 0.35rem 0;
}

.seo-guide-section p {
  margin: 0;
  line-height: 1.6;
}

.seo-guide-section strong {
  color: var(--ink);
}

.seo-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.seo-guide-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Footer */
footer {
  margin-top: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--muted-dark);
}

footer a {
  color: var(--gold);
  text-decoration: none;
  transition: var(--transition);
}

footer a:hover {
  text-decoration: underline;
  color: #fff;
}

/* Loading & Skeletons */
.loader-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  border-top-color: var(--accent-hot);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13, 13, 13, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  z-index: 100;
  border-radius: var(--radius);
  transition: opacity 0.2s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Toast Notification */
.toast-notice {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: #1f1f23;
  color: #fff;
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--accent-hot);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1.25rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.7);
  font-size: 0.85rem;
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.toast-notice.show {
  transform: translateY(0);
  opacity: 1;
}

/* Mobile Optimization for Clear Card Separation & Distinction */
@media (max-width: 768px) {
  .wrap {
    padding: 1rem 0.65rem 3rem 0.65rem;
    gap: 1.85rem;
  }

  .card {
    padding: 1.1rem;
    gap: 1.15rem;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }

  .location-selector {
    padding: 0.95rem;
    border-radius: 14px;
  }

  .card-identity-badge {
    padding-bottom: 0.2rem;
  }

  .card-num-chip {
    font-size: 0.68rem;
    padding: 0.2rem 0.55rem;
  }

  .card-folder-hint {
    font-size: 0.68rem;
  }

  .weather-hero {
    padding: 1rem 0.85rem;
    border-radius: 12px;
    gap: 1.1rem;
  }

  .hero-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }

  .metric-box {
    padding: 0.55rem 0.65rem;
  }

  .folder-section-title {
    font-size: 0.72rem;
    margin-top: 0.25rem;
    margin-bottom: -0.25rem;
  }

  .folder-tabs-header {
    padding: 3px;
    gap: 3px;
    border-radius: 10px;
  }

  .folder-tab {
    padding: 0.55rem 0.35rem;
    font-size: 0.8rem;
    gap: 0.35rem;
  }

  .folder-tab-badge {
    display: none;
  }

  .hourly-card {
    flex: 0 0 86px;
    padding: 0.75rem 0.4rem;
  }

  .chart-wrapper {
    padding: 0.65rem 0.35rem;
    min-height: 310px;
  }

  .climate-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }

  .climate-kpi-box {
    padding: 0.75rem 0.8rem;
  }

  .seo-guide-section {
    padding: 1.1rem;
    border-radius: 14px;
  }
}

