/* 妙遇 · 沿用日记站的苹果风 + 玫瑰色,锁屏用宋体竖排 */
:root {
  --bg: #f7f4f2; --card: #ffffff; --text: #1d1a19; --text2: #6f6662; --line: rgba(60,40,30,.10);
  --inset: rgba(118,108,100,.12); --accent: #e0314f; --accent-bg: #d92b49; --tint: rgba(224,49,79,.10);
  --seal: #c23a2b; --seal-ink: #fff8f4; --err: #d70015; --ok: #248a3d;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "Noto Serif CJK SC", serif;
  --sans: -apple-system, "SF Pro Text", "PingFang SC", "HarmonyOS Sans SC", "MiSans", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121011; --card: #1d1a1b; --text: #efe9e5; --text2: #9c938f; --line: rgba(255,240,230,.10);
    --inset: rgba(160,150,145,.16); --accent: #ff5773; --accent-bg: #c9304b; --tint: rgba(255,87,115,.16);
    --seal: #d4513f; --seal-ink: #1a1213; --err: #ff453a; --ok: #30d158;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
       -webkit-text-size-adjust: 100%; min-height: 100vh; min-height: 100dvh; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .45; cursor: default; }
input, textarea { font: inherit; font-size: 16px; color: var(--text); }

.view { max-width: 560px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) 16px calc(40px + env(safe-area-inset-bottom)); }
.view.narrow { max-width: 420px; padding-top: calc(8vh + env(safe-area-inset-top)); }

/* ---------- 诗句 ---------- */
.poem { display: flex; flex-direction: row-reverse; justify-content: center; gap: 22px; font-family: var(--serif); }
.poem .ln { writing-mode: vertical-rl; margin: 0; font-size: clamp(28px, 7.4vw, 40px); letter-spacing: .42em; line-height: 1; }
.poem .a { opacity: 0; transition: opacity 1.4s ease .25s; }
.poem.answered .a { opacity: 1; }
/* 开门那一刻:键盘和圆点退下,只留诗句 */
#v-lock.revealing .dots, #v-lock.revealing .padmsg, #v-lock.revealing .pad, #v-lock.revealing .lockfoot { display: none; }
#v-lock.revealing .poem { margin-bottom: 0; }
#v-lock.revealing { cursor: pointer; }
.poem.small .ln { font-size: 26px; }
.poem.small { margin: 0 0 26px; }

#v-lock { display: flex; flex-direction: column; align-items: center; justify-content: center;
          min-height: 100vh; min-height: 100dvh; padding: calc(12px + env(safe-area-inset-top)) 16px calc(12px + env(safe-area-inset-bottom)); }
#v-lock .poem { margin-bottom: 3dvh; }
#v-lock .poem .ln { font-size: min(7.4vw, 4.4dvh, 40px); }

/* ---------- 暗号键盘 ---------- */
.dots { display: flex; gap: 14px; justify-content: center; height: 14px; margin: 4px 0 10px; }
.dots i { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--text2); display: block; transition: background .12s; }
.dots i.on { background: var(--text); border-color: var(--text); }
.dots.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.padmsg { min-height: 20px; margin: 0 0 8px; text-align: center; font-size: 13px; color: var(--err); }
.pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 14px 24px; justify-content: center; }
.pad button { width: 72px; height: 72px; border-radius: 50%; border: none; background: var(--inset);
              font-size: 28px; font-weight: 400; font-family: var(--sans); touch-action: manipulation; }
.pad button:active { background: var(--text2); color: var(--bg); }
.pad button.fn { background: transparent; font-size: 15px; color: var(--text2); }
.pad.busy { opacity: .5; pointer-events: none; }
.lockfoot { display: flex; gap: 22px; justify-content: center; margin-top: 18px; }
.link { background: none; border: none; color: var(--text2); font-size: 14px; padding: 8px 6px; }

/* ---------- 通用 ---------- */
.card { background: var(--card); border-radius: 16px; padding: 16px; margin-bottom: 12px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.row input { flex: 1; }
input[type=password], input[type=text], textarea {
  width: 100%; border: none; outline: none; background: var(--inset); border-radius: 10px; padding: 11px 12px; }
textarea { display: block; min-height: 42vh; line-height: 1.9; resize: none; font-family: var(--serif); }
input::placeholder, textarea::placeholder { color: var(--text2); }
.lbl { font-size: 13px; color: var(--text2); margin: 2px 2px -4px; }
.primary { background: var(--accent-bg); color: #fff; border: none; font-weight: 600; padding: 10px 22px;
           border-radius: 999px; font-size: 15px; min-height: 44px; }
.ghost { background: var(--inset); border: none; padding: 10px 18px; border-radius: 999px; font-size: 15px; min-height: 44px; }
.primary:active, .ghost:active { transform: scale(.97); }
.wide { width: 100%; min-height: 46px; font-size: 16px; }
.err { color: var(--err); font-size: 13px; margin: 0; min-height: 0; }
.err:empty { display: none; }
.center { text-align: center; }
.hint { color: var(--text2); font-size: 13px; line-height: 1.8; margin: 14px 4px; }
.small2 { color: var(--text2); font-size: 12px; line-height: 1.7; margin: 0; }
.links { text-align: center; margin-top: 6px; }
.ttl { font-size: 22px; font-weight: 700; margin: 0 4px 16px; }
.big { font-size: 17px; font-weight: 600; margin: 0 0 6px; }
.hello { font-size: 15px; margin: 0; }
.sect { font-size: 13px; color: var(--text2); font-weight: 500; margin: 22px 6px 8px; }

/* ---------- 顶栏 ---------- */
.bar { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; min-height: 40px; }
.seal { writing-mode: vertical-rl; font-family: var(--serif); font-size: 12px; letter-spacing: .15em; line-height: 1;
        padding: 6px 4px 4px; background: var(--seal); color: var(--seal-ink); border-radius: 4px; }
.who { color: var(--text2); font-size: 13px; flex: 1; margin-left: 6px; }
.grow { flex: 1; }
.ttl2 { text-align: center; font-size: 15px; font-weight: 600; }
.iconbtn { background: var(--inset); border: none; border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 600; min-height: 36px; }
.iconbtn.strong { background: var(--tint); color: var(--accent); }

/* ---------- 列表 ---------- */
.actions { display: flex; gap: 10px; margin: 4px 0 16px; }
.actions.stick { position: sticky; bottom: calc(10px + env(safe-area-inset-bottom)); margin-top: 18px; }
.list { display: flex; flex-direction: column; gap: 10px; }
.item { display: block; width: 100%; text-align: left; background: var(--card); border: none; border-radius: 16px; padding: 14px 16px; }
.item .meta { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--text2); }
.item .meta .by { color: var(--text); font-weight: 600; }
.item .meta .st { margin-left: auto; }
.item .env { font-family: var(--serif); font-size: 17px; margin: 8px 0 0; line-height: 1.6; word-break: break-word; }
.item .env.dim { color: var(--text2); font-size: 15px; }
.item.new { box-shadow: inset 0 0 0 1.5px var(--accent); }
.badge { display: inline-block; background: var(--accent-bg); color: #fff; border-radius: 999px; font-size: 11px; font-weight: 700;
         padding: 2px 8px; margin-left: 6px; vertical-align: 1px; }
.item .sub { display: flex; gap: 12px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--text2); }
.item .undo { margin-left: auto; background: none; border: none; color: var(--accent); font-size: 13px; padding: 2px 0; }
.empty { text-align: center; color: var(--text2); padding: 50px 0; font-size: 14px; line-height: 1.9; }

.banner { background: var(--tint); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; font-size: 13px; line-height: 1.7;
          display: flex; gap: 10px; align-items: flex-start; }
.banner p { margin: 0; flex: 1; }
.banner button { background: none; border: none; color: var(--accent); font-weight: 600; font-size: 13px; padding: 0 2px; white-space: nowrap; }

/* ---------- 信 ---------- */
.content { transition: filter .4s ease; }
.letter { background: var(--card); border-radius: 16px; padding: 18px 18px 16px; margin-bottom: 12px; }
.letter .meta { font-size: 13px; color: var(--text2); display: flex; gap: 8px; align-items: baseline; }
.letter .meta .by { color: var(--text); font-weight: 600; }
.letter .env { font-family: var(--serif); font-size: 18px; margin: 10px 0 4px; }
.letter .body { font-family: var(--serif); font-size: 17px; line-height: 2; white-space: pre-wrap; word-break: break-word; margin-top: 10px; }
.letter .body.gone { color: var(--text2); font-size: 15px; }
.letter .acts { display: flex; gap: 14px; justify-content: flex-end; margin-top: 10px; }
.letter .acts button { background: none; border: none; font-size: 13px; color: var(--text2); padding: 4px 0; }
.letter .acts .danger { color: var(--err); }
.ctx { background: var(--inset); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; font-size: 13px; color: var(--text2);
       display: flex; gap: 10px; align-items: center; }
.ctx p { margin: 0; flex: 1; }
.ctx button { background: none; border: none; color: var(--accent); font-weight: 600; font-size: 13px; }
.endmark { height: 1px; }
.readnote { text-align: center; color: var(--text2); font-size: 12px; margin: 6px 0 0; min-height: 18px; }

/* 空闲柔焦:点一下恢复 */
body.soft .content, body.soft #c-body, body.soft #c-env { filter: blur(12px); }
body.soft::after { content: "点一下继续"; position: fixed; left: 50%; top: 45%; transform: translateX(-50%);
  background: var(--card); color: var(--text2); padding: 8px 16px; border-radius: 999px; font-size: 13px; z-index: 5;
  box-shadow: 0 4px 20px rgba(0,0,0,.12); pointer-events: none; }

.crow { display: flex; justify-content: space-between; min-height: 18px; }

/* ---------- 设置 ---------- */
.rowbtn { background: var(--inset); border: none; border-radius: 12px; padding: 12px; text-align: left; font-size: 15px; }
.dev { display: flex; justify-content: space-between; font-size: 14px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.dev:last-child { border-bottom: none; }
.dev span:last-child { color: var(--text2); font-size: 12px; }
.codebox { font-family: ui-monospace, Menlo, monospace; font-size: 30px; letter-spacing: .12em; text-align: center; padding: 10px 0 4px; }
.about p { margin: 0 0 8px; font-size: 14px; line-height: 1.8; }
.about p:last-child { margin: 0; }

/* ---------- 浮层 ---------- */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheetin { background: var(--bg); width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; max-height: 100dvh; overflow-y: auto;
           padding: 22px 16px calc(22px + env(safe-area-inset-bottom)); }
.sheet-title { text-align: center; font-size: 17px; font-weight: 600; margin: 0 0 4px; }
.sheet-sub { text-align: center; font-size: 13px; color: var(--text2); margin: 0 0 16px; min-height: 18px; }
.cover { position: fixed; inset: 0; background: var(--bg); z-index: 30; display: flex; align-items: center; justify-content: center; }
.toast { position: fixed; left: 50%; bottom: calc(30px + env(safe-area-inset-bottom)); transform: translateX(-50%);
         background: var(--text); color: var(--bg); padding: 9px 18px; border-radius: 999px; font-size: 14px; z-index: 40; }

@media (prefers-reduced-motion: reduce) { .poem .a, .content { transition: none; } .dots.shake { animation: none; } }
@media (max-height: 800px) { .pad { gap: 10px 22px; } .pad button { width: 64px; height: 64px; font-size: 26px; } .lockfoot { margin-top: 8px; } }
@media (max-height: 680px) { .pad { gap: 8px 20px; } .pad button { width: 58px; height: 58px; font-size: 24px; }
  #v-lock .poem .ln { letter-spacing: .3em; } .padmsg { margin-bottom: 4px; } }

/* 忘了暗号页的开门密码:普通文本框用圆点遮住,浏览器不会自动填入 */
.masked { -webkit-text-security: disc; text-security: disc; }
@media (max-height: 600px) {
  .pad { gap: 6px 18px; } .pad button { width: 52px; height: 52px; font-size: 22px; }
  #v-lock .poem .ln { font-size: min(6vw, 3.6dvh); } #v-lock .poem { margin-bottom: 2dvh; }
  .dots { margin: 2px 0 6px; } .padmsg { min-height: 16px; } .lockfoot { margin-top: 4px; } .link { padding: 4px 6px; }
}

/* ---------- 中部弹窗(放到桌面) ---------- */
.modal { position: fixed; inset: 0; z-index: 25; background: rgba(0,0,0,.42); display: flex; align-items: center; justify-content: center;
         padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom)); }
.modalin { background: var(--card); width: 100%; max-width: 340px; border-radius: 22px; padding: 26px 20px 12px; text-align: center;
           box-shadow: 0 12px 40px rgba(0,0,0,.25); max-height: 100%; overflow-y: auto; animation: pop .22s ease-out; }
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.appicon { width: 64px; height: 64px; border-radius: 15px; display: block; margin: 0 auto; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.modal-title { font-size: 19px; font-weight: 700; margin: 14px 0 6px; }
.modal-sub { font-size: 14px; color: var(--text2); line-height: 1.6; margin: 0 0 14px; }
.steps { list-style: none; margin: 0 0 12px; padding: 0; text-align: left; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: center; padding: 11px 2px; border-top: 1px solid var(--line); font-size: 15px; line-height: 1.5; }
.steps li:last-child { border-bottom: 1px solid var(--line); }
.steps li::before { content: counter(s); flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--tint); color: var(--accent);
                    font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.steps svg { vertical-align: -4px; margin-left: 2px; color: var(--accent); }
.steps small { color: var(--text2); font-size: 12px; }
.modal-note { font-size: 12px; color: var(--text2); line-height: 1.6; margin: 0 0 14px; }
.modalin .link { display: block; margin: 4px auto 0; }
@media (prefers-reduced-motion: reduce) { .modalin { animation: none; } }
