:root {
  --ground: #EEF0EC;
  --surface: #FFFFFF;
  --surface-2: #F3F5F7;
  --ink: #141A22;
  --muted: #5B6573;
  --line: #DDE2E8;
  --line-strong: #C9CED4;
  --accent: #1B4FD8;
  --accent-ink: #FFFFFF;
  --ontime: #1F6FEB;
  --minor: #E8890C;
  --major: #C42B1C;
  --planned: #8A939E;
  --live-bg: #E7F0FE;
  --live-ink: #123E8C;
  --minor-bg: #FDF1E1;
  --minor-ink: #3D2300;
  --major-bg: #FBE5E3;
  --major-ink: #5C120B;
  --shadow: 0 2px 12px rgba(20, 26, 34, .14);
  --ctrl-bg: #FFFFFF;
  --ctrl-border: #DDE2E8;
  --ctrl-icon-filter: none;
  --sans: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  color-scheme: light;
}

/* Dark: follows the device unless the switch picks light or dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #343B45;
    --surface: #1E242D;
    --surface-2: #262D37;
    --ink: #E6EAF0;
    --muted: #9AA4B1;
    --line: #2A313B;
    --line-strong: #3A424E;
    --accent: #8AB4FF;
    --accent-ink: #0B1B3A;
    --ontime: #4C8DFF;
    --minor: #F0A33A;
    --major: #F0635A;
    --planned: #7D8794;
    --live-bg: #1B2A45;
    --live-ink: #B5CEFF;
    --minor-bg: #3A2A12;
    --minor-ink: #F5C98A;
    --major-bg: #3D1A17;
    --major-ink: #F7B4AE;
    --shadow: 0 2px 14px rgba(0, 0, 0, .5);
    --ctrl-bg: #4B5563;
    --ctrl-border: #6B7585;
    --ctrl-icon-filter: invert(1) brightness(1.6);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --ground: #343B45;
  --surface: #1E242D;
  --surface-2: #262D37;
  --ink: #E6EAF0;
  --muted: #9AA4B1;
  --line: #2A313B;
  --line-strong: #3A424E;
  --accent: #8AB4FF;
  --accent-ink: #0B1B3A;
  --ontime: #4C8DFF;
  --minor: #F0A33A;
  --major: #F0635A;
  --planned: #7D8794;
  --live-bg: #1B2A45;
  --live-ink: #B5CEFF;
  --minor-bg: #3A2A12;
  --minor-ink: #F5C98A;
  --major-bg: #3D1A17;
  --major-ink: #F7B4AE;
  --shadow: 0 2px 14px rgba(0, 0, 0, .5);
    --ctrl-bg: #4B5563;
    --ctrl-border: #6B7585;
    --ctrl-icon-filter: invert(1) brightness(1.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
/* No page zoom: on iPhone a double tap or pinch outside the map enlarged the whole
   app. The map does its own zooming. */
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  display: flex; flex-direction: column; overscroll-behavior: none; -webkit-tap-highlight-color: transparent;
  background: var(--ground); color: var(--ink);
  font: 15px/1.4 var(--sans);
}
button { font: inherit; color: inherit; cursor: pointer; }
.mono { font-family: var(--mono); }

/* Top bar */
.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: relative; z-index: 3;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 18px; font-weight: 700; }
.search {
  position: relative; flex: 1 1 300px; max-width: 520px;
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px;
  border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted);
}
.search:focus-within { border-color: var(--accent); }
.search input { flex: 1; width: 0; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 16px; color: var(--ink); outline: none; }
.search input::-webkit-search-cancel-button { display: none; }
.q-clear { flex: none; width: 32px; height: 32px; margin-right: -6px; border: 0; border-radius: 16px; background: var(--surface-2); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.q-clear[hidden] { display: none; }
.q-clear:not([hidden]) ~ kbd { display: none; }
.search kbd { font-family: var(--mono); font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.results {
  position: absolute; top: 50px; left: 0; right: 0; margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  max-height: 60vh; overflow: auto;
}
.results li button {
  width: 100%; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 10px;
  border: 0; border-radius: 8px; background: transparent; text-align: left;
}
.results li button:hover, .results li button:focus-visible { background: var(--surface-2); outline: none; }
.results .kind { font-size: 12px; color: var(--muted); margin-left: auto; }
.results .empty { padding: 10px; color: var(--muted); }

.theme-btn {
  width: 44px; height: 44px; flex: none; border-radius: 12px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
}
.theme-btn:hover { border-color: var(--line-strong); }
.menu-wrap { position: relative; flex: none; }
.menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; min-width: 220px; margin: 0; padding: 6px; list-style: none;
  border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--line);
}
.menu[hidden] { display: none; }
.menu button { width: 100%; min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: 500 15px var(--sans, inherit); text-align: left; cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: var(--surface-2); outline: none; }
dialog.info {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 64px); overflow-y: auto; padding: 24px; border: 0; border-radius: 20px;
  background: var(--surface); color: var(--ink); box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
}
dialog.info::backdrop { background: rgba(10, 14, 20, .5); }
dialog.info h2 { margin: 0 0 12px; font: 600 22px/1.2 var(--mono); }
dialog.info p { margin: 0 0 12px; font-size: 15px; line-height: 1.5; color: var(--ink); }
dialog.info a { color: var(--accent); }
dialog.info form { display: flex; justify-content: flex-end; margin-top: 8px; }
dialog.info .btn { flex: none; padding: 0 24px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  height: 36px; padding: 0 14px; border-radius: 18px; font-size: 14px; font-weight: 500;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
}
.chips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }

.legend {
  position: absolute; top: 16px; right: 16px; z-index: 2; margin: 0; padding: 10px 14px; list-style: none;
  display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted);
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow);
}
.legend li { display: flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot.ontime { background: var(--ontime); }
.dot.minor { background: var(--minor); }
.dot.major { background: var(--major); }
.dot.planned { border: 2px solid var(--planned); }

/* Map + panel */
.body { flex: 1; display: flex; min-height: 0; }
.mapwrap { position: relative; flex: 1; min-width: 0; }
#map { position: absolute; inset: 0; }
.panel {
  position: relative; width: 380px; flex: none; overflow-y: auto; padding: 24px;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 20px;
}
.panel[hidden] { display: none; }
.panel > * { flex-shrink: 0; }

.status {
  position: absolute; left: 16px; bottom: 16px; z-index: 2;
  display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow); font-size: 14px;
}
.status::before { content: ''; width: 8px; height: 8px; border-radius: 4px; background: var(--ontime); flex: none; }
.status.demo::before { background: var(--minor); }
.status.error::before { background: var(--major); }
.weather {
  position: absolute; left: 16px; bottom: 96px; z-index: 2; max-width: calc(100% - 96px);
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px;
  background: var(--surface); box-shadow: var(--shadow); font-size: 13px; color: var(--muted);
}
.weather[hidden] { display: none; }
.weather strong { font-family: var(--mono); font-size: 15px; color: var(--ink); }
.wx-icon { font-size: 18px; line-height: 1; }
.overlay-ctrl button { display: grid; place-items: center; color: var(--ink); }
.overlay-ctrl button[aria-pressed="true"] { background: var(--ontime); color: #FFFFFF; }

.following {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 2;
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 6px 0 16px; border-radius: 24px;
  background: var(--surface); box-shadow: var(--shadow); color: var(--accent); white-space: nowrap;
}
.following[hidden] { display: none; }
.pointing {
  position: absolute; top: 72px; left: 50%; transform: translateX(-50%); z-index: 2; max-width: calc(100% - 32px);
  height: 40px; padding: 0 16px; border: 0; border-radius: 20px; font: 500 14px var(--sans, inherit);
  background: var(--surface); box-shadow: var(--shadow); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pointing[hidden] { display: none; }
.hunt { display: flex; align-items: center; gap: 10px; height: auto; min-height: 40px; padding: 6px 6px 6px 16px; white-space: normal; z-index: 3; }
.hunt span { flex: 1; }
.hunt button { flex: none; width: 30px; height: 30px; border: 0; border-radius: 15px; background: var(--surface-2); color: var(--ink); display: grid; place-items: center; }
.pointing b { font-family: var(--mono); }
.me-beam { width: 160px; height: 160px; pointer-events: none; }
.me-beam svg { display: block; width: 100%; height: 100%; }
.following span { color: var(--ink); }
.following strong { font-family: var(--mono); }
.following button { width: 38px; height: 38px; border-radius: 19px; border: 0; background: var(--surface-2); display: grid; place-items: center; color: var(--ink); }

/* Panel content */
.handle { display: none; }
.badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 6px; font-weight: 600; }
.badge.live { background: var(--live-bg); color: var(--live-ink); }
.badge.live::before { content: ''; width: 6px; height: 6px; border-radius: 3px; background: var(--ontime); }
.badge.planned { background: var(--surface-2); color: var(--muted); }
.badge.cancelled { background: var(--major-bg); color: var(--major-ink); }
.title { margin: 4px 0 2px; font: 600 28px/1.15 var(--mono); letter-spacing: -.02em; overflow-wrap: anywhere; padding-right: 36px; }
.subtitle { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 15px; color: var(--muted); }
.subtitle i { font-style: normal; opacity: .6; padding: 0 2px; }
.flag { width: 24px; height: 18px; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px var(--line); flex: none; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs button {
  flex: none; height: 40px; padding: 0 10px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
  background: none; font: 600 14px var(--sans, inherit); color: var(--muted); cursor: pointer; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.pane { display: flex; flex-direction: column; gap: 16px; }
.pane[hidden] { display: none; }
.voyage { display: grid; grid-template-columns: auto minmax(40px, 1fr) auto; align-items: end; gap: 12px; }
.end { display: flex; flex-direction: column; min-width: 0; max-width: 120px; }
.end.to { text-align: right; }
.end small { font-size: 12px; font-weight: 600; letter-spacing: .03em; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.end b { font: 600 20px/1.2 var(--mono); overflow-wrap: anywhere; }
.end b.muted { font: 500 13px/1.3 var(--sans, inherit); color: var(--muted); }
.leg { --done: 12%; position: relative; height: 24px; margin-bottom: 2px; }
.leg .done, .leg .todo { position: absolute; top: 11px; height: 0; }
.leg .done { left: 0; width: var(--done); border-top: 2px solid var(--ink); }
.leg .todo { left: var(--done); right: 0; border-top: 2px dotted var(--muted); }
.leg .arrow { position: absolute; top: 3px; left: calc(var(--done) - 9px); width: 18px; height: 18px; fill: var(--c, var(--accent)); }
.times { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.times > div { display: flex; flex-direction: column; min-width: 0; }
.times .to { text-align: right; }
.times small { font-size: 12px; color: var(--muted); }
.times span { font: 500 13px/1.35 var(--mono); white-space: nowrap; }
.times em { font: 500 12px var(--mono); font-style: normal; color: var(--muted); }
.timetable { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: 12px; border: 1px dashed var(--line-strong); }
.timetable[hidden] { display: none; }
.timetable small { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.timetable span { font: 500 14px/1.35 var(--mono); }
.timetable em { font: 500 12px var(--mono); font-style: normal; color: var(--muted); }
.timetable p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stats > div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.stats > div + div { padding-left: 10px; border-left: 1px solid var(--line); }
.stats svg { flex: none; color: var(--muted); }
.stats span { display: flex; flex-direction: column; min-width: 0; }
.stats small { font-size: 12px; color: var(--muted); }
.stats b { font: 600 16px/1.2 var(--mono); white-space: nowrap; }
.updated { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.updated svg { width: 18px; height: 18px; }
.updated b { font-weight: 600; color: var(--ink); }
.route-btn {
  width: 100%; padding: 10px 14px; border: 0; border-radius: 12px; background: var(--surface-2);
  font: 500 14px var(--sans, inherit); color: var(--accent); text-align: left; cursor: pointer; overflow-wrap: anywhere;
}
.route-btn:disabled { color: var(--muted); cursor: default; }
.route-btn:not(:disabled):hover { box-shadow: inset 0 0 0 2px var(--c); }
.muted { color: var(--muted); }
.photo { margin: 0; }
.photo .frame { display: block; border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.photo img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.photo.none .frame { display: none; }
.photo.none figcaption { margin: 0; padding: 10px 14px; border-radius: 12px; background: var(--surface-2); font-size: 13px; white-space: normal; }
.photo figcaption { margin-top: 4px; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.photos-link { font-size: 14px; font-weight: 500; color: var(--accent); text-decoration: none; }
.photos-link:hover { text-decoration: underline; }
.actions { display: flex; gap: 10px; }
.btn {
  flex: 1; height: 48px; border-radius: 12px; font-size: 15px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line-strong); background: var(--surface); text-decoration: none; color: var(--ink);
}
.btn.primary { border: 0; background: var(--accent); color: var(--accent-ink); }
.btn.more { display: none; }

.details h3 { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.details dl { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); }
.details dt, .details dd { margin: 0; padding: 9px 0; border-bottom: 1px solid var(--line); }
.details dt { color: var(--muted); font-size: 14px; padding-right: 16px; }
.details dd { text-align: right; font: 500 14px var(--mono); overflow-wrap: anywhere; }
.details dl > :nth-last-child(-n+2) { border-bottom: 0; }
.note { margin-top: auto; font-size: 12px; color: var(--muted); }
.note a { color: inherit; }
.close { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border: 0; border-radius: 22px; background: transparent; display: grid; place-items: center; }
.close:hover { background: var(--surface-2); }

/* Ship type colours, shared by the chips, the map and the panel */
.chips button { display: inline-flex; align-items: center; gap: 7px; }
.chips button i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; box-shadow: 0 0 0 1.5px var(--surface); }
.chips button[aria-pressed="false"] i { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }
.chips button small { font: 500 12px var(--mono); opacity: .7; }
.shape { display: inline-block; flex: none; color: var(--ink); }
.unknown .shape { color: var(--planned); }
.legend svg.shape { width: 16px; }
.results .dot { flex: none; }
.results .pin { flex: none; color: var(--muted); }

/* MapLibre controls in our colours */
.maplibregl-ctrl-group { background: var(--ctrl-bg); border: 1px solid var(--ctrl-border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
/* Map buttons: separate round buttons, dark with white icons, readable over land, sea and satellite. */
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group { display: flex; flex-direction: column; gap: 10px; background: none; border: 0; box-shadow: none; overflow: visible; }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group button {
  width: 46px; height: 46px; border-radius: 23px; border: 0 !important; background-color: rgba(48, 52, 58, .9); color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25); display: grid; place-items: center;
}
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group button:hover { background-color: rgba(30, 33, 38, .95); }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group button + button { border-top: 0; }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: none !important; background-size: 24px 24px; width: 24px; height: 24px; }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group button.maplibregl-ctrl-zoom-in .maplibregl-ctrl-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M12 5v14M5 12h14'/%3E%3C/svg%3E"); }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group button.maplibregl-ctrl-zoom-out .maplibregl-ctrl-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M5 12h14'/%3E%3C/svg%3E"); }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group button.maplibregl-ctrl-fullscreen .maplibregl-ctrl-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 9V4h5M20 9V4h-5M4 15v5h5M20 15v5h-5M4 4l6 6M20 4l-6 6M4 20l6-6M20 20l-6-6'/%3E%3C/svg%3E"); }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group button.maplibregl-ctrl-shrink .maplibregl-ctrl-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 4v5H4M15 4v5h5M9 20v-5H4M15 20v-5h5'/%3E%3C/svg%3E"); }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group button.maplibregl-ctrl-geolocate .maplibregl-ctrl-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M20 4L4 11l7 2 2 7z'/%3E%3C/svg%3E"); }
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon,
.maplibregl-ctrl-bottom-right .maplibregl-ctrl-group button.maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%234C8DFF' stroke='%234C8DFF' stroke-width='1.8' stroke-linejoin='round'%3E%3Cpath d='M20 4L4 11l7 2 2 7z'/%3E%3C/svg%3E"); }
.maplibregl-ctrl-bottom-right .overlay-ctrl button { color: #FFFFFF; }
.maplibregl-ctrl-bottom-right .overlay-ctrl button[aria-pressed="true"] { background-color: var(--ontime); }
.maplibregl-ctrl-group button { width: 44px; height: 44px; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--ctrl-border); }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: var(--ctrl-icon-filter); }
.maplibregl-ctrl-attrib { font-size: 11px; }
.maplibregl-ctrl.maplibregl-ctrl-attrib { background: var(--surface); color: var(--muted); }
.maplibregl-ctrl-attrib a { color: var(--muted); }
.maplibregl-ctrl-attrib-button { filter: var(--ctrl-icon-filter); }
.maplibregl-ctrl-bottom-left .maplibregl-ctrl-scale { margin: 0 0 64px 16px; }
.maplibregl-ctrl-scale {
  border: 2px solid var(--ink); border-top: 0; background: var(--surface); color: var(--ink);
  font: 500 11px var(--mono); padding: 1px 6px; opacity: .9;
}

/* Phone: floating search, bottom sheet */
@media (max-width: 720px) {
  .panel:not(.expanded) .photo img { aspect-ratio: 3 / 1; }
  .bar {
    position: absolute; top: 0; left: 0; right: 0; padding: calc(env(safe-area-inset-top) + 12px) 16px 0;
    background: transparent; border: 0; pointer-events: none;
  }
  .bar > * { pointer-events: auto; }
  .brand, .search kbd { display: none; }
  .legend { display: none; }
  .theme-btn { width: 48px; height: 48px; border-radius: 24px; border: 0; background: var(--surface); box-shadow: var(--shadow); }
  .menu-wrap { pointer-events: auto; }
  .chips { flex-basis: 100%; }
  .search { flex: 1 1 0; min-width: 0; max-width: none; height: 48px; border-radius: 24px; background: var(--surface); border: 0; box-shadow: var(--shadow); }
  .chips { flex-wrap: nowrap; overflow-x: auto; }
  .chips button { height: 34px; padding: 0 12px; font-size: 13px; box-shadow: var(--shadow); border: 0; flex: none; }
  .following { top: calc(env(safe-area-inset-top) + 112px); }
  .pointing { top: calc(env(safe-area-inset-top) + 168px); }
  .panel {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 4; width: auto; max-height: 50vh;
    padding: 10px 20px calc(env(safe-area-inset-bottom) + 24px); gap: 16px;
    border: 0; border-radius: 28px 28px 0 0; box-shadow: 0 -4px 20px rgba(20, 26, 34, .16);
  }
  .panel.expanded { max-height: 88vh; }
  .handle { display: block; align-self: center; width: 40px; height: 5px; border: 0; padding: 0; border-radius: 3px; background: var(--line-strong); flex: none; }
  .close { top: 8px; right: 8px; width: 40px; height: 40px; border-radius: 20px; background: var(--surface-2); color: var(--ink); }
  .handle { position: relative; }
  .handle::before { content: ''; position: absolute; inset: -14px -40px; } /* bigger target than the bar */
  /* Compact sheet: summary only, so it covers as little map as possible. */
  .panel { gap: 10px; padding-top: 8px; }
  .title { font-size: 20px; margin: 2px 0 0; }
  .subtitle { font-size: 13px; }
  .badges { font-size: 12px; }
  .end b { font-size: 17px; }
  .stats { padding: 8px 0; }
  .stats svg { width: 20px; height: 20px; }
  .stats b { font-size: 15px; }
  .tabs button { height: 36px; font-size: 13px; }
  .panel:not(.expanded) .tabs, .panel:not(.expanded) .times, .panel:not(.expanded) .photos-link { display: none; }
  .btn { height: 42px; font-size: 14px; }
  .panel:not(.expanded) .note { display: none; }
  .btn.more { display: flex; }
  .panel:not(.expanded) .pane.details { display: none; }
  .panel:not(.expanded) .pane[data-pane="voyage"] { display: flex; }
  body.has-panel .status { display: none; }
}
