/* ============================================================
   同生的手账本 · 前台样式（由原手账页 index.html 迁移而来）
   ============================================================ */
*{margin:0;padding:0;box-sizing:border-box}
body{background:#faf3e3;color:#5a4632;font-family:"KaiTi","STKaiti","Kaiti SC","PingFang SC",cursive;line-height:1.9}
.wrap{max-width:760px;margin:0 auto;padding:0 24px}
a{color:inherit}

/* ---- 页头 ---- */
header{text-align:center;padding:56px 0 18px;position:relative}
.washi{position:absolute;top:36px;left:50%;width:180px;height:26px;transform:translateX(-50%) rotate(-2deg);background:repeating-linear-gradient(45deg,#f0c8d0 0 14px,#e8b4c4 14px 20px);opacity:.7}
.site-name{font-size:32px;letter-spacing:8px;font-weight:bold}
.site-sub{font-size:13px;color:#a08a6b;letter-spacing:3px;margin-top:8px}
nav{margin-top:26px;display:flex;justify-content:center;gap:20px;flex-wrap:wrap}
nav a{color:#8a7355;text-decoration:none;font-size:14px;letter-spacing:2px;padding:4px 12px;border-bottom:2px dashed #d9c8a8;transition:.2s}
nav a:hover{color:#d1662f}
.sticky{position:absolute;right:6px;top:70px;background:#fff9c4;box-shadow:2px 4px 8px rgba(90,70,50,.18);padding:14px 16px;transform:rotate(6deg);transform-origin:50% 0;font-size:13px;width:130px;z-index:3}
.sticky:before{content:'';position:absolute;top:-8px;left:20px;width:70px;height:18px;background:rgba(255,255,255,.55)}
.sticky b{color:#d1662f}
/* 登录便签：贴在页头左侧，与右侧黄便签对称 */
.sticky-login{position:absolute;left:24px;top:58px;background:#ddf0e3;box-shadow:2px 4px 8px rgba(90,70,50,.18);padding:20px 24px;transform:rotate(-5deg);transform-origin:50% 0;font-size:17px;width:225px;min-height:170px;box-sizing:border-box;z-index:3}
/* 登录后：便签保持同样大小，问候语在签面居中，不因内容变少而缩小 */
.sticky-login.greet-on{display:flex;flex-direction:column;justify-content:center}
.sticky-login.greet-on .login-greet{margin-top:0;line-height:1.9}
.sticky-login.greet-on .logout-icon{bottom:auto;top:8px}
.sticky-login:before{content:'';position:absolute;top:-10px;left:28px;width:104px;height:24px;background:rgba(255,255,255,.55)}
.sticky-login b{color:#3f7d5c}
.sticky-login form{display:flex;flex-direction:column;gap:10px;margin-top:10px}
.sticky-login [hidden]{display:none !important} /* display:flex/等会压过 hidden 属性，这里强制生效 */
.sticky-login input{width:100%;border:none;border-bottom:2px dashed #9fc7ad;background:transparent;font-family:inherit;font-size:16px;color:#5a4632;padding:3px 2px 6px;outline:none}
.sticky-login input::placeholder{color:#8fb49c}
.sticky-login input:focus{border-bottom-color:#3f7d5c}
.sticky-login button{border:none;background:#aedcb9;color:#2f5c42;font-family:inherit;font-size:14px;font-weight:bold;border-radius:999px;padding:6px 14px;cursor:pointer;align-self:flex-end;transition:.2s}
.sticky-login button:hover{background:#9cd2ab}
.sticky-login .login-greet{margin-top:6px;color:#35664a}
.sticky-login .login-greet .rename{border:none;background:none;color:#5f8f74;font-family:inherit;font-size:13px;cursor:pointer;text-decoration:underline dashed;padding:0;margin-left:4px}
/* 退出：轻量小图标，便签右下角小邮戳，悬停才显色 */
.sticky-login .login-greet .logout-icon{position:absolute;right:9px;bottom:8px;border:none;background:none;color:#9cc4aa;font-family:inherit;cursor:pointer;padding:3px;line-height:0;border-radius:50%;transition:.2s}
.sticky-login .login-greet .logout-icon:hover{color:#3f7d5c;background:rgba(174,220,185,.45);transform:rotate(-10deg) scale(1.15)}
/* 音乐播放时，两张便签像被风吹着轻轻摇摆（节奏错开，不机械同步） */
@keyframes note-sway{
  0%,100%{transform:rotate(var(--sway-base,0deg)) translateY(0)}
  30%{transform:rotate(calc(var(--sway-base,0deg) + 1.8deg)) translateY(-1.2px)}
  65%{transform:rotate(calc(var(--sway-base,0deg) - 1.3deg)) translateY(.6px)}
}
body.music-on .sticky-login{--sway-base:-5deg;animation:note-sway 3.8s ease-in-out infinite}
body.music-on .sticky{--sway-base:6deg;animation:note-sway 4.7s ease-in-out -1.3s infinite}
@media (prefers-reduced-motion:reduce){body.music-on .sticky-login,body.music-on .sticky{animation:none}}
.sticky-login .login-msg{color:#3f7d5c;font-size:13px;line-height:1.5;margin-top:4px}

/* ---- 双便签登录弹层：注册 / 登录 两张彩签叠放，点击翻页切换 ---- */
.auth-overlay{position:fixed;inset:0;z-index:60;display:flex;align-items:center;justify-content:center;background:rgba(74,58,40,.4);backdrop-filter:blur(3px);-webkit-backdrop-filter:blur(3px);animation:auth-fade .2s ease-out}
@keyframes auth-fade{from{opacity:0}to{opacity:1}}
.auth-overlay[hidden]{display:none}
.auth-cards{position:relative;width:min(520px,92vw);height:360px;perspective:1200px}
/* 关闭按钮：一枚钉子，钉在两签左上角的重合点上，把整叠签钉住 */
.auth-close{position:absolute;top:15px;left:calc(50% - 136px);z-index:3;width:22px;height:22px;border:none;border-radius:50%;background:rgba(255,255,255,.55);color:#b3a184;font-size:11px;line-height:22px;padding:0;cursor:pointer;transition:.2s}
.auth-close:hover{background:#f4b8c8;color:#7a3b4e}

.auth-note{position:absolute;top:26px;width:250px;padding:20px 20px 16px;background:#fdf1d8;box-shadow:3px 5px 12px rgba(74,58,40,.28);transform-origin:0 0;cursor:pointer;transition:transform .35s ease,filter .35s ease,box-shadow .35s ease}
.auth-note .auth-tape{position:absolute;top:-10px;left:50%;width:76px;height:20px;margin-left:-38px;background:rgba(255,255,255,.6);transform:rotate(-4deg)}
.auth-note h3{margin:0 0 6px;font-size:17px;letter-spacing:2px;color:#8a5a2e}
.auth-note .auth-sub{margin:0 0 12px;font-size:11.5px;line-height:1.7;color:#b39a77}
.auth-note form{display:flex;flex-direction:column;gap:9px}
.auth-note input{width:100%;border:none;border-bottom:1.5px dashed #d9c8a8;background:rgba(255,255,255,.45);font-family:inherit;font-size:13px;color:#5a4632;padding:5px 6px;outline:none;box-sizing:border-box}
.auth-note input:focus{border-bottom-color:#d1662f}
.auth-note button{border:none;background:#e9b949;color:#6b4a12;font-family:inherit;font-size:12.5px;font-weight:bold;border-radius:999px;padding:6px 12px;cursor:pointer;align-self:flex-end;transition:.2s}
.auth-note button:hover{filter:brightness(1.06)}
.auth-note .auth-msg{min-height:16px;margin:8px 0 0;font-size:11.5px;line-height:1.5;color:#c2557b}
/* 注册签：薄荷绿，默认在前（居中，微左倾） */
.note-register{left:50%;margin-left:-125px;background:#dff0dc}
.note-register h3{color:#4a6b45}
.note-register input{border-bottom-color:#a8c4a2}
.note-register input:focus{border-bottom-color:#5a8a52}
.note-register button{background:#9ed094;color:#2f5229}
/* 登录签：樱粉，默认垫在后面（同位置，只露出右上角） */
.note-login{left:50%;margin-left:-125px;background:#ffe3ec}
.note-login h3{color:#b0557a}
.note-login input{border-bottom-color:#d9a8b8}
.note-login input:focus{border-bottom-color:#c2557b}
.note-login button{background:#f4b8c8;color:#7a3b4e}

/* 前/后状态：两签左上角重合于一点（transform-origin:0 0），后签绕这个角扇形展开，沿顶边向右上露出 */
.auth-note.is-front{z-index:2;cursor:default;box-shadow:5px 8px 18px rgba(74,58,40,.34)}
.note-register.is-front{transform:rotate(-2deg)}
.note-login.is-front{transform:rotate(2deg)}
.auth-note.is-back{z-index:1;filter:brightness(.95) saturate(.9);top:6px} /* 后签上移：从上面露出签头，别坠在下面 */
.note-register.is-back,.note-login.is-back{transform:rotate(-9deg)}
/* 翻页动画：被点到的签绕重合角「掀起来」翻到前位（起止与前后态 transform 对齐，无跳变） */
.auth-note.flip-in{animation:flip-to-front .45s ease}
@keyframes flip-to-front{
  0%{filter:brightness(.95) saturate(.9)}
}
.note-register.flip-in{animation-name:flip-to-front-reg}
.note-login.flip-in{animation-name:flip-to-front-login}
@keyframes flip-to-front-reg{
  0%{transform:rotate(-9deg);filter:brightness(.95)}
  45%{transform:rotate(-15deg);filter:brightness(1.03)}
  100%{transform:rotate(-2deg)}
}
@keyframes flip-to-front-login{
  0%{transform:rotate(-9deg);filter:brightness(.95)}
  45%{transform:rotate(-15deg);filter:brightness(1.03)}
  100%{transform:rotate(2deg)}
}
@media (max-width:560px){
  .auth-cards{height:400px}
  .auth-note{width:min(300px,86vw);margin-left:calc(min(300px,86vw)/-2)}
  .auth-close{left:calc(50% - min(300px,86vw)/2 - 11px)}
}

/* ---- 首屏 ---- */
.hero{padding:40px 0 16px;text-align:center}
.hero .b{font-size:clamp(24px,4.5vw,34px);letter-spacing:3px}
.hero .s{color:#a08a6b;font-size:14px;margin-top:12px}

/* ---- 文章卡片 ---- */
.posts{padding:14px 0 36px}
.note{display:block;background:#fffdf4;border:1px solid #eadcc0;padding:26px 26px 22px;margin-bottom:24px;box-shadow:2px 3px 0 rgba(90,70,50,.12);position:relative;transition:.25s;text-decoration:none;color:inherit}
.note:nth-child(even){transform:rotate(1deg)}
.note:nth-child(odd){transform:rotate(-.8deg)}
.note:hover{transform:rotate(0) translateY(-4px);border-color:#d1662f}
.note .date{font-size:12px;color:#b39a77;letter-spacing:1px}
.note h3{font-size:20px;margin:10px 0 10px;letter-spacing:1px}
.note .content-pre{font-size:14.5px;color:#7a6244;line-height:2}
.note .tag{display:inline-block;margin-top:12px;font-size:12px;color:#d1662f;border:1px dashed #d1662f;padding:2px 12px;border-radius:999px}
.note .tape2{position:absolute;top:-12px;left:38%;width:90px;height:22px;background:rgba(245,235,205,.8);transform:rotate(-3deg)}
.empty{text-align:center;color:#b39a77;padding:30px 0;font-size:15px}

/* ---- 文章浏览工具栏（随机挑选 + 每页篇数） ---- */
.posts-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;margin:6px 0 22px;padding:10px 14px;background:#fffdf4;border:1px dashed #d8c9ae;border-radius:10px;font-size:13.5px;color:#7a6244}
.posts-toolbar strong{color:#d1662f}
.posts-actions{display:flex;align-items:center;gap:10px}
.size-form{display:flex;align-items:center;gap:6px}
.size-form select{font-family:inherit;font-size:13.5px;padding:4px 6px;border:1px solid #d8c9ae;border-radius:6px;background:#fff;color:#5b5142;cursor:pointer}
.shuffle-btn{font-family:inherit;font-size:13.5px;padding:5px 14px;border:1px solid #d8c9ae;border-radius:999px;background:#f6ecd9;color:#8a6d3b;cursor:pointer;transition:.2s}
.shuffle-btn:hover{background:#e9d9b8;border-color:#d1662f;color:#d1662f}

/* ---- 留言便利贴 ---- */
.wishes{display:flex;gap:16px;flex-wrap:wrap;padding:8px 0 40px;justify-content:center}
.card{background:#fff9c4;width:180px;padding:20px;transform:rotate(var(--r,0deg));box-shadow:2px 4px 10px rgba(90,70,50,.15);position:relative}
.card:nth-child(1){--r:-3deg;background:#fff3b0}
.card:nth-child(2){--r:2deg;background:#ffe0ec}
.card:nth-child(3){--r:-1deg;background:#d6f5d6}
.card p{font-size:14px;line-height:1.9;color:#6b5638}
.card .who{font-size:12px;color:#b39a77;margin-top:10px;text-align:right}

/* ---- 投稿表单 ---- */
.guest{text-align:center;background:#fffdf4;border:1px dashed #d9c8a8;padding:24px;margin-bottom:44px}
.guest .t{font-size:16px;letter-spacing:3px}
.guest>p{color:#a08a6b;font-size:13px;margin-top:8px}
.guest form{max-width:520px;margin:20px auto 0;text-align:left}
.guest .field{margin-bottom:16px}
.guest label{display:block;font-size:13px;color:#8a7355;letter-spacing:2px;margin-bottom:6px}
.guest input[type=text],
.guest textarea,
.guest select{
  width:100%;padding:10px 14px;font-size:15px;color:#5a4632;background:#fffdf6;
  border:1px solid #eadcc0;border-radius:4px;font-family:inherit;line-height:1.8;
  transition:.2s;
}
.guest input[type=text]:focus,
.guest textarea:focus,
.guest select:focus{outline:none;border-color:#d1662f;box-shadow:0 0 0 3px rgba(209,102,47,.15)}
.guest textarea{resize:vertical;min-height:130px}
.guest button{
  margin-top:6px;padding:10px 34px;font-size:15px;letter-spacing:2px;color:#fff;
  background:#d1662f;border:1px solid #c05a26;border-radius:999px;cursor:pointer;font-family:inherit;
  box-shadow:0 3px 0 #a3481f;transition:.15s;
}
.guest button:hover{transform:translateY(2px);box-shadow:0 1px 0 #a3481f}
.flash-ok{margin-top:16px;color:#3f7f3d;background:#e8f5e6;border:1px dashed #9bc48f;padding:10px 16px;border-radius:6px}
.flash-err{margin-top:16px;color:#a3482e;background:#fbe9e4;border:1px dashed #e0a89a;padding:10px 16px;border-radius:6px}
.guest .track-entry{display:inline-block;margin-top:14px;font-size:13px;color:#8a7355;letter-spacing:1px;border-bottom:1px dashed #c9b28c;padding-bottom:2px}
.guest .track-entry:hover{color:#d1662f;border-bottom-color:#d1662f}

/* ---- 文章详情 ---- */
.detail{background:#fffdf4;border:1px solid #eadcc0;padding:36px 32px;margin:10px 0 20px;box-shadow:2px 3px 0 rgba(90,70,50,.12);position:relative}
.detail .date{font-size:12px;color:#b39a77;letter-spacing:1px}
.detail h1{font-size:26px;margin:14px 0 8px;letter-spacing:1px;line-height:1.5}
.detail .meta{display:flex;gap:14px;font-size:13px;color:#a08a6b;margin-bottom:22px}
.detail .body{font-size:16px;line-height:2.2;color:#5a4632;border-top:1px dashed #eadcc0;padding-top:22px}
.back{text-align:center;padding:6px 0 26px}
.back a{color:#8a7355;text-decoration:none;font-size:14px;letter-spacing:2px}
.back a:hover{color:#d1662f}
.content-pre{white-space:pre-wrap;word-break:break-word}

footer{text-align:center;padding:10px 0 54px;color:#b39a77;font-size:12px;letter-spacing:3px}

/* ---- Markdown 渲染内容 ---- */
.markdown-body h1,.markdown-body h2,.markdown-body h3,
.markdown-body h4,.markdown-body h5,.markdown-body h6{margin:1.2em 0 .6em;line-height:1.6;font-weight:bold;color:#4a3826}
.markdown-body h1{font-size:22px}.markdown-body h2{font-size:20px}.markdown-body h3{font-size:18px}
.markdown-body h4,.markdown-body h5,.markdown-body h6{font-size:16px}
.markdown-body p{margin:.6em 0}
.markdown-body ul,.markdown-body ol{margin:.6em 0 .6em 1.6em;padding:0}
.markdown-body ul{list-style:disc}.markdown-body ol{list-style:decimal}
.markdown-body li{margin:.2em 0}
.markdown-body blockquote{margin:1em 0;padding:.3em 1em;border-left:3px solid #d9c8a8;color:#8a7355;background:#fdf8ec}
.markdown-body pre{background:#f5f2e9;border:1px solid #eadcc0;border-radius:6px;padding:12px 14px;overflow-x:auto;line-height:1.6;margin:1em 0}
.markdown-body code{font-family:"Consolas","JetBrains Mono","Courier New",monospace;font-size:13.5px;background:rgba(90,70,50,.07);padding:2px 6px;border-radius:4px}
.markdown-body pre code{background:none;padding:0}
.markdown-body table{border-collapse:collapse;margin:1em 0;width:100%}
.markdown-body th,.markdown-body td{border:1px solid #e3d3b4;padding:8px 12px;font-size:14.5px}
.markdown-body th{background:#faf0da;font-weight:bold}
.markdown-body img{max-width:100%;border-radius:6px}
.markdown-body a{color:#d1662f;text-decoration:underline}
.markdown-body hr{border:none;border-top:1px dashed #d9c8a8;margin:1.6em 0}
.markdown-body .task-list-item{list-style:none}
.markdown-body .task-list-item input{margin-right:8px}

/* ---- 卡片摘要 + 阅读量 ---- */
.note .excerpt{font-size:14.5px;color:#7a6244;line-height:2;word-break:break-word;
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.note .views{display:inline-flex;align-items:center;gap:4px;margin-top:12px;margin-left:10px;font-size:12px;color:#b39a77}
.detail .meta .views{color:#b39a77}
.views-icon{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none}

/* ---- 首页背景音乐 ---- */
.music-toggle{
  position:fixed;right:18px;bottom:16px;z-index:20;
  display:grid;place-items:center;width:38px;height:38px;
  border:0;background:#fff3b0;color:#8a6d3b;transform:rotate(6deg);
  box-shadow:2px 3px 7px rgba(90,70,50,.2);font:inherit;cursor:pointer;
}
.music-toggle[hidden]{display:none}
.music-toggle::before{
  content:'';position:absolute;top:-5px;left:8px;width:22px;height:10px;
  background:rgba(255,255,255,.55);transform:rotate(-5deg);
}
.music-toggle-icon{position:relative;line-height:1;font-size:15px;font-weight:bold}
.music-toggle:hover,.music-toggle:focus-visible{background:#ffe998;color:#765724}

/* 播放中轻柔摆动：围绕 6° 基线 ±3° 游走并带轻微浮沉，像随音乐飘动 */
.music-toggle.music-playing{
  animation:music-float 3.4s ease-in-out infinite;
}
@keyframes music-float{
  0%  {transform:rotate(6deg) translate(0,0)}
  15% {transform:rotate(9deg) translate(1px,0)}
  40% {transform:rotate(5deg) translate(.5px,-1px)}
  65% {transform:rotate(3deg) translate(-1px,0)}
  85% {transform:rotate(7.5deg) translate(-.5px,-1px)}
  100%{transform:rotate(6deg) translate(0,0)}
}
@media (prefers-reduced-motion:reduce){
  .music-toggle.music-playing{animation:none}
}

@media (max-width:640px){
  .sticky,.sticky-login{display:none}
  .music-toggle{right:12px;bottom:12px;width:44px;height:44px}
}

/* Journal UI: monochrome ink strokes inherit the surrounding text and hover color. */
.ink-icon{display:inline-block;width:1.15em;height:1.15em;vertical-align:-.18em;fill:none;stroke:currentColor;stroke-width:1.65;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
.shuffle-btn .ink-icon,.track-entry .ink-icon,.guest .t .ink-icon,.track-title .ink-icon{margin-right:.25em}
.sticky .ink-icon{width:1em;height:1em}

/* 登录后昵称锁定态 */
.guest input.locked{background:#faf5ea;color:#a08a6b;cursor:not-allowed}
.guest input.locked:focus{outline:none;border-color:#eadcc0;box-shadow:none}
.guest .locked-hint{margin:6px 0 0;font-size:11.5px;color:#b39a77;letter-spacing:.5px}
