/* Earth Atlas — dark "glass" UI floating over satellite imagery. */

:root {
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --glass: rgba(13, 19, 33, 0.84);
  --glass-strong: rgba(13, 19, 33, 0.94);
  --solid: #111a2c;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #e9eef7;
  --muted: #9aa8bd;
  --faint: #6b7a92;
  --hover: rgba(255, 255, 255, 0.06);
  --press: rgba(255, 255, 255, 0.1);
  --accent: #5b9dff;
  --accent-strong: #3b82f6;
  --accent-soft: rgba(91, 157, 255, 0.16);
  --danger: #f87171;

  --radius: 16px;
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.38), 0 2px 6px rgba(0, 0, 0, 0.25);
  --panel-w: 384px;
  --gap: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #02040a;
  color: var(--text);
  font: 14px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}

button:disabled {
  cursor: default;
  opacity: 0.35;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

kbd {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  font: 600 11px/16px var(--font);
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

svg {
  flex: none;
}

.muted {
  color: var(--muted);
}

.glass,
.panel,
.layer-picker,
.ctx-menu,
.player,
.hint,
.toast,
.expand-panel {
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* ------------------------------------------------------------------ map --- */

#map {
  position: fixed;
  inset: 0;
  background-color: #02040a;
  background-repeat: repeat, no-repeat;
  background-size: 1600px 1000px, cover;
}

/* --------------------------------------------------------------- panel --- */

.panel {
  position: fixed;
  z-index: 10;
  top: var(--gap);
  left: var(--gap);
  bottom: var(--gap);
  width: var(--panel-w);
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}

body.panel-hidden .panel {
  transform: translateX(calc(-100% - var(--gap) * 2));
}

.panel-top {
  padding: 14px 14px 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.brand-mark {
  font-size: 26px;
  display: grid;
}

.brand-name {
  flex: 1;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.search {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 17px;
  display: grid;
  pointer-events: none;
}

#search-input {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

#search-input::placeholder {
  color: var(--faint);
}

#search-input:focus {
  border-color: rgba(91, 157, 255, 0.6);
  background: rgba(255, 255, 255, 0.09);
}

#search-input::-webkit-search-cancel-button {
  filter: invert(1) opacity(0.5);
}

.search-results {
  position: absolute;
  z-index: 30;
  top: 48px;
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--solid);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: min(380px, 60vh);
  overflow: auto;
}

.search-results.stale .result {
  opacity: 0.45;
  pointer-events: none;
}

.result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.result.on,
.result:hover {
  background: var(--hover);
}

.result.on {
  background: var(--accent-soft);
}

.result-icon {
  display: grid;
  font-size: 16px;
  color: var(--muted);
}

.result-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.result-name,
.result-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-name {
  font-weight: 500;
}

.result-sub {
  font-size: 12px;
  color: var(--muted);
}

.result-kind {
  font-size: 11px;
  color: var(--faint);
  text-transform: capitalize;
  white-space: nowrap;
}

.result-empty {
  padding: 10px;
  color: var(--muted);
}

.panel-body {
  flex: 1;
  overflow: auto;
  padding: 4px 14px 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.swatch {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 25%, transparent);
}

.swatch.lg {
  width: 16px;
  height: 16px;
}

/* ---------------------------------------------------------------- tabs --- */

.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 12px;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 13px;
  color: var(--muted);
  transition: background 0.12s, color 0.12s;
}

.tab:hover {
  background: var(--hover);
  color: var(--text);
}

.tab.on {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.tab-count {
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 11px;
  line-height: 17px;
}

.tab-count:empty {
  display: none;
}

.save-state {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--faint);
}

.save-state[data-state='saved'] svg {
  color: #4ade80;
}

.save-state[data-state='error'] {
  color: var(--danger);
}

/* ------------------------------------------------------------- library --- */

.library {
  padding-top: 12px;
}

.lib-toolbar {
  display: flex;
  gap: 8px;
}

.lib-search {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.lib-search-icon {
  position: absolute;
  left: 10px;
  display: grid;
  font-size: 15px;
  color: var(--faint);
  pointer-events: none;
}

.lib-search input,
.lib-sort {
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  outline: none;
}

.lib-search input {
  width: 100%;
  padding: 0 10px 0 32px;
}

.lib-search input:focus,
.lib-sort:focus {
  border-color: rgba(91, 157, 255, 0.6);
}

.lib-sort {
  padding: 0 8px;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
}

.lib-sort option {
  background: var(--solid);
}

.lib-actions {
  display: flex;
  gap: 8px;
  margin: 10px 0 12px;
}

.lib-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.trip-card {
  position: relative;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
  transition: border-color 0.15s, background 0.15s;
}

.trip-card:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--line-strong);
}

.trip-card.active {
  background: var(--accent-soft);
  border-color: rgba(91, 157, 255, 0.45);
}

.trip-card.is-hidden .card-open {
  opacity: 0.55;
}

.card-open {
  display: flex;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  padding: 10px;
  text-align: left;
}

.card-thumb {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 112px;
  height: 76px;
  border-radius: 9px;
  overflow: hidden;
  background: radial-gradient(circle at 30% 20%, #1d3156, #0b1426 72%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.card-thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 14px 14px;
}

.card-thumb svg {
  position: relative;
  width: 100%;
  height: 100%;
}

.thumb-empty {
  position: relative;
  font-size: 22px;
  color: var(--faint);
}

.card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 14px;
}

.card-name,
.card-route,
.card-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-route {
  font-size: 12px;
  color: var(--muted);
}

.card-meta {
  font-size: 12px;
  color: var(--faint);
}

.card-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  font-size: 11.5px;
  color: var(--faint);
}

.card-modes {
  display: flex;
  gap: 4px;
}

.card-modes span {
  display: grid;
  font-size: 14px;
  color: var(--mc);
}

.card-date {
  margin-left: auto;
  white-space: nowrap;
}

.card-actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 1px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: rgba(13, 19, 33, 0.92);
  opacity: 0;
  transition: opacity 0.12s;
}

.trip-card:hover .card-actions,
.trip-card:focus-within .card-actions {
  opacity: 1;
}

@media (hover: none) {
  .card-actions {
    opacity: 1;
  }
}

.lib-empty {
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  font-size: 13px;
  color: var(--muted);
}

.lib-empty b {
  color: var(--text);
}

.lib-empty p {
  margin: 4px 0 0;
}

.lib-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  font-size: 12px;
  color: var(--faint);
}

.lib-foot .text-btn {
  flex: none;
}

/* ------------------------------------------------------------- flights --- */

body.mode-flights .stop-marker,
body.mode-flights .leg-badge {
  visibility: hidden;
}

.flights {
  padding-top: 12px;
}

.fx-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fx-origin-field {
  position: relative;
  display: flex;
  align-items: center;
}

.fx-label {
  position: absolute;
  left: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
  pointer-events: none;
}

#fx-origin {
  width: 100%;
  height: 42px;
  padding: 0 12px 0 58px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
  font-weight: 600;
  font-size: 14.5px;
  outline: none;
}

#fx-origin:focus {
  border-color: rgba(91, 157, 255, 0.6);
}

.fx-origin-field .search-results {
  top: 46px;
}

.fx-to-field {
  position: relative;
  display: flex;
  align-items: center;
}

#fx-area {
  width: 100%;
  height: 42px;
  padding: 0 12px 0 58px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 14.5px;
  outline: none;
  color-scheme: dark;
  cursor: pointer;
}

#fx-area:focus {
  border-color: rgba(91, 157, 255, 0.6);
}

#fx-area option {
  background: var(--solid);
}

.fx-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fx-row .seg {
  flex: 1;
}

.fx-row .seg button {
  flex: 1;
  padding: 5px 8px;
}

.fx-row select,
.fx-date input {
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 0 8px;
  outline: none;
  color-scheme: dark;
}

.fx-row select option {
  background: var(--solid);
}

.fx-flex-row select:first-child {
  flex: 1;
}

.fx-date {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  font-weight: 600;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.fx-date input {
  width: 100%;
}

.fx-row .switch {
  font-size: 12.5px;
  color: var(--muted);
}

.flights .fx-dates-row,
.flights.fx-exact .fx-flex-row,
.flights.fx-oneway .fx-round-only {
  display: none;
}

.flights.fx-exact .fx-dates-row {
  display: flex;
}

.fx-search {
  width: 100%;
  height: 40px;
  margin-top: 4px;
  font-size: 14px;
}

.fx-search svg {
  width: 16px;
  height: 16px;
}

.fx-search:disabled {
  opacity: 0.75;
  cursor: progress;
}

/* Settings changed since the results on screen (or nothing searched yet). */
.fx-search.attn {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 0 0 3px rgba(91, 157, 255, 0.35), 0 4px 14px rgba(59, 130, 246, 0.45);
}

.fx-cost {
  font-size: 11.5px;
  color: var(--faint);
  text-align: center;
}

.fx-cost:empty {
  display: none;
}

.fx-note.fx-stale {
  color: #fde68a;
}

.fx-status {
  margin: 12px 0 8px;
  padding: 9px 11px;
  border-radius: 10px;
  font-size: 12.5px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.fx-status:empty {
  display: none;
}

.fx-status[data-kind='estimate'] {
  border-color: rgba(250, 204, 21, 0.35);
  background: rgba(250, 204, 21, 0.07);
}

.fx-status-main {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.fx-status-main > svg {
  flex: none;
  margin-top: 1px;
  color: #facc15;
  font-size: 15px;
}

.fx-status-main > span {
  flex: 1;
  min-width: 180px;
}

.fx-status b {
  color: var(--text);
}

.fx-dot-live {
  flex: none !important;
  min-width: 0 !important;
  width: 8px;
  height: 8px;
  margin-top: 5px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.2);
}

.fx-status[data-kind='recent'] .fx-dot-live {
  background: #facc15;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.2);
}

.fx-note {
  margin-top: 6px;
  color: var(--faint);
}

.fx-help {
  display: none;
  margin-top: 8px;
  color: var(--muted);
}

.fx-help.open {
  display: block;
}

.fx-help ol {
  margin: 0 0 8px;
  padding-left: 18px;
}

.fx-help li {
  margin-bottom: 5px;
}

.fx-help a {
  color: var(--accent);
}

.fx-help code {
  font: 11.5px var(--mono);
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.fx-filter {
  margin-bottom: 10px;
}

.fx-filter-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--faint);
}

#fx-max {
  width: 100%;
  margin: 6px 0;
  accent-color: var(--accent);
}

.fx-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--faint);
}

.fx-ramp {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #4ade80, #a3e635, #facc15, #fb923c, #f87171);
}

.fx-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  border-left: 3px solid var(--tier);
}

.fx-item:hover {
  background: var(--hover);
}

.fx-item.on {
  background: var(--accent-soft);
}

.fx-item-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.fx-item-name {
  font-weight: 600;
}

.fx-item-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fx-price {
  font-weight: 700;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fx-pop-price {
  margin-top: 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.fx-pop-price span {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}

.pop-country {
  margin-left: 6px;
  font-weight: 500;
  color: var(--muted);
}

a.primary-btn {
  text-decoration: none;
}

.fx-origin {
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}

.fx-origin-dot {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f472b6;
  color: #0b1220;
  font-size: 18px;
  border: 3px solid #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.fx-origin-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid #f472b6;
  animation: ping 1.8s ease-out infinite;
}

.fx-origin-code {
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(10, 16, 30, 0.9);
  font: 700 12px var(--font);
  color: #fff;
}

/* ----------------------------------------------------------- itinerary --- */

.itinerary {
  padding-top: 12px;
}

.trip-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.trip-title {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  margin-left: -6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.01em;
  outline: none;
  text-overflow: ellipsis;
}

.trip-title:hover {
  border-color: var(--line);
}

.trip-title:focus {
  border-color: rgba(91, 157, 255, 0.6);
  background: rgba(255, 255, 255, 0.05);
}

.trip-actions {
  display: flex;
  gap: 2px;
}

.add-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 10px;
}

.add-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px 0 10px;
  border-radius: 10px;
  background: var(--accent-strong);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  transition: background 0.15s, box-shadow 0.15s;
}

.add-btn svg {
  font-size: 17px;
}

.add-btn:hover {
  background: #4b8ef8;
}

.add-btn.on {
  background: #fff;
  color: #0b1a33;
  box-shadow: 0 0 0 4px rgba(91, 157, 255, 0.35);
  animation: pulse-ring 1.8s ease-out infinite;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(91, 157, 255, 0.55); }
  100% { box-shadow: 0 0 0 10px rgba(91, 157, 255, 0); }
}

.mode-picker {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  min-width: 0;
}

.mode-picker-label {
  padding: 0 5px 0 4px;
  font-size: 12px;
  color: var(--faint);
}

.mode-btn {
  display: grid;
  place-items: center;
  width: 28px;
  height: 26px;
  border-radius: 7px;
  color: var(--faint);
  font-size: 16px;
  transition: background 0.12s, color 0.12s;
}

.mode-btn:hover {
  background: var(--hover);
  color: var(--text);
}

.mode-btn.on {
  color: var(--mc);
  background: color-mix(in srgb, var(--mc) 18%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mc) 45%, transparent);
}

.stops {
  list-style: none;
  margin: 0;
  padding: 0;
}

.stop {
  display: grid;
  grid-template-columns: 14px 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 4px 5px 0;
  border-radius: 10px;
  position: relative;
}

.stop:hover {
  background: var(--hover);
}

.stop.selected {
  background: var(--accent-soft);
}

.stop.dragging {
  opacity: 0.4;
}

.stop.drop-before::before,
.stop.drop-after::after {
  content: '';
  position: absolute;
  left: 18px;
  right: 6px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}

.stop.drop-before::before {
  top: -2px;
}

.stop.drop-after::after {
  bottom: -2px;
}

.grip {
  display: grid;
  place-items: center;
  height: 26px;
  color: var(--faint);
  cursor: grab;
  opacity: 0;
  font-size: 14px;
  transition: opacity 0.12s;
}

.stop:hover .grip {
  opacity: 0.8;
}

.stop-badge {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--c);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 2px 6px rgba(0, 0, 0, 0.35);
  position: relative;
  z-index: 1;
}

.stop-badge.sm {
  display: inline-grid;
  width: 20px;
  height: 20px;
  font-size: 11px;
  vertical-align: -4px;
  margin-right: 4px;
}

.stop-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stop-name {
  width: 100%;
  padding: 1px 6px;
  margin-left: -6px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  font-weight: 550;
  outline: none;
  text-overflow: ellipsis;
}

.stop-name:focus {
  border-color: rgba(91, 157, 255, 0.6);
  background: rgba(255, 255, 255, 0.05);
}

.stop-name.locating {
  color: var(--muted);
  font-style: italic;
}

.stop-sub {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Arrival date, nights and a note: set by AI-planned trips. */
.stop-extra {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 1px;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--faint);
}

.stop-extra b {
  color: #c4b5fd;
  font-weight: 600;
}

.stop-tools {
  display: flex;
  opacity: 0;
  transition: opacity 0.12s;
}

.stop:hover .stop-tools,
.stop:focus-within .stop-tools,
.stop.selected .stop-tools {
  opacity: 1;
}

.leg {
  display: grid;
  grid-template-columns: 14px 26px minmax(0, 1fr);
  gap: 8px;
  cursor: pointer;
  border-radius: 10px;
}

.leg-rail {
  grid-column: 2;
  justify-self: center;
  width: 3px;
  margin: -6px 0;
  border-radius: 2px;
  background: var(--mc);
  opacity: 0.85;
}

.leg.pending .leg-rail {
  background: repeating-linear-gradient(to bottom, var(--muted) 0 4px, transparent 4px 8px);
  background-size: 100% 16px;
  animation: rail 0.6s linear infinite;
}

.leg.error .leg-rail {
  background: repeating-linear-gradient(to bottom, var(--danger) 0 3px, transparent 3px 7px);
}

@keyframes rail {
  to { background-position: 0 16px; }
}

.leg-body {
  grid-column: 3;
  padding: 8px 8px 9px;
  margin: 2px 0;
  border-radius: 10px;
  transition: background 0.12s;
}

.leg:hover .leg-body {
  background: var(--hover);
}

.leg.selected .leg-body {
  background: color-mix(in srgb, var(--mc) 12%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mc) 35%, transparent);
}

.mode-row {
  display: flex;
  gap: 2px;
}

.leg-info {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.leg-info b {
  color: var(--text);
  font-weight: 600;
}

.leg-note {
  color: var(--faint);
}

.err {
  color: var(--danger);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.leg-fixes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 550;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line-strong);
}

.chip svg {
  color: var(--mc, var(--muted));
  font-size: 14px;
}

.chip:hover {
  background: rgba(255, 255, 255, 0.12);
}

.empty-stops {
  margin-top: 6px;
  padding: 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
}

.empty-stops b {
  color: var(--text);
}

.empty-stops p {
  margin: 6px 0 0;
}

.empty-state {
  text-align: center;
  padding: 22px 12px 10px;
  color: var(--muted);
}

.empty-state h3 {
  margin: 8px 0 6px;
  color: var(--text);
  font-size: 17px;
}

.empty-state p {
  margin: 0 0 16px;
  font-size: 13px;
}

.empty-state .text-btn {
  display: block;
  margin: 10px auto 0;
}

.empty-globe {
  font-size: 54px;
  display: grid;
  place-items: center;
}

/* -------------------------------------------------------------- summary --- */

.summary {
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  background: rgba(8, 12, 22, 0.45);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.stat-value {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-label {
  font-size: 11px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mode-bar {
  display: flex;
  gap: 2px;
  height: 6px;
  margin: 12px 0 8px;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}

.mode-bar span {
  background: var(--mc);
  min-width: 3px;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  font-size: 12px;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-item svg {
  color: var(--mc);
  font-size: 14px;
}

.legend-item.err {
  color: var(--danger);
}

.summary-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.summary-actions .primary-btn {
  flex: 1;
}

.settings {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--muted);
}

.summary > .settings:first-child {
  margin-top: 0;
}

.seg {
  display: flex;
  padding: 2px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.seg button {
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.seg button.on {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  width: 30px;
  height: 18px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.15);
  position: relative;
  transition: background 0.15s;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

.switch input:checked + .switch-track {
  background: var(--accent-strong);
}

.switch input:checked + .switch-track::after {
  transform: translateX(12px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* -------------------------------------------------------------- buttons --- */

.icon-btn {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 17px;
  transition: background 0.12s, color 0.12s;
}

.icon-btn.sm {
  width: 28px;
  height: 28px;
  font-size: 15px;
}

.icon-btn.xs {
  width: 24px;
  height: 24px;
  font-size: 14px;
  border-radius: 7px;
}

.icon-btn:not(:disabled):hover {
  background: var(--press);
  color: var(--text);
}

.icon-btn.danger:not(:disabled):hover,
.ghost-btn.danger:hover {
  color: var(--danger);
}

.text-btn {
  padding: 4px 8px;
  border-radius: 8px;
  color: var(--accent);
  font-weight: 600;
  font-size: 13px;
}

.text-btn:hover {
  background: var(--accent-soft);
}

.primary-btn,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13.5px;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}

.primary-btn {
  background: linear-gradient(180deg, #5b9dff, #3b82f6);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 4px 14px rgba(59, 130, 246, 0.35);
}

.primary-btn:hover {
  background: linear-gradient(180deg, #6aa7ff, #4b8ef8);
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--line-strong);
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.ghost-btn.icon-only {
  width: 36px;
  padding: 0;
  font-size: 16px;
}

.primary-btn.sm,
.ghost-btn.sm {
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
  border-radius: 8px;
  gap: 5px;
}

.spinner {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: currentColor;
  animation: spin 0.75s linear infinite;
  vertical-align: -1px;
}

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

/* ------------------------------------------------------------- floating --- */

.expand-panel {
  position: fixed;
  z-index: 10;
  top: var(--gap);
  left: var(--gap);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 14px 0 10px;
  border-radius: 12px;
  font-weight: 600;
}

.expand-panel[hidden] {
  display: none;
}

.hint,
.player,
.toast {
  position: fixed;
  z-index: 12;
  left: calc(50% + (var(--panel-w) + var(--gap)) / 2);
  transform: translateX(-50%);
}

body.panel-hidden .hint,
body.panel-hidden .player,
body.panel-hidden .toast {
  left: 50%;
}

.hint {
  top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 8px 8px;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 13.5px;
  animation: rise 0.25s ease-out;
}

.hint[hidden] {
  display: none;
}

.hint-mode {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--mc);
  color: #0b1220;
  font-size: 17px;
}

.hint-sep {
  width: 1px;
  height: 18px;
  background: var(--line-strong);
}

@keyframes rise {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.toast {
  bottom: 84px;
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(560px, calc(100vw - 32px));
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 13.5px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  pointer-events: auto;
}

.toast[hidden] {
  display: none;
}

.toast-action {
  color: var(--accent);
  font-weight: 650;
}

.player {
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(620px, calc(100vw - var(--panel-w) - var(--gap) * 4));
  padding: 8px 10px;
  border-radius: 16px;
  animation: rise 0.25s ease-out;
}

body.panel-hidden .player {
  width: min(620px, calc(100vw - 32px));
}

.player[hidden] {
  display: none;
}

.player-play {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  color: #0b1220;
  font-size: 20px;
}

.player-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.player-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  min-width: 0;
}

.player-route {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-count {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.mode-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px 1px 6px;
  border-radius: 999px;
  color: var(--mc);
  background: color-mix(in srgb, var(--mc) 16%, transparent);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}

#player-scrub {
  width: 100%;
  accent-color: #fff;
  height: 16px;
  margin: 0;
}

.player-speed {
  flex: none;
  min-width: 42px;
  height: 30px;
  border-radius: 8px;
  font-weight: 650;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.08);
  font-variant-numeric: tabular-nums;
}

.layer-picker {
  position: fixed;
  z-index: 20;
  width: 300px;
  padding: 12px;
  border-radius: 14px;
  background: var(--glass-strong);
}

.layer-picker[hidden],
.ctx-menu[hidden] {
  display: none;
}

.picker-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 2px 10px;
}

.picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.picker-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.picker-thumb {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: #1c2740;
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.picker-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.picker-item:hover .picker-thumb {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.picker-item.on {
  color: var(--text);
  font-weight: 600;
}

.picker-item.on .picker-thumb {
  box-shadow: 0 0 0 2px var(--accent);
}

.picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--muted);
}

.picker-row.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.ctx-menu {
  position: fixed;
  z-index: 25;
  min-width: 240px;
  padding: 6px;
  border-radius: 12px;
  background: var(--glass-strong);
  display: flex;
  flex-direction: column;
}

.ctx-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  text-align: left;
  font-size: 13.5px;
}

.ctx-menu button:hover {
  background: var(--press);
}

.menu-icon {
  display: grid;
  font-size: 16px;
  color: var(--mc, var(--muted));
}

.menu-hint {
  margin-left: auto;
  padding-left: 12px;
  font: 11.5px var(--mono);
  color: var(--faint);
}

.dialog {
  width: min(520px, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--solid);
  color: var(--text);
  box-shadow: var(--shadow);
}

.dialog::backdrop {
  background: rgba(2, 4, 10, 0.55);
  backdrop-filter: blur(3px);
}

.dialog h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.dialog p {
  margin: 0 0 14px;
  font-size: 13px;
}

.share-row {
  display: flex;
  gap: 8px;
}

.share-row input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  font: 12px var(--mono);
  outline: none;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.ai-steps {
  margin: 12px 0 0;
  padding-left: 20px;
  font-size: 13px;
  color: var(--muted);
}

.ai-steps li {
  margin-bottom: 14px;
  padding-left: 2px;
}

.ai-steps b {
  color: var(--text);
}

.ai-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.ai-text {
  display: block;
  width: 100%;
  min-height: 120px;
  margin-top: 8px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font: 12px/1.45 var(--mono);
  resize: vertical;
  outline: none;
}

.ai-text:focus {
  border-color: rgba(91, 157, 255, 0.6);
}

.ai-text[hidden] {
  display: none;
}

#ai-prompt {
  min-height: 160px;
  color: var(--muted);
}

.dialog p.ai-tip {
  margin: -4px 0 0;
  font-size: 12px;
}

.ai-tip:empty {
  display: none;
}

.ai-tip a {
  color: var(--accent);
}

.ai-status {
  min-height: 18px;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.ai-status.err {
  color: #fca5a5;
}

/* -------------------------------------------------------------- markers --- */

.stop-marker {
  cursor: pointer;
}

/* --zs: zoom-band scale (smaller from space), --ps: state scale (hover / selected / inactive). */
.stop-marker .pin {
  position: relative;
  width: 32px;
  height: 42px;
  transform-origin: 50% 100%;
  transform: scale(calc(var(--zs, 1) * var(--ps, 1)));
  transition: transform 0.2s;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.45));
}

.stop-marker:hover .pin {
  --ps: 1.08;
}

.stop-marker.selected .pin {
  --ps: 1.18;
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.55)) drop-shadow(0 3px 5px rgba(0, 0, 0, 0.45));
}

.stop-marker.inactive .pin {
  --ps: 0.72;
  opacity: 0.8;
}

body[data-zoom='mid'] .stop-marker {
  --zs: 0.82;
}

body[data-zoom='far'] .stop-marker {
  --zs: 0.6;
}

body[data-zoom='far'] .pin-label {
  opacity: 0;
}

.pin-svg {
  display: block;
  width: 32px;
  height: 42px;
}

.pin-svg path {
  fill: var(--c);
  stroke: #fff;
  stroke-width: 2.5;
}

.pin-label {
  position: absolute;
  top: 6px;
  left: 0;
  right: 0;
  text-align: center;
  font: 700 12.5px/20px var(--font);
  color: #fff;
  pointer-events: none;
}

/* visibility, not opacity: MapLibre sets an inline opacity on markers for globe occlusion */
body[data-zoom='far'] .leg-badge {
  visibility: hidden;
}

.leg-badge {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(10, 16, 30, 0.9);
  border: 2px solid var(--mc);
  color: var(--mc);
  font-size: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  transition: background 0.12s, color 0.12s;
}

.leg-badge:hover,
.leg-badge.selected {
  background: var(--mc);
  color: #0b1220;
}

.leg-badge.inactive {
  width: 20px;
  height: 20px;
  font-size: 11px;
  opacity: 0.6;
}

.leg-badge.pending {
  color: #e2e8f0;
  border-color: rgba(226, 232, 240, 0.6);
}

.vehicle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--mc, #fff);
  color: #0b1220;
  font-size: 20px;
  border: 3px solid #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.vehicle::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--mc, #fff);
  animation: ping 1.6s ease-out infinite;
}

@keyframes ping {
  from { transform: scale(1); opacity: 0.8; }
  to { transform: scale(2.1); opacity: 0; }
}

body.adding .leg-badge {
  pointer-events: none; /* clicks fall through to the map and add a stop */
}

body.touring .leg-badge {
  opacity: 0.35;
  pointer-events: none;
}

/* ------------------------------------------------------- popups (maplibre) --- */

.ea-popup .maplibregl-popup-content {
  padding: 14px 16px 12px;
  border-radius: 14px;
  background: var(--solid);
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  font: 13.5px/1.4 var(--font);
}

.ea-popup.maplibregl-popup-anchor-bottom .maplibregl-popup-tip,
.ea-popup.maplibregl-popup-anchor-bottom-left .maplibregl-popup-tip,
.ea-popup.maplibregl-popup-anchor-bottom-right .maplibregl-popup-tip {
  border-top-color: var(--solid);
}

.ea-popup.maplibregl-popup-anchor-top .maplibregl-popup-tip,
.ea-popup.maplibregl-popup-anchor-top-left .maplibregl-popup-tip,
.ea-popup.maplibregl-popup-anchor-top-right .maplibregl-popup-tip {
  border-bottom-color: var(--solid);
}

.ea-popup.maplibregl-popup-anchor-left .maplibregl-popup-tip {
  border-right-color: var(--solid);
}

.ea-popup.maplibregl-popup-anchor-right .maplibregl-popup-tip {
  border-left-color: var(--solid);
}

.ea-popup .maplibregl-popup-close-button {
  top: 6px;
  right: 8px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 18px;
}

.ea-popup .maplibregl-popup-close-button:hover {
  background: var(--press);
  color: var(--text);
}

.pop-title {
  padding-right: 22px;
  font-weight: 650;
  font-size: 14.5px;
}

.pop-title .arrow {
  color: var(--faint);
}

.pop-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pop-coords {
  margin-top: 4px;
  font: 11.5px var(--mono);
  color: var(--faint);
}

.pop .mode-row {
  margin-top: 10px;
}

.pop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

/* ----------------------------------------------------- maplibre controls --- */

.maplibregl-ctrl-top-right {
  top: 4px;
  right: 4px;
}

.maplibregl-ctrl-group {
  background: var(--glass) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--line);
  border-radius: 12px !important;
  box-shadow: var(--shadow) !important;
  overflow: hidden;
}

.maplibregl-ctrl-group button {
  width: 38px !important;
  height: 38px !important;
}

.maplibregl-ctrl-group button + button {
  border-top: 1px solid var(--line) !important;
}

.maplibregl-ctrl-group button:not(:disabled):hover {
  background: var(--press) !important;
}

.maplibregl-ctrl-group .maplibregl-ctrl-icon {
  filter: invert(1) brightness(1.35);
}

.ea-tools button {
  display: grid !important;
  place-items: center;
  color: var(--text);
  font-size: 18px;
}

.ea-tools button.on {
  color: var(--accent);
}

.tool-3d {
  font: 800 12px var(--font);
  letter-spacing: 0.02em;
}

.ea-tools button[data-tool='terrain'].on {
  background: var(--accent-soft) !important;
}

.maplibregl-ctrl-bottom-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.maplibregl-ctrl-scale {
  background: rgba(10, 16, 30, 0.65);
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
}

.maplibregl-ctrl.maplibregl-ctrl-attrib,
.maplibregl-ctrl-attrib.maplibregl-compact {
  background-color: rgba(10, 16, 30, 0.78) !important;
  color: var(--muted) !important;
  font-size: 11px;
}

.maplibregl-ctrl-attrib a {
  color: var(--muted) !important;
}

.maplibregl-ctrl-attrib.maplibregl-compact {
  border-radius: 12px;
}

.maplibregl-ctrl-attrib.maplibregl-compact .maplibregl-ctrl-attrib-button {
  filter: invert(1);
  background-color: transparent;
}

/* ------------------------------------------------------ API meter (testing) --- */

.api-meter {
  position: absolute;
  right: 12px;
  bottom: 70px;
  z-index: 6;
  width: 280px;
  border-radius: 12px;
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-size: 12px;
  color: var(--muted);
}

.api-meter:not(.open) {
  width: auto;
}

.am-head {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: left;
}

.am-title {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.am-total {
  font-variant-numeric: tabular-nums;
}

.am-chip {
  padding: 1px 7px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: #b9d3ff;
  font-weight: 600;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.am-caret {
  margin-left: auto;
  color: var(--faint);
  font-weight: 700;
}

.am-body {
  padding: 0 10px 8px;
}

.am-sec {
  margin: 8px 0 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.am-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 2px 0;
}

.am-line b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.am-line span:first-child {
  min-width: 58px;
}

.am-dim {
  color: var(--faint);
}

.am-bar {
  height: 5px;
  margin: 2px 0 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.am-bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, #4ade80, #facc15 70%, #f87171);
}

.am-free {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 10px;
}

.am-free b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.am-log {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 128px;
  overflow-y: auto;
}

.am-log li {
  display: flex;
  gap: 6px;
  padding: 1.5px 0;
  white-space: nowrap;
}

.am-log li > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.am-log b {
  color: var(--text);
  font-weight: 600;
}

.am-log .am-bad span:last-child {
  color: #fca5a5;
}

.am-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

/* --------------------------------------------------------------- mobile --- */

@media (max-width: 720px) {
  :root {
    --panel-w: 0px;
  }

  /* Bottom sheet: the whole sheet scrolls, so the itinerary isn't squeezed by the summary. */
  .panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: 52vh;
    border-radius: 18px 18px 0 0;
    border-bottom: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
  }

  .panel-top {
    position: sticky;
    top: 0;
    z-index: 5;
    background: #0e1526;
    border-bottom: 1px solid var(--line);
  }

  .panel-body {
    flex: none;
    overflow: visible;
  }

  body.panel-hidden .panel {
    transform: translateY(100%);
  }

  .expand-panel {
    top: auto;
    bottom: 16px;
  }

  .panel-top {
    padding: 10px 12px 8px;
  }

  .brand {
    margin-bottom: 8px;
  }

  .hint {
    top: 12px;
    font-size: 12.5px;
  }

  .hint .hint-sep,
  .hint .muted {
    display: none;
  }

  .toast {
    bottom: calc(52vh + 64px);
  }

  .player {
    bottom: calc(52vh + 12px);
    width: calc(100vw - 24px);
  }

  .layer-picker {
    width: min(300px, calc(100vw - 72px));
  }

  .api-meter {
    top: 12px;
    left: 12px;
    right: auto;
    bottom: auto;
    width: min(272px, calc(100vw - 80px));
  }

  .stop-tools,
  .grip {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
