* {box-sizing:border-box}
:root {color-scheme:light;color:#50483c;-webkit-text-size-adjust:100%;text-size-adjust:100%;font-family:"LXGW WenKai",serif}
body {margin:0;min-height:100vh;min-height:100svh;background:radial-gradient(ellipse at center,#f7f1e3,#e0dfcd);display:grid;place-items:center}
button {font:inherit;color:inherit;cursor:pointer;-webkit-tap-highlight-color:transparent}
button:focus-visible {outline:3px solid #696f50;outline-offset:3px}
[hidden] {display:none!important}
#home {position:relative;width:min(100vw,calc(100svh * 393 / 852),450px);aspect-ratio:393/852;overflow:hidden;isolation:isolate;background:#e1e6d5 center / 100% 100% no-repeat;container-type:inline-size;user-select:none;-webkit-user-select:none;touch-action:manipulation}
@media (min-width:600px) {#home {border-radius:22px;box-shadow:0 8px 38px #71634338}}
@media (max-width:599px) and (orientation:portrait) {#home {width:min(100vw,calc(100svh * .54));height:100svh;aspect-ratio:auto}}
header {position:absolute;top:max(6.6%,env(safe-area-inset-top));left:7.4%;right:7.4%;display:flex;align-items:center;justify-content:space-between}
h1 {margin:0;font-family:inherit;font-weight:500;font-size:clamp(25px,8cqw,37px);letter-spacing:.055em}
header p {margin:.5em 0 0;color:#67604f;font-size:clamp(12px,3.6cqw,16px);letter-spacing:.1em}
#closet {border:1px solid #b8ad92;background:#f0e7d1;border-radius:50%;width:13cqw;min-width:44px;min-height:44px;aspect-ratio:1;box-shadow:inset 0 0 4px #977c5533,0 2px 3px #63553e20;padding:2px}
#closet img {width:100%;display:block}
#pet {position:absolute;left:8%;width:84%;bottom:39.8%;aspect-ratio:248/172;padding:0;border:0;background:transparent;touch-action:none;-webkit-touch-callout:none}
canvas {width:100%;height:100%;display:block;transform-origin:50% 94%;pointer-events:none}
#tray {position:absolute;top:69.2%;left:5%;right:5%;text-align:center}
#status {margin:0;font-size:clamp(16px,5.1cqw,22px);font-weight:500;letter-spacing:.06em}
#hint {font-family:inherit;margin:.6em 0 0;font-size:clamp(12px,3.35cqw,15px);color:#6a6051;line-height:1.45}
.actions {display:flex;justify-content:space-around;margin-top:6.2cqw}
.tool {display:grid;justify-items:center;gap:2.1cqw;background:none;border:0;padding:0 2px;touch-action:none;user-select:none;-webkit-touch-callout:none}
.pad {width:18cqw;aspect-ratio:1.12;display:grid;place-items:center;border-radius:48% 52% 47% 50%;background:radial-gradient(ellipse at 40% 33%,#e8e1c7 1%,#ded2ac 89%);box-shadow:inset 0 -3px 5px #80674018,0 1px 2px #695b4215;outline:1px dashed #bcae89;outline-offset:-4px}
.tool[data-tool=hand] .pad {background:radial-gradient(ellipse at 40% 30%,#f2d8bf,#e7bea8);outline-color:#c4a28c}
.tool[data-tool=quilt] .pad {background:radial-gradient(ellipse at 40% 30%,#dce0c3,#c4ccad);outline-color:#9ba785}
.tool img {width:75%;display:block;pointer-events:none}
.tool b {font-size:clamp(15px,4.3cqw,19px);font-weight:500}
.tool[aria-pressed=true] .pad {outline:2px solid #7f876b;transform:translateY(-3px)}
#prop {position:fixed;left:0;top:0;width:64px;height:55px;object-fit:contain;z-index:4;pointer-events:none;filter:drop-shadow(0 3px 2px #67574136)}
#wardrobe {position:absolute;z-index:5;bottom:max(3.2%,env(safe-area-inset-bottom));left:3.5%;right:3.5%;border:1px solid #c1ae8f;border-radius:17px;background:#f7eedc;box-shadow:0 4px 18px #67533d39;padding:10px}
#wardrobe header {position:static;display:flex;margin:0 3px 8px} h2 {margin:0;font-size:20px;font-weight:500}
#close {border:0;background:none;padding:8px;min-height:44px;font-size:15px}
#looks {display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px}
.look {position:relative;padding:4px 0 7px;border:1px dashed #b8a98f;border-radius:10px;background:#fbf5e8;font-size:clamp(11px,3.1cqw,14px)}
.look img {width:100%;display:block}
.look[aria-pressed=true] {background:#dce3ce;border:1px solid #7f8c73}
.look[aria-pressed=true]::after {content:"✓";position:absolute;right:3px;top:0;color:#677b58}
@media (prefers-reduced-motion:reduce) {* {scroll-behavior:auto!important}}
#gauges {position:absolute;top:18.2%;left:7.4%;right:7.4%;display:flex;gap:5%;font-size:clamp(12px,3.4cqw,15px)}
#gauges label {flex:1;color:#645a4e} #gauges span {font:12px "LXGW WenKai",serif}
#gauges progress {display:block;width:100%;height:5px;margin-top:5px;border:0;border-radius:5px;background:#cfcab6;appearance:none}
progress::-webkit-progress-bar {background:#d0cbb9;border-radius:5px} progress::-webkit-progress-value {background:var(--fill);border-radius:5px} progress::-moz-progress-bar {background:var(--fill)}
#fullness {--fill:#bf8775} #energy {--fill:#879878} #bond {--fill:#b29093}
#growth-button {border:1px dashed #ac997e;border-radius:13px;background:#f3e9d5;padding:5px 12px;font:inherit}

.home-books {position:absolute;bottom:max(1.2%,env(safe-area-inset-bottom));left:0;right:0;display:flex;align-items:center;justify-content:center;gap:10px}
.home-books button {padding:5px 13px;min-height:42px;font-size:15px;border:1px dashed #ac997e;border-radius:13px;background:#f3e9d5}
.home-books #journal-button {background:#dce3d1;border-color:#98a28b}

#growth {position:absolute;z-index:6;bottom:2.5%;left:3.5%;right:3.5%;padding:14px 16px;border:1px solid #beaa8e;border-radius:18px;background:#f7eedc;box-shadow:0 4px 18px #67533d39}
.book-head {display:flex;align-items:center;justify-content:space-between;margin-bottom:8px}
#growth-close {border:0;background:none;min-height:40px;font-size:15px} #growth p {font-size:14px;line-height:1.4;margin:7px 0 12px} .sample-label {border-top:1px dashed #beaa8e;padding-top:12px} .samples {display:grid;grid-template-columns:1fr 1fr;gap:6px} .samples button {min-height:36px}
#tray {top:68.6%} .actions {margin-top:4.8cqw}
@media(max-height:650px){.actions{margin-top:2.5cqw}.pad{width:15cqw}#growth-button{min-height:32px;bottom:1%}#tray{top:68%}}

#home-title {max-width:66cqw;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.paper {color:#59483f;width:min(87vw,345px);max-height:90svh;overflow:auto;border:1px solid #b7a28e;border-radius:19px;padding:9px;background:#f6ebd8;box-shadow:0 12px 45px #4b41493d;text-align:center}
.paper::backdrop {background:#5c50534d;backdrop-filter:blur(2px)}
.paper form,.card {padding:15px 19px 19px;border:1px dashed #c7af90;border-radius:12px}
.paper h2 {font-size:24px;letter-spacing:.04em;margin:5px 0 13px}
.shore {height:100px;display:grid;align-items:end;justify-items:center;background:url('art/dusk-bay.webp') center 44%/100% auto;border-radius:65% 35% 43% 40% / 35% 45% 45% 35%;margin:0 4px 15px}
.shore img {width:122px}
.paper label {display:block;text-align:left;font-size:15px;margin:0 0 7px}
.paper input {width:100%;min-height:44px;padding:8px 12px;border:1px solid #b5a18c;border-radius:8px;background:#fff8e8;color:#463c35;font:inherit;font-size:16px}
.paper-button {background:#ead6bd;border:1px solid #b59a83;border-radius:13px;color:#53473b;padding:9px 18px;min-height:44px;font:inherit}
#adopt-form button {width:100%;margin-top:15px;background:#d4d8bf;border-color:#a8ad93}
#shell {position:absolute;z-index:2;left:20%;bottom:35%;background:none;border:0;padding:2px;display:grid;justify-items:center;animation:push-ashore 1.45s ease-out both}
#shell img {width:clamp(53px,16cqw,72px);margin-bottom:-7px;filter:drop-shadow(0 2px 2px #6d534b36)}
#shell span {background:#fbefd9;color:#695246;border-radius:12px;border:1px dashed #ae8e79;font-size:13px;padding:3px 9px}
.return-to-shore {animation:swim-ashore 1.45s ease-out both}
@keyframes swim-ashore {0%{transform:translate(48%,-12%) rotate(5deg);opacity:.2}48%{transform:translate(14%,-4%) rotate(-2deg)}100%{transform:none;opacity:1}}
@keyframes push-ashore {0%{transform:translate(130%,-22%) rotate(16deg);opacity:.3}50%{transform:translate(60%,-10%) rotate(11deg)}100%{transform:none;opacity:1}}
.card {background:radial-gradient(ellipse at 80% 15%,#f4e3cb,transparent 58%);position:relative}
.card::before {content:"";position:absolute;right:14px;top:18px;width:48px;height:48px;background:url('art/shell.png') center/contain;transform:rotate(12deg)}
.card-seal {width:150px;max-width:80%}
#card-name {display:block;font-size:21px;overflow-wrap:anywhere;font-weight:500}
.card dl {margin:12px auto 20px;max-width:240px;border-top:1px dashed #c0ab91}
.card dl div {display:flex;justify-content:space-between;font-size:15px;padding:8px 0;border-bottom:1px dashed #c0ab91}
.card dd {margin:0}
#growth {max-height:78svh;overflow:auto}
@media(max-height:560px){.shore{height:64px}.shore img{width:84px}}
@media(prefers-reduced-motion:reduce){#shell,.return-to-shore {animation:none}}

#journal {width:min(92vw,400px);max-height:85svh;overflow:auto;overscroll-behavior:contain;padding:0;border:1px solid #a9987e;border-radius:12px 18px 18px 12px;color:#51463c;background:linear-gradient(90deg,#dad0b7 0,#efe7d4 6px,#faf3e4 14px,#f7efdd 96%,#eadfc8);box-shadow:1px 3px 0 #c6b99d,0 10px 38px #4b41493d;text-align:left}
#journal::backdrop {background:#504b494f;backdrop-filter:blur(2px)}
.journal-head {display:flex;align-items:center;justify-content:space-between;gap:12px;margin:18px 18px 12px 23px}
#journal-date {margin:0 0 2px;color:#756958;font-size:13px}.journal-head h2 {font-size:26px;letter-spacing:.08em}
#journal button {min-height:42px}
#journal-close,.entry-foot button,.journal-actions button:not(.ink-button),.clock-buttons button:not(.ink-button) {border:0;background:transparent;color:#625444;padding:5px 9px}
.journal-tabs {display:flex;padding:0 14px 0 20px;gap:5px;border-bottom:1px solid #c7b498}
.journal-tabs button {flex:1;border:1px solid #c7b498;border-bottom:none;border-radius:10px 10px 0 0;background:#eee2cd;font-size:15px}
.journal-tabs button[aria-pressed=true] {background:#dbe2cb;box-shadow:inset 0 3px #929e80}
.journal-content {padding:16px 17px 16px 22px}
#journal label {display:block;margin-bottom:7px;font-size:16px}
#journal input,#journal textarea {font:inherit;font-size:16px;color:inherit;background:#fff9ec;border:1px solid #b9a78d;border-radius:8px;padding:9px;width:100%;min-width:0;user-select:text;-webkit-user-select:text}
#journal textarea {resize:vertical;line-height:1.55;background:repeating-linear-gradient(to bottom,#fff9ed 0 24px,#e9dfca 24px 25px);background-position:0 9px}
.journal-actions,.clock-buttons {display:flex;gap:4px;justify-content:flex-end;align-items:center;flex-wrap:wrap}
.journal-actions {margin:7px 0 12px}
.ink-button,.stamp {border:1px solid #93a086;border-radius:12px;background:#dce4cc;padding:7px 13px}
.entries {list-style:none;padding:0;margin:12px 0 0}
.entries li {padding:10px 2px 4px;border-top:1px dashed #c9b79c;overflow-wrap:anywhere}
.entries p {margin:0;white-space:pre-wrap;line-height:1.5}
.entry-foot {display:flex;align-items:center;gap:4px}
.entry-foot time,.entry-foot small {margin-right:auto;font-size:13px;color:#726453}
.entry-foot button {font-size:14px}
#page-focus {text-align:center}
#clock-face {display:grid;place-items:center;width:min(48vw,185px);aspect-ratio:1;margin:0 auto 12px;padding:5px;border-radius:50%;background:#b1b99e}
.clock-inner {width:100%;height:100%;border-radius:50%;display:flex;align-items:center;justify-content:center;flex-direction:column;background:#fcf4e3}
#clock-phase {font-size:14px;margin-top:4px}
#clock-time {font:normal clamp(32px,10vw,46px)/1.12 "LXGW WenKai",serif;font-variant-numeric:tabular-nums;color:#535c47}
#study-seal {width:42%;height:auto}
#clock-face.studying img {animation:study-breath 3.2s ease-in-out infinite alternate;transform-origin:center bottom}
@keyframes study-breath {to{transform:scale(1.035,.955) rotate(-2deg)}}
@media(prefers-reduced-motion:reduce){#clock-face.studying img{animation:none}}
.clock-buttons {justify-content:center}
#clock-caption {margin:6px 0 12px}#clock-count {margin:12px 0 0;font-size:14px;color:#716656}
.habit-input,.habit-row {display:flex;align-items:center;gap:8px}
.habit-input button,.stamp {white-space:nowrap}.habit-row{justify-content:space-between}.habit-row strong{font-weight:500}.stamp{background:#f6ebd6;border-style:dashed}
.stamp[aria-pressed=true]{background:#dce4cc;border-style:solid}
.week {display:grid;grid-template-columns:repeat(7,1fr);gap:5px;margin:9px 0 0}
.week span {display:grid;place-items:center;margin:auto;border:1px dashed #bfb29a;border-radius:50%;font-size:13px;color:#776852;width:28px;height:28px}
.week .stamped {background:#e1ac99;color:#51382f;border:2px double #966454;font-weight:bold}
#journal-status {font-size:14px;color:#6c5848;margin:9px 0 0}#journal-status:empty {display:none}


#clock-progress {width:min(58%,178px);height:6px;display:block;margin:0 auto 13px;accent-color:#859478;--fill:#859478;border:0;border-radius:5px;overflow:hidden}
