/*
  通用基础样式：主题变量、重置、布局骨架与主题切换按钮组
  说明：首页导航页与各工具页共用本文件，统一维护视觉规范
        仅收录三处页面完全一致的部分，页面专属样式仍写在各自 <style> 中
  作者：张涵哲
  时间：2026-07-07 18:30:00
*/

/* 主题变量：明暗两套配色，通过 html[data-theme] 切换；--accent 系列可由页面自行覆盖 */
:root {
  --bg: #f5f6f8;
  --card-bg: #ffffff;
  --text: #1f2328;
  --text-weak: #6b7280;
  --border: #e5e7eb;
  --track: #e5e7eb;
  --accent: #3b82f6;
  --accent-weak: rgba(59, 130, 246, .1);
  --danger: #dc2626;
  --shadow: 0 1px 3px rgba(0, 0, 0, .08);
  --shadow-hover: 0 6px 18px rgba(0, 0, 0, .12);
}

html[data-theme="dark"] {
  --bg: #0f1115;
  --card-bg: #1a1d24;
  --text: #e6e8eb;
  --text-weak: #9aa0aa;
  --border: #2a2f3a;
  --track: #2a2f3a;
  --accent: #60a5fa;
  --accent-weak: rgba(96, 165, 250, .12);
  --danger: #f87171;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-hover: 0 6px 18px rgba(0, 0, 0, .5);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background .25s, color .25s;
}

/* 页面主容器：最大宽度由各页面自行覆盖 */
.container {
  margin: 0 auto;
  padding: 32px 20px 60px;
}

/* 顶部栏：标题 + 主题切换 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.topbar h1 {
  font-size: 22px;
  font-weight: 600;
}

/* 主题切换按钮组：同时显示太阳与月亮，滑块指示当前主题 */
.theme-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 4px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: box-shadow .2s;
}

.theme-switch:hover {
  box-shadow: var(--shadow-hover);
}

/* 滑块：跟随当前主题在两个选项间滑动 */
.theme-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 34px;
  height: 32px;
  border-radius: 999px;
  background: var(--accent);
  opacity: .18;
  transition: transform .25s cubic-bezier(.4, 0, .2, 1);
}

html[data-theme="dark"] .theme-thumb {
  transform: translateX(34px);
}

.theme-opt {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  opacity: .5;
  transition: opacity .25s;
}

/* 当前主题对应的选项高亮 */
html[data-theme="light"] .theme-opt[data-opt="light"],
html[data-theme="dark"] .theme-opt[data-opt="dark"] {
  opacity: 1;
}
