/* ============================================================
   我的个人主页 · 基础样式
   改配色：改下面 :root 里的变量即可，其他样式会自动跟着变
   ============================================================ */

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

/* ---------- 主题变量 ---------- */
:root {
  --bg: #f6f7f9;            /* 页面背景 */
  --bg-alt: #ffffff;        /* 头部 / 卡片 / 交替区块背景 */
  --text: #23272f;          /* 正文颜色 */
  --text-muted: #5b6472;    /* 次要文字 */
  --accent: #4f6ef7;        /* 主色（按钮、高亮、链接） */
  --accent-strong: #3d5ce0; /* 主色 hover */
  --accent-soft: #e9edfe;   /* 主色的浅色底 */
  --border: #e3e6ec;
  --radius: 12px;
  --shadow: 0 6px 20px rgba(35, 39, 47, 0.06);
  --container: 960px;
  --header-h: 64px;
}

/* 手动选择深色 */
:root[data-theme="dark"] {
  --bg: #16181d;
  --bg-alt: #1e2127;
  --text: #e8eaf0;
  --text-muted: #9aa3b2;
  --accent: #7c93ff;
  --accent-strong: #93a6ff;
  --accent-soft: #272c45;
  --border: #2c3039;
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

/* 未手动选择时，跟随系统深色模式 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16181d;
    --bg-alt: #1e2127;
    --text: #e8eaf0;
    --text-muted: #9aa3b2;
    --accent: #7c93ff;
    --accent-strong: #93a6ff;
    --accent-soft: #272c45;
    --border: #2c3039;
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  }
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
}

a { color: var(--accent); }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- 头部导航 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}

.site-nav {
  display: flex;
  gap: 4px;
}

.site-nav a {
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.site-nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.icon-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* 主题按钮：浅色显示太阳，深色显示月亮 */
.icon-btn .icon-moon { display: none; }
:root[data-theme="dark"] .icon-btn .icon-moon { display: block; }
:root[data-theme="dark"] .icon-btn .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-btn .icon-moon { display: block; }
  :root:not([data-theme="light"]) .icon-btn .icon-sun { display: none; }
}

.nav-toggle { display: none; }

/* 按钮内嵌图标 */
.btn-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.record-del svg {
  width: 15px;
  height: 15px;
}

/* ---------- 页面标题 ---------- */
.page-head {
  padding: 56px 0 40px;
  text-align: center;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
}

.page-head h1 { font-size: 2rem; }
.page-head p { margin-top: 8px; color: var(--text-muted); }

.status-chip {
  display: inline-flex;
  margin-top: 14px;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ---------- 通用区块 ---------- */
.section { padding: 64px 0; }
.section-sm { padding: 32px 0; }
.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section h2 { font-size: 1.5rem; margin-bottom: 12px; }
.sub-title { font-size: 1.15rem !important; }
.section-intro { color: var(--text-muted); margin-bottom: 28px; }

/* 占位提示框 */
.placeholder {
  padding: 16px 18px;
  color: var(--text-muted);
  background: var(--accent-soft);
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 22px;
  border-radius: 10px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease, filter 0.15s ease, transform 0.1s ease;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 110, 247, 0.25);
}

.btn-primary:hover {
  filter: brightness(1.07);
  box-shadow: 0 6px 16px rgba(79, 110, 247, 0.35);
}

.btn-ghost {
  background: var(--bg-alt);
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ---------- 首页：模块入口卡片 ---------- */
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
}

.module-card {
  display: block;
  padding: 28px 24px;
  text-decoration: none;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.module-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.module-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  margin-bottom: 14px;
}

.module-card h3 {
  color: var(--text);
  font-size: 1.15rem;
  margin-bottom: 6px;
}

.module-card p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.module-enter {
  display: inline-block;
  margin-top: 14px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ---------- 学习：统计与打卡 ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-box {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.stat-num {
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.2;
}

.stat-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.checkin-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  border: none;
  border-radius: 12px;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  box-shadow: 0 6px 16px rgba(79, 110, 247, 0.28);
  transition: filter 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.checkin-btn:hover {
  filter: brightness(1.06);
  box-shadow: 0 8px 20px rgba(79, 110, 247, 0.36);
  transform: translateY(-1px);
}

.checkin-btn:active { transform: translateY(0) scale(0.99); }

.checkin-btn.done {
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: none;
  cursor: default;
}

.checkin-btn.done:hover {
  filter: none;
  box-shadow: none;
  transform: none;
}

/* ---------- 学习：日历 ---------- */
.calendar-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 24px;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.month-label { font-weight: 600; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-grid .dow {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 2px 0 8px;
}

.cell {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.cell.checked {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.cell.today {
  box-shadow: inset 0 0 0 2px var(--accent);
}

.cell.today.checked {
  box-shadow: inset 0 0 0 2px var(--accent-strong);
}

/* ---------- 学习：记录 ---------- */
.record-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.record-form textarea {
  width: 100%;
  min-height: 96px;
  padding: 12px 14px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  color: var(--text);
  font: inherit;
  line-height: 1.6;
}

.record-form textarea:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

.record-actions {
  display: flex;
  justify-content: flex-end;
}

.record-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.record-item {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.record-main { min-width: 0; flex: 1; }

.record-main p {
  white-space: pre-wrap;
  word-break: break-word;
}

.record-main time {
  display: block;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.record-del {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 4px;
  cursor: pointer;
}

.record-del:hover { color: #e5484d; }

.empty-records {
  color: var(--text-muted);
  text-align: center;
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* ---------- 学习：链接列表 ---------- */
.link-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.link-list a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
}

.link-list a:hover { border-color: var(--accent); }

.link-emoji { font-size: 1.3rem; }

.link-meta {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.82rem;
}

/* ---------- 通用卡片（生活 / 娱乐占位用） ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.card {
  padding: 24px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card h3 { font-size: 1.05rem; margin-bottom: 8px; }
.card p { color: var(--text-muted); font-size: 0.95rem; }

.badge {
  display: inline-block;
  margin-top: 14px;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* ---------- 工具条与提示 ---------- */
.toolbar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.text-input {
  width: 200px;
  max-width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-alt);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s ease;
}

.text-input:focus {
  outline: 2px solid var(--accent);
  border-color: transparent;
}

/* ---------- 页脚 ---------- */
.site-footer {
  padding: 24px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--border);
}

/* ---------- 移动端 ---------- */
@media (max-width: 720px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .site-nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 4px;
    padding: 12px 20px;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    display: none;
  }

  .site-nav.open { display: flex; }
  .site-nav a { padding: 10px 12px; }

  .section { padding: 48px 0; }
  .page-head { padding: 44px 0 32px; }
}
