:root {
  --bg: #eef3f5;
  --ink: #152026;
  --muted: #64727a;
  --line: #d5dee3;
  --panel: #ffffff;
  --panel-2: #f7fafb;
  --teal: #008b8f;
  --teal-dark: #00676b;
  --blue: #2f6fb2;
  --amber: #c98715;
  --red: #c74c3d;
  --green: #407f4d;
  --violet: #6a5c9f;
  --shadow: 0 18px 42px rgba(25, 42, 52, 0.14);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: auto;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  letter-spacing: 0;
}

body {
  display: grid;
  place-items: center;
  padding: 18px;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  gap: 12px;
  width: min(calc(100vw - 36px), calc((100vh - 36px) * 55 / 36));
  height: min(calc(100vh - 36px), calc((100vw - 36px) * 36 / 55));
  min-width: 980px;
  min-height: 640px;
  padding: 12px;
  border: 10px solid #17262d;
  border-radius: 24px;
  background: var(--bg);
  box-shadow: 0 24px 70px rgba(11, 25, 32, 0.24);
}

.control-rail,
.workspace {
  min-height: 0;
}

.control-rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}

.brand-block,
.panel-section,
.topbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 74px;
  padding: 12px 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 7px;
  background: #112a33;
  color: white;
  font-size: 24px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

.brand-block h1 {
  font-size: 18px;
  line-height: 1.2;
}

.brand-block p,
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.panel-section {
  padding: 14px;
}

.control-rail .panel-section:first-of-type {
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.control-rail .panel-section:first-of-type .category-list {
  max-height: calc(100% - 48px);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: #28353b;
  font-size: 14px;
  font-weight: 700;
}

.text-button {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 700;
}

.text-button:active {
  transform: translateY(1px);
}

.count-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.category-list {
  position: relative;
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 4px 0 6px;
}

.category-list::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 22px;
  bottom: 22px;
  width: 2px;
  background: linear-gradient(#6376ff, #4a63ff);
  opacity: 0.75;
}

.category-list.is-sublevel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 0;
}

.category-list.is-sublevel::before {
  display: none;
}

.sublevel-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 4px 0 8px;
}

.back-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--ink);
}

.back-button svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sublevel-head strong,
.sublevel-head span {
  display: block;
}

.sublevel-head strong {
  overflow: hidden;
  font-size: 18px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sublevel-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.property-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  overflow: auto;
}

.property-row {
  width: 100%;
  min-height: 72px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7fafb;
  color: var(--ink);
  text-align: left;
}

.property-row[aria-pressed="true"] {
  border-color: var(--teal);
  background: #e6f5f4;
  box-shadow: inset 4px 0 0 var(--teal);
}

.property-row strong,
.property-row span {
  display: block;
}

.property-row strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.28;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.property-row span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.category-button {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  width: calc(100% - 40px);
  max-width: none;
  margin-left: 28px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f4f5f6;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 8px 18px rgba(24, 39, 47, 0.08);
}

.category-button[aria-pressed="true"] {
  border-color: var(--teal);
  background: #e6f5f4;
  box-shadow: 0 0 0 2px rgba(0, 139, 143, 0.12), 0 10px 20px rgba(24, 39, 47, 0.12);
}

.category-icon {
  display: none;
}

.category-icon svg,
.icon-button svg,
.search-wrap svg,
.gesture-hint svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.category-main {
  min-width: 0;
}

.category-main strong,
.category-main span {
  display: block;
}

.category-main strong {
  overflow: hidden;
  font-size: 17px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-main span {
  display: none;
}

.category-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.workspace {
  position: relative;
  display: grid;
  min-height: 0;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--muted);
}

.search-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
}

.status-strip {
  display: flex;
  gap: 10px;
}

.status-strip > div {
  min-width: 112px;
  padding: 8px 12px;
  border-left: 1px solid var(--line);
}

.status-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}

.status-strip strong {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  font-size: 17px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-stage {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #d7e8ef;
  box-shadow: var(--shadow);
}

.map-viewport {
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: pan-x pan-y;
  background: #000; /* 背景黑色，用于留边 */
  display: flex;
  align-items: center;
  justify-content: center;
}

.real-map {
  position: absolute;
  inset: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.is-aspect-locked .real-map {
  position: relative;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  inset: auto;
  box-shadow: 0 0 50px rgba(0,0,0,0.8);
}

.icon-button.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.maplibregl-ctrl-bottom-left,
.maplibregl-ctrl-bottom-right {
  display: none;
}

.maplibregl-canvas {
  outline: none;
}

.property-point {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 2px solid white;
  border-radius: 999px;
  background: var(--point-color);
  color: white;
  box-shadow: 0 10px 20px rgba(28, 47, 55, 0.25);
  transition: width 160ms ease, height 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.property-point svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.property-point.is-selected {
  width: 44px;
  height: 44px;
  box-shadow: 0 0 0 8px rgba(0, 139, 143, 0.22), 0 18px 28px rgba(28, 47, 55, 0.28);
  z-index: 5;
}

.property-point.is-muted {
  display: none;
  opacity: 0;
  pointer-events: none;
}

.map-toolbar {
  position: absolute;
  z-index: 10;
  right: 18px;
  top: 18px;
  display: grid;
  gap: 8px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: 0 10px 22px rgba(20, 42, 52, 0.12);
}

.icon-button:active {
  transform: translateY(1px);
}

.gesture-hint {
  position: absolute;
  z-index: 10;
  left: 18px;
  bottom: 18px;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 7px;
  background: rgba(17, 42, 51, 0.78);
  color: white;
  font-size: 13px;
  font-weight: 700;
  backdrop-filter: blur(10px);
  pointer-events: none;
}

.compass-button {
  position: absolute;
  z-index: 10;
  right: 18px;
  bottom: 18px;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  box-shadow: 0 10px 22px rgba(20, 42, 52, 0.12);
  transition: transform 160ms ease;
}

.compass-button:active {
  transform: scale(0.95);
}

.compass-needle {
  position: relative;
  width: 4px;
  height: 36px;
  background: #ccc;
  border-radius: 2px;
  transition: transform 100ms linear;
}

.compass-needle::before {
  content: "";
  position: absolute;
  top: 0;
  left: -6px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 18px solid #c74c3d;
}

.compass-needle::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: -6px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 18px solid #112a33;
}

.compass-needle span {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 900;
  color: white;
  z-index: 1;
}

.compass-needle .north { top: 2px; }
.compass-needle .south { bottom: 2px; }

.floating-card {
  position: absolute;
  z-index: 30;
  right: 16px;
  top: 50%;
  width: min(360px, 40vw);
  opacity: 0;
  pointer-events: none;
  transform: translateY(calc(-50% - 10px));
  transition: opacity 200ms ease, transform 200ms ease;
}

.floating-card.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%);
}

.selected-card {
  overflow: hidden;
  border: 1px solid rgba(193, 207, 216, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 38px rgba(21, 38, 46, 0.18);
  backdrop-filter: blur(12px);
}

.selected-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 0;
}

.close-card {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--ink);
}

.close-card svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.selected-body {
  padding: 10px 14px 14px;
}

.type-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.selected-body h2 {
  margin-bottom: 8px;
  font-size: 20px;
  line-height: 1.2;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
}

.meta-item {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-2);
}

.meta-item span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.meta-item strong {
  display: block;
  margin-top: 3px;
  font-size: 14px;
}

.description {
  min-height: 0;
  color: #435057;
  font-size: 13px;
  line-height: 1.5;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  min-width: 260px;
  padding: 14px 18px;
  border-radius: 7px;
  background: #102b35;
  color: white;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 18px 35px rgba(16, 43, 53, 0.32);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 244px minmax(0, 1fr);
  }

  .workspace {
    grid-column: 2;
    grid-row: 1;
  }
}

@media (max-width: 860px) {
  body {
    overflow: auto;
  }

  .app-shell {
    display: flex;
    min-height: 100%;
    height: auto;
    width: 100%;
    min-width: 0;
    flex-direction: column;
  }

  .workspace {
    min-height: 680px;
  }

  .topbar {
    grid-template-columns: 1fr;
    height: auto;
  }

  .control-rail {
    display: block;
  }
}
