/* ...保留之前的顶部通用样式... */
:root {
    --bg: #f4f6f8;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --brand: #2563eb;
    --ok: #16a34a;
    --warn: #d97706;
    --border: #e2e8f0;
    --shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0d1117;
        --card: #161b22;
        --text: #e5e7eb;
        --muted: #9ca3af;
        --brand: #3b82f6;
        --ok: #22c55e;
        --warn: #f59e0b;
        --border: #2d3748;
        --shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    transition: background .3s, color .3s;
}

header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    /* 液态玻璃效果 */
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
    /* 动画过渡 */
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.3s ease;
    transform: translateY(0);
    opacity: 1;
}
/* 隐藏状态 */
header.hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}
.wechat-work header { display: none; }
.wechat-work main.wrap { padding-top: 6px; }
@media (prefers-color-scheme: dark) {
    header { 
        background: rgba(17, 24, 39, 0.75);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    }
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 4px; }
main.wrap { padding-top: 70px; } /* 为main添加上边距 */
.headerbar { display: flex; align-items: center; justify-content: space-between; }
h1 { font-size: 20px; margin: 6px 0 12px 0; display: flex; gap: 10px; align-items: center; }
.logo { display: inline-flex; align-items: center; justify-content: center; width: 35px; height: 35px; border-radius: 8px; }
.logo img { width: 35px; height: 35px; filter: none; }
@media (prefers-color-scheme: dark) { .logo img { filter: brightness(1.2) invert(1); } }

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 14px;
}

.search { padding: 14px; }
.search .row { display: flex; justify-content: center; flex-wrap: nowrap; align-items: center; gap: 8px; }
.office-filter { min-height: 36px; margin: 8px 6px 0; display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.office-filter input { width: 16px; height: 16px; }
.office-filter select { min-height: 38px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text); padding: 7px 10px; font-size: 14px; }
.filter-row { margin-top: 8px; display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; }
.filter-row .office-filter { margin: 0; }
.checkbox-filter { cursor: pointer; }
.input-wrap { display: flex; align-items: center; gap: 8px; width: 100%; max-width: 500px; }
#q { width: 100%; flex: 1; min-width: 0; margin: 0; padding: 12px 14px; height: 46px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--text); outline: none; font-size: 16px; transition: border-color .2s; }
.input-wrap .btn { height: 46px; line-height: 46px; }
.clear-btn { width: 28px; min-width: 28px; justify-content: center; font-size: 18px; line-height: 1; border-radius: 999px; }
#q:focus { border-color: var(--brand); }
.btn { cursor: pointer; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--text); padding: 0 16px; height: 46px; font-size: 15px; display: inline-flex; align-items: center; flex: none; white-space: nowrap; }
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:disabled { cursor: not-allowed; color: var(--muted); border-color: var(--border); background: var(--bg); opacity: 0.8; }

.panel-grid {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  grid-template-areas:
    "results building";
  gap: 14px;
}
.panel-grid .card { margin-bottom: 0; }
.results-card { grid-area: results; padding: 10px; min-height: 0; align-self: start; }
.map-card { grid-area: map; padding: 0; align-self: start; overflow: hidden; }
.map-float-anchor { grid-area: map; height: 0; pointer-events: none; }
.building-card { grid-area: building; padding: 10px; align-self: start; }
.map-card.map-floating {
  position: fixed;
  top: auto;
  bottom: 16px;
  right: 16px;
  z-index: 80;
  width: min(360px, calc(100vw - 32px));
  border-radius: 12px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.22);
}
.map-float-header {
  display: none;
}
.map-card.map-floating .map-float-header {
  display: none;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 8px 7px 10px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--card) 92%, var(--bg));
  cursor: move;
  user-select: none;
}
.map-float-title {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}
.map-float-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  flex: none;
}
.map-float-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}
.map-float-close {
  display: none;
}
.map-card.map-floating .map-float-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.map-card.map-floating .map-float-close:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.map-card.map-floating.map-float-dragging {
  cursor: move;
  user-select: none;
}
.map-card.map-floating::after {
  content: "右键拖动";
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 25;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.66);
  color: #fff;
  font-size: 12px;
  line-height: 1.2;
  pointer-events: none;
}
.results-card { display: flex; flex-direction: column; }
.results { overflow: auto; }
.results::-webkit-scrollbar { width: 8px; }
.results::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.6); border-radius: 999px; }
@media(max-width: 900px) {
  .panel-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "map"
      "results"
      "building";
  }
  .results-card, .map-card, .building-card { grid-column: auto; grid-row: auto; }
  .map-card.map-floating {
    position: static;
    width: auto;
    box-shadow: var(--shadow);
  }
  .map-card.map-floating .map-float-header {
    display: none;
  }
}

@media(min-width: 901px) {
  .map-card {
    position: fixed;
    top: auto;
    bottom: 16px;
    right: 16px;
    z-index: 80;
    width: min(360px, calc(100vw - 32px));
    border-radius: 12px;
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.22);
  }
  .map-card.map-dock-left {
    left: 16px;
    right: auto;
  }
  .map-card.map-floating .map-float-close {
    display: none;
  }
}

.results { padding: 10px; border-top: none; width: 100%; min-height: 0; }
.result-status { display: grid; gap: 8px; padding: 4px 4px 10px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.result-status-main { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; color: var(--muted); font-size: 13px; }
.result-status-main strong { color: var(--text); font-size: 14px; }
.active-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.filter-chip { display: inline-flex; align-items: center; min-height: 26px; padding: 3px 9px; border: 1px solid rgba(37, 99, 235, 0.22); border-radius: 999px; background: rgba(37, 99, 235, 0.08); color: var(--brand); font-size: 12px; }
.filter-clear { min-height: 26px; padding: 3px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--muted); font-size: 12px; cursor: pointer; }
.filter-clear:hover { border-color: var(--brand); color: var(--brand); }
.load-more-wrap { display: flex; justify-content: center; padding: 10px 4px 4px; }
.load-more-btn { height: 38px; min-width: min(220px, 100%); justify-content: center; }
.result-group { margin: 12px 0 14px; }
.result-group-title { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 2px; border-bottom: 1px solid var(--border); background: var(--card); color: var(--muted); font-size: 12px; }
.group-count { flex: none; color: var(--muted); font-size: 12px; }
.result { display: grid; grid-template-columns: minmax(54px, max-content) 1fr; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; margin: 7px 0; background: var(--card); width: 100%; cursor: pointer; }
.result.active { border-color: var(--brand); background: rgba(37, 99, 235, 0.055); box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.24); }
.campus { color: var(--brand); }
.bname { font-weight: 600; }
.result-room-block { display: inline-flex; align-items: center; justify-content: center; align-self: center; min-height: 32px; padding: 4px 8px; border-radius: 8px; background: var(--bg); border: 1px solid var(--border); line-height: 1.15; text-align: center; }
.room { font-weight: 800; color: var(--text); }
.result-content { min-width: 0; }
.type { color: var(--text); font-weight: 650; }
.result-main { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; line-height: 1.35; }
.result-meta { margin-top: 4px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 12px; }
.active-label { display: none; padding: 1px 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 600; }
.result.active .active-label { display: inline-flex; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--border); color: var(--muted); }
.hit { padding: 0 2px; border-radius: 4px; background: rgba(250, 204, 21, 0.42); color: inherit; }
.empty-room-badge { display: inline-block; padding: 2px 8px; margin-left: 6px; border-radius: 999px; font-size: 12px; background: #dcfce7; color: #16a34a; border: 1px solid #86efac; font-weight: 500; }
@media (prefers-color-scheme: dark) {
  .empty-room-badge { background: rgba(22, 163, 74, 0.2); color: #4ade80; border-color: rgba(134, 239, 172, 0.3); }
  .hit { background: rgba(234, 179, 8, 0.36); }
}

.building-card-title { padding: 10px 10px 2px; color: var(--text); font-size: 15px; font-weight: 700; }
.b-list { padding: 8px 10px 10px; width: 100%; }
details { border: 1px solid var(--border); border-radius: 12px; margin: 8px 0; background: var(--card); width: 100%; }
.building-details { overflow: hidden; }
.building-details.active { border-color: var(--brand); box-shadow: 0 0 0 1px rgba(37, 99, 235, 0.24); }
.building-details.active > summary { background: rgba(37, 99, 235, 0.055); }
.building-details.active:not([open]) > summary { border-radius: 11px; }
.building-details.active[open] > summary { border-radius: 11px 11px 0 0; }
.building-details.active[open] > .rooms { border-radius: 0 0 11px 11px; }
summary { cursor: pointer; padding: 10px 12px; display: flex; justify-content: space-between; align-items: center; list-style: none; gap: 8px; }
summary::-webkit-details-marker { display: none; }
.b-title { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.summary-hint { flex: none; white-space: nowrap; }
.rooms { padding: 8px 12px; border-top: 1px dashed var(--border); background: var(--bg); }
.floor-details { border: 1px solid var(--border); border-radius: 10px; margin: 8px 0; background: var(--card); }
.floor-details:first-child { margin-top: 0; }
.floor-details:last-child { margin-bottom: 0; }
.floor-summary { cursor: pointer; padding: 8px 10px; font-size: 13px; font-weight: 600; color: var(--brand); list-style: none; }
.floor-summary::-webkit-details-marker { display: none; }
.floor-rooms { display: grid; gap: 6px; padding: 6px 10px 10px; border-top: 1px dashed var(--border); background: var(--bg); }
.room-item { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-items: start; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 14px; }
.room-item > div { min-width: 0; overflow-wrap: anywhere; }
.room-item:last-child { border-bottom: none; }

.empty { color: var(--muted); padding: 16px; text-align: center; }
footer { padding: 20px; color: var(--muted); font-size: 12px; text-align: center; }
.author-line { margin-top: 4px; }

/* ... 保留顶部样式 ... */

/* ==================
   地图相关样式 (移除宽度限制)
   ================== */
.map-section { overflow: hidden; }
.compact-map { padding: 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--border); }

.map-container {
  width: 100%;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  background-color: #f1f5f9;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  cursor: grab;
  touch-action: none;
  border: none;
  /* 容器层面的性能优化 */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  /* 禁用文本选择，防止拖动时出现蓝色选中效果 */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
  background: rgba(241, 245, 249, 0.8);
  z-index: 5;
}
.map-loading .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(148, 163, 184, 0.6);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.map-container:active {
  cursor: grabbing;
}

.map-gesture-toggle,
.map-gesture-hint {
  display: none;
}

.map-gesture-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 20;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.14);
}

.map-gesture-hint {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 20;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}
.map-gesture-hint.is-nudge {
  background: rgba(37, 99, 235, 0.9);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.28);
}

/* 移动层 */
.map-mover {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  will-change: transform;
  /* 强制硬件加速，防止闪屏 */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-perspective: 1000;
  perspective: 1000;
}

#mapImage {
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  /* 优化图片渲染，防止闪烁 */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  image-rendering: auto;
  /* 对高DPI设备的优化 */
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* ... 保持后续样式不变 ... */

.map-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* 叠加层性能优化 */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.highlight-box {
  position: absolute;
  border: 4px solid #ef4444;
  background-color: rgba(239, 68, 68, 0.3);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.8);
  border-radius: 4px;
  z-index: 10;
  /* 呼吸灯动画 */
  animation: pulse 1.5s infinite;
  /* 动画性能优化 */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.highlight-circle {
  position: absolute;
  border: 4px solid rgba(37, 99, 235, 1);
  background: transparent;
  box-shadow:
    0 0 0 6px rgba(37, 99, 235, 0.18),
    0 0 20px rgba(37, 99, 235, 0.9),
    0 0 44px rgba(37, 99, 235, 0.6),
    0 0 72px rgba(37, 99, 235, 0.35);
  border-radius: 50%;
  z-index: 10;
  animation: circle-pulse 1.4s ease-out infinite;
  /* 动画性能优化 */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.section-title {
  color: #475569;
  margin: 0 0 10px 6px;
}

.summary-hint {
  font-size: 12px;
  color: var(--muted);
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes circle-pulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7), 0 0 20px rgba(37, 99, 235, 0.9), 0 0 44px rgba(37, 99, 235, 0.6), 0 0 72px rgba(37, 99, 235, 0.35); }
  70% { box-shadow: 0 0 0 12px rgba(37, 99, 235, 0), 0 0 26px rgba(37, 99, 235, 0.8), 0 0 52px rgba(37, 99, 235, 0.55), 0 0 80px rgba(37, 99, 235, 0.3); }
  100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0), 0 0 20px rgba(37, 99, 235, 0.9), 0 0 44px rgba(37, 99, 235, 0.6), 0 0 72px rgba(37, 99, 235, 0.35); }
}

@media (prefers-color-scheme: dark) {
  .map-container { background-color: #1e293b; }
  .map-gesture-toggle { background: rgba(17, 24, 39, 0.88); }
  .section-title { color: #cbd5e1; }
}

@media(max-width: 900px) {
  main.wrap { padding-top: 64px; }
  .wechat-work main.wrap { padding-top: 6px; }
  .wrap { padding: 6px; }
  .card { border-radius: 12px; margin-bottom: 10px; }
  .search { padding: 10px; }
  .filter-row {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: stretch;
    align-items: stretch;
    gap: 8px;
  }
  .unit-filter-label {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    width: 100%;
  }
  .unit-filter-label select {
    width: 100%;
    max-width: none;
    min-height: 44px;
    padding: 9px 12px;
  }
  .checkbox-filter {
    width: max-content;
    justify-self: start;
    justify-content: flex-start;
    padding: 4px 2px;
  }
  .map-card { padding: 0; }
  .map-container {
    touch-action: pan-y;
    cursor: default;
  }
  .map-container:active {
    cursor: default;
  }
  .map-container.map-gesture-active {
    touch-action: none;
    cursor: grab;
  }
  .map-container.map-gesture-active:active {
    cursor: grabbing;
  }
  .map-gesture-toggle,
  .map-gesture-hint {
    display: block;
  }
  .map-container.map-gesture-active .map-gesture-toggle {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
  }
  .result { border-radius: 10px; padding: 9px 10px; }
  .result-status { padding: 6px 4px 9px; }
  .result-group-title { position: static; }
  .results.has-more-results {
    position: relative;
  }
  .results.has-more-results::after {
    content: "向上滑动结果区查看更多";
    position: sticky;
    left: 50%;
    bottom: 6px;
    display: block;
    width: max-content;
    max-width: calc(100% - 20px);
    margin: -28px auto 0;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    color: #fff;
    font-size: 12px;
    text-align: center;
    pointer-events: none;
  }
  .room-item { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; font-size: 13px; }
  .room-item > div:nth-child(3) { color: var(--muted); }
}
