#bgLayer {
  position: fixed;
  left: 50%;
  top: 64px;
  bottom: 20px;
  transform: translateX(-50%);
  width: min(1120px, calc(100% - 32px));
  border-radius: 20px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
  pointer-events: none;
  filter: blur(9px) saturate(1.12) brightness(1.14);
  transition: opacity .6s ease;
}
#bgLayer::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(250,247,240,.30) 0%, rgba(250,247,240,.62) 55%, rgba(250,247,240,.92) 100%);
}
#bgLayer.off { opacity: 0; }


:root{
  --ink:#1f2328; --muted:#6b7280; --line:#e5e1d8; --paper:#faf7f0;
  --accent:#8a6b4f; --card:#fff; --shadow:0 2px 10px rgba(60,45,30,.08);
}
*{box-sizing:border-box}
html{background:var(--paper)}
body{
  margin:0;background:transparent;color:var(--ink);
  font:16px/1.7 "PingFang SC","Microsoft YaHei",system-ui,sans-serif;
}
header{
  position:sticky;top:0;z-index:20;background:rgba(250,247,240,.92);
  backdrop-filter:blur(8px);border-bottom:1px solid var(--line);
  padding:14px 18px 0;
}
h1{margin:0 0 10px;font-size:22px;letter-spacing:2px;font-weight:600;color:var(--accent)}
nav{display:flex;gap:6px}
.tab{
  border:0;background:transparent;padding:9px 16px;font-size:15px;color:var(--muted);
  cursor:pointer;border-bottom:2px solid transparent;
}
.tab.active{color:var(--ink);border-bottom-color:var(--accent);font-weight:600}
main{max-width:1080px;margin:0 auto;padding:20px 16px 60px}
.panel{display:none}
.panel.active{display:block}
.bar{display:flex;align-items:center;gap:12px;margin-bottom:18px;flex-wrap:wrap}
.btn{
  display:inline-flex;align-items:center;gap:6px;border:1px solid var(--accent);
  background:var(--accent);color:#fff;padding:8px 16px;border-radius:999px;
  font-size:14px;cursor:pointer;
}
.btn.ghost{background:transparent;color:var(--accent)}
.tip{color:var(--muted);font-size:13px}

/* 照片 */
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:14px}
.card{
  background:var(--card);border-radius:12px;overflow:hidden;box-shadow:var(--shadow);
  cursor:pointer;transition:transform .15s;
}
.card:hover{transform:translateY(-2px)}
.card img{width:100%;height:150px;object-fit:cover;display:block;background:#eee}
.card .meta{padding:8px 10px;font-size:12px;color:var(--muted)}
.empty{color:var(--muted);text-align:center;padding:40px 0}

/* 灯箱 */
.lightbox{
  position:fixed;inset:0;background:rgba(20,16,12,.92);display:none;
  align-items:center;justify-content:center;flex-direction:column;z-index:50;padding:20px;
}
.lightbox.show{display:flex}
.lightbox img{max-width:92vw;max-height:82vh;border-radius:8px}
.lightbox .cap{color:#f0e8dc;margin-top:12px;font-size:14px}

/* 家谱 */
.tree-wrap{background:var(--card);border-radius:14px;box-shadow:var(--shadow);padding:10px;overflow:auto}
#treeSvg{display:block;width:100%;height:560px;touch-action:pan-y;cursor:grab}
.node rect{fill:#fff;stroke:var(--accent);stroke-width:1.6;rx:8}
.node text{font-size:14px;fill:var(--ink);dominant-baseline:middle;text-anchor:middle;pointer-events:none}
.node.sel rect{stroke-width:3;fill:#fdf6ec}
.link{stroke:#c9bfae;stroke-width:1.6;fill:none}

/* 文档 */
.doc-list{display:grid;gap:14px}
.doc{background:var(--card);border-radius:12px;padding:16px 18px;box-shadow:var(--shadow)}
.doc h4{margin:0 0 6px;font-size:17px}
.doc .d{color:var(--muted);font-size:12px;margin-bottom:8px}
.doc p{margin:0;white-space:pre-wrap;color:#333}

/* 弹窗 */
.modal{position:fixed;inset:0;background:rgba(0,0,0,.45);display:none;align-items:center;justify-content:center;z-index:60;padding:16px}
.modal.show{display:flex}
.modal-box{background:#fff;border-radius:14px;padding:20px;width:min(560px,92vw)}
.modal-box h3{margin:0 0 12px;font-size:17px}
.modal-box input,.modal-box textarea{
  width:100%;border:1px solid var(--line);border-radius:8px;padding:10px;
  font:inherit;margin-bottom:10px;background:#fcfaf6;
}
.modal-actions{display:flex;justify-content:flex-end;gap:10px}
@media(max-width:600px){
  .card img{height:120px}
  h1{font-size:19px}
}

/* 家谱：禁止选中文字（否则拖动变选字） */
#treeSvg text, #treeSvg rect { user-select: none; -webkit-user-select: none; -ms-user-select: none; }
#treeBar { flex-wrap: wrap; gap: 8px; }
#treeBar select {
  font: inherit; padding: 4px 8px; border-radius: 6px;
  border: 1px solid #d8cbb6; background: #fff; color: #4b3b2a;
}
.link.spouse { stroke: #c9a86a; stroke-width: 3; }

/* ---- 背景图层 ---- */
html { background: #faf7f0; }
body.has-bg body.has-bg header, body.has-bg main, body.has-bg .wrap, body.has-bg .tabs {
  position: relative; z-index: 1;
}

/* ---- 音乐按钮 ---- */
button.music {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid #d8c9b0; background: #fff8ec; color: #8a6a45;
  font-size: 20px; cursor: pointer; box-shadow: 0 4px 14px rgba(120,90,60,.18);
}
button.music.playing { background: #8a6a45; color: #fff8ec; border-color: #8a6a45; }
button.music:hover { transform: translateY(-1px); }
/* 有背景时，内容卡片半透明，让照片透出来 */
body.has-bg .tree-wrap,
body.has-bg .panel > .card,
body.has-bg .doc-list {
  background: rgba(255,252,246,.84);
  backdrop-filter: blur(3px);
}
/* 照片卡片上的删除按钮 */
.card { position: relative; }
.card .del {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px; line-height: 22px;
  border: none; border-radius: 50%;
  background: rgba(40,32,26,.55); color: #fff;
  font-size: 17px; cursor: pointer; padding: 0;
  opacity: .5; transition: opacity .15s, background .15s;
}
.card:hover .del { opacity: 1; }
.card .del:hover { background: #b23b3b; }
@media (hover: none) { .card .del { opacity: .85; } }
/* ===== 背景图层（最终版：限制在站内宽度，轻虚化） ===== */
body.has-bg body.has-bg header, body.has-bg main { position: relative; z-index: 1; }
body.has-bg { background: #f3ede2; }
/* 背景开关按钮 */
button.bgtog {
  margin-left: auto;
  border: 1px solid #d8c9b0; background: #fff8ec; color: #8a6a45;
  border-radius: 999px; padding: 6px 14px; font-size: 13px; cursor: pointer;
}
button.bgtog:hover { background: #f6ecdb; }
/* 顶栏排成一行：标题 / 标签 / 背景开关 */
header { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
header h1 { margin: 0; }
header nav { margin: 0; }
button.bgtog { margin-left: auto; margin-top: 0; }
/* ================= 照片描述 ================= */
.card .meta { display: flex; flex-direction: column; gap: 2px; }
.card .meta b { font-weight: 600; color: #4b3b2a; font-size: 13px; }
.card .meta span { color: #8a7a66; font-size: 12px; }

.cap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lb-title { font-weight: 600; font-size: 17px; color: #fff; text-align: center; }
.lb-note {
  max-width: 640px; color: #e8e0d4; font-size: 14px; line-height: 1.7;
  text-align: center; white-space: pre-wrap;
}
.lb-time { color: #b9ab9a; font-size: 12px; }
.lb-edit { margin-top: 6px; }

#metaModal textarea { margin-top: 10px; }
/* 大图页：图片限高 + 说明区留白 */
#lightbox { display: none; }
#lightbox.show { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; overflow-y: auto; }
#lightbox img { max-height: 62vh; max-width: 92vw; width: auto; border-radius: 10px; }
#lightbox .cap { margin-top: 14px; padding-bottom: 18px; }
/* 内容层压在背景层之上 */
header, main { position: relative; z-index: 1; }


/* ===== 相册（图片夹）样式 ===== */
.album-month {
  font-size: 15px; font-weight: 600; color: #7a6a55;
  letter-spacing: .04em; margin: 26px 0 12px;
  padding-left: 2px; position: relative;
}
.album-month::after {
  content: ''; display: block; height: 1px; margin-top: 8px;
  background: linear-gradient(90deg, rgba(180,160,130,.45), rgba(180,160,130,0));
}
.album {
  display: flex; flex-wrap: wrap; gap: 26px 24px; padding: 4px 2px 8px;
}
.ph {
  width: 240px; background: #fffdf9; padding: 10px 10px 0;
  border-radius: 3px; box-shadow: 0 6px 18px rgba(120, 96, 64, .16);
  transform: rotate(var(--tilt, 0deg));
  transition: transform .18s ease, box-shadow .18s ease;
  cursor: pointer; position: relative;
}
.ph:hover { transform: rotate(0deg) translateY(-4px); box-shadow: 0 12px 26px rgba(120,96,64,.24); }
.ph-img { width: 100%; aspect-ratio: 4 / 3; overflow: hidden; background: #efe7da; }
.ph-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-cap { padding: 9px 2px 12px; font-family: "KaiTi", "STKaiti", serif; }
.ph-cap b { display: block; font-size: 15px; color: #4a3f31; font-weight: 600;
            white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 20px; }
.ph-cap span { display: block; font-size: 12px; color: #9c8e7a; margin-top: 3px;
               font-family: "Microsoft YaHei", sans-serif; }
.ph .del {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px;
  border: 0; border-radius: 50%; background: rgba(0,0,0,.42); color: #fff;
  font-size: 14px; line-height: 24px; padding: 0; cursor: pointer; opacity: .55;
}
.ph .del:hover { opacity: 1; background: #b23b3b; }
@media (max-width: 640px) {
  .ph { width: calc(50% - 12px); }
  .album { gap: 18px 14px; }
}

/* 相册需要普通块级流，覆盖旧的 grid 布局 */
#photoGrid { display: block !important; }

/* ===== 视角侧栏 ===== */
.tree-layout { display: flex; gap: 16px; align-items: flex-start; }
.tree-layout > .tree-wrap { flex: 1 1 auto; min-width: 0; }
.tree-side {
  flex: 0 0 196px; width: 196px;
  background: rgba(255,252,246,.9); border: 1px solid rgba(180,160,130,.28);
  border-radius: 14px; padding: 12px 10px;
}
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: #8d7c64; letter-spacing: .04em; margin-bottom: 8px;
}
.mini-btn {
  border: 1px solid rgba(180,160,130,.5); background: #fffdf9; color: #7c6f5e;
  width: 22px; height: 22px; border-radius: 6px; cursor: pointer; line-height: 1;
}
.viewer-list { display: flex; flex-direction: column; gap: 6px; }
.viewer-list .empty { font-size: 12px; color: #a99a84; line-height: 1.6; }
.viewer-row {
  border: 1px solid transparent; border-radius: 10px; padding: 6px 8px;
  background: #fffdf9; transition: .15s;
}
.viewer-row.on { border-color: rgba(160,130,90,.55); box-shadow: 0 3px 10px rgba(140,110,70,.12); }
.viewer-row .vname { display: block; font-size: 14px; color: #5b4a36; cursor: pointer; }
.viewer-row .vmenu { display: none; gap: 6px; margin-top: 6px; }
.viewer-row.open .vmenu, .viewer-row:hover .vmenu { display: flex; }
.viewer-row .vmenu button {
  font-size: 12px; padding: 3px 8px; border-radius: 7px; cursor: pointer;
  border: 1px solid rgba(180,160,130,.45); background: #fff; color: #6a5b47;
}
.viewer-row .vmenu button.del { color: #b23b3b; border-color: rgba(178,59,59,.35); }
.side-foot { font-size: 11.5px; color: #a99a84; line-height: 1.6; margin-top: 10px; }
#treeBar input.mini {
  width: 110px; padding: 4px 8px; font-size: 13px; border-radius: 7px;
  border: 1px solid rgba(180,160,130,.45); background: #fffdf9;
}
.modal-box.wide { width: min(560px, calc(100vw - 40px)); max-height: min(720px, 82vh); display: flex; flex-direction: column; }
.calling-body { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 4px; overflow-y: auto; flex: 1 1 auto; min-height: 120px; }
.ct-row { display: flex; align-items: center; gap: 10px; }
.ct-real { flex: 0 0 110px; font-size: 13px; color: #6a5b47; }
.ct-row input {
  flex: 1; padding: 6px 10px; font-size: 13px; border-radius: 8px;
  border: 1px solid rgba(180,160,130,.45); background: #fffdf9;
}
@media (max-width: 760px) {
  .tree-layout { flex-direction: column; }
  .tree-side { width: 100%; flex: none; }
  .viewer-row .vmenu { display: flex; }
}
/* 缩放工具条 */
.zoom-bar {
  display: none; align-items: center; gap: 8px; justify-content: flex-end;
  margin: 0 0 8px 0; font-size: 12px; color: #8d7c64;
}
.zoom-bar button {
  border: 1px solid rgba(180,160,130,.5); background: #fffdf9; color: #7c6f5e;
  width: 28px; height: 26px; border-radius: 8px; cursor: pointer; line-height: 1;
}
.zoom-bar button[data-z="fit"] { width: auto; padding: 0 10px; }
#zoomLabel { min-width: 42px; text-align: center; }
/* 编辑栏换行 + 缩放条浮在右上 */
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.zoom-bar {
  position: absolute; right: 12px; top: 10px; z-index: 5;
  background: rgba(255,253,249,.92); border: 1px solid rgba(180,160,130,.35);
  border-radius: 10px; padding: 4px 6px; display: none; align-items: center; gap: 6px;
}
.vtag{font-size:11px;color:#a2917a;border:1px solid rgba(180,160,130,.45);border-radius:8px;padding:1px 6px;margin-left:4px}

.tree-tip{position:absolute;left:0;right:0;top:44%;text-align:center;color:#a2917a;font-size:14px;letter-spacing:.02em;pointer-events:none}

/* ===== 亲人页：让画布占满可用空间 ===== */
body.tree-wide main { max-width: min(1560px, 96vw); padding-top: 10px; }
body.tree-wide #treeSvg { height: min(74vh, 880px); }
body.tree-wide .tree-wrap { padding: 6px; }
@media (max-width: 760px) {
  body.tree-wide main { max-width: 100%; padding-left: 8px; padding-right: 8px; }
  body.tree-wide #treeSvg { height: 68vh; }
}

/* ===== 照片匣 ===== */
.box-badge{position:absolute;left:8px;bottom:8px;background:rgba(90,70,50,.78);color:#fff;font-size:11px;padding:2px 7px;border-radius:9px}
.ph.box .ph-img{position:relative}
.album-view{position:fixed;inset:0;background:rgba(28,22,16,.82);display:none;align-items:center;justify-content:center;z-index:40}
.album-view.show{display:flex}
.av-box{background:#fffdf8;border-radius:16px;width:min(920px,94vw);max-height:86vh;overflow:auto;padding:16px 18px}
.av-head{display:flex;gap:8px;align-items:center;margin-bottom:12px;flex-wrap:wrap}
.av-title{flex:1 1 220px;min-width:160px;border:1px solid #e2d8c8;border-radius:9px;padding:7px 10px;font:inherit;background:#fff}
.av-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
.av-item{position:relative;border-radius:10px;overflow:hidden;background:#f3ede2}
.av-item img{display:block;width:100%;height:150px;object-fit:cover}
.av-item.is-cover{outline:3px solid #b08d5f;outline-offset:-3px}
.av-item button{position:absolute;left:6px;right:6px;border:0;border-radius:7px;padding:4px 0;font-size:11px;background:rgba(255,255,255,.9);cursor:pointer}
.av-item .av-set{bottom:30px}
.av-item .av-open{bottom:6px}
.av-tip{color:#9c8b74;font-size:12px;margin:10px 2px 0}
.lb-actions{display:inline-flex;gap:8px;margin-top:6px}

.av-badge{position:absolute;left:6px;top:6px;background:rgba(176,141,95,.92);color:#fff;font-size:11px;padding:2px 7px;border-radius:8px}
.av-item{cursor:pointer}

/* ===== 生日模式 ===== */
#bdayFx{position:fixed;inset:0;width:100%;height:100%;pointer-events:none;z-index:9998}
#bdayBar{position:fixed;left:0;right:0;top:0;z-index:9999;display:flex;flex-direction:column;align-items:center;
  padding:14px 10px 18px;pointer-events:none;
  background:linear-gradient(180deg,rgba(190,44,44,.96) 0%,rgba(190,44,44,.72) 62%,rgba(190,44,44,0) 100%)}
.bd-text{font-family:"STKaiti","KaiTi","楷体",serif;font-size:clamp(30px,5.2vw,62px);font-weight:900;letter-spacing:.10em;
  color:#ffd24a;-webkit-text-stroke:2.5px #9c1b1b;
  text-shadow:0 2px 0 #7d1414,0 4px 0 rgba(125,20,20,.5),0 0 22px rgba(255,180,60,.95),0 0 44px rgba(255,90,60,.55)}
.bd-sub{margin-top:4px;color:#ffe9b0;font-size:13px;letter-spacing:.35em;text-shadow:0 0 12px rgba(255,120,60,.9)}
body.has-bday{padding-top:132px}
body.has-bday header{top:0}
@keyframes bdFade{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:none}}
#bdayMusic{position:fixed;right:20px;bottom:84px;z-index:9999;border:0;border-radius:20px;cursor:pointer;
  padding:9px 16px;font:inherit;font-size:13px;color:#7a2f0c;background:linear-gradient(180deg,#ffe9a8,#ffc861);
  box-shadow:0 6px 18px rgba(180,90,20,.35)}

/* ================= 芳辰页：天鹅蛋糕 + 44 根蜡烛 ================= */
#bdayPanel{display:none}
body.tab-bday main{display:none}
body.tab-bday #bdayPanel{display:block;position:relative;z-index:2;padding:16px 16px 40px;text-align:center}
.bday-title{font-family:"STKaiti","KaiTi","Songti SC",serif;font-size:clamp(24px,3.2vw,38px);color:#b3261e;letter-spacing:.16em;margin:4px 0 2px;text-shadow:0 1px 0 rgba(255,255,255,.7)}
.bday-sub{color:#8a6a3a;font-size:14px;margin:0 0 8px}
.bday-sub b{color:#c0392b}
.bday-stage{display:flex;justify-content:center}
#cakeCanvas{width:min(1040px,96vw);height:auto;cursor:pointer;touch-action:manipulation;user-select:none}

.poem-mask{position:fixed;inset:0;background:rgba(28,14,6,.42);backdrop-filter:blur(2px);display:none;align-items:center;justify-content:center;z-index:10000;padding:28px}
.poem-mask.on{display:flex}

/* ===== 圣旨手卷（横款，左右木轴 + 云凤暗纹） ===== */
.poem-card{position:relative;width:min(1040px,94vw);height:min(520px,66vh);display:flex;align-items:stretch;padding:0 52px;
  clip-path:inset(0 50% 0 50%)}
.poem-mask.on .poem-card{animation:scrollOpen .92s cubic-bezier(.2,.85,.3,1) forwards}
@keyframes scrollOpen{from{clip-path:inset(0 50% 0 50%)}to{clip-path:inset(0 0 0 0)}}

.roller{position:absolute;top:-30px;bottom:-30px;width:54px;border-radius:9px;
  background:linear-gradient(90deg,#3a2408,#c99b4f 22%,#e0b975 42%,#a9722a 66%,#3a2408);
  box-shadow:0 18px 34px rgba(0,0,0,.55), inset 0 0 0 1px rgba(255,236,180,.35);
  display:flex;flex-direction:column;justify-content:space-between}
.roller.left{left:10px}.roller.right{right:10px}
.roller .cap{display:block;height:30px;margin:-15px 0;border-radius:12px;
  background:linear-gradient(#0f0f10,#3b3b3d 45%,#141415);
  box-shadow:0 3px 8px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.18)}

.silk{flex:1;position:relative;margin:0 46px;overflow:hidden;
  background:
    repeating-linear-gradient(90deg, rgba(190,150,70,.10) 0 2px, transparent 2px 9px),
    radial-gradient(120% 90% at 50% 30%, #fffdf0, #f7ebc4 55%, #eed9a3 100%);
  box-shadow:0 24px 60px rgba(0,0,0,.55), inset 0 0 90px rgba(160,105,30,.25)}
.silk::before{content:'';position:absolute;inset:10px;pointer-events:none;z-index:2;
  border:11px solid #8e1f18;
  box-shadow:inset 0 0 0 2px #cfa14a, 0 0 0 2px #cfa14a, inset 0 0 26px rgba(90,10,6,.55)}
.silk::after{content:'';position:absolute;inset:26px;pointer-events:none;z-index:2;
  border:2px solid rgba(170,30,22,.35)}
.silk-art{display:none}

.shengzhi{position:absolute;right:7%;top:50%;transform:translateY(-50%);
  writing-mode:vertical-rl;text-orientation:upright;
  font-family:"STKaiti","KaiTi",serif;font-weight:800;font-size:clamp(40px,5vw,68px);
  color:#17100a;letter-spacing:.1em;
  text-shadow:0 2px 0 rgba(255,252,232,.75), 0 6px 14px rgba(90,50,10,.25)}

.poem-cols{position:absolute;left:8%;right:8%;top:50%;transform:translateY(-50%);
  display:flex;flex-direction:row-reverse;align-items:center;justify-content:space-between;height:72%;gap:2px}
.poem-line{margin:0;writing-mode:vertical-rl;text-orientation:upright;
  font-family:"Songti SC","SimSun","STSong","Noto Serif CJK SC",serif;
  font-size:clamp(26px,3.2vw,42px);font-weight:400;letter-spacing:.08em;line-height:1.08;white-space:nowrap;
  color:#5b3608;
  text-shadow:0 1px 0 rgba(255,253,240,.6);
  transform:rotate(var(--tl)) translateY(var(--ty))}
.poem-line:nth-child(1){--tl:1.8deg;--ty:6px}
.poem-line:nth-child(2){--tl:-1.2deg;--ty:-8px}
.poem-line:nth-child(3){--tl:1deg;--ty:10px}
.poem-line:nth-child(4){--tl:-2deg;--ty:-6px}

.poem-seal{position:absolute;right:44px;bottom:56px;width:52px;height:52px;border:3px solid rgba(178,38,30,.85);border-radius:5px;
  color:rgba(178,38,30,.9);display:flex;align-items:center;justify-content:center;
  font-family:"STKaiti",serif;font-size:26px;transform:rotate(-6deg)}
.poem-x{position:absolute;right:2px;top:-30px;width:40px;height:40px;border-radius:50%;
  border:2px solid #c08a3a;background:#4a2c0a;color:#ffe9a8;font-size:22px;line-height:1;cursor:pointer;z-index:5}

@media (max-width:760px){
  .poem-card{height:min(330px,52vh);padding:0 30px}
  .roller{width:34px;top:-18px;bottom:-18px}.roller .cap{height:20px;margin:-10px 0}
  .silk{margin:0 30px}
  .poem-line{font-size:clamp(17px,4.6vw,24px)}
  .shengzhi{right:14px;font-size:clamp(30px,8vw,46px)}
  .poem-seal{right:16px;bottom:30px;width:40px;height:40px;font-size:20px}
  .poem-cols{left:22px}
}

.bday-page{position:relative}
.bday-couplet{position:absolute;top:86px;writing-mode:vertical-rl;text-orientation:upright;
  display:flex;flex-direction:row;gap:24px;pointer-events:none;user-select:none;
  font-family:"STKaiti","KaiTi","Kaiti SC",serif;font-weight:600;letter-spacing:.3em;
  font-size:clamp(17px,1.65vw,24px);line-height:2;color:rgba(118,54,22,.52)}
.bday-couplet p{margin:0}
.bday-couplet.left{left:2%}
.bday-couplet.right{right:2%}
@media (max-width:1120px){.bday-couplet{display:none}}

.album-pick{appearance:none;border:1px solid rgba(140,104,64,.28);background:#fff;color:#5b3a1e;
  border-radius:999px;padding:8px 32px 8px 14px;font:500 14px/1 "PingFang SC","Microsoft YaHei",sans-serif;
  cursor:pointer;max-width:220px;background-image:linear-gradient(45deg,transparent 50%,#9a7750 50%),linear-gradient(135deg,#9a7750 50%,transparent 50%);
  background-position:calc(100% - 16px) 52%,calc(100% - 11px) 52%;background-size:5px 5px,5px 5px;background-repeat:no-repeat}
.album-pick:focus{outline:none;border-color:rgba(140,104,64,.55)}

#gate .gate-label {
  display: block; margin: 6px 0 -2px; padding-left: 2px;
  font-size: 12.5px; letter-spacing: .18em; color: #a2917a;
}
#gateForm input::placeholder { font-size: 13.5px; }

/* 两个输入框：竖排、整宽 */
#gate { padding: 16px; box-sizing: border-box; }
#gate .gate-card { width: min(380px, calc(100vw - 48px)); max-width: none; box-sizing: border-box; }
html, body { overflow-x: hidden; }
#gateForm { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 14px; }
#gateForm input { width: 100%; box-sizing: border-box; }
#gateForm button { width: 100%; margin-top: 4px; }

/* ===== 密码门 ===== */
#gate .gate-bday{display:none;flex-direction:column;align-items:center;gap:6px;margin-bottom:10px}
#gate .gb-title{
  font-family:"华文行楷","STXingkai","KaiTi",serif;font-size:34px;line-height:1.15;
  color:#c0342b;letter-spacing:.06em;text-shadow:0 2px 0 rgba(255,255,255,.65),0 0 18px rgba(255,140,90,.45);
}
#gate .gb-sub{font-size:13px;letter-spacing:.32em;color:#c07a3a}
#gate.gate-bday{background:
  radial-gradient(120% 90% at 50% 0%, #b3352b 0%, #96241d 45%, #7c1a15 100%)}
#gate.gate-bday .gate-card{
  background:rgba(255,250,240,.92);box-shadow:0 18px 60px rgba(60,10,0,.35),0 0 0 2px rgba(255,214,140,.55);
}
#gate.gate-bday .gate-bday{display:flex}
#gate.gate-bday .gate-title{color:#7c1a15}
#gate.gate-bday .gate-sub{color:#a4632c}
#gateFx{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:1;display:none}
#gate.gate-bday #gateFx{display:block}
#gate .gate-card{position:relative;z-index:2}
#gate {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #f7f1e6, #efe6d6);
  padding: 24px;
}
html.unlocked #gate { display: none; }
.gate-card {
  width: 100%; max-width: 420px; text-align: center;
  background: rgba(255,253,248,.96); border: 1px solid rgba(180,160,130,.3);
  border-radius: 18px; padding: 38px 30px 30px;
  box-shadow: 0 18px 48px rgba(120,95,60,.14);
}
.gate-title { font-size: 30px; letter-spacing: 4px; color: #5b4a36; margin: 0 0 10px; }
.gate-sub { color: #9c8c76; font-size: 14px; margin: 0 0 22px; letter-spacing: 1px; }
.gate-hint {
  color: #a8967c; font-size: 13px; line-height: 1.7; margin: 0 0 18px;
  background: #f6efe2; border-radius: 10px; padding: 10px 12px;
}
#gateForm { display: flex; flex-direction: column; gap: 10px; }
#gateUser, #gateInput {
  flex: 1; padding: 12px 14px; font-size: 15px; color: #4a3f31;
  border: 1px solid rgba(180,160,130,.45); border-radius: 10px; background: #fffdf9;
  outline: none;
}
#gateUser:focus, #gateInput:focus { border-color: #b99b6b; box-shadow: 0 0 0 3px rgba(185,155,107,.15); }
#gateForm button {
  padding: 12px 20px; font-size: 15px; color: #fff; cursor: pointer;
  background: #a5834f; border: none; border-radius: 10px; letter-spacing: 2px;
}
#gateForm button:hover { background: #94743f; }
.gate-msg { min-height: 20px; margin: 14px 0 0; font-size: 13px; color: #c0392b; }
.shake { animation: shake .38s; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  75% { transform: translateX(7px); }
}
