/* =========================================================
   个人日常主页 — 6 套主题样式
   ========================================================= */

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

/* ========== 主题变量 ========== */
body[data-theme="dark"] {
  --bg: #0f0f14;
  --card: rgba(255,255,255,0.08);
  --text: #e5e5e5;
  --accent: #6c8cff;
  --accent-soft: rgba(108,140,255,0.15);
  --border: rgba(255,255,255,0.1);
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  --nav-bg: rgba(255,255,255,0.06);
  --nav-active: rgba(108,140,255,0.25);
}
body[data-theme="light"] {
  --bg: #f5f5f7;
  --card: rgba(0,0,0,0.04);
  --text: #222;
  --accent: #2d6cdf;
  --accent-soft: rgba(45,108,223,0.1);
  --border: rgba(0,0,0,0.08);
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  --nav-bg: rgba(0,0,0,0.03);
  --nav-active: rgba(45,108,223,0.12);
}
body[data-theme="terminal"] {
  --bg: #000;
  --card: rgba(0,255,0,0.06);
  --text: #0f0;
  --accent: #0f0;
  --accent-soft: rgba(0,255,0,0.1);
  --border: rgba(0,255,0,0.2);
  --shadow: 0 0 10px rgba(0,255,0,0.15);
  --font: "SF Mono", "Fira Code", Consolas, "Courier New", monospace;
  --nav-bg: rgba(0,255,0,0.04);
  --nav-active: rgba(0,255,0,0.15);
}
body[data-theme="nature"] {
  --bg: #1a2a1a;
  --card: rgba(255,255,255,0.12);
  --text: #f0f7ee;
  --accent: #7CFC00;
  --accent-soft: rgba(124,252,0,0.15);
  --border: rgba(255,255,255,0.15);
  --shadow: 0 4px 20px rgba(0,0,0,0.25);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  --nav-bg: rgba(255,255,255,0.08);
  --nav-active: rgba(124,252,0,0.2);
}
body[data-theme="retro"] {
  --bg: #080820;
  --card: rgba(255,255,255,0.05);
  --text: #fff;
  --accent: #FF6B9D;
  --accent-soft: rgba(255,107,157,0.12);
  --border: rgba(255,255,255,0.1);
  --shadow: 4px 4px 0 rgba(255,107,157,0.3);
  --font: "Courier New", "VT323", monospace;
  --nav-bg: rgba(255,255,255,0.04);
  --nav-active: rgba(255,107,157,0.15);
}
body[data-theme="cyberpunk"] {
  --bg: #0a0a1a;
  --card: rgba(255,0,255,0.06);
  --text: #0ff;
  --accent: #f0f;
  --accent-soft: rgba(255,0,255,0.12);
  --border: rgba(0,255,255,0.15);
  --shadow: 0 0 20px rgba(255,0,255,0.2), 0 0 40px rgba(0,255,255,0.08);
  --font: "Rajdhani", "Orbitron", -apple-system, sans-serif;
  --nav-bg: rgba(0,255,255,0.04);
  --nav-active: rgba(0,255,255,0.12);
}

/* ========== 全局 ========== */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px 20px 40px;
  transition: background 0.4s ease, color 0.4s ease;
  line-height: 1.6;
}
html { scroll-behavior: smooth; scroll-padding-top: 80px; }

/* 自然主题背景图 */
body[data-theme="nature"] {
  background:
    linear-gradient(rgba(0,0,0,0.35), rgba(0,0,0,0.35)),
    url("https://images.unsplash.com/photo-1506905925346-21bda4d32df4?w=1920") center/cover fixed no-repeat,
    #1a2a1a;
}

.container { width: 100%; max-width: 1000px; }

/* ========== 顶部栏 ========== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  flex-wrap: wrap;
  gap: 8px;
}
.greeting { font-size: 15px; opacity: 0.85; font-weight: 500; }
.time { font-size: 13px; opacity: 0.5; margin-bottom: 20px; }

/* ========== 搜索 ========== */
.search-wrapper { display: flex; gap: 10px; margin-bottom: 10px; }
.search-wrapper input {
  flex: 1; padding: 14px 20px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--card); color: var(--text); font-size: 16px; outline: none;
  backdrop-filter: blur(10px); transition: border 0.2s, box-shadow 0.2s;
  font-family: inherit;
}
.search-wrapper input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.engines { display: flex; gap: 4px; }
.engines span {
  cursor: pointer; padding: 10px 14px; background: var(--card);
  border-radius: 10px; font-size: 12px; opacity: 0.5;
  transition: 0.2s; border: 1px solid var(--border);
  user-select: none;
}
.engines span:hover, .engines span.active {
  opacity: 1; background: var(--accent); color: #fff;
}

/* ========== 搜索提示 ========== */
.search-hint {
  text-align: center;
  font-size: 12px;
  opacity: 0.45;
  margin-bottom: 20px;
  transition: opacity 0.2s;
}
.search-hint:hover { opacity: 0.7; }
.search-hint kbd {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-family: inherit;
  margin: 0 2px;
}

/* ========== 导航栏 ========== */
.nav-bar {
  display: flex;
  gap: 4px;
  background: var(--nav-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px;
  margin-bottom: 28px;
  backdrop-filter: blur(12px);
  position: sticky;
  top: 12px;
  z-index: 50;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
}
.nav-link {
  flex: 1;
  min-width: 80px;
  text-align: center;
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  opacity: 0.55;
  transition: all 0.2s;
  white-space: nowrap;
  user-select: none;
}
.nav-link:hover {
  opacity: 1;
  background: var(--nav-active);
}
.nav-link.active {
  opacity: 1;
  background: var(--accent);
  color: #fff;
}

/* 终端主题导航 */
body[data-theme="terminal"] .nav-bar { border-color: rgba(0,255,0,0.25); }
body[data-theme="terminal"] .nav-link.active { background: #0f0; color: #000; text-shadow: none; }
body[data-theme="terminal"] .nav-link:hover { background: rgba(0,255,0,0.1); }

/* 复古主题导航 */
body[data-theme="retro"] .nav-bar { border-radius: 0; border: 2px solid var(--accent); }
body[data-theme="retro"] .nav-link { border-radius: 0; }
body[data-theme="retro"] .nav-link.active { background: var(--accent); color: #080820; }

/* 赛博朋克导航 */
body[data-theme="cyberpunk"] .nav-bar { border-color: rgba(0,255,255,0.2); box-shadow: 0 0 15px rgba(0,255,255,0.1); }
body[data-theme="cyberpunk"] .nav-link.active { box-shadow: 0 0 12px var(--accent); text-shadow: 0 0 6px #fff; }

/* 自然主题导航 */
body[data-theme="nature"] .nav-link.active { background: var(--accent); color: #1a2a1a; }

/* ========== 网格 & 卡片 ========== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.card {
  background: var(--card); border-radius: 16px; padding: 20px;
  backdrop-filter: blur(12px); border: 1px solid var(--border);
  box-shadow: var(--shadow); transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-2px); }
.card h3 { margin-bottom: 12px; font-size: 13px; opacity: 0.6; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.card a {
  display: block; padding: 7px 0; color: var(--text);
  text-decoration: none; border-radius: 6px; transition: 0.2s;
  font-size: 14px;
}
.card a:hover { color: var(--accent); padding-left: 8px; }

/* 复古主题硬边 */
body[data-theme="retro"] .card { border-radius: 0; border: 2px solid var(--accent); }
body[data-theme="retro"] .card a:hover { color: var(--accent); background: rgba(255,107,157,0.1); }
/* 赛博朋克斜切 */
body[data-theme="cyberpunk"] .card { border-radius: 4px; border-left: 3px solid var(--accent); }
body[data-theme="cyberpunk"] .card a:hover { text-shadow: 0 0 8px var(--accent); }
/* 终端主题 */
body[data-theme="terminal"] .card a:hover { background: rgba(0,255,0,0.1); }

/* ========== 区块（section） ========== */
.section { margin-top: 32px; scroll-margin-top: 80px; }
.section-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 14px; flex-wrap: wrap; gap: 8px;
}
.section-header h2 { font-size: 18px; font-weight: 700; }
.section-link {
  font-size: 13px; color: var(--accent); text-decoration: none;
  opacity: 0.8; transition: opacity 0.2s;
}
.section-link:hover { opacity: 1; text-decoration: underline; }

/* ========== 主题切换器 ========== */
.theme-switcher {
  position: fixed; top: 16px; right: 16px;
  display: flex; gap: 6px;
  background: var(--card); padding: 6px; border-radius: 14px;
  backdrop-filter: blur(12px); border: 1px solid var(--border);
  z-index: 100; box-shadow: var(--shadow);
}
.theme-switcher button {
  width: 32px; height: 32px; border: none; border-radius: 10px;
  cursor: pointer; font-size: 14px; opacity: 0.4;
  transition: 0.2s; display: flex; align-items: center; justify-content: center;
}
.theme-switcher button:hover, .theme-switcher button.active { opacity: 1; transform: scale(1.15); }

/* ========== 页脚 ========== */
.footer {
  margin-top: 48px; text-align: center;
  font-size: 12px; opacity: 0.35;
}

/* ========== 帮助弹窗 ========== */
.help-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.6); z-index: 200;
  justify-content: center; align-items: center;
  backdrop-filter: blur(4px);
}
.help-overlay.show { display: flex; }
.help-modal {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px 32px; max-width: 420px;
  box-shadow: var(--shadow); max-height: 80vh; overflow-y: auto;
}
.help-modal h2 { margin-bottom: 16px; font-size: 18px; }
.help-modal table { width: 100%; border-collapse: collapse; }
.help-modal td { padding: 6px 0; font-size: 14px; }
.help-modal td:first-child { width: 140px; }
.help-modal kbd {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 8px; font-size: 12px;
  font-family: "SF Mono", Consolas, monospace;
}
.help-modal button {
  margin-top: 18px; padding: 8px 20px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--card);
  color: var(--text); cursor: pointer; font-size: 14px;
  font-family: inherit;
}
.help-modal button:hover { background: var(--accent); color: #fff; }

/* ========== 响应式 ========== */
@media (max-width: 640px) {
  .theme-switcher { top: 8px; right: 8px; }
  .theme-switcher button { width: 28px; height: 28px; font-size: 12px; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .search-wrapper { flex-direction: column; }
  .engines { justify-content: flex-start; }
  .nav-bar { gap: 2px; padding: 4px; }
  .nav-link { padding: 6px 8px; font-size: 12px; min-width: 60px; }
}
