/* ============================================================
   首页模块 / 学习（统计·日历·记录·链接） / 娱乐 / 日记 / 访客锁 / 页脚
   由 style.css 按原顺序拆分，层叠顺序未变
   引用顺序：base → modules → pages，不要调换
   ============================================================ */

/* ---------- 首页：模块入口卡片 ---------- */
.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: none;
  transition: filter 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
}

.checkin-btn:hover {
  filter: brightness(1.06);
  box-shadow: none;
  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: var(--danger); }

.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;
}

/* ---------- 娱乐：Steam 游戏库 ---------- */
.steam-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.steam-game {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.steam-game img {
  width: 96px;
  height: 36px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--accent-soft);
  flex-shrink: 0;
  align-self: center;
}

.steam-noimg {
  width: 96px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  border-radius: 6px;
  flex-shrink: 0;
  align-self: center;
}

.steam-game-info {
  flex: 1;
  min-width: 0;
}

.steam-game-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.steam-game-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.steam-game-hours {
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

.steam-game-sub {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.play-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--accent-soft);
  margin-top: 8px;
  overflow: hidden;
}

.play-bar span {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

.steam-ach-btn {
  margin-top: 10px;
  padding: 6px 14px;
  font-size: 0.82rem;
}

.steam-ach {
  display: none;
}

.steam-ach.open {
  display: block;
  margin-top: 10px;
}

.ach-head {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.steam-ach-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
}

.steam-ach-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
}

.steam-ach-item.ach-locked {
  opacity: 0.55;
}

.ach-ico {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
}

.ach-ico.ok {
  border-color: var(--success);
  background: var(--success);
}

.ach-name {
  font-weight: 600;
}

.ach-desc {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.ach-meta {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 2px;
}

/* ---------- 通用卡片（生活 / 娱乐占位用） ---------- */
.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);
}

/* ---------- 访客锁 ---------- */
[hidden] { display: none !important; }

.lock-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lock-box {
  width: min(380px, 100%);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 30px 26px;
  text-align: center;
}

.lock-box h2 { font-size: 1.3rem; margin-bottom: 10px; }
.lock-desc { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 20px; line-height: 1.8; }
.lock-box .text-input { width: 100%; margin-bottom: 14px; }
.lock-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- 日记 ---------- */
.tab-row { display: flex; gap: 10px; justify-content: center; margin-bottom: 20px; }
.tab-btn {
  padding: 10px 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
}
.tab-btn:hover { color: var(--text); border-color: var(--accent); }
.tab-btn.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.diary-stats { margin-top: 0; }

.toolbar-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.toolbar-row .text-input { width: 230px; }

.mood-filter { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-bottom: 16px; }
.mood-btn {
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
  touch-action: manipulation;
}
.mood-btn:hover { border-color: var(--accent); }
.mood-btn.active { background: var(--accent-soft); border-color: var(--accent); }

.entry-list { display: flex; flex-direction: column; gap: 12px; }
.entry-card { text-align: left; }
.entry-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.entry-date { font-weight: 700; font-size: 0.95rem; }
.entry-mood { font-size: 1.3rem; }
.entry-title { font-weight: 600; margin: 8px 0 4px; font-size: 1.05rem; }
.entry-body { color: var(--text-muted); font-size: 0.92rem; white-space: pre-wrap; word-break: break-word; }
.entry-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.tag { background: var(--accent-soft); color: var(--accent); font-size: 0.75rem; padding: 2px 10px; border-radius: 999px; }

/* 日记分类 */
.entry-head-left { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cat-tag { font-size: 0.72rem; padding: 1px 9px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.cat-tag.cat-achievement { background: rgba(47, 191, 113, 0.16); color: #2fbf71; }
.cat-tag.cat-insight { background: rgba(79, 142, 247, 0.16); color: #4f8ef7; }
.cat-tag.cat-life { background: rgba(224, 138, 60, 0.16); color: #e08a3c; }
.category-filter { margin-top: -6px; }
.category-filter .mood-btn { font-size: 0.82rem; padding: 3px 12px; }
#categoryPick .cat-btn { font-size: 0.85rem; padding: 5px 14px; }
#categoryPick .cat-btn[data-cat="achievement"].active { background: rgba(47, 191, 113, 0.18); border-color: #2fbf71; color: #2fbf71; }
#categoryPick .cat-btn[data-cat="insight"].active { background: rgba(79, 142, 247, 0.18); border-color: #4f8ef7; color: #4f8ef7; }
#categoryPick .cat-btn[data-cat="life"].active { background: rgba(224, 138, 60, 0.18); border-color: #e08a3c; color: #e08a3c; }
.entry-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.entry-actions .btn { padding: 6px 14px; font-size: 0.82rem; }

.cell.diary { flex-direction: column; }
.cell.diary.has-entry { background: var(--accent-soft); color: var(--accent); }
.cell-mood { font-size: 0.8rem; line-height: 1; margin-top: 2px; }

/* 状态记录日历 */
.status-cell { font-weight: 700; flex-direction: column; }
.cell.status-yellow { background: #d4a72c; color: #0f172a; }
.cell.status-red { background: #c93a3f; color: #fff; }
.cell.status-blue { background: #2f6fd6; color: #fff; }
.cell.status-yellow.today,
.cell.status-red.today,
.cell.status-blue.today { box-shadow: inset 0 0 0 2px #ffffff; }
.cell.status-red .cell-mood { color: #fff; opacity: 0.9; }

.editor-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 90;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.editor-box {
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  max-height: 85dvh;
  overflow-y: auto;
  background: var(--bg-alt);
  border-radius: 18px 18px 0 0;
  padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
  text-align: left;
}
.editor-box label { font-size: 0.85rem; color: var(--text-muted); display: block; margin: 14px 0 5px; }
.editor-row { display: flex; gap: 12px; }
.editor-row > div { flex: 1; min-width: 0; }
.editor-row label { margin-top: 0; }
.editor-box input[type="date"],
.editor-box input[type="text"],
.editor-box input[type="time"] {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.editor-box textarea {
  width: 100%;
  min-height: 150px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  line-height: 1.7;
  resize: vertical;
}
.editor-box input:focus, .editor-box textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.mood-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.mood-pick .mood-btn { font-size: 1.35rem; padding: 5px 12px; }
.word-count { font-size: 0.8rem; color: var(--text-muted); text-align: right; margin-top: 4px; }
.detail-body { white-space: pre-wrap; word-break: break-word; color: var(--text); line-height: 1.8; }

.weekly-form { display: flex; flex-direction: column; }
.weekly-form label { font-size: 0.9rem; font-weight: 600; margin: 12px 0 6px; display: block; text-align: left; }
.weekly-form textarea {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-alt);
  color: var(--text);
  font: inherit;
  line-height: 1.7;
  resize: vertical;
  margin-bottom: 4px;
}
.weekly-form textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.week-card { text-align: left; }
.week-card summary { cursor: pointer; font-weight: 600; padding: 2px 0; }
.week-field { margin-top: 10px; }
.week-field b { font-size: 0.85rem; }
.week-field p { color: var(--text-muted); font-size: 0.9rem; white-space: pre-wrap; word-break: break-word; margin-top: 3px; }

/* ---------- 安全日志 ---------- */
.log-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
  max-height: 320px;
  overflow-y: auto;
}
.log-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: baseline;
  padding: 8px 12px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.8rem;
}
.log-time { color: var(--text-muted); }
.log-action { color: var(--accent); font-weight: 600; }
.log-detail { color: var(--text-muted); }
.log-ip { margin-left: auto; color: var(--text-muted); font-family: ui-monospace, Consolas, monospace; }
