:root {
  --lime: #d9f66c;
  --lime-2: #bdeb45;
  --lime-soft: #f0fad2;
  --green: #35c75a;
  --green-d: #1fa245;
  --bg: #f3f6e7;
  --card: #ffffff;
  --ink: #1d2118;
  --muted: #8a907d;
  --line: #e7ebd8;
  --orange: #ffa53c;
  --red: #ff4d5e;
  --purple: #8b6cff;
  --stroke: 2.5px solid var(--ink);
  --pop: 0 3px 0 var(--ink);
  --soft: 0 8px 24px rgba(60, 80, 20, .12);
  --font: "SF Pro Rounded", ui-rounded, -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); min-height: 100vh; min-height: 100dvh; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--green-d); }
.boot { display: grid; place-items: center; height: 90vh; }
.boot svg { width: 72px; height: 72px; animation: beat 1.2s infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 30% { transform: scale(1.12); } 60% { transform: scale(.96); } }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* 粗描边大标题 */
.title-pop {
  font-size: 34px; font-weight: 900; letter-spacing: 1px; color: #fff; line-height: 1.1;
  -webkit-text-stroke: 7px var(--ink); paint-order: stroke fill; text-shadow: 0 4px 0 var(--ink);
}

/* ---------- 头像 ---------- */
.av {
  width: 46px; height: 46px; border-radius: 16px; overflow: hidden; flex: none; display: grid; place-items: center;
  background: var(--lime); color: var(--ink); font-weight: 900; font-size: 19px; border: var(--stroke);
}
.av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av.round { border-radius: 50%; }
.av.big { width: 88px; height: 88px; border-radius: 30px; font-size: 34px; border-width: 3px; }
.av.empty { background: #fff; color: var(--muted); border-style: dashed; }

/* ---------- 定位页：全屏地图 ---------- */
.home { position: fixed; inset: 0; overflow: hidden; }
#map { position: absolute; inset: 0; background: #f4f3ec; }
/* 底图调成柔和的奶油色调，文字层稍淡一点 */
.tiles-clean { filter: saturate(.5) brightness(1.06) contrast(.88); }
.tiles-detail { filter: saturate(.62) brightness(1.04) contrast(.95); }
.leaflet-container { font: inherit; background: #f4f3ec; }
/* 地图四周一圈淡淡的暗角，让中间的人更突出 */
.home::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 450; box-shadow: inset 0 0 90px rgba(120, 140, 70, .18); }

/* 头像下的光晕、波纹、影子 */
.bub .halo { position: absolute; left: -32px; top: 10px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, rgba(217, 246, 108, .55) 0%, rgba(217, 246, 108, .25) 40%, rgba(217, 246, 108, 0) 70%); pointer-events: none; }
.bub.me .halo { background: radial-gradient(circle, rgba(255, 196, 92, .45) 0%, rgba(255, 196, 92, .18) 40%, rgba(255, 196, 92, 0) 70%); left: -12px; top: 30px; width: 100px; height: 100px; }
.bub .ripple { position: absolute; left: 8px; top: 50px; width: 60px; height: 60px; border-radius: 50%; border: 2.5px solid var(--green); opacity: 0; animation: ripple 2.4s ease-out infinite; pointer-events: none; }
.bub .ripple.r2 { animation-delay: 1.2s; }
@keyframes ripple { 0% { transform: scale(.3); opacity: .9; } 100% { transform: scale(2); opacity: 0; } }
.bub .shadow { position: absolute; left: 26px; top: 77px; width: 24px; height: 8px; border-radius: 50%; background: rgba(30, 40, 10, .3); filter: blur(2px); }

/* 连线中间的爱心距离牌 */
.midlove {
  position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 3px; white-space: nowrap;
  background: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: 2px 10px 2px 5px; font-size: 12px; font-weight: 900; box-shadow: 0 3px 0 var(--ink);
  animation: float 3s ease-in-out infinite;
}
.midlove svg { width: 16px; height: 16px; }
@keyframes float { 0%, 100% { margin-top: 0; } 50% { margin-top: -4px; } }

/* 足迹停留点：编号 + 时间牌 */
.stopmk { position: absolute; transform: translate(-13px, -13px); display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.stopmk i { width: 26px; height: 26px; border-radius: 50%; background: var(--orange); border: 2.5px solid var(--ink); color: var(--ink); font-style: normal; font-weight: 900; font-size: 13px; display: grid; place-items: center; box-shadow: 0 2px 0 var(--ink); }
.stopmk span { background: #fff; border-radius: 999px; padding: 1px 8px; font-size: 11px; font-weight: 800; box-shadow: 0 2px 8px rgba(0, 0, 0, .15); }
.leaflet-control-attribution { font-size: 9px; background: transparent !important; color: var(--muted); }
.leaflet-control-attribution a { color: var(--muted); }

.topbar { position: absolute; z-index: 600; left: 14px; right: 14px; top: calc(env(safe-area-inset-top) + 12px); display: flex; align-items: flex-start; justify-content: space-between; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.daypill {
  display: flex; align-items: center; gap: 6px; background: #fff; border: var(--stroke); box-shadow: var(--pop);
  border-radius: 999px; padding: 6px 14px 6px 8px; font-weight: 800; font-size: 14px;
}
.daypill svg { width: 22px; height: 22px; }
.daypill b { font-size: 17px; }
.rbtns { display: flex; flex-direction: column; gap: 10px; }
.rbtn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--ink); color: #fff; display: grid; place-items: center; box-shadow: var(--soft); }
.rbtn svg { width: 21px; height: 21px; }
.rbtn.on { background: var(--lime); color: var(--ink); border: var(--stroke); }

/* 地图气泡头像 */
.bub { position: relative; width: 76px; height: 100px; }
.bub .frame {
  position: absolute; left: 9px; top: 18px; width: 58px; height: 58px; border-radius: 20px; padding: 4px;
  background: linear-gradient(150deg, var(--lime) 0%, var(--green) 100%); box-shadow: 0 6px 14px rgba(40, 90, 20, .3); z-index: 2;
}
.bub.me .frame { width: 46px; height: 46px; left: 15px; top: 30px; border-radius: 16px; background: linear-gradient(150deg, #ffe27a, var(--orange)); }
.bub .ph { width: 100%; height: 100%; border-radius: 16px; overflow: hidden; background: #fff; display: grid; place-items: center; font-weight: 900; font-size: 20px; }
.bub.me .ph { border-radius: 12px; font-size: 16px; }
.bub .ph img { width: 100%; height: 100%; object-fit: cover; }
.bub .tail { position: absolute; left: 31px; top: 68px; width: 14px; height: 14px; transform: rotate(45deg); background: var(--green); border-radius: 3px; z-index: 1; }
.bub.me .tail { background: var(--orange); top: 70px; }
.bub .spd {
  position: absolute; left: 50%; top: -14px; transform: translateX(-50%); white-space: nowrap; z-index: 3;
  background: var(--lime); border: 2px solid var(--ink); border-radius: 999px; padding: 1px 8px 1px 5px; font-size: 12px; font-weight: 800; display: flex; align-items: center; gap: 2px;
}
.bub .spd svg { width: 14px; height: 14px; }
.bub .tag { position: absolute; left: -16px; top: 58px; z-index: 3; background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.bub .bt {
  position: absolute; left: 50%; top: 84px; transform: translateX(-50%); z-index: 3; white-space: nowrap;
  background: #fff; border-radius: 999px; padding: 0 7px 0 5px; font-size: 11px; font-weight: 800; display: flex; align-items: center; gap: 3px; box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}
.bub .bt i { display: inline-block; width: 16px; height: 9px; border: 1.5px solid var(--ink); border-radius: 3px; position: relative; padding: 1px; }
.bub .bt i::after { content: ""; position: absolute; right: -4px; top: 2px; width: 2px; height: 3px; background: var(--ink); border-radius: 1px; }
.bub .bt i b { display: block; height: 100%; background: var(--green); border-radius: 1px; }
.bub .bt.low i b { background: var(--red); }
.bub.me .bt { top: 84px; }

/* 底部卡片 */
.dock { position: absolute; z-index: 700; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 84px); max-width: 500px; margin: 0 auto; }
.dcard {
  background: #fff; border-radius: 26px; padding: 16px 18px; position: relative; overflow: visible;
  box-shadow: var(--soft); display: flex; align-items: center; min-height: 104px;
}
.dcard .lbl { font-size: 16px; font-weight: 800; }
.dcard .big { font-size: 40px; font-weight: 900; line-height: 1.05; letter-spacing: -1px; }
.dcard .big span { font-size: 20px; margin-left: 3px; letter-spacing: 0; }
.dcard .doodle { position: absolute; right: 6px; bottom: 8px; width: 150px; }
.dcard .since { font-size: 12px; color: var(--muted); margin-top: 2px; }
.where { background: #fff; border-radius: 26px; padding: 14px 18px 16px; margin-top: 10px; box-shadow: var(--soft); }
.where .wh { display: flex; align-items: center; justify-content: space-between; }
.where .wh b { font-size: 16px; font-weight: 900; }
.where .wh .x { border: 0; background: var(--bg); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; }
.where .wh .x svg { width: 15px; height: 15px; }
.where .sub { font-size: 13px; color: var(--muted); margin: 2px 0 10px; display: flex; align-items: center; gap: 6px; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.facts > div { background: var(--bg); border-radius: 16px; padding: 9px 2px 7px; }
.facts svg { width: 22px; height: 22px; display: block; margin: 0 auto 2px; }
.facts span { font-size: 12px; font-weight: 700; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; flex: none; }
.dot.warn { background: var(--orange); }
.dot.bad { background: var(--red); }
.dock.hide-where .where { display: none; }

/* ---------- 足迹页 ---------- */
.trackpage .topbar { align-items: center; }
.backbtn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: #fff; display: grid; place-items: center; box-shadow: var(--soft); }
.backbtn svg { width: 22px; height: 22px; }
.who-switch { display: flex; align-items: center; gap: 8px; }
.who-switch button { border: 0; background: none; padding: 0; }
.who-switch .av { transition: transform .2s; opacity: .7; }
.who-switch .on .av { transform: scale(1.25); opacity: 1; box-shadow: 0 0 0 3px var(--lime), 0 0 0 5.5px var(--ink); }
.datebar {
  position: absolute; z-index: 700; left: 12px; right: 12px; max-width: 500px; margin: 0 auto;
  background: var(--ink); color: #b9bdb0; border-radius: 22px; display: flex; overflow-x: auto; padding: 6px; gap: 2px; scrollbar-width: none;
}
.datebar::-webkit-scrollbar { display: none; }
.datebar button { border: 0; background: none; color: inherit; padding: 9px 10px; border-radius: 16px; font-weight: 800; font-size: 14px; white-space: nowrap; flex: 1; }
.datebar button.on { color: #fff; position: relative; }
.datebar button.on::after { content: ""; position: absolute; left: 50%; bottom: 3px; transform: translateX(-50%); width: 18px; height: 3px; border-radius: 2px; background: var(--lime); }
.tsheet { position: absolute; z-index: 690; left: 0; right: 0; bottom: 0; max-width: 520px; margin: 0 auto; background: #fff; border-radius: 26px 26px 0 0; box-shadow: var(--soft); padding: 46px 20px calc(env(safe-area-inset-bottom) + 20px); height: 44vh; overflow-y: auto; }
.trackpage .datebar { bottom: calc(44vh - 26px); }
.tl { list-style: none; margin: 0; padding: 0; }
.tl li { display: flex; gap: 12px; position: relative; padding-bottom: 12px; }
.tl li::before { content: ""; position: absolute; left: 47px; top: 18px; bottom: -2px; border-left: 2px dashed #cfd6bd; }
.tl li:last-child::before { display: none; }
.tl .tm { width: 40px; font-size: 13px; font-weight: 700; padding-top: 1px; flex: none; }
.tl .pt { width: 12px; height: 12px; border-radius: 50%; background: var(--green); margin-top: 5px; flex: none; position: relative; z-index: 1; }
.tl .pt.stop { background: var(--orange); }
.tl .bd { flex: 1; min-width: 0; }
.tl .bd b { font-weight: 800; }
.tl .move { background: var(--lime-soft); border-radius: 14px; padding: 8px 12px; font-size: 14px; color: var(--green-d); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.tl .move svg { width: 16px; height: 16px; }
.stopdot { width: 18px; height: 18px; border-radius: 50%; background: var(--orange); border: 2.5px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.startdot { width: 30px; height: 30px; box-shadow: 0 2px 0 var(--ink); color: #fff; background: var(--green) !important; border-radius: 50%; background: var(--orange); border: 2.5px solid var(--ink); display: grid; place-items: center; font-size: 13px; font-weight: 900; }

/* ---------- 动态页（聊天式报备） ---------- */
.page { max-width: 520px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 110px); }
.pagehead { display: flex; align-items: center; justify-content: space-between; margin: 6px 2px 14px; }
.pagehead h1 { margin: 0; font-size: 28px; font-weight: 900; }
.feed { background: #fff; border-radius: 28px; padding: 14px 14px 18px; box-shadow: var(--soft); }
.feed .ts { text-align: center; color: var(--muted); font-size: 12px; margin: 14px 0 8px; font-weight: 700; }
.feed .sys { text-align: center; font-size: 13px; color: var(--muted); margin: 6px 0; display: flex; align-items: center; justify-content: center; gap: 5px; }
.feed .sys svg { width: 16px; height: 16px; flex: none; }
.feed .sys .c-wifi { color: #3a8dff; }
.feed .sys .c-chg { color: var(--green); }
.feed .sys .c-low { color: var(--red); }
.msg { display: flex; align-items: flex-end; gap: 8px; margin: 8px 0; }
.msg.mine { flex-direction: row-reverse; }
.msg .av { width: 36px; height: 36px; border-radius: 50%; font-size: 14px; border-width: 2px; }
.msg .bubble { background: var(--bg); border-radius: 18px 18px 18px 6px; padding: 9px 14px; font-size: 14px; max-width: 72%; display: flex; align-items: center; gap: 6px; }
.msg.mine .bubble { background: var(--green); color: #fff; border-radius: 18px 18px 6px 18px; }
.msg .bubble svg { width: 16px; height: 16px; flex: none; color: var(--green); }
.msg.mine .bubble svg { color: #fff; }
.empty { text-align: center; padding: 30px 10px; color: var(--muted); }
.empty svg { width: 120px; display: block; margin: 0 auto 10px; }

/* ---------- 我的 ---------- */
.hero {
  background: var(--lime); border-radius: 30px; padding: 20px; border: var(--stroke); box-shadow: 0 5px 0 var(--ink);
  position: relative; overflow: hidden; margin-bottom: 18px;
}
.hero .couple { display: flex; align-items: center; justify-content: center; gap: 14px; }
.hero .couple svg { width: 34px; height: 34px; animation: beat 1.4s infinite; }
.hero .names { text-align: center; font-weight: 900; font-size: 18px; margin-top: 10px; }
.hero .cnt { text-align: center; font-size: 13px; font-weight: 700; }
.hero .cnt b { font-size: 26px; font-weight: 900; margin: 0 2px; }
.hero label.av { cursor: pointer; position: relative; overflow: visible; }
.hero label.av img { border-radius: 27px; }
.cam { position: absolute; right: -6px; bottom: -6px; width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; border: 2px solid #fff; }
.cam svg { width: 14px; height: 14px; }

.group-title { font-size: 13px; color: var(--muted); margin: 18px 8px 8px; font-weight: 800; }
.group { background: var(--card); border-radius: 24px; box-shadow: var(--soft); margin-bottom: 14px; overflow: hidden; }
.item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; text-decoration: none; color: var(--ink); cursor: pointer; }
.item:last-child { border-bottom: 0; }
.item .ic { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; flex: none; border: 2px solid var(--ink); }
.item .ic svg { width: 18px; height: 18px; }
.item .tx { flex: 1; min-width: 0; font-weight: 700; }
.item .tx small { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.item .val { color: var(--muted); font-size: 14px; }
.item input[type="date"], .item input.inline { border: 0; background: none; padding: 0; text-align: right; width: auto; color: var(--muted); font-size: 15px; }
.item.danger { color: var(--red); justify-content: center; font-weight: 800; }
.chev { color: #c9cfb8; transition: transform .2s; }
details[open] .chev { transform: rotate(90deg); }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.ic.lime { background: var(--lime); }
.ic.green { background: #c9f2d3; }
.ic.orange { background: #ffe1b8; }
.ic.purple { background: #e3dcff; }
.ic.pink { background: #ffd6dc; }

.guide { padding: 4px 16px 16px; }
ol.steps { padding-left: 20px; margin: 4px 0 0; font-size: 14px; }
ol.steps li { margin-bottom: 8px; }
.copy { background: var(--bg); border-radius: 8px; padding: 2px 8px; cursor: pointer; display: inline-block; word-break: break-all; font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }
.kv { display: grid; grid-template-columns: 64px 1fr; gap: 8px 10px; font-size: 14px; align-items: start; margin-top: 8px; }
.kv .k { color: var(--muted); }

/* ---------- 表单 / 按钮 ---------- */
label.f { display: block; font-size: 13px; color: var(--muted); margin: 12px 4px 6px; font-weight: 700; }
input {
  width: 100%; padding: 14px 16px; border-radius: 16px; border: 2px solid var(--line);
  background: #fff; color: var(--ink); font: inherit; font-size: 16px; outline: none;
}
input:focus { border-color: var(--ink); }
.btn {
  display: block; width: 100%; border: var(--stroke); border-radius: 18px; padding: 14px; margin-top: 16px;
  background: var(--lime); color: var(--ink); font-weight: 900; font-size: 17px; text-align: center; text-decoration: none; box-shadow: var(--pop);
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn.dark { background: var(--ink); color: #fff; }
.btn.white { background: #fff; }
.btn.text { background: none; color: var(--muted); box-shadow: none; border: 0; font-weight: 600; font-size: 15px; }
.err { color: var(--red); font-size: 14px; min-height: 20px; margin: 8px 4px 0; font-weight: 600; }

/* 登录 */
.auth { min-height: 100vh; min-height: 100dvh; background: var(--lime); padding: calc(env(safe-area-inset-top) + 7vh) 20px 40px; position: relative; overflow: hidden; }
.auth .art { width: 220px; display: block; margin: 0 auto; }
.auth .title-pop { text-align: center; font-size: 52px; margin-top: 4px; }
.auth .sub { text-align: center; font-weight: 800; margin: 8px 0 22px; }
.auth .card { max-width: 420px; margin: 0 auto; background: #fff; border: var(--stroke); border-radius: 28px; padding: 18px; box-shadow: 0 5px 0 var(--ink); }

/* 配对 */
.pairing { text-align: center; background: #fff; border-radius: 28px; padding: 22px 18px; box-shadow: var(--soft); }
.pairing .avs { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 8px 0 12px; }
.pairing .avs svg { width: 32px; height: 32px; animation: beat 1.4s infinite; }
.pairing h2 { font-size: 22px; font-weight: 900; margin: 6px 0 4px; }
.code { font-size: 40px; font-weight: 900; letter-spacing: 8px; padding: 12px 0 4px; font-family: ui-monospace, Menlo, monospace; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; margin: 18px 0 4px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 2px dashed var(--line); }
.code-in { text-align: center; letter-spacing: 6px; font-size: 22px; font-weight: 900; text-transform: uppercase; margin-top: 8px; }
.tip { background: #fff; border-radius: 22px; padding: 14px 16px; margin-top: 14px; font-size: 14px; box-shadow: var(--soft); }

/* 底部导航 */
.tabbar {
  position: fixed; z-index: 1000; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 12px);
  display: flex; gap: 4px; padding: 5px; border-radius: 999px; background: #fff; border: var(--stroke); box-shadow: var(--pop);
}
.tabbar a { display: flex; align-items: center; gap: 5px; padding: 9px 16px; white-space: nowrap; flex: none; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 800; }
.tabbar a svg { width: 20px; height: 20px; }
.tabbar a.on { background: var(--lime); color: var(--ink); }

.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 16px); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 700; z-index: 2000;
  max-width: calc(100% - 32px); box-shadow: var(--soft);
}
