/* Home is a top-level destination, never the empty state of a conversation. */
.home-page{display:flex;flex-direction:column;align-items:center;justify-content:center;padding:30px;overflow:auto}.home-page #welcome{display:flex;flex:none;width:100%;min-height:0;background:none;padding:0 16px 18px;overflow:visible}.home-page .home-roles-link{min-height:44px;padding:10px 20px;font-size:13px}.home-page #hello.home-greeting{color:#000!important;text-shadow:none!important;width:clamp(165px,19vw,210px)}
:root[data-theme=dark] .home-page #hello.home-greeting{background:#f4f2f8;border-radius:20px;padding:4px 12px}
#chat-home{min-height:40px;padding:8px 12px;border:1px solid var(--line);border-radius:10px;white-space:nowrap;font-size:12px}
@media(max-width:1099px){.app .mobile-nav{grid-template-columns:repeat(5,1fr);gap:4px}.home-page{padding:22px 14px}.mobile-nav button{font-size:10px}.mobile-nav button .ui-icon{width:21px;height:21px}}
@media(max-height:700px){.home-page #dream-scene{height:160px;width:220px}.home-page #hello.home-greeting{width:145px}}

/* Dedicated character conversation surface, separate from the homepage. */
#detail[data-chat-kind=character] #welcome{display:none!important}
.character-chat-opening{max-width:580px;margin:clamp(18px,7vh,70px) auto 30px;display:flex;flex-direction:column;align-items:center;text-align:center;gap:14px}
.chat-opening-avatar{width:78px;height:78px;border-radius:26px;display:grid;place-items:center;background:var(--accent-soft);color:var(--accent);font-size:30px;overflow:hidden;border:1px solid var(--line)}.chat-opening-avatar img{width:100%;height:100%;object-fit:cover}
.character-chat-opening h1{font-size:23px;font-weight:550;margin:0;color:var(--ink)}.chat-opening-label{color:var(--muted);font-size:12px;margin:0}
.character-chat-opening .bubble{align-self:stretch;text-align:left;margin-top:16px;padding:18px 22px;background:var(--surface-soft);border:1px solid var(--line);border-radius:4px 20px 20px 20px;font-size:16px;line-height:1.8}
@media(max-width:600px){.character-chat-opening{margin-top:28px}.chat-opening-avatar{width:64px;height:64px;border-radius:22px}.character-chat-opening .bubble{padding:16px 18px}}
/* Dreamer / dream study. Semantic surfaces; quiet content, dimensional controls. */
:root{color-scheme:light;--canvas:#f4f2f8;--surface:#fff;--surface-soft:#f6f4fa;--surface-raised:#fff;--ink:#25243a;--muted:#625d75;--line:#dcd7e8;--accent:#6750b5;--accent-hover:#56409f;--on-accent:#fff;--accent-soft:#ece7f7;--positive:#347b70;--danger:#b33e55;--nav-glass:rgba(248,246,252,.9);--modal-glass:rgba(255,255,255,.97);--shadow:0 8px 30px #30254a08,0 1px 3px #30254a08;--shadow-float:0 24px 80px #21133b26,0 4px 16px #21133b12;--blue:var(--accent);--text:var(--ink);--quiet:var(--muted);--edge:var(--line);--ease:cubic-bezier(.22,.76,.24,1);--drawer:280px}
:root[data-theme=dark]{color-scheme:dark;--canvas:#141322;--surface:#211f33;--surface-soft:#29263d;--surface-raised:#302c45;--ink:#f2effa;--muted:#bcb5ce;--line:#48405e;--accent:#b7a2ef;--accent-hover:#c7b6f4;--on-accent:#241638;--accent-soft:#39304f;--positive:#8ad0bf;--danger:#ff9eb0;--nav-glass:rgba(28,25,44,.94);--modal-glass:rgba(33,31,51,.98);--shadow:0 8px 30px #0002,0 1px 3px #0002;--shadow-float:0 24px 80px #0006,0 4px 16px #0004}
*{scrollbar-width:thin;scrollbar-color:var(--line) transparent}body{background:var(--canvas);color:var(--ink);font-family:-apple-system,BlinkMacSystemFont,'PingFang SC','Microsoft YaHei',sans-serif;font-size:15px}button,input,select,textarea{font:inherit}button{touch-action:manipulation}button:not(:disabled){transition:background-color 160ms ease,color 160ms ease,border-color 160ms ease,box-shadow 200ms ease}button:disabled{opacity:.48;cursor:not-allowed}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible,a:focus-visible{outline:3px solid var(--accent);outline-offset:4px}h1,h2,h3,p{overflow-wrap:anywhere}h1,h2,h3{text-wrap:balance}.ui-icon{display:inline-flex;flex:0 0 auto;width:22px;height:22px;vertical-align:middle}.ui-icon svg{width:100%;height:100%;display:block}.skip-link{position:fixed;left:16px;top:-60px;z-index:1000;padding:12px 20px;border-radius:12px;background:var(--accent);color:var(--on-accent)}.skip-link:focus{top:12px}
#app{height:var(--app-height,100dvh);background:var(--canvas);max-width:1920px;margin:auto}#detail,#memory-page{background:var(--surface);color:var(--ink)}#detail{border:1px solid var(--line);box-shadow:var(--shadow)}#drawer{background:var(--nav-glass);color:var(--ink);backdrop-filter:blur(22px);padding:26px 18px 20px}.drawer-head{margin:0 8px 22px}.brand{display:inline-flex;align-items:center;gap:9px;text-decoration:none;color:var(--ink)}.brand img{width:32px;height:32px;object-fit:cover;border-radius:50%;mix-blend-mode:multiply}.brand strong{font-family:Georgia,'Times New Roman',serif;font-size:27px;font-weight:500;letter-spacing:-1px}:root[data-theme=dark] .brand img{mix-blend-mode:normal}.desktop-nav{display:grid;gap:6px;margin-bottom:26px}.desktop-nav button{display:flex;gap:13px;align-items:center;background:transparent;border:1px solid transparent;color:var(--muted);padding:12px 16px;text-align:left;min-height:46px;border-radius:13px;font-size:14px}.desktop-nav button:hover{background:var(--surface-soft);color:var(--ink)}.desktop-nav button.is-active{background:var(--surface);border-color:var(--line);box-shadow:var(--shadow);color:var(--accent);font-weight:600}.sidebar-label{font-size:12px;color:var(--muted);margin:0 13px 12px}#drawer .search{background:var(--surface-soft);border:1px solid var(--line);border-radius:12px;margin-bottom:10px}#drawer .search input{font-size:13px;color:var(--ink);min-height:42px}#drawer .search svg{color:var(--muted)}#drawer .nav-main{min-height:44px;color:var(--accent);border:1px solid var(--line);border-radius:12px;background:var(--surface);font-size:13px;margin-top:6px}#drawer #world-open{display:none}#drawer h1{font-size:12px;color:var(--muted)}#drawer .rail-heading{padding:22px 8px 10px}#drawer #new-role{font-size:12px;color:var(--accent);min-height:36px}.settings-foot{border-color:var(--line);gap:5px;color:var(--muted)}#connection-state{font-size:11px;flex:1;line-height:1.5}#connection-state:before{content:'';width:6px;height:6px;background:var(--muted);display:inline-block;border-radius:50%;margin-right:6px}#connection-state[data-connected=true]:before{background:var(--positive)}#drawer .tool{color:var(--muted)}.character-group{margin-bottom:7px}.character-heading{border-radius:10px}.character-toggle{color:var(--ink)}.character-avatar{background:var(--accent-soft);color:var(--accent)}.session-link{color:var(--muted);border-radius:10px!important;min-height:42px}.session-link.selected{background:var(--accent-soft)!important;color:var(--accent)!important}.session-new{color:var(--accent)}.character-sessions{border-color:var(--line)}.empty-history{color:var(--muted);font-size:13px;padding:20px 10px;line-height:1.7}
.topbar{padding:16px 24px;border-bottom:1px solid var(--line);background:var(--surface);gap:8px;min-height:72px}.topbar h2{font-size:15px;color:var(--ink);font-weight:600}#character-header{color:var(--ink)}.tool,#chat-form #attach{color:var(--muted)}.tool:hover{background:var(--surface-soft)!important}#role-card-button{color:var(--muted);border:1px solid var(--line);padding:8px 12px;border-radius:10px;min-height:40px}.story-context{padding:12px 24px;border-bottom:1px solid var(--line);gap:10px;background:var(--surface)}.context-choice{color:var(--ink);background:var(--surface-soft);border:1px solid var(--line);border-radius:12px;padding:10px 15px;font-size:13px;box-shadow:inset 0 1px 0 #ffffff50}.context-choice:first-child:before{content:'角色';font-size:10px;color:var(--muted);margin-right:4px}.context-choice:nth-child(2):before{content:'世界';font-size:10px;color:var(--muted);margin-right:4px}#story-chapter-wrap{color:var(--muted)}#story-chapter{border-radius:10px;background:var(--surface-soft);color:var(--ink);border:1px solid var(--line)}
#welcome{gap:12px;padding:12px 24px 24px;background:radial-gradient(ellipse at 50% 30%,var(--accent-soft),transparent 64%);overflow:auto}#dream-scene{width:320px;height:250px;flex-shrink:0;position:relative;margin:0 auto -15px}.dream-sculpture-fallback{position:absolute;inset:24px 42px;perspective:600px;filter:drop-shadow(0 20px 16px #44316a22)}.dream-sculpture-fallback span{display:block;position:absolute;inset:12px 0;border:27px solid #bba8e2;border-top-color:#f2edf9;border-right-color:#8f80c0;border-radius:50%;transform:rotateX(48deg) rotateZ(-34deg);box-shadow:inset 3px 4px 8px #fff9,3px 4px 9px #66519330}.dream-sculpture-fallback i{display:block;position:absolute;inset:50px 56px;border-radius:50%;background:radial-gradient(circle at 28% 25%,white,#d8ece9 40%,#8eb5b3);box-shadow:inset -7px -10px 20px #456c7933}.welcome-caption{font-size:12px;color:var(--accent);margin:0;font-weight:500}#welcome #hello{font-size:clamp(23px,2.1vw,32px);font-weight:500;max-width:640px;line-height:1.45;letter-spacing:-.7px;color:var(--ink)}.welcome-note{font-size:14px;color:var(--muted);margin:0;line-height:1.7;max-width:460px}.welcome-actions{display:flex;align-items:center;justify-content:center;flex-wrap:wrap;gap:10px;margin-top:12px}.welcome-actions button{display:flex;align-items:center;gap:8px;min-height:44px;font-size:13px;padding:11px 17px}.welcome-actions .ui-icon{width:18px;height:18px}
.primary{background:var(--accent)!important;color:var(--on-accent)!important;border:1px solid transparent!important;border-radius:12px!important;box-shadow:0 4px 12px #6750b51c!important;font-weight:500}.primary:hover{background:var(--accent-hover)!important}.secondary{background:var(--surface)!important;color:var(--ink)!important;border:1px solid var(--line)!important;border-radius:12px!important;box-shadow:none!important}.secondary:hover{background:var(--surface-soft)!important}.subtle{color:var(--accent);background:transparent}.danger{background:transparent;color:var(--danger);border-color:var(--line)}.helper,.empty-note{color:var(--muted)!important;line-height:1.7;font-size:13px}
#messages{width:min(100%,850px);padding:28px 32px;color:var(--ink);background:var(--surface);min-height:0}.message-row{margin:4px 0 26px}.bubble.assistant,.bubble.pending{color:var(--ink);font-size:16px;line-height:1.85;max-width:100%}.bubble.user{background:var(--accent-soft);color:var(--ink);border-radius:20px 20px 5px 20px;padding:14px 20px;font-size:15px;max-width:85%;line-height:1.7}.message-identity{color:var(--muted)!important;font-size:12px}.message-avatar{background:var(--accent-soft);color:var(--accent)}.like-message{color:var(--muted);min-height:36px}.reasoning{color:var(--muted);border-color:var(--line);background:var(--surface-soft);border-radius:8px;padding:10px 14px}.bubble.pending:before{content:'';display:inline-block;width:8px;height:8px;border-radius:50%;margin-right:10px;background:var(--accent);animation:thinking-breathe 1.4s ease-in-out infinite}@keyframes thinking-breathe{0%,100%{opacity:.4;transform:scale(.8)}50%{opacity:1;transform:scale(1)}}#detail .composer-wrap{width:min(100%,850px);padding:10px 28px 18px;background:var(--surface);flex-shrink:0}#chat-form{border:1px solid var(--line);border-radius:23px;background:var(--surface-soft);padding:17px 16px 12px;box-shadow:0 3px 14px #30254a04,inset 0 1px 0 #ffffff55}#chat-form:focus-within{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}#chat-form textarea{font-size:16px;line-height:1.6;min-height:48px;max-height:180px;color:var(--ink)}#chat-form textarea::placeholder{color:var(--muted)}#chat-form .pill{background:var(--surface)!important;color:var(--muted);border-color:var(--line);min-height:36px;height:36px;border-radius:10px;font-size:12px}#chat-form .pill[aria-pressed=true]{background:var(--accent-soft)!important;color:var(--accent);border-color:var(--accent)}#chat-form #send{height:40px;width:40px;min-height:40px;border-radius:13px;background:var(--accent);color:var(--on-accent);box-shadow:0 4px 9px #6750b52b}#chat-form:has(textarea:placeholder-shown):has(#picture-preview[hidden]) #send{background:var(--accent);opacity:.65}.composer-note{color:var(--muted);font-size:11px;margin-top:9px}#world-context-info{color:var(--muted);font-size:12px}#picture-preview{color:var(--muted)}
.library-page{position:absolute;inset:0;overflow:auto;padding:clamp(24px,4vw,56px);background:var(--surface);color:var(--ink);overscroll-behavior:contain}.library-page[hidden]{display:none!important}.library-header,.world-library-page>header{display:flex;justify-content:space-between;align-items:center;gap:20px;margin-bottom:28px}.library-header h1,.world-library-page h1{font-size:34px;letter-spacing:-1px;margin:5px 0 12px;font-weight:550}.library-header p,.world-library-page>header p{color:var(--muted);font-size:14px;line-height:1.7;margin:0}.library-header .section-kicker,.world-library-page .section-kicker{color:var(--accent);font-size:12px}.library-header .primary{display:flex;align-items:center;gap:8px;min-height:44px;padding:12px 18px;font-size:14px}.library-toolbar{display:flex;gap:20px;align-items:center;margin:0 0 24px}.library-search{flex:1;max-width:380px}.library-search input{width:100%;padding:12px 15px;border-radius:12px;background:var(--surface-soft);border:1px solid var(--line);font-size:14px;color:var(--ink)}#character-count{color:var(--muted);font-size:12px}.character-grid,#world-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(250px,100%),1fr));gap:22px;align-items:stretch}.persona-card{border:1px solid var(--line);border-radius:20px;overflow:hidden;background:var(--surface);box-shadow:var(--shadow);padding:0 20px 20px;transition:transform 240ms var(--ease),box-shadow 240ms var(--ease)}.persona-cover{margin:0 -20px 20px;height:148px;position:relative;display:flex;align-items:center;justify-content:center;background:radial-gradient(ellipse at 65% 20%,hsl(var(--card-hue) 44% 89%),transparent 80%),linear-gradient(135deg,#efedf7,#d4e6e2)}:root[data-theme=dark] .persona-cover{background:radial-gradient(ellipse at 65% 20%,hsl(var(--card-hue) 30% 32%),transparent 80%),linear-gradient(135deg,#302942,#29413f)}.persona-cover:after{content:'';position:absolute;width:150px;height:150px;border:1px solid #ffffff77;border-radius:50%;transform:translate(60px,-30px);pointer-events:none}.persona-portrait{display:grid;place-items:center;width:72px;height:72px;position:relative;z-index:1;background:rgba(255,255,255,.58);color:#584978;border:1px solid #ffffffaa;border-radius:24px;box-shadow:inset 0 1px 0 white,0 12px 24px #6652851a;font-family:Georgia,'Songti SC',serif;font-size:30px;overflow:hidden}.persona-portrait img{width:100%;height:100%;object-fit:cover}.persona-session-count{position:absolute;left:15px;bottom:12px;font-size:11px;color:#504761;background:#ffffffb8;border:1px solid #ffffff9c;border-radius:20px;padding:5px 9px}.persona-card h3{font-size:20px;font-weight:550;margin:0 0 9px}.persona-description{color:var(--muted);font-size:13px;line-height:1.7;min-height:44px;margin:0 0 18px}.persona-actions{display:flex;gap:8px}.persona-actions button{min-height:42px;padding:9px 12px;font-size:12px;flex:1}.library-empty{grid-column:1/-1;text-align:center;display:flex;flex-direction:column;align-items:center;padding:60px 24px;border:1px dashed var(--line);border-radius:20px;color:var(--muted);background:var(--surface-soft)}.library-empty>.ui-icon{width:48px;height:48px;color:var(--accent);margin-bottom:16px}.library-empty h3{font-weight:500;color:var(--ink);margin:0 0 10px}.library-empty p{font-size:14px;margin:0 0 22px}.library-empty button{padding:12px 20px}.world-library-page>header .close{display:none}.world-library-page>.world-actions{margin-bottom:24px;gap:10px}.world-library-page>.world-actions button{min-height:44px;padding:10px 16px;font-size:13px}#world-list>.helper{grid-column:1/-1;padding:48px 24px;background:var(--surface-soft);border:1px dashed var(--line);border-radius:20px;text-align:center}.world-list-card{position:relative;overflow:hidden;border:1px solid var(--line)!important;border-radius:20px;padding:26px 22px!important;box-shadow:var(--shadow);background:var(--surface)}.world-list-card:before{content:'';display:block;width:48px;height:58px;border:1px solid #a9a1c9;border-radius:5px 13px 13px 5px;background:linear-gradient(135deg,#e9e2f5,#b9cfcf);box-shadow:inset 4px 0 #ffffff75,5px 4px 0 var(--surface-soft),6px 5px 0 var(--line);transform:rotate(-7deg);margin:3px 0 26px}.world-list-card h3{font-size:20px;font-weight:550}.world-list-card .world-actions{gap:8px;margin-top:18px}.world-list-card .world-actions button{min-height:42px;font-size:12px;padding:9px 12px}.world-list-card .world-actions .primary{width:100%;margin-bottom:2px}.world-list-card .world-actions .secondary{flex:1}
.modal{background:#211b3e55;backdrop-filter:blur(6px);padding:24px}.sheet,.world-dialog{color:var(--ink);background:var(--modal-glass);border:1px solid var(--line);box-shadow:var(--shadow-float);border-radius:24px;padding:28px;width:min(560px,100%)}.sheet.wide{width:min(780px,100%)}.sheet header,.world-dialog header{align-items:center;margin-bottom:24px}.sheet h2,.world-dialog h2{color:var(--ink);font-size:23px;letter-spacing:-.5px;font-weight:550}.close{border:1px solid var(--line)!important;background:var(--surface-soft)!important;color:var(--muted)!important;border-radius:50%!important;min-width:40px;min-height:40px;line-height:1;flex-shrink:0}.sheet input,.sheet select,.sheet textarea,.world-dialog input,.world-dialog select,.world-dialog textarea{background:var(--surface-soft)!important;border:1px solid var(--line)!important;color:var(--ink)!important;border-radius:12px!important;padding:12px;font-size:16px;line-height:1.6}.sheet label,.world-dialog label{font-size:13px;color:var(--ink);line-height:1.6;margin-bottom:16px}.sheet input::placeholder,.sheet textarea::placeholder,.world-dialog textarea::placeholder{color:var(--muted);opacity:.85}.form-row{gap:14px}#profile .sheet h4{color:var(--muted);font-size:12px}#profile .profile-actions button{background:var(--surface-soft)!important;color:var(--ink)!important;border:1px solid var(--line);min-height:44px;border-radius:12px}.profile-actions{gap:9px}#profile-avatar,#editor-avatar{background:var(--accent-soft);color:var(--accent);box-shadow:inset 0 1px 0 #fff6}.form-section{margin:22px 0;border-top:1px solid var(--line);padding-top:5px}.form-section summary{display:flex;align-items:center;min-height:52px;cursor:pointer;color:var(--accent);font-size:14px;font-weight:550;gap:12px}.form-section summary:before{content:'›';font-size:20px;transform:rotate(0);transition:transform 160ms}.form-section[open] summary:before{transform:rotate(90deg)}.form-section summary::-webkit-details-marker{display:none}.form-section[open]{padding-bottom:10px}#role-form>[type=submit]{position:sticky;bottom:0;z-index:2;min-height:48px;margin-top:14px;width:100%;box-shadow:0 -12px 20px var(--modal-glass)!important}#api-settings{background:#211b3e55}#api-settings .sheet{background:var(--modal-glass);border-radius:24px 0 0 24px;border-left:1px solid var(--line);padding:28px;box-shadow:var(--shadow-float);width:min(480px,100%)}#api-settings .settings-section{color:var(--muted);margin-top:28px}.settings-row{color:var(--ink)}#api-settings .check{display:flex;gap:12px;align-items:center}#api-settings .check input{width:20px;height:20px;accent-color:var(--accent)}.web-version{font-size:10px;color:var(--muted)}#api-status,#file-status,#analysis-status{color:var(--muted)}#analysis-progress{padding:12px 14px;border:1px solid var(--line);background:var(--surface-soft);border-radius:12px}#analysis-meter{width:100%;height:6px;border-radius:6px;accent-color:var(--accent);margin:14px 0 0}#analysis-evidence{margin-bottom:18px}#analysis-evidence-content{max-height:300px;overflow:auto;padding:12px;background:var(--surface-soft);border-radius:12px}#analysis-evidence-content p{white-space:pre-wrap}.world-editor{width:min(1080px,calc(100vw - 32px))}.world-dialog::backdrop{background:#211b3e66;backdrop-filter:blur(6px)}.world-dialog .helper{color:var(--muted)}.world-dialog .world-entry-row{border-color:var(--line)}.world-entry-title{color:var(--ink)}#world-entry-form{background:var(--surface-soft);border:1px solid var(--line)}.world-editor-footer{border-color:var(--line);background:var(--modal-glass)}.memory-page-body{padding:28px}.memory-page-body h3,.memory-page-body h4{color:var(--ink)}.memory-item,.summary-editor{background:var(--surface-soft);border-color:var(--line);color:var(--ink)}#memory-page .detail-header{color:var(--ink);border-bottom:1px solid var(--line)}#memory-page input,#memory-page textarea{background:var(--surface);color:var(--ink);border-color:var(--line)}#scene-state{color:var(--muted)}
.toast{left:50%;bottom:28px;transform:translateX(-50%);max-width:min(560px,calc(100vw - 32px));background:var(--ink);color:var(--surface);border:1px solid var(--line);border-radius:16px;padding:14px 20px;box-shadow:var(--shadow-float);font-size:13px;line-height:1.7;z-index:500;cursor:pointer}.toast[data-tone=success]{border-left:4px solid var(--positive)}.toast[data-tone=error]{border-left:4px solid var(--danger)}#startup-notice{background:var(--surface);color:var(--ink);border:1px solid var(--line);border-radius:24px;box-shadow:var(--shadow-float)}.notice-paper,.notice-copy{background:var(--surface);color:var(--ink)}.notice-copy p,.notice-copy small{color:var(--muted)}.notice-accounts strong{color:var(--ink)}.notice-copy button{background:var(--accent);color:var(--on-accent);border-radius:12px}.notice-cover{border-radius:22px 22px 0 0}.mobile-nav{display:none}
@media(min-width:1100px){#drawer{inset:0 auto 0 0;transform:none;visibility:visible;width:272px;transition:none;border-right:1px solid var(--line)}#close-drawer{display:none}#menu{display:none}#detail,#memory-page,.library-page{left:288px;right:16px;top:16px;bottom:16px;width:auto;height:auto;border-radius:26px}.library-page{border:1px solid var(--line);box-shadow:var(--shadow)}.drawer-open #detail{transform:none;box-shadow:var(--shadow)}.drawer-mask,.drawer-open .drawer-mask{display:none}#api-settings .sheet{height:calc(100% - 32px);margin:16px;border-radius:24px}#drawer .settings-foot{margin-top:auto;padding-top:18px}#world-library.world-library-page{padding:40px}}
@media(hover:hover) and (prefers-reduced-motion:no-preference){.persona-card:hover{transform:translateY(-4px);box-shadow:0 16px 28px #30254a12}.world-list-card:hover:before{transform:rotate(-2deg) translateY(-2px);transition:transform 240ms var(--ease)}}
@media(max-width:1099px){#detail,#memory-page,.library-page{bottom:76px;height:auto}.topbar{padding-top:calc(12px + env(safe-area-inset-top))}.mobile-nav{position:absolute;display:grid;grid-template-columns:repeat(4,1fr);bottom:0;left:0;right:0;height:76px;padding:7px 18px calc(7px + env(safe-area-inset-bottom));background:var(--nav-glass);border-top:1px solid var(--line);backdrop-filter:blur(22px);z-index:15;gap:12px}.mobile-nav button{background:transparent;border:0;color:var(--muted);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-height:52px;font-size:11px;border-radius:14px}.mobile-nav button.is-active{color:var(--accent);background:var(--accent-soft)}.mobile-nav button .ui-icon{width:23px;height:23px}.desktop-nav{display:none}.sidebar-label{margin-top:12px}#drawer{z-index:25;width:min(84vw,320px);padding:24px 18px}.drawer-mask{z-index:24;left:min(84vw,320px);background:#211b3e44;backdrop-filter:blur(3px)}.drawer-open #detail{transform:none;border-radius:0}.library-page{padding:28px 22px}.toast{bottom:90px}.library-header h1,.world-library-page h1{font-size:28px}.world-library-page>header{margin-bottom:22px}}
@media(max-width:600px){#detail{border:0}.topbar{min-height:62px;padding:10px 12px}.topbar h2{font-size:14px}.story-context{padding:10px 14px;gap:8px}.context-choice{padding:9px 11px;font-size:12px;min-height:42px}.context-choice:before{display:none}.context-choice:nth-child(2){flex:1}.context-choice:first-child{flex:0 1 auto}#role-card-button{display:none!important}#dream-scene{width:240px;height:180px;margin-bottom:-4px}.dream-sculpture-fallback{inset:15px 26px}.dream-sculpture-fallback span{border-width:22px}.dream-sculpture-fallback i{inset:38px 44px}#welcome{gap:9px;padding:4px 18px 16px}#welcome #hello{font-size:23px;max-width:340px;letter-spacing:-.4px}.welcome-note{font-size:12px;max-width:300px}.welcome-caption{font-size:11px}.welcome-actions{gap:8px;margin-top:8px}.welcome-actions button{font-size:12px;padding:9px 11px;min-height:40px}.welcome-actions .subtle{display:none}#detail .composer-wrap{padding:6px 14px 12px}#chat-form{padding:13px 12px 10px;border-radius:20px}#chat-form textarea{min-height:40px}#chat-form .pill{font-size:11px;padding:0 8px;min-height:34px;height:34px}#chat-form #send{height:38px;width:38px}.composer-note{font-size:10px;margin-top:7px}#messages{padding:20px 18px}.bubble.assistant{font-size:15px}.bubble.user{font-size:14px;padding:12px 16px;max-width:90%}.library-page{padding:24px 18px}.library-header{align-items:flex-start;gap:12px}.library-header .primary{font-size:12px;padding:10px 12px}.library-header h1,.world-library-page h1{font-size:28px;margin-bottom:8px}.library-header p{font-size:12px}.library-toolbar{gap:12px;margin-bottom:18px}.library-search input{font-size:16px}.character-grid,#world-list{grid-template-columns:1fr;gap:18px}.persona-cover{height:130px}.persona-description{min-height:0}.persona-actions button{min-height:44px;font-size:13px}.world-list-card .world-actions .primary{width:auto;flex:2;margin-bottom:0}.world-list-card .world-actions .secondary{flex:1}.world-list-card:before{float:right;width:44px;height:54px;margin:2px 6px 16px 18px}.world-list-card>.helper{clear:none}.world-list-card .world-actions{clear:both}.world-library-page>.world-actions{gap:8px}.world-library-page>.world-actions button{padding:9px 12px;font-size:12px}.world-library-page #world-none{width:100%;text-align:left}.modal{padding:12px;align-items:flex-end}.sheet,.world-dialog{padding:22px 18px;border-radius:22px;max-height:90dvh}.sheet h2,.world-dialog h2{font-size:21px}.sheet input,.sheet textarea,.sheet select{padding:11px;font-size:16px}.sheet label{font-size:13px}#api-settings .sheet{border-radius:22px 22px 0 0;width:100%;padding:24px 20px;max-height:94dvh;height:auto;margin-top:auto}#editor .sheet{max-height:93dvh}.world-dialog{width:calc(100vw - 16px)}.world-editor-layout{gap:18px}.world-dialog .world-actions button{font-size:12px}#world-entry-form{padding:12px}.memory-page-body{padding:22px 18px}.mobile-nav{gap:8px;padding-left:14px;padding-right:14px}}
@media(max-height:700px){#dream-scene{height:135px;width:190px}.welcome-note{display:none}#welcome{gap:5px}.welcome-actions{margin-top:4px}#welcome #hello{font-size:20px}.welcome-caption{display:none}.topbar{min-height:55px}.composer-tools{margin-top:7px}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}.persona-card:hover{transform:none}}.motion-off *,.motion-off *:before,.motion-off *:after{animation:none!important;transition:none!important;scroll-behavior:auto!important}.motion-off .persona-card:hover{transform:none}
/* Preserve the requested gold logo without recoloring the UI. */
.brand img{mix-blend-mode:normal!important;border-radius:0;width:38px;height:38px}.release-tag{font-size:10px;color:var(--muted);padding-left:5px}
/* Welcome text stays distinct from the gold brand sculpture. */
#welcome #hello.home-greeting{width:clamp(150px,18vw,190px);height:auto;line-height:0;margin:2px 0 5px;color:#354942;text-shadow:none;font-size:0;letter-spacing:0;text-indent:0}
.greeting-lettering{display:block;width:100%;height:auto;overflow:visible}
:root[data-theme=dark] #welcome #hello.home-greeting{color:#c1d0c7;text-shadow:0 1px 1px #0003}
@media(max-height:700px){#welcome #hello.home-greeting{font-size:30px}}

@media(max-width:1099px){
  #app.keyboard-open[data-view=chat]{top:var(--chat-viewport-top,0px)}
  #app.keyboard-open[data-view=chat] .mobile-nav{display:none}
  #app.keyboard-open[data-view=chat] #detail{bottom:0}
  #app.keyboard-open[data-view=chat] #detail .composer-wrap{padding-bottom:10px}
}

#api-settings [hidden]{display:none!important}
.api-mode-switch{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:4px 0 14px}
.api-mode-switch button{border:1px solid var(--line);border-radius:12px;color:var(--muted);min-height:44px;font-weight:650}
.api-mode-switch button[aria-pressed=true]{background:var(--accent-soft);color:var(--accent);border-color:var(--accent)}
.special-api-hero{position:relative;isolation:isolate;overflow:hidden;border-radius:16px;margin:0 0 12px;padding:16px;min-height:180px;display:flex;align-items:center;background:#28242d;color:#fff}
.special-api-hero::before{content:"";position:absolute;inset:-12px;z-index:-1;background:linear-gradient(90deg,rgba(25,21,32,.80),rgba(25,21,32,.18)),url('./special-api-bg.jpg') center 54%/cover;filter:blur(3px) saturate(.56) brightness(.78)}
.special-api-glass{background:rgba(30,26,37,.55);backdrop-filter:blur(7px);border:1px solid rgba(255,255,255,.22);border-radius:12px;padding:12px 14px;max-width:84%}
.special-api-glass h3{margin:0;color:#fff;font-size:18px}
.special-api-glass p{margin:3px 0;color:#f0eaf5;font-size:13px}
.special-api-glass a{display:inline-flex;align-items:center;gap:6px;min-height:44px;color:#f3e7ff;text-decoration:underline;text-underline-offset:4px;font-weight:650}

.attachment-picker{display:flex;gap:8px;flex-wrap:wrap;margin:0 0 8px}.attachment-picker[hidden]{display:none!important}.attachment-picker button{min-height:44px}

#detail #attachment-picker{
 display:flex;align-items:center;gap:8px;flex-wrap:wrap;
 margin:0 0 8px;padding:6px 8px;
 border:1px solid var(--line);border-radius:12px;background:var(--surface);
}
#detail #attachment-picker[hidden]{display:none!important}
#detail #attachment-picker button{
 display:inline-flex;justify-content:center;align-items:center;white-space:nowrap;
 width:auto;min-height:44px;height:auto;margin:0;padding:6px 14px;
 border-radius:8px;font-size:14px;line-height:1.35;color:var(--ink);
}

:root[data-theme=dark] #messages{color-scheme:dark;scrollbar-color:var(--muted) var(--surface)}
