.nowcast-card {
  position: fixed;
  z-index: 655;
  left: 16px;
  top: 205px;
  width: min(310px, calc(100vw - 32px));
  border-radius: 12px;
  padding: 13px 14px;
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}

.nowcast-card.is-hidden {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  pointer-events: none;
}

.nowcast-card__heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.nowcast-card__heading > div {
  display: grid;
  gap: 2px;
}

.nowcast-card__heading strong {
  color: var(--ink);
  font-family: 'Encode Sans Condensed', sans-serif;
  font-size: 16px;
}

.nowcast-card p {
  margin: 9px 0 5px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
}

.nowcast-card small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

.nowcast-badge {
  flex: 0 0 auto;
  min-width: 34px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(88, 70, 209, .10);
  color: var(--brand-violet);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.nowcast-cell-label {
  display: grid;
  place-items: center;
  min-width: 38px;
  min-height: 24px;
  padding: 4px 7px;
  border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: 0 5px 16px rgba(31, 42, 55, .24);
  background: #5846d1;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.05;
  white-space: nowrap;
}

.nowcast-cell-label strong {
  font-size: 10px;
  font-weight: 800;
}

.nowcast-cell-label small {
  margin-top: 2px;
  color: rgba(255, 255, 255, .94);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .01em;
}

.nowcast-cell-label.is-tracked {
  box-shadow:
    0 5px 16px rgba(31, 42, 55, .24),
    0 0 0 2px rgba(255, 255, 255, .35);
}

.nowcast-cell-label.is-strong {
  background: #e05f78;
}

.nowcast-cell-label.is-very-strong {
  background: #b83250;
}

.nowcast-div-icon {
  background: transparent !important;
  border: 0 !important;
}

.nowcast-popup {
  min-width: 270px;
  color: #2f3942;
  font-family: 'Montserrat', sans-serif;
}

.nowcast-popup__heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.nowcast-popup__heading > div {
  display: grid;
  gap: 2px;
}

.nowcast-popup__heading span {
  color: #5846d1;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .11em;
}

.nowcast-popup__heading strong {
  color: #181818;
  font-family: 'Encode Sans Condensed', sans-serif;
  font-size: 18px;
}

.nowcast-popup__heading small {
  color: #71808c;
  font-size: 10px;
  text-align: right;
}

.nowcast-popup__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.nowcast-popup__grid > div {
  display: grid;
  gap: 1px;
  padding: 8px;
  border-radius: 8px;
  background: #f4f8fb;
}

.nowcast-popup__grid span {
  color: #71808c;
  font-size: 9px;
}

.nowcast-popup__grid strong {
  color: #181818;
  font-size: 12px;
}

.nowcast-popup__etas {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(24, 24, 24, .10);
}

.nowcast-popup__etas > span {
  color: #5846d1;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
}

.nowcast-popup__etas ul {
  margin: 6px 0 0;
  padding-left: 17px;
  color: #2f3942;
  font-size: 10px;
  line-height: 1.45;
}

.nowcast-popup__disclaimer {
  display: block;
  margin-top: 9px;
  color: #71808c;
  font-size: 8px;
  line-height: 1.35;
}

@media (max-width: 720px) {
  .nowcast-card {
    top: 150px;
    left: 10px;
    width: min(280px, calc(100vw - 20px));
    padding: 11px 12px;
  }

  .nowcast-card__heading strong {
    font-size: 14px;
  }

  .nowcast-card p {
    font-size: 11px;
  }
}

/* Il pannello di diagnostica si attiva con ?nowcastDebug=1. */
.nowcast-map-actions {
  display: grid;
  justify-items: start;
  gap: 5px;
  margin-top: 8px;
  font-size: 10px;
  line-height: 1.35;
  color: var(--text);
}
.nowcast-map-actions button {
  padding: 6px 9px;
  border: 1px solid rgba(88, 70, 209, .25);
  border-radius: 7px;
  color: var(--brand-violet);
  background: #f3f1ff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}
.nowcast-map-actions button:hover,
.nowcast-map-actions button:focus-visible { background: #e8e3ff; }
.nowcast-map-actions button[hidden],
.nowcast-diagnostics[hidden] { display: none !important; }
.nowcast-diagnostics {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(31, 42, 55, .12);
  color: var(--text);
  font-size: 10px;
}
.nowcast-diagnostics summary { cursor: pointer; font-weight: 700; }
.nowcast-diagnostics dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 10px;
  row-gap: 5px;
  margin: 8px 0 0;
}
.nowcast-diagnostics dt,
.nowcast-diagnostics dd { margin: 0; }
.nowcast-diagnostics dd { font-weight: 700; text-align: right; }
.nowcast-diagnostics .nowcast-debug-note { margin-top: 8px; font-size: 10px; }

.nowcast-historical-help { margin: 8px 0 !important; line-height: 1.4; }
.nowcast-historical-button {
  border: 1px solid rgba(88,70,209,.3);
  border-radius: 7px;
  padding: 8px;
  color: var(--brand-violet);
  background: #f3f1ff;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}
.nowcast-historical-button[hidden] { display: none !important; }


/* Visual distinction: solid observed-cell label, dashed estimated path,
   hollow endpoint and +30 min caption only for reliably tracked cells. */
.nowcast-motion-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  margin-top: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  background: #f4f6ff;
  font-size: 9px;
  color: var(--text);
  line-height: 1.3;
}
.nowcast-motion-legend[hidden] { display: none !important; }
.nowcast-motion-legend span { display: inline-flex; align-items: center; gap: 4px; }
.nowcast-legend-current,
.nowcast-legend-future {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 2px solid #5846d1;
  border-radius: 50%;
  flex: 0 0 auto;
}
.nowcast-legend-current { background: #5846d1; }
.nowcast-legend-future { background: #fff; }
.nowcast-legend-path {
  display: inline-block;
  width: 17px;
  border-top: 2px dashed #5846d1;
  flex: 0 0 auto;
}
.nowcast-future-div-icon {
  border: 0 !important;
  background: transparent !important;
  pointer-events: none;
}
.nowcast-future-label {
  display: inline-block;
  padding: 3px 5px;
  border: 1px solid currentColor;
  border-radius: 5px;
  background: rgba(255, 255, 255, .94);
  color: #5846d1;
  box-shadow: 0 2px 7px rgba(31, 42, 55, .17);
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.nowcast-popup__footprint-note {
  display: block;
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #f4f6ff;
  color: #465368;
  font-size: 9px;
  line-height: 1.45;
}
.nowcast-legend-current,
.nowcast-legend-future {
  width: 15px;
  height: 11px;
  border-radius: 3px;
  background: transparent;
  border: 2px solid #5846d1;
}
.nowcast-legend-future {
  border-style: dashed;
  opacity: .65;
}

/* Diagnostics-only table: never overlays later observations on the past raster. */
.nowcast-verification-actions {
  display: grid;
  gap: 5px;
  margin: 12px 0 8px;
  padding: 9px;
  border: 1px solid rgba(88, 70, 209, .2);
  border-radius: 8px;
  background: #f4f6ff;
}
.nowcast-verification-actions[hidden],
.nowcast-verification-results[hidden] { display: none !important; }
.nowcast-verification-actions button {
  padding: 7px 8px;
  border: 1px solid rgba(88, 70, 209, .35);
  border-radius: 6px;
  background: #fff;
  color: #5846d1;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.nowcast-verification-actions button:disabled {
  opacity: .55;
  cursor: wait;
}
.nowcast-verification-actions small { line-height: 1.45; }
.nowcast-verification-results {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid rgba(31, 42, 55, .15);
  color: var(--text);
  font-size: 10px;
  line-height: 1.4;
}
.nowcast-verification-results section { margin-top: 10px; }
.nowcast-verification-results h4 { margin: 0 0 4px; font-size: 11px; color: var(--ink); }
.nowcast-verification-results p { margin: 5px 0; font-size: 10px; }
.nowcast-verification-results small { display: block; margin-top: 8px; }
.nowcast-verification-scroll {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid rgba(31, 42, 55, .12);
  border-radius: 6px;
}
.nowcast-verification-results table {
  border-collapse: collapse;
  min-width: 520px;
  width: 100%;
  font-size: 9px;
}
.nowcast-verification-results th,
.nowcast-verification-results td {
  padding: 5px 6px;
  border-bottom: 1px solid rgba(31, 42, 55, .1);
  text-align: left;
  white-space: nowrap;
}
.nowcast-verification-results th {
  background: #f4f6ff;
  font-weight: 800;
}

/* Distinct development-only inspection workspace. The background radar
   remains frozen on the selected t0 frame; future VMI appears only here. */
.nowcast-verification-workspace {
  position: fixed;
  z-index: 690;
  top: 90px;
  left: min(300px, 26vw);
  width: min(420px, calc(100vw - 330px));
  max-height: calc(100dvh - 210px);
  overflow-y: auto;
  padding: 14px;
  border: 1px solid rgba(31,42,55,.15);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(21,32,54,.16);
  color: var(--text);
}
.nowcast-verification-workspace[hidden] { display: none !important; }
.nowcast-verification-heading { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.nowcast-verification-heading > div { display: grid; gap: 4px; }
.nowcast-verification-heading strong { font: 800 18px 'Encode Sans Condensed', sans-serif; color: var(--ink); }
.nowcast-verification-heading .eyebrow { font-size: 9px; color: #5846d1; }
.nowcast-verification-workspace p { font-size: 11px; line-height: 1.5; margin: 9px 0; }
.nowcast-verification-controls { display: grid; gap: 7px; margin: 12px 0; }
.nowcast-verification-controls label { font-weight: 800; font-size: 10px; }
.nowcast-verification-controls select { width: 100%; padding: 8px; border: 1px solid #cdd7e3; border-radius: 6px; background: #fff; }
.nowcast-verification-leads { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.nowcast-verification-leads button,
#nowcast-verification-focus { padding: 8px 5px; border: 1px solid #5846d1; border-radius: 7px; background: #fff; color: #5846d1; font-weight: 800; font-size: 10px; cursor: pointer; }
.nowcast-verification-leads button[aria-pressed="true"] { background: #5846d1; color: #fff; }
.nowcast-verification-key { display: grid; gap: 6px; padding: 9px; border-radius: 8px; background: #f4f6ff; font-size: 10px; line-height: 1.4; }
.nowcast-verification-key span { display: flex; align-items: center; gap: 7px; }
.nowcast-verification-key i { width: 18px; height: 10px; flex: 0 0 auto; border: 3px solid #cf4d7a; }
.nowcast-verification-key .nowcast-key-estimated { border-style: dashed; border-color: #5846d1; }
.nowcast-verification-key .nowcast-key-observed { border-style: solid; }
.nowcast-verification-metric-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 7px; margin: 12px 0; }
.nowcast-verification-metric-grid div { display: grid; gap: 3px; background: #f4f8fb; padding: 9px; border-radius: 8px; }
.nowcast-verification-metric-grid span { font-size: 10px; }
.nowcast-verification-metric-grid strong { color: var(--ink); font-size: 16px; }
.nowcast-verification-workspace #nowcast-verification-focus { width: 100%; margin: 9px 0; }
.nowcast-verification-workspace #nowcast-verification-focus:disabled { opacity: .5; cursor: not-allowed; }
.nowcast-verification-workspace small { display: block; font-size: 9px; line-height: 1.5; }
@media (max-width: 980px) {
  .nowcast-verification-workspace { left: 12px; right: 12px; top: auto; bottom: 92px; width: auto; max-height: min(56dvh, 460px); }
}

/* Temporal context and pixel-wise verification, development-only. */
.nowcast-verification-background {
  margin: 10px 0;
  padding: 9px;
  border: 1px solid rgba(88,70,209,.22);
  border-radius: 8px;
  display: grid;
  gap: 7px;
  font-size: 10px;
}
.nowcast-verification-background legend { padding: 0 4px; font-weight: 800; color: var(--ink); }
.nowcast-verification-background label,
.nowcast-verification-difference-control {
  display: flex;
  gap: 7px;
  align-items: center;
  font-size: 10px;
  line-height: 1.4;
  cursor: pointer;
}
.nowcast-verification-background input,
.nowcast-verification-difference-control input { accent-color: #5846d1; }
.nowcast-verification-background small { font-size: 9px; color: var(--muted); }
.nowcast-verification-difference-control {
  background: #f4f8fb;
  border-radius: 7px;
  padding: 8px;
  margin: 8px 0;
  font-weight: 700;
}
.nowcast-verification-difference-key {
  padding: 8px;
  margin: 6px 0 10px;
  display: grid;
  gap: 5px;
  background: #f4f8fb;
  border-radius: 7px;
  font-size: 10px;
}
.nowcast-verification-difference-key[hidden] { display: none !important; }
.nowcast-verification-difference-key span {
  display: flex;
  align-items: center;
  gap: 7px;
}
.nowcast-verification-difference-key i {
  display: inline-block;
  width: 15px;
  height: 11px;
  border: 1px solid rgba(31,42,55,.15);
  border-radius: 2px;
  flex: 0 0 auto;
}
.nowcast-key-overlap { background: #28a36b; }
.nowcast-key-forecast-only { background: #7457d7; }
.nowcast-key-observed-only { background: #d84d82; }
