@charset "UTF-8";
/* Tiny Calafell — product shell. One stylesheet, organised by component.
   Painted artwork (plaques, tray, frame, buttons) arrives as CSS variables set by app.js;
   everything readable stays HTML text. The interface frames the map: it never competes with it. */

/* ---------- Typeface ---------- */
/* Lora (SIL Open Font License 1.1, see fonts/OFL.txt), self-hosted so the brand looks the same on every system. */
@font-face { font-family: 'Lora'; src: url('fonts/lora-latin.woff2') format('woff2'); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'Lora'; src: url('fonts/lora-latin-italic.woff2') format('woff2'); font-weight: 400 700; font-style: italic; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  --serif: 'Lora', Georgia, 'Noto Serif', 'DejaVu Serif', serif;
  --sans: 'Trebuchet MS', 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
  --gap: 20px;
  --radius: 18px;
  --atlas-cloth: none; --ui-banner: none; --ui-tray: none; --ui-frame: none;
  --page: #e8e4d7;
  --paper: #fbf5e5; --ink: #2c4436; --muted: #4f6250; --line: #a9a277;
  --accent: #a8492b; --brass: #805c25; --focus: #b5531f;
  --plaque: linear-gradient(#fdf8ea, #f3ecd6); --plaque-ink: #2c4436; --plaque-muted: #4f6250; --plaque-line: #b9b08a;
  --shadow: 0 3px 0 #30483a22, 0 8px 22px #233e3426;
  --label-ink: #fff6dc;
  color-scheme: light;
  color: var(--ink); background: var(--page);
  font: 15px/1.45 var(--sans);
}
:root[data-theme=dark] {
  --page: #15221e;
  --paper: #172e28; --ink: #edf0d7; --muted: #c3ceb7; --line: #728366;
  --accent: #edc783; --brass: #d8b978; --focus: #f7dea1;
  --plaque: linear-gradient(#19372de8, #132e27ed), var(--atlas-cloth);
  --plaque-ink: #f1e7c5; --plaque-muted: #d0d8b9; --plaque-line: #abb78a88;
  --shadow: 0 3px 0 #071e1866, 0 8px 22px #0006;
  color-scheme: dark;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { overflow: hidden; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: transparent; padding: 0; }
button:disabled { opacity: .5; cursor: default; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; }

/* Plaques: painted cloth in dark mode, paper in light mode. Text is always real text. */
.plaque {
  background: var(--plaque); background-size: auto, 240px;
  color: var(--plaque-ink); border: 1px solid var(--plaque-line); border-radius: 23px; box-shadow: var(--shadow);
}

/* ---------- Map ---------- */
#map { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; display: block; }
#map:active { cursor: grabbing; }
#map.over-pin { cursor: pointer; }
/* The canvas fills the viewport: an outer outline would be invisible, so the focus ring is drawn inside. */
#map:focus-visible { outline: 4px solid var(--focus); outline-offset: -6px; }

/* ---------- Brand ---------- */
.brand { position: fixed; top: var(--gap); left: var(--gap); margin: 0; width: 290px; height: 76px; padding: 6px 26px 6px 14px;
  background: var(--ui-banner) center / 100% 100% no-repeat; border: 0; box-shadow: none; filter: drop-shadow(0 4px 3px #071d1855); }
.brand h1 { margin: 0; height: 100%; font-size: inherit; }
.brand button { display: flex; align-items: center; gap: 8px; height: 100%; text-align: left; color: #f1e7c5; border-radius: 12px; }
.brand img { width: 54px; height: 54px; object-fit: contain; filter: drop-shadow(0 3px 2px #0005); }
.brand-name { display: block; font: 26px/1 var(--serif); letter-spacing: -.6px; }
.brand-name b { font-weight: 400; }
.brand small { display: block; margin-top: 5px; font-size: 12px; color: #dfe5ca; }

/* ---------- Heritage ---------- */
.heritage-open { position: fixed; top: calc(var(--gap) + 84px); left: calc(var(--gap) + 10px); display: flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 18px 0 12px; font-size: 14px; }
.heritage-open .icon { width: 26px; height: 26px; background: var(--ui-button-heritage) center / contain no-repeat; }
.heritage-open:hover:not(:disabled) { filter: brightness(1.1); }

/* ---------- Search ---------- */
.search-box { position: fixed; top: calc(var(--gap) + 8px); left: 50%; transform: translateX(-50%); width: min(380px, calc(100vw - 680px));
  min-width: 300px; height: 52px; display: flex; align-items: stretch; padding: 0; z-index: 4; }
.search-box label { display: flex; align-items: center; padding-left: 18px; cursor: text; }
.search-icon { font-size: 26px; color: var(--brass); line-height: 1; }
/* The input fills the plaque: tapping anywhere on it focuses the field. */
.search-box input { flex: 1; min-width: 0; height: 100%; padding: 0 12px; border: 0; background: none; outline: none; font-size: 16px; color: var(--plaque-ink); }
.search-box input::placeholder { color: var(--plaque-muted); opacity: 1; }
.search-box:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.search-box kbd { align-self: center; margin-right: 16px; padding: 1px 6px; border: 1px solid var(--plaque-line); border-radius: 4px; color: var(--plaque-muted); font-size: 13px; }
#results { position: absolute; top: 58px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none; max-height: min(60vh, 460px); overflow: auto;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
:root[data-theme=dark] #results { background: linear-gradient(#142d27f2, #142d27f2), var(--atlas-cloth); background-size: auto, 240px; }
#results button { display: block; width: 100%; min-height: 44px; padding: 9px 12px; text-align: left; border-radius: 10px; font-size: 15px; }
#results button:hover, #results button:focus-visible { background: color-mix(in srgb, var(--accent) 18%, transparent); outline-offset: -3px; }
#results small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
#results .empty { padding: 10px 12px 6px; font-size: 14px; color: var(--muted); }

/* ---------- Navigation console: compass, + / −, «Más» ---------- */
.navigation-console { position: fixed; z-index: 5; top: var(--gap); right: var(--gap); width: 84px; display: flex; flex-direction: column; align-items: center; gap: 12px; pointer-events: none; }
.navigation-console > * { pointer-events: auto; }
.compass-control { position: relative; width: 78px; height: 96px; filter: drop-shadow(0 4px 3px #071d1866); font-size: 30px; color: var(--plaque-ink); }
.compass-control img { display: block; width: 100%; height: 100%; object-fit: contain; }
.compass-control:focus-visible { outline-offset: 2px; border-radius: 45%; }
.north-needle { position: absolute; left: 50%; top: 61%; width: 42%; height: 59%; transform: translate(-50%, -50%) rotate(var(--north-angle, 0deg)); pointer-events: none; }
.north-needle img { display: block; width: 100%; height: 100%; object-fit: contain; }
.north-needle b { position: absolute; left: 50%; top: -12px; transform: translateX(-50%); font: 700 12px var(--serif); color: #f7e9bd; text-shadow: 0 1px 2px #001c16, 0 0 3px #001c16; }
.tools { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 70px; padding: 18px 10px 24px;
  background: var(--ui-tray) center / 100% 100% no-repeat; filter: drop-shadow(0 5px 3px #071d1855); }
.tools button { width: 46px; height: 46px; border-radius: 50%; font-size: 24px; line-height: 1; color: #eedfac;
  background: radial-gradient(circle at 35% 30%, #3c6a52, #173a2d 70%); box-shadow: inset 0 0 0 2px #c9a75f, 0 2px 0 #0b241a;
  transition: filter .12s, transform .12s; }
.tools button.has-button-art { background: var(--button-art) center / contain no-repeat; box-shadow: none; font-size: 0; color: transparent; }
#zoom-in.has-button-art { --button-art: var(--ui-button-zoom-in); }
#zoom-out.has-button-art { --button-art: var(--ui-button-zoom-out); }
#more span { font: 700 26px/1 var(--sans); position: relative; top: -4px; }
.tools button:hover { filter: brightness(1.15); }
.tools button:active { transform: translateY(1px); }

.menu { position: absolute; top: 100%; right: 0; margin-top: -8px; width: 250px; padding: 8px; display: grid; gap: 2px;
  max-height: calc(100dvh - 96px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
:root[data-theme=dark] .menu { background: linear-gradient(#142d27f5, #142d27f5), var(--atlas-cloth); background-size: auto, 240px; }
.menu button { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 10px; text-align: left; border-radius: 10px; font-size: 15px; }
.menu button::before { content: ''; flex: none; width: 28px; height: 28px; background: center / contain no-repeat; }
.menu button[data-icon=save]::before { background-image: var(--ui-button-save); }
.menu button[data-icon=share]::before { background-image: var(--ui-button-share); }
.menu button[data-icon=fullscreen]::before { background-image: var(--ui-button-fullscreen); }
.menu button[data-icon=theme]::before, .menu button[data-icon=theme-dark]::before { background-image: var(--ui-button-theme); }
.menu button[data-icon=about]::before { background-image: var(--ui-button-about); }
.menu button[data-icon=minimap]::before { background-image: var(--ui-frame); }
.menu button[aria-pressed=false] { color: var(--muted); }
.menu button[aria-pressed]::after { content: '✓'; margin-left: auto; color: var(--accent); }
.menu button[aria-pressed=false]::after { content: ''; }
.menu button:hover, .menu button:focus-visible { background: color-mix(in srgb, var(--accent) 16%, transparent); outline-offset: -3px; }
.menu .count { margin-left: auto; min-width: 26px; padding: 0 7px; border-radius: 12px; text-align: center; font-size: 13px; background: color-mix(in srgb, var(--accent) 22%, transparent); }
.language-choice { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; font-size: 13px; border-bottom: 1px solid var(--line); }
.language-choice select { min-height: 44px; max-width: 125px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: var(--paper); color: var(--ink); }

/* ---------- Explore: current place, destinations and tour ---------- */
.explore { position: fixed; left: var(--gap); bottom: 40px; display: flex; align-items: flex-end; gap: 16px; max-width: calc(100vw - 300px); }
.explore-bar { display: flex; align-items: center; gap: 10px; min-height: 64px; min-width: 230px; max-width: 280px; padding: 10px 18px; }
.location { display: flex; align-items: center; gap: 10px; min-width: 0; }
.location-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #e2ce94; box-shadow: 0 0 0 3px #e2ce9440; }
.location strong { display: block; font: 17px/1.2 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.location small { display: block; margin-top: 3px; font-size: 13px; color: var(--plaque-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#explore-toggle { display: none; }
.explore-panel { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.destination-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.destination-heading h2 { margin: 0; padding: 5px 12px; font-size: 14px; font-style: italic; border-radius: 14px 5px 14px 5px;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
:root[data-theme=dark] .destination-heading h2 { background: #18372ce8; color: #e2dfbd; }
.heading-actions { display: flex; gap: 8px; }
#nearby-toggle { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 20px; background: var(--plaque); background-size: auto, 240px; color: var(--plaque-ink); border: 1px solid var(--plaque-line); box-shadow: var(--shadow); }
#nearby-toggle[aria-expanded=true] { background: var(--accent); color: var(--paper); }
.nearby { margin: 0; padding: 6px; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; max-height: 172px; overflow: auto;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
:root[data-theme=dark] .nearby { background: linear-gradient(#142d27f2, #142d27f2), var(--atlas-cloth); background-size: auto, 240px; }
.nearby button { min-height: 40px; padding: 4px 12px; border-radius: 10px; text-align: left; font-size: 14px; }
.nearby button:hover, .nearby button:focus-visible { background: color-mix(in srgb, var(--accent) 16%, transparent); outline-offset: -3px; }
.nearby small { display: block; font-size: 12px; color: var(--muted); }
.nearby .empty { padding: 8px 10px; font-size: 14px; color: var(--muted); }
#tour { min-height: 40px; padding: 0 16px; font-size: 14px; border-radius: 20px; background: var(--plaque); background-size: auto, 240px; color: var(--plaque-ink); border: 1px solid var(--plaque-line); box-shadow: var(--shadow); }
#tour[aria-pressed=true] { background: var(--accent); color: var(--paper); }
#destinations { display: flex; gap: 10px; overflow-x: auto; padding: 4px 4px 8px; scrollbar-width: thin; }
#destinations button { flex: 0 0 auto; width: 100px; overflow: hidden; text-align: center; background: var(--paper); color: var(--ink);
  border: 2px solid var(--line); border-radius: 12px 8px 11px 7px; box-shadow: 2px 3px 0 #0c241a77; transition: transform .15s; }
#destinations button:hover, #destinations button:focus-visible { transform: translateY(-4px); border-color: #e4cf91; }
#destinations button[aria-pressed=true] { border-color: #e4cf91; box-shadow: 0 -2px 0 #e4cf91, 2px 3px 0 #0c241a99; }
#destinations img { display: block; width: 100%; height: 60px; object-fit: cover; padding: 4px 4px 0; border-radius: 10px 6px 0 0; }
#destinations strong { display: block; padding: 6px 4px 8px; font: 14px/1.2 var(--serif); }

/* ---------- Minimap ---------- */
.mini-chart { position: fixed; right: var(--gap); bottom: 40px; width: 230px; height: 188px; filter: drop-shadow(0 5px 3px #071d1877); }
#minimap { position: absolute; left: 6.5%; top: 11.7%; width: 87%; height: 80%; border-radius: 15px; background: #20372d; cursor: crosshair; display: block; }
.mini-frame { position: absolute; inset: 0; background: var(--ui-frame) center / 100% 100% no-repeat; pointer-events: none; }

/* ---------- Status, hint, toast ---------- */
.status-pill { position: fixed; left: 50%; top: 164px; transform: translateX(-50%); max-width: min(90vw, 460px); padding: 9px 16px; text-align: center;
  font-size: 14px; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); pointer-events: none; z-index: 3; }
#loading.retry { pointer-events: auto; cursor: pointer; border-color: var(--accent); }
#toast { top: 212px; }
.hint { position: fixed; left: 50%; top: 96px; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; max-width: min(92vw, 520px); padding: 10px 10px 10px 18px; font-size: 15px; z-index: 2; }
.hint-close { flex: none; width: 36px; height: 36px; border-radius: 50%; font-size: 22px; }

/* ---------- Footer ---------- */
footer { position: fixed; left: 0; right: 0; bottom: 0; min-height: 28px; display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 3px 12px max(3px, env(safe-area-inset-bottom)); font-size: 12px; background: var(--paper); color: var(--muted); border-top: 1px solid #b6b58344; }
footer button { min-height: 24px; padding: 0 6px; white-space: nowrap; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; color: var(--ink); }

/* ---------- Dialogs ---------- */
dialog { width: 470px; max-width: calc(100vw - 24px); max-height: 88dvh; padding: 26px; overflow: auto; line-height: 1.6;
  background: var(--paper); color: var(--ink); border: 12px solid transparent; border-image: var(--ui-frame) 48 35 30 35 stretch; border-radius: 22px; box-shadow: 0 16px 90px #051812a6; }
:root[data-theme=dark] dialog { background: linear-gradient(#142d27b8, #142d27b8), var(--atlas-cloth); background-size: auto, 240px; }
dialog::backdrop { background: #08141099; backdrop-filter: blur(2px); }
:root[data-theme=light] dialog::backdrop { background: #19392b55; }
dialog h2 { margin: 8px 40px 10px 0; font-size: 27px; line-height: 1.15; }
dialog h3 { font-size: 19px; margin: 22px 0 6px; }
dialog p { font-size: 15px; color: var(--muted); }
dialog .close, .sheet-close { position: absolute; right: 12px; top: 10px; width: 44px; height: 44px; border-radius: 50%; font-size: 28px; line-height: 1; color: var(--ink); }
dialog .close:hover, .sheet-close:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.about-icon { display: block; }
dialog .note { padding: 14px 16px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, transparent); margin: 18px 0; }
.note p { margin: 4px 0 0; font-size: 14px; }
.help { font-size: 14px !important; }
#source-credits p { margin: 4px 0; font-size: 14px; }
.privacy { font-size: 13px !important; }
.primary { margin-top: 12px; min-height: 44px; padding: 10px 22px; border-radius: 17px; background: linear-gradient(#254536, #183629), var(--atlas-cloth); background-size: auto, 240px; color: #f1e7c5; border: 1px solid #abb78a88; }
.primary:hover { filter: brightness(1.12); }
#share-url { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: color-mix(in srgb, var(--paper) 80%, white); color: var(--ink); font-size: 14px; }
:root[data-theme=dark] #share-url { background: #15221e; }
#saved-list { display: grid; gap: 8px; margin: 18px 0; }
.saved-row { display: flex; gap: 4px; align-items: center; border-radius: 10px; background: color-mix(in srgb, var(--accent) 10%, transparent); padding: 4px; }
.saved-row button { min-height: 44px; padding: 8px 12px; border-radius: 8px; }
.saved-row button:first-child { flex: 1; text-align: left; }
#error { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(400px, 90vw); padding: 25px; z-index: 5; }

/* Heritage list and site card */
#heritage-dialog { width: min(550px, calc(100vw - 24px)); }
.heritage-list { display: grid; gap: 4px; margin-top: 18px; }
.heritage-place { display: flex; align-items: center; gap: 18px; padding: 12px 4px 16px; text-align: left; border-bottom: 1px solid var(--line); }
.heritage-place img { width: 112px; height: 82px; object-fit: cover; border: 3px solid #c0b58388; border-radius: 7px; box-shadow: 3px 3px 0 #0a1b1466; transform: rotate(-2deg); }
.heritage-place:nth-child(even) img { transform: rotate(2deg); }
.heritage-place strong { display: block; font: 20px var(--serif); }
.heritage-place small { display: block; margin-top: 4px; font-size: 14px; color: var(--muted); }
.heritage-place:hover strong { text-decoration: underline; text-underline-offset: 4px; }
#site-dialog { width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 22px 26px 28px; overscroll-behavior: contain; }
#site-dialog .sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
#site-dialog h2 { margin: 0 44px 16px 0; font-size: 29px; }
.site-gallery { margin: 0; }
.site-art-frame { position: relative; }
.site-art { display: block; width: 100%; height: auto; max-height: 43vh; object-fit: contain; background: #15221e; border: 3px solid #c5bc9299; border-radius: 8px; box-shadow: 3px 3px 0 #081c1770; }
.art-tag { position: absolute; left: 12px; bottom: 12px; padding: 4px 10px; border-radius: 12px; font-size: 13px; background: #102620d9; color: #f6ecd0; }
.site-gallery figcaption { margin-top: 8px; font-size: 13px; line-height: 1.45; color: var(--muted); }
.site-thumbnails { display: flex; gap: 8px; margin: 12px 0 16px; flex-wrap: wrap; }
.site-thumbnails button { padding: 3px; border: 2px solid transparent; border-radius: 6px; }
.site-thumbnails button[aria-pressed=true] { border-color: var(--accent); }
.site-thumbnails img { display: block; width: 72px; height: 53px; object-fit: cover; border-radius: 3px; }
.sheet-meta { display: flex; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.badge { padding: 4px 10px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--brass); }
.sheet-summary { font-size: 17px !important; line-height: 1.6; color: var(--ink) !important; }
.site-map { min-height: 44px; padding: 10px 22px; border-radius: 17px; background: linear-gradient(#254536, #183629), var(--atlas-cloth); background-size: auto, 240px; color: #f1e7c5; border: 1px solid #abb78a88; }
.timeline { list-style: none; border-left: 1px solid #c3b77b66; padding-left: 19px; margin-left: 3px; }
.timeline li { position: relative; padding: 0 0 14px 6px; line-height: 1.65; }
.timeline li::before { content: ''; position: absolute; left: -24px; top: 10px; width: 7px; height: 7px; border: 1px solid var(--brass); background: var(--paper); transform: rotate(45deg); }
.timeline .src { font-size: 13px; }
#site-dialog a, dialog a { color: var(--ink); text-underline-offset: 3px; }
:root[data-theme=dark] #site-dialog a { color: #b9d6a4; }
.links { padding-left: 20px; }
.links li { padding: 6px 0; }
.sheet-note { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px !important; }

/* ---------- Medium screens ---------- */
@media (max-width: 1180px) and (min-width: 651px) {
  .search-box { left: auto; right: 124px; transform: none; width: min(340px, calc(100vw - 480px)); min-width: 240px; }
  .explore { flex-direction: column; align-items: flex-start; width: calc(100vw - 236px); max-width: none; bottom: 36px; }
  .explore-panel { width: 100%; }
  #destinations button { width: 86px; }
  #destinations img { height: 42px; }
  #destinations strong { font-size: 13px; padding: 5px 3px 6px; }
  .explore-bar { min-height: 54px; padding: 6px 16px; }
  .mini-chart { width: 184px; height: 150px; }
}

/* ---------- Phones (portrait) and short screens (landscape phones) ---------- */
@media (max-width: 650px), (max-height: 500px) {
  :root { --gap: 10px; }
  .brand { top: max(8px, env(safe-area-inset-top)); left: 8px; width: 186px; height: 54px; padding: 4px 18px 4px 10px; }
  .brand img { width: 38px; height: 38px; }
  .brand-name { font-size: 20px; }
  .brand small { display: none; }
  .heritage-open { top: max(12px, calc(env(safe-area-inset-top) + 4px)); left: auto; right: 8px; min-height: 44px; padding: 0 14px 0 10px; font-size: 14px; }
  .search-box { top: calc(max(8px, env(safe-area-inset-top)) + 60px); left: 8px; right: 64px; transform: none; width: auto; min-width: 0; height: 48px; }
  .search-box kbd { display: none; }
  .navigation-console { top: calc(max(8px, env(safe-area-inset-top)) + 58px); right: 6px; width: 54px; gap: 8px; }
  .compass-control { width: 52px; height: 62px; }
  .north-needle b { font-size: 10px; top: -10px; }
  .tools { width: 52px; padding: 6px 4px; gap: 6px; background: var(--plaque); background-size: auto, 240px; border: 1px solid var(--plaque-line); border-radius: 26px; filter: none; box-shadow: var(--shadow); }
  .tools button { width: 44px; height: 44px; }
  .menu { position: fixed; top: auto; bottom: 120px; right: 8px; margin: 0; width: min(280px, calc(100vw - 16px)); max-height: calc(100dvh - 144px); }
  .explore { left: 8px; right: 8px; bottom: 34px; max-width: none; flex-direction: column-reverse; align-items: stretch; gap: 8px; }
  .explore-bar { min-width: 0; max-width: none; min-height: 52px; padding: 6px 6px 6px 14px; }
  .location { flex: 1; }
  .location strong { font-size: 16px; }
  .location small { font-size: 12px; }
  #explore-toggle { display: flex; align-items: center; gap: 8px; flex: none; min-height: 44px; padding: 0 14px; border-radius: 20px; font-size: 15px;
    background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--plaque-ink); }
  .chevron { width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(2px) rotate(-135deg); transition: transform .15s; }
  .explore.open .chevron { transform: translateY(-2px) rotate(45deg); }
  .explore-panel { display: none; padding: 10px; border-radius: 20px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); }
  :root[data-theme=dark] .explore-panel { background: linear-gradient(#142d27f2, #142d27f2), var(--atlas-cloth); background-size: auto, 240px; }
  .explore.open .explore-panel { display: flex; }
  .destination-heading h2 { border: 0; background: none !important; padding: 0 4px; }
  #destinations button { width: 92px; }
  #destinations img { height: 52px; }
  .mini-chart { right: 8px; bottom: 96px; width: 150px; height: 122px; }
  .status-pill { top: calc(max(8px, env(safe-area-inset-top)) + 180px); font-size: 13px; }
  #toast { top: calc(max(8px, env(safe-area-inset-top)) + 226px); }
  .hint { top: calc(max(8px, env(safe-area-inset-top)) + 116px); left: 8px; right: 66px; transform: none; max-width: none; font-size: 14px; }
  footer { min-height: 26px; font-size: 11px; gap: 6px; }
  footer button { font-size: 11px; }
  footer #footer-credits { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  #site-dialog { padding: 16px 14px 22px; }
  #site-dialog h2 { font-size: 24px; }
  .site-art { max-height: 34vh; }
  .heritage-place img { width: 90px; height: 69px; }
  .heritage-place strong { font-size: 17px; }
  #heritage-dialog { padding: 18px 14px; }
}
/* Landscape phones: the map needs the height. Keep one compact row of plaques at the top. */
@media (max-height: 500px) {
  .search-box { top: 8px; left: 204px; right: auto; width: min(340px, calc(100vw - 420px)); }
  .navigation-console { top: 8px; flex-direction: row-reverse; width: auto; align-items: flex-start; }
  .compass-control { width: 46px; height: 54px; }
  .tools { flex-direction: row; width: auto; }
  .explore { left: 8px; right: auto; width: min(420px, calc(100vw - 16px)); bottom: 32px; }
  .menu { bottom: auto; top: 64px; max-height: calc(100dvh - 96px); }
  .hint { top: 64px; }
  .heritage-open { top: auto; bottom: 32px; right: 8px; }
}
@media (max-width: 380px) {
  .brand { width: 160px; }
  .brand-name { font-size: 17px; }
  .heritage-open span:last-child { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  #destinations button:hover, #destinations button:focus-visible { transform: none; }
}
