/* ============================================================
   云图天气 · 设计系统
   ============================================================ */
:root {
  --bg-start: #1b3a5c;
  --bg-end: #0d1b2e;
  --card: rgba(255, 255, 255, 0.10);
  --card-strong: rgba(255, 255, 255, 0.16);
  --border: rgba(255, 255, 255, 0.16);
  --text: #f5f9ff;
  --text-dim: rgba(235, 244, 255, 0.72);
  --text-faint: rgba(235, 244, 255, 0.5);
  --accent: #5eb0ff;
  --accent-2: #7fd1ae;
  --warn: #ffb45e;
  --danger: #ff6b6b;
  --radius: 18px;
  --shadow: 0 10px 34px rgba(6, 18, 36, 0.45);
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(160deg, var(--bg-start), var(--bg-end) 70%);
  background-attachment: fixed;
  min-height: 100vh;
  transition: background 1.2s ease;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(94, 176, 255, 0.22), transparent 60%),
    radial-gradient(900px 420px at 8% 110%, rgba(127, 209, 174, 0.14), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

#app { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 0 20px 28px; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 4px 12px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo { filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3)); }
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: 1px; }

.tabs {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  margin-left: 6px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  background: var(--card-strong);
  color: var(--text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 8px 7px 16px;
  flex: 1;
  min-width: 220px;
  max-width: 380px;
  margin-left: auto;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.search-box:focus-within { border-color: var(--accent); background: var(--card-strong); }
.search-box svg { color: var(--text-dim); flex-shrink: 0; }
.search-box input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.search-box input::placeholder { color: var(--text-faint); }

.search-box button {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  padding: 5px;
  border-radius: 50%;
  display: flex;
  transition: all 0.2s ease;
}
.search-box button:hover { background: rgba(255, 255, 255, 0.12); color: var(--text); }

/* ---------- 视图切换 ---------- */
.view { display: none; animation: fadeIn 0.45s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 快捷城市 ---------- */
.quick-cities {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 18px;
}
.qc-label { font-size: 13px; color: var(--text-faint); margin-right: 2px; }
.chip {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-dim);
  font-size: 13px;
  font-family: inherit;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.22s ease;
}
.chip:hover, .chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- 加载状态 ---------- */
.loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 70px 0; color: var(--text-dim); }
.loading.small { padding: 36px 0; font-size: 13px; }
.spinner {
  width: 34px; height: 34px;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.loading.small .spinner { width: 26px; height: 26px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 天气主内容 ---------- */
.weather-content { display: flex; flex-direction: column; gap: 16px; }

.hero {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 30px 34px;
  background: linear-gradient(135deg, var(--card-strong), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero .loc-block .city-name { font-size: 26px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.hero .loc-block .city-sub { font-size: 13px; color: var(--text-dim); margin-top: 6px; line-height: 1.6; }
.hero .loc-block .city-sub b { color: var(--text); font-weight: 600; }

.hero .cond-block { text-align: center; }
.hero .cond-block svg { width: 86px; height: 86px; filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.28)); }
.hero .cond-block .cond-name { font-size: 17px; font-weight: 600; margin-top: 6px; }

.hero .temp-block { text-align: right; }
.hero .temp-block .temp { font-size: 72px; font-weight: 200; letter-spacing: -2px; line-height: 1; }
.hero .temp-block .temp span { font-size: 30px; font-weight: 300; }
.hero .temp-block .range { font-size: 14px; color: var(--text-dim); margin-top: 6px; }

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
}

.metric {
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.metric .m-label { font-size: 12px; color: var(--text-faint); display: flex; align-items: center; gap: 6px; }
.metric .m-label svg { color: var(--accent); }
.metric .m-value { font-size: 20px; font-weight: 600; }
.metric .m-value small { font-size: 12px; font-weight: 400; color: var(--text-dim); margin-left: 2px; }
.metric .m-sub { font-size: 12px; color: var(--text-dim); }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.card h3 svg { color: var(--accent); }

/* ---------- 24 小时 ---------- */
.hourly-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}
.hourly-strip::-webkit-scrollbar { height: 6px; }
.hourly-strip::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.22); border-radius: 4px; }

.hourly-item {
  flex: 0 0 auto;
  width: 74px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 12px 4px;
  border-radius: 14px;
  transition: background 0.2s ease;
}
.hourly-item:hover { background: rgba(255, 255, 255, 0.07); }
.hourly-item.now { background: rgba(94, 176, 255, 0.16); border: 1px solid rgba(94, 176, 255, 0.35); }
.hourly-item .h-time { font-size: 12px; color: var(--text-dim); }
.hourly-item.now .h-time { color: var(--accent); font-weight: 600; }
.hourly-item svg { width: 34px; height: 34px; }
.hourly-item .h-temp { font-size: 15px; font-weight: 600; }
.hourly-item .h-pop { font-size: 11px; color: #8fd0ff; min-height: 14px; }
.hourly-item .h-rain { font-size: 11px; color: var(--text-faint); }

/* ---------- 7 天 ---------- */
.daily-list { display: flex; flex-direction: column; }
.daily-row {
  display: grid;
  grid-template-columns: 86px 44px 1fr 96px 60px;
  align-items: center;
  gap: 12px;
  padding: 12px 8px;
  border-radius: 12px;
  transition: background 0.2s ease;
}
.daily-row:hover { background: rgba(255, 255, 255, 0.06); }
.daily-row + .daily-row { border-top: 1px solid rgba(255, 255, 255, 0.07); }
.daily-row.today .d-day { color: var(--accent); font-weight: 700; }
.daily-row .d-day { font-size: 14px; font-weight: 600; }
.daily-row .d-date { font-size: 12px; color: var(--text-faint); }
.daily-row svg { width: 34px; height: 34px; justify-self: center; }
.daily-row .d-pop { font-size: 12px; color: #8fd0ff; }
.daily-row .d-rain { font-size: 11px; color: var(--text-faint); }

.tempbar { position: relative; height: 6px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); overflow: visible; }
.tempbar .bar { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: linear-gradient(90deg, #5eb0ff, #ffd166, #ff8a5e); min-width: 4px; }
.daily-row .d-range { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; white-space: nowrap; }
.daily-row .d-range .low { color: var(--text-dim); font-weight: 500; }

/* ---------- 台风视图布局 ---------- */
.typhoon-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 16px;
  align-items: start;
}

.typhoon-side {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow);
}

.side-head { display: flex; align-items: center; justify-content: space-between; }
.side-head h2 { font-size: 15px; font-weight: 600; }

.refresh-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  width: 30px; height: 30px;
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.refresh-btn:hover { background: rgba(255, 255, 255, 0.12); color: var(--text); }
.refresh-btn.spinning svg { animation: spin 0.9s linear infinite; }

.typhoon-list { display: flex; flex-direction: column; gap: 8px; max-height: 560px; overflow-y: auto; }

.tf-item {
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 12px 13px;
  cursor: pointer;
  transition: all 0.22s ease;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-family: inherit;
}
.tf-item:hover { background: rgba(255, 255, 255, 0.07); }
.tf-item.active {
  background: rgba(94, 176, 255, 0.18);
  border-color: rgba(94, 176, 255, 0.55);
}
.tf-item .tf-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.tf-item .tf-name { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.tf-item .tf-status { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.tf-item .tf-status.start { background: rgba(255, 107, 107, 0.22); color: #ff9d9d; }
.tf-item .tf-status.stop { background: rgba(255, 255, 255, 0.12); color: var(--text-dim); }
.tf-item .tf-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 12px; color: var(--text-dim); }
.tf-item .tf-en { font-size: 11px; color: var(--text-faint); letter-spacing: 0.5px; }

.side-note {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-faint);
  padding-top: 8px; border-top: 1px solid var(--border);
}

.typhoon-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.map-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: #15202b;
}
.map { height: 520px; width: 100%; z-index: 1; }

.map-controls {
  position: absolute;
  left: 12px; right: 12px; bottom: 12px;
  z-index: 800;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(10, 20, 32, 0.72);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  flex-wrap: wrap;
}

.play-group { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 220px; }
.play-btn {
  width: 38px; height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s ease, background 0.2s ease;
  flex-shrink: 0;
}
.play-btn:hover { transform: scale(1.06); }
.play-btn:active { transform: scale(0.96); }

#trackSlider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.22);
  outline: none;
  cursor: pointer;
}
#trackSlider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  cursor: pointer;
}
#trackSlider::-moz-range-thumb {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  cursor: pointer;
}
.track-time { font-size: 12px; color: var(--text-dim); white-space: nowrap; font-variant-numeric: tabular-nums; }

.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-dim); }
.legend .lg-item { display: inline-flex; align-items: center; gap: 5px; }
.legend .dot { width: 12px; height: 4px; border-radius: 2px; display: inline-block; }
.legend .dot.actual { background: #ff9f43; }
.legend .dot.forecast { background: repeating-linear-gradient(90deg, #5eb0ff 0 5px, transparent 5px 8px); }
.legend .dot.circle7 { background: rgba(94, 176, 255, 0.65); }
.legend .dot.circle10 { background: rgba(255, 214, 102, 0.65); }

/* ---------- 台风详情 ---------- */
.typhoon-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }

.detail-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.detail-panel h3 {
  font-size: 15px; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
}
.detail-panel h3 svg { color: var(--accent); }

.detail-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.detail-head .d-name { font-size: 24px; font-weight: 800; }
.detail-head .d-intensity {
  font-size: 13px; font-weight: 700;
  padding: 3px 12px; border-radius: 999px;
  background: rgba(255, 180, 94, 0.2); color: #ffd9a0;
}
.detail-head .d-no { font-size: 12px; color: var(--text-faint); }
.detail-time { font-size: 12px; color: var(--text-dim); margin: 8px 0 16px; }

.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.dg-item { background: rgba(255, 255, 255, 0.06); border-radius: 12px; padding: 11px 12px; }
.dg-item .k { font-size: 11px; color: var(--text-faint); margin-bottom: 5px; }
.dg-item .v { font-size: 18px; font-weight: 700; }
.dg-item .v small { font-size: 11px; font-weight: 400; color: var(--text-dim); }

.forecast-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.forecast-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-faint);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.forecast-table td { padding: 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.forecast-table tr:last-child td { border-bottom: 0; }
.forecast-table td.wind { color: var(--accent); font-weight: 600; }
.forecast-table .tf-int { font-weight: 700; }

.empty-state { text-align: center; color: var(--text-dim); padding: 60px 20px; }
.empty-state svg { width: 64px; height: 64px; opacity: 0.4; margin-bottom: 12px; }
.empty-note { text-align: center; color: var(--text-faint); padding: 18px 0; }

.list-group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-faint);
  padding: 10px 4px 4px;
}
.list-group-title:first-child { padding-top: 0; }

.tf-wind {
  font-size: 12px;
  font-weight: 600;
  color: var(--warn);
  background: rgba(255, 180, 94, 0.16);
  padding: 1px 8px;
  border-radius: 999px;
  margin-left: 4px;
}

.d-meaning { font-size: 12px; color: var(--text-faint); margin-top: 14px; line-height: 1.7; }

/* 台风眼标记 */
.tf-eye { position: relative; }
.tf-eye svg {
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.5));
  animation: eyePulse 2.4s ease-in-out infinite;
}
@keyframes eyePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* 城市搜索建议下拉 */
.suggest {
  position: fixed;
  z-index: 2000;
  background: rgba(13, 27, 42, 0.96);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  backdrop-filter: blur(12px);
  animation: fadeIn 0.18s ease;
}
.suggest button {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 11px 16px;
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.15s ease;
}
.suggest button:hover { background: rgba(94, 176, 255, 0.16); }
.suggest button + button { border-top: 1px solid rgba(255, 255, 255, 0.07); }
.suggest .s-name { font-size: 14px; font-weight: 600; }
.suggest .s-region { font-size: 12px; color: var(--text-faint); }

/* ---------- 页脚 ---------- */
.footer {
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--text-faint);
}
.update-stamp { font-variant-numeric: tabular-nums; }

/* ---------- 提示条 ---------- */
.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translate(-50%, -90px);
  background: rgba(15, 28, 44, 0.92);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: var(--shadow);
  z-index: 3000;
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); }

/* ---------- Leaflet 微调 ---------- */
.leaflet-container { font-family: var(--font); background: #16232f; }
.leaflet-control-attribution { font-size: 10px; opacity: 0.75; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .typhoon-layout { grid-template-columns: 1fr; }
  .typhoon-list { max-height: 260px; }
  .typhoon-detail { grid-template-columns: 1fr; }
  .map { height: 420px; }
}

@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; text-align: center; gap: 18px; padding: 24px 20px; }
  .hero .temp-block, .hero .cond-block { text-align: center; }
  .hero .temp-block .temp { font-size: 60px; }
  .topbar { gap: 12px; }
  .brand-name { font-size: 17px; }
  .tabs { margin-left: 0; }
  .search-box { max-width: none; order: 3; flex-basis: 100%; }
  .daily-row { grid-template-columns: 74px 40px 1fr 60px; }
  .daily-row .d-range { display: none; }
  .map { height: 380px; }
  .map-controls { flex-direction: column; align-items: stretch; }
}
