/* 问道 PRO — 浅色地图 App（深蓝色 #1E3A8A 参考风格） */

:root {
  --blue: #1e3a8a;
  --blue-dark: #172554;
  --blue-soft: rgba(30, 58, 138, 0.16);
  --page-bg: #f2f3f5;
  --surface: #ffffff;
  --text: #1a1a1a;
  --text-2: #4b5563;
  --text-3: #9ca3af;
  --line: rgba(0, 0, 0, 0.06);
  --line-strong: rgba(0, 0, 0, 0.1);
  --shadow-float: 0 4px 24px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
  --shadow-dock: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-fab: 0 8px 20px rgba(30, 58, 138, 0.45);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  /* 底栏：wrap 下内边距 12 + dock 上下 10+10 + 中间列（标签+FAB）≈76 + FAB 上凸 26 + 与提示条间距 12 */
  --dock-clearance: calc(118px + var(--safe-bottom));

  --radius-pill: 999px;
  --radius-card: 16px;
  --radius-ctrl: 12px;

  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-lg: 17px;
  --text-xl: 20px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.32s;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.45;
  background: var(--page-bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  position: relative;
}

/* —— 地图全屏 —— */
.panel-page {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

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

.map-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #e8e9ec;
}

/* 地图标点：正一红、全真蓝，其余中性色 */
.map-marker-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  box-sizing: border-box;
}
.map-marker-dot--zhengyi {
  background: #dc2626;
}
.map-marker-dot--quanzhen {
  background: #2563eb;
}
.map-marker-dot--other {
  background: #475569;
}

#map {
  width: 100%;
  height: 100%;
}

/* 悬浮底栏盖住地图底边时，抬高高德 Logo / 版权，与 map-overlay-hint 使用同一预留高度 */
#map .amap-logo,
#map .amap-copyright {
  bottom: calc(var(--dock-clearance) + 4px) !important;
}

.map-ui {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.map-ui__top {
  pointer-events: auto;
  padding: calc(var(--safe-top) + 10px) 14px 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.map-ui__brand {
  display: flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 6px 14px 6px 8px;
  background: var(--surface);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-float);
  border: 1px solid var(--line);
}

.map-ui__logo {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.map-ui__taiji {
  width: 30px;
  height: 30px;
  display: block;
}

.map-ui__title {
  font-weight: 700;
  font-size: var(--text-sm);
  letter-spacing: 0.03em;
  line-height: 1.25;
  color: var(--text);
  white-space: nowrap;
}

@media (max-width: 400px) {
  .map-ui__brand {
    padding: 5px 10px 5px 6px;
    max-width: min(calc(100vw - 100px), 280px);
  }

  .map-ui__title {
    font-size: 11px;
    letter-spacing: 0.02em;
    white-space: normal;
    max-width: 11em;
  }
}

.map-ui__chips-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  margin: 0 -14px;
  padding: 0 14px 2px;
  scrollbar-width: none;
}

.map-ui__chips-scroll::-webkit-scrollbar {
  display: none;
}

.map-ui__chips {
  display: flex;
  gap: 8px;
  width: max-content;
  padding-bottom: 2px;
}

.filter-pill {
  flex-shrink: 0;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-float);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.12s ease;
}

.filter-pill:active {
  transform: scale(0.98);
}

.filter-pill.active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  box-shadow: var(--shadow-float), 0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.map-ui__search-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.map-search-field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-float);
  pointer-events: auto;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.map-search-field:focus-within {
  border-color: rgba(30, 58, 138, 0.55);
  box-shadow: var(--shadow-float), 0 0 0 3px var(--blue-soft);
}

.map-search-field svg {
  flex-shrink: 0;
  opacity: 0.45;
  stroke: var(--text);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

.map-search-field input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  font-size: var(--text-sm);
  color: var(--text);
  outline: none;
}

.map-search-field input::placeholder {
  color: var(--text-3);
}

.map-search-field input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.btn-pill-ghost {
  flex-shrink: 0;
  height: 46px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-float);
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.12s ease;
}

.btn-pill-ghost:active {
  transform: scale(0.98);
}

/* 右下角控件 */
.map-controls {
  position: absolute;
  right: 14px;
  bottom: calc(var(--dock-clearance) + 56px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
}

.map-ctrl-btn {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: var(--radius-ctrl);
  background: var(--surface);
  color: var(--text);
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-float);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, background 0.2s ease;
}

.map-ctrl-btn:active {
  transform: scale(0.96);
  background: #f9fafb;
}

.map-ctrl-btn--icon {
  font-size: 0;
}

.map-ctrl-btn--icon svg {
  stroke: var(--text);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
}

.map-overlay-hint {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: var(--dock-clearance);
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  font-size: var(--text-xs);
  color: var(--text-2);
  line-height: 1.4;
  pointer-events: none;
  box-shadow: var(--shadow-float);
}

/* —— 悬浮式底栏 —— */
.dock-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  padding: 0 20px calc(12px + var(--safe-bottom));
  pointer-events: none;
}

.app-dock {
  pointer-events: auto;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
  min-width: min(320px, 92vw);
  padding: 10px 12px 10px;
  background: var(--surface);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-dock);
  border: 1px solid var(--line);
}

.dock-item {
  flex: 1;
  max-width: 96px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 2px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-3);
  transition: color 0.2s ease;
}

.dock-item__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.dock-item__icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dock-item__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.dock-item.active:not(.dock-item--center) {
  color: var(--text);
}

.dock-item--center {
  position: relative;
  padding-top: 0;
  margin-top: -26px;
  color: var(--text-3);
}

.dock-item--center.active {
  color: var(--text);
}

.dock-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--page-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 2px;
  box-shadow: var(--shadow-float);
  transition: background 0.25s var(--ease), box-shadow 0.25s ease, transform 0.2s var(--ease);
}

.dock-fab svg {
  width: 26px;
  height: 26px;
  stroke: var(--text-2);
  fill: none;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dock-item--center.active .dock-fab {
  background: var(--blue);
  box-shadow: var(--shadow-fab);
  transform: scale(1.02);
}

.dock-item--center.active .dock-fab svg {
  stroke: #fff;
}

/* —— 内页（分类 / 我的） —— */
.panel-page--sheet {
  background: var(--page-bg);
}

.panel-scroll {
  flex: 1;
  overflow: auto;
  padding: 20px 18px calc(var(--dock-clearance) + 24px);
  -webkit-overflow-scrolling: touch;
}

.page-head {
  margin-bottom: 18px;
}

.page-title {
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: var(--text);
}

.page-sub {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--text-3);
  line-height: 1.45;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}

.chip-row--wrap {
  flex-wrap: wrap;
}

.chip {
  padding: 8px 16px;
  min-height: 38px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--text-sm);
  font-weight: 600;
  border: 1px solid var(--line-strong);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.chip.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

#cat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.temple-row {
  padding: 16px;
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.2s ease, transform 0.12s ease;
}

.temple-row:active {
  transform: scale(0.99);
  box-shadow: var(--shadow-float);
}

.temple-row h4 {
  margin: 0 0 6px;
  font-size: var(--text-base);
  font-weight: 700;
}

.temple-row p {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--text-3);
  line-height: 1.45;
}

.profile-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  padding: 28px 22px;
  text-align: center;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-float);
}

.profile-card .avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  color: var(--blue-dark);
  background: var(--blue-soft);
  border: 3px solid #fff;
  box-shadow: var(--shadow-float);
}

.profile-name {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 700;
}

.profile-meta {
  margin: 10px 0 0;
  font-size: var(--text-sm);
  color: var(--text-3);
  line-height: 1.5;
}

/* —— 抽屉（宽屏占比大） —— */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 25, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur) ease, visibility var(--dur) ease;
  z-index: 100;
}

.drawer-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(90vw, 400px);
  height: 100%;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.1);
  transform: translateX(100%);
  transition: transform var(--dur) var(--ease);
  z-index: 101;
  display: flex;
  flex-direction: column;
  padding-top: calc(var(--safe-top) + 8px);
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 8px 18px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-header h2 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 800;
}

.drawer-close {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--page-bg);
  color: var(--text-2);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
}

.drawer-scroll {
  flex: 1;
  overflow: auto;
  padding: 14px 16px;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}

.drawer-footer {
  flex-shrink: 0;
  padding: 12px 16px calc(14px + var(--safe-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.btn-drawer-primary {
  width: 100%;
  height: 52px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--blue);
  color: #fff;
  font-size: var(--text-base);
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(30, 58, 138, 0.35);
  transition: filter 0.15s ease, transform 0.12s ease;
}

.btn-drawer-primary:active {
  filter: brightness(0.95);
  transform: scale(0.99);
}

.drawer-section-title {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 18px 0 10px;
  padding-left: 4px;
  border-left: 3px solid var(--blue);
}

.drawer-section-title:first-child {
  margin-top: 0;
}

.sd-item {
  width: 100%;
  text-align: left;
  padding: 14px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s ease, transform 0.12s ease;
}

.sd-item:active {
  transform: scale(0.99);
  border-color: rgba(30, 58, 138, 0.4);
}

.sd-item .name {
  font-weight: 700;
  font-size: var(--text-sm);
  margin-bottom: 4px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  line-height: 1.35;
}

.sd-item .alias {
  font-size: var(--text-xs);
  color: var(--blue-dark);
  font-weight: 600;
}

.sd-item .addr {
  font-size: var(--text-xs);
  color: var(--text-3);
  margin-top: 6px;
  line-height: 1.45;
}

.badge-fj {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  letter-spacing: 0.06em;
}

/* —— 底部 Sheet —— */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 25, 0.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
  z-index: 110;
}

.sheet-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 80vh;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  transform: translateY(105%);
  transition: transform var(--dur) var(--ease);
  z-index: 111;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(var(--safe-bottom) + 12px);
  border: 1px solid var(--line);
  border-bottom: none;
  box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.12);
}

.sheet.open {
  transform: translateY(0);
}

.sheet-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.sheet-handle {
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: #e5e7eb;
  margin: 10px auto 4px;
  flex-shrink: 0;
}

.sheet-close {
  position: absolute;
  top: 8px;
  right: 14px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--page-bg);
  color: var(--text-2);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  z-index: 2;
}

.sheet-body {
  overflow: auto;
  padding: 0 20px 16px;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  min-height: 0;
}

.sheet-title {
  margin: 0 0 12px;
  padding-right: 48px;
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.kv {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px 12px;
  font-size: var(--text-sm);
  margin-bottom: 8px;
}

.kv dt {
  margin: 0;
  color: var(--text-3);
  font-weight: 600;
}

.kv dd {
  margin: 0;
  word-break: break-word;
  color: var(--text-2);
}

.sheet-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.sheet-actions button {
  flex: 1;
  min-height: 50px;
  border: none;
  border-radius: var(--radius-pill);
  font-size: var(--text-base);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.sheet-actions button:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 4px 14px rgba(30, 58, 138, 0.35);
}

.btn-secondary {
  background: var(--page-bg);
  color: var(--text);
  border: 1px solid var(--line-strong);
}

/* —— Toast —— */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--dock-clearance) + 20px);
  transform: translateX(-50%) translateY(12px);
  padding: 12px 20px;
  background: rgba(26, 26, 26, 0.92);
  color: #fff;
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s ease, transform 0.28s var(--ease), visibility 0.28s ease;
  z-index: 200;
  max-width: min(340px, 88vw);
  text-align: center;
  line-height: 1.45;
  box-shadow: var(--shadow-dock);
}

.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* —— 启动错误 —— */
.boot-error {
  position: fixed;
  inset: 0;
  background: var(--page-bg);
  color: var(--text);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  z-index: 300;
}

.boot-error.show {
  display: flex;
}

.boot-error__icon {
  width: 64px;
  height: 64px;
  margin-bottom: 18px;
  border-radius: 16px;
  background: var(--blue-soft);
  border: 1px solid rgba(30, 58, 138, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue-dark);
  font-size: 28px;
  font-weight: 800;
}

.boot-error__title {
  margin: 0 0 10px;
  font-size: var(--text-xl);
  font-weight: 800;
}

.boot-error p,
.boot-error__text {
  margin: 0;
  color: var(--text-2);
  font-size: var(--text-sm);
  line-height: 1.6;
  max-width: 280px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.filter-pill:focus-visible,
.btn-pill-ghost:focus-visible,
.map-ctrl-btn:focus-visible {
  outline-offset: 3px;
}
