/* Kepma 代理商地图样式：黑色、暖白与少量木色，适配桌面、平板和手机。 */
:root {
  --ink: #0b0b0c;
  --panel: #111214;
  --panel-2: #1a1b1e;
  --paper: #f5f0e8;
  --muted: #929398;
  --wood: #c79b76;
  --line: rgba(245, 240, 232, .12);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--ink); }
body { color: var(--paper); font-family: Arial, "PingFang SC", "Microsoft YaHei", sans-serif; }
button, input, select { font: inherit; }
button, select { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 2px solid var(--wood); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.app { height: 100dvh; display: grid; grid-template-columns: minmax(360px, 400px) minmax(0, 1fr); transition: grid-template-columns .3s cubic-bezier(.22, .8, .22, 1); }
.app.panel-collapsed { grid-template-columns: 52px minmax(0, 1fr); }
.dealer-panel { position: relative; z-index: 10; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 36px 30px 17px; overflow: hidden; border-right: 1px solid var(--line); background: var(--panel); transition: padding .3s ease; }
.dealer-panel.collapsed { padding: 0; }
.dealer-panel.collapsed > :not(.panel-toggle):not(.sheet-handle) { display: none; }
.sheet-handle { display: none; }
.panel-toggle { position: absolute; z-index: 5; top: 14px; right: 12px; display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--panel-2); color: var(--wood); cursor: pointer; }
.panel-toggle-arrow { font: 23px/1 Georgia, serif; transform: translateY(-1px); }
.panel-toggle-label { display: none; }
.dealer-panel.collapsed .panel-toggle { top: 12px; right: auto; left: 8px; width: 36px; height: 118px; flex-direction: column; gap: 12px; border-radius: 18px; }
.dealer-panel.collapsed .panel-toggle-label { display: block; color: #aaa9a7; font-size: 9px; letter-spacing: .2em; writing-mode: vertical-rl; }

.eyebrow { margin: 0 0 14px; color: var(--wood); font-size: 9px; font-weight: 700; letter-spacing: .34em; }
h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(29px, 2.5vw, 40px); line-height: 1.18; font-weight: 500; letter-spacing: -.035em; }
.intro { max-width: 310px; margin: 12px 0 22px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.controls { flex: 0 0 auto; }
.search-box { height: 47px; display: flex; align-items: center; gap: 12px; padding: 0 13px; border: 1px solid var(--line); background: var(--panel-2); }
.search-box:focus-within { border-color: rgba(199, 155, 118, .7); }
.search-box input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--paper); font-size: 12px; }
.search-box input::placeholder { color: #6f7075; }
.search-icon { position: relative; flex: 0 0 auto; width: 14px; height: 14px; border: 1.6px solid var(--wood); border-radius: 50%; }
.search-icon::after { content: ""; position: absolute; right: -5px; bottom: -2px; width: 6px; height: 1.5px; background: var(--wood); transform: rotate(45deg); }
.filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.select-wrap { position: relative; }
.select-wrap::after { content: ""; position: absolute; right: 12px; top: 15px; width: 6px; height: 6px; border-right: 1px solid #88898e; border-bottom: 1px solid #88898e; transform: rotate(45deg); pointer-events: none; }
.select-wrap select { width: 100%; height: 41px; padding: 0 31px 0 12px; appearance: none; border: 1px solid var(--line); background: transparent; color: #b6b5b2; font-size: 11px; cursor: pointer; }
.select-wrap option { color: #191919; }
.primary-button { width: 100%; height: 43px; margin: 8px 0; border: 0; background: var(--paper); color: var(--ink); font-size: 11px; font-weight: 700; cursor: pointer; }
.locate-dot { display: inline-block; width: 9px; height: 9px; margin-right: 9px; border: 2px solid var(--wood); border-radius: 50%; box-shadow: 0 0 0 3px rgba(199, 155, 118, .22); }
.results-heading { display: flex; justify-content: space-between; flex: 0 0 auto; padding-bottom: 11px; border-bottom: 1px solid var(--line); color: #77787d; font-size: 9px; letter-spacing: .17em; }
.dealer-list { min-height: 0; flex: 1 1 auto; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #3f4044 transparent; overscroll-behavior: contain; }
.dealer-card { width: 100%; display: grid; grid-template-columns: 29px 1fr; gap: 8px; padding: 15px 3px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: #85868b; text-align: left; cursor: pointer; }
.dealer-card:hover, .dealer-card.selected { color: var(--paper); background: rgba(255, 255, 255, .025); }
.card-index { color: var(--wood); font: 10px Georgia, serif; padding-top: 2px; }
.card-title { display: flex; justify-content: space-between; gap: 8px; font-family: Georgia, "Songti SC", serif; font-size: 14px; line-height: 1.35; }
.card-distance { flex: 0 0 auto; color: var(--wood); font: 9px Arial, sans-serif; }
.card-address { display: block; margin-top: 5px; color: #77787d; font-size: 10px; line-height: 1.55; }
.empty-state { padding: 30px 8px; color: #77787d; font-size: 11px; line-height: 1.7; text-align: center; }

.map-stage { position: relative; min-width: 0; overflow: hidden; background: #e9e5df; }
#map { position: absolute; inset: 0; }
.map-title { position: absolute; z-index: 4; top: 25px; left: 28px; display: flex; align-items: baseline; gap: 10px; color: #4a4743; pointer-events: none; }
.map-title span { font: 18px Georgia, serif; letter-spacing: .12em; }
.map-title small { color: #8e8982; font-size: 8px; letter-spacing: .15em; }
.provider-chip { position: absolute; z-index: 7; top: 18px; right: 58px; display: flex; align-items: center; gap: 8px; height: 31px; padding: 0 11px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 18px; background: rgba(11, 11, 12, .9); color: #aaa9a7; font-size: 9px; cursor: pointer; }
.provider-chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--wood); box-shadow: 0 0 0 3px rgba(199, 155, 118, .14); }
.detail-card { position: absolute; z-index: 7; left: 30px; bottom: 28px; width: min(330px, calc(100% - 60px)); padding: 24px; background: rgba(12, 12, 13, .96); color: var(--paper); box-shadow: 0 22px 48px rgba(0, 0, 0, .28); }
.detail-card[hidden] { display: none; }
.detail-close { position: absolute; top: 9px; right: 10px; width: 28px; height: 28px; border: 0; background: transparent; color: #77787d; font-size: 20px; cursor: pointer; }
.detail-kicker { margin-bottom: 9px; color: var(--wood); font-size: 8px; letter-spacing: .22em; }
.detail-card h2 { margin: 0 24px 12px 0; font: 500 21px/1.3 Georgia, "Songti SC", serif; }
.detail-row { display: grid; grid-template-columns: 49px 1fr; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); color: #adaca9; font-size: 10px; line-height: 1.5; }
.detail-row span:first-child { color: #66676b; }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 15px; }
.detail-actions a { display: grid; place-items: center; height: 37px; border: 1px solid var(--line); color: var(--paper); font-size: 10px; text-decoration: none; }
.detail-actions a:last-child { border-color: var(--paper); background: var(--paper); color: var(--ink); }
.map-message { position: absolute; z-index: 6; inset: 0; display: grid; place-items: center; padding: 32px; background: #e9e5df; color: #6f6b65; font-size: 12px; line-height: 1.8; text-align: center; }
.map-message[hidden] { display: none; }
.toast { position: absolute; z-index: 12; top: 62px; left: 50%; max-width: min(520px, calc(100% - 110px)); padding: 11px 14px; background: rgba(12, 12, 13, .94); color: #cfceca; font-size: 10px; line-height: 1.5; opacity: 0; transform: translate(-50%, -8px); pointer-events: none; transition: .2s ease; }
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.user-marker { width: 18px; height: 18px; border: 5px solid var(--paper); border-radius: 50%; background: #2d6fb1; box-shadow: 0 0 0 4px rgba(45, 111, 177, .25); }
.amap-marker-button { width: 28px; height: 28px; padding: 0; border: 6px solid rgba(11, 11, 12, .22); border-radius: 50%; background: var(--wood); box-shadow: 0 8px 22px rgba(0, 0, 0, .2); cursor: pointer; }
.amap-marker-button.active { background: var(--paper); box-shadow: 0 0 0 3px var(--wood); }

.guide-page { min-height: 100%; overflow: auto; background: #efebe4; color: #252321; }
.guide { width: min(880px, calc(100% - 34px)); margin: 0 auto; padding: 52px 0 80px; }
.guide h1, .guide h2 { font-family: Georgia, "Songti SC", serif; font-weight: 500; }
.guide h1 { font-size: clamp(32px, 5vw, 54px); }
.guide h2 { margin-top: 42px; padding-top: 24px; border-top: 1px solid #d4cec5; }
.guide p, .guide li { color: #5f5a54; line-height: 1.8; }
.guide code, .guide pre { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.guide code { padding: 2px 5px; background: #ded8cf; color: #332f2a; }
.guide pre { overflow: auto; padding: 18px; background: #171718; color: #ded8cf; line-height: 1.65; }
.guide a { color: #8f5f3d; }
.guide .warning { padding: 18px 20px; border-left: 3px solid #a66840; background: #e5ddd2; }

@media (max-width: 980px) and (min-width: 761px) {
  .app { grid-template-columns: 340px minmax(0, 1fr); }
  .app.panel-collapsed { grid-template-columns: 52px minmax(0, 1fr); }
  .dealer-panel { padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 760px) {
  .app, .app.panel-collapsed { display: block; position: relative; }
  .map-stage { position: absolute; inset: 0; }
  .dealer-panel { position: absolute; z-index: 10; left: 8px; right: 8px; bottom: 8px; height: 52vh; padding: 0 17px 12px; border: 0; border-radius: 16px 16px 4px 4px; box-shadow: 0 -16px 46px rgba(0, 0, 0, .36); transition: height .3s ease; }
  .dealer-panel.collapsed { height: 44px; padding: 0 17px; }
  .sheet-handle { display: block; width: 100%; height: 28px; flex: 0 0 28px; border: 0; background: transparent; touch-action: none; }
  .sheet-handle span { display: block; width: 38px; height: 3px; margin: 9px auto 0; border-radius: 3px; background: #4d4d50; }
  .panel-toggle, .dealer-panel.collapsed .panel-toggle { top: 2px; right: 8px; left: auto; width: 34px; height: 28px; border: 0; background: transparent; }
  .dealer-panel.collapsed .panel-toggle-label { display: none; }
  .panel-heading { display: none; }
  .search-box { height: 42px; }
  .select-wrap select { height: 37px; }
  .select-wrap::after { top: 13px; }
  .primary-button { height: 39px; }
  .dealer-card { padding: 12px 2px; }
  .card-address { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .map-title { top: 17px; left: 16px; }
  .map-title span { font-size: 15px; }
  .provider-chip { top: 13px; right: 53px; }
  .detail-card { top: 55px; right: 12px; bottom: auto; left: 12px; width: auto; max-height: 40vh; overflow: auto; padding: 19px; }
  .toast { top: 56px; max-width: calc(100% - 24px); width: max-content; }
  .maplibregl-ctrl-top-right { top: 43px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
