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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
  background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    /*background: linear-gradient(135deg, 
  #1e3c72 0%,    
  #2a5298 50%,   
  #4a90e2 100%  */
);
  min-height: 100vh;
  color: #e0e0e0;
  padding: 16px;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.15), transparent),
    radial-gradient(1px 1px at 30% 60%, rgba(255,255,255,0.1), transparent),
    radial-gradient(1px 1px at 50% 30%, rgba(255,255,255,0.12), transparent),
    radial-gradient(1px 1px at 70% 80%, rgba(255,255,255,0.08), transparent),
    radial-gradient(1px 1px at 90% 15%, rgba(255,255,255,0.1), transparent),
    radial-gradient(1px 1px at 15% 85%, rgba(255,255,255,0.12), transparent),
    radial-gradient(1px 1px at 60% 10%, rgba(255,255,255,0.08), transparent),
    radial-gradient(1px 1px at 85% 45%, rgba(255,255,255,0.1), transparent);
  background-size: 180px 180px;
  pointer-events: none;
  z-index: 0;
}

.container { max-width: 1280px; margin: 0 auto; position: relative; z-index: 1; }

/* ═══ Top Bar ═══ */
.top-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; margin-bottom: 20px;
}
.site-title {
  font-size: 1.4rem; font-weight: 700; white-space: nowrap;
  background: linear-gradient(90deg, #f7971e, #ffd200);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  display: flex;
  align-items: center;
  gap: 8px;
}
.site-title a { text-decoration: none; color: inherit; }

/* 天气组件样式 */
.weather-mini {
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  padding: 2px 6px;
  border-radius: 4px;
}
.weather-mini:hover {
  background: rgba(255,255,255,0.08);
}
.weather-popup {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  background: rgba(25,25,45,0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 12px 16px;
  min-width: 200px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  z-index: 100;
  display: none;
}
.weather-popup.show {
  display: block;
}
.weather-popup .city { font-size: 0.85rem; color: rgba(255,255,255,0.5); margin-bottom: 4px; }
.weather-popup .temp { font-size: 1.2rem; font-weight: 700; color: #ffd700; margin-bottom: 4px; }
.weather-popup .desc { font-size: 0.8rem; color: rgba(255,255,255,0.5); }

.nav-links { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.nav-btn {
  padding: 6px 14px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.06); color: #c0c0c0; text-decoration: none;
  font-size: 0.82rem; transition: all 0.2s;
}
.nav-btn:hover { background: rgba(255,215,0,0.15); border-color: rgba(255,215,0,0.3); color: #fff; }
.nav-btn.active { background: rgba(255,215,0,0.2); border-color: #ffd700; color: #ffd700; }

/* 音乐播放器样式修改 */
.music-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c0c0c0;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 8px;
}
.music-icon:hover {
  background: rgba(255,215,0,0.15);
  border-color: rgba(255,215,0,0.3);
  color: #fff;
}
.music-panel {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background: rgba(25,25,45,0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 12px 16px;
  min-width: 280px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  z-index: 100;
  display: none;
}
.music-panel.show {
  display: block;
}
.music-panel .label { font-size: 0.8rem; color: rgba(255,255,255,0.45); margin-bottom: 6px; }
.music-panel select {
  width: 100%; padding: 8px 12px; border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.06); color: #ccc; font-size: 0.85rem;
  outline: none; margin-bottom: 8px; cursor: pointer;
}
.music-panel select option { background: #1e1e3a; color: #ccc; }
.music-panel audio { width: 100%; border-radius: 6px; }
.volume-control {
  width: 100%;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.volume-control label {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.45);
}
.volume-control input {
  flex: 1;
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
}
.volume-control input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffd700;
  cursor: pointer;
}

/* ═══ Header ═══ */
.header { text-align: center; padding: 24px 16px 18px; }
.header h1 {
  font-size: 2rem; font-weight: 700;
  background: linear-gradient(90deg, #f7971e, #ffd200);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; letter-spacing: 2px; margin-bottom: 4px;
}
.header .subtitle { font-size: 0.85rem; color: rgba(255,255,255,0.4); letter-spacing: 3px; }
.header .contact { margin-top: 8px; font-size: 0.8rem; color: rgba(255,255,255,0.35); }
.header .contact a { color: rgba(255,215,0,0.6); text-decoration: none; }
.header .contact a:hover { color: #ffd700; }

/* ═══ Weather + Search Row ═══ */
.tool-row {
  display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap;
}
.search-wrap { flex: 1; min-width: 200px; position: relative; }
.search-wrap input {
  width: 100%; height: 100%; min-height: 52px;
  padding: 0 16px 0 44px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px; background: rgba(255,255,255,0.06);
  color: #e0e0e0; font-size: 0.95rem; outline: none;
  backdrop-filter: blur(12px); transition: border-color 0.2s;
}
.search-wrap input:focus { border-color: rgba(255,215,0,0.3); }
.search-wrap input::placeholder { color: rgba(255,255,255,0.3); }
.search-wrap .search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  font-size: 1rem; color: rgba(255,255,255,0.3); pointer-events: none;
}

.search-count {
  text-align: center; font-size: 0.8rem; color: rgba(255,255,255,0.25);
  margin-bottom: 16px; display: none;
}
.search-count.show { display: block; }

/* ═══ Section ═══ */
.section { margin-bottom: 20px; }
.section-header {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 12px 6px 12px 10px; /* 上下内边距加大，触控区域变高 */
  min-height: 48px; /* 满足苹果44px最小触控标准 */
  border-radius: 10px;
  user-select: none; transition: background 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; /* 禁用双击缩放，移除300ms延迟 */
}
.section-header:hover { background: rgba(255,255,255,0.04); }
.section-header .arrow {
  font-size: 0.7rem; color: rgba(255,255,255,0.3); transition: transform 0.25s ease;
  flex-shrink: 0;
}
.section-header.collapsed .arrow { transform: rotate(-90deg); }
.section-title { font-size: 1rem; font-weight: 600; color: rgba(255,255,255,0.7); flex: 1; }
.section-title .icon { margin-right: 4px; }
.section-count {
  font-size: 0.7rem; color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.06); padding: 2px 8px; border-radius: 8px;
}
.link-grid {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  padding-left: 4px;
  overflow: hidden;
  /* 固定最大高度，不能用none */
  max-height: 2000px;
  transition: max-height 0.35s ease, opacity 0.25s ease;
}
.link-grid.collapsed {
  max-height: 0;
  opacity: 0;
  padding: 0 0 0 4px;
}

/* ═══ Link Card ═══ */
.link-card {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; min-height: 42px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 10px; text-decoration: none; color: #c8c8c8;
  font-size: 0.83rem; transition: all 0.2s ease; position: relative; overflow: hidden;
}
.link-card::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 3px; height: 100%;
  background: linear-gradient(180deg, #f7971e, #ffd200);
  opacity: 0; transition: opacity 0.2s;
}
.link-card:hover {
  background: rgba(255,255,255,0.09);
  border-color: rgba(255,215,0,0.18);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  color: #fff;
}
.link-card:hover::before { opacity: 1; }
.link-card .emoji { font-size: 1rem; flex-shrink: 0; }
.link-card .label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.link-card .fav-btn {
  font-size: 0.8rem; cursor: pointer; flex-shrink: 0;
  opacity: 0.3; transition: opacity 0.2s, transform 0.2s; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.link-card:hover .fav-btn { opacity: 0.5; }
.link-card .fav-btn.active { opacity: 1; color: #ffd700; }
.link-card .fav-btn:hover { transform: scale(1.2); opacity: 1; }

.link-card.hidden { display: none; }
.link-card.search-match { border-color: rgba(255,215,0,0.2); }

/* ═══ Favorites toggle ═══ */
.filter-bar {
  display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
}
.filter-btn {
  padding: 5px 14px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04); color: #999; font-size: 0.8rem;
  cursor: pointer; transition: all 0.2s;
}
.filter-btn:hover { border-color: rgba(255,215,0,0.3); color: #ddd; }
.filter-btn.active { background: rgba(255,215,0,0.15); border-color: #ffd700; color: #ffd700; }

/* ═══ Footer ═══ */
.footer { text-align: center; padding: 32px 16px 16px; font-size: 0.75rem; color: rgba(255,255,255,0.18); }

/* ═══ Responsive ═══ */
@media (max-width: 640px) {
  body { padding: 10px; }
  .header h1 { font-size: 1.5rem; }
  .link-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
  .link-card { padding: 8px 10px; font-size: 0.78rem; min-height: 36px; }
  .top-bar { flex-direction: column; align-items: flex-start; }
  .music-panel { min-width: 240px; right: 0; left: 0; margin: 8px auto 0; }
  .header { padding: 16px 8px 12px; }
  .tool-row { flex-direction: column; }
  .search-wrap input { min-height: 44px; font-size: 0.9rem; }
  .weather-popup { left: 0; right: 0; min-width: unset; }
}

/* 点击外部关闭弹窗 */
.click-outside-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  display: none;
}
.click-outside-wrapper.show {
  display: block;
}