:root {
  color-scheme: dark;
  --bg: #07111f;
  --panel: #0c1727;
  --line: rgba(149, 188, 226, 0.18);
  --muted: #8fa7bf;
  --text: #f4f8fc;
  --accent: #49bdf2;
  --topbar-height: 76px;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
select,
a { font: inherit; }

button,
select {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #14243a;
  color: var(--text);
}

button { cursor: pointer; }

button:hover,
button:focus-visible,
select:focus-visible {
  border-color: rgba(73, 189, 242, 0.72);
  outline: none;
  background: #19304a;
}

.topbar {
  position: relative;
  z-index: 10;
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 17, 31, 0.94);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(16px);
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #61cef7, #258ed0);
  color: #04101c;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: -0.04em;
  box-shadow: 0 8px 22px rgba(18, 156, 219, 0.22);
}

.brand strong,
.brand small { display: block; }

.brand strong {
  font-size: 17px;
  line-height: 1.25;
}

.brand small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-actions button,
.topbar-actions select {
  height: 38px;
  padding: 0 12px;
}

.dimension-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.app {
  width: 100%;
  min-width: 0;
  height: calc(100dvh - var(--topbar-height));
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
}

.places {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 20px 14px 14px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #0d1929, #091320);
}

.places-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 6px 14px;
}

.places-heading h1 {
  margin: 2px 0 0;
  font-size: 20px;
  line-height: 1.2;
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.places-heading a {
  color: #9bdcf8;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}

.places-heading a:hover { color: #fff; }

.destinations {
  width: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  gap: 7px;
  overflow: auto;
  padding: 2px 4px 12px;
  scrollbar-color: #29445e transparent;
}

.destination {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  text-align: left;
  background: rgba(20, 36, 58, 0.78);
}

.destination strong,
.destination small { display: block; }

.destination strong {
  overflow: hidden;
  color: #edf7ff;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.destination small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.destination::after {
  content: "›";
  color: #6d88a1;
  font-size: 20px;
}

.destination.active {
  border-color: rgba(73, 189, 242, 0.7);
  background: linear-gradient(135deg, rgba(21, 157, 217, 0.25), rgba(25, 48, 74, 0.9));
  box-shadow: inset 3px 0 var(--accent);
}

.destination.active::after { color: var(--accent); }

.map-shell {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #080d19;
}

#map {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}

#map.dragging { cursor: grabbing; }

.map-tools {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  gap: 6px;
}

.map-tools button {
  width: 38px;
  height: 38px;
  padding: 0;
  background: rgba(12, 23, 39, 0.9);
  font-size: 20px;
  line-height: 1;
  backdrop-filter: blur(12px);
}

.active-place,
.coords,
.map-help {
  position: absolute;
  border: 1px solid var(--line);
  background: rgba(8, 18, 32, 0.86);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(12px);
}

.active-place {
  top: 14px;
  left: 14px;
  max-width: min(460px, calc(100% - 90px));
  padding: 10px 13px;
  border-radius: 10px;
}

.active-place strong,
.active-place small { display: block; }

.active-place strong { font-size: 14px; }

.active-place small {
  margin-top: 2px;
  color: #9fc4da;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.coords {
  right: 14px;
  bottom: 14px;
  padding: 7px 10px;
  border-radius: 8px;
  color: #c8d7e6;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.map-help {
  left: 14px;
  bottom: 14px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 860px) {
  :root { --topbar-height: 126px; }

  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px 14px;
    padding: 10px 12px;
  }

  .brand { width: 100%; }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 14px;
  }

  .brand strong { font-size: 15px; }

  .brand small {
    max-width: calc(100vw - 70px);
    line-height: 1.35;
    white-space: normal;
  }

  .topbar-actions { width: 100%; }

  .topbar-actions button,
  .topbar-actions select {
    height: 34px;
    padding: 0 9px;
    font-size: 12px;
  }

  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 154px minmax(0, 1fr);
  }

  .places {
    width: 100%;
    padding: 10px 8px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .places-heading {
    align-items: center;
    padding: 0 4px 8px;
  }

  .places-heading h1 { font-size: 16px; }

  .eyebrow { display: none; }

  .destinations {
    max-width: 100%;
    display: flex;
    gap: 7px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 4px 8px;
  }

  .destination {
    width: 166px;
    min-width: 166px;
    height: 74px;
    padding: 9px 10px;
  }

  .destination strong { white-space: normal; }

  .map-help { display: none; }

  .coords {
    right: 10px;
    bottom: 10px;
    max-width: calc(100% - 20px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .active-place {
    top: 10px;
    left: 10px;
  }

  .map-tools {
    top: 10px;
    right: 10px;
  }

  .map-shell { width: 100%; }
}

@media (max-width: 460px) {
  .dimension-control > span { display: none; }
  .topbar-actions { gap: 6px; }

  .topbar-actions button,
  .topbar-actions select { min-width: 0; }

  #fit-all { display: none; }
}
