:root {
  --ocean: #01244c;
  --deep: #06182b;
  --ink: #142538;
  --muted: #5d7083;
  --line: #d9e4ed;
  --paper: #f6f8fa;
  --white: #ffffff;
  --cyan: #00d9e6;
  --teal: #0c8f8f;
  --gold: #f7c600;
  --shadow: 0 18px 50px rgba(12, 25, 42, 0.14);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--paper); }

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
  overflow-x: hidden;
}

button,
input,
select,
textarea { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.map-page,
.map-page main {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--ocean);
}

.archipelago {
  position: relative;
  min-height: 100vh;
}

#background,
#currents {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#background {
  object-fit: cover;
  object-position: center;
}

#currents {
  opacity: 0.45;
  mix-blend-mode: screen;
  pointer-events: none;
}

.map-control {
  position: absolute;
  z-index: 4;
  border: 1px solid rgba(181, 245, 255, 0.62);
  color: var(--white);
  background: rgba(0, 45, 94, 0.72);
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.sound-control {
  right: 20px;
  bottom: 20px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.sound-control svg {
  width: 22px;
  fill: currentColor;
}

.sound-control.is-playing { color: var(--gold); }

.island-hotspot {
  position: absolute;
  z-index: 3;
  left: 12.5%;
  top: 14.5%;
  width: 13.5%;
  height: 14%;
  display: grid;
  place-items: center;
  color: var(--white);
  font-weight: 800;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}

.island-hotspot::before,
.island-hotspot::after {
  content: "";
  position: absolute;
  inset: 18%;
  border: 1px solid rgba(0, 217, 230, 0.72);
  border-radius: 50%;
  box-shadow: 0 0 28px rgba(0, 217, 230, 0.55);
}

.island-hotspot::after {
  inset: 8%;
  animation: pulse 2.8s ease-in-out infinite;
}

.island-hotspot span {
  position: relative;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(0, 43, 88, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(8px);
}

@keyframes pulse {
  0%, 100% { transform: scale(0.92); opacity: 0.28; }
  50% { transform: scale(1.08); opacity: 0.85; }
}

@media (prefers-reduced-motion: reduce) {
  #currents,
  .island-hotspot::after { display: none; }
}

/* ── Mapa do arquipélago v2: dez ilhas, pesquisa, voz e lista em texto ── */
.map-page .archipelago { height: 100vh; height: 100dvh; min-height: 0; }
.map-sr { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.map-skip { position: absolute; left: 12px; top: 0; z-index: 20; transform: translateY(-160%); padding: 10px 14px; background: var(--white); color: var(--ink); border-radius: 8px; font-weight: 700; }
.map-skip:focus { transform: translateY(10px); }
.map-brand { position: absolute; z-index: 4; top: 0; left: 0; right: 0; padding: 18px 76px 34px; text-align: center; color: var(--white); background: linear-gradient(rgba(1, 20, 44, 0.78), rgba(1, 20, 44, 0)); pointer-events: none; }
.map-brand h1 { margin: 0; font-size: clamp(1.25rem, 2.4vw, 1.7rem); letter-spacing: 0.08em; line-height: 1.2; }
.map-brand h1 span { font-weight: 400; letter-spacing: 0.16em; text-transform: uppercase; font-size: 0.62em; margin-left: 0.5em; }
.map-brand p { margin: 4px 0 0; font-size: 0.85rem; color: #d6e8f2; }
.markers { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.island-marker { position: absolute; left: 0; top: 0; width: auto; height: auto; transform: translate(-50%, -50%); display: block; pointer-events: auto; visibility: hidden; white-space: nowrap; color: var(--white); font-size: 0.8rem; font-weight: 700; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8); }
.island-marker.is-placed { visibility: visible; }
.island-marker > span { position: relative; display: block; padding: 5px 10px; border-radius: 999px; background: rgba(0, 30, 62, 0.62); border: 1px solid rgba(255, 255, 255, 0.22); }
.island-marker:not(.is-active) > span { font-weight: 400; color: #dbe9f2; }
.island-hotspot.island-marker { left: 0; top: 0; width: auto; height: auto; display: block; font-size: 0.95rem; }
.island-hotspot.island-marker > span { padding: 9px 15px; background: rgba(0, 43, 88, 0.82); border-color: var(--cyan); }
.island-hotspot.island-marker::before { display: none; }
.island-hotspot.island-marker::after { inset: -9px; border-radius: 999px; }
.sound-control { top: 14px; bottom: auto; right: 14px; z-index: 6; }
.map-dock { position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; padding: 46px 16px calc(14px + env(safe-area-inset-bottom, 0px)); display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; justify-items: center; background: linear-gradient(rgba(1, 20, 44, 0), rgba(1, 20, 44, 0.9) 42%); color: var(--white); }
.map-search { display: flex; gap: 8px; width: min(640px, 100%); padding: 6px; border-radius: 14px; background: var(--white); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35); }
.map-search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 12px; font-size: 1rem; color: var(--ink); }
.map-search input::placeholder { color: #5d7083; }
.map-go { border: 0; border-radius: 10px; padding: 0 18px; min-height: 44px; background: #0a6f6f; color: var(--white); font-weight: 700; cursor: pointer; }
.map-voice { flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; border: 1px solid #c5d3de; background: var(--white); color: #0a6f6f; display: grid; place-items: center; cursor: pointer; }
.map-voice svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.map-voice.is-listening { background: #0a6f6f; color: var(--white); }
.map-status { margin: 0; min-height: 1.2em; font-size: 0.82rem; color: #e6f1f7; text-align: center; }
.island-nav { width: min(980px, 100%); }
.island-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.island-nav a, .island-nav li > span { display: inline-flex; align-items: baseline; gap: 7px; padding: 8px 12px; border-radius: 999px; font-size: 0.85rem; line-height: 1.2; border: 1px solid rgba(255, 255, 255, 0.28); background: rgba(1, 30, 62, 0.72); color: #e6f1f7; }
.island-nav a { background: var(--white); color: var(--ink); border-color: var(--white); font-weight: 700; min-height: 36px; }
.island-nav small { font-size: 0.72rem; font-weight: 400; color: #c9dce8; }
.island-nav a small { color: #0a6f6f; font-weight: 700; }
.map-note { margin: 0; max-width: 760px; font-size: 0.75rem; line-height: 1.5; color: #d6e8f2; text-align: center; }
@media (max-width: 760px) {
  .map-brand { padding: 14px 62px 26px; }
  .map-brand p { font-size: 0.76rem; }
  .island-marker { font-size: 0.72rem; }
  .island-hotspot.island-marker { font-size: 0.85rem; left: 0; top: 0; width: auto; height: auto; }
  .island-hotspot.island-marker span { font-size: inherit; }
  .island-nav a, .island-nav li > span { padding: 7px 10px; font-size: 0.78rem; }
  .map-go { padding: 0 12px; }
  .map-search input { font-size: 0.95rem; padding: 10px 8px; }
  .map-dock { padding-top: 34px; gap: 8px; }
}
@media (max-height: 560px) { .map-note { display: none; } .map-brand p { display: none; } }
@media (max-width: 480px) { .map-brand p { display: none; } .map-brand h1 span { display: block; margin: 2px 0 0; } }
@media (prefers-reduced-motion: reduce) { .island-hotspot.island-marker::after { display: none; } }
.map-page [hidden] { display: none !important; }
.map-voice-note { margin: 0; max-width: 640px; font-size: 0.75rem; line-height: 1.45; color: #e6f1f7; text-align: center; }
@media (max-width: 480px), (max-height: 520px) {
  .island-nav li > span small { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .island-nav li > span { padding: 5px 9px; font-size: 0.74rem; color: #c9dce8; }
  .island-nav ul { gap: 5px; }
  .map-voice-note, .map-note { font-size: 0.7rem; }
  .map-dock { gap: 7px; padding-top: 28px; }
}
@media (max-height: 520px) { .map-brand { padding-top: 8px; } .map-dock { padding-bottom: 8px; } }
.map-note a { color: var(--white); text-decoration: underline; text-underline-offset: 3px; display: inline-block; min-height: 24px; }


/* Menu inicial vertical, discreto e separado do mapa. */
.map-page .map-dock { padding: 8px; border: 1px solid #d1eeff45; border-radius: 18px; background: #032a4780; backdrop-filter: blur(14px); gap: 2px; max-height: calc(100dvh - 390px); }
.map-dock .map-panel { border: 0; border-radius: 10px; background: transparent; box-shadow: none; backdrop-filter: none; }
.map-dock .map-panel + .map-panel { border-top: 1px solid #d1eeff20; }
.map-panel summary:hover { background: #d1eeff0b; border-radius: 10px; }
.map-dock .map-panel summary { min-height: 50px; padding: 12px 13px; }
.map-shortcuts { display: grid; gap: 8px; }
.map-shortcuts a { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; min-height: 44px; font-size: 14px; }
.map-shortcuts a:hover { color: #b9f0ee; }
.map-detail-note { font-size: 12px; line-height: 1.6; margin: 0; color: #d6e8f2; }
.map-detail-note a { text-decoration: underline; text-underline-offset: 3px; }
.emergency-label { display: inline-flex; align-items: center; gap: 10px; }
.emergency-label > span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: #db6d6425; color: #ffc0b7; font-weight: bold; }
.emergency-intro { margin-bottom: 12px; }
.emergency-numbers { display: grid; gap: 6px; margin-bottom: 12px; }
.emergency-numbers a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px; min-height: 46px; border: 1px solid #d1eeff30; border-radius: 8px; font-size: 13px; }
.emergency-numbers a:hover { background: #ffffff0d; }
.emergency-numbers strong { font-size: 22px; font-weight: 400; }
.emergency-numbers a:last-child span:last-child { font-size: 11px; }
.future-safety { margin-top: 18px; padding-top: 15px; border-top: 1px solid #d1eeff30; }
.future-safety strong { display: block; font-size: 14px; font-weight: 400; }
.future-safety > span { display: inline-block; margin: 7px 0 4px; padding: 3px 7px; border-radius: 4px; border: 1px solid #d1eeff35; font-size: 10px; color: #d6e8f2; }
.future-safety p { font-size: 12px; line-height: 1.6; color: #d6e8f2; }
.map-weather { position: absolute; z-index: 5; right: 28px; bottom: 28px; width: 288px; padding: 16px; border: 1px solid #d1eeff45; border-radius: 18px; background: #032a4780; backdrop-filter: blur(14px); color: #fff; }
.weather-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.weather-heading h2 { margin: 0; font-size: 13px; font-weight: 400; letter-spacing: .04em; }
#weather-refresh { width: 44px; height: 44px; border: 0; border-radius: 8px; color: #d6e8f2; background: transparent; font-size: 22px; cursor: pointer; }
#weather-refresh:disabled { opacity: .4; cursor: wait; }
#weather-island { width: 100%; background: #052d4d; color: #e6f1f7; border: 1px solid #d1eeff30; border-radius: 7px; min-height: 38px; padding: 7px 8px; font-size: 12px; }
.weather-data { display: flex; align-items: center; gap: 14px; margin-top: 13px; }
#weather-temperature { font-size: 32px; line-height: 1; font-weight: 400; white-space: nowrap; }
.weather-data > div { display: grid; gap: 4px; font-size: 12px; color: #e6f1f7; }
.weather-status { font-size: 11px; color: #d6e8f2; margin: 10px 0 0; line-height: 1.5; }
.weather-credit { font-size: 10px; color: #d6e8f2; margin: 6px 0 0; }
.weather-credit a { text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 760px) {
  .map-page .map-dock { max-height: none; }
  .map-weather { position: relative; right: auto; bottom: auto; width: min(420px, 100%); margin: 16px auto 0; }
}
@media (min-width: 761px) and (max-height: 600px) {
  .map-page .map-dock { top: 80px; max-height: calc(100dvh - 340px); }
  .map-weather { bottom: 14px; padding: 12px; }
  .map-dock .map-panel summary { min-height: 44px; padding: 8px 13px; }
}

/* Partilhado com entregas.html */
/* Mapa integral: reservar mar para controlos, nunca recortar as ilhas. */
.map-page { background: #03254a; overflow-x: clip; overflow-y: auto; }
.map-page .archipelago { min-height: 100dvh; height: 100dvh; background: radial-gradient(ellipse at 88% 45%, #073962, #03254a 65%); }
.map-page .archipelago::before { content: ''; position: absolute; inset: 0; pointer-events: none; background: url('assets/cvdn-mar-nuvens-1600.webp') right center / 600% 100% no-repeat; opacity: .3; }
.map-page #background { inset: 76px 344px 26px 18px; width: calc(100% - 362px); height: calc(100% - 102px); object-fit: contain; object-position: center; }
.map-page #background { mask-image: linear-gradient(to right, transparent, #000 2%, #000 98%, transparent), linear-gradient(to bottom, transparent, #000 2%, #000 98%, transparent); mask-composite: intersect; }
.map-brand { left: 18px; right: 344px; top: 22px; padding: 0; background: none; }
.map-brand h1 { font-size: clamp(21px, 2vw, 30px); font-weight: 400; letter-spacing: .025em; text-shadow: 0 2px 14px #001b38; }
.map-dock { left: auto; right: 28px; top: 108px; bottom: auto; width: 288px; padding: 0; gap: 12px; background: none; justify-items: stretch; max-height: calc(100dvh - 136px); overflow-y: auto; scrollbar-width: thin; }
.map-panel { border: 1px solid #c7e9ff40; border-radius: 14px; background: #04294b99; backdrop-filter: blur(12px); box-shadow: 0 8px 24px #001b3820; }
.map-panel summary { display: flex; align-items: center; justify-content: space-between; min-height: 52px; padding: 14px 18px; cursor: pointer; list-style: none; font-size: 15px; }
.map-panel summary::-webkit-details-marker { display: none; }
.map-panel summary::after { content: '+'; font-size: 22px; font-weight: 400; color: #b4e3ee; }
.map-panel[open] summary::after { content: '−'; }
.map-panel[open] summary { border-bottom: 1px solid #c7e9ff22; }
.map-panel-content { padding: 16px; }
.map-search { width: 100%; flex-wrap: wrap; border-radius: 10px; box-shadow: none; gap: 6px; }
.map-search input { flex-basis: calc(100% - 58px); width: 100%; padding: 10px 6px; font-size: 15px; }
.map-go { width: 100%; }
.map-status:empty { display: none; }
.map-status { margin-top: 12px; text-align: left; }
.map-voice-note { margin-top: 12px; text-align: left; font-size: 12px; }
.island-nav { width: 100%; }
.island-nav ul { display: grid; grid-template-columns: 1fr; gap: 6px; }
.island-nav a, .island-nav li > span { display: flex; justify-content: space-between; width: 100%; min-height: 44px; padding: 10px; border-radius: 8px; font-size: 14px; }
.island-nav li > span small { position: static; width: auto; height: auto; margin: 0; clip: auto; overflow: visible; white-space: normal; font-size: 11px; }
.map-dock .sound-control { position: static; width: 100%; height: auto; min-height: 44px; display: flex; gap: 12px; padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.map-note { display: block; margin-top: 16px; text-align: left; font-size: 12px; }
@media (max-width: 760px) {
  .map-page .archipelago { height: auto; min-height: 100dvh; padding: calc(110px + 56.25vw) 16px 24px; overflow: visible; }
  .map-page #background { inset: 86px 0 auto; width: 100%; height: 56.25vw; }
  .map-brand { left: 16px; right: 16px; top: 24px; }
  .map-brand h1 { font-size: 23px; }
  .map-dock { position: relative; top: auto; right: auto; left: auto; bottom: auto; width: min(420px, 100%); margin: 0 auto; max-height: none; overflow: visible; }
  .island-marker { font-size: 9px; }
  .island-marker:not(.is-active) { display: none; }
  .island-marker > span { padding: 3px 5px; }
  .island-hotspot.island-marker { font-size: 10px; }
  .island-hotspot.island-marker > span { padding: 6px; }
  .island-hotspot.island-marker::after { inset: -4px; }
}

.brand {
  display: flex;
  flex-direction: column;
  min-width: 145px;
  font-weight: 800;
  line-height: 1.05;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--white);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

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

.btn.dark {
  border-color: var(--deep);
  background: var(--deep);
  color: var(--white);
}

.btn.ghost { background: transparent; }

/* Imagem original como fundo contínuo. Um só menu sobre o mar. */
.map-page, .map-page .archipelago { height: 100dvh; min-height: 100dvh; padding: 0; overflow: hidden; background: var(--ocean); }
.map-page .archipelago::before { content: none; }
.map-page #background { inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; mask-image: none; }
.map-page .map-brand { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); }
.map-tools { position: absolute; z-index: 6; top: 16px; bottom: 16px; right: 16px; width: clamp(184px, 13.7vw, 210px); display: flex; flex-direction: column; justify-content: space-between; gap: 12px; color: white; }
.map-menu { border: 1px solid #ffffff35; border-radius: 12px; background: #01244c25; backdrop-filter: blur(3px); }
.map-menu > summary { display: flex; align-items: center; gap: 11px; padding: 13px 15px; min-height: 48px; cursor: pointer; list-style: none; font-size: 14px; }
.map-menu > summary::-webkit-details-marker { display: none; }
.map-menu > summary svg { width: 21px; height: 21px; stroke: currentColor; stroke-width: 1.5; fill: none; }
.map-menu[open] > summary { border-bottom: 1px solid #ffffff30; }
.map-page .map-dock { position: static; width: 100%; margin: 0; padding: 4px 6px; border: 0; border-radius: 0; background: transparent; backdrop-filter: none; max-height: max(100px,calc(100dvh - 265px)); overflow-y: auto; gap: 0; }
.map-dock .map-panel, .map-panel summary:hover { border-radius: 0; }
.map-dock .map-panel summary { min-height: 44px; padding: 9px 8px; font-size: 13px; }
.map-panel-content { padding: 10px 8px; }
.map-tools .map-weather { position: static; flex-shrink: 0; width: 100%; margin: 0; padding: 10px; background: #01244c25; border: 1px solid #ffffff35; border-radius: 12px; backdrop-filter: blur(3px); }
.map-tools #weather-temperature { font-size: 24px; }
.map-tools { text-shadow: 0 1px 3px #001426; }
.map-tools .map-weather { background: #01244c40; }
.map-tools .weather-data { gap: 9px; }
.map-tools #weather-island { font-size: 11px; padding: 6px; }
.emergency-numbers strong { font-size: 16px; }
.emergency-numbers a { padding: 9px 6px; font-size: 12px; }
.contact-pending { display: flex; justify-content: space-between; gap: 8px; padding: 10px 6px; font-size: 12px; border: 1px solid #d1eeff30; border-radius: 8px; }
.contact-pending small { font-size: 10px; color: #d6e8f2; }
.map-menu .map-detail-note, .map-menu .future-safety p { font-size: 11px; }
.map-tools { display: block; }
.map-menu > summary { min-height: 46px; padding: 11px 14px; font-size: 13px; letter-spacing: .04em; }
.map-page .map-dock { max-height: max(120px,calc(100dvh - 180px)); }
.map-tools .map-weather { position: fixed; right: 16px; bottom: 16px; width: min(430px,calc(100% - 32px)); display: grid; grid-template-columns: minmax(130px,1fr) auto minmax(80px,auto) 36px; align-items: center; column-gap: 10px; row-gap: 4px; padding: 8px 12px; background: #01244c40; border-radius: 9px; }
.map-weather .weather-heading,.map-weather .weather-data { display: contents; }
.map-weather .weather-heading h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.map-weather #weather-island { grid-column: 1; grid-row: 1; min-height: 36px; font-size: 12px; }
.map-weather #weather-temperature { grid-column: 2; grid-row: 1; font-size: 23px; }
.map-weather .weather-data > div { grid-column: 3; grid-row: 1; font-size: 11px; }
.map-weather #weather-refresh { grid-column: 4; grid-row: 1; width: 36px; height: 44px; font-size: 21px; }
.map-weather .weather-status { grid-column: 1 / 3; grid-row: 2; margin: 0; font-size: 10px; }
.map-weather .weather-credit { grid-column: 3 / 5; grid-row: 2; margin: 0; font-size: 9px; text-align: right; }
@media (max-width: 760px) {
  .map-page #background { object-fit: contain; object-position: center top; }
  .map-tools { top: calc(56.25vw + 14px); bottom: auto; right: 14px; width: min(230px,calc(100% - 28px)); }
  .map-page .map-dock { max-height: max(100px,calc(100dvh - 56.25vw - 175px)); }
  .map-tools .map-weather { right: 10px; bottom: 10px; width: calc(100% - 20px); padding: 6px 8px; grid-template-columns: minmax(110px,1fr) auto minmax(75px,auto) 30px; column-gap: 6px; }
  .map-weather #weather-island { font-size: 11px; }
  .map-weather #weather-refresh { width: 30px; }
  .map-weather #weather-temperature { font-size: 21px; }
}

/* Telemóvel: o fundo decorativo usa a mesma imagem de 900 px que o mapa já carregou (poupa ~220 KB). */
@media (max-width: 900px) { .map-page .archipelago::before { background-image: url('assets/cvdn-mar-nuvens-900.webp'); } }

/* Tablet ao alto: com "cover" a imagem cortava São Vicente e Santo Antão. Mostra o arquipélago inteiro. */
@media (min-width: 761px) and (orientation: portrait) {
  .map-page #background { object-fit: contain; object-position: center top; }
}

/* Enquadramento centrado: preservar a imagem inteira em qualquer proporção de ecrã. */
.map-page #background { object-fit: contain; object-position: center center; }
.map-tools { top: max(16px, calc((100dvh - 56.25vw) / 2 + 16px)); right: max(16px, calc((100vw - 177.7778dvh) / 2 + 16px)); }
.map-tools .map-weather { right: max(16px, calc((100vw - 177.7778dvh) / 2 + 16px)); bottom: max(16px, calc((100dvh - 56.25vw) / 2 + 16px)); }
@media (max-width: 760px) and (orientation: portrait) {
  .map-page #background { object-position: center top; }
  .map-tools { top: calc(56.25vw + 14px); right: 14px; }
  .map-tools .map-weather { right: 10px; bottom: 10px; }
}
/* Telemóvel deitado: o MENU ficava abaixo do ecrã. Fica no canto superior direito, e a meteorologia mais estreita. */
@media (max-width: 760px) and (orientation: landscape) {
  .map-page #background { inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center top; }
  .map-tools { top: 10px; right: 10px; width: min(220px, calc(100% - 20px)); }
  .map-tools .map-weather { width: min(380px, calc(100% - 20px)); }
}

/* Nomes sobre o mar; São Vicente é uma área de clique transparente sobre a ilha. */
.map-page .island-marker > span { padding: 4px 8px; background: #01244c22; border-color: #ffffff20; font-size: 12px; font-weight: 400; text-shadow: 0 1px 4px #001426, 0 0 8px #001426; }
.map-page .island-marker:not(.is-active) { pointer-events: none; }
.map-page a.island-marker.island-link { pointer-events: auto; min-width: 44px; min-height: 44px; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.map-page a.island-link:hover > span,.map-page a.island-link:focus-visible > span { border-color: #8deeff90; background: #01244c66; }
.map-page .island-hotspot.island-marker { background: transparent; border: 0; border-radius: 45%; box-shadow: none; cursor: pointer; }
.map-page .island-hotspot.island-marker::before,.map-page .island-hotspot.island-marker::after { display: none; }
.map-page .island-hotspot.island-marker > span { position: absolute; left: 50%; top: calc(50% + var(--island-label-offset)); transform: translate(-50%,-50%); padding: 4px 8px; background: #01244c22; border-color: #8deeff50; font-size: 12px; font-weight: 600; }
.map-page .island-hotspot.island-marker:hover,.map-page .island-hotspot.island-marker:focus-visible { outline: 1px solid #9beeff90; outline-offset: 3px; background: #79efff08; }
@media (max-width: 760px) {
  .map-page .island-marker:not(.is-active) { display: block; }
  .map-page .island-marker > span,.map-page .island-hotspot.island-marker > span { font-size: 8px; padding: 2px 4px; }
  .map-page .island-hotspot.island-marker > span { left: 20%; }
}

/* Alertas: avisos oficiais (alertas.json) e indicações da previsão. */
.map-tools { justify-content: flex-start; }
.map-tools .map-weather { margin-top: auto; }
.map-alerts { flex-shrink: 0; width: 100%; padding: 10px 12px; color: #fff; background: #01244c25; border: 1px solid #ffffff35; border-radius: 12px; backdrop-filter: blur(3px); }
.alerts-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.alerts-heading h2 { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.alerts-heading span { font-size: 11px; color: #d6e8f2; }
.alerts-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.alerts-list:empty { display: none; }
.alert-item { display: grid; gap: 3px; padding: 8px 10px; border-radius: 9px; border-left: 4px solid #9fd8ea; background: #ffffff12; font-size: 12px; line-height: 1.4; }
.alert-item strong { font-size: 13px; }
.alert-item small { font-size: 10.5px; color: #d6e8f2; }
.alert-item a { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.alert-urgente { border-left-color: #ff6b5e; background: #ff6b5e26; }
.alert-aviso { border-left-color: #ffc44d; background: #ffc44d1f; }
.alert-previsao { border-left-color: #ffc44d; }
.alerts-empty { margin: 6px 0 0; font-size: 12px; color: #e6f1f7; }
.alerts-empty::before { content: '✓ '; color: #8fe3a8; }
.alerts-sources { margin: 6px 0 0; font-size: 10.5px; color: #d6e8f2; }
.alerts-sources a { color: #fff; text-decoration: underline; text-underline-offset: 2px; display: inline-block; min-height: 24px; line-height: 24px; }

/* Telemóvel ao alto (pedido do Heider, 14/10): as ilhas ocupam a largura toda, sem mar vazio;
   MENU no canto superior direito, sobre o mar; meteorologia e alertas por baixo, até ao fim do ecrã. */
@media (max-width: 760px) and (orientation: portrait) {
  .map-page .archipelago { display: flex; flex-direction: column; height: auto; min-height: 100dvh; padding: 0; overflow: visible; overflow-x: clip; }
  .map-page .archipelago::before { opacity: .22; }
  .map-page #background { position: relative; inset: auto; display: block; flex-shrink: 0; width: 125vw; max-width: none; height: calc(125vw * .5625); margin-left: -12.5vw; object-fit: contain; object-position: center; }
  .map-tools { position: static; width: auto; flex: 1; display: flex; flex-direction: column; gap: 10px; padding: 4px 12px 14px; }
  .map-tools .map-menu { position: absolute; z-index: 8; top: 10px; right: 10px; background: #01244c66; backdrop-filter: blur(6px); }
  .map-tools .map-menu > summary { min-height: 44px; padding: 10px 12px; font-size: 13px; }
  .map-tools .map-menu[open] { width: min(320px, calc(100vw - 20px)); }
  .map-tools .map-menu .map-dock { max-height: calc(100dvh - 70px); overflow-y: auto; }
  .map-tools .map-weather { position: static; width: 100%; margin: 0; right: auto; bottom: auto; }
  .map-tools .map-alerts { flex: 1; }
}
.map-quick { display: none; }
@media (max-width: 760px) and (orientation: portrait) {
  .map-tools .map-alerts { flex: 0 0 auto; }
  .map-quick { display: grid; gap: 10px; margin-top: auto; }
  .quick-primary { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; border-radius: 12px; background: #0b6f70; color: #fff; font-size: 16px; font-weight: 600; text-decoration: none; box-shadow: 0 6px 18px #00122a55; }
  .quick-emergency { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .quick-emergency a { display: grid; justify-items: center; gap: 2px; min-height: 52px; padding: 7px 4px; border-radius: 12px; border: 1px solid #ff8a8066; background: #ff6b5e1f; color: #fff; text-decoration: none; }
  .quick-emergency strong { font-size: 18px; line-height: 1.1; }
  .quick-emergency span { font-size: 11px; color: #ffe1dd; }
}
@media (max-width: 760px) and (orientation: portrait) {
  .map-tools { justify-content: space-between; gap: 12px; }
  .map-quick { margin-top: 0; }
}

/* Telemóvel ao alto, versão final (Heider, 14/10): mapa reorganizado em ecrã inteiro (assets/cvdn-archipelago-retrato-*.webp).
   As ilhas enchem o ecrã; MENU no canto superior direito sobre o mar; meteorologia e alertas em baixo, sobre o mar. */
@media (max-width: 760px) and (orientation: portrait) {
  .map-page .archipelago { display: block; height: 100dvh; min-height: 0; padding: 0; overflow: hidden; }
  .map-page .archipelago::before { display: none; }
  .map-page picture { display: contents; }
  .map-page #background { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; max-width: none; object-fit: cover; object-position: center top; mask-image: none; }
  .map-page .archipelago::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 34%; pointer-events: none; background: linear-gradient(to bottom, transparent, #011d3acc 70%); z-index: 1; }
  .map-tools { position: absolute; inset: 0; z-index: 6; width: auto; padding: 10px; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; pointer-events: none; }
  .map-tools > * { pointer-events: auto; }
  .map-tools .map-menu { position: absolute; top: 10px; right: 10px; }
  .map-tools .map-weather, .map-tools .map-alerts { position: static; flex: 0 0 auto; width: 100%; margin: 0; background: #01244c99; backdrop-filter: blur(8px); }
  .map-quick { display: none; }
  .map-page .island-marker > span, .map-page .island-hotspot.island-marker > span { font-size: 10px; padding: 2px 6px; }
  .map-page .island-hotspot.island-marker > span { left: 50%; }
}
/* Ecrãs baixos ao alto (ex.: 360×640, iPhone SE): cartões compactos para não taparem Santiago e Maio. */
@media (max-width: 760px) and (orientation: portrait) and (max-height: 720px) {
  .map-tools { gap: 6px; padding: 8px; }
  .map-tools .map-weather { padding: 6px 8px; row-gap: 2px; }
  .map-tools .map-weather .weather-status { display: none; }
  .map-tools .map-alerts { padding: 7px 10px; }
  .map-alerts .alerts-heading { display: none; }
  .map-alerts .alerts-empty { margin: 0; font-size: 11.5px; }
  .map-alerts .alerts-sources { margin-top: 2px; font-size: 10px; }
  .map-alerts .alerts-sources a { min-height: 24px; line-height: 24px; }
}
/* Telemóvel deitado: o quadro de alertas só aparece quando há alertas, para não tapar Sal e Boa Vista. */
@media (max-width: 760px) and (orientation: landscape) {
  .map-alerts:has(.alerts-list:empty) { display: none; }
}
@media (max-width: 760px) and (orientation: portrait) and (max-height: 720px) {
  .map-page #background { height: calc((100dvh - 165px) / .70); object-fit: contain; object-position: center top; }
  .map-page .archipelago { background: #062f5c; }
}
/* Telemóvel ao alto (Heider, 14/10, 22h): só as ilhas e o MENU. Sem meteorologia nem alertas neste ecrã. */
@media (max-width: 760px) and (orientation: portrait) {
  .map-tools .map-weather, .map-tools .map-alerts, .map-quick { display: none; }
  .map-page .archipelago::after { display: none; }
  .map-page #background { height: 100%; object-fit: cover; object-position: center center; }
}
/* Ecrãs ao alto mais largos do que a imagem (ex.: 360×640): a imagem inteira, com o mesmo mar desfocado nas margens. */
@media (max-width: 760px) and (orientation: portrait) and (max-aspect-ratio: 1/2) { .map-page #background { object-fit: cover; } }
@media (max-width: 760px) and (orientation: portrait) and (min-aspect-ratio: 1/2) {
  .map-page #background { height: 100%; object-fit: contain; object-position: center center; }
  .map-page .archipelago::before { display: block; content: ''; position: absolute; inset: -20px; opacity: 1; background: url('assets/cvdn-mar-nuvens-retrato-600.webp') center / cover no-repeat; filter: blur(10px) brightness(.85); }
}
@media (max-width: 760px) and (orientation: portrait) and (min-aspect-ratio: 1/2) {
  .map-page .archipelago::before { background: radial-gradient(ellipse at 50% 45%, #0d4a8c, #062f5f 75%); filter: none; }
}

/* ── Mapa adaptativo (pedido do Heider, 15/10/2026, 21:23) ──────────────────────────────────────────
   O mar e as nuvens da imagem original enchem o ecrã em qualquer formato (sem faixas laterais).
   Cada ilha é um recorte da imagem original, colocado na posição geográfica e sempre com a sua proporção;
   as distâncias entre ilhas abrem-se para ocupar o ecrã. Gerado por ferramentas/gerar_mapa_ilhas.py. */
.map-page #background { inset: 0 !important; width: 100% !important; height: 100% !important; max-width: none !important; margin: 0 !important; position: absolute !important; object-fit: cover !important; object-position: center !important; }
.map-page .archipelago::before { content: none !important; }
.map-page .markers { position: absolute; inset: 0; --u: min(100vw, 177.78dvh); }
.map-page .markers a.ilha.island-marker { position: absolute; left: calc(var(--x) * 100%); top: calc(var(--y) * 100%); width: calc(var(--w) * var(--u)); height: auto; min-width: 0; min-height: 0; padding: 0; margin: 0; display: block; visibility: visible; transform: translate(-50%, -50%); background: none; border: 0; border-radius: 0; box-shadow: none; pointer-events: auto; text-decoration: none; }
.map-page .markers a.ilha.island-marker img { display: block; width: 100%; height: auto; pointer-events: none; }
.map-page .markers a.ilha.island-marker > span { position: absolute; left: 50%; top: auto; bottom: 0; transform: translate(-50%, 70%); white-space: nowrap; padding: 4px 9px; font-size: 12px; line-height: 1.25; border-radius: 999px; background: #01244c99; border: 1px solid #ffffff2e; color: #e8f3f8; text-shadow: 0 1px 4px #001426; }
.map-page .markers a.ilha.island-hotspot > span { font-weight: 700; color: #fff; border-color: #8deeff80; background: #002b58cc; }
.map-page .markers a.ilha.island-marker:hover img, .map-page .markers a.ilha.island-marker:focus-visible img { filter: brightness(1.12) drop-shadow(0 0 10px #8deeffaa); }
.map-page .markers a.ilha.island-marker:focus-visible { outline: 2px solid #8deeff; outline-offset: 4px; border-radius: 12px; }
@media (min-width: 761px), (orientation: landscape) {
  .map-tools { top: 16px !important; right: 16px !important; }
  .map-tools .map-weather { right: 16px !important; bottom: 16px !important; }
}
/* Telemóvel e tablet ao alto: disposição geográfica num ecrã alto. */
@media (max-width: 1100px) and (orientation: portrait) {
  .map-page .markers { --u: min(100vw, 46.15dvh); }
  .map-page .markers a.ilha.island-marker { left: calc(var(--px) * 100%); top: calc(var(--py) * 100%); width: calc(var(--pw) * var(--u)); }
  .map-page .markers a.ilha.island-marker > span { font-size: 10px; padding: 2px 7px; }
}
@media (prefers-reduced-motion: no-preference) { .map-page .markers a.ilha.island-marker img { transition: filter .2s; } }
/* Tablet ao alto: as ilhas ficam à esquerda da coluna do MENU, dos alertas e da meteorologia. */
@media (min-width: 761px) and (max-width: 1100px) and (orientation: portrait) {
  .map-page .markers { right: 250px; --u: min(calc(100vw - 250px), 46.15dvh); }
}
/* Telemóvel deitado (ecrã baixo): as ilhas ficam acima da meteorologia; nomes mais pequenos. */
@media (orientation: landscape) and (max-height: 500px) {
  .map-page .markers { top: 50px; bottom: 96px; --u: min(100vw, calc((100dvh - 146px) * 1.7778)); }
  .map-page .markers a.ilha.island-marker > span { font-size: 9px; padding: 1px 6px; }
}
