:root{
    --ink:#2b3a48; --dim:#7c8fa1; --dim2:#9fb0c0;
    --line:rgba(180,205,225,.75); --card:rgba(255,255,255,.94);
    --brand:#3d7fb5;
  }
  *{box-sizing:border-box}
  html,body{margin:0;padding:0}
  body{
    background:#f2ece0;
    font-family:"PingFang SC","Microsoft YaHei",system-ui,sans-serif;
    color:var(--ink);
    min-height:100vh;
    display:flex;flex-direction:column;
  }

  /* 顶部一条细标题，图占满剩下的 */
  .hd{
    flex:none;display:flex;align-items:center;gap:10px;
    padding:10px 18px 8px;
    background:linear-gradient(180deg,rgba(242,236,224,.98),rgba(242,236,224,.85));
    border-bottom:1px solid rgba(190,175,150,.5);
  }
  .hd h1{margin:0;font-size:14px;font-weight:800;letter-spacing:4px;color:#6b5a44}
  .hd .sub{font-size:11px;color:#9a8a72}
  .hd .sp{margin-left:auto;font-size:11px;color:#8d7c65}

  /* 图：等比缩放，热区跟着图走 */
  .stage{
    flex:1;position:relative;
    /* 图现在只有 980 宽（高约 735），视口基本装得下，可以由 flex 居中。
       真要装不下时 overflow:auto 会出滚动条，不会再被裁掉。 */
    display:flex;align-items:center;justify-content:center;
    padding:14px 14px 20px;
    overflow:auto;
  }
  .frame{
    position:relative;
    /* 默认收小：铺满 1500 宽时整张图比视口还高，得滚动才看得全 */
    width:min(980px,94%);margin:0 auto;max-height:100%;
    aspect-ratio:1776/1328;        /* 和新地图原图一致，热区才不会错位 */
    border-radius:14px;overflow:hidden;
    box-shadow:0 20px 50px -30px rgba(70,55,35,.55), 0 0 0 1px rgba(180,160,130,.35);
    background:#f6f1e6;
  }
  /* 用 contain：cover 会在高度受限时裁掉图的上下边，南门站就露一半 */
  .frame img{display:block;width:100%;height:100%;object-fit:contain;background:#f6f1e6}

  /* 移动路线：铺在图上、热区下面；过河只走桥 */
  .routes{position:absolute;inset:0;width:100%;height:100%;z-index:3;pointer-events:none;overflow:visible}
  .routes .casing{fill:none;stroke:rgba(247,242,231,.9);stroke-width:12;
    stroke-linecap:round;stroke-linejoin:round}
  .routes .ghost{fill:none;stroke:rgba(55,120,170,.42);stroke-width:6;
    stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:2 8}
  .routes .go{fill:none;stroke:#2f7fb9;stroke-width:7;
    stroke-linecap:round;stroke-linejoin:round}

  /* 移动中的角色：圆形头像沿路线移动，名字/倒计时挂在头像下方 */
  .movers{position:absolute;inset:0;z-index:6;pointer-events:none}
  .mover{position:absolute;width:50px;height:50px;transform:translate(-50%,-50%);
    pointer-events:none}
  .mover .mav{
    position:absolute;inset:0;z-index:2;
    display:flex;align-items:center;justify-content:center;
    overflow:hidden;border-radius:50%;
    background:linear-gradient(160deg,#5aa8dd,#3d7fb5);
    color:#fff;font-size:15px;font-weight:800;
    border:2.5px solid #fff;
    box-shadow:0 5px 14px rgba(10,30,50,.42);
    animation:moverBob 1.15s ease-in-out infinite;
  }
  .mover .mav img{width:100%;height:100%;object-fit:cover;display:block}
  .mover .mring{
    position:absolute;inset:-3px;z-index:1;border-radius:50%;
    border:2px solid rgba(127,209,255,.85);
    animation:moverPulse 1.9s ease-out infinite;
  }
  .mover.walk .mring{border-color:rgba(158,230,168,.9)}
  .mover.bike .mring{border-color:rgba(143,196,255,.9)}
  .mover.bus .mring{border-color:rgba(255,196,107,.9)}
  @keyframes moverPulse{
    0%{transform:scale(.9);opacity:.9}
    70%{transform:scale(1.55);opacity:0}
    100%{transform:scale(1.55);opacity:0}
  }
  @keyframes moverBob{
    0%,100%{transform:translateY(0)}
    50%{transform:translateY(-2px)}
  }
  .mover .mtag{
    position:absolute;left:50%;top:calc(100% + 4px);transform:translateX(-50%);
    z-index:3;display:flex;align-items:center;gap:5px;
    padding:3px 8px 6px;border-radius:999px;
    background:rgba(18,38,58,.88);color:#eaf6ff;
    font-size:10.5px;font-weight:700;white-space:nowrap;
    border:1px solid rgba(160,210,240,.35);
    box-shadow:0 5px 14px rgba(10,30,50,.3);
  }
  .mover .mtag .nm{max-width:72px;overflow:hidden;text-overflow:ellipsis}
  .mover .mtag .left{font-variant-numeric:tabular-nums;color:#ffd9a0;font-weight:800}
  .mover .mbar{
    position:absolute;left:8px;right:8px;bottom:2px;height:3px;border-radius:1.5px;
    background:rgba(255,255,255,.22);overflow:hidden;
  }
  .mover .mbar b{display:block;height:100%;border-radius:1px;background:#7fd1ff}
  .mover.walk .mbar b{background:#9ee8a8}
  .mover.bike .mbar b{background:#8fc4ff}
  .mover.bus .mbar b{background:#ffc46b}
  /* 停在某处做事：同一套头像+标签，进度条换成暖金色 */
  .mover.action .mring{border-color:rgba(255,196,107,.9);animation-duration:2.6s}
  .mover.action .mtag{padding:4px 9px 7px}
  .mover.action .mtag .nm{max-width:132px}
  .mover.action .mbar{height:4px}
  .mover.action .mbar b{background:linear-gradient(90deg,#ffd9a0,#ffb347)}

  /* ?debug=1 的路线检查 */
  .dbg .edge{stroke:rgba(198,72,40,.62);stroke-width:3.5;stroke-linecap:round}
  .dbg .node{fill:#2f7fb9;stroke:#fff;stroke-width:1.5}
  .dbg .node.bridge{fill:#e2503f}
  .dbg .route{fill:none;stroke-linecap:round;stroke-linejoin:round}
  .dbg .dest{stroke:#fff;stroke-width:1.5}
  .dbg-panel{
    position:fixed;top:52px;right:12px;z-index:50;
    display:flex;align-items:center;gap:6px;
    background:rgba(18,38,58,.9);color:#eaf6ff;
    padding:7px 9px;border-radius:10px;
    font:11px/1.5 "PingFang SC","Microsoft YaHei",system-ui,sans-serif;
    border:1px solid rgba(160,210,240,.35);
    box-shadow:0 6px 18px rgba(10,30,50,.35);
  }
  .dbg-panel b{font-weight:800;letter-spacing:1px;color:#9fd3f2}
  .dbg-panel select{
    font:inherit;background:#0f2638;color:#eaf6ff;
    border:1px solid rgba(160,210,240,.35);border-radius:6px;
    padding:2px 4px;max-width:210px;
  }
  body.embed .dbg-panel{top:8px;right:8px}

  /* ?edit=1 路线编辑器 */
  body.edit .stage{padding-right:320px}
  body.edit .frame{width:min(900px, calc(100vw - 360px))}
  .edit-panel{
    position:fixed;top:52px;right:12px;bottom:12px;width:300px;z-index:60;overflow:auto;
    background:rgba(255,252,246,.98);border:1px solid rgba(180,160,130,.55);border-radius:12px;
    box-shadow:0 12px 30px -20px rgba(60,45,25,.55);padding:12px;color:#2b3a48;
    font:11px/1.55 "PingFang SC","Microsoft YaHei",system-ui,sans-serif;
  }
  .edit-panel .ed-title{font-size:13px;font-weight:800;letter-spacing:2px;color:#6b5a44;margin-bottom:8px}
  .edit-panel .ed-row{display:flex;gap:8px;margin:6px 0;align-items:flex-end}
  .edit-panel label{display:flex;flex-direction:column;gap:3px;font-size:10px;color:#8d7c65;flex:1}
  .edit-panel select,.edit-panel input{
    font:inherit;padding:4px 5px;border:1px solid rgba(180,160,130,.6);
    border-radius:6px;background:#fff;color:#2b3a48;width:100%;box-sizing:border-box;
  }
  .edit-panel .ed-actions{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0}
  .edit-panel button{
    font:inherit;font-weight:700;padding:5px 8px;border-radius:7px;cursor:pointer;
    border:1px solid rgba(180,160,130,.7);background:#fbf6ec;color:#5d4c36;
  }
  .edit-panel button.primary{background:#3d7fb5;color:#fff;border-color:#3d7fb5}
  .edit-panel .ed-status{font-weight:800;color:#b07414;margin:4px 0}
  .edit-panel .ed-status.ok{color:#2f7a4f}
  .edit-panel .ed-hint,.edit-panel .ed-count,.edit-panel .ed-tip{font-size:10px;color:#8d7c65}
  .edit-panel .ed-tip{margin-top:6px;line-height:1.6}
  @media (max-width:900px){
    body.edit .stage{padding:8px}
    body.edit .frame{width:100%}
    .edit-panel{left:8px;right:8px;top:auto;bottom:8px;width:auto;max-height:45vh}
  }
  .dbg .edit-auto{fill:none;stroke:rgba(80,100,120,.45);stroke-width:3;stroke-dasharray:4 7}
  .dbg .edit-line{fill:none;stroke:#e2503f;stroke-width:5;stroke-linecap:round;stroke-linejoin:round}
  .dbg .edit-dot{fill:#fff;stroke:#e2503f;stroke-width:3}
  .dbg .edit-end{fill:#e2503f;stroke:#fff;stroke-width:2}
  .edit-panel .hidden{display:none!important}
  .dbg .edit-road{fill:none;stroke:#2f7fb9;stroke-width:4;stroke-linecap:round;stroke-linejoin:round;opacity:.85}
  .dbg .edit-road-dot{fill:#2f7fb9;stroke:#fff;stroke-width:1.5}
  .dbg .edit-road-live{fill:none;stroke:#e2503f;stroke-width:5;stroke-linecap:round;stroke-linejoin:round}
  .dbg .edit-spot{fill:#b9c7d4;stroke:#fff;stroke-width:1.5}
  .dbg .edit-spot.on{fill:#2f7a4f}
  .dbg .edit-preview{fill:none;stroke:#e08a1e;stroke-width:4;stroke-dasharray:6 6;stroke-linecap:round;stroke-linejoin:round}
  body.edit .routes{pointer-events:auto}
  .dbg .net-edge{stroke:rgba(47,127,185,.68);stroke-width:4;stroke-linecap:round;pointer-events:none}
  .dbg .net-hit{stroke:transparent;stroke-width:16;pointer-events:stroke;cursor:copy}
  .dbg .net-node{fill:#fff;stroke:#2f7fb9;stroke-width:3;pointer-events:all;cursor:grab}
  .dbg .net-node.fixed{fill:#e2503f;stroke:#fff;cursor:default}
  .dbg .net-node.selected{fill:#f0b429;stroke:#fff;stroke-width:3}

  /* 热区：默认不可见，鼠标移上去浮一个圈 */
  /* 热区：直接画在按钮上，不用 ::after —— 伪元素在这种嵌套 iframe 里不听话 */
  .spot{
    position:absolute;transform:translate(-50%,-50%);
    width:26px;height:26px;border-radius:50%;
    padding:0;cursor:pointer;z-index:5;   /* 必须压在 <img> 之上，否则点不到 */
    border:2px solid rgba(61,127,181,.62);
    background:rgba(255,255,255,.62);
    box-shadow:0 0 0 2px rgba(255,255,255,.55), 0 2px 6px rgba(20,60,100,.25);
    transition:.16s ease;
  }
  .spot:hover,.spot.on{
    width:36px;height:36px;
    border-color:rgba(61,127,181,.95);
    background:rgba(61,127,181,.42);
    box-shadow:0 0 0 4px rgba(255,255,255,.6), 0 3px 10px rgba(20,60,100,.3);
  }
  .spot:focus-visible{outline:2px solid #3d7fb5;outline-offset:3px}

  
  
/* 有人在这：右上角挂一个数字气泡 */
.spot.has-people::before{
  content:attr(data-badge);
  position:absolute;right:-9px;top:-9px;
  min-width:18px;height:18px;
  padding:0 5px;
  display:flex;align-items:center;justify-content:center;
  border-radius:9px;
  background:linear-gradient(160deg,#ff8a5b,#e2503f);
  color:#fff;font-size:10.5px;font-weight:800;line-height:1;
  font-variant-numeric:tabular-nums;
  border:1.5px solid #fff;
  box-shadow:0 2px 6px rgba(160,50,30,.4);
  pointer-events:none;
}

  /* 信息卡：点热区才出现，贴在右下角 */
  .info{
    /* 放左下：右下角被图例占了 */
    position:absolute;left:16px;bottom:16px;width:min(330px,calc(100% - 32px));
    background:var(--card);border:1px solid var(--line);border-radius:14px;
    box-shadow:0 18px 40px -24px rgba(40,60,85,.6);
    padding:14px 15px 13px;
    transform:translateY(8px);opacity:0;pointer-events:none;
    transition:.2s ease;
  }
  .info.on{transform:none;opacity:1;pointer-events:auto}
  .info h2{margin:0 0 3px;font-size:15px;font-weight:800;letter-spacing:1.5px}
  .info .brief{font-size:11.5px;color:var(--dim);line-height:1.6}
  .info .row{margin-top:9px;padding-top:9px;border-top:1px dashed rgba(170,200,225,.8);
    display:flex;align-items:center;gap:8px;font-size:11.5px;color:var(--dim)}
  .info .row b{color:var(--brand);font-weight:800}
  .info .x{
    position:absolute;right:9px;top:9px;width:24px;height:24px;
    border:0;background:none;color:var(--dim2);font-size:16px;line-height:1;cursor:pointer;
  }
  .info .x:hover{color:var(--ink)}

  .empty{
    position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);
    font-size:12px;color:var(--dim2);
  }

  @media (max-width:640px){
    .frame{border-radius:10px}
    .info{right:8px;bottom:8px;left:8px;width:auto}
  }








/* ===== 被嵌进首页弹窗时（?embed=1）=====
   地图是 1600×1200（4:3）。
   宽和高都用 min() 算：谁先顶到容器就用谁，另一边按 4:3 跟着走，
   这样既不会溢出被裁，也保持比例，百分比热区也就准了。 */
body.embed{ padding:0; margin:0; background:transparent; overflow:hidden; }
body.embed .hd{ display:none; }

body.embed .stage{
  padding:0;
  display:flex;align-items:center;justify-content:center;
  height:100dvh;
  background:transparent;
  overflow:hidden;
}
body.embed .frame{
  position:relative;
  width:min(100%, calc((100dvh - 24px) * 4 / 3));
  aspect-ratio:4 / 3;
  max-height:calc(100dvh - 24px);
  border-radius:0;
  box-shadow:none;
  background:transparent;
  overflow:visible;
}
body.embed .frame img{
  display:block;
  width:100%;
  height:100%;
  object-fit:fill;      /* 容器已是 4:3，和原图一致，fill 不会变形 */
  border-radius:4px;
  box-shadow:0 22px 60px -30px rgba(0,0,0,.65);
}
body.embed .empty{
  position:absolute;left:50%;bottom:8px;transform:translateX(-50%);
  font-size:11px;opacity:.7;pointer-events:none;
}

/* ===== 「我在这儿」=====
   头像挂在所属地点的正上方一点，不压住地名。
   一圈光圈缓慢扩散，表示"这是活的、此刻在这儿"。 */
.me-mark{
  position:absolute;
  width:max-content;         /* 宽度跟着内容走，不然 flex 会把头像压小 */
  transform:translate(-50%,-100%);
  margin-top:-16px;          /* 再往上抬一点，避开地点圆点 */
  display:flex;flex-direction:column;align-items:center;gap:2px;
  pointer-events:none;
  z-index:20;
  animation:meIn .45s cubic-bezier(.2,.9,.3,1.1) both;
}
@keyframes meIn{from{opacity:0;transform:translate(-50%,-100%) scale(.7)}to{opacity:1;transform:translate(-50%,-100%) scale(1)}}

.me-mark .me-av{
  width:54px;height:54px;flex:none;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  overflow:hidden;
  background:linear-gradient(160deg,#5aa8dd,#3d7fb5);
  color:#fff;font-size:16px;font-weight:800;
  border:2.5px solid #fff;
  box-shadow:0 4px 12px rgba(16,52,88,.4);
}
.me-mark .me-av img{width:100%;height:100%;object-fit:cover;display:block}

/* 扩散的光圈：两个错开，看起来连续 */
.me-mark .me-ring{
  position:absolute;left:50%;top:20px;
  width:54px;height:54px;margin:-27px 0 0 -27px;
  border-radius:50%;
  border:2px solid rgba(90,168,221,.85);
  animation:mePulse 2.2s ease-out infinite;
}
.me-mark .me-ring::after{
  content:"";position:absolute;inset:-2px;border-radius:50%;
  border:2px solid rgba(90,168,221,.7);
  animation:mePulse 2.2s ease-out 1.1s infinite;
}
@keyframes mePulse{
  0%{transform:scale(.85);opacity:.9}
  70%{transform:scale(1.9);opacity:0}
  100%{transform:scale(1.9);opacity:0}
}

.me-mark b{
  font-size:10px;font-weight:800;letter-spacing:.5px;
  color:#2b4a68;
  background:rgba(255,255,255,.9);
  padding:0 6px;border-radius:8px;
  box-shadow:0 2px 6px rgba(16,52,88,.18);
  white-space:nowrap;
}
