/* =========================
   华灿智能装备客户互动地图
   无第三方依赖，可离线运行
   ========================= */

:root {
  --navy: #073574;
  --blue: #0878de;
  --cyan: #00bff3;
  --light-blue: #dff4ff;
  --gold: #ffb21d;
  --green: #18a454;
  --ink: #102a52;
  --muted: #6980a4;
  --border: rgba(44, 116, 190, 0.22);
  --panel: rgba(255, 255, 255, 0.94);
  --shadow: 0 26px 76px rgba(11, 71, 139, 0.17);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC",
    "Source Han Sans SC", Arial, sans-serif;
  background:
    radial-gradient(circle at 10% 10%, rgba(0, 191, 243, 0.13), transparent 32rem),
    radial-gradient(circle at 90% 90%, rgba(24, 164, 84, 0.09), transparent 30rem),
    linear-gradient(145deg, #eef7ff, #fbfdff 50%, #edf7ff);
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.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 {
  width: min(1840px, calc(100% - 30px));
  margin: 18px auto 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 13px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 34px rgba(11, 66, 126, 0.09);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
}

.brand__mark {
  position: relative;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 4px solid #d0efff;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 0 6px rgba(0, 191, 243, 0.1);
}

.brand h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(16px, 1.35vw, 24px);
  line-height: 1.35;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.select-box select,
.btn {
  min-height: 40px;
  border: 1px solid #c9dbef;
  border-radius: 11px;
  outline: none;
  color: var(--navy);
  background: #fff;
  transition: 0.2s ease;
}

.select-box select {
  min-width: 160px;
  padding: 0 34px 0 12px;
}

.btn {
  padding: 0 14px;
  font-weight: 700;
}

.btn:hover,
.btn:focus-visible,
.select-box select:hover,
.select-box select:focus {
  border-color: var(--cyan);
  box-shadow: 0 8px 22px rgba(0, 153, 222, 0.16);
  transform: translateY(-1px);
}

.btn--primary {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #0878de, #00bff3);
}

.map-card {
  padding: 9px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.93);
  box-shadow: var(--shadow);
}

.map-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: 17px;
  background: #f4faff;
  isolation: isolate;
  user-select: none;
}

.map-image {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.route-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.active-route {
  fill: none;
  stroke: var(--gold);
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-dasharray: 11 8;
  marker-end: url(#routeArrow);
  filter: url(#routeGlow);
  opacity: 0;
  transition: opacity 0.22s ease;
  animation: routeMove 1.2s linear infinite;
}

.active-route.is-visible {
  opacity: 1;
}

@keyframes routeMove {
  to {
    stroke-dashoffset: -38;
  }
}

.hub {
  position: absolute;
  z-index: 6;
  left: 68.62%;
  top: 50.2%;
  width: 2.1%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.hub__core {
  position: absolute;
  inset: 29%;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow:
    0 0 0 3px rgba(0, 191, 243, 0.82),
    0 0 18px 7px rgba(0, 191, 243, 0.36);
}

.hub::before,
.hub::after {
  content: "";
  position: absolute;
  inset: 10%;
  border: 2px solid rgba(0, 191, 243, 0.55);
  border-radius: 50%;
  animation: hubPulse 2s ease-out infinite;
}

.hub::after {
  animation-delay: 1s;
}

@keyframes hubPulse {
  from {
    transform: scale(0.7);
    opacity: 0.85;
  }
  to {
    transform: scale(2.3);
    opacity: 0;
  }
}

.hotspot-layer,
.count-layer {
  position: absolute;
  inset: 0;
}

.hotspot-layer {
  z-index: 8;
}

.count-layer {
  z-index: 7;
  pointer-events: none;
}

.province-hotspot {
  position: absolute;
  min-width: 28px;
  min-height: 26px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  outline: none;
  color: transparent;
  background: transparent;
  transform: translate(-50%, -50%);
}

.province-hotspot::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(46px, 74%);
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 50%;
  background: transparent;
  transform: translate(-50%, -50%);
  transition: 0.2s ease;
}

.province-hotspot:hover::before,
.province-hotspot:focus-visible::before,
.province-hotspot.is-active::before {
  border-color: rgba(255, 178, 29, 0.98);
  background: rgba(255, 178, 29, 0.2);
  box-shadow:
    0 0 0 7px rgba(255, 178, 29, 0.12),
    0 0 22px rgba(255, 178, 29, 0.72);
  transform: translate(-50%, -50%) scale(1.12);
}

.province-hotspot::after {
  content: attr(data-name) " " attr(data-count) "家";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 3px);
  padding: 5px 9px;
  border: 1px solid rgba(0, 191, 243, 0.45);
  border-radius: 999px;
  color: #fff;
  font-size: clamp(9px, 0.72vw, 13px);
  font-weight: 700;
  white-space: nowrap;
  background: rgba(5, 62, 137, 0.94);
  box-shadow: 0 8px 20px rgba(3, 43, 98, 0.22);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 7px);
  transition: 0.2s ease;
}

.province-hotspot:hover::after,
.province-hotspot:focus-visible::after,
.province-hotspot.is-active::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.count-badge {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.94);
  border-radius: 999px;
  color: #fff;
  font-size: clamp(9px, 0.72vw, 13px);
  font-weight: 800;
  white-space: nowrap;
  background: linear-gradient(135deg, #0754b6, #00aee9);
  box-shadow:
    0 6px 18px rgba(0, 81, 161, 0.25),
    0 0 0 3px rgba(0, 191, 243, 0.12);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.82);
  transition: 0.2s ease;
}

.count-badge strong {
  color: #ffe18c;
  font-size: 1.12em;
}

.count-badge.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.count-badge.is-selected {
  border-color: #fff6ca;
  background: linear-gradient(135deg, #ef8d00, #ffbc22);
  box-shadow:
    0 8px 24px rgba(236, 132, 0, 0.32),
    0 0 0 5px rgba(255, 178, 29, 0.15);
}

.count-badge.is-selected strong {
  color: #fff;
}

.detail-panel {
  position: absolute;
  z-index: 14;
  width: clamp(225px, 18vw, 310px);
  padding: 17px;
  border: 1px solid rgba(126, 211, 255, 0.5);
  border-radius: 18px;
  color: #fff;
  background:
    linear-gradient(145deg, rgba(5, 49, 111, 0.97), rgba(0, 148, 218, 0.94));
  box-shadow: 0 24px 52px rgba(0, 49, 111, 0.32);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.97);
  transition: 0.22s ease;
}

.detail-panel.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.detail-panel__close {
  position: absolute;
  right: 9px;
  top: 8px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.14);
}

.detail-panel__tag {
  color: #c4ecff;
  font-size: 12px;
  letter-spacing: 0.12em;
}

.detail-panel h2 {
  margin: 5px 0 10px;
  font-size: clamp(25px, 2vw, 38px);
}

.detail-panel__count {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 11px 13px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.1);
}

.detail-panel__count strong {
  color: #ffe18c;
  font-size: clamp(36px, 3.2vw, 56px);
  line-height: 1;
}

.detail-panel__count span {
  font-size: 14px;
}

.detail-panel__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 11px;
}

.detail-panel__grid div {
  padding: 8px 4px;
  border-radius: 10px;
  text-align: center;
  background: rgba(255, 255, 255, 0.09);
}

.detail-panel__grid span,
.detail-panel__grid b {
  display: block;
}

.detail-panel__grid span {
  margin-bottom: 3px;
  color: #caecff;
  font-size: 10px;
}

.detail-panel__grid b {
  font-size: 12px;
}

.click-tip {
  position: absolute;
  z-index: 11;
  right: 2.3%;
  bottom: 2.4%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(0, 163, 225, 0.3);
  border-radius: 999px;
  color: var(--navy);
  font-size: clamp(10px, 0.82vw, 14px);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.91);
  box-shadow: 0 8px 24px rgba(5, 80, 150, 0.12);
  pointer-events: none;
  animation: tipFloat 2.4s ease-in-out infinite;
}

.click-tip__icon {
  position: relative;
  width: 13px;
  height: 18px;
  border: 2px solid var(--cyan);
  border-radius: 8px;
}

.click-tip__icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 3px;
  width: 2px;
  height: 4px;
  border-radius: 2px;
  background: var(--cyan);
  transform: translateX(-50%);
}

@keyframes tipFloat {
  50% {
    transform: translateY(-4px);
  }
}

.summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(135px, 1fr)) minmax(250px, 1.7fr);
  gap: 10px;
  margin-top: 13px;
}

.summary-card,
.status-message {
  min-height: 78px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 28px rgba(11, 66, 126, 0.08);
}

.summary-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 13px 15px;
}

.summary-card span {
  color: var(--muted);
  font-size: 13px;
}

.summary-card strong {
  color: var(--navy);
  font-size: clamp(25px, 2vw, 38px);
}

.summary-card small {
  margin-left: 3px;
  font-size: 12px;
}

.summary-card__text {
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  font-size: clamp(20px, 1.7vw, 31px) !important;
}

.summary-card--accent {
  background: linear-gradient(135deg, #0878de, #00bff3);
}

.summary-card--accent span,
.summary-card--accent strong {
  color: #fff;
}

.status-message {
  display: grid;
  place-items: center;
  padding: 14px 18px;
  color: var(--navy);
  font-weight: 700;
  text-align: center;
}

@media (max-width: 1050px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .actions {
    width: 100%;
    justify-content: flex-start;
  }

  .summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .status-message {
    grid-column: 1 / -1;
  }
}

@media (max-width: 650px) {
  .app {
    width: calc(100% - 14px);
    margin: 7px auto;
  }

  .topbar {
    padding: 11px;
    border-radius: 14px;
  }

  .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .select-box {
    grid-column: 1 / -1;
  }

  .select-box select {
    width: 100%;
  }

  .map-card {
    padding: 4px;
    border-radius: 14px;
  }

  .map-stage {
    border-radius: 10px;
  }

  .detail-panel {
    left: 3% !important;
    right: 3% !important;
    top: auto !important;
    bottom: 3% !important;
    width: auto;
    padding: 12px;
  }

  .click-tip {
    display: none;
  }

  .count-badge {
    padding: 2px 5px;
    font-size: 8px;
  }

  .summary {
    gap: 7px;
  }

  .summary-card {
    min-height: 66px;
    padding: 10px 11px;
  }

  .summary-card span {
    font-size: 11px;
  }
}

/* 全屏时保持原图 3:2 比例，避免地图变形 */
.map-card:fullscreen,
.map-card:-webkit-full-screen {
  display: grid;
  place-items: center;
  width: 100vw;
  height: 100vh;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #edf8ff;
}

.map-card:fullscreen .map-stage,
.map-card:-webkit-full-screen .map-stage {
  width: min(100vw, 150vh);
  height: min(100vh, 66.6667vw);
  aspect-ratio: 3 / 2;
  border-radius: 0;
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .summary {
    display: none !important;
  }

  .app {
    width: 100%;
    margin: 0;
  }

  .map-card {
    padding: 0;
    border: 0;
    box-shadow: none;
  }
}
