@font-face { font-family: "Wenkai"; src: url(/fonts/wenkai.woff2) format("woff2"); font-display: swap; }
:root {
  --bg: #08101f; --ink: #e9eefb; --muted: #8fa1c2; --faint: #5d6f93; --line: rgba(160,190,240,.14);
  --glass: rgba(13,22,40,.66); --glass-hi: rgba(24,38,66,.72);
  --zhi: #ff9b82; --ke: #7fd8c9; --amber: #ffd9a3; --swan: #fff6ea;
  --ui: "Microsoft YaHei", "PingFang SC", "HarmonyOS Sans SC", system-ui, sans-serif;
  --hand: "Wenkai", "LXGW WenKai", "Kaiti SC", KaiTi, serif;
  --ease: cubic-bezier(.2,0,0,1); --panel-w: 392px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); font-family: var(--ui); overflow: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

#map { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#map.dragging { cursor: grabbing; }
#overlay { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(120% 90% at 62% 48%, transparent 40%, rgba(2,6,14,.62) 100%); }

/* 地图上的日期牌、留言钉、她的名字 */
.tag { position: absolute; left: 0; top: 0; will-change: transform; transition: opacity 240ms; white-space: nowrap; pointer-events: none; }
.tag.day { font-size: 11px; color: var(--amber); text-shadow: 0 1px 6px #000, 0 0 2px #000; letter-spacing: .04em; transform-origin: 0 0; }
.tag.day small { display: block; color: var(--muted); font-size: 10px; margin-top: 1px; }
.tag.day::before { content: ""; position: absolute; left: -10px; top: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.tag.dim { opacity: .18; }
.tag.name { font-family: var(--hand); font-size: 22px; color: var(--swan); text-shadow: 0 2px 14px rgba(0,0,0,.8), 0 0 18px rgba(255,200,160,.45); }
.tag.name small { display: block; font-family: var(--ui); font-size: 11px; color: var(--muted); letter-spacing: .06em; }
.pin { pointer-events: auto; cursor: pointer; width: 0; height: 0; }
.pin .card { position: absolute; left: -14px; bottom: 10px; width: max-content; max-width: 220px; padding: 8px 11px 9px; border-radius: 10px 10px 10px 2px; background: color-mix(in srgb, var(--c) 18%, rgba(14,22,40,.92)); border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); box-shadow: 0 6px 22px rgba(0,0,0,.45); font-family: var(--hand); font-size: 14px; line-height: 1.45; color: var(--ink); white-space: normal; transform-origin: 14px 100%; transition: transform 200ms var(--ease), opacity 200ms; }
.pin .card b { display: block; font: 600 10px var(--ui); letter-spacing: .08em; color: var(--c); margin-bottom: 2px; }
.pin::after { content: ""; position: absolute; left: -4px; top: -4px; width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 3px rgba(8,16,31,.8), 0 0 14px var(--c); }
.pin.compact .card { transform: scale(.0); opacity: 0; }
.pin.compact:hover .card, .pin.open .card { transform: none; opacity: 1; z-index: 3; }
.pin.zhi { --c: var(--zhi); } .pin.ke { --c: var(--ke); }

/* 面板 */
#panel { position: fixed; z-index: 5; left: 18px; top: 18px; bottom: 18px; width: var(--panel-w); display: flex; flex-direction: column; border-radius: 22px; background: var(--glass); -webkit-backdrop-filter: blur(22px) saturate(1.4); backdrop-filter: blur(22px) saturate(1.4); box-shadow: 0 18px 60px rgba(0,0,0,.45), inset 0 0 0 1px var(--line); overflow: hidden; }
.scroll { flex: 1; overflow-y: auto; padding: 22px 22px 26px; scrollbar-width: thin; scrollbar-color: rgba(160,190,240,.25) transparent; }
section { margin-top: 22px; }
.eyebrow { font-size: 12px; letter-spacing: .14em; color: var(--muted); }
h1 { font-family: var(--hand); font-weight: 400; font-size: 58px; line-height: 1.05; margin-top: 4px; background: linear-gradient(180deg, #fff 30%, #ffd9bd); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; }
.en { font-size: 13px; color: var(--muted); letter-spacing: .18em; margin-top: 4px; }

.pair { display: flex; align-items: center; gap: 12px; margin-top: 18px; padding: 12px 14px; border-radius: 16px; background: rgba(255,255,255,.04); box-shadow: inset 0 0 0 1px var(--line); }
.who { position: relative; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-family: var(--hand); font-size: 20px; color: #1a1020; background: var(--c); flex: none; transition: transform 200ms var(--ease), box-shadow 300ms; }
.who.zhi { --c: var(--zhi); } .who.ke { --c: var(--ke); }
.who.off { background: transparent; color: var(--c); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--c) 45%, transparent); }
.who.on { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 22%, transparent), 0 0 22px color-mix(in srgb, var(--c) 55%, transparent); }
.who.me::after { content: "我"; position: absolute; right: -5px; bottom: -3px; font: 600 9px var(--ui); padding: 1px 4px; border-radius: 6px; background: var(--bg); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
button.who:hover { transform: scale(1.06); }
.thread { flex: 1; height: 2px; position: relative; background: linear-gradient(90deg, var(--zhi), var(--ke)); opacity: .55; border-radius: 2px; }
.thread.both { opacity: 1; box-shadow: 0 0 14px rgba(255,220,190,.6); animation: breathe 3s ease-in-out infinite; }
.thread::after { content: "♥"; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -52%); font-size: 12px; color: #fff; text-shadow: 0 0 8px #000; opacity: 0; transition: opacity .4s; }
.thread.both::after { opacity: 1; }
@keyframes breathe { 50% { filter: brightness(1.5); } }
.pair-line { margin-top: 8px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.pair-line b { color: var(--ink); font-weight: 600; }

.now { padding: 18px; border-radius: 18px; background: linear-gradient(160deg, rgba(255,171,128,.14), rgba(120,170,255,.08)); box-shadow: inset 0 0 0 1px var(--line); }
.now .state { font-family: var(--hand); font-size: 25px; line-height: 1.3; }
.now .sub { margin-top: 6px; font-size: 13px; color: var(--muted); line-height: 1.65; }
.now .where { margin-top: 12px; font-size: 13px; color: var(--amber); display: flex; gap: 6px; align-items: flex-start; line-height: 1.5; }
.now .where svg { flex: none; margin-top: 2px; }
.now .wx { margin-top: 10px; display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink); }
.now .wx span { padding: 4px 10px; border-radius: 99px; background: rgba(255,255,255,.06); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { padding: 12px 10px; border-radius: 14px; background: rgba(255,255,255,.045); box-shadow: inset 0 0 0 1px var(--line); text-align: center; }
.stat b { display: block; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat b i { font-style: normal; font-size: 11px; color: var(--muted); margin-left: 2px; font-weight: 400; }
.stat span { font-size: 11px; color: var(--muted); }

h2 { font-size: 12px; font-weight: 500; letter-spacing: .14em; color: var(--muted); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; }
h2 small { letter-spacing: 0; font-weight: 400; color: var(--faint); }
.bars { display: flex; align-items: flex-end; gap: 5px; height: 92px; padding-bottom: 20px; position: relative; }
.bar { flex: 1; position: relative; height: 100%; display: flex; align-items: flex-end; border-radius: 4px; }
.bar i { display: block; width: 100%; min-height: 3px; border-radius: 4px 4px 2px 2px; background: linear-gradient(180deg, var(--amber), #ff8b6e); opacity: .72; transition: opacity .2s, transform .2s var(--ease); transform-origin: bottom; }
.bar:hover i { opacity: 1; transform: scaleY(1.04); }
.bar.sel i { opacity: 1; box-shadow: 0 0 14px rgba(255,170,120,.7); }
.bar em { position: absolute; left: 50%; bottom: -18px; transform: translateX(-50%); font: 10px var(--ui); color: var(--faint); font-style: normal; font-variant-numeric: tabular-nums; }
.bar.sel em { color: var(--amber); }
.bar:nth-child(odd) em { visibility: hidden; } .bar.sel em { visibility: visible; }
.daydetail { margin-top: 6px; min-height: 36px; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.daydetail b { color: var(--ink); font-weight: 600; }

.composer { display: flex; flex-direction: column; gap: 8px; }
textarea { width: 100%; resize: none; height: 66px; border: 0; outline: none; padding: 11px 13px; border-radius: 14px; background: rgba(255,255,255,.06); color: var(--ink); font: 16px/1.5 var(--hand); box-shadow: inset 0 0 0 1px var(--line); }
textarea:focus { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--amber) 60%, transparent); }
textarea::placeholder { color: var(--faint); }
.row { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.row small { color: var(--faint); font-size: 11.5px; }
.btn { padding: 8px 16px; border-radius: 99px; font-size: 13px; background: rgba(255,255,255,.08); box-shadow: inset 0 0 0 1px var(--line); transition: background .2s, transform .15s; }
.btn:hover { background: rgba(255,255,255,.14); }
.btn:active { transform: scale(.96); }
.btn.primary { background: linear-gradient(135deg, #ffb48f, #ff8a74); color: #2a1217; font-weight: 600; box-shadow: 0 4px 18px rgba(255,130,100,.35); }
.btn:disabled { opacity: .4; cursor: default; }
.notes { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.note { position: relative; padding: 11px 13px 11px 15px; border-radius: 4px 14px 14px 14px; background: color-mix(in srgb, var(--c) 9%, rgba(255,255,255,.03)); box-shadow: inset 2px 0 0 var(--c); cursor: pointer; transition: background .2s; }
.note:hover { background: color-mix(in srgb, var(--c) 15%, rgba(255,255,255,.03)); }
.note.zhi { --c: var(--zhi); } .note.ke { --c: var(--ke); }
.note p { font-family: var(--hand); font-size: 16px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.note .meta { display: flex; gap: 8px; margin-top: 6px; font-size: 11px; color: var(--faint); }
.note .meta b { color: var(--c); font-weight: 600; letter-spacing: .06em; }
.note .del { position: absolute; right: 8px; top: 6px; font-size: 14px; color: var(--faint); opacity: 0; transition: opacity .2s; }
.note:hover .del { opacity: 1; }
.empty { color: var(--faint); font-size: 13px; padding: 6px 2px; line-height: 1.7; }
.src { margin-top: 26px; font-size: 11px; color: var(--faint); line-height: 1.7; }

/* 顶部右侧与底部控制 */
#tools { position: fixed; z-index: 4; right: 18px; top: 18px; display: flex; gap: 8px; }
.chip { padding: 9px 15px; border-radius: 99px; font-size: 13px; background: var(--glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: inset 0 0 0 1px var(--line); transition: background .2s, color .2s; display: inline-flex; align-items: center; gap: 6px; }
.chip:hover { background: var(--glass-hi); }
.chip[aria-pressed=true] { color: var(--amber); box-shadow: inset 0 0 0 1px rgba(255,217,163,.5); }
#zoom { position: fixed; z-index: 4; right: 18px; bottom: 112px; display: flex; flex-direction: column; border-radius: 16px; overflow: hidden; background: var(--glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: inset 0 0 0 1px var(--line); }
#zoom button { width: 40px; height: 40px; font-size: 20px; color: var(--ink); }
#zoom button:hover { background: rgba(255,255,255,.08); }
#zoom button + button { box-shadow: inset 0 1px 0 var(--line); }

#player { position: fixed; z-index: 4; left: calc(var(--panel-w) + 36px); right: 74px; bottom: 22px; display: flex; align-items: center; gap: 14px; padding: 12px 18px; border-radius: 20px; background: var(--glass); -webkit-backdrop-filter: blur(20px) saturate(1.3); backdrop-filter: blur(20px) saturate(1.3); box-shadow: 0 10px 40px rgba(0,0,0,.4), inset 0 0 0 1px var(--line); }
#play { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #ffcaa6, #ff8f78); color: #2a1217; display: grid; place-items: center; box-shadow: 0 4px 16px rgba(255,130,100,.4); flex: none; transition: transform .15s; }
#play:active { transform: scale(.93); }
.scrub { flex: 1; min-width: 0; }
.when { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 8px; font-variant-numeric: tabular-nums; }
.when b { color: var(--ink); font-weight: 500; }
.track { position: relative; height: 18px; cursor: pointer; touch-action: none; }
.track .rail { position: absolute; left: 0; right: 0; top: 8px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.12); }
.track .fill { position: absolute; left: 0; top: 8px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, #5aa9c9, var(--amber) 70%, #ff8a74); width: 0; }
.track .ticks { position: absolute; left: 0; right: 0; top: 4px; height: 11px; background: repeating-linear-gradient(90deg, rgba(255,255,255,.18) 0 1px, transparent 1px var(--tick, 20px)); opacity: .6; pointer-events: none; }
.track .knob { position: absolute; top: 3px; width: 13px; height: 13px; margin-left: -6.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 4px rgba(255,200,160,.25), 0 2px 8px #000; left: 0; }
.speed { display: flex; gap: 2px; padding: 3px; border-radius: 99px; background: rgba(255,255,255,.06); flex: none; }
.speed button { padding: 5px 10px; font-size: 12px; border-radius: 99px; color: var(--muted); }
.speed button[aria-pressed=true] { background: rgba(255,255,255,.14); color: var(--ink); }

#toast { position: fixed; z-index: 20; left: 50%; top: 22px; transform: translate(-50%, -16px); padding: 10px 18px; border-radius: 99px; background: rgba(10,18,34,.92); box-shadow: inset 0 0 0 1px var(--line), 0 8px 30px rgba(0,0,0,.5); font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s var(--ease); }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
dialog { border: 0; padding: 22px; border-radius: 20px; background: #0f1a30; color: var(--ink); box-shadow: 0 24px 80px #000, inset 0 0 0 1px var(--line); width: min(360px, 90vw); }
dialog::backdrop { background: rgba(3,8,18,.6); backdrop-filter: blur(4px); }
dialog h3 { margin: 0 0 6px; font: 400 22px var(--hand); }
dialog p { color: var(--muted); font-size: 13px; line-height: 1.6; margin-bottom: 14px; }
dialog input { width: 100%; padding: 11px 14px; border-radius: 12px; border: 0; outline: none; background: rgba(255,255,255,.07); color: var(--ink); font: 15px var(--ui); box-shadow: inset 0 0 0 1px var(--line); margin-bottom: 14px; }
dialog .row { justify-content: flex-end; }
#loading { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: var(--bg); transition: opacity .8s .1s; }
#loading.off { opacity: 0; pointer-events: none; }
#loading div { text-align: center; font-family: var(--hand); font-size: 30px; letter-spacing: .1em; color: var(--swan); animation: breathe 2.4s ease-in-out infinite; }
#loading small { display: block; font: 12px var(--ui); color: var(--muted); letter-spacing: .2em; margin-top: 8px; }

/* 窄屏：地图在上，面板变成底部抽屉 */
@media (max-width: 860px) {
  :root { --panel-w: auto; }
  #panel { left: 8px; right: 8px; top: auto; bottom: 8px; height: 46vh; border-radius: 20px; transition: height .35s var(--ease); }
  #panel.min { height: 108px; }
  #panel.min .scroll { overflow: hidden; }
  .scroll { padding: 16px 16px 22px; }
  h1 { font-size: 44px; }
  #player { left: 8px; right: 8px; bottom: calc(46vh + 16px); padding: 9px 12px; }
  #panel.min ~ #player { bottom: 124px; }
  #zoom { display: none; }
  #tools { right: 8px; top: 8px; }
  .chip { padding: 7px 12px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition-duration: 1ms !important; } }
