/* 布局原则：手机上地图至少占一半屏幕（底部抽屉 max-height 42vh）。 */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  font: 15px/1.55 "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #1c2733; background: #0e141b;
}
/* UI 随视口分档缩放：4K/高分辨率屏（100% 系统缩放）下整体放大，笔记本保持原样 */
:root { --ui-zoom: 1; }
@media (min-width: 1700px) { :root { --ui-zoom: 1.25; } }
@media (min-width: 2200px) { :root { --ui-zoom: 1.55; } }
@media (min-width: 3000px) { :root { --ui-zoom: 1.9; } }
@media (min-width: 3600px) { :root { --ui-zoom: 2.2; } }
#topbar, #modebar, #left, #route-top-banner, #credits, #toast { zoom: var(--ui-zoom); }
#app { position: relative; width: 100%; height: 100%; }
#scene { position: absolute; inset: 0; }
#scene canvas { display: block; }

/* 顶栏 */
#topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; pointer-events: none;
}
#campus-title {
  background: rgba(16, 32, 48, .82); color: #fff;
  padding: 6px 14px; border-radius: 16px; font-weight: 600; font-size: 15px; pointer-events: auto;
}
#draft-banner {
  background: rgba(255, 196, 0, .92); color: #4a3200; font-size: 12.5px;
  padding: 5px 11px; border-radius: 14px; pointer-events: auto;
}

/* 模式条 */
#modebar {
  position: absolute; left: 12px; top: 46px; z-index: 20;
  display: flex; gap: 8px;
}
.mode-btn {
  border: 0; background: rgba(255, 255, 255, .92); color: #16324f;
  padding: 8px 15px; border-radius: 15px; font-size: 14px; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
}
.mode-btn.active { background: #16324f; color: #fff; }

/* 左栏（桌面） */
#left {
  position: absolute; left: 12px; top: 90px; bottom: 34px; width: 410px; z-index: 15;
  background: rgba(255, 255, 255, .96); border-radius: 12px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .25);
  display: flex; flex-direction: column; overflow: hidden;
}
.pane { display: flex; flex-direction: column; min-height: 0; height: 100%; padding: 14px; gap: 12px; overflow: hidden; }
.pane[hidden] { display: none; }

#search { width: 100%; padding: 10px 12px; border: 1px solid #c8d2dc; border-radius: 9px; font-size: 15px; }
#position-box { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pos-btn { border: 1px solid #b9c6d2; background: #f2f6fa; border-radius: 13px; padding: 6px 13px; font-size: 13.5px; cursor: pointer; }
.pos-btn.active { background: #16324f; color: #fff; border-color: #16324f; }
.pos-btn.warn-btn { background: #fff3cd; border-color: #e0a800; color: #7a5200; font-weight: 600; }
#position-note { font-size: 13.5px; color: #5a6b7b; width: 100%; line-height: 1.5; }
#position-note .pos-warn {
  margin-top: 6px; color: #b02a2a; background: #fdeaea; border-radius: 8px; padding: 6px 9px; font-size: 13px;
}
#position-note .pos-warn + .pos-btn { margin-top: 6px; }

#place-list { list-style: none; overflow-y: auto; flex: 1; min-height: 0; }
#place-list li {
  padding: 11px 8px; border-bottom: 1px solid #eef2f5; cursor: pointer;
  display: flex; align-items: center; gap: 10px;
}
#place-list li:hover { background: #f2f7fc; }
#place-list li img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; background: #dde5ec; flex-shrink: 0; }
#place-list .pl-name { flex: 1; min-width: 0; }
#place-list .pl-name .n { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: 16px; }
#place-list .pl-name .s { display: block; font-size: 12.5px; color: #7b8a99; margin-top: 1px; }
#place-list .pl-dist { font-size: 14px; color: #33475b; white-space: nowrap; font-variant-numeric: tabular-nums; }

.ghost-btn {
  align-self: flex-start; border: 0; background: none; color: #2a6ebb;
  cursor: pointer; font-size: 14px; padding: 2px 0;
}

#detail-body { overflow-y: auto; flex: 1; min-height: 0; }
#detail-body h2 { font-size: 20px; margin: 6px 0 3px; }
#detail-body .prov { font-size: 13.5px; color: #64748b; margin: 3px 0; line-height: 1.5; }
#detail-body .prov b { color: #41556b; font-weight: 600; }
#detail-body .mainphoto { width: 100%; border-radius: 10px; margin: 8px 0 4px; background: #dde5ec; display: block; cursor: zoom-in; }
#detail-body .credit { font-size: 12px; color: #8a99a8; margin-bottom: 8px; }
#detail-body .warn { font-size: 13px; color: #9a6b00; background: #fff7dd; border-radius: 8px; padding: 7px 9px; margin: 6px 0; }
#detail-body .empty-photo { font-size: 13.5px; color: #7b8a99; background: #f1f5f8; border-radius: 8px; padding: 9px; margin: 8px 0; }
#detail-body .inside-list { list-style: none; margin-top: 6px; }
#detail-body .inside-list li { padding: 8px 4px; border-top: 1px solid #eef2f5; cursor: pointer; font-size: 14.5px; }
#detail-body .route-btns { display: flex; gap: 8px; margin: 10px 0 4px; }
#detail-body .route-btns button {
  flex: 1; border: 1px solid #2a6ebb; background: #eaf3fc; color: #1a5493;
  border-radius: 8px; padding: 8px 0; cursor: pointer; font-size: 14px;
}

/* 新生动线 */
#orientation-status { font-size: 13.5px; color: #9a6b00; background: #fff7dd; border-radius: 8px; padding: 9px; line-height: 1.5; }
#orientation-steps { list-style: none; overflow-y: auto; flex: 1; }
#orientation-steps li { padding: 12px 8px; border-bottom: 1px solid #eef2f5; }
#orientation-steps .ord {
  display: inline-flex; width: 24px; height: 24px; border-radius: 50%;
  background: #16324f; color: #fff; align-items: center; justify-content: center;
  font-size: 13px; margin-right: 8px;
}
#orientation-steps li.unknown .ord { background: #aab6c2; }
#orientation-steps li.unknown { color: #8a99a8; }
#orientation-steps li.unknown .title { pointer-events: none; }
#orientation-steps .title { font-weight: 600; font-size: 15.5px; }
#orientation-steps .why { font-size: 13px; color: #a25b00; margin-top: 4px; }
#orientation-steps .det { font-size: 13.5px; color: #5a6b7b; margin-top: 4px; }
#orientation-steps .src { font-size: 12px; color: #94a3b2; margin-top: 2px; }
#orientation-steps .goto {
  margin-top: 6px; border: 1px solid #2a6ebb; background: #eaf3fc; color: #1a5493;
  border-radius: 8px; padding: 5px 12px; cursor: pointer; font-size: 13px;
}

/* 数据覆盖 */
.coverage-legend { font-size: 14px; display: grid; gap: 6px; }
.swatch { display: inline-block; width: 15px; height: 15px; border-radius: 3px; vertical-align: -2px; margin-right: 6px; }
.swatch-osm { background: #3f7fbf; }
.swatch-wts { background: #e6973c; }
.swatch-unknown { background: #b8c2cc; }
#coverage-stats, #coverage-notes { font-size: 13.5px; color: #5a6b7b; overflow-y: auto; line-height: 1.6; }
#coverage-notes div { margin-bottom: 6px; }

/* 路线 */
#route-hint { font-size: 14px; color: #5a6b7b; }
#route-steps { overflow-y: auto; flex: 1; font-size: 14.5px; }
#route-steps .seg { padding: 8px 4px; border-bottom: 1px solid #eef2f5; }
#route-banner {
  font-size: 13px; color: #9a6b00; background: #fff7dd; border-radius: 8px; padding: 9px;
}
#route-top-banner {
  position: absolute; top: 44px; left: 50%; transform: translateX(-50%); z-index: 18;
  background: rgba(255, 247, 221, .96); color: #9a6b00; font-size: 12px;
  padding: 6px 14px; border-radius: 16px; box-shadow: 0 2px 10px rgba(0,0,0,.2);
}

#credits {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 20;
  font-size: 11px; color: #c3d2e0; background: rgba(10, 18, 26, .78);
  padding: 4px 12px; text-align: center;
}

#toast {
  position: absolute; left: 50%; bottom: 64px; transform: translateX(-50%); z-index: 40;
  background: rgba(16, 32, 48, .92); color: #fff; padding: 8px 16px;
  border-radius: 18px; font-size: 13px; max-width: 86vw;
}

/* 手机：左栏变底部抽屉，地图至少占一半 */
@media (max-width: 760px) {
  #left {
    left: 0; right: 0; top: auto; bottom: 0; width: auto;
    max-height: 42vh; border-radius: 14px 14px 0 0;
  }
  #modebar { top: 40px; flex-wrap: wrap; max-width: 94vw; }
  #credits { font-size: 10px; }
  #route-top-banner { top: auto; bottom: calc(42vh + 8px); max-width: 92vw; }
  #toast { bottom: calc(42vh + 44px); }
}
