:root {
  --bg-ocean: #0b1626;
  --panel-bg: rgba(12, 18, 30, 0.86);
  --panel-bg-solid: #0f1726;
  --panel-border: rgba(255, 255, 255, 0.1);
  --panel-hover: rgba(255, 255, 255, 0.06);
  --text-main: #f1f5f9;
  --text-dim: #94a3b8;
  --text-muted: #64748b;
  --accent-pink: #ff4fd8;
  --accent-cyan: #38e8ff;
  --accent-grad: linear-gradient(135deg, #ff4fd8 0%, #38e8ff 100%);
  --danger: #f43f5e;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 7px;
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-ocean);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  user-select: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

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

#map-canvas.dragging {
  cursor: grabbing;
}

#map-canvas.pin-cursor {
  cursor: crosshair;
}

.hidden {
  display: none !important;
}

.mono {
  font-family: var(--font-mono);
  font-size: 12px;
}

.mono-soft {
  font-size: 12px;
  color: var(--text-dim);
}

/* 顶部悬浮栏 */
.top-bar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
  z-index: 20;
}

.brand-card,
.top-actions {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-card {
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 6px 12px 6px 6px;
  box-shadow: var(--shadow);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-badge {
  background: var(--accent-grad);
  color: #08101c;
  font-size: 11px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 5px;
  letter-spacing: 0.5px;
}

.brand-text {
  font-size: 14px;
  white-space: nowrap;
}

.count-pill {
  font-size: 12px;
  color: var(--accent-cyan);
  background: rgba(56, 232, 255, 0.12);
  border: 1px solid rgba(56, 232, 255, 0.25);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-main);
  cursor: pointer;
  font-size: 18px;
  transition: background 0.15s;
}

.icon-btn:hover {
  background: var(--panel-hover);
}

.segmented {
  display: inline-flex;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 3px;
  box-shadow: var(--shadow);
}

.segmented button {
  border: none;
  background: transparent;
  color: var(--text-dim);
  padding: 6px 11px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.segmented button:hover {
  color: var(--text-main);
}

.segmented button.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 12px;
  background: var(--panel-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.15s;
  white-space: nowrap;
}

.action-btn:hover {
  border-color: rgba(255, 79, 216, 0.5);
  color: #fff;
}

.action-btn.active {
  background: rgba(255, 79, 216, 0.22);
  border-color: var(--accent-pink);
  color: #fff;
}

/* 左侧抽屉 */
.sidebar {
  position: absolute;
  top: 64px;
  left: 12px;
  bottom: 42px;
  width: 340px;
  max-width: calc(100vw - 24px);
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  z-index: 18;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.sidebar.collapsed {
  transform: translateX(calc(-100% - 20px));
  opacity: 0;
  pointer-events: none;
}

.sidebar-header {
  padding: 10px 10px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  height: 36px;
  padding: 0 30px 0 32px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.search-box input:focus {
  border-color: var(--accent-cyan);
  background: rgba(255, 255, 255, 0.09);
}

.clear-btn {
  position: absolute;
  right: 6px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-main);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.sidebar-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--panel-border);
}

.tab-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  padding: 7px 6px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

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

.tab-btn.active {
  background: rgba(56, 232, 255, 0.14);
  color: var(--accent-cyan);
}

.mini-badge {
  background: rgba(255, 79, 216, 0.25);
  color: #ffb8ef;
  font-size: 10px;
  padding: 0 5px;
  border-radius: 999px;
}

.tab-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.tab-panel.active {
  display: flex;
}

.quick-districts-wrap {
  padding: 8px 10px 4px;
}

.section-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.district-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 76px;
  overflow-y: auto;
}

.district-chip {
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-dim);
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}

.district-chip:hover {
  color: #fff;
  border-color: rgba(56, 232, 255, 0.45);
}

.district-chip.active {
  background: rgba(56, 232, 255, 0.18);
  border-color: var(--accent-cyan);
  color: #fff;
}

.quick-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--panel-border);
}

.flag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.flag-chip input {
  accent-color: var(--accent-cyan);
  margin: 0;
}

.list-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.text-btn {
  border: none;
  background: none;
  color: var(--accent-pink);
  font-size: 11.5px;
  cursor: pointer;
  padding: 0;
}

.landmark-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 10px;
}

.landmark-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 9px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.12s;
  border: 1px solid transparent;
}

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

.landmark-item.selected {
  background: rgba(56, 232, 255, 0.12);
  border-color: rgba(56, 232, 255, 0.35);
}

.cat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
  box-shadow: 0 0 8px currentColor;
}

.landmark-item-main {
  flex: 1;
  min-width: 0;
}

.landmark-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.landmark-item-sub {
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.landmark-item-tags {
  display: flex;
  gap: 4px;
  margin-top: 3px;
}

.tiny-tag {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-dim);
}

.tiny-tag.enterable {
  background: rgba(74, 222, 128, 0.15);
  color: #86efac;
}

.tiny-tag.photo {
  background: rgba(56, 232, 255, 0.15);
  color: #7dd3fc;
}

/* 分类筛选 */
.filter-toolbar {
  display: flex;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--panel-border);
}

.small-btn {
  flex: 1;
  height: 30px;
  border: 1px solid var(--panel-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border-radius: 7px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.small-btn.danger {
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.35);
}

.category-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.cat-row:hover {
  background: var(--panel-hover);
}

.cat-row input {
  accent-color: var(--accent-cyan);
  margin: 0;
}

.cat-row-name {
  flex: 1;
  font-size: 13px;
}

.cat-row-count {
  font-size: 11.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.pin-help {
  padding: 10px 12px 6px;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* 详情卡片 */
.detail-card {
  position: absolute;
  top: 64px;
  right: 12px;
  width: 350px;
  max-width: calc(100vw - 24px);
  max-height: calc(100vh - 115px);
  background: var(--panel-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 19;
  user-select: text;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 10px 14px;
  border-bottom: 1px solid var(--panel-border);
}

.detail-title-group {
  min-width: 0;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 5px;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.badge.enterable {
  background: rgba(74, 222, 128, 0.2);
  color: #86efac;
}

.badge.closed {
  background: rgba(244, 63, 94, 0.22);
  color: #fda4af;
}

.detail-header h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
  word-break: break-word;
}

.detail-sub {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 2px;
}

.detail-photo-wrap {
  position: relative;
  width: 100%;
  background: #060b14;
  border-bottom: 1px solid var(--panel-border);
  cursor: zoom-in;
  overflow: hidden;
  max-height: 210px;
}

.detail-photo-wrap img {
  display: block;
  width: 100%;
  max-height: 210px;
  object-fit: cover;
}

.photo-caption {
  position: absolute;
  right: 8px;
  bottom: 6px;
  font-size: 10.5px;
  background: rgba(0, 0, 0, 0.65);
  color: #e2e8f0;
  padding: 2px 7px;
  border-radius: 999px;
}

.detail-body {
  padding: 10px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.info-label {
  font-size: 11px;
  color: var(--text-muted);
}

.info-value {
  font-size: 13px;
  color: var(--text-main);
  word-break: break-word;
}

.tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.detail-actions {
  display: flex;
  gap: 8px;
  padding: 10px 14px 12px;
  border-top: 1px solid var(--panel-border);
}

.primary-btn,
.secondary-btn,
.danger-btn {
  flex: 1;
  height: 34px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: none;
}

.primary-btn {
  background: var(--accent-grad);
  color: #07101c;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--panel-border);
}

.danger-btn {
  background: rgba(244, 63, 94, 0.18);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.4);
}

/* 地图控制按钮 */
.map-controls {
  position: absolute;
  right: 12px;
  bottom: 44px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 16;
}

.ctrl-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-main);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
}

.ctrl-btn:hover {
  background: rgba(30, 41, 59, 0.95);
}

.ctrl-btn.active {
  color: var(--accent-cyan);
  border-color: rgba(56, 232, 255, 0.45);
}

/* 底部状态栏 */
.status-bar {
  position: absolute;
  left: 12px;
  bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--text-dim);
  z-index: 15;
}

.status-bar a {
  color: var(--accent-cyan);
  text-decoration: none;
}

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

/* Tooltip */
.map-tooltip {
  position: absolute;
  pointer-events: none;
  z-index: 25;
  background: rgba(8, 13, 24, 0.94);
  border: 1px solid rgba(56, 232, 255, 0.4);
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 12px;
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  max-width: 240px;
  transform: translate(12px, -50%);
}

.map-tooltip .tt-sub {
  font-size: 11px;
  color: var(--text-dim);
}

/* 打点模式横幅 */
.pin-mode-banner {
  position: absolute;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 79, 216, 0.92);
  color: #0b0d17;
  font-weight: 700;
  font-size: 13px;
  padding: 7px 14px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 25;
  box-shadow: var(--shadow);
}

.pin-mode-banner button {
  border: none;
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  padding: 2px 9px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
}

/* 弹窗 */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 40;
}

.modal-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel-bg-solid);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-lg);
  padding: 14px 16px 16px;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.modal-header h3 {
  margin: 0;
  font-size: 15px;
}

.form-field {
  margin-bottom: 10px;
}

.form-field label {
  display: block;
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.form-field input,
.form-field textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  color: var(--text-main);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--accent-cyan);
}

.color-picker {
  display: flex;
  gap: 10px;
}

.color-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}

.color-dot.active {
  border-color: #fff;
  transform: scale(1.15);
}

.form-coords {
  color: var(--text-muted);
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  gap: 8px;
}

/* 灯箱 */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
  cursor: zoom-out;
}

.lightbox img {
  max-width: 96vw;
  max-height: 92vh;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 52px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(56, 232, 255, 0.45);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 60;
  box-shadow: var(--shadow);
}

.mobile-only {
  display: none;
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
}

/* 移动端适配 */
@media (max-width: 768px) {
  .desktop-only {
    display: none !important;
  }
  .mobile-only {
    display: inline-flex;
  }
  .brand-text {
    font-size: 13px;
  }
  .top-bar {
    flex-wrap: wrap;
    top: 8px;
    left: 8px;
    right: 8px;
    gap: 6px;
  }
  .brand-card {
    flex: 1;
    justify-content: space-between;
  }
  .top-actions {
    width: 100%;
    justify-content: space-between;
  }
  .segmented {
    flex: 1;
  }
  .segmented button {
    flex: 1;
    padding: 6px 6px;
  }
  .sidebar {
    top: 102px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
  }
  .detail-card {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-height: 62vh;
  }
  .map-controls {
    right: 8px;
    bottom: 42px;
  }
  .status-bar {
    left: 8px;
    bottom: 8px;
  }
}
