/* ============================================================
   V2.12 · My Trips — 我的行程库 + 分享浮条
   默认跟 App 一致：清爽浅色（奶油底 + 白卡 + 薄荷绿）
   夜间模式（html[data-theme="night"]）自动切回深色 + 暖金
   类名统一 tp- 前缀
   ============================================================ */
.tp-root {
  /* ---- 浅色（默认） ---- */
  --tp-surface: #ffffff;
  --tp-surface-2: #f4f9f5;
  --tp-line: rgba(21, 41, 31, .10);
  --tp-line-strong: rgba(21, 41, 31, .18);
  --tp-fg: #16241c;
  --tp-muted: #5c7168;
  --tp-accent: #0b8a68;
  --tp-accent-ink: #ffffff;
  --tp-warm: #b07a2e;
  --tp-shadow: 0 20px 44px -28px rgba(14, 46, 33, .45);
  --tp-shadow-hover: 0 28px 60px -30px rgba(14, 46, 33, .55);
  --tp-veil: rgba(255, 255, 255, .86);
  position: fixed; inset: 0; z-index: 9100;
  display: none; color: var(--tp-fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.tp-root.open { display: block; }

/* 夜间：恢复深色 + 暖金 */
html[data-theme="night"] .tp-root {
  --tp-surface: #121722;
  --tp-surface-2: #171e2b;
  --tp-line: rgba(255, 255, 255, .10);
  --tp-line-strong: rgba(255, 255, 255, .20);
  --tp-fg: #f4f6fa;
  --tp-muted: #9aa6b8;
  --tp-accent: #e8c477;
  --tp-accent-ink: #11151d;
  --tp-warm: #e8c477;
  --tp-shadow: 0 18px 40px -28px rgba(0, 0, 0, .8);
  --tp-shadow-hover: 0 26px 56px -28px rgba(0, 0, 0, .9);
  --tp-veil: rgba(17, 22, 31, .92);
}

.tp-backdrop {
  position: absolute; inset: 0;
  background:
    radial-gradient(1100px 620px at 10% -8%, #dff1e6 0%, rgba(223, 241, 230, 0) 62%),
    radial-gradient(900px 540px at 94% 4%, #f7eede 0%, rgba(247, 238, 222, 0) 58%),
    #eef4f0;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
html[data-theme="night"] .tp-backdrop {
  background:
    radial-gradient(900px 520px at 12% -6%, rgba(35, 60, 52, .55) 0%, rgba(35, 60, 52, 0) 60%),
    #0a0d13;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}

.tp-shell {
  position: relative; height: 100%; overflow-y: auto; overscroll-behavior: contain;
  padding: 0 max(20px, calc((100vw - 1180px) / 2)) 72px;
}
.tp-shell::-webkit-scrollbar { width: 9px; }
.tp-shell::-webkit-scrollbar-thumb { background: rgba(21, 41, 31, .18); border-radius: 9px; }
html[data-theme="night"] .tp-shell::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); }

/* ---------- 顶栏 ---------- */
.tp-top {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 24px;
  padding: 40px 0 24px; border-bottom: 1px solid var(--tp-line);
}
.tp-kicker {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 10px; letter-spacing: .26em; color: var(--tp-accent);
  text-transform: uppercase; margin-bottom: 14px; font-weight: 650;
}
.tp-kicker::before { content: ''; width: 22px; height: 1.5px; background: var(--tp-accent); border-radius: 2px; opacity: .8; }
.tp-top h1 {
  margin: 0; font-size: clamp(30px, 4.2vw, 52px); font-weight: 600;
  letter-spacing: -.035em; line-height: 1.05; color: var(--tp-fg);
}
.tp-top p { margin: 13px 0 0; color: var(--tp-muted); font-size: 14px; line-height: 1.68; max-width: 600px; }
.tp-top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; padding-top: 6px; }
.tp-count {
  font-size: 12px; color: var(--tp-muted); letter-spacing: .02em; white-space: nowrap;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--tp-line);
  background: var(--tp-veil); backdrop-filter: blur(8px);
}

/* ---------- 按钮 ---------- */
.tp-btn {
  appearance: none; border: 1px solid var(--tp-line-strong); background: var(--tp-surface);
  color: var(--tp-fg); padding: 9px 15px; border-radius: 999px; font-size: 12.5px; cursor: pointer;
  min-height: 38px; white-space: nowrap; font-weight: 550;
  transition: background .18s, border-color .18s, transform .18s, box-shadow .18s, color .18s;
}
.tp-btn:hover { border-color: var(--tp-accent); color: var(--tp-accent); transform: translateY(-1px); box-shadow: var(--tp-shadow); }
.tp-btn.primary {
  background: var(--tp-accent); border-color: var(--tp-accent); color: var(--tp-accent-ink); font-weight: 650;
  box-shadow: 0 10px 22px -14px var(--tp-accent);
}
.tp-btn.primary:hover { color: var(--tp-accent-ink); filter: brightness(1.06); box-shadow: 0 14px 28px -14px var(--tp-accent); }
.tp-btn.ghost { background: transparent; border-color: transparent; color: var(--tp-muted); }
.tp-btn.ghost:hover { background: var(--tp-surface-2); color: var(--tp-fg); border-color: var(--tp-line); box-shadow: none; }
.tp-btn.danger:hover { border-color: #d4564a; color: #c0392b; background: #fdf1ef; box-shadow: none; }
html[data-theme="night"] .tp-btn.danger:hover { border-color: #ff7a6b; color: #ffb3a8; background: rgba(255, 122, 107, .1); }
.tp-btn:focus-visible, .tp-root button:focus-visible, .tp-root input:focus-visible {
  outline: 2px solid var(--tp-accent); outline-offset: 3px;
}
.tp-close { padding: 9px 13px; }
.tp-close:hover { background: var(--tp-surface-2); color: var(--tp-fg); }

/* ---------- 卡片网格 ---------- */
.tp-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 20px; padding: 28px 0 0;
}
.tp-card {
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--tp-surface); border: 1px solid var(--tp-line); border-radius: 20px;
  box-shadow: var(--tp-shadow);
  transition: border-color .22s, transform .22s, box-shadow .22s;
}
.tp-card:hover {
  border-color: var(--tp-accent);
  border-color: color-mix(in srgb, var(--tp-accent) 42%, transparent);
  transform: translateY(-4px); box-shadow: var(--tp-shadow-hover);
}
.tp-cover {
  position: relative; height: 118px; display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--tp-line); overflow: hidden;
}
/* 封面上一层柔光，浅色时不至于发灰 */
.tp-cover::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 90% at 50% -20%, rgba(255, 255, 255, .75), rgba(255, 255, 255, 0) 62%);
}
html[data-theme="night"] .tp-cover::after {
  background: radial-gradient(120% 90% at 50% -20%, rgba(255, 255, 255, .12), rgba(255, 255, 255, 0) 62%);
}
.tp-emoji {
  position: relative; z-index: 1; font-size: 44px; line-height: 1;
  filter: drop-shadow(0 8px 16px rgba(14, 46, 33, .22));
  transition: transform .3s ease;
}
.tp-card:hover .tp-emoji { transform: scale(1.1) rotate(-2deg); }
.tp-cd {
  position: absolute; top: 11px; right: 11px; z-index: 2; font-size: 11px; font-weight: 650;
  padding: 5px 10px 5px 9px; border-radius: 999px; letter-spacing: .01em;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255, 255, 255, .92); color: var(--tp-fg);
  border: 1px solid rgba(21, 41, 31, .08); box-shadow: 0 6px 14px -10px rgba(14, 46, 33, .5);
  backdrop-filter: blur(6px);
}
.tp-cd::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--tp-accent); }
html[data-theme="night"] .tp-cd {
  background: rgba(10, 13, 19, .74); color: var(--tp-accent);
  border-color: rgba(232, 196, 119, .34); box-shadow: none;
}
.tp-body { padding: 15px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.tp-name { margin: 0; font-size: 16.5px; font-weight: 620; letter-spacing: -.012em; line-height: 1.32; color: var(--tp-fg); }
.tp-meta { margin: 0; font-size: 12.5px; color: var(--tp-muted); line-height: 1.55; }
.tp-acts { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; }
.tp-acts .tp-btn { padding: 7px 12px; min-height: 34px; font-size: 12px; flex: 0 1 auto; }
.tp-rename {
  width: 100%; padding: 9px 11px; border-radius: 11px; font-size: 15px; font-weight: 600;
  background: var(--tp-surface-2); border: 1px solid var(--tp-accent); color: var(--tp-fg);
}
.tp-share { margin-top: 8px; padding-top: 11px; border-top: 1px dashed var(--tp-line-strong); }
.tp-share[hidden] { display: none; }
.tp-share label { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--tp-muted); flex-wrap: wrap; }
.tp-share input {
  flex: 1 1 150px; min-width: 0; padding: 7px 9px; border-radius: 9px; font-size: 11.5px;
  background: var(--tp-surface-2); border: 1px solid var(--tp-line); color: var(--tp-fg);
}
.tp-share .tp-btn { padding: 6px 11px; min-height: 30px; font-size: 11.5px; }

/* ---------- 空状态 ---------- */
.tp-empty {
  position: relative; margin: 40px auto 0; max-width: 620px; padding: 56px 28px 44px;
  text-align: center; border-radius: 26px;
  border: 1px dashed var(--tp-line-strong); background: var(--tp-surface);
  box-shadow: var(--tp-shadow);
}
.tp-empty-art {
  width: 104px; height: 104px; margin: 0 auto 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 46px;
  background: radial-gradient(circle at 32% 28%, #e4f6ea, #d3ecdd 70%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .8), 0 18px 34px -22px rgba(14, 46, 33, .55);
}
html[data-theme="night"] .tp-empty-art {
  background: radial-gradient(circle at 32% 28%, rgba(232, 196, 119, .22), rgba(232, 196, 119, .06) 72%);
  box-shadow: inset 0 0 0 1px rgba(232, 196, 119, .2);
}
.tp-empty h2 { margin: 0 0 10px; font-size: 21px; font-weight: 620; letter-spacing: -.02em; color: var(--tp-fg); }
.tp-empty p { margin: 0 auto 22px; max-width: 440px; color: var(--tp-muted); font-size: 14.5px; line-height: 1.78; }

/* ---------- 提示 ---------- */
.tp-toast {
  position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 16px);
  z-index: 9300; padding: 11px 18px; border-radius: 999px;
  background: var(--tp-surface, #fff); color: var(--tp-fg, #16241c); font-size: 13px;
  border: 1px solid var(--tp-line-strong, rgba(21, 41, 31, .18));
  box-shadow: 0 18px 40px -22px rgba(14, 46, 33, .55);
  opacity: 0; pointer-events: none; transition: opacity .22s, transform .22s;
  max-width: min(88vw, 520px); text-align: center; line-height: 1.5; font-weight: 550;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
.tp-toast.show { opacity: 1; transform: translate(-50%, 0); }
html[data-theme="night"] .tp-toast {
  background: rgba(18, 23, 34, .97); color: #fff; border-color: rgba(232, 196, 119, .34);
  box-shadow: 0 18px 40px -18px rgba(0, 0, 0, .8);
}

/* ---------- 朋友分享浮条 ---------- */
.tp-sharebar {
  /* 不在 .tp-root 里，要自带变量，主按钮才有正确配色 */
  --tp-surface: #fff;
  --tp-fg: #16241c;
  --tp-muted: #5c7168;
  --tp-line-strong: rgba(21, 41, 31, .18);
  --tp-accent: #0b8a68;
  --tp-accent-ink: #fff;
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 24px);
  z-index: 9200; display: none; align-items: center; gap: 16px;
  width: min(92vw, 620px); padding: 13px 16px; border-radius: 18px;
  background: rgba(255, 255, 255, .96); border: 1px solid rgba(21, 41, 31, .10);
  box-shadow: 0 26px 60px -30px rgba(14, 46, 33, .6);
  color: #16241c; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  opacity: 0; transition: opacity .24s, transform .24s;
  backdrop-filter: blur(14px);
}
html[data-theme="night"] .tp-sharebar {
  --tp-surface: #121722;
  --tp-fg: #f4f6fa;
  --tp-muted: #9aa6b8;
  --tp-line-strong: rgba(255, 255, 255, .2);
  --tp-accent: #e8c477;
  --tp-accent-ink: #11151d;
  background: rgba(18, 23, 34, .97); border-color: rgba(232, 196, 119, .38);
  color: #f4f6fa; box-shadow: 0 26px 60px -26px rgba(0, 0, 0, .9);
}
.tp-sharebar.show { display: flex; opacity: 1; transform: translate(-50%, 0); }
.tp-sb-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.tp-sb-txt b { font-size: 13px; font-weight: 650; }
.tp-sb-txt span { font-size: 12px; color: var(--tp-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-sb-acts { display: flex; gap: 8px; flex-shrink: 0; }
.tp-sb-acts .tp-btn { padding: 8px 14px; min-height: 36px; font-size: 12.5px; }

/* ---------- 导航角标 ---------- */
.trips-btn { position: relative; }
.trips-count {
  position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px;
  padding: 0 4px; border-radius: 999px; background: var(--teal); color: #fff;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.trips-count[hidden] { display: none; }

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
  .tp-top { flex-direction: column; gap: 16px; padding: 30px 0 18px; }
  .tp-top-actions { justify-content: space-between; width: 100%; }
  .tp-grid { grid-template-columns: 1fr; gap: 15px; padding-top: 20px; }
  .tp-card:hover { transform: none; }
  .tp-empty { margin-top: 24px; padding: 42px 20px 34px; }
  .tp-empty-art { width: 88px; height: 88px; font-size: 40px; margin-bottom: 18px; }
  .tp-acts .tp-btn { flex: 1 1 44%; }
  .tp-sharebar { flex-direction: column; align-items: stretch; gap: 10px; bottom: 14px; }
  .tp-sb-acts .tp-btn { flex: 1; }
}
