:root {
  --accent-1: #7dd3fc;
  --accent-2: #c4b5fd;
  --accent-3: #f9a8d4;
  --text-primary: #fff;
  --text-secondary: rgba(255, 255, 255, 0.74);
  --text-tertiary: rgba(255, 255, 255, 0.5);
  --glass-bg: rgba(17, 24, 39, 0.46);
  --line: rgba(255, 255, 255, 0.14);
  --radius: 26px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: #0b1120;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button { font: inherit; }

#background {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #0b1120 url("./bg.jpg") center center / cover no-repeat;
}

#background::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, rgba(11, 17, 32, 0.08) 0%, rgba(11, 17, 32, 0.64) 100%);
}

.page-shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 32px 20px;
}

.glass-card {
  position: relative;
  isolation: isolate;
  width: min(1180px, 100%);
  height: calc(100vh - 64px);
  height: calc(100dvh - 64px);
  min-height: 560px;
  margin: auto;
  padding: 24px 26px 18px;
  display: flex;
  flex-direction: column;
  border-radius: calc(var(--radius) + 4px);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.18) 0%, rgba(255, 255, 255, 0.055) 38%, rgba(255, 255, 255, 0.025) 62%, rgba(255, 255, 255, 0.1) 100%),
    var(--glass-bg);
  border: 1px solid transparent;
  -webkit-backdrop-filter: blur(24px) saturate(165%) brightness(1.04);
  backdrop-filter: blur(24px) saturate(165%) brightness(1.04);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -1px 0 rgba(255, 255, 255, 0.06),
    0 30px 80px rgba(0, 0, 0, 0.45);
}

.glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: inherit;
  background: conic-gradient(
    from 140deg,
    rgba(125, 211, 252, 0.75),
    rgba(196, 181, 253, 0.65),
    rgba(249, 168, 212, 0.6),
    rgba(125, 211, 252, 0.75)
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.glass-card::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: calc(var(--radius) + 14px);
  background: conic-gradient(
    from 140deg,
    rgba(125, 211, 252, 0.3),
    rgba(196, 181, 253, 0.26),
    rgba(249, 168, 212, 0.24),
    rgba(125, 211, 252, 0.3)
  );
  filter: blur(28px);
  opacity: 0.7;
  z-index: -1;
  pointer-events: none;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.identity {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.avatar {
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent-1), var(--accent-2), var(--accent-3), var(--accent-1));
  box-shadow: 0 0 22px rgba(167, 139, 250, 0.28);
}

.avatar::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: rgba(11, 17, 32, 0.66);
}

.avatar span {
  position: relative;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.identity-name {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.25;
}

.top-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.meta-divider {
  width: 1px;
  height: 11px;
  background: rgba(255, 255, 255, 0.22);
}

.card-rule {
  height: 1px;
  margin: 16px 0 14px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.24), transparent);
}

.tool-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

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

.tab {
  appearance: none;
  padding: 7px 17px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.06em;
  transition: transform .22s ease, background .22s ease, border-color .22s ease, box-shadow .22s ease, color .22s ease;
}

.tab:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.32);
  color: var(--text-primary);
}

.tab.is-active {
  color: #0b1120;
  font-weight: 600;
  border-color: rgba(255, 255, 255, 0.5);
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 6px 18px rgba(125, 211, 252, 0.25);
}

.panel-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-tertiary);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.ghost-btn {
  appearance: none;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 10px;
  letter-spacing: 0.05em;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.ghost-btn:hover {
  background: rgba(255, 255, 255, 0.13);
  border-color: rgba(255, 255, 255, 0.38);
  color: var(--text-primary);
}

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px;
}

.map-panel,
.side-panel {
  min-height: 0;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.025)),
    rgba(11, 17, 32, 0.26);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  backdrop-filter: blur(16px) saturate(150%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 12px 30px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.map-panel {
  display: flex;
  flex-direction: column;
}

.map-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  background:
    radial-gradient(circle at 50% 48%, rgba(125, 211, 252, 0.1), transparent 58%),
    rgba(8, 13, 24, 0.22);
}

.map-canvas {
  position: absolute;
  inset: 0;
}

.corner {
  position: absolute;
  width: 14px;
  height: 14px;
  border-color: rgba(255, 255, 255, 0.24);
  border-style: solid;
  pointer-events: none;
}

.corner-tl { top: 12px; left: 12px; border-width: 1px 0 0 1px; }
.corner-tr { top: 12px; right: 12px; border-width: 1px 1px 0 0; }
.corner-bl { bottom: 12px; left: 12px; border-width: 0 0 1px 1px; }
.corner-br { bottom: 12px; right: 12px; border-width: 0 1px 1px 0; }

.map-foot {
  height: 46px;
  flex: 0 0 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-secondary);
  font-size: 10px;
  letter-spacing: 0.04em;
}

.legend,
.selection {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-1);
  box-shadow: 0 0 0 3px rgba(125, 211, 252, 0.14);
}

.legend-dot.is-active {
  background: var(--accent-3);
  box-shadow: 0 0 0 3px rgba(249, 168, 212, 0.16);
}

.legend-divider {
  width: 1px;
  height: 10px;
  margin: 0 4px;
  background: rgba(255, 255, 255, 0.2);
}

.selection {
  justify-content: flex-end;
  text-align: right;
  color: var(--text-tertiary);
}

.selection strong { color: var(--text-primary); font-weight: 500; }

.selection span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-panel {
  display: flex;
  flex-direction: column;
}

.side-head {
  height: 56px;
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.035);
}

.side-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.count {
  font-family: var(--mono);
  font-size: 19px;
  letter-spacing: 0.04em;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.list-hint {
  padding: 8px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-tertiary);
  font-size: 10px;
  letter-spacing: 0.06em;
}

.group-nav {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 7px;
  padding: 10px 12px;
  white-space: normal;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.025);
}

.group-chip {
  appearance: none;
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 10px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
}

.group-chip:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--text-primary);
}

.group-chip.is-active {
  color: #0b1120;
  font-weight: 600;
  border-color: rgba(255, 255, 255, 0.5);
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  box-shadow: 0 4px 14px rgba(125, 211, 252, 0.2);
}

.place-list {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.place-list::-webkit-scrollbar { width: 6px; }
.place-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 99px; }
.place-list::-webkit-scrollbar-track { background: transparent; }

.group-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(17, 24, 39, 0.78);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: var(--text-secondary);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.group-head span:last-child {
  color: var(--text-tertiary);
  font-size: 9px;
}

.place-item {
  width: calc(100% - 20px);
  margin: 4px 10px;
  padding: 8px 12px;
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-primary);
  display: grid;
  grid-template-columns: 24px 1fr 8px;
  align-items: center;
  gap: 7px;
  text-align: left;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.place-item:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.24);
}

.place-item.is-active {
  background: linear-gradient(90deg, rgba(249, 168, 212, 0.14), rgba(196, 181, 253, 0.07));
  border-color: rgba(249, 168, 212, 0.34);
  box-shadow: 0 6px 18px rgba(249, 168, 212, 0.12);
}

.idx {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-tertiary);
}

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

.place-name {
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-meta {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.place-arrow {
  width: 5px;
  height: 5px;
  border-right: 1px solid var(--text-tertiary);
  border-top: 1px solid var(--text-tertiary);
  transform: rotate(45deg);
  opacity: 0;
  transition: opacity .18s ease;
}

.place-item:hover .place-arrow,
.place-item.is-active .place-arrow { opacity: 1; }

.side-foot {
  height: 36px;
  flex: 0 0 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text-tertiary);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-tertiary);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.tip {
  min-width: 160px;
  max-width: 260px;
  font-family: var(--font-sans);
}

.tip-title {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}

.tip-sub {
  color: var(--text-secondary);
  font-size: 10px;
  font-family: var(--mono);
  letter-spacing: 0.04em;
}

.tip-note {
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.5;
  margin-top: 7px;
  padding-top: 7px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.tip a {
  display: inline-block;
  margin-top: 7px;
  color: var(--accent-1);
  font-size: 10px;
  text-decoration: none;
  border-bottom: 1px solid rgba(125, 211, 252, 0.4);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass-card,
  .map-panel,
  .side-panel {
    background: rgba(17, 24, 39, 0.9);
  }
}

@media (max-width: 900px) {
  .page-shell { padding: 18px 12px; }
  .glass-card { height: auto; min-height: calc(100dvh - 36px); padding: 20px 18px 16px; }
  .workspace { grid-template-columns: 1fr; }
  .map-panel { height: 58vh; min-height: 380px; }
  .side-panel { height: 380px; }
}

@media (max-width: 560px) {
  .identity-name { font-size: 15px; }
  .top-meta { font-size: 9px; }
  .tool-row { align-items: flex-start; flex-direction: column; }
  .map-foot {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    height: 56px;
    flex-basis: 56px;
  }
  .selection { justify-content: flex-start; text-align: left; }
  .card-foot { flex-wrap: wrap; }
}
