:root {
  color-scheme: dark;
  --bg: #0f1713;
  --surface: rgba(18, 27, 23, 0.86);
  --surface-solid: #18221d;
  --surface-soft: rgba(255, 255, 255, 0.08);
  --line: rgba(239, 246, 235, 0.16);
  --text: #f4f7ed;
  --muted: rgba(244, 247, 237, 0.68);
  --soft: rgba(244, 247, 237, 0.48);
  --green: #58d38c;
  --green-deep: #1f6f4b;
  --water: #72c7d2;
  --amber: #f0b84d;
  --clay: #c28d62;
  --danger: #ff7a6f;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 10%, rgba(88, 211, 140, 0.14), transparent 30%),
    linear-gradient(145deg, #111c17, #0b100e 52%, #16170f);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  cursor: pointer;
}

.phone-shell {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 640px;
  overflow: hidden;
  background: var(--bg);
  isolation: isolate;
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
}

.screen.active {
  display: block;
}

.home-screen {
  overflow-y: auto;
  overflow-x: hidden;
  padding: max(18px, env(safe-area-inset-top)) 0 max(16px, env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(33, 58, 44, 0.54), rgba(12, 17, 14, 0.82) 42%),
    #111914;
}

.home-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.5;
  background:
    linear-gradient(135deg, transparent 0 20%, rgba(255, 255, 255, 0.035) 20% 21%, transparent 21% 42%, rgba(255, 255, 255, 0.025) 42% 43%, transparent 43%),
    radial-gradient(circle at 78% 16%, rgba(114, 199, 210, 0.14), transparent 26%);
}

.home-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-right: 32px;
  margin-left: 16px;
  width: auto;
  max-width: none;
}

.eyebrow,
.field-label {
  display: block;
  color: var(--soft);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.home-header h1 {
  margin: 8px 0 0;
  font-size: 46px;
  line-height: 1;
  letter-spacing: 0;
}

.home-copy {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
}

.icon-btn.glass,
.icon-btn.raised {
  background: rgba(15, 22, 18, 0.64);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(16px);
}

.map-card {
  position: relative;
  width: auto;
  max-width: none;
  height: min(48dvh, 430px);
  min-height: 330px;
  margin: 22px 32px 0 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #132119;
  box-shadow: var(--shadow);
}

.map-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  opacity: 0;
  background: linear-gradient(100deg, transparent 0 34%, rgba(244, 247, 237, 0.16) 48%, transparent 62% 100%);
  transform: translateX(-100%);
  pointer-events: none;
}

.home-loading .map-card::after {
  opacity: 1;
  animation: home-map-scan 1200ms cubic-bezier(0.22, 1, 0.36, 1) infinite;
}

.home-loading-query .map-card::after {
  animation-duration: 900ms;
}

.map,
.map-fallback {
  position: absolute;
  inset: 0;
}

.map {
  z-index: 1;
  background: #132119;
}

.map-fallback {
  z-index: 2;
  display: none;
  background:
    linear-gradient(180deg, rgba(16, 37, 31, 0.12), rgba(7, 12, 10, 0.2)),
    #17241c;
}

.map-fallback.active {
  display: block;
}

.terrain {
  position: absolute;
  right: -10%;
  left: -10%;
  height: 46%;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(180deg, rgba(65, 113, 77, 0.92), rgba(34, 78, 55, 0.86));
  transform: rotate(-5deg);
}

.terrain-a {
  top: 24%;
}

.terrain-b {
  top: 36%;
  background: linear-gradient(180deg, rgba(42, 93, 68, 0.82), rgba(25, 61, 47, 0.9));
  transform: rotate(7deg);
}

.lake-shape {
  position: absolute;
  right: 10%;
  bottom: 11%;
  left: 7%;
  height: 42%;
  border-radius: 44% 56% 48% 52%;
  background: linear-gradient(145deg, rgba(114, 199, 210, 0.7), rgba(35, 93, 108, 0.92));
  box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.12);
  transform: rotate(-8deg);
}

.map-dots {
  position: absolute;
  inset: 0;
}

.map-dot {
  position: absolute;
  display: grid;
  place-items: center;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 6px rgba(240, 184, 77, 0.16);
  transform: translate(-50%, -50%);
}

.map-dot.peak {
  width: 9px;
  height: 9px;
  border-width: 1px;
  background: var(--green);
  box-shadow: none;
}

.map-overlay {
  position: absolute;
  right: 12px;
  bottom: 38px;
  left: 12px;
  z-index: 4;
  display: block;
  min-height: 64px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 22, 18, 0.72);
  backdrop-filter: blur(16px);
}

.map-overlay > div {
  min-width: 0;
  padding-right: 88px;
}

.map-overlay strong {
  display: block;
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 18px;
}

.ghost-btn,
.secondary-btn {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  white-space: nowrap;
}

.map-overlay .ghost-btn {
  position: absolute;
  top: 12px;
  right: 28px;
}

.map-locate-btn {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 6;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(244, 247, 237, 0.28);
  border-radius: 8px;
  background: rgba(10, 15, 13, 0.8);
  color: var(--text);
  font-size: 20px;
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.map-attribution {
  position: absolute;
  right: 12px;
  bottom: 8px;
  left: 12px;
  z-index: 4;
  margin: 0;
  color: rgba(244, 247, 237, 0.58);
  font-size: 10px;
}

.route-panel {
  width: auto;
  max-width: none;
  margin: 14px 32px 0 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

.route-main {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 12px;
}

.route-dot {
  width: 12px;
  height: 12px;
  margin-top: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(88, 211, 140, 0.12);
}

.home-loading .route-panel {
  border-color: rgba(88, 211, 140, 0.38);
  background: rgba(88, 211, 140, 0.08);
}

.home-loading .route-dot {
  animation: route-dot-breathe 900ms ease-in-out infinite;
}

.route-panel h2 {
  margin: 0;
  font-size: 20px;
}

.route-panel p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.metric-grid div {
  min-width: 0;
  min-height: 64px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.16);
}

.metric-grid span {
  display: block;
  color: var(--soft);
  font-size: 11px;
}

.metric-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.home-actions {
  position: static;
  display: grid;
  gap: 10px;
  margin: 14px 32px max(16px, env(safe-area-inset-bottom)) 16px;
}

.home-actions > .primary-btn,
.home-actions > .secondary-actions {
  width: 100%;
}

.primary-btn,
.scan-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 56px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--green), #9be4b9);
  color: #102018;
  box-shadow: 0 20px 46px rgba(39, 166, 95, 0.24);
  transition:
    filter 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.primary-btn:disabled,
.scan-btn:disabled,
.icon-btn:disabled,
.map-locate-btn:disabled {
  cursor: progress;
  opacity: 0.82;
}

.primary-btn.loading {
  transform: translateY(1px) scale(0.99);
  filter: saturate(1.08);
  box-shadow: 0 12px 30px rgba(39, 166, 95, 0.2);
}

.primary-btn.loading > span {
  animation: busy-spin 820ms linear infinite;
}

.primary-btn strong,
.scan-btn strong {
  font-size: 16px;
  font-weight: 850;
}

.secondary-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
}

.home-actions .secondary-btn {
  width: 100%;
  min-height: 56px;
}

.secondary-btn {
  color: var(--text);
}

.camera,
.fallback-scene,
.frozen-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #17221d;
  opacity: 0;
  transition: opacity 180ms ease;
}

.camera.active,
.fallback-scene.active,
.frozen-frame.active {
  opacity: 1;
}

.shade {
  position: absolute;
  right: 0;
  left: 0;
  z-index: 2;
  pointer-events: none;
}

.top-shade {
  top: 0;
  height: 30%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.72), transparent);
}

.bottom-shade {
  bottom: 0;
  height: 46%;
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.82), transparent);
}

.scanner-topbar {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: 14px;
  width: calc(100vw - 96px);
  max-width: calc(100vw - 96px);
  z-index: 8;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 10px;
}

.scanner-title {
  display: grid;
  justify-items: center;
  gap: 5px;
}

.status-pill,
.sensor-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border: 1px solid rgba(88, 211, 140, 0.42);
  border-radius: 999px;
  background: rgba(26, 91, 61, 0.58);
  color: #e4fff0;
  font-size: 12px;
  white-space: nowrap;
}

.sensor-pill {
  justify-self: end;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.sensor-pill.warn {
  border-color: rgba(240, 184, 77, 0.5);
  background: rgba(105, 72, 18, 0.64);
  color: #ffe4a3;
}

.label-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.mountain-label {
  position: absolute;
  z-index: 2;
  min-width: 136px;
  max-width: 192px;
  padding: 10px 11px;
  border: 1px solid rgba(240, 184, 77, 0.72);
  border-radius: 8px;
  background: rgba(16, 19, 14, 0.74);
  color: var(--text);
  text-align: left;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  transform: translate(-50%, -50%);
  pointer-events: auto;
  backdrop-filter: blur(14px);
}

.label-stem {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 1px;
  min-height: 22px;
  background: linear-gradient(180deg, rgba(240, 184, 77, 0.82), transparent);
  transform-origin: 50% 0;
  pointer-events: none;
}

.mountain-label strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.25;
}

.mountain-label span {
  display: block;
  margin-top: 5px;
  color: #ffd990;
  font-size: 12px;
}

.mountain-label .label-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 8px;
}

.label-metrics b {
  font-weight: 760;
}

.mountain-label.primary {
  z-index: 8;
  border-color: rgba(88, 211, 140, 0.86);
  background: rgba(16, 66, 43, 0.78);
}

.mountain-label.primary span {
  color: #cfffe0;
}

.label-empty,
.label-overflow {
  position: absolute;
  left: 50%;
  bottom: 34%;
  max-width: min(260px, calc(100vw - 128px));
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 22, 18, 0.72);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  transform: translateX(-50%);
  backdrop-filter: blur(14px);
}

.label-overflow {
  top: max(112px, calc(env(safe-area-inset-top) + 88px));
  bottom: auto;
  left: 16px;
  z-index: 1;
  max-width: min(210px, calc(100vw - 132px));
  color: #ffdf9e;
  text-align: left;
  transform: none;
}

.center-guide {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.center-guide span {
  position: relative;
  width: min(42vw, 190px);
  aspect-ratio: 1;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 50%;
}

.center-guide span::before,
.center-guide span::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  background: var(--amber);
  transform: translate(-50%, -50%);
}

.center-guide span::before {
  width: 18px;
  height: 1px;
}

.center-guide span::after {
  width: 1px;
  height: 18px;
}

.mini-radar {
  position: absolute;
  right: 92px;
  top: max(98px, calc(env(safe-area-inset-top) + 82px));
  z-index: 7;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.radar-ring {
  position: relative;
  width: 92px;
  height: 92px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(88, 211, 140, 0.24) 0 2px, transparent 3px),
    rgba(15, 22, 18, 0.62);
  backdrop-filter: blur(16px);
}

.radar-ring::before,
.radar-ring::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.14);
}

.radar-ring::before {
  top: 50%;
  right: 12px;
  left: 12px;
  height: 1px;
}

.radar-ring::after {
  top: 12px;
  bottom: 12px;
  left: 50%;
  width: 1px;
}

.radar-n {
  position: absolute;
  top: 7px;
  left: 50%;
  color: var(--soft);
  font-size: 10px;
  transform: translateX(-50%);
}

.radar-heading {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 2px;
  height: 34px;
  border-radius: 2px;
  background: var(--amber);
  transform-origin: 50% 36px;
}

.radar-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  border: 1px solid rgba(255, 255, 255, 0.54);
  border-radius: 50%;
  background: var(--water);
  transform: translate(-50%, -50%);
}

.radar-dot.visible {
  background: var(--green);
}

.scanner-sheet {
  position: absolute;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 14px;
  width: calc(100vw - 96px);
  max-width: calc(100vw - 96px);
  z-index: 8;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 22, 18, 0.74);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.scanner-status {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
}

.scanner-status strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.heading-control {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
}

.heading-control input {
  width: 100%;
  accent-color: var(--green);
}

.scan-actions {
  display: grid;
  grid-template-columns: 46px 1fr 46px 46px;
  gap: 10px;
}

.scan-btn {
  min-height: 48px;
}

.scan-sweep {
  position: absolute;
  right: 0;
  left: 0;
  top: -18%;
  z-index: 3;
  height: 18%;
  opacity: 0;
  background: linear-gradient(180deg, rgba(88, 211, 140, 0), rgba(88, 211, 140, 0.34), rgba(88, 211, 140, 0));
  pointer-events: none;
}

.scanning .scan-sweep {
  animation: sweep 900ms ease-in-out;
  opacity: 1;
}

@keyframes sweep {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(760%);
  }
}

@keyframes home-map-scan {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

@keyframes route-dot-breathe {
  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(88, 211, 140, 0.12);
  }
  50% {
    transform: scale(1.18);
    box-shadow: 0 0 0 10px rgba(88, 211, 140, 0.04);
  }
}

@keyframes busy-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-loading .map-card::after,
  .home-loading .route-dot,
  .primary-btn.loading > span,
  .scanning .scan-sweep {
    animation: none;
  }

  .primary-btn,
  .scan-btn,
  .route-panel {
    transition: none;
  }
}

.dev-panel {
  position: absolute;
  right: 14px;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 14px;
  z-index: 20;
  display: none;
  max-height: min(52dvh, 420px);
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(114, 199, 210, 0.34);
  border-radius: 8px;
  background: rgba(10, 15, 13, 0.94);
  box-shadow: var(--shadow);
}

.dev-panel.active {
  display: block;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.dev-readout {
  display: grid;
  gap: 8px;
}

.dev-row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
}

.dev-row span {
  color: var(--soft);
}

.dev-row strong {
  color: var(--text);
  font-weight: 650;
  overflow-wrap: anywhere;
}

.settings-dialog {
  position: fixed;
  top: auto;
  right: 32px;
  bottom: 0;
  left: 0;
  width: auto;
  max-width: none;
  max-height: 74dvh;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.settings-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.location-dialog {
  position: fixed;
  top: auto;
  right: 32px;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 16px;
  width: auto;
  max-width: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
}

.location-dialog::backdrop {
  background: rgba(0, 0, 0, 0.42);
}

.location-sheet {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 19, 16, 0.96);
  box-shadow: var(--shadow);
}

.location-sheet h2 {
  margin: 0;
  font-size: 22px;
}

.location-sheet p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.settings-sheet {
  max-height: 74dvh;
  overflow: auto;
  padding: 18px 16px max(18px, env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  background: rgba(13, 19, 16, 0.96);
  box-shadow: var(--shadow);
}

.settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.settings-head h2 {
  margin: 5px 0 0;
  font-size: 24px;
}

.setting-group {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.setting-group .segmented-control {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.setting-group .segmented-control[data-setting-group="searchRadiusKm"] {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.setting-select {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 0 12px;
}

.setting-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.setting-toggle strong,
.setting-toggle small {
  display: block;
}

.setting-toggle small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.setting-toggle input {
  width: 22px;
  height: 22px;
  accent-color: var(--green);
}

.setting-action {
  width: 100%;
  margin-top: 14px;
  color: var(--text);
}

.setting-action + .setting-action {
  margin-top: 8px;
}

.detail-dialog {
  position: fixed;
  top: auto;
  right: 64px;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 16px;
  width: auto;
  margin: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #151d18;
  color: var(--text);
  box-shadow: var(--shadow);
}

.detail-dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 24px;
}

.detail-meta {
  margin: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.detail-dialog h2 {
  margin: 8px 42px 16px 0;
  font-size: 28px;
  line-height: 1.1;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0 0 18px;
}

.detail-grid div {
  min-height: 66px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.detail-grid dt {
  color: var(--soft);
  font-size: 12px;
}

.detail-grid dd {
  margin: 8px 0 0;
  font-size: 16px;
  font-weight: 800;
}

.detail-copy,
.detail-route {
  margin: 0;
  color: rgba(244, 247, 237, 0.86);
  font-size: 14px;
  line-height: 1.65;
}

.detail-route {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: #ffdf9e;
}

.compass-dialog {
  position: fixed;
  inset: 0;
  width: auto;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: max(18px, env(safe-area-inset-top)) 40px max(16px, env(safe-area-inset-bottom)) 16px;
  border: 0;
  background: #101713;
  color: var(--text);
}

.compass-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.compass-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.compass-head h2 {
  margin: 6px 0 0;
  font-size: 26px;
  line-height: 1.1;
}

.compass-map {
  position: relative;
  height: calc(100dvh - 306px);
  min-height: 360px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #17241c;
  box-shadow: var(--shadow);
}

.compass-map-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #17241c;
}

.compass-map-base {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0.92;
}

.map-ready .compass-map-base,
.map-ready .compass-dots {
  display: none;
}

.compass-view-cone {
  position: absolute;
  z-index: 8;
  width: min(86vw, 360px);
  height: min(86vw, 360px);
  border-radius: 50%;
  border: 1px solid rgba(24, 83, 49, 0.34);
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.1) 0 22%, transparent 23%),
    conic-gradient(from -35deg, rgba(48, 166, 89, 0.3) 0 70deg, transparent 70deg 360deg);
  box-shadow: inset 0 0 0 1px rgba(240, 255, 221, 0.18), 0 0 28px rgba(48, 166, 89, 0.18);
  pointer-events: none;
  transform-origin: center;
  mix-blend-mode: multiply;
}

.compass-heading-line {
  position: absolute;
  z-index: 10;
  width: 3px;
  height: min(40vw, 180px);
  border-radius: 2px;
  background: linear-gradient(180deg, #f0b84d, rgba(240, 184, 77, 0));
  box-shadow: 0 0 0 1px rgba(36, 25, 8, 0.34), 0 0 16px rgba(240, 184, 77, 0.4);
  transform-origin: 50% 100%;
  pointer-events: none;
}

.compass-dial {
  position: absolute;
  z-index: 7;
  display: none;
  width: min(88vw, 368px);
  height: min(88vw, 368px);
  border: 1px solid rgba(244, 247, 237, 0.24);
  border-radius: 50%;
  background:
    repeating-conic-gradient(rgba(22, 36, 28, 0.34) 0deg 1deg, transparent 1deg 15deg),
    radial-gradient(circle, rgba(246, 247, 231, 0.08) 0 22%, transparent 23% 37%, rgba(15, 22, 18, 0.3) 38% 38.8%, transparent 39.2% 61%, rgba(15, 22, 18, 0.36) 62% 62.8%, transparent 63.2%);
  opacity: 0.9;
  pointer-events: none;
}

.compass-dial.active {
  display: block;
}

.compass-dial.fengshui {
  border: 2px solid rgba(230, 184, 92, 0.58);
  background:
    repeating-conic-gradient(from -7.5deg, rgba(231, 188, 93, 0.28) 0deg 0.8deg, transparent 0.8deg 15deg),
    repeating-conic-gradient(rgba(244, 247, 237, 0.12) 0deg 0.28deg, transparent 0.28deg 5deg),
    radial-gradient(circle, rgba(10, 15, 13, 0.08) 0 17%, rgba(231, 188, 93, 0.22) 17.4% 17.9%, transparent 18.2% 30%, rgba(231, 188, 93, 0.3) 30.4% 31%, transparent 31.4% 39.5%, rgba(244, 247, 237, 0.2) 40% 40.6%, transparent 41% 48%, rgba(231, 188, 93, 0.34) 48.4% 49%, transparent 49.5% 58%, rgba(231, 188, 93, 0.34) 58.5% 59.2%, transparent 59.6%),
    rgba(25, 20, 12, 0.18);
  box-shadow:
    inset 0 0 0 5px rgba(12, 16, 12, 0.2),
    inset 0 0 42px rgba(231, 188, 93, 0.12),
    0 18px 46px rgba(0, 0, 0, 0.24);
}

.dial-label {
  position: absolute;
  color: rgba(18, 27, 20, 0.82);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  text-shadow: 0 1px 3px rgba(255, 248, 222, 0.78);
  transform: translate(-50%, -50%);
}

.dial-label small {
  display: block;
  margin-top: 2px;
  font-size: 9px;
  font-weight: 700;
  opacity: 0.72;
}

.compass-dial .dial-label.major {
  color: #122018;
  font-size: 15px;
}

.compass-dial .dial-label.minor {
  font-size: 10px;
}

.compass-dial.standard .dial-label.mountain,
.compass-dial.standard .ring-mountain,
.compass-dial.standard .ring-bagua {
  display: none;
}

.compass-dial.fengshui .dial-label.major {
  color: #1f1a0c;
  font-size: 13px;
  text-shadow: 0 1px 3px rgba(255, 248, 222, 0.82);
}

.compass-dial.fengshui .dial-label.minor {
  color: rgba(34, 28, 12, 0.86);
  font-size: 10px;
}

.compass-dial.fengshui .dial-label.mountain {
  color: #4a3208;
  font-size: 12px;
  font-weight: 900;
  text-shadow: 0 1px 3px rgba(255, 248, 222, 0.82);
}

.dial-ring {
  position: absolute;
  inset: 50%;
  border: 1px solid rgba(231, 188, 93, 0.28);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.ring-outer {
  width: 96%;
  height: 96%;
}

.ring-nav-mid {
  width: 72%;
  height: 72%;
  border-color: rgba(18, 27, 20, 0.24);
}

.ring-nav-inner {
  width: 46%;
  height: 46%;
  border-color: rgba(18, 27, 20, 0.18);
}

.ring-mountain {
  width: 84%;
  height: 84%;
}

.ring-bagua {
  width: 66%;
  height: 66%;
}

.ring-center {
  width: 28%;
  height: 28%;
  background: radial-gradient(circle, rgba(240, 184, 77, 0.22), rgba(12, 18, 14, 0.12));
}

.dial-cross::before,
.dial-cross::after {
  content: "";
  position: absolute;
  z-index: 1;
  background: rgba(198, 55, 45, 0.72);
  box-shadow: 0 0 8px rgba(198, 55, 45, 0.24);
}

.dial-cross::before {
  top: 3%;
  bottom: 3%;
  left: 50%;
  width: 1px;
}

.dial-cross::after {
  right: 3%;
  left: 3%;
  top: 50%;
  height: 1px;
}

.dial-tick {
  position: absolute;
  top: 3.5%;
  left: 50%;
  width: 1px;
  height: 7px;
  background: rgba(244, 247, 237, 0.24);
  transform: translateX(-50%) rotate(var(--angle));
  transform-origin: 50% min(41vw, 170px);
}

.dial-tick.medium {
  height: 12px;
  background: rgba(231, 188, 93, 0.5);
}

.dial-tick.big {
  width: 2px;
  height: 16px;
  background: rgba(255, 238, 177, 0.78);
}

.dial-center {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(231, 188, 93, 0.44);
  border-radius: 50%;
  background: rgba(10, 15, 13, 0.52);
  color: #241a08;
  font-size: 11px;
  font-weight: 900;
  text-shadow: 0 1px 3px rgba(255, 248, 222, 0.82);
  transform: translate(-50%, -50%);
}

.dial-center b,
.dial-center small {
  display: block;
  line-height: 1;
}

.dial-center small {
  margin-top: 3px;
  font-size: 9px;
  opacity: 0.74;
}

.compass-distance-rings {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.distance-ring {
  position: absolute;
  border: 1px solid rgba(20, 31, 23, 0.34);
  border-radius: 50%;
  background: rgba(248, 244, 218, 0.055);
  box-shadow: inset 0 0 0 1px rgba(255, 250, 222, 0.18);
  transform: translate(-50%, -50%);
}

.distance-ring em {
  position: absolute;
  right: 8px;
  bottom: var(--label-y, 50%);
  padding: 2px 5px;
  border-radius: 6px;
  background: rgba(245, 241, 218, 0.72);
  color: #1a251c;
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
  transform: translateY(50%);
}

.compass-legend {
  position: absolute;
  left: 10px;
  bottom: 10px;
  z-index: 16;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: calc(100% - 20px);
  padding: 7px;
  border: 1px solid rgba(244, 247, 237, 0.18);
  border-radius: 8px;
  background: rgba(10, 15, 13, 0.76);
  color: rgba(244, 247, 237, 0.82);
  font-size: 11px;
  backdrop-filter: blur(14px);
}

.compass-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: var(--water);
}

.legend-dot.visible {
  background: var(--green);
}

.legend-dot.nearby {
  background: var(--water);
}

.legend-dot.here {
  background: var(--amber);
}

.compass-dots {
  position: absolute;
  inset: 0;
  z-index: 9;
}

.compass-dot {
  position: absolute;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
}

.compass-dot.peak {
  width: 13px;
  height: 13px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 50%;
  background: var(--water);
  box-shadow: 0 0 0 6px rgba(114, 199, 210, 0.1);
}

.compass-dot.peak.visible {
  background: var(--green);
  box-shadow: 0 0 0 7px rgba(88, 211, 140, 0.16);
}

.compass-dot.peak span {
  display: none;
}

.compass-dot.here {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.86);
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 9px rgba(240, 184, 77, 0.18);
}

.compass-map-marker {
  display: block;
  padding: 0;
  border: 0;
  transform: translate(-50%, -50%);
}

.compass-map-marker.peak {
  width: 15px;
  height: 15px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 50%;
  background: var(--water);
  box-shadow: 0 0 0 7px rgba(114, 199, 210, 0.12);
}

.compass-map-marker.peak.visible {
  background: var(--green);
  box-shadow: 0 0 0 8px rgba(88, 211, 140, 0.18);
}

.compass-map-marker.here {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 10px rgba(240, 184, 77, 0.2);
}

.compass-popup {
  position: absolute;
  z-index: 20;
  display: grid;
  gap: 5px;
  min-width: 138px;
  max-width: 180px;
  padding: 10px;
  border: 1px solid rgba(244, 247, 237, 0.18);
  border-radius: 8px;
  background: rgba(10, 15, 13, 0.88);
  color: var(--text);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
  transform: translate(-50%, calc(-100% - 16px));
  backdrop-filter: blur(16px);
}

.compass-popup[hidden] {
  display: none;
}

.compass-popup strong {
  font-size: 15px;
}

.compass-popup span {
  color: #ffdf9e;
  font-size: 12px;
}

.compass-popup button {
  justify-self: start;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
}

.compass-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.compass-controls > * {
  min-width: 0;
}

.compass-controls > div,
.compass-controls > button,
.segmented-control {
  min-height: 52px;
}

.compass-controls > div:not(.segmented-control) {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.compass-controls strong {
  display: block;
  margin-top: 6px;
}

.compass-controls .secondary-btn.active {
  border-color: rgba(88, 211, 140, 0.44);
  background: rgba(26, 91, 61, 0.58);
}

.segmented-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.segmented-control button {
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  overflow: hidden;
  font-size: 13px;
  white-space: nowrap;
}

.segmented-control button.active {
  background: rgba(244, 247, 237, 0.14);
  color: var(--text);
}

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

.maplibre-marker {
  display: block;
  width: 10px;
  height: 10px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  background: var(--green);
}

.viewpoint-marker {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.82);
  background: var(--amber);
  box-shadow: 0 0 0 7px rgba(240, 184, 77, 0.18);
}

@media (min-width: 760px) {
  body {
    display: grid;
    place-items: center;
    overflow: auto;
    padding: 28px;
  }

  .phone-shell {
    width: min(430px, 100vw);
    height: min(900px, calc(100dvh - 56px));
    min-height: 760px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.42);
  }

  .home-header,
  .map-card,
  .route-panel,
  .scanner-topbar,
  .scanner-sheet {
    width: auto;
    max-width: none;
  }

  .scanner-topbar {
    right: 14px;
  }

  .scanner-sheet {
    right: 14px;
  }

  .mini-radar {
    right: 14px;
  }
}

@media (max-height: 730px) {
  .map-card {
    min-height: 280px;
    height: 42dvh;
  }

  .route-panel {
    padding: 12px;
  }

  .metric-grid div {
    min-height: 56px;
  }

  .heading-control {
    display: none;
  }
}
