:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel2: #1e222b;
  --line: #2a2f3a;
  --txt: #e6e9ef;
  --sub: #8b93a3;
  --acc: #6c8cff;
  --gold: #f0b34a;
  --green: #3ecf8e;
  --header-bg: rgba(15,17,21,.92);
  --faint: #5a6172;
  --sk-a: #1b1f27;
  --sk-b: #262c3a;
}

/* 浅色主题：只翻变量，结构不动 */
:root[data-theme="light"] {
  --bg: #f5f6f9;
  --panel: #ffffff;
  --panel2: #eef1f6;
  --line: #dde2ea;
  --txt: #1b2231;
  --sub: #5c6678;
  --acc: #3d63d9;
  --gold: #b07b18;
  --green: #1f9a64;
  --header-bg: rgba(255,255,255,.92);
  --faint: #98a1b0;
  --sk-a: #e8ecf3;
  --sk-b: #f2f5f9;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--txt);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  line-height: 1.6;
}
a { color: var(--acc); text-decoration: none; }

/* 毛笔字体：从 5.87MB 的 TTF 子集化而来，只剩站点用到的 533 个字，168KB。
   swap 让文字先用系统楷体显示，字体到位再换，避免首屏空白。
   改了诗句 / 标题后如果出现缺字，跑 python tools/subset_font.py 重新生成。 */
@font-face {
  font-family: 'MaoshanKai';
  src: url('repkg/fonts/maoshan-kai.woff2') format('woff2');
  font-display: swap;
}

/* 顶栏 */
header {
  position: sticky; top: 0; z-index: 10;
  background: var(--header-bg); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 24px;
  padding: 14px 32px;
}
header .logo {
  font-size: 20px; font-weight: 700; letter-spacing: 1px; white-space: nowrap;
  color: var(--txt); text-decoration: none; display: flex; align-items: center;
}
header .logo:hover { color: #fff; }
header .logo span { color: var(--acc); }
header .logo .ico { font-size: 22px; margin-right: 6px; }
header nav { display: flex; gap: 20px; overflow-x: auto; scrollbar-width: none; }
header nav::-webkit-scrollbar { display: none; }
header nav a {
  color: var(--sub); font-size: 14px; padding: 4px 2px; white-space: nowrap;
  display: flex; align-items: center; gap: 6px; border-bottom: 2px solid transparent;
}
header nav a:hover, header nav a.on { color: var(--txt); border-bottom-color: var(--acc); }
header nav a i { font-style: normal; }
@media (max-width: 640px) { header { padding: 12px 16px; gap: 14px; } header .logo { font-size: 17px; } }

main { max-width: 1200px; margin: 0 auto; padding: 28px 24px 80px; }

/* 内页横幅：蛊真人《坚持》同款风格 */
.page-banner {
  position: relative; height: 200px; border-radius: 16px; overflow: hidden;
  border: 1px solid var(--line); margin-bottom: 28px; background: #000;
}
.page-banner .poem {
  position: absolute; top: 0; writing-mode: vertical-rl; text-orientation: upright;
  font-family: 'MaoshanKai', 'KaiTi', serif; color: rgba(255,255,255,.13);
  font-size: 26px; letter-spacing: .3em; line-height: 1; white-space: nowrap;
  user-select: none; pointer-events: none;
}
.page-banner .t {
  position: absolute; left: 36px; bottom: 30px;
  font-family: 'MaoshanKai', 'KaiTi', serif; color: #fff;
  font-size: 52px; letter-spacing: .08em; line-height: 1.1;
  text-shadow: 0 0 24px rgba(255,255,255,.2);
}
.page-banner .e {
  position: absolute; left: 40px; bottom: 14px;
  color: rgba(255,255,255,.3); font-size: 11px; letter-spacing: 4px;
}
.page-banner .seal {
  position: absolute; right: 28px; bottom: 24px;
  font-family: 'MaoshanKai', serif; color: rgba(240,179,74,.85);
  font-size: 13px; letter-spacing: 2px; writing-mode: vertical-rl;
  border: 1px solid rgba(240,179,74,.4); padding: 6px 2px;
}
@media (max-width: 640px) { .page-banner { height: 150px; } .page-banner .t { font-size: 38px; } }

.checkin {
  background: var(--acc); color: #fff; border: none; border-radius: 10px;
  padding: 10px 22px; font-size: 14px; cursor: pointer; white-space: nowrap;
}
.checkin.done { background: var(--panel2); color: var(--green); cursor: default; }
.checkin:disabled { opacity: .75; cursor: default; }

/* 区块 */
section { margin-bottom: 36px; }
.sec-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.sec-head h2 { font-size: 18px; }
.sec-head .more { font-size: 13px; color: var(--sub); }

/* 卡片网格 */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.card {
  position: relative;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  overflow: hidden; transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-3px); border-color: var(--c2, var(--acc)); }
.card.has-link { cursor: pointer; }
.poster {
  height: 176px; display: flex; align-items: center; justify-content: center;
  font-size: 52px; color: rgba(255,255,255,.85);
}
/* 有真封面时：3:4 竖版，图片铺满，卡片底部信息压在图上 */
.poster.has-cover { padding: 0; background: #000; }
.poster.has-cover img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform .35s;
}
.card:hover .poster.has-cover img { transform: scale(1.04); }
.card .info { padding: 10px 12px 12px; }
.card .title { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.card .meta { font-size: 12px; color: var(--sub); display: flex; justify-content: space-between; gap: 8px; }
.tag {
  display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 20px;
  background: var(--panel2); color: var(--sub); border: 1px solid var(--line);
}
.tag.hot { color: var(--gold); border-color: var(--gold); }
.tag.up { color: var(--green); border-color: var(--green); }
.stars { color: var(--gold); font-size: 12px; white-space: nowrap; }
.empty { color: var(--sub); font-size: 12px; grid-column: 1 / -1; }

/* 卡片右上角的编辑 / 删除 */
.card .del, .card .ed {
  position: absolute; top: 6px; width: 26px; height: 26px;
  border: none; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff;
  font-size: 12px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity .15s;
}
.card .del { right: 6px; }
.card .ed { right: 36px; }
.card:hover .del, .card:hover .ed { opacity: 1; }
.card .del:hover { background: #e05a4a; }
.card .ed:hover { background: var(--acc); }
/* 触屏没有 hover：按钮直接常显，否则手机上够不着 */
@media (hover: none) {
  .card .del, .card .ed { opacity: 1; }
}

/* 两栏布局 */
.cols { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.panel h3 { font-size: 15px; margin-bottom: 12px; }

/* 打卡 */
.habit { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.habit:last-child { border: none; }
.habit .streak { font-size: 12px; color: var(--green); }

/* 待办 */
.todo { list-style: none; font-size: 14px; }.todo li {
  padding: 7px 0; border-bottom: 1px dashed var(--line); color: var(--sub);
  display: flex; gap: 8px; align-items: center;
}
.todo li::before { content: "□"; color: var(--acc); flex: none; }
.todo li.add::before { content: none; }
.todo li.ok { text-decoration: line-through; color: var(--faint); }
.todo li.ok::before { content: "☑"; color: var(--green); }
.todo li > span { flex: 1; overflow-wrap: anywhere; }
.todo .x {
  flex: none; width: 28px; height: 28px; border: none; border-radius: 8px;
  background: transparent; color: #5a6172; font-size: 14px; cursor: pointer;
}
.todo .x:hover { background: var(--panel2); color: #e05a4a; }
@media (hover: none) { .todo .x { color: var(--sub); } }

/* 倒计时 */
.count { font-size: 26px; font-weight: 700; color: var(--acc); font-variant-numeric: tabular-nums; }
.count-label { font-size: 12px; color: var(--sub); }

footer { text-align: center; color: var(--sub); font-size: 12px; padding: 24px; border-top: 1px solid var(--line); }

/* 按钮 / 表单 */
.btn-plain {
  background: var(--panel2); color: var(--sub); border: 1px solid var(--line);
  border-radius: 8px; padding: 5px 12px; font-size: 12px; cursor: pointer;
}
.btn-plain:hover { color: var(--txt); border-color: var(--acc); }
input, select {
  background: var(--panel2); color: var(--txt); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 10px; font-size: 13px; outline: none;
}
input:focus { border-color: var(--acc); }

/* 添加 / 编辑弹窗（原来写在 api.js 的内联样式里） */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; z-index: 99;
  padding: 16px;
}
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 22px; width: min(92vw, 360px); max-height: 88vh; overflow: auto;
}
.modal h3 { margin-bottom: 14px; font-size: 16px; }
.modal label { display: block; font-size: 12px; color: var(--sub); margin-top: 8px; }
.modal input { width: 100%; margin: 4px 0 2px; }
textarea {
  width: 100%; margin: 4px 0 2px; resize: vertical;
  background: var(--panel2); color: var(--txt); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 13px; line-height: 1.7;
  font-family: inherit; outline: none;
}
textarea:focus { border-color: var(--acc); }
.modal-btns { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }

/* ---------------- 详情弹层 ---------------- */
.detail {
  position: relative; display: flex; gap: 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  width: min(94vw, 620px); max-height: 88vh; overflow: auto; padding: 18px;
}
.detail-close {
  position: absolute; top: 10px; right: 10px; width: 28px; height: 28px;
  border: none; border-radius: 50%; background: rgba(0,0,0,.5); color: #fff;
  font-size: 13px; cursor: pointer; z-index: 2;
}
.detail-close:hover { background: #e05a4a; }
.detail-cover {
  flex: 0 0 200px; height: 267px; border-radius: 12px; overflow: hidden;
  background: #000; display: flex; align-items: center; justify-content: center;
  font-size: 72px;
}
.detail-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail-body { flex: 1; min-width: 0; }
.detail-kicker {
  display: flex; gap: 6px; align-items: center;
  font-size: 12px; color: var(--faint); letter-spacing: .5px; margin-bottom: 6px;
}
.detail-kicker .dot { opacity: .55; }
.detail-body h3 { font-size: 21px; margin-bottom: 10px; padding-right: 28px; line-height: 1.35; }
.detail-meta {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  font-size: 13px; color: var(--sub);
}
.detail-info { color: var(--txt); opacity: .8; }
/* 简介：这一块是「内容」的主体，给它独立的分隔和行距，别和元信息挤在一起 */
.detail-notebox {
  margin-top: 16px; padding-top: 12px; border-top: 1px dashed var(--line);
}
.detail-notebox h4 {
  font-size: 11px; font-weight: 600; letter-spacing: 3px;
  color: var(--faint); margin-bottom: 8px;
}
.detail-note {
  font-size: 14px; line-height: 1.95; color: var(--txt); opacity: .88;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.detail-note.empty-note { font-size: 13px; color: var(--faint); opacity: 1; }
.detail-btns { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.btn-go {
  background: var(--acc); color: #fff; padding: 9px 20px; border-radius: 10px;
  font-size: 14px; border: none; cursor: pointer;
}
.btn-go:hover { filter: brightness(1.1); color: #fff; }
@media (max-width: 640px) {
  .detail { flex-direction: column; gap: 14px; padding: 14px; }
  .detail-cover { flex: none; width: 100%; height: 240px; }
  .detail-body h3 { font-size: 18px; }
}

/* ---------------- 「新」角标 ---------------- */
.badge-new {
  position: absolute; top: 8px; left: 8px; z-index: 2;
  background: #e05a4a; color: #fff; font-size: 11px; line-height: 1;
  padding: 3px 7px; border-radius: 20px; font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,.45);
}
.badge-new.inline { position: static; }

/* ---------------- 骨架屏 ---------------- */
.skeleton .poster,
.skeleton .sk-line {
  background: linear-gradient(90deg, var(--sk-a) 25%, var(--sk-b) 37%, var(--sk-a) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
.skeleton .sk-line { height: 10px; border-radius: 6px; margin: 8px 0; }
.skeleton .sk-line.w70 { width: 70%; }
.skeleton .sk-line.w40 { width: 40%; }
.skeleton .poster { font-size: 0; }
@keyframes shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

/* ---------------- 打卡热力图 ---------------- */
.heat-stat { font-size: 13px; color: var(--sub); margin-bottom: 10px; }
.heat-stat b { color: var(--green); font-size: 15px; }
.heat {
  display: grid; grid-auto-flow: column;
  grid-template-rows: repeat(7, 12px);
  gap: 4px; overflow-x: auto; padding-bottom: 4px;
}
.heat .cell {
  width: 12px; height: 12px; border-radius: 3px;
  background: var(--panel2); border: 1px solid rgba(128,128,128,.10);
}
.heat .cell.pad { background: transparent; border-color: transparent; }
.heat .cell.on { background: var(--green); border-color: transparent; }
.heat .cell.on.today { box-shadow: 0 0 0 1px #fff inset; }
.heat .cell.today { border-color: var(--acc); }
@media (max-width: 640px) {
  .heat { grid-template-rows: repeat(7, 10px); gap: 3px; }
  .heat .cell { width: 10px; height: 10px; }
}
/* 备案号 */
footer .beian { color: var(--sub); text-decoration: none; }
footer .beian:hover { color: var(--acc); }


/* ---------------- 主题切换按钮 ---------------- */
.theme-btn {
  margin-left: auto; flex: none;
  width: 34px; height: 34px; border-radius: 10px; cursor: pointer;
  background: var(--panel2); border: 1px solid var(--line);
  color: var(--txt); font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: border-color .15s, transform .15s;
}
.theme-btn:hover { border-color: var(--acc); transform: translateY(-1px); }

/* ---------------- 列表工具栏：搜索 / 排序 ---------------- */
.toolbar {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 16px; flex-wrap: wrap;
}
.toolbar .search {
  flex: 1 1 200px; max-width: 340px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--txt);
  border-radius: 10px; padding: 8px 12px; font-size: 13px; outline: none;
  -webkit-appearance: none; appearance: none;
}
.toolbar .search::placeholder { color: var(--sub); }
.toolbar .search:focus { border-color: var(--acc); }
.toolbar .search::-webkit-search-cancel-button { filter: grayscale(1); }
.toolbar .sort {
  background: var(--panel2); border: 1px solid var(--line); color: var(--txt);
  border-radius: 10px; padding: 8px 10px; font-size: 13px; cursor: pointer; outline: none;
}
.toolbar .count { margin-left: auto; font-size: 12px; color: var(--sub); white-space: nowrap; }

/* ---------------- 卡片入场 ---------------- */
.card { animation: cardIn .32s ease backwards; animation-delay: calc(var(--i, 0) * 30ms); }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .card { animation: none; }
}

/* ---------------- 移动端：两列海报墙 ---------------- */
@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .card .title { font-size: 13px; }
  .card .meta { font-size: 11px; }
  .card .info { padding: 8px 10px 10px; }
  .poster { height: 150px; font-size: 40px; }
  .poster.has-cover { height: 150px; }
  .toolbar .search { max-width: none; }
  .toolbar .count { width: 100%; margin-left: 0; text-align: right; }
}
/* ---------------- 首页：首屏下面那段「这站是干嘛的」 ---------------- */
.about {
  padding: 22px 24px 4px;
  max-width: 760px;
}
.about p {
  font-size: 15px; line-height: 1.95; color: var(--txt); opacity: .9;
}
.about .about-sub {
  margin-top: 8px; font-size: 13px; color: var(--sub); opacity: 1;
}
@media (max-width: 560px) { .about { padding: 18px 16px 2px; } .about p { font-size: 14px; } }

/* ---------------- 最近动态时间线 ---------------- */
.timeline { display: flex; flex-direction: column; }
.tl-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 8px; border-radius: 10px;
  color: var(--txt); text-decoration: none; font-size: 13px;
  border-bottom: 1px dashed var(--line);
}
.tl-item:last-child { border-bottom: none; }
.tl-item:hover { background: var(--panel2); }
.tl-when { color: var(--sub); font-size: 12px; width: 68px; flex: none; }
.tl-cat {
  font-size: 11px; padding: 1px 8px; border-radius: 20px;
  border: 1px solid var(--line); color: var(--sub); flex: none;
}
.tl-anime { color: var(--acc); border-color: var(--acc); }
.tl-game { color: var(--gold); border-color: var(--gold); }
.tl-novel { color: var(--green); border-color: var(--green); }
.tl-title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 560px) {
  .tl-when { width: 56px; }
  .tl-item { gap: 8px; }
}