/* 星语手记：中间一张稿纸，工具在右侧栏（窄屏折叠到下面） */
[hidden] { display: none !important; }

:root {
  --paper: #f6efdc;
  --paper-2: #eee4cb;
  --ink: #1f1b16;
  --ink-soft: #7d715f;
  --line: #ddd0b3;
  --accent: #9c3b2a;      /* 朱砂 */
  --side-bg: rgba(255, 253, 246, .66);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background-color: #ece2cd;
  background-image:
    /* 1. 纸纤维 */
    repeating-linear-gradient(90deg, rgba(150,130,95,.045) 0 1px, transparent 1px 6px),
    repeating-linear-gradient(0deg, rgba(150,130,95,.04) 0 1px, transparent 1px 8px),
    /* 2. 左上角柔光 */
    radial-gradient(circle at 18% 6%, rgba(255,255,255,.5) 0%, transparent 44%),
    /* 3. 纸色罩：左边压到看不清画，右边放开 */
    linear-gradient(90deg,
      rgba(238,228,203,.94) 0%,
      rgba(238,228,203,.88) 34%,
      rgba(238,228,203,.50) 64%,
      rgba(238,228,203,.10) 100%),
    /* 4. 右侧立轴（出血） */
    url("/bg-art.jpg"),
    /* 5. 铺满整页的淡底 */
    url("/bg-art.jpg");
  background-position: 0 0, 0 0, 0 0, center, right -90px center, center 38%;
  background-size: auto, auto, auto, auto, auto 132vh, cover;
  background-repeat: repeat, repeat, no-repeat, no-repeat, no-repeat, no-repeat;
  background-attachment: scroll, scroll, scroll, fixed, fixed, fixed;
  color: var(--ink);
  font-family: "Georgia", "Songti SC", "SimSun", "Noto Serif CJK SC", serif;
}

/* ---------------- 顶栏 ---------------- */
.bar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 22px 6px; max-width: 1180px; margin: 0 auto;
  flex-wrap: wrap;
}
.bar .home {
  color: #7d6a4c; text-decoration: none; font-size: 12.5px;
  border: 1px solid rgba(150,116,66,.35); padding: 5px 10px; border-radius: 6px;
  background: rgba(255,255,255,.5);
}
.bar .home:hover { background: #fff; color: var(--accent); }
.bar .spacer { flex: 1; }
.bar .streak { font-size: 12.5px; color: var(--accent); letter-spacing: 1px; }

.seal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 3px;
  background: var(--accent); color: #fdf6e6;
  font-family: "Kaiti SC", "KaiTi", serif; font-size: 10.5px;
  line-height: 1.05; text-align: center;
  box-shadow: 0 1px 0 rgba(0,0,0,.15) inset;
  transform: rotate(-2deg);
}
.bar .title {
  font-family: "LXGW WenKai Lite", "Kaiti SC", "KaiTi", serif;
  letter-spacing: 5px; font-size: 18px;
}

/* ---------------- 两栏布局 ---------------- */
.diary-layout {
  max-width: 1180px; margin: 8px auto 60px; padding: 0 18px;
  display: grid; grid-template-columns: minmax(0, 1fr) 286px;
  gap: 22px; align-items: start;
}

/* ---------------- 稿纸 ---------------- */
/* 白话：横向条形格纸（原来的样子） */
.sheet {
  position: relative;
  min-height: 600px;
  padding: 34px 44px 40px;
  border: 1px solid #d8c8a6;
  border-radius: 2px;
  background:
    repeating-linear-gradient(to bottom, transparent 0 33px, rgba(190,168,132,.55) 33px 34px),
    linear-gradient(180deg, #fbf5e4 0%, #f3e9d1 100%);
  box-shadow: 0 10px 26px rgba(94,74,44,.16), 0 2px 5px rgba(94,74,44,.10);
}

/* （旧版文言纸规则已删除，见文件末尾） */

.sheet::after { content: none; }

/* 页头 */
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.turn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid rgba(150,116,66,.4); background: rgba(255,255,255,.55);
  color: #7d6a4c; cursor: pointer; font-size: 12px;
}
.turn:hover { background: #fff; color: var(--accent); }
.turn.small { width: 24px; height: 24px; font-size: 13px; }
.day { flex: 1; display: flex; align-items: baseline; gap: 10px; }
#day-text { font-size: 19px; font-weight: 600; letter-spacing: 1px; }
.weekday { font-size: 12.5px; color: var(--ink-soft); }

/* 白话 / 文言 */
.mode-switch {
  display: inline-flex; margin: 0 0 10px;
  border: 1px solid var(--line); border-radius: 999px; overflow: hidden;
}
.mode-switch button {
  border: none; background: transparent; cursor: pointer;
  padding: 4px 14px; font-size: 12.5px; color: #9a8b74; font-family: inherit;
}
.mode-switch button.active { background: var(--accent); color: #fdf6e6; }
.mode-switch button:not(.active):hover { background: rgba(255,255,255,.6); }

/* 心情 */
.mood-row { display: flex; gap: 6px; margin: 2px 0 10px; }
.mood-row button {
  font-size: 19px; line-height: 1; padding: 5px 8px; border-radius: 8px;
  border: 1px solid transparent; background: rgba(255,255,255,.45); cursor: pointer;
  filter: grayscale(.5); transition: all .12s;
}
.mood-row button:hover { filter: none; transform: translateY(-1px); }
.mood-row button.on { filter: none; background: #fff; border-color: var(--accent); }
.mood-row.readonly button { pointer-events: none; opacity: .55; }

/* 空本子引导 */
.onboard {
  background: #fdf7e9; border: 1px dashed #d8c9a8; border-radius: 6px;
  padding: 12px 14px; margin: 4px 0 12px;
}
.onboard .ob-title { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: #6d5427; }
.onboard .ob-body { margin: 0; font-size: 13px; line-height: 1.9; color: #8a7c67; }

/* 正文 */
.note-wrap { position: relative; }
.note {
  width: 100%; border: none; outline: none; resize: vertical;
  background: transparent; padding: 2px; font-size: 17px; line-height: 36px;
  color: var(--ink);
  font-family: "Ma Shan Zheng", "STXingkai", "华文行楷", "Xingkai SC", cursive;
}
.note:disabled { opacity: .6; }
.font-song { font-family: "Songti SC", "SimSun", serif; }
.font-kai  { font-family: "Kaiti SC", "KaiTi", "STKaiti", serif; }
.font-hei  { font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }
.font-mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.font-hand {
  font-family: "LXGW WenKai Lite", "LXGW WenKai", "STXingkai", "华文行楷",
               "Hanzipen SC", "手札体-简", "Hannotate SC", cursive;
}
.font-brush {
  font-family: "Ma Shan Zheng", "STXingkai", "华文行楷", "Xingkai SC", cursive;
  font-size: 17px;
}

/* 锁 */
.locked {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  background: rgba(246,239,220,.75); backdrop-filter: blur(2px);
  border-radius: 4px; color: var(--ink-soft);
}
.locked .lock { font-size: 24px; }
.locked p { margin: 0; font-size: 13px; }
.locked-input { display: flex; gap: 6px; margin-top: 8px; }

/* 图片 */
.img-strip { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 2px; }
.img-strip .ph {
  position: relative; width: 88px; height: 88px; border-radius: 4px; overflow: hidden;
  border: 1px solid var(--line); background: #fff;
}
.img-strip .ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-strip .ph .del {
  position: absolute; top: 2px; right: 2px; width: 19px; height: 19px;
  border-radius: 50%; border: none; background: rgba(0,0,0,.55); color: #fff;
  font-size: 11px; line-height: 1; cursor: pointer;
}

/* 文言信笺 */
.classic-box {
  margin: 12px 0 4px; padding: 14px 16px;
  background: linear-gradient(180deg, #fbf6e8, #f5eedb);
  border: 1px solid #e2d5b8; border-left: 3px solid var(--accent);
  border-radius: 3px;
}
.classic-text {
  margin: 0; font-size: 16.5px; line-height: 2;
  font-family: "Ma Shan Zheng", "STXingkai", "华文行楷", "Xingkai SC", cursive;
  color: #4a3f2e; letter-spacing: .5px;
}
.classic-mark { display: block; text-align: right; font-size: 11.5px; color: #a89a84; margin-top: 6px; }

/* 追踪 */
.trackers { margin: 12px 0 0; display: grid; gap: 9px; }
.tracker { display: grid; grid-template-columns: 92px 86px 1fr 46px; gap: 10px; align-items: center; }
.tracker .name { font-size: 13.5px; }
.tracker input {
  width: 100%; padding: 4px 8px; border: 1px solid var(--line);
  border-radius: 5px; background: rgba(255,255,255,.6);
  font-family: inherit; font-size: 12.5px;
}
.tracker .bar { height: 6px; background: #e7ddc9; border-radius: 99px; overflow: hidden; }
.tracker .bar > i { display: block; height: 100%; background: var(--accent); width: 0; }
.tracker .pct { font-size: 11.5px; color: var(--ink-soft); text-align: right; }

/* 页码 */
.page-no {
  text-align: center; margin-top: 16px; padding-top: 8px;
  font-family: "Kaiti SC", "KaiTi", serif; font-size: 12px;
  color: #9a8564; letter-spacing: 3px;
}
.page-no::before, .page-no::after {
  content: "◆"; font-size: 5px; margin: 0 8px; vertical-align: middle; opacity: .45;
}

/* ---------------- 纸下操作条 ---------------- */
.page-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 10px; padding: 8px 4px;
}
.note-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.note-tools .mini { width: 108px; }
.page-foot .save { margin-left: auto; }

.mini {
  padding: 6px 9px; border: 1px solid rgba(150,116,66,.35); border-radius: 5px;
  background: rgba(255,255,255,.6); font-family: inherit; font-size: 12.5px;
}
.mini.wide { flex: 1; }
.mini-btn {
  padding: 6px 12px; border-radius: 5px; border: 1px solid rgba(150,116,66,.35);
  background: rgba(255,255,255,.55); cursor: pointer; font-family: inherit;
  font-size: 12.5px; color: #6d5b3f;
}
.mini-btn:hover { border-color: var(--accent); color: var(--accent); }
.save {
  padding: 7px 18px; border-radius: 5px; border: 1px solid var(--accent);
  background: var(--accent); color: #fdf6e6; cursor: pointer;
  font-family: inherit; font-size: 13px; letter-spacing: 2px;
}
.save:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------- 侧栏 ---------------- */
.side { display: grid; gap: 10px; position: sticky; top: 12px; }
.side-box {
  background: var(--side-bg); border: 1px solid rgba(180,152,110,.4);
  border-radius: 6px; overflow: hidden;
  backdrop-filter: blur(3px);
}
.side-box > summary {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px; cursor: pointer; list-style: none;
  font-size: 13px; color: #6d5b3f; letter-spacing: 1px;
}
.side-box > summary::-webkit-details-marker { display: none; }
.side-box > summary:hover { background: rgba(255,255,255,.55); }
.side-note { margin-left: auto; font-size: 11px; color: #a89a84; }
.cal-toggle { margin-left: auto; font-size: 11px; color: #a89a84; }
.side-box[open] > summary { border-bottom: 1px solid rgba(180,152,110,.28); }

.side-body { padding: 10px 12px; display: grid; gap: 8px; }
.hide-toggle, .pw-set { font-size: 12.5px; color: #7d6a4c; display: flex; align-items: center; gap: 6px; }
.pw-set .mini { flex: 1; width: auto; }

/* 日历 */
.cal-body { padding: 10px 12px 12px; }
.cal-title { font-weight: 600; color: #6d604c; }
.cal-hint { font-size: 11px; color: #a89a84; }
.cal-nav { display: flex; align-items: center; gap: 5px; margin-bottom: 6px; }
.cal-nav .mini-btn { padding: 3px 8px; font-size: 11.5px; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-week span { text-align: center; font-size: 10px; color: #a89a84; padding: 2px 0; }
.cal-day {
  position: relative; border: none; background: transparent; cursor: pointer;
  height: 27px; border-radius: 4px; font-size: 11.5px; color: #6d604c;
  font-family: inherit;
}
.cal-day:hover { background: rgba(255,255,255,.9); }
.cal-day.other { color: #cfc3ae; }
.cal-day.written { color: #7a4f16; font-weight: 700; background: #f2e2c4; }
.cal-day.written::after {
  content: ""; position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  width: 3px; height: 3px; border-radius: 50%; background: var(--accent);
}
.cal-day.active { background: #e3ecf6; color: #3a5a78; font-weight: 600; }
.cal-day.locked { background: #efe7d8; color: #8a7c67; }
.cal-day.today { outline: 1.5px solid var(--accent); outline-offset: -1.5px; }
.cal-day.current { box-shadow: inset 0 0 0 1.5px #b07a3c; }
.cal-legend {
  margin-top: 8px; font-size: 10.5px; color: #9c8f7b;
  display: flex; gap: 8px; align-items: center;
}
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 2px; }
.dot.written { background: var(--accent); }
.dot.active { background: #7aa2c8; }
.dot.locked { background: #b9a98c; }

/* 加油 */
.cheers { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 12px; }
.cheer {
  border: 1px solid rgba(180,152,110,.45); background: rgba(255,255,255,.6);
  border-radius: 99px; padding: 3px 10px; cursor: pointer; font-size: 12px;
  color: #7d6a4c;
}
.cheer.on { background: #fff; border-color: var(--accent); color: var(--accent); }

/* 便签 */
.comment-list { display: grid; gap: 6px; padding: 10px 12px 0; }
.sticky {
  background: #fff6b8; padding: 8px 10px; border-radius: 2px;
  box-shadow: 1px 2px 6px rgba(120,95,55,.16); font-size: 12.5px; line-height: 1.6;
  transform: rotate(-.5deg);
}
.sticky:nth-child(even) { background: #ffe9a8; transform: rotate(.6deg); }
.sticky .who { display: block; font-size: 10.5px; color: #8a7b4a; margin-top: 3px; }
.comment-form { display: flex; gap: 6px; padding: 10px 12px; flex-wrap: wrap; }
.comment-form .mini { flex: 1 1 70px; min-width: 0; }
.comment-form .mini.wide { flex: 2 1 120px; }

/* 日子 */
.bookmarks { display: flex; gap: 4px; flex-wrap: wrap; padding: 10px 12px; }
.bookmark {
  border: none; background: transparent; cursor: pointer;
  color: #7d6a4c; font-size: 11.5px; padding: 3px 6px; border-radius: 4px;
}
.bookmark:hover { background: rgba(255,255,255,.7); }
.bookmark.on { background: #fff; color: var(--accent); font-weight: 600; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: #2b241c; color: #f5eedc; padding: 8px 16px; border-radius: 6px;
  font-size: 12.5px; z-index: 50;
}

/* ---------------- 窄屏 ---------------- */
@media (max-width: 980px) {
  .diary-layout { grid-template-columns: 1fr; gap: 12px; padding: 0 12px; }
  .side { position: static; }
  .sheet { padding: 20px 18px 24px; }
  .page-foot .save { margin-left: 0; width: 100%; }
  .tracker { grid-template-columns: 74px 74px 1fr 40px; }
}

/* ---------------- 登录组件（重写样式时漏掉的，补回来） ---------------- */
.who { display: inline-flex; align-items: center; margin-left: 4px; }

.gh-btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: 999px;
  background: #2b241c; color: #f7f1e2; font-size: 12.5px; text-decoration: none;
  box-shadow: 0 1px 2px rgba(0,0,0,.18);
  transition: background .15s, transform .12s;
}
.gh-btn:hover { background: #3a3128; transform: translateY(-1px); }
.gh-btn svg { width: 15px; height: 15px; opacity: .95; }

.gh-user {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 6px 3px 4px; border-radius: 999px;
  background: rgba(255,255,255,.7); border: 1px solid rgba(180,152,110,.45);
  font-size: 12.5px; color: #5c4b33;
}
.gh-avatar, .gh-fallback {
  width: 22px; height: 22px; border-radius: 50%; display: block;
  object-fit: cover; background: #e7ddc9; flex: 0 0 auto;
}
.gh-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #8a7c67;
}
.gh-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gh-out {
  color: #a09480; text-decoration: none; font-size: 11.5px;
  padding: 2px 7px; border-radius: 999px;
}
.gh-out:hover { background: #f0e6d4; color: var(--accent); }

/* 兜底：任何意外的大图都不许撑破版面 */
img { max-width: 100%; height: auto; }

/* 侧栏摘要里的横向排列 */
.cal-head { display: flex; align-items: center; gap: 8px; }
.sheet-col { min-width: 0; }

/* ================= 古意：所有控件重做 ================= */
/* 侧栏：像一叠签条 */
.side-box {
  border-radius: 2px;
  border: 1px solid rgba(126, 100, 62, .5);
  background: linear-gradient(180deg, rgba(253,249,238,.82), rgba(248,241,226,.72));
  box-shadow: 0 1px 0 rgba(255,255,255,.8) inset, 0 2px 6px rgba(120,95,55,.10);
}
.side-box > summary {
  font-family: "LXGW WenKai Lite", "Kaiti SC", "KaiTi", serif;
  font-size: 14px; letter-spacing: 4px; color: #5c4a2e;
  border-left: 3px solid var(--accent);
  padding: 9px 12px 9px 10px;
}
.side-box > summary:hover { background: rgba(255,255,255,.5); }
.side-note, .cal-toggle { font-family: "Songti SC", "SimSun", serif; letter-spacing: 1px; }

/* 按钮：方角、细墨线、朱色悬停 */
.mini-btn, .turn, .home, .gh-btn, .cheer, .bookmark, .mode-switch, .save {
  border-radius: 2px;
  font-family: "LXGW WenKai Lite", "Kaiti SC", "KaiTi", serif;
  letter-spacing: 2px;
}
.mini-btn, .turn, .home {
  background: rgba(255,255,255,.5);
  border: 1px solid rgba(126,100,62,.55);
  color: #5c4a2e;
}
.mini-btn:hover, .turn:hover, .home:hover {
  background: var(--accent); border-color: var(--accent); color: #fbf4e2;
}
.save {
  background: var(--accent); border: 1px solid #7d2b1d; color: #fdf6e6;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
}
.save:hover { filter: brightness(1.06); }

/* 输入框：只有底线，像在纸上写 */
.mini, .note, .tracker input {
  border: none; border-bottom: 1px solid rgba(126,100,62,.45);
  border-radius: 0; background: transparent;
  font-family: "LXGW WenKai Lite", "Kaiti SC", "KaiTi", serif;
}
.mini:focus, .tracker input:focus { outline: none; border-bottom-color: var(--accent); }
.tracker input { text-align: center; }

/* 白话 / 文言：书签样式 */
.mode-switch { border-radius: 2px; border: 1px solid rgba(126,100,62,.5); }
.mode-switch button { border-radius: 0; letter-spacing: 2px; }
.mode-switch button.active { background: var(--accent); color: #fbf4e2; }

/* 心情：墨圈 */
.mood-row button {
  background: transparent; border: 1px solid transparent; border-radius: 50%;
  padding: 4px 6px; filter: grayscale(.75) opacity(.75);
}
.mood-row button:hover { filter: none; background: rgba(255,255,255,.55); }
.mood-row button.on {
  background: transparent; border-color: var(--accent);
  filter: none; box-shadow: 0 0 0 2px rgba(156,59,42,.18);
}

/* 日期：题签 */
#day-text {
  font-family: "LXGW WenKai Lite", "Kaiti SC", "KaiTi", serif;
  font-size: 21px; letter-spacing: 3px;
}
.weekday { font-family: "Kaiti SC", "KaiTi", serif; letter-spacing: 2px; }

/* 追踪器：竖排小条 */
.side .trackers { margin: 0; padding: 10px 12px 12px; gap: 12px; }
.side .tracker {
  grid-template-columns: 1fr auto;
  grid-template-areas: "name value" "bar bar";
  gap: 4px 8px;
}
.side .tracker .name { grid-area: name; font-family: "LXGW WenKai Lite","Kaiti SC",serif; font-size: 13px; letter-spacing: 1px; }
.side .tracker input { grid-area: value; width: 74px; }
.side .tracker .bar {
  grid-area: bar; height: 4px; background: rgba(126,100,62,.16);
  background-image: repeating-linear-gradient(90deg, rgba(126,100,62,.28) 0 1px, transparent 1px 10%);
}
.side .tracker .bar > i { background: var(--accent); opacity: .85; }
.side .tracker .pct { display: none; }

/* 日历：历书格子 */
.cal-day { border-radius: 0; font-family: "Songti SC", "SimSun", serif; }
.cal-day.written { background: rgba(156,59,42,.12); color: #7d2b1d; }
.cal-day.current { box-shadow: inset 0 0 0 1.5px var(--accent); }

/* 便签：宣纸小条 + 朱线 */
.sticky {
  border-radius: 0; background: #fdf8e4;
  border-left: 2px solid rgba(156,59,42,.5);
  box-shadow: 1px 2px 5px rgba(120,95,55,.12);
  transform: none;
}
.sticky:nth-child(even) { background: #fbf3dc; transform: none; }

/* 加油：印章式 */
.cheer { background: transparent; border: 1px solid rgba(126,100,62,.5); }
.cheer.on { background: var(--accent); border-color: var(--accent); color: #fdf6e6; }

/* 登录：墨块 */
.gh-btn { border-radius: 2px; background: #2b241c; letter-spacing: 2px; }
.gh-user { border-radius: 2px; border-color: rgba(126,100,62,.5); }
.gh-out { border-radius: 2px; }

/* 页码、标题 */
.page-no { letter-spacing: 6px; }
.bar .title { letter-spacing: 8px; }

/* ================= 纸张撕边（clip-path，稳妥） ================= */

.sheet-col {
  filter: drop-shadow(0 10px 22px rgba(94, 74, 44, .20))
          drop-shadow(0 2px 4px rgba(94, 74, 44, .10));
}
.sheet::after { border-radius: 0; }

/* ================= 默认字体：文楷 ================= */
.note {
  font-family: "LXGW WenKai Lite", "LXGW WenKai", "STKaiti", "Kaiti SC",
               "KaiTi", "KaiTi SC", serif;
  line-height: 34px;
}

/* ================= 题签字体（侧栏标题 / 站名） ================= */
.side-box > summary,
.bar .title,
#day-text {
  font-family: "ZCOOL XiaoWei", "LXGW WenKai Lite", "Kaiti SC", "KaiTi", serif;
}
.side-box > summary { font-size: 14.5px; letter-spacing: 5px; }
.bar .title { letter-spacing: 9px; }

/* 侧栏标题前的小朱点，像钤印 */
.side-box > summary::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); opacity: .85; flex: 0 0 auto;
}

/* 字体在稿纸正文与文言信笺上同时生效（放最后，覆盖 .classic-text 的默认声明） */
.note.font-song, .classic-text.font-song { font-family: "Songti SC", "SimSun", serif; }
.note.font-kai, .classic-text.font-kai { font-family: "Kaiti SC", "KaiTi", "STKaiti", serif; }
.note.font-hei, .classic-text.font-hei { font-family: "PingFang SC", "Microsoft YaHei", sans-serif; }
.note.font-mono, .classic-text.font-mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }
.note.font-hand, .classic-text.font-hand {
  font-family: "LXGW WenKai Lite", "LXGW WenKai", "STXingkai", "华文行楷",
               "Hanzipen SC", "手札体-简", "Hannotate SC", cursive;
}
.note.font-brush, .classic-text.font-brush {
  font-family: "Ma Shan Zheng", "STXingkai", "华文行楷", "Xingkai SC", cursive;
}

/* ================= 纸外的日期/心情条 ================= */
.day-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 0 0 10px;
  padding: 8px 12px;
  background: rgba(253,249,238,.72);
  border: 1px solid rgba(126,100,62,.35);
  border-left: 3px solid var(--accent);
}
.day-bar .day { display: flex; align-items: baseline; gap: 8px; }
.day-bar .mood-row { margin: 0 0 0 auto; }
.day-bar .mode-switch { margin: 0; }

/* 纸页不再放页码：页码在纸下方 */
.page-no { margin-top: 10px; }

/* ================= 文言纸：固定尺寸 + 绝对定位（去掉花哨特性） ================= */
.sheet.mode-classic {
  width: 620px;
  height: 930px;
  max-width: 92vw;
  margin: 0 auto;
  padding: 0;
  border: none;
  border-radius: 0;
  background: #f7f1e0;
  box-shadow: 0 12px 26px rgba(94,74,44,.20), 0 2px 6px rgba(94,74,44,.12);
  overflow: hidden;
  position: relative;
}
/* 纸页图片：铺满整张纸，加载失败时用 CSS 画的替身 */
.sheet .paper-img { display: none; }
.sheet.mode-classic .paper-img {
  display: block;
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: fill;
  z-index: 0;
  pointer-events: none;
}
.sheet .paper-img:not([src]) { display: none; }
.sheet.mode-classic > .note-wrap,
.sheet.mode-classic > .img-strip { position: relative; z-index: 1; }
.sheet.mode-classic .classic-box { z-index: 1; }

/* 图片加载失败时的替身：红框 + 竖栏 */
.sheet.mode-classic .paper-fallback:not([hidden]) {
  position: absolute; inset: 0; z-index: 0;
  background:
    repeating-linear-gradient(90deg, transparent 0 55px, rgba(156,59,42,.35) 55px 56px),
    linear-gradient(180deg, #fbf5e4, #f2e8d0);
  box-shadow: inset 0 0 0 2px rgba(156,59,42,.55), inset 0 0 0 8px #fbf5e4,
              inset 0 0 0 9px rgba(156,59,42,.45);
}

.sheet.mode-classic .note-wrap,
.sheet.mode-classic .img-strip { display: none; }

.sheet.mode-classic .classic-box {
  position: absolute;
  top: 12.5%;
  right: calc(11.25% + var(--pitch, 47.7px));
  bottom: 12.5%; left: 11%;
  margin: 0; padding: 0; background: none; border: none;
  display: flex; justify-content: flex-end;
}
.sheet.mode-classic .classic-text {
  writing-mode: vertical-rl;
  text-orientation: upright;
  line-height: var(--pitch, 47.7px);
  font-size: calc(var(--pitch, 47.7px) * 0.66);
  height: 100%; margin: 0; overflow: hidden;
  letter-spacing: 0;
  padding-left: calc(var(--pitch, 47.7px) * 0.5);
}

/* 白话模式：图片区正常显示 */
.sheet:not(.mode-classic) .img-strip { display: flex; }

/* 纸面题签：干支农历 + 天气，竖排在最右列，和正文同一支笔 */
.almanac {
  position: absolute;
  top: 12.5%;
  right: 11.25%;
  height: 58%;
  margin: 0; padding: 0;
  writing-mode: vertical-rl;
  text-orientation: upright;
  font-family: "Ma Shan Zheng", "STXingkai", "华文行楷", "Xingkai SC", cursive;
  font-size: calc(var(--pitch, 47.7px) * 0.52);
  line-height: var(--pitch, 47.7px);
  letter-spacing: .18em;
  color: rgba(140, 62, 42, .82);
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}
.sheet:not(.mode-classic) .almanac { display: none; }

/* ================= 印章 ================= */
.stamp-layer {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
}
.sheet:not(.mode-classic) .stamp-layer { display: none; }

.stamp {
  position: absolute;
  width: 84px; height: auto;
  transform-origin: center center;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: move;
  opacity: .92;
  filter: saturate(1.15) contrast(1.05);
  user-select: none;
  -webkit-user-drag: none;
}
.stamp.sel { outline: 1px dashed rgba(156,59,42,.8); outline-offset: 4px; }

.seal-body { padding: 10px 12px; display: grid; gap: 8px; }
.seal-list { display: flex; gap: 8px; flex-wrap: wrap; }
.seal-thumb {
  width: 46px; height: 46px; border: 1px solid rgba(126,100,62,.4);
  background: rgba(255,255,255,.6); cursor: pointer; padding: 2px;
  display: flex; align-items: center; justify-content: center;
}
.seal-thumb img { max-width: 100%; max-height: 100%; display: block; }
.seal-thumb.on { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(156,59,42,.18); }
.seal-tools { display: flex; gap: 4px; flex-wrap: wrap; }
.seal-tools .mini-btn { padding: 4px 8px; font-size: 12px; }
.seal-hint { margin: 0; font-size: 11.5px; color: #a89a84; line-height: 1.7; }

/* 印章：拖动更顺 + 删除按钮 */
.stamp {
  will-change: left, top;
  touch-action: none;
  transition: none;
}
.stamp.dragging { cursor: grabbing; opacity: .85; }
.seal-thumb { position: relative; }
.seal-del {
  position: absolute; top: -6px; right: -6px;
  width: 16px; height: 16px; border-radius: 50%;
  border: none; background: rgba(60,45,30,.75); color: #fff;
  font-size: 11px; line-height: 1; cursor: pointer; padding: 0;
  opacity: 0; transition: opacity .12s;
}
.seal-thumb:hover .seal-del { opacity: 1; }

/* 印章大小滑块 */
#seal-size { width: 100%; accent-color: var(--accent); margin-top: 2px; }

/* ================= 文言续页 ================= */
.classic-extra { display: grid; gap: 18px; margin-top: 18px; }
.sheet.mode-classic.extra-sheet {
  width: 620px; height: 930px; max-width: 92vw;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  background: #f7f1e0;
}
.sheet.mode-classic.extra-sheet .paper-img {
  display: block; position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: fill;
  z-index: 0; pointer-events: none;
}
.sheet.mode-classic.extra-sheet .classic-box {
  position: absolute;
  top: 12.5%; right: 11.25%; bottom: 12.5%; left: 11%;
  display: flex; justify-content: flex-end;
}
.sheet.mode-classic.extra-sheet .classic-text {
  writing-mode: vertical-rl;
  text-orientation: upright;
  line-height: var(--pitch, 47.7px);
  font-size: calc(var(--pitch, 47.7px) * 0.66);
  height: 100%; margin: 0; overflow: hidden;
  padding-left: calc(var(--pitch, 47.7px) * 0.5);
  font-family: "Ma Shan Zheng", "STXingkai", "华文行楷", cursive;
  color: #241f18;
}

/* ================= 手写抖动 ================= */
.classic-text .glyph {
  display: inline-block;
  transform: rotate(var(--r, 0deg)) translate(var(--dx, 0px), var(--dy, 0px))
             scale(var(--s, 1));
  transform-origin: center center;
  color: var(--c, #241f18);
  will-change: transform;
}
.classic-text .nl { display: block; height: 0; }

/* ================= 墨吃进纸里 ================= */
.sheet.mode-classic .classic-text,
.sheet.mode-classic .almanac {
  mix-blend-mode: multiply;      /* 文字与纸纹相乘，墨色变"透" */
}
.sheet.mode-classic .classic-text { isolation: auto; }

/* 5% 的字下笔更重 / 更轻，模拟运笔顿挫 */
.classic-text .glyph.w-heavy {
  -webkit-text-stroke: 0.22px currentColor;
  filter: contrast(1.05);
}
.classic-text .glyph.w-light {
  opacity: .78;
  filter: blur(0.25px);
}

/* 今日收支（与账本联动） */
.day-money {
  margin-top: 8px; padding-top: 8px;
  border-top: 1px dashed rgba(150,116,66,.3);
  font-size: 12px; color: #7d6a4c;
  display: flex; gap: 12px; flex-wrap: wrap; align-items: baseline;
}
.day-money b { font-weight: 600; color: var(--accent, #9c3b2a); font-variant-numeric: tabular-nums; }
.day-money .in { color: #4a6b4f; }
.day-money a { color: #9a8b74; text-decoration: none; border-bottom: 1px dashed currentColor; }
