:root {
  --container-max: 1900px;
  --countdown-color: #0f172a;
  /* 默认倒计时颜色（可被 JS 覆盖） */
}

/* 倒计时字体：统一大小并在一行显示 */
.countdown-font {
  font-family: 'ZCOOL XiaoWei', serif;
  color: var(--countdown-color);
  font-size: 2rem;
  /* 统一字号，可调整 */
  line-height: 1;
  display: inline-block;
  transition: color 240ms ease;
}

.container-root {
  max-width: var(--container-max);
  width: 90%;
  margin-left: auto;
  margin-right: auto;
}

/* banner 两栏布局：图片左、天气卡右；对齐拉伸，使等高 */
.banner-wrap {
  display: flex;
  gap: 1rem;
  align-items: stretch;
}

.banner-container {
  flex: 1 1 auto;
  min-height: 10rem;
  height: 10rem;
  position: relative;
  overflow: hidden;
  border-radius: 0.75rem;
}

/* 右侧天气卡与 banner 同高 */
#banner-weather {
  min-width: 14rem;
  max-width: 18rem;
  height: 10rem;
  /* 与 banner-container 保持一致 */
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1rem;
  border-radius: 0.75rem;
  transition: background 300ms ease, color 300ms ease, box-shadow 300ms ease;
  color: inherit;
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.06);
}

/* 在卡片内部强制文本继承卡片颜色（覆盖 tailwind 的 text-gray-*） */
#banner-weather .force-inherit {
  color: inherit !important;
}

/* 天气背景/配色（可根据审美调整颜色） */
.weather-sunny {
  background: linear-gradient(180deg, #ffd54a, #ffb74d);
  color: #1f2937;
}

.weather-cloudy {
  background: linear-gradient(180deg, #cfe9ff, #e6eef9);
  color: #0f172a;
}

.weather-rain {
  background: linear-gradient(180deg, #4fc3f7, #0288d1);
  color: #fff;
}

.weather-storm {
  background: linear-gradient(180deg, #3a3a52, #1f1f2e);
  color: #fff;
}

.weather-snow {
  background: linear-gradient(180deg, #eaf6ff, #cfeefb);
  color: #0f172a;
}

.weather-fog {
  background: linear-gradient(180deg, #d7d2cc, #9aa3a8);
  color: #111827;
}

.weather-dust {
  background: linear-gradient(180deg, #f3e5ab, #e6be6b);
  color: #111827;
}

.weather-unknown {
  background: linear-gradient(180deg, #e0e0e0, #bdbdbd);
  color: #0f172a;
}

/* 手机下堆叠，取消固定高度以自适应文本 */
@media (max-width: 768px) {
  .banner-wrap {
    flex-direction: column;
  }

  .banner-container,
  #banner-weather {
    height: auto;
    min-height: 10rem;
  }

  #banner-weather {
    width: 100%;
    max-width: none;
  }
}

/* 字体应用 */
.banner-font {
  font-family: 'Noto Serif SC', serif;
}

/* 导航 - 标签页样式 */
.nav-tabs {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  overflow-x: auto;
}

.nav-tab {
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(15, 23, 42, 0.04);
  cursor: pointer;
  transition: all 220ms ease;
  font-weight: 700;
  color: #374151;
  white-space: nowrap;
}

.nav-tab:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.06);
}

.nav-tab.active {
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  color: white;
  box-shadow: 0 10px 25px rgba(139, 92, 246, 0.18);
}

/* 导航卡片网格：改为固定宽度卡片，超长文本省略 */
.nav-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.fixed-card {
  width: 200px;
  /* 固定宽度 */
  min-height: 80px;
  padding: 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #fbfbff);
  border: 1px solid rgba(2, 6, 23, 0.04);
  box-shadow: 0 6px 18px rgba(2, 6, 23, 0.04);
  transition: transform 220ms ease, box-shadow 220ms ease;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.fixed-card .nav-item {
  display: block;
  width: 100%;
  color: #0f172a;
  font-weight: 600;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* 单行省略 */
}

.fixed-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 28px rgba(2, 6, 23, 0.08);
}

/* modal 入场动画 */
#settings-modal {
  display: none;
  /* 默认不可见 */
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  align-items: center;
  justify-content: center;
  z-index: 60;
}

#settings-modal.show {
  display: flex !important;
}

/* modal 显示修复：支持 tailwind 的 hidden，同时 .show 强制显示 */
#settings-modal.hidden {
  display: none !important;
}

#settings-modal.show {
  display: flex !important;
}

/* 保持原有子元素入场动画规则（保留已存在实现） */
#settings-modal>div {
  transform: translateY(10px) scale(.995);
  transition: transform 260ms cubic-bezier(.2, .9, .3, 1), opacity 260ms ease;
  opacity: 0;
}

#settings-modal.show>div {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* 强制图片填充容器且不缩放（覆盖 HTML 中的 transform hover） */
.banner-container img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  transform: none !important;
  transition: none !important;
  display: block;
}

/* 防止 hover 状态下图片被放大（覆盖 tailwind hover:scale-105） */
.banner-container:hover img {
  transform: none !important;
}

/* 悬停时仅放大 Banner 的文字（字体放大），并添加平滑过渡（保持原行为） */
.banner-font {
  transition: transform 420ms cubic-bezier(.2, .9, .3, 1);
  transform-origin: left top;
}

.banner-container:hover .banner-font {
  transform: scale(1.06);
}

/* 天气区域收窄：更小内边距和高度，使布局紧凑 */
#weather-root {
  align-items: start;
  gap: 0.5rem;
}

#weather-root>div {
  padding: 0.6rem;
  min-height: 3.2rem;
}

/* 动画 keyframes */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.995);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.animate-fade-in-up {
  animation-name: fadeInUp;
  animation-duration: 420ms;
  animation-fill-mode: both;
  animation-timing-function: cubic-bezier(.2, .9, .3, 1);
}

/* 搜索区 UI 优化 */
#search-form { align-items: center; }
.search-input {
  font-size: 1rem;
  line-height: 1.25rem;
  background: transparent;
  border-radius: 0.75rem;
  box-shadow: none;
}
.search-input::placeholder { color: #9CA3AF; }

.search-clear {
  background: transparent;
  border: none;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

/* 当输入非空时显示清除按钮（可由 JS 切换 .hidden / remove） */
.search-clear:not(.hidden) { display: inline-flex; }

/* 搜索引擎选择样式 */
.search-engine-select {
  min-width: 10rem;
  max-width: 12rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(15,23,42,0.06);
  background: #fff;
}

/* 搜索按钮样式 */
.search-btn {
  min-width: 5.5rem;
  border-radius: 0.75rem;
  box-shadow: 0 6px 14px rgba(99,102,241,0.08);
}

/* 在窄屏时让选择和按钮更紧凑 */
@media (max-width: 640px) {
  #search-form { flex-direction: column; align-items: stretch; gap: 0.5rem; }
  .search-engine-select { width: 100%; max-width: none; }
  .search-btn { width: 100%; }
}

/* 鼠标悬停与聚焦的微交互 */
.search-input:focus { box-shadow: 0 6px 18px rgba(99,102,241,0.06); }
.search-engine-select:focus, .search-btn:focus { outline: none; box-shadow: 0 6px 18px rgba(99,102,241,0.06); }

/* Settings panel specific styling */
.settings-panel {
  max-height: 75vh;
  overflow-y: auto;
  padding: 1rem;
}

/* 强制单列（移除两列布局） */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr; /* 只竖向排列 */
  gap: 1rem;
}

/* 确保每个分区不会无限拉伸，内部滚动由整面板控制 */
.settings-section {
  background: #fff;
  padding: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(2,6,23,0.04);
  box-shadow: 0 4px 14px rgba(2,6,23,0.03);
  /* 保持自然高度，避免单区滚动 */
  overflow: visible;
}

/* banner 预览固定高度，避免撑开面板 */
.banner-preview {
  width: 100%;
  height: 96px;
  object-fit: cover;
  display: block;
}

/* 若需要，移动端保持同样单列 */
@media (max-width: 900px) {
  .settings-grid { grid-template-columns: 1fr; }
}

/* 操作按钮右侧对齐（已在 HTML） */
.settings-panel .mt-4 { margin-top: 1rem; }

/* 小提示文本 */
.settings-section p { margin-top: 0.25rem; }

/* Close button at top-right smaller */
#close-settings { background: transparent; border: none; font-size: 0.95rem; }

/* 城市搜索结果样式 */
#city-results { margin-top: 0.5rem; }
.city-loading { padding: 0.5rem; color: #6B7280; }

.city-list { display: grid; grid-template-columns: 1fr; gap: 0.5rem; }

.city-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem;
  border: 1px solid rgba(15,23,42,0.06);
  background: #fff;
  border-radius: 0.5rem;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.city-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 20px rgba(2,6,23,0.06);
  border-color: rgba(99,102,241,0.18);
}

.city-card-title { font-size: 0.95rem; color: #0f172a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.city-card-meta { font-size: 0.78rem; color: #6b7280; }

.city-action { display:flex; flex-direction: column; gap: 0.35rem; align-items: flex-end; }

/* 选择按钮（主动作） */
.city-select-btn {
  min-width: 64px;
  padding: 6px 10px;
  font-size: 0.85rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
}
.city-select-btn:hover { box-shadow: 0 6px 14px rgba(99,102,241,0.12); }

/* 打开按钮样式 */
.city-open-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
}

/* 手机端：卡片内元信息换行显示 */
@media (max-width: 640px) {
  .city-card { flex-direction: column; align-items: stretch; }
  .city-card-title { max-width: 100%; }
  .city-action { flex-direction: row; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; }
}