/* Milk-white paper, soft amber accents, and a little charm made from the existing Xiaojie artwork. */
body{background:radial-gradient(ellipse at 85% 0,#f2e3c54d,transparent 48%),var(--bg)}
::selection{background:#ecd8b4;color:#514637}
.sidebar{background:linear-gradient(155deg,#f7f2e9,#f0e9dc);overflow-y:auto;scrollbar-width:thin;scrollbar-color:#d4c4aa transparent}
.topbar{background:#fffcf675;border-color:var(--line)}
.nav-item.active{box-shadow:inset 3px 0 #bc8b4d;color:#805623}
.nav-item:hover{background:#ece1d0}
.brand>img{box-shadow:0 3px 8px #a17a3915;border-radius:11px}
.button.primary{background:#946630;border-color:#946630;color:#fffdf7;box-shadow:0 3px 8px #8f64341a}
.button.primary:hover{background:#835724;border-color:#835724;color:#fffdf7}
.home-card,.note-card,.news-card,.calendar-panel,.project-card,.record-card,.mood-record,.spending-panel,.ledger-stats article{box-shadow:0 4px 18px #936c3210}
.home-hero{background:radial-gradient(ellipse at 90% 12%,#fffaf0 0,transparent 54%),linear-gradient(115deg,#f1ebd9,#f5edde 60%,#efe7d5);border-color:#e0d1b7;box-shadow:0 7px 24px #987b3d0d}
.home-hero:after{content:"";position:absolute;width:240px;height:240px;border:1px solid #cdbb9730;border-radius:50%;right:-110px;top:-140px;pointer-events:none}
.home-welcome h1{color:#574933}
.home-welcome>p{color:#756751}
.room-window{background:linear-gradient(#cbd7d2,#f1e4c5);box-shadow:0 0 0 1px #d5c5aa,inset 0 0 15px #ece4ce}
.room-moon{background:#fff5ca;box-shadow:0 0 28px #fff1b28a}
.home-portrait{box-shadow:0 7px 18px #8e6c3926;border-color:#fff9eb}
.room-caption{color:#786a50}
.lamp:after{background:linear-gradient(#ecc57244,#ecc57200)}
.letter-arrival{background:linear-gradient(105deg,#f0e3ca,#faf3e5);border-color:#dfccab;box-shadow:0 3px 13px #93763e0a}
.letter-arrival:hover{border-color:#b98f51}
.welcome-letter{background:#fffdf7;box-shadow:inset 5px 0 #f0e4cc,0 8px 25px #a0804112}
.companion-card{background:linear-gradient(150deg,#f1e8d6,#faf6ec);border-color:#e1d5bf}
.care-card{background:radial-gradient(ellipse at 50% 0,#f3e5cb,#f8f2e7 65%,#f4eddf);border-color:#e2d4bc}
.care-card>img{border-color:#fff9ee;box-shadow:0 4px 16px #97734517}
.news-card.featured{background:linear-gradient(115deg,#f3ead8,#fcf8ef)}
.filter.selected,.room-tabs button.selected,.method-menu button.selected{color:#805726}
.field input,.field select,.field textarea{border-color:#d5c5ac;background:#fffdf7}
.field input:focus,.field textarea:focus,.field select:focus{box-shadow:0 0 0 3px #b88e4720}
.search-field{background:#fffdf7}
.day-event{color:#536e5e;border-left-color:#80977e}
.task-check.checked{color:#fffdf7}
.category{color:#805726}.category-world,.category-china{color:#536e81}.category-growth,.category-psychology{color:#506c4d}
.note-card blockquote{border-left-color:#b29772}
.portrait-frame{box-shadow:0 4px 17px #97734517}
.button,.news-card,.home-shortcuts>a{transition:background .18s ease,border-color .18s ease,box-shadow .18s ease}

/* The charm lives in the sidebar so it never covers reading or editing controls. */
.cozy-corner{margin:18px 0 10px;position:relative}
.cozy-toggle{width:100%;display:flex;align-items:center;gap:12px;padding:0 5px;background:transparent;text-align:left;border-radius:14px}
.cozy-charm{display:block;position:relative;width:82px;height:145px;flex-shrink:0;transform:rotate(-5deg);transform-origin:43px 4px;transition:transform .25s ease}
.cozy-cord{position:absolute;top:0;left:38px;width:13px;height:32px;border:2px solid #b99570;border-radius:50%}
.cozy-ribbon{position:absolute;top:20px;left:21px;width:46px;height:25px;color:#bf8b77;z-index:2}
.cozy-ribbon svg{width:100%;height:100%}
.cozy-tag{position:absolute;inset:36px 0 0;border:3px solid #fffcf5;border-radius:37px 37px 12px 12px;background:#fffaf0;box-shadow:0 5px 12px #9b70422b,0 0 0 1px #d9c5a4;overflow:hidden;padding:3px 3px 2px}
.cozy-photo{display:block;height:78px;overflow:hidden;border-radius:32px 32px 6px 6px;background:#f9efdf}
.cozy-photo img{display:block;width:100%;height:100%;object-fit:cover;transform:scale(1.13);transform-origin:center 60%}
.cozy-tag-name{display:block;text-align:center;font-size:9px;line-height:21px;letter-spacing:4px;color:#8a6b47;padding-left:4px}
.cozy-flower{position:absolute;right:-9px;bottom:8px;display:grid;place-items:center;width:27px;height:27px;font-size:29px;line-height:1;color:#c3986d;text-shadow:0 2px 0 #fffaf0;transform:rotate(12deg)}
.cozy-label{font-size:12px;line-height:1.9;color:#79613f;white-space:nowrap;padding-top:25px}
.cozy-label small{display:block;font-size:10px;color:var(--faint);line-height:1.8;margin-top:5px}
.cozy-toggle:hover .cozy-charm,.cozy-toggle:focus-visible .cozy-charm{transform:rotate(4deg)}
.cozy-toggle:hover .cozy-label{color:#906128}
.cozy-avatar{position:relative;display:grid;place-items:center;width:40px;height:40px;border:1px solid #d5c2a3;border-radius:16px 16px 12px 12px;padding:3px;background:#fffaf1;transform:rotate(4deg);box-shadow:0 3px 7px #9c76401c;flex-shrink:0}
.cozy-avatar img{display:block;width:100%;height:100%;object-fit:cover;border-radius:12px}
.cozy-avatar>span[aria-hidden="true"]{position:absolute;right:-5px;bottom:-6px;font-size:17px;color:#ab824d;text-shadow:0 0 3px #fffdf5}
.cozy-avatar:hover{transform:rotate(-4deg)}

/* An on-demand paper card; native dialog provides focus trapping and Escape to close. */
.cozy-dialog{width:min(438px,calc(100% - 32px));max-height:calc(100dvh - 36px);padding:0;border:1px solid #dac9aa;border-radius:21px;background:#fffaf0;box-shadow:0 18px 90px #6f512e33;overflow:auto}
.cozy-dialog::backdrop{background:#5c4a303b;backdrop-filter:blur(4px)}
.cozy-paper{padding:35px 32px 23px;position:relative;background:radial-gradient(ellipse at 10% 0,#f3e1bd60,transparent 55%),#fffcf4}
.cozy-close{position:absolute;top:8px;right:9px;width:36px;height:36px;display:grid;place-items:center;background:transparent;color:#806e55;font:26px/1 sans-serif;border-radius:50%}
.cozy-close:hover{background:#f0e5d3}
.cozy-paper-top{display:flex;align-items:center;gap:12px;margin:0 0 32px;color:#816746;font-size:12px}
.cozy-paper-top small{display:block;letter-spacing:1.4px;font-size:8px;margin-top:4px;color:#877457}
.cozy-paper-flower{font-size:34px;color:#c09b63;line-height:1}
.cozy-note-number{margin-left:auto;font-size:10px;letter-spacing:1px;font-variant-numeric:tabular-nums;color:#806d51}
.cozy-note h2{font-family:"KaiTi","STKaiti","Songti SC",serif;font-size:27px;font-weight:400;line-height:1.7;color:#675239;margin-bottom:20px}
.cozy-note p{font-size:14px;line-height:2.25;white-space:pre-line;color:#76634b;min-height:95px}
.cozy-note>span{display:inline-block;font-size:10px;color:#93724b;background:#f1e5cf;transform:rotate(-2deg);padding:4px 12px;margin-top:20px}
.cozy-signature{display:flex;justify-content:flex-end;align-items:center;gap:12px;margin:20px 0 21px}
.cozy-signature>span{font-family:"KaiTi","STKaiti",serif;font-size:15px;color:#8f6f4c;transform:rotate(-3deg)}
.cozy-signature img{width:72px;height:72px;object-fit:cover;border-radius:50%;border:3px solid #f5e7ce}
.cozy-paper-actions{border-top:1px dashed #d9c6a7;padding-top:19px;display:flex;align-items:center;justify-content:space-between;gap:15px}
.cozy-paper-actions>.button{background:#f3e7d0;color:#79582f;border-color:#dfcaa4}
.cozy-paper-actions>.button:hover{background:#ecdbbb}
.cozy-paper-actions>.text-link{font-size:11px}
.cozy-paper-foot{display:block;font-size:10px;line-height:1.9;color:var(--faint);margin-top:17px}
@media(min-width:721px) and (max-width:1200px){.cozy-toggle{gap:8px;padding:0}.cozy-charm{width:72px}.cozy-cord{left:33px}.cozy-ribbon{left:17px;width:43px}.cozy-label{font-size:11px}.cozy-label small{font-size:9px}}
@media(min-width:721px) and (max-height:780px){.cozy-corner{margin-top:10px;margin-bottom:3px}.cozy-charm{height:119px;width:70px}.cozy-tag{top:30px;border-radius:32px 32px 11px 11px}.cozy-photo{height:62px}.cozy-cord{left:31px;height:26px}.cozy-ribbon{top:14px;left:14px;width:44px}.cozy-tag-name{line-height:18px}.cozy-label{padding-top:18px}.cozy-label small{margin-top:2px}.sidebar .export-link{padding-top:7px;padding-bottom:7px}.sidebar .storage-status{margin-top:7px}}
@media(max-width:720px){.sidebar{background:#f7f1e7f5;overflow:visible;box-shadow:0 -3px 16px #9575480d}.nav-item.active{box-shadow:none}.sidebar .nav-item.active{color:#805623}.topbar{background:#fbf7ee}.cozy-avatar{width:35px;height:35px;border-radius:14px 14px 10px 10px}.cozy-avatar>span[aria-hidden="true"]{font-size:15px}.cozy-paper{padding:33px 25px 22px}.cozy-paper-top{gap:10px;margin-bottom:25px}.cozy-note h2{font-size:25px}.cozy-note p{font-size:13px;line-height:2.25}.cozy-note>span{margin-top:17px}.cozy-signature{margin-top:17px;margin-bottom:18px}.cozy-signature img{width:65px;height:65px}.cozy-paper-actions{gap:10px}.cozy-paper-foot{font-size:9px}}
@media(prefers-reduced-motion:reduce){.cozy-toggle .cozy-charm,.cozy-avatar{transition:none!important;transform:none!important}}

/* Keep the library image intact: the scene stays wide, portraits frame its face in CSS. */
.scene-portrait{display:inline-block;position:relative;width:100%;height:100%;overflow:hidden;border-radius:inherit;background:#f2e5ce;vertical-align:middle;isolation:isolate}
.scene-portrait>img{display:block;position:absolute;inset:0;width:100%;height:100%;max-width:none;border:0;border-radius:0;object-fit:cover;object-position:75% 40%;transform:scale(1.7);transform-origin:58% 33%;margin:0;box-shadow:none}
.cozy-signature>.signature-portrait{width:72px;height:72px;border-radius:50%;border:3px solid #f5e7ce;transform:none;padding:0;flex-shrink:0}
.care-portrait{width:135px;height:135px;border-radius:43% 47% 40% 44%;border:4px solid #fff9ee;margin:6px 0 23px;box-shadow:0 4px 16px #97734517}
.home-scene{margin:0;align-self:center;width:100%;max-width:450px;min-width:0;padding:7px 7px 0;border:1px solid #ddceb3;background:#fffaf0;border-radius:17px;transform:rotate(1.3deg);box-shadow:0 10px 26px #97713d23;overflow:hidden}
.home-scene>img{display:block;width:100%;height:225px;object-fit:cover;object-position:63% 47%;border-radius:11px}
.home-scene figcaption{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px 6px 13px;color:#816849;font-size:10px;letter-spacing:.3px}
.home-scene figcaption span{font:italic 9px Georgia,serif;color:#8a7352;white-space:nowrap}
@media(max-width:1020px){.home-hero{grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:20px}.home-scene>img{height:215px;object-position:67% 47%}.home-scene figcaption{font-size:9px;padding-left:2px;padding-right:2px}.home-scene figcaption span{display:none}.care-portrait{width:120px;height:120px}}
@media(max-width:720px){.home-scene{margin-top:20px;align-self:stretch;max-width:none;transform:rotate(.7deg);padding:6px 6px 0;border-radius:13px}.home-scene>img{height:185px;border-radius:8px;object-position:64% 48%}.home-scene figcaption{font-size:10px;padding:11px 5px 12px}.home-scene figcaption span{display:block;font-size:8px}.care-portrait{width:111px;height:111px;margin-bottom:20px}.cozy-signature>.signature-portrait{width:65px;height:65px}}
