/* ============ 光影机位 · 深色毛玻璃 · 大字关怀 ============ */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: rgba(18, 20, 26, 0.86);
  --bg-solid: #12141a;
  --card: rgba(255, 255, 255, 0.055);
  --line: rgba(255, 255, 255, 0.09);
  --txt: #f2f4f8;
  --txt2: #a3adbf;
  --txt3: #6d7789;
  --sunrise: #FFC93C;
  --sunset: #FF5A36;
  --moonrise: #3AC0F2;
  --moonset: #6C6CF0;
  --sun-path: #F59E42;
  --moon-path: #AEB6DF;
  --gold: #ffcf6e;
  --accent: linear-gradient(135deg, #ffb648, #ff6b57);
  --r-lg: 22px; --r-md: 16px; --r-sm: 12px;
}
html, body {
  margin: 0; padding: 0; height: 100%; width: 100%;
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--bg-solid); overflow: hidden; color: var(--txt);
}
#map { position: absolute; inset: 0; z-index: 1; background: #1a2028; }

/* ---------- toast ---------- */
#toast {
  display: none; position: fixed; left: 50%; transform: translateX(-50%);
  top: calc(env(safe-area-inset-top, 0px) + 74px); z-index: 60;
  max-width: min(92vw, 480px); padding: 12px 18px;
  background: rgba(20, 22, 28, 0.94); color: #ffd9b0;
  font-size: 14px; line-height: 1.5; border-radius: 14px;
  border: 1px solid rgba(255, 182, 72, 0.35);
  box-shadow: 0 8px 32px rgba(0,0,0,.5); backdrop-filter: blur(16px);
}

/* ---------- 顶部搜索 ---------- */
#topbar {
  position: fixed; z-index: 40;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: 12px; right: 12px;
}
.search-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 8px 6px 16px;
  box-shadow: 0 8px 28px rgba(0,0,0,.4);
}
.pill-icon { font-size: 15px; opacity: .7; }
.search-pill input {
  flex: 1; min-width: 0; background: none; border: none; outline: none;
  color: var(--txt); font-size: 16px; padding: 8px 0;
}
.search-pill input::placeholder { color: var(--txt3); }
#locate-btn {
  flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%;
  border: none; cursor: pointer; font-size: 18px;
  background: var(--accent); box-shadow: 0 4px 14px rgba(255, 120, 70, .45);
}
#search-results {
  margin-top: 8px; border-radius: var(--r-md); overflow: hidden;
  background: var(--bg); backdrop-filter: blur(24px);
  border: 1px solid var(--line); box-shadow: 0 12px 40px rgba(0,0,0,.5);
  max-height: 42vh; overflow-y: auto; display: none;
}
#search-results.show { display: block; }
.sr-item { padding: 13px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.sr-item:last-child { border-bottom: none; }
.sr-item:active { background: rgba(255,255,255,.08); }
.sr-item b { display: block; font-size: 16px; font-weight: 600; }
.sr-item span { font-size: 13px; color: var(--txt2); }
.sr-empty { padding: 14px 16px; color: var(--txt2); font-size: 14px; }

/* ---------- 底部抽屉 ---------- */
#sheet {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  background: var(--bg); backdrop-filter: blur(28px) saturate(1.5);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  border: 1px solid var(--line); border-bottom: none;
  box-shadow: 0 -12px 48px rgba(0,0,0,.55);
  display: flex; flex-direction: column;
  transition: height .32s cubic-bezier(.32,.72,.28,1);
}
#sheet.half { height: 46vh; }
#sheet.full { height: 82vh; }
#sheet.peek { height: 118px; }
#sheet-handle { flex-shrink: 0; cursor: pointer; padding: 8px 18px 4px; }
.grabber {
  position: relative;
  width: 48px; height: 6px; border-radius: 3px;
  background: rgba(255,255,255,.45); margin: 4px auto 12px;
}
/* 扩大小横条的点击/触摸热区，不影响视觉 */
.grabber::after { content: ''; position: absolute; inset: -16px -50px; }
.grabber:active { background: rgba(255,255,255,.7); }
.sheet-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.spot-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
#spot-name {
  font-size: 20px; font-weight: 700; letter-spacing: .3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tz-chip { font-size: 12px; color: var(--txt2); }
#fav-btn {
  flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card);
  color: var(--gold); font-size: 22px; cursor: pointer; line-height: 1;
}
#fav-btn.faved { background: rgba(255, 207, 110, .18); border-color: rgba(255,207,110,.4); }

#sheet-content { overflow-y: auto; padding: 6px 18px calc(env(safe-area-inset-bottom, 0px) + 24px); }
#sheet.peek #sheet-content { overflow: hidden; }

.hidden { display: none !important; }

/* ---------- 收藏命名表单 ---------- */
#fav-form { display: flex; gap: 8px; margin: 4px 0 12px; }
#fav-form input {
  flex: 1; min-width: 0; padding: 11px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--card);
  color: var(--txt); font-size: 15px; outline: none;
}
#fav-form button {
  padding: 0 16px; border: none; border-radius: var(--r-sm);
  background: var(--accent); color: #1a1206; font-size: 15px; font-weight: 700; cursor: pointer;
}
#fav-form button.ghost { background: var(--card); color: var(--txt2); border: 1px solid var(--line); }

/* ---------- chips ---------- */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.chip {
  padding: 7px 13px; border-radius: 999px; font-size: 13.5px;
  background: var(--card); border: 1px solid var(--line); color: var(--txt2);
}
.chip b { color: var(--txt); font-weight: 600; }

/* ---------- 日期导航 ---------- */
.date-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.date-arrow {
  width: 42px; height: 42px; border-radius: var(--r-sm); flex-shrink: 0;
  border: 1px solid var(--line); background: var(--card);
  color: var(--txt); font-size: 22px; cursor: pointer; line-height: 1;
}
.date-nav input {
  flex: 1; min-width: 0; padding: 10px 12px; text-align: center;
  border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--card); color: var(--txt);
  font-size: 16px; font-weight: 600; outline: none;
  font-variant-numeric: tabular-nums;
}
.today-btn {
  flex-shrink: 0; padding: 0 14px; height: 42px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--card);
  color: var(--gold); font-size: 14px; font-weight: 600; cursor: pointer;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 14px; margin-bottom: 12px;
}

/* ---------- 时间滑块 ---------- */
.slider-card { padding-bottom: 18px; }
.slider-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; gap: 10px; }
.slider-time {
  font-size: 30px; font-weight: 800; letter-spacing: 1px;
  font-variant-numeric: tabular-nums;
  background: var(--accent); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.slider-readout { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.ro { font-size: 13.5px; color: var(--txt2); font-variant-numeric: tabular-nums; }
.ro.sun { color: #ffd9a0; }
.ro.moon { color: #c3cdfd; }

#time-slider {
  width: 100%; height: 30px; -webkit-appearance: none; appearance: none;
  background: transparent; margin: 2px 0 8px; cursor: pointer;
}
#time-slider::-webkit-slider-runnable-track {
  height: 12px; border-radius: 6px;
  background: var(--slider-bg, linear-gradient(90deg,#141824,#2a3350,#ffb648,#9fc7ff,#ffb648,#2a3350,#141824));
  border: 1px solid var(--line);
}
#time-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 26px; margin-top: -8px;
  border-radius: 50%; background: #fff;
  border: 3px solid #ffb648; box-shadow: 0 2px 10px rgba(0,0,0,.5);
}
#time-slider::-moz-range-track { height: 12px; border-radius: 6px; background: #2a3350; }
#time-slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 3px solid #ffb648;
}

/* 24h 时段条 */
.timeline { position: relative; height: 8px; border-radius: 4px; overflow: hidden; background: #10131c; }
.timeline .seg { position: absolute; top: 0; bottom: 0; }
.timeline-marker {
  position: absolute; top: -2px; bottom: -2px; width: 2px;
  background: #fff; box-shadow: 0 0 6px rgba(255,255,255,.9); z-index: 2;
}

/* ---------- 日月出没 2×2 ---------- */
.astro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.ev-card {
  border-radius: var(--r-md); padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line);
  border-left: 4px solid var(--c, #888);
}
.ev-card .ev-label { font-size: 13.5px; color: var(--txt2); display: flex; justify-content: space-between; }
.ev-card .ev-time {
  font-size: 26px; font-weight: 800; letter-spacing: .5px; margin: 3px 0 2px;
  font-variant-numeric: tabular-nums;
}
.ev-card .ev-dir { font-size: 13px; color: var(--c, var(--txt2)); font-weight: 600; }

/* ---------- 黄金/蓝调/月相/银河 ---------- */
.x-row { display: flex; justify-content: space-between; align-items: baseline; padding: 5px 0; font-size: 15px; gap: 10px; }
.x-row .k { color: var(--txt2); flex-shrink: 0; font-size: 14px; }
.x-row .v { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.x-note { font-size: 12.5px; color: var(--moonrise); margin-top: 6px; line-height: 1.5; }
.x-divider { border-top: 1px dashed var(--line); margin: 6px 0; }

/* ---------- 地形遮挡 ---------- */
.terrain-card { border-left: 4px solid #7ea88a; }
.terrain-row { display: flex; justify-content: space-between; font-size: 14.5px; padding: 3px 0; }
.terrain-row .warn { color: #ffb648; font-weight: 700; }
.terrain-row .ok { color: #7ee2a8; font-weight: 600; }
.terrain-note { font-size: 12px; color: var(--txt3); margin-top: 4px; }

/* ---------- 朝霞晚霞 ---------- */
.section-title { font-size: 16px; font-weight: 700; margin: 14px 0 10px; }
.burn-scroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.burn-scroll::-webkit-scrollbar { display: none; }
.burn-card {
  flex: 0 0 148px; border-radius: var(--r-md); padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line);
  border-top: 4px solid var(--bc, #555);
}
.burn-card .bc-day { font-size: 13px; color: var(--txt2); }
.burn-card .bc-type { font-size: 15px; font-weight: 700; margin-top: 2px; display: flex; justify-content: space-between; }
.burn-card .bc-type small { color: var(--txt3); font-weight: 400; font-variant-numeric: tabular-nums; }
.burn-card .bc-score { font-size: 34px; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.burn-card .bc-score small { font-size: 13px; color: var(--txt3); font-weight: 400; }
.burn-card .bc-label { font-size: 13px; font-weight: 600; color: var(--bc, var(--txt2)); }
.burn-card .bc-cloud { font-size: 11px; color: var(--txt3); margin-top: 3px; }
.burn-na { display: flex; align-items: center; justify-content: center; color: var(--txt3); font-size: 13px; }

/* ---------- 常用机位 ---------- */
.preset-scroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.preset-scroll::-webkit-scrollbar { display: none; }
.preset-chip {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-radius: var(--r-md); cursor: pointer;
  background: var(--card); border: 1px solid var(--line);
}
.preset-chip:active { background: rgba(255,255,255,.09); }
.preset-chip.active { background: rgba(255,182,72,.16); border-color: rgba(255,182,72,.5); }
.preset-chip .pc-emoji { font-size: 19px; }
.preset-chip .pc-name { font-size: 15.5px; font-weight: 600; white-space: nowrap; }

/* ---------- 收藏列表 ---------- */
.fav-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.fav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border-radius: var(--r-md);
  background: var(--card); border: 1px solid var(--line); cursor: pointer;
}
.fav-item:active { background: rgba(255,255,255,.09); }
.fav-item .fi-icon { font-size: 17px; }
.fav-item .fi-name { flex: 1; font-size: 15.5px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fav-item .fi-del {
  flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%;
  border: none; background: rgba(255,107,87,.14); color: #ff8f80;
  font-size: 15px; cursor: pointer; line-height: 1;
}
.fav-empty { color: var(--txt3); font-size: 13.5px; padding: 4px 2px 8px; }

/* ---------- 地图图例浮层 ---------- */
#legend-overlay {
  position: fixed; z-index: 25;
  top: calc(env(safe-area-inset-top, 0px) + 74px); left: 12px;
  background: var(--bg); backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid var(--line); border-radius: 14px;
  padding: 9px 12px; box-shadow: 0 6px 20px rgba(0,0,0,.4);
}
#legend-toggle {
  font-size: 12.5px; font-weight: 700; color: var(--txt);
  cursor: pointer; user-select: none; display: flex; align-items: center; gap: 4px;
}
#legend-toggle .lg-arrow { color: var(--txt2); font-size: 11px; transition: transform .2s; }
#legend-overlay.collapsed .lg-arrow { transform: rotate(-90deg); }
#legend-body { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
#legend-overlay.collapsed #legend-body { display: none; }
#legend-body span { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--txt2); white-space: nowrap; }
#legend-body i { width: 18px; height: 5px; border-radius: 3px; flex-shrink: 0; }

.disclaimer { font-size: 11.5px; color: var(--txt3); margin-top: 2px; }
.loading { color: var(--txt2); font-size: 14px; padding: 8px 0; }

/* ---------- 桌面端：抽屉变右侧面板 ---------- */
@media (min-width: 900px) {
  #topbar { left: 16px; right: auto; width: 400px; }
  #sheet, #sheet.half, #sheet.full {
    left: auto; right: 16px; bottom: 16px; top: 16px;
    width: 396px; height: auto; border-radius: var(--r-lg);
    border-bottom: 1px solid var(--line);
  }
  #sheet.peek { height: auto; }
  .grabber { display: none; }
  #sheet-handle { cursor: default; padding-top: 16px; }
}
