:root{--font:17px;--composer-h:58px;--safe-top:max(14px,env(safe-area-inset-top));--safe-bottom:max(12px,env(safe-area-inset-bottom));color:#f6f1f4;font-family:"Microsoft YaHei",sans-serif}*{box-sizing:border-box}html,body{margin:0;min-height:100%;overflow:hidden;background:#151215}button,input,textarea{font:inherit}button{color:inherit;cursor:pointer}.device{position:relative;width:100%;height:var(--viewport-height,100dvh);max-width:430px;margin:auto;overflow:hidden;background:#211b20}.screen{position:absolute;inset:0;isolation:isolate;overflow:hidden}.hidden{display:none!important}.scene-background,.phone-background{position:absolute;inset:0;z-index:-3;background:#251d20 center/cover no-repeat}.scene-background{background-image:linear-gradient(#0000,#0001),var(--page-scene)}.phone-background{background-image:linear-gradient(#110d1099,#110d1099),var(--page-scene)}.hero{position:absolute;z-index:-2;left:50%;top:calc(var(--safe-top) + 58px);width:112%;height:auto;transform:translateX(-50%);pointer-events:none}.topbar{height:calc(58px + var(--safe-top));padding:var(--safe-top) 12px 7px;display:flex;align-items:center;gap:9px;background:#1814199c;border-bottom:1px solid #ffffff28}.topbar h1{font:500 24px serif;letter-spacing:.08em;margin:0}.icon-button{width:44px;height:44px;display:grid;place-items:center;border:0;background:none}.top-actions{display:flex;gap:3px;margin-left:auto}svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.scene-meta{position:absolute;top:calc(var(--safe-top) + 66px);right:15px;display:grid;gap:4px;text-align:right;font-size:12px;text-shadow:0 2px 4px #000}.conversation{position:absolute;left:0;right:0;overflow:auto;overflow-x:hidden;padding:10px 16px;overscroll-behavior:contain}.face-conversation{bottom:calc(var(--composer-h) + 63px + var(--safe-bottom));max-height:28%;border-radius:20px 20px 0 0;border-top:1px solid #ffffff30;background:#181418a8}.phone-conversation{top:calc(var(--safe-top) + 64px);bottom:calc(var(--composer-h) + 63px + var(--safe-bottom));padding-top:22px;background:#140f1280}.message{display:flex;align-items:flex-end;gap:8px;margin:8px 0;max-width:100%}.message.mine{justify-content:flex-end}.avatar{width:40px;height:40px;flex:0 0 40px;object-fit:cover;border-radius:50%;border:1px solid #ffffff80;background:#806c74}.message-content{width:fit-content;flex:0 1 auto;min-width:0;max-width:min(78%,calc(100% - 48px))}.bubble{display:inline-block;width:fit-content;max-width:100%;min-width:0;padding:7px 11px;border:1px solid #ffffff38;border-radius:16px;background:#282328c9;box-shadow:0 2px 8px #0002;font-size:var(--font);line-height:1.3;white-space:pre-wrap;overflow-wrap:anywhere}.mine .bubble{border-radius:16px;background:#947782c2}.face-author{margin:0 0 2px;font-size:12px}.composer{position:absolute;z-index:4;left:12px;right:12px;bottom:calc(63px + var(--safe-bottom));display:flex;align-items:center;gap:8px;min-height:58px;padding:7px 9px 7px 14px;border:1px solid #ffffff38;border-radius:28px;background:#181419d8}.composer textarea{flex:1;resize:none;max-height:82px;border:0;outline:0;background:transparent;color:#fff;line-height:1.35}.composer button{width:40px;height:40px;flex:0 0 40px;display:grid;place-items:center;border:0;border-radius:50%;background:#5e5765}.bottom-nav{position:absolute;bottom:0;left:0;right:0;height:calc(63px + var(--safe-bottom));padding-bottom:var(--safe-bottom);display:flex;border-top:1px solid #ffffff28;background:#161216cb}.bottom-nav button{flex:1;display:grid;place-content:center;gap:2px;border:0;background:none;color:#d2c7cb}.bottom-nav svg{width:21px;height:21px}.bottom-nav span{font-size:12px}#saveStatus{position:absolute;z-index:3;bottom:calc(var(--composer-h) + 66px + var(--safe-bottom));right:17px;font-size:11px;color:#ded2d6}.text-back{display:flex;align-items:center;gap:2px;border:0;background:none;font-size:15px}.text-back svg{width:21px}.modal{position:fixed;z-index:10;inset:0;display:grid;place-items:center;padding:18px;background:#0009}.modal-card{position:relative;width:min(100%,410px);max-height:82dvh;overflow:auto;padding:23px;border:1px solid #ffffff35;border-radius:22px;background:#211b20}.modal-close{position:absolute;right:12px;top:7px;border:0;background:none;font-size:29px}.avatar-settings{display:flex;gap:9px}.avatar-setting{flex:1;border:1px solid #ffffff35;border-radius:12px;padding:8px;background:#322930;font-size:12px}.avatar-setting-preview{display:inline-grid;width:30px;height:30px;margin-right:5px;border-radius:50%;background:#866b75;vertical-align:middle}.font-setting{display:flex;gap:8px;align-items:center;margin:15px 0}.font-setting input{flex:1}.scene-picker{display:grid;grid-template-columns:repeat(2,1fr);gap:8px}.scene-choice{padding:0;overflow:hidden;border:1px solid #ffffff35;border-radius:10px;background:#30272d}.scene-choice img{width:100%;height:72px;object-fit:cover}.scene-choice span{display:block;padding:6px;font-size:11px}.upload-control{display:block;margin:12px 0;padding:9px;border:1px dashed #ffffff55;border-radius:10px;text-align:center}.upload-control input{display:none}.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:14px}.modal-actions button,.start-content button{padding:9px 14px;border:1px solid #ffffff55;border-radius:10px;background:#715662}.start-content{position:absolute;inset:0;display:grid;place-content:center;text-align:center;background:#120e1099}.start-content h1{font:500 46px serif;letter-spacing:.25em}.defs{position:absolute;width:0;height:0}@media(min-width:431px){body{display:grid;place-items:center}.device{height:min(var(--viewport-height,100dvh),880px);border-radius:27px}}@media(max-height:480px){.face-conversation{max-height:23%;top:auto}.hero{top:calc(var(--safe-top) + 54px)}.scene-meta{font-size:11px}}body.keyboard-open .bottom-nav{display:none}body.keyboard-open .composer{bottom:var(--safe-bottom)}body.keyboard-open .conversation{bottom:calc(var(--composer-h) + var(--safe-bottom))}

.ai-feedback{font-size:12px;line-height:1.4;color:#eadde2;text-align:right;padding:5px 8px;flex-shrink:0}
.ai-feedback button{margin-left:8px;padding:3px 9px;border:1px solid #bca3b0;border-radius:10px;background:#5d4a58;color:white;font:inherit}
/* Shared message proportions and visible mobile viewport. */
/* Only the initial scene is a default. Every scene thereafter supplies this
   one image variable to all full-screen layers, regardless of image dimensions. */
:root{--viewport-height:var(--full-viewport-height,100vh);--viewport-offset:0px;--scene-viewport-height:var(--viewport-height);--page-scene:url("../素材/场景/姜家住处/姜瓷青房间_定稿.png");--scene-edge-color:#211b20}
@supports(height:100dvh){:root{--viewport-height:var(--full-viewport-height,100dvh)}}
/* Artwork can extend beyond the stage, but focusing an input must not scroll it. */
@supports(overflow:clip){.device,.screen{overflow:clip}}
.message.mine .message-content{display:flex;align-items:flex-end;flex-direction:column}
html,body{height:100%;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Microsoft YaHei",sans-serif}
body{background:radial-gradient(ellipse at top,#34292f,#100e10)}
.device{box-shadow:0 20px 80px #0008}
.topbar{-webkit-backdrop-filter:none;backdrop-filter:none}
.topbar h1{white-space:nowrap}
.icon-button,.text-back,.modal-close{min-height:44px;min-width:44px}
.phone-header{justify-content:space-between;gap:4px}
.phone-header h1{font-size:22px;flex-shrink:0}
.text-back{padding:0;font-size:14px;white-space:nowrap}
.scene-meta b{font-size:12px;font-weight:500}
.conversation{scrollbar-width:thin;padding-bottom:30px}



.avatar{display:grid;place-items:center;overflow:hidden;padding:0;color:#f4e8ed;font-size:19px;cursor:pointer}
.avatar img,.avatar-setting-preview img{width:100%;height:100%;object-fit:cover;display:block}
.default-avatar{display:block;width:100%;height:100%;background:none}
.avatar-setting-preview{overflow:hidden;place-items:center;background:#fff}
.composer textarea{min-width:0;width:100%;font-size:16px;overflow-y:auto}
.composer textarea::placeholder{color:#b9adb3}
.composer button{min-width:44px;min-height:44px}
.bottom-nav button{min-height:48px;font-size:12px}
.bottom-nav button[data-panel=today]{color:#f4e2d6}
#saveStatus{pointer-events:none;max-width:calc(100% - 80px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-shadow:0 1px 3px #000}
.retry-save{position:absolute;z-index:5;bottom:calc(var(--composer-h) + 63px + var(--safe-bottom));left:16px;font-size:12px;min-height:30px;border:1px solid #d8b3c0;border-radius:8px;background:#57414a;padding:3px 8px}
.save-error{color:#ffd5df!important}
.empty{color:#c9bac1;text-align:center;padding:35px 12px;font-size:14px;line-height:1.7}
.empty p{color:#f1e6eb;margin:0 0 8px;font-size:18px}
.empty span{font-size:13px}
.modal-card{box-shadow:0 20px 60px #0007;max-height:calc(var(--viewport-height,100dvh) - 36px)}
.modal-card h2{padding-right:26px;font-size:22px;font-weight:500;margin:0 0 18px}
.modal-close{top:5px;right:5px}
.modal-card p,.panel-hint{font-size:13px;color:#c8b9c1;line-height:1.6}
.scene-choice{cursor:pointer;text-align:left}
.scene-choice img{display:block}
.scene-choice.selected{outline:2px solid #d5b5c2;outline-offset:-2px}
.font-setting{font-size:14px}
.font-setting input{min-width:30px}
.font-setting output{width:35px;font-size:12px}
.diary-area{width:100%;min-height:210px;resize:vertical;padding:12px;margin-top:10px;color:#fff;background:#161216;border:1px solid #ffffff32;border-radius:12px;font-size:16px;line-height:1.6}
.save-row{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-top:12px;font-size:12px}
.save-row button{padding:10px 14px;border:1px solid #d9bac3;border-radius:10px;background:#785a67}
#cropModal .modal-actions{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px} #cropModal .modal-actions button{min-width:0;min-height:44px;padding:8px 4px;font-size:14px}
#cropModal label:not(.upload-control){display:flex;align-items:center;gap:10px;font-size:14px}
#cropModal input[type=range]{flex:1;min-width:20px}
button:disabled{opacity:.5;cursor:wait}
button:focus-visible,input:focus-visible,textarea:focus-visible{outline:2px solid #e4cbd5;outline-offset:3px}
body.keyboard-open #saveStatus{bottom:calc(var(--composer-h) + var(--safe-bottom) + 3px)}
body.keyboard-open .retry-save{bottom:calc(var(--composer-h) + var(--safe-bottom))}
body.compact-height .hero{width:min(104%,calc(var(--viewport-height) * .72));top:calc(var(--safe-top) + 58px)}
body.compact-height .face-conversation{max-height:20%;padding-top:5px}
body.compact-height .scene-meta{font-size:10px;gap:2px;max-width:220px}
body.compact-height .scene-meta b{font-size:10px}
@media(max-width:430px){.device{position:fixed;left:50%;top:var(--viewport-offset,0px);transform:translateX(-50%)}}
@media(min-width:431px){body{min-height:100dvh}.device{height:min(var(--viewport-height,100dvh),880px)}}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}

/* Face view: one continuous translucent dock over the full-height scene. */
.device{--stage-height:min(var(--viewport-height,100dvh),880px);--scene-height:min(var(--scene-viewport-height,var(--viewport-height,100dvh)),880px);--face-inset-top:env(safe-area-inset-top,0px);--face-inset-bottom:env(safe-area-inset-bottom,0px)}
/* Full-length artwork continues below the viewport instead of ending at the thighs.
   Its height follows the scene, so opening the keyboard pulls the camera back. */
#scenePage .hero{top:calc(var(--face-inset-top) + 40px);width:auto;max-width:none;height:calc((var(--scene-height) - var(--face-inset-top) - var(--face-inset-bottom) - 40px) * 1.48)}
#scenePage .topbar{position:relative;z-index:2;height:calc(46px + var(--face-inset-top));padding:var(--face-inset-top) 8px 0;gap:3px;background:#211b201c;border-bottom:1px solid #ffffff20;backdrop-filter:none;text-shadow:0 1px 5px #000b}
#scenePage .topbar h1{font-size:19px;letter-spacing:.05em}
#scenePage .topbar svg{width:21px;height:21px}
#scenePage .top-actions{gap:0}
#scenePage .scene-meta{top:calc(var(--face-inset-top) + 56px);right:12px;max-width:70%;gap:3px;font-size:10px;line-height:1.4;text-shadow:0 1px 4px #000,0 0 8px #0008}
#scenePage .scene-meta b{font-size:10px}
.face-dock{position:absolute;z-index:3;inset:auto 0 0;display:flex;flex-direction:column;padding-bottom:var(--face-inset-bottom);border:1px solid #ffffff26;border-bottom:0;border-radius:16px 16px 0 0;background:rgba(30,26,30,.65);box-shadow:0 -2px 12px #0001;overflow:hidden}
#faceDock .face-conversation{position:relative;inset:auto;flex:0 1 auto;height:auto;min-height:50px;max-height:min(300px,calc(var(--stage-height) * .38));margin:0;padding:5px 14px;border:0;border-radius:0;background:transparent;scrollbar-width:none;scroll-padding:5px;touch-action:pan-y}
#faceDock .face-conversation::-webkit-scrollbar{display:none}
#faceDock .message{margin:3px 0;gap:8px}
#faceDock .avatar{width:36px;height:36px;flex-basis:36px;font-size:18px}
#faceDock .face-author{font-size:11px;line-height:1.2;color:#e0d5db;margin-bottom:3px}
#faceDock .bubble{background:#514b529c;box-shadow:none;border-color:#ffffff22}
#faceDock .mine .bubble{background:#88747fad}
#faceDock .composer{position:relative;inset:auto;flex:none;margin:0 10px 4px;min-height:44px;padding:0;gap:7px;border:0;border-radius:0;background:transparent}
#faceDock .composer textarea{padding:4px 2px;max-height:82px;line-height:1.35;border-bottom:1px solid #ffffff38;border-radius:0}
#faceDock .composer button{width:44px;height:44px;flex-basis:44px;border:0;border-radius:0;background:transparent;padding:0}
#faceDock .composer button svg{width:22px;height:22px}
#faceDock .bottom-nav{position:relative;inset:auto;flex:none;height:48px;padding:0;border-top:1px solid #ffffff1f;background:transparent}
#faceDock .bottom-nav button{min-height:48px;gap:2px}
#faceDock .bottom-nav svg{width:20px;height:20px}
#faceDock .bottom-nav span{font-size:11px}
/* Save notices float briefly, and errors remain visible with the retry control. */
#saveStatus{z-index:6;top:calc(env(safe-area-inset-top,0px) + 104px);bottom:auto;right:12px;max-width:calc(100% - 84px);padding:5px 9px;border-radius:8px;background:#231b23d9;font-size:11px;line-height:1.5;white-space:normal}
#saveStatus:empty{display:none}
.retry-save{z-index:7;top:calc(env(safe-area-inset-top,0px) + 104px);bottom:auto;left:12px}
body.keyboard-open #saveStatus{bottom:auto}
body.keyboard-open .retry-save{bottom:auto}
body.keyboard-open #faceDock .conversation{inset:auto;height:auto;min-height:50px;max-height:min(180px,calc(var(--stage-height) * .34))}
body.keyboard-open #faceDock .composer{inset:auto;margin-bottom:6px}
body.keyboard-open #faceDock{padding-bottom:0}
body.compact-height #scenePage .scene-meta{gap:1px}
@media(max-width:430px){.device{--stage-height:var(--viewport-height,100dvh)}}

/* Phone view uses one background plane, including beneath both toolbars. */
#phonePage{--phone-top:calc(52px + env(safe-area-inset-top,0px));--phone-nav:calc(56px + env(safe-area-inset-bottom,0px))}
#phonePage .phone-header{height:var(--phone-top);padding:env(safe-area-inset-top,0px) 12px 0;background:transparent;border:0;backdrop-filter:none;text-shadow:0 1px 5px #0009}
#phonePage .phone-header h1{font-size:21px}
#phonePage .phone-conversation{top:var(--phone-top);bottom:calc(var(--composer-h) + var(--phone-nav) + 10px);padding:14px 16px 12px;background:transparent;border:0}
#phonePage .composer{bottom:calc(var(--phone-nav) + 6px);min-height:44px;padding:0;background:transparent;border:0;border-radius:0}
#phonePage .composer textarea{padding:4px 2px;border-bottom:1px solid #ffffff38;border-radius:0}
#phonePage .composer button{width:44px;height:44px;flex-basis:44px;padding:0;border-radius:0;background:transparent}
#phonePage .bottom-nav{height:var(--phone-nav);padding-bottom:env(safe-area-inset-bottom,0px);background:transparent;border:0}
body.keyboard-open #phonePage .composer{bottom:7px}
body.keyboard-open #phonePage .phone-conversation{bottom:calc(var(--composer-h) + 11px)}
.sync-conflict{border:1px solid #ffffff30;border-radius:10px;padding:10px;margin:12px 0}
.sync-conflict label{display:block;margin:8px 0;font-size:14px}
.conflict-text{white-space:pre-wrap;overflow-wrap:anywhere;max-height:150px;overflow:auto;font:inherit;padding:10px;background:#ffffff08}
.conflict-avatar{display:block;width:64px;height:64px;object-fit:cover;border-radius:50%;margin:8px}
#applySyncChoices{padding:10px 14px;border:1px solid #ffffff40;border-radius:10px;background:#715662}
.save-settings{display:flex;align-items:center;flex-wrap:wrap;gap:10px;padding:14px;margin-bottom:20px;border:1px solid #ffffff26;border-radius:12px;background:#ffffff06}
.save-settings>div{flex:1 1 180px}
.save-settings p{margin:0;line-height:1.6}
.save-settings #lastSavedAt{font-size:13px;color:#f3e9ef}
.save-settings #syncDetail{font-size:12px;margin-top:4px;color:#bbaeb5}
.save-settings button,.reset-settings button{min-height:44px;padding:8px 12px;border:1px solid #ffffff35;border-radius:10px;background:#59434f;font-size:14px}
.has-unsynced{position:relative}
.has-unsynced::after{content:'';position:absolute;right:7px;top:8px;width:6px;height:6px;border-radius:50%;background:#e2b987}
.reset-settings{display:flex;align-items:center;justify-content:space-between;gap:12px;border-top:1px solid #ffffff20;margin-top:22px;padding-top:18px}
.reset-settings h3{font-size:14px;font-weight:500;margin:0}
.reset-settings p{font-size:12px;margin:5px 0 0}
.reset-settings button{flex-shrink:0;background:transparent;color:#dcb8c4}
#resetError{color:#efbecb;min-height:0}

/* The latest message grows naturally; only very long messages scroll.
   Expanded history keeps its own larger viewport, including with a keyboard. */
#faceDock:not(.is-expanded) .face-author{display:none}
#faceDock.is-expanded .face-conversation{height:min(360px,calc(var(--stage-height) * .44));max-height:none}
#faceDock .composer .conversation-toggle{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0;color:#e0d5db}
#faceDock .conversation-toggle svg{width:16px;height:16px}
#faceDock .conversation-toggle span{font-size:12px;line-height:16px}
#faceDock.is-expanded .conversation-toggle svg{transform:rotate(180deg)}
body.keyboard-open #faceDock.is-expanded .face-conversation{height:min(240px,calc(var(--stage-height) * .42));max-height:none}
/* Artwork and controls both track the actual visible viewport. */
#sceneBackground,#phoneBackground{height:var(--scene-height);bottom:auto}
.face-dock{padding-left:env(safe-area-inset-left,0px);padding-right:env(safe-area-inset-right,0px)}
#scenePage .topbar{padding-left:max(8px,env(safe-area-inset-left,0px));padding-right:max(8px,env(safe-area-inset-right,0px))}
#phonePage .phone-header{padding-left:max(12px,env(safe-area-inset-left,0px));padding-right:max(12px,env(safe-area-inset-right,0px))}
.modal{top:var(--viewport-offset,0px);bottom:auto;height:var(--viewport-height,100dvh)}
@media(max-width:600px){
  html{background:var(--scene-edge-color,#514138)}
  body{display:block;min-height:0;background:var(--page-scene) center/cover no-repeat;background-color:var(--scene-edge-color,#514138)}
  .device{position:fixed;left:50%;top:var(--viewport-offset,0px);transform:translateX(-50%);width:100%;max-width:none;height:var(--viewport-height,100dvh);border-radius:0;box-shadow:none;--stage-height:var(--viewport-height,100dvh);--scene-height:var(--scene-viewport-height,var(--viewport-height,100dvh))}
}

/* Fill the web viewport; the system status/address bars remain owned by Safari. */
@media(max-width:600px){.device{background:transparent}}
@media(display-mode:standalone){
  /* Keep the document canvas in normal flow, as in the working fullscreen1
     layout. Only the game stage is fixed; fixing both roots clips iOS edges. */
  html,body{width:100%;height:100%;min-height:var(--full-viewport-height,100dvh)}
  html{background:var(--scene-edge-color,#514138)}
  body{background:var(--page-scene) center/cover no-repeat;background-color:var(--scene-edge-color,#514138)}
  .device{position:fixed;inset:var(--viewport-offset,0px) 0 auto;width:100%;max-width:none;height:var(--viewport-height,100dvh);transform:none;border-radius:0;box-shadow:none;--stage-height:var(--viewport-height,100dvh);--scene-height:var(--scene-viewport-height,var(--viewport-height,100dvh))}
  /* Give the fixed viewport a real scene backing instead of a transparent edge.
     Keep the same cover crop as the foreground scene, also during keyboard resize. */
  .device{background:var(--page-scene) center/cover no-repeat;background-color:var(--scene-edge-color,#514138)}
  /* One sharp scene fills the viewport, including both safe areas.
     Insets protect the controls only; they never shrink the background. */
  .scene-background,.phone-background{pointer-events:none}
}
body.keyboard-open .device{--face-inset-bottom:0px}
.home-screen-help{border-top:1px solid #ffffff20;margin-top:18px;padding-top:16px}
.home-screen-help summary{min-height:44px;display:flex;align-items:center;font-size:14px;cursor:pointer}
.home-screen-help p{margin:4px 0;font-size:13px;line-height:1.7}
.display-help{border-top:1px solid #ffffff20;margin-top:18px;padding-top:16px}
.display-help summary{min-height:44px;display:flex;align-items:center;font-size:14px;cursor:pointer}
.display-help p{margin:4px 0;font-size:13px;line-height:1.7}
.display-help button{margin-top:10px;padding:7px 10px;border:1px solid #ffffff30;border-radius:8px;background:#ffffff0d;color:inherit;font:inherit}
#displayResult{display:block;margin-top:10px;font-size:12px;line-height:1.7;overflow-wrap:anywhere;user-select:text;-webkit-user-select:text}
#displayResult[hidden],#copyDisplay[hidden]{display:none}
@media(display-mode:standalone){.home-screen-help{display:none}}

/* FS7: keep roots in normal flow but prevent focus/bfcache from scrolling them. */
html,body{overscroll-behavior:none;scroll-behavior:auto}
@supports(overflow:clip){html,body{overflow:clip}}
.defs{top:0;left:0}
