/* ================= 足迹星图 · 水彩淡彩 · 手帐风 ================= */
:root {
  --paper: #fbf7ef;            /* 手帐纸 · 暖米白 */
  --ink: #5b5346;             /* 主文字 · 暖墨 */
  --ink-dim: #948b77;         /* 次要 */
  --ink-faint: #b7ac95;       /* 更淡 */

  --land: #f1ebdc;            /* 陆地 · 安静奶油 */
  --land-line: #ddd0b6;       /* 陆地描边 · 柔 */
  --grid: rgba(150, 135, 105, 0.07);

  --coral: #e08a6c;           /* 点亮 · 珊瑚 */
  --coral-soft: #d98a6f;
  --coral-glow: #f2b49c;
  --dot: #aab3ad;             /* 未点亮 · 淡青灰 */

  --sage: #9fb894;            /* 马卡龙 · 抹茶 */
  --sky: #94b1c4;             /* 马卡龙 · 天青 */
  --rose: #d6a1a7;            /* 马卡龙 · 藕粉 */
  --butter: #d8bf82;          /* 马卡龙 · 奶油黄 */

  --panel: rgba(253, 250, 243, 0.93);
  --panel-line: rgba(185, 168, 130, 0.24);
  --shadow: 0 12px 38px rgba(150, 125, 90, 0.16);
  --shadow-soft: 0 6px 20px rgba(150, 125, 90, 0.12);

  --serif: "Songti SC", "STSong", "Noto Serif SC", "Georgia", serif;
  --hand: "Kaiti SC", "STKaiti", "KaiTi", "楷体", "Noto Serif SC", serif;
  --sans: "PingFang SC", "Helvetica Neue", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* 背景:柔和水彩晕染(就是海洋的颜色) */
#sky {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(900px 660px at 15% 22%, rgba(140, 174, 196, 0.52), transparent 62%),
    radial-gradient(820px 600px at 87% 24%, rgba(226, 140, 110, 0.38), transparent 60%),
    radial-gradient(940px 720px at 71% 84%, rgba(156, 184, 146, 0.48), transparent 62%),
    radial-gradient(780px 640px at 25% 86%, rgba(216, 160, 168, 0.38), transparent 60%),
    radial-gradient(700px 580px at 97% 62%, rgba(218, 192, 128, 0.34), transparent 60%),
    radial-gradient(760px 560px at 45% 46%, rgba(255, 255, 255, 0.22), transparent 62%),
    linear-gradient(180deg, #fbf8f1 0%, #f4eee1 100%);
}

#map { position: fixed; inset: 0; z-index: 1; display: block; cursor: grab; }
#map:active { cursor: grabbing; }
/* 海洋透明,让背后的水彩晕染透出来;陆地是安静奶油色、带柔和投影浮在水上 */
.sphere { fill: transparent; stroke: rgba(150, 170, 185, 0.28); stroke-width: 1px; }
.graticule { fill: none; stroke: var(--grid); stroke-width: .5px; }
.land { fill: var(--land); stroke: var(--land-line); stroke-width: .6px;
  filter: drop-shadow(0 2px 6px rgba(140, 120, 90, 0.14)); }

/* 地点 · 水彩小点 */
.place { cursor: pointer; }
.place .halo { fill: var(--coral-glow); opacity: 0; filter: blur(3px);
  transition: opacity .45s ease; }
.place .core { fill: var(--dot); stroke: rgba(255,255,255,.85); stroke-width: 1px;
  transition: fill .35s ease, r .2s ease; }
.place:hover .core { fill: var(--coral-soft); }
.place.lit .core { fill: var(--coral); stroke: #fff3ec; }
.place.lit .halo { opacity: .55; animation: bloom 3.6s ease-in-out infinite; }
@keyframes bloom { 0%,100% { opacity:.38; } 50% { opacity:.62; } }

/* 品牌 */
#brand { position: fixed; z-index: 5; top: 22px; left: 26px; }
#brand h1 { font-family: var(--serif); font-size: 26px; letter-spacing: 4px; font-weight: 600; color: var(--ink); }
#brand .en { font-family: var(--hand); font-size: 13px; letter-spacing: 2px; color: var(--coral-soft); margin-top: 3px; }
#brand .tag { font-family: var(--hand); font-size: 14px; color: var(--ink-dim); margin-top: 6px; letter-spacing: 1px; }

/* 搜索 */
#searchwrap { position: fixed; z-index: 5; top: 24px; left: 50%; transform: translateX(-50%); width: min(360px, 56vw); }
#search { width: 100%; padding: 10px 18px; border-radius: 22px; background: var(--panel);
  border: 1px solid var(--panel-line); color: var(--ink); font-family: var(--sans); font-size: 14px;
  outline: none; backdrop-filter: blur(8px); box-shadow: var(--shadow-soft); }
#search::placeholder { color: var(--ink-faint); }
#search:focus { border-color: var(--coral-soft); }
#results { position: absolute; top: 46px; left: 0; right: 0; background: var(--panel);
  border: 1px solid var(--panel-line); border-radius: 16px; overflow: hidden; backdrop-filter: blur(10px);
  box-shadow: var(--shadow); display: none; }
#results.show { display: block; }
.ritem { padding: 10px 18px; cursor: pointer; font-size: 14px; display: flex; justify-content: space-between; }
.ritem:hover { background: rgba(224, 138, 108, 0.10); }
.ritem .rc { color: var(--ink); } .ritem .re { color: var(--ink-faint); font-size: 12px; }

/* 足迹按钮 */
#trigger { position: fixed; z-index: 5; top: 24px; right: 26px; padding: 10px 18px; border-radius: 22px;
  background: var(--panel); border: 1px solid var(--panel-line); color: var(--ink); cursor: pointer;
  font-size: 13px; letter-spacing: 1px; backdrop-filter: blur(8px); box-shadow: var(--shadow-soft); transition: border-color .3s; }
#trigger:hover { border-color: var(--coral-soft); }
#trigger b { color: var(--coral); font-family: var(--serif); }

/* 面板 */
.panel { position: fixed; z-index: 10; top: 0; bottom: 0; width: min(420px, 92vw);
  background: var(--panel); backdrop-filter: blur(16px); box-shadow: var(--shadow);
  display: flex; flex-direction: column; transition: transform .42s cubic-bezier(.22,.61,.36,1); }
#footprints { right: 0; border-left: 1px solid var(--panel-line); transform: translateX(105%); }
#footprints.open { transform: translateX(0); }
#card { left: 0; border-right: 1px solid var(--panel-line); transform: translateX(-105%); }
#card.open { transform: translateX(0); }

.phead { position: relative; padding: 30px 28px 16px; border-bottom: 1px solid var(--panel-line); }
/* 手帐小胶带 */
.phead::before { content: ""; position: absolute; top: -9px; left: 34px; width: 96px; height: 22px;
  background: repeating-linear-gradient(45deg, rgba(224,138,108,.32) 0 7px, rgba(224,138,108,.18) 7px 14px);
  transform: rotate(-3deg); border-radius: 2px; box-shadow: 0 2px 6px rgba(150,125,90,.12); }
.phead .close { position: absolute; top: 24px; right: 22px; width: 30px; height: 30px; border: none;
  background: transparent; color: var(--ink-dim); font-size: 22px; cursor: pointer; line-height: 1; }
.phead .close:hover { color: var(--ink); }
.pbody { padding: 22px 28px; overflow-y: auto; flex: 1; }

/* 卡片内容 */
#card .eyebrow { font-family: var(--hand); font-size: 14px; letter-spacing: 2px; color: var(--coral-soft); margin-bottom: 8px; }
#card h2 { font-family: var(--serif); font-size: 25px; line-height: 1.35; font-weight: 600; color: var(--ink); }
#card .place-sub { font-size: 13px; color: var(--ink-dim); margin-top: 8px; letter-spacing: .5px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip { font-size: 12px; padding: 4px 13px; border-radius: 20px; }
/* 马卡龙轮换配色 */
.chip:nth-child(4n+1){ color:#5f7a54; background:rgba(159,184,148,.20); border:1px solid rgba(159,184,148,.45); }
.chip:nth-child(4n+2){ color:#4f7286; background:rgba(148,177,196,.20); border:1px solid rgba(148,177,196,.45); }
.chip:nth-child(4n+3){ color:#a56b72; background:rgba(214,161,167,.20); border:1px solid rgba(214,161,167,.45); }
.chip:nth-child(4n)  { color:#9a7f3f; background:rgba(216,191,130,.22); border:1px solid rgba(216,191,130,.5); }
#card .fact { font-family: var(--hand); font-size: 17.5px; line-height: 2.05; color: #574e3f; margin-top: 22px; }

.section-label { font-family: var(--hand); font-size: 14px; letter-spacing: 1px; color: var(--ink-dim);
  margin: 26px 0 10px; }
.divider { height: 1px; background: var(--panel-line); margin: 24px 0; }

/* 点亮按钮 */
.lit-btn { width: 100%; padding: 13px; border-radius: 26px; border: 1px solid var(--coral-soft);
  background: transparent; color: var(--coral-soft); font-size: 15px; letter-spacing: 2px; cursor: pointer;
  font-family: var(--serif); transition: all .3s; margin-top: 24px; }
.lit-btn:hover { background: rgba(224, 138, 108, 0.08); }
.lit-btn.on { background: var(--coral); color: #fff6f0; border-color: var(--coral);
  box-shadow: 0 6px 22px rgba(224, 138, 108, 0.35); }

/* 笔记 */
#note { width: 100%; min-height: 90px; padding: 12px 14px; border-radius: 12px;
  background: rgba(255, 252, 246, 0.7); border: 1px solid var(--panel-line); color: var(--ink);
  font-family: var(--hand); font-size: 15px; line-height: 1.8; resize: vertical; outline: none; }
#note::placeholder { color: var(--ink-faint); font-family: var(--sans); font-size: 14px; }
#note:focus { border-color: var(--coral-soft); }
.note-actions { display: flex; gap: 10px; margin-top: 12px; }
.btn-sm { padding: 8px 16px; border-radius: 18px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--panel-line); background: transparent; color: var(--ink-dim); transition: all .25s; }
.btn-sm:hover { color: var(--ink); border-color: var(--ink-dim); }
.btn-sm.primary { color: var(--coral-soft); border-color: rgba(224, 138, 108, 0.4); }
.btn-sm.primary:hover { background: rgba(224, 138, 108, 0.08); }
.save-hint { font-size: 12px; color: var(--coral-soft); margin-top: 10px; opacity: 0; transition: opacity .3s; }
.save-hint.show { opacity: 1; }

/* AI 润色预览 */
#polish { margin-top: 16px; padding: 16px 18px; border-radius: 14px; display: none;
  background: linear-gradient(180deg, rgba(224, 138, 108, 0.10), rgba(159, 184, 148, 0.06));
  border: 1px solid rgba(224, 138, 108, 0.22); }
#polish.show { display: block; }
#polish .plabel { font-family: var(--hand); font-size: 13px; letter-spacing: 1px; color: var(--coral-soft); margin-bottom: 8px; }
#polish .ptext { font-family: var(--hand); font-size: 16px; line-height: 2; color: #6a5d45; }

/* 足迹列表 */
.fp-count { font-family: var(--serif); font-size: 15px; color: var(--ink-dim); }
.fp-count b { color: var(--coral); font-size: 34px; }
.fp-list { list-style: none; }
.fp-item { padding: 14px 4px; border-bottom: 1px solid rgba(185, 168, 130, 0.16); cursor: pointer;
  display: flex; align-items: baseline; gap: 10px; transition: padding-left .2s; }
.fp-item:hover { padding-left: 8px; }
.fp-item .dot { color: var(--coral); font-size: 12px; }
.fp-item .fc { font-family: var(--serif); font-size: 16px; color: var(--ink); }
.fp-item .ft { font-size: 12px; color: var(--ink-faint); margin-left: auto; }
.fp-empty { color: var(--ink-faint); font-size: 15px; line-height: 1.9; margin-top: 30px; font-family: var(--hand); }

/* 轻提示 */
#hint { position: fixed; z-index: 6; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: var(--panel); border: 1px solid var(--panel-line); border-radius: 24px; padding: 12px 24px;
  font-family: var(--hand); font-size: 15px; color: var(--ink-dim); letter-spacing: .5px;
  backdrop-filter: blur(8px); box-shadow: var(--shadow-soft); transition: opacity .6s; }
#hint b { color: var(--coral-soft); }
#hint.hide { opacity: 0; pointer-events: none; }

/* 缩放 */
#zoomctl { position: fixed; z-index: 5; bottom: 30px; right: 26px; display: flex; flex-direction: column; gap: 8px; }
#zoomctl button { width: 40px; height: 40px; border-radius: 14px; background: var(--panel);
  border: 1px solid var(--panel-line); color: var(--ink-dim); font-size: 20px; cursor: pointer;
  backdrop-filter: blur(8px); box-shadow: var(--shadow-soft); }
#zoomctl button:hover { border-color: var(--coral-soft); color: var(--coral); }

/* ================= 新建地点 / 搜索兜底 / funfact + AI 桥接 ================= */

/* 「＋ 加一个地方」按钮(左下) */
#addplace { position: fixed; z-index: 5; left: 26px; bottom: 30px; padding: 10px 16px; border-radius: 22px;
  background: var(--panel); border: 1px dashed var(--coral-soft); color: var(--coral-soft); cursor: pointer;
  font-family: var(--hand); font-size: 14px; letter-spacing: 1px; backdrop-filter: blur(8px);
  box-shadow: var(--shadow-soft); transition: all .25s; }
#addplace:hover { background: rgba(224, 138, 108, 0.10); }
body.placing #addplace { background: var(--coral); color: #fff6f0; border-style: solid; }
body.placing #map { cursor: crosshair; }

/* 选点提示条 */
#placing-hint { position: fixed; z-index: 6; top: 74px; left: 50%; transform: translateX(-50%);
  background: var(--coral); color: #fff6f0; border-radius: 20px; padding: 9px 20px;
  font-family: var(--hand); font-size: 14px; letter-spacing: .5px; box-shadow: var(--shadow-soft);
  opacity: 0; pointer-events: none; transition: opacity .3s; white-space: nowrap; }
#placing-hint.show { opacity: 1; }

/* 新建地点浮层 */
#newplace { position: fixed; inset: 0; z-index: 20; display: none; align-items: center; justify-content: center;
  background: rgba(120, 105, 80, 0.14); backdrop-filter: blur(2px); }
#newplace.show { display: flex; }
.np-card { width: min(360px, 88vw); background: var(--panel); border: 1px solid var(--panel-line);
  border-radius: 18px; padding: 26px 24px; box-shadow: var(--shadow); position: relative; }
.np-card::before { content: ""; position: absolute; top: -9px; left: 28px; width: 80px; height: 20px;
  background: repeating-linear-gradient(45deg, rgba(148,177,196,.34) 0 7px, rgba(148,177,196,.18) 7px 14px);
  transform: rotate(-3deg); border-radius: 2px; box-shadow: 0 2px 6px rgba(150,125,90,.12); }
.np-title { font-family: var(--serif); font-size: 19px; color: var(--ink); }
.np-sub { font-family: var(--hand); font-size: 13px; color: var(--ink-dim); margin-top: 6px; letter-spacing: .5px; }
#np-name { width: 100%; margin-top: 16px; padding: 11px 14px; border-radius: 12px;
  background: rgba(255, 252, 246, 0.7); border: 1px solid var(--panel-line); color: var(--ink);
  font-family: var(--hand); font-size: 15px; outline: none; }
#np-name::placeholder { color: var(--ink-faint); font-family: var(--sans); font-size: 13px; }
#np-name:focus { border-color: var(--coral-soft); }
.np-actions { display: flex; gap: 10px; margin-top: 16px; }

/* 地图上:自建点 = 天青;待补充故事 = 空心虚线圈(点亮后恢复珊瑚) */
.place.custom:not(.lit) .core { fill: var(--sky); }
.place.blank:not(.lit) .core { fill: transparent; stroke: var(--ink-faint); stroke-dasharray: 2 2.4; }
.place.custom.blank:not(.lit) .core { fill: transparent; stroke: var(--sky); stroke-dasharray: 2 2.4; }

/* 搜索兜底:添加入口 */
.ritem.add-hit { border-top: 1px dashed var(--panel-line); }
.ritem.add-hit .rc { color: var(--coral-soft); }

/* 故事:补充/修改入口 */
.link-btn { margin-top: 12px; background: transparent; border: none; cursor: pointer;
  font-family: var(--hand); font-size: 13.5px; color: var(--ink-dim); letter-spacing: .5px; padding: 2px 0; }
.link-btn:hover { color: var(--coral-soft); }

/* 故事:编辑态 */
#story-edit { display: none; }
#funfact { width: 100%; min-height: 88px; padding: 12px 14px; border-radius: 12px;
  background: rgba(255, 252, 246, 0.7); border: 1px solid var(--panel-line); color: var(--ink);
  font-family: var(--hand); font-size: 15px; line-height: 1.8; resize: vertical; outline: none; margin-top: 4px; }
#funfact::placeholder { color: var(--ink-faint); font-family: var(--sans); font-size: 13.5px; line-height: 1.7; }
#funfact:focus { border-color: var(--coral-soft); }

/* AI 回填区 */
#ai-return { display: none; margin-top: 14px; padding: 14px 16px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(224, 138, 108, 0.10), rgba(159, 184, 148, 0.06));
  border: 1px solid rgba(224, 138, 108, 0.22); }
#ai-return.show { display: block; }
#ai-return .plabel { font-family: var(--hand); font-size: 13px; color: var(--coral-soft); margin-bottom: 8px; line-height: 1.6; }
#ai-text { width: 100%; min-height: 96px; padding: 11px 13px; border-radius: 10px;
  background: rgba(255, 252, 246, 0.85); border: 1px solid var(--panel-line); color: var(--ink);
  font-family: var(--hand); font-size: 15px; line-height: 1.9; resize: vertical; outline: none; }
#ai-text::placeholder { color: var(--ink-faint); font-family: var(--sans); font-size: 13.5px; }
#ai-text:focus { border-color: var(--coral-soft); }
#ai-return .btn-sm { margin-top: 10px; }
.prompt-box { width: 100%; min-height: 70px; max-height: 130px; padding: 10px 12px; border-radius: 10px;
  background: rgba(250, 246, 238, 0.9); border: 1px dashed var(--panel-line); color: var(--ink-dim);
  font-family: var(--sans); font-size: 12.5px; line-height: 1.7; resize: vertical; outline: none; cursor: pointer; }
.ai-sep { font-family: var(--hand); font-size: 12.5px; color: var(--ink-faint); margin: 13px 0 6px; text-align: center; letter-spacing: .5px; }

/* 删除自建地点 */
.del-place { display: none; width: 100%; margin-top: 26px; padding: 9px; border-radius: 20px;
  background: transparent; border: 1px solid rgba(180, 120, 110, 0.3); color: #b08a82; cursor: pointer;
  font-family: var(--sans); font-size: 12.5px; letter-spacing: 1px; transition: all .25s; }
.del-place:hover { background: rgba(200, 120, 110, 0.08); color: #a05a50; border-color: rgba(180, 120, 110, 0.5); }
