@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;450;500;550;600;650;700&family=Manrope:wght@400;500;600;650;700;750;800&display=swap');

.custom-image-field{margin-top:18px}.custom-image-field input{padding:8px;background:var(--soft);max-width:100%;cursor:pointer}.custom-image-preview{display:flex;align-items:center;gap:12px;margin-top:12px;color:var(--muted);font-size:12px}.custom-image-preview img{width:64px;height:64px;object-fit:cover;border-radius:16px;border:1px solid var(--line)}

:root{--bg:#f2f0f5;--surface:#fff;--soft:#f8f7fb;--ink:#302b40;--muted:#8c869a;--line:#eeeaf3;--purple:#7960cd;--purple-dark:#664abc;--lavender:#eee8fa;--chat:#f8f6fc;--bubble:#fff;--shadow:0 16px 60px #3d245a0b;--radius:18px;color-scheme:light;font-family:'DM Sans',sans-serif;font-size:14px}
*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);-webkit-font-smoothing:antialiased}button,input,textarea,select{font:inherit}button,a,input,textarea,select{-webkit-tap-highlight-color:transparent}button{cursor:pointer}button{color:inherit}button:disabled{cursor:not-allowed;opacity:.5}button:focus-visible,a:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible{outline:3px solid #b9a2ee;outline-offset:3px}button{border:0;background:none}a{color:var(--purple)}svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}h1,h2,h3,p{margin:0}h1,h2,h3,.wordmark{font-family:'Manrope',sans-serif}button{transition:background .18s,transform .18s,color .18s}button:active{transform:translateY(1px)}[hidden]{display:none!important}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.app-shell{display:grid;grid-template-columns:76px 308px minmax(0,1fr) 272px;max-width:1640px;height:calc(100dvh - 40px);min-height:540px;margin:20px auto;background:var(--surface);border:1px solid #ffffffb0;border-radius:22px;box-shadow:var(--shadow);overflow:hidden}.rail{background:#f1edf8;display:flex;align-items:center;flex-direction:column;padding:23px 10px 18px;gap:32px}.brand-mark{display:block;line-height:0}.rail-links,.rail-bottom{display:flex;flex-direction:column;gap:13px;align-items:center;width:100%}.rail-bottom{margin-top:auto;gap:14px}.rail-button{display:flex;align-items:center;justify-content:center;flex-direction:column;gap:5px;color:#a094b7;width:48px;min-height:44px;border-radius:14px}.rail-button span{font-size:9px;font-weight:700}.rail-button.active{height:58px;background:#e3daf4;color:#7655b7}.rail-button:hover{background:#e3daf4;color:var(--purple)}.user-avatar{width:36px;height:36px;border-radius:50%;background:#d9c9e8;color:#634486;font-weight:700;margin-top:6px;border:3px solid #f9f6fe}
.sidebar{display:flex;flex-direction:column;min-height:0;border-right:1px solid var(--line);padding:27px 20px 0}.wordmark{font-size:24px;letter-spacing:-1px;font-weight:800;display:flex;align-items:center;gap:9px}.beta-tag{font-family:'DM Sans',sans-serif;font-size:8px;letter-spacing:1px;background:var(--lavender);color:var(--purple);border-radius:5px;padding:4px 6px}.sidebar-heading{display:flex;justify-content:space-between;align-items:center;margin:34px 0 22px}.sidebar-heading h1{font-size:23px;letter-spacing:-.9px}.tiny-spark{font-size:22px;margin-left:8px;color:#c9b6e9;vertical-align:middle}.sidebar-heading p{font-size:12px;color:var(--muted);margin-top:7px}.icon-button{width:38px;height:38px;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;border-radius:12px;color:var(--muted)}.icon-button:hover{background:var(--lavender);color:var(--purple)}.primary-icon{background:var(--purple);color:#fff;width:36px;height:36px;box-shadow:0 4px 10px #7960cd20}.primary-icon:hover{background:var(--purple-dark);color:#fff}.search-field{display:flex;align-items:center;gap:9px;border:1px solid var(--line);border-radius:11px;padding:11px 12px;background:var(--soft);color:#a49cae}.search-field svg{width:17px;height:17px}.search-field input{width:100%;background:transparent;border:0;outline:0;font-size:12px;color:var(--ink)}input::placeholder,textarea::placeholder{color:#a69fb1}.chat-filters{display:flex;gap:9px;margin:20px 0 15px}.filter{border-radius:7px;padding:7px 10px;color:var(--muted);font-size:11px;font-weight:600}.filter.active{background:var(--lavender);color:var(--purple)}.filter span{margin-left:5px;background:#ffffff80;border-radius:4px;font-size:9px;padding:2px 5px}.chat-list{min-height:130px;flex:1;overflow:auto;margin:0 -10px;padding:0 4px}.chat-row{position:relative;width:100%;display:flex;align-items:center;gap:12px;padding:15px 10px;text-align:left;border-radius:13px;margin-bottom:6px;border:1px solid transparent}.chat-row.active{background:#f1ecfa;border-color:#ebe2f7}.chat-row:hover{background:var(--soft)}.avatar{object-fit:cover;background:var(--lavender);border-radius:50%;width:46px;height:46px;flex-shrink:0}.avatar-wrap{position:relative;display:inline-flex;flex-shrink:0}.avatar-wrap .status-dot{position:absolute;right:0;bottom:2px;border:2px solid var(--surface);width:11px;height:11px}.chat-row-body{flex:1;min-width:0}.chat-row-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:6px;gap:8px}.chat-row-top strong{font-size:13px;font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.chat-row-top time{font-size:9px;color:var(--muted);flex-shrink:0}.chat-preview{color:var(--muted);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;font-size:11px;line-height:1.5}.chat-row.active .chat-preview{color:#8c7aa8}.unread-dot{position:absolute;bottom:17px;right:10px;min-width:16px;height:16px;background:var(--purple);color:white;font-size:9px;border-radius:50%;display:grid;place-items:center}.chat-row.unread .chat-preview{padding-right:16px}.loading-placeholder,.list-empty{padding:26px 12px;color:var(--muted);font-size:12px;line-height:1.7;text-align:center}
.create-card{position:relative;margin:20px 0;background:#f7f0e7;border:1px solid #f1e5d6;border-radius:15px;padding:21px 17px 15px;overflow:hidden;flex-shrink:0}.eyebrow{font-size:8px;font-weight:700;letter-spacing:1.35px;color:#af9172}.create-card h2{font-size:22px;line-height:1.35;letter-spacing:-.8px;color:#655047;margin-top:11px;position:relative}.create-card p{font-size:10px;color:#a89485;margin-top:9px;max-width:180px;line-height:1.6}.create-card button{display:flex;align-items:center;gap:14px;font-size:11px;font-weight:700;color:#8b6b50;margin-top:15px;padding:0}.create-card button svg{width:16px}.card-art{position:absolute;right:6px;top:35px;font-size:76px;transform:rotate(12deg);color:#deccb7;line-height:1}.card-art span{position:absolute;font-size:31px;right:0;top:67px}.sidebar-footer{display:flex;align-items:center;gap:7px;border-top:1px solid var(--line);min-height:54px;font-size:10px;color:var(--muted);flex-shrink:0}.status-dot{width:6px;height:6px;background:#78b995;display:inline-block;border-radius:50%;flex-shrink:0}.mobile-settings{display:none}
.conversation{display:flex;min-width:0;flex-direction:column;min-height:0;background:var(--chat);position:relative}.conversation-header{display:flex;align-items:center;gap:12px;min-height:86px;padding:17px 27px;background:var(--surface);border-bottom:1px solid var(--line);flex-shrink:0}.conversation-header .avatar{width:44px;height:44px}.header-character{display:flex;gap:12px;align-items:center;padding:0;text-align:left;min-width:0}.header-character>div{min-width:0}.header-name{display:flex;align-items:center;gap:8px}.header-name h2{font-size:16px;font-weight:750;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:220px}.ai-tag{font-size:8px;letter-spacing:.3px;background:var(--lavender);color:var(--purple);padding:3px 6px;border-radius:4px;white-space:nowrap}.header-mood{color:var(--muted);font-size:10px;margin-top:5px;display:flex;gap:6px;align-items:center}.header-actions{margin-left:auto;display:flex;align-items:center;gap:7px}.header-actions .icon-button{width:33px;height:33px}.mobile-back{display:none}.connection-banner{padding:8px 16px;font-size:10px;line-height:1.5;text-align:center;background:#fff5df;color:#997636;border-bottom:1px solid #f7ebd2;flex-shrink:0}.connection-banner button{text-decoration:underline;font-size:inherit;color:inherit;padding:0 2px}.connection-banner.offline{background:#f8e8e8;color:#aa5252}.scenario-strip{padding:13px 27px 0;flex-shrink:0}.scene-pill{border:1px solid #e8e0f2;border-radius:10px;background:#f3eff9;width:100%;display:flex;align-items:center;text-align:left;padding:10px 13px;gap:10px}.scene-emoji{font-size:18px}.scene-pill .scene-text{font-size:11px;color:#8d7aab;flex:1}.scene-pill strong{font-weight:600;color:#786092}.scene-pill .scene-change{font-size:10px;color:#9f8ab5;display:flex;align-items:center;gap:6px}.scene-pill svg{height:14px;width:14px}
.messages{flex:1;min-height:0;overflow:auto;padding:22px 28px 20px;scrollbar-width:thin;scrollbar-color:#d9d0e9 transparent;background-image:url('wallpaper.svg');background-size:420px}.day-label{display:flex;justify-content:center;align-items:center;color:#aca1b9;font-size:9px;margin:2px 0 24px;gap:14px}.day-label:before,.day-label:after{content:'';width:28px;height:1px;background:#e5dfed}.message{display:flex;align-items:flex-end;gap:8px;margin-bottom:17px;animation:appear .2s ease-out}.message .avatar{width:27px;height:27px;margin-bottom:2px}.message-content{max-width:79%;min-width:75px}.bubble{background:var(--bubble);padding:12px 16px;border-radius:15px 15px 15px 4px;box-shadow:0 2px 3px #3e285204;white-space:pre-wrap;overflow-wrap:anywhere;font-size:12px;line-height:1.85;border:1px solid #eee9f480;color:#5c536b}.message.user{justify-content:flex-end}.message.user .bubble{background:var(--purple);color:#fff;border-color:transparent;border-radius:15px 15px 4px 15px;box-shadow:0 4px 12px #7960cd12}.message-meta{display:flex;align-items:center;gap:5px;margin-top:5px;font-size:8px;color:#b1a6bd;padding:0 3px;line-height:1.5}.message-meta svg{width:12px;height:12px;color:#9d85c6}.message.user .message-meta{justify-content:flex-end}.message .retry-button{color:#c2787e;font-size:10px;padding:3px 0;font-weight:600}.source-tag{font-size:8px;background:#eee8f480;border-radius:3px;padding:1px 4px;color:#a096ad}.welcome-state{text-align:center;max-width:340px;margin:50px auto 35px}.welcome-spark{font-size:40px;color:#cbbbdf}.welcome-state h2{font-size:25px;line-height:1.45;font-weight:700;letter-spacing:-.8px;margin:13px 0;color:#887198}.welcome-state p{font-size:12px;color:#aa9cb5;line-height:1.8}.chat-intro{text-align:center;padding:24px 0 29px}.chat-intro .avatar{width:76px;height:76px;box-shadow:0 0 0 7px #efe8f650}.chat-intro h2{font-size:19px;letter-spacing:-.5px;margin-top:15px}.chat-intro p{font-size:11px;color:var(--muted);line-height:1.8;max-width:280px;margin:8px auto 0}.intro-traits{display:flex;justify-content:center;gap:5px;flex-wrap:wrap;margin-top:13px}.intro-traits span{font-size:9px;padding:5px 9px;color:#9a87af;border-radius:20px;background:#eee8f77a}.load-more{display:block;color:var(--purple);font-size:11px;margin:0 auto 18px;text-decoration:underline}.typing-indicator{display:flex;align-items:center;gap:9px;font-size:10px;color:#a895bc;padding:0 28px 12px}.typing-dots{display:flex;gap:3px;padding:8px 10px;background:var(--surface);border-radius:8px}.typing-dots i{width:4px;height:4px;border-radius:50%;background:#b3a0cc;animation:bounce 1.2s infinite}.typing-dots i:nth-child(2){animation-delay:.15s}.typing-dots i:nth-child(3){animation-delay:.3s}.chat-error{color:#a35b61;background:#fff0f0;border:1px solid #f0d7d9;margin:0 22px 10px;padding:10px;border-radius:9px;font-size:11px;line-height:1.6}.chat-error button{color:inherit;text-decoration:underline;font-weight:600}
.composer-area{padding:0 26px 13px;background:var(--chat);flex-shrink:0}.starter-prompts{display:flex;gap:7px;overflow:auto;scrollbar-width:none;padding:4px 0 13px}.starter-prompts button{font-size:10px;white-space:nowrap;border:1px solid #e5ddee;border-radius:20px;padding:7px 10px;color:#9b89ae;background:#ffffff70}.starter-prompts button:hover{background:var(--lavender)}.composer{display:flex;align-items:flex-end;padding:9px 9px 9px 7px;gap:6px;border:1px solid #e9e1f1;box-shadow:0 3px 12px #4d295506;background:var(--surface);border-radius:14px}.composer .icon-button{height:36px;width:34px}.composer .icon-button svg{height:20px;width:20px}.composer textarea{resize:none;background:transparent;border:0;outline:none!important;color:var(--ink);padding:9px 3px;line-height:20px;min-height:36px;max-height:132px;flex:1;min-width:0;font-size:12px}.send-button{display:flex;align-items:center;justify-content:center;width:37px;height:37px;background:var(--purple);color:#fff;border-radius:11px;flex-shrink:0}.send-button svg{height:18px;width:18px}.send-button:hover{background:var(--purple-dark)}.composer-caption{display:flex;align-items:center;justify-content:center;gap:5px;color:#b2a7be;font-size:8px;margin-top:10px;line-height:1.5}.composer-caption svg{width:11px;height:11px}.composer-caption #character-count{margin-left:auto}.composer-caption #character-count:empty{display:none}
.profile-panel{min-height:0;overflow:auto;border-left:1px solid var(--line);padding:26px 22px;background:var(--surface)}.panel-heading{display:flex;justify-content:space-between;align-items:center;font-size:10px;font-weight:600;letter-spacing:.2px;color:#a39bad}.profile-hero{text-align:center;margin:28px 0 23px}.profile-hero .avatar{width:105px;height:105px;box-shadow:0 0 0 8px var(--soft)}.profile-hero h2{font-size:23px;letter-spacing:-.8px;margin-top:19px;overflow-wrap:anywhere}.profile-hero p{font-size:10px;color:var(--muted);margin-top:7px}.mood-badge{display:inline-flex;align-items:center;gap:6px;background:#f7f0de;color:#b49957;font-size:9px;border-radius:20px;padding:7px 11px;margin-top:13px}.profile-quote{font-size:11px;line-height:1.9;text-align:center;color:#a093ad;padding:0 10px;margin-bottom:24px}.profile-section{padding:20px 0;border-top:1px solid var(--line)}.section-label{font-size:9px;letter-spacing:1px;color:#afa4ba;font-weight:600;text-transform:uppercase;margin-bottom:12px;display:flex;align-items:center;gap:7px}.section-label svg{width:14px;height:14px}.trait-tags{display:flex;gap:6px;flex-wrap:wrap}.trait-tag{font-size:10px;color:#9274b4;background:#f2edf9;border:1px solid #ebe3f5;border-radius:7px;padding:6px 9px}.trait-tag:nth-child(2){background:#fcf1e8;border-color:#f6e7d9;color:#b68d6a}.trait-tag:nth-child(3){background:#edf5ef;border-color:#dfeee3;color:#83a18c}.current-scene{display:flex;align-items:center;gap:11px;background:var(--soft);border-radius:10px;padding:12px}.current-scene .scene-emoji{font-size:23px}.current-scene h3{font-family:'DM Sans',sans-serif;font-size:11px;font-weight:600}.current-scene p{font-size:9px;line-height:1.7;color:var(--muted);margin-top:3px}.text-button{color:var(--purple);font-size:10px;padding:0;margin-top:12px;display:flex;align-items:center;gap:6px}.text-button svg{width:13px;height:13px}.memory-note{font-size:10px;line-height:1.9;color:#a699b0}.memory-link{width:100%;display:flex;align-items:center;justify-content:space-between;text-align:left;padding:12px 0 0;font-size:10px;color:#9074b0}.memory-link svg{width:14px}.profile-bottom{text-align:center;margin:23px 0 0;color:#b8adbf;font-size:9px;line-height:1.9}.profile-bottom .heart{color:#bfa6d1}.outline-button{border:1px solid var(--line);border-radius:9px;padding:10px 12px;font-size:11px;display:flex;align-items:center;justify-content:center;gap:7px;background:var(--surface)}.outline-button:hover{background:var(--soft)}.outline-button svg{width:15px;height:15px}.profile-edit{width:100%;margin-top:20px;color:#9c86b2}
.main-dialog{padding:0;border:1px solid var(--line);border-radius:22px;width:min(620px,calc(100vw - 28px));max-height:calc(100dvh - 40px);background:var(--surface);color:var(--ink);box-shadow:0 30px 100px #23133533;overflow:auto}.main-dialog::backdrop{background:#29203560;backdrop-filter:blur(5px)}.dialog-header{padding:25px 28px 19px;border-bottom:1px solid var(--line);display:flex;align-items:flex-start;justify-content:space-between;gap:12px}.dialog-header h2{font-size:23px;letter-spacing:-.7px}.dialog-header p{color:var(--muted);font-size:12px;line-height:1.6;margin-top:7px}.dialog-body{padding:24px 28px}.dialog-footer{padding:17px 28px;border-top:1px solid var(--line);display:flex;gap:12px;justify-content:flex-end;background:var(--surface);position:sticky;bottom:0;z-index:2}.primary-button{background:var(--purple);color:#fff;font-size:12px;font-weight:600;border-radius:10px;padding:12px 19px;display:inline-flex;align-items:center;justify-content:center;gap:8px}.primary-button:hover{background:var(--purple-dark)}.primary-button svg{height:16px;width:16px}.secondary-button{color:var(--muted);padding:12px 14px;border:1px solid var(--line);border-radius:10px;font-size:12px}.field{display:flex;flex-direction:column;gap:8px;font-size:11px;font-weight:600;margin-bottom:18px;min-width:0}.field input,.field select,.field textarea{width:100%;padding:12px;border-radius:10px;border:1px solid var(--line);background:var(--soft);color:var(--ink);font-size:12px;font-weight:400}.field textarea{resize:vertical;min-height:76px;line-height:1.7}.field-row{display:grid;grid-template-columns:1fr 100px 1fr;gap:14px}.field-hint{font-size:10px;color:var(--muted);font-weight:400;line-height:1.7}.form-section{margin:8px 0 23px}.form-section>h3{font-size:12px;margin:0 0 5px}.form-section>p{font-size:10px;color:var(--muted);line-height:1.8;margin:0 0 13px}.choice-grid{display:flex;gap:8px;flex-wrap:wrap}.choice-button{border:1px solid var(--line);border-radius:9px;font-size:11px;display:flex;align-items:center;gap:7px;padding:10px 13px;background:var(--soft)}.choice-button.selected{border-color:var(--purple);color:var(--purple);background:var(--lavender);box-shadow:0 0 0 1px var(--purple)}.avatar-choices{display:flex;justify-content:center;gap:13px;margin-bottom:25px;flex-wrap:wrap}.avatar-choice{padding:3px;border:2px solid transparent;border-radius:50%;line-height:0}.avatar-choice .avatar{width:53px;height:53px}.avatar-choice.selected{border-color:var(--purple)}.scenario-grid{display:grid;grid-template-columns:1fr 1fr;gap:11px}.scenario-choice{border:1px solid var(--line);background:var(--soft);border-radius:12px;padding:16px;display:flex;align-items:flex-start;gap:11px;text-align:left}.scenario-choice.selected{border-color:var(--purple);background:var(--lavender)}.scenario-choice strong{display:block;font-size:11px;font-weight:600}.scenario-choice small{display:block;font-size:10px;color:var(--muted);line-height:1.7;margin-top:5px}.switch-row{display:flex;justify-content:space-between;align-items:center;gap:20px;padding:17px 0;border-bottom:1px solid var(--line);font-size:12px}.switch-row p{font-size:10px;font-weight:400;color:var(--muted);line-height:1.7;margin-top:5px}.switch-row input[type=checkbox]{accent-color:var(--purple);width:19px;height:19px;flex-shrink:0}.settings-section{margin-bottom:23px}.settings-section h3{font-size:13px;margin-bottom:7px}.settings-details{font-size:11px;line-height:1.9;color:var(--muted)}.settings-details code{font-size:10px;color:var(--purple)}.two-columns{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-top:18px}.form-error{font-size:11px;color:#b66570;background:#fcedeF;border-radius:9px;padding:11px 13px;line-height:1.7;margin-bottom:14px}.memory-content{white-space:pre-wrap;font-size:12px;line-height:1.9;color:var(--muted);overflow-wrap:anywhere}.danger-button{color:#c16e79;border:1px solid #efd9df;border-radius:9px;padding:11px;font-size:11px}.menu-actions{display:flex;flex-direction:column;gap:9px}.menu-actions button,.menu-actions a{text-decoration:none;display:flex;align-items:center;gap:10px;padding:14px;border-radius:10px;text-align:left;font-size:12px;border:1px solid var(--line)}.menu-actions svg{width:18px}.discover-card{border:1px solid var(--line);background:var(--soft);border-radius:13px;padding:16px;display:flex;align-items:center;gap:14px;margin-bottom:12px}.discover-card h3{font-size:14px}.discover-card p{font-size:11px;line-height:1.6;color:var(--muted);margin-top:5px}.discover-card .icon-button{margin-left:auto}.toast{position:fixed;bottom:max(25px,env(safe-area-inset-bottom));left:50%;transform:translateX(-50%);background:#453653;color:#fff;border-radius:12px;box-shadow:0 8px 30px #28153422;padding:14px 20px;z-index:10;font-size:12px;line-height:1.6;max-width:calc(100vw - 36px);width:max-content}.noscript{position:fixed;inset:0;background:var(--surface);display:grid;place-items:center;padding:30px}.skeleton-line{height:16px;width:160px;background:var(--lavender);border-radius:8px;animation:pulse 1.5s infinite}::-webkit-scrollbar{width:5px;height:4px}::-webkit-scrollbar-thumb{background:#d9d0e980;border-radius:10px}
body.dark{--bg:#191620;--surface:#25212e;--soft:#2b2634;--ink:#ece5f4;--muted:#aba0b8;--line:#37303f;--purple:#9577df;--purple-dark:#a286e5;--lavender:#3b2d50;--chat:#201c29;--bubble:#302937;color-scheme:dark}body.dark .rail{background:#221c2e}body.dark .rail-button.active,body.dark .rail-button:hover{background:#3c2e50;color:#b499e5}body.dark .chat-row.active{background:#342840;border-color:#473356}body.dark .bubble{color:#ded3e8;border-color:#453850}body.dark .message.user .bubble{color:#fff;background:#7759b7}body.dark .scene-pill{background:#302637;border-color:#41304e}body.dark .create-card{background:#382e2b;border-color:#4b3b30}body.dark .create-card h2{color:#d6bba8}body.dark .create-card .card-art{color:#715a42}body.dark .trait-tag{background:#392c48;border-color:#473453;color:#c2a3dc}body.dark .trait-tag:nth-child(2){background:#41332a;border-color:#4c392c;color:#cead92}body.dark .trait-tag:nth-child(3){background:#293c32;border-color:#344b3c;color:#9ac2a5}body.dark .mood-badge{background:#433c2a}body.dark .connection-banner{background:#443924;color:#d1b16e}body.dark .messages{background-blend-mode:soft-light}body.dark .starter-prompts button{background:#2d2436;border-color:#443450}body.dark .chat-error{background:#42272e;border-color:#6b3b46;color:#e6a4ae}body.dark .form-error{background:#42272e;color:#e6a4ae}body.dark .scene-pill strong{color:#b09bc3}
@keyframes appear{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:translateY(0)}}@keyframes bounce{0%,70%,100%{transform:translateY(0)}35%{transform:translateY(-3px)}}@keyframes pulse{50%{opacity:.5}}
@media(min-width:1700px){.app-shell{margin:35px auto;height:calc(100dvh - 70px)}}
@media(max-width:1400px){.app-shell{grid-template-columns:70px 280px minmax(0,1fr) 242px;margin:14px;height:calc(100dvh - 28px)}.sidebar{padding-left:17px;padding-right:17px}.profile-panel{padding:24px 18px}.profile-hero .avatar{width:91px;height:91px}.conversation-header{padding:17px 21px}.messages{padding:20px 22px}.scenario-strip{padding:13px 21px 0}.composer-area{padding-left:21px;padding-right:21px}.create-card h2{font-size:20px}}
@media(max-width:1190px){.app-shell{grid-template-columns:66px 285px minmax(0,1fr)}.profile-panel{display:none}.bubble{font-size:13px}.messages{padding-left:26px;padding-right:26px}.conversation-header{min-height:82px}.header-name h2{max-width:260px}}
@media(max-width:800px){.app-shell{grid-template-columns:58px 245px minmax(0,1fr);margin:0;height:100dvh;border:0;border-radius:0;min-height:0}.rail{padding:20px 5px}.sidebar{padding:22px 13px 0}.wordmark{font-size:23px}.sidebar-heading{margin-top:29px}.sidebar-heading h1{font-size:21px}.chat-row{gap:9px}.chat-row .avatar{width:41px;height:41px}.create-card{padding:18px 13px}.create-card h2{font-size:20px}.card-art{font-size:62px}.conversation-header{padding:13px 15px;gap:7px}.header-name h2{max-width:135px}.header-character{gap:9px}.header-actions{gap:0}.conversation-header .avatar{width:37px;height:37px}.header-actions .optional-action{display:none}.scenario-strip{padding:10px 14px 0}.scene-pill .scene-change{font-size:0;gap:0}.messages{padding:18px 15px}.message-content{max-width:85%}.message .avatar{display:none}.composer-area{padding:0 13px 12px}.starter-prompts button{font-size:9px}.composer-caption{font-size:7px}.scene-pill .scene-text{font-size:10px}}
@media(max-width:620px){.app-shell{display:flex;flex-direction:column}.rail{display:none}.sidebar{flex:1;border:0;width:100%;padding:24px 22px 0;min-height:0;padding-top:max(24px,env(safe-area-inset-top))}.wordmark{font-size:26px}.sidebar-heading{margin:27px 0 21px}.sidebar-heading h1{font-size:27px}.sidebar-heading p{font-size:13px}.sidebar-heading .primary-icon{height:42px;width:42px;border-radius:13px}.search-field{padding:14px}.search-field input{font-size:13px}.chat-filters{margin:19px 0 17px}.filter{font-size:12px;padding:8px 12px}.chat-row{padding:17px 13px;gap:14px}.chat-row .avatar{width:53px;height:53px}.chat-row-top strong{font-size:15px}.chat-row-top time{font-size:10px}.chat-preview{font-size:12px}.create-card{margin-top:15px;margin-bottom:16px;min-height:150px;padding:19px}.create-card h2{font-size:23px}.create-card h2 br{display:none}.create-card p{max-width:unset;font-size:11px}.create-card .card-art{top:38px;right:19px;font-size:77px;opacity:.7}.create-card button{font-size:12px;margin-top:14px}.sidebar-footer{min-height:58px;padding-bottom:env(safe-area-inset-bottom);font-size:10px}.mobile-settings{display:inline-flex;margin-left:auto}.conversation{display:none;height:100dvh;width:100%}.app-shell.mobile-chat .sidebar{display:none}.app-shell.mobile-chat .conversation{display:flex}.mobile-back{display:inline-flex;width:30px}.conversation-header{min-height:77px;padding:12px 14px 12px 8px;padding-top:max(12px,env(safe-area-inset-top));gap:6px}.conversation-header .avatar{width:43px;height:43px}.header-name h2{font-size:16px;max-width:180px}.header-mood{font-size:10px}.header-actions .icon-button{width:35px}.header-character{gap:10px}.ai-tag{font-size:8px}.scenario-strip{padding:10px 15px 0}.scene-pill{padding:11px 12px}.scene-pill .scene-text{font-size:11px}.scene-pill .scene-change{font-size:10px;gap:4px}.connection-banner{font-size:10px;padding:7px 14px}.messages{padding:20px 17px}.bubble{font-size:13px;line-height:1.8;padding:11px 14px}.message-content{max-width:85%}.message{margin-bottom:17px}.message-meta{font-size:9px}.message .avatar{display:inline-block;width:25px;height:25px}.message.assistant .message-content{max-width:82%}.composer-area{padding:0 13px max(11px,env(safe-area-inset-bottom))}.composer{padding:8px}.composer textarea{font-size:16px;line-height:22px;padding:7px 3px}.send-button{width:38px;height:38px}.composer-caption{font-size:8px;margin-top:8px}.starter-prompts button{font-size:10px}.typing-indicator{padding-left:19px}.chat-intro{padding:20px 0 30px}.chat-intro .avatar{width:80px;height:80px}.chat-intro h2{font-size:21px}.chat-intro p{font-size:12px}.intro-traits span{font-size:10px}.main-dialog{max-height:calc(100dvh - 24px);border-radius:19px;width:calc(100vw - 20px)}.dialog-header{padding:22px 20px 18px}.dialog-header h2{font-size:21px}.dialog-body{padding:22px 20px}.dialog-footer{padding:16px 20px;padding-bottom:max(16px,env(safe-area-inset-bottom))}.field input,.field select,.field textarea{font-size:16px;padding:11px}.field-row{grid-template-columns:1fr 85px}.field-row .field:last-child{grid-column:1 / -1}.avatar-choices{gap:8px}.avatar-choice .avatar{width:40px;height:40px}.choice-button{padding:10px 11px}.scenario-grid{gap:9px}.scenario-choice{padding:13px 11px;gap:8px}.scenario-choice small{font-size:9px}.profile-panel.in-dialog{display:block;border:0;padding:0 18px}.profile-panel.in-dialog .profile-hero{margin-top:20px}.profile-panel.in-dialog .profile-section{padding:17px 0}}
@media(max-width:360px){.sidebar{padding-left:17px;padding-right:17px}.header-name h2{max-width:128px}.header-name{gap:5px}.scene-pill .scene-change{font-size:0}.avatar-choices{gap:5px}.avatar-choice .avatar{width:37px;height:37px}.scenario-grid{grid-template-columns:1fr}.composer-caption{font-size:7px}.message.assistant .message-content{max-width:80%}}
@media(max-height:730px) and (min-width:621px){.create-card{padding:15px}.create-card h2{font-size:18px;margin-top:8px}.create-card p{display:none}.sidebar-heading{margin:24px 0 18px}.profile-hero{margin:16px 0}.profile-hero .avatar{width:77px;height:77px}.profile-hero h2{margin-top:15px;font-size:21px}.profile-quote{margin-bottom:16px}.profile-section{padding:15px 0}.profile-bottom{margin-top:16px}.chat-intro{padding:10px 0 20px}}
/* Keep message text readable across desktop, compact screens and both themes. */
.bubble{font-size:14px;color:#5e536c}.message-meta{font-size:10px;color:#9587a4}.chat-preview{font-size:12px;color:#857891}.chat-row-top strong{font-size:14px}.header-mood{font-size:11px}.profile-quote,.memory-note{font-size:11px;color:#8f7f9d}.composer-caption{color:#92819f}.scene-pill .scene-text{font-size:12px}.scene-pill .scene-change{font-size:11px}.profile-panel .section-label{font-size:10px}.chat-intro p{color:#8c7e99}.intro-traits span{color:#8b74a2}.create-card h2 br::after{content:' '}
body.dark .messages{background-image:linear-gradient(#201c29dd,#201c29dd),url('wallpaper.svg');background-blend-mode:normal}
body.dark .header-character,body.dark .chat-row{color:var(--ink)}
body.dark .profile-quote,body.dark .memory-note,body.dark .chat-preview{color:#b0a0bd}
@media(max-width:620px){.create-card h2 br{display:initial}.create-card h2{font-size:21px}.create-card h2 br::after{content:' '}.bubble{font-size:14px}.scene-pill .scene-text{font-size:11px}}
@media(max-width:360px){.scene-pill .scene-change{font-size:0}.bubble{font-size:13px}}
/* Keep creation before the list, with one scrollable sidebar on short screens. */
.app-shell{grid-template-rows:minmax(0,1fr)}.rail{min-height:0;overflow-y:auto}.rail>*{flex-shrink:0}
.sidebar{overflow-y:auto;overscroll-behavior:contain;padding-bottom:env(safe-area-inset-bottom)}
.sidebar>*{flex-shrink:0}.sidebar .chat-list{flex:1 0 auto;min-height:0;overflow:visible}
.sidebar .create-card{margin:0 0 18px;padding:15px;min-height:0}
.sidebar .create-card h2{margin-top:5px;font-size:21px}.sidebar .create-card p{display:block;max-width:unset;margin-top:5px}
.create-card .card-art{pointer-events:none;opacity:.4}.create-actions{position:relative;display:flex;flex-wrap:wrap;gap:0 18px;margin-top:6px}
.create-actions button{min-height:44px;margin:0;text-align:left;gap:7px}
.field-row{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}
.avatar-choices{display:grid;grid-template-columns:repeat(auto-fit,minmax(65px,1fr));gap:10px;margin:15px 0 0}
.avatar-choice{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;border-radius:13px;padding:7px 3px;line-height:1.3;font-size:10px;text-transform:capitalize}
.avatar-choice.selected{background:var(--lavender)}.avatar-choice .avatar{width:46px;height:46px}
@media(max-width:620px){.sidebar .sidebar-heading{margin:18px 0 16px}.sidebar .create-card{padding:12px 15px;margin-bottom:14px}.sidebar .create-card .card-art{top:15px;font-size:65px}.sidebar .create-card h2{font-size:20px}.create-actions button{font-size:11px}.field-row .field:last-child{grid-column:auto}.avatar-choices{gap:7px}.avatar-choice .avatar{width:42px;height:42px}.sidebar-footer{padding-bottom:0}.sidebar{padding-bottom:max(12px,env(safe-area-inset-bottom))}}
@media(max-width:360px){.field-row{grid-template-columns:1fr}.create-actions{gap:0 10px}.create-actions button{font-size:10px;gap:4px}}
/* A brighter story palette keeps the existing layout familiar. */
body:not(.dark){--bg:#f0ecf8;--chat:#faf8ff;--purple:#7956c9;--purple-dark:#6140b0;--lavender:#eee6fc}
body:not(.dark) .rail{background:linear-gradient(175deg,#f0e9fc 0%,#fdf0ec 62%,#edf8f3 100%)}
body:not(.dark) .sidebar{background:linear-gradient(180deg,#fff 0%,#fff 70%,#faf7ff 100%)}
.sidebar .create-card{background:linear-gradient(125deg,#f0e6ff 0%,#ffece5 57%,#fff5df 100%);border-color:#e9d8f8;box-shadow:0 10px 24px #8053b818}
.create-card .eyebrow{color:#7c58a8}.create-card h2{color:#503675}.create-card p{color:#795f84}
.create-card .card-art{color:#a97cdb;opacity:.34}
.update-badge{position:relative;display:inline-block;margin-left:7px;padding:4px 7px;border-radius:999px;background:#fff9f5;color:#a34f78;font-size:8px;font-weight:800;letter-spacing:.5px;white-space:nowrap}
.create-actions button:first-child{padding:0 11px;border-radius:9px;background:#704bbb;color:#fff;box-shadow:0 4px 10px #6b45ad25}
.create-actions button:first-child:hover{background:#58399d}
.create-actions button:last-child{color:#6741a3}
.primary-icon,.send-button,.primary-button{background:linear-gradient(135deg,#8e65dc,#6844b5);box-shadow:0 5px 13px #7750c52b}
.primary-icon:hover,.send-button:hover,.primary-button:hover{background:linear-gradient(135deg,#7951ce,#5736a2)}
.chat-row.active{background:linear-gradient(110deg,#efe8fc,#fff1ef);border-color:#e6d8f6}
.conversation-header{background:linear-gradient(90deg,var(--surface),#fbf5ff)}
.scene-pill{background:linear-gradient(100deg,#f0eafd,#fdf1f7);border-color:#e8d9f4}
.message.user .bubble{background:linear-gradient(140deg,#8964d4,#6a48b5)}
.discover-section-label{margin:14px 0 10px;color:#8369a7;font-size:10px;letter-spacing:1.2px;font-weight:800}
.discover-section-label:first-child{margin-top:0}
.discover-card{transition:border-color .18s,box-shadow .18s,transform .18s}
.discover-card:hover{border-color:#d7c3ee;box-shadow:0 7px 20px #6d47a417;transform:translateY(-1px)}
.discover-card.rival-card{background:linear-gradient(105deg,#f4eaff,#fff0e7);border-color:#e6d2ee}
.rival-card .avatar{box-shadow:0 0 0 3px #e7c9ef}
.discover-role{display:inline-block;vertical-align:middle;margin-left:5px;padding:3px 5px;border-radius:5px;background:#f9dce9;color:#883b75;font-family:'DM Sans',sans-serif;font-size:8px;letter-spacing:.4px;white-space:nowrap}
.rival-tag,.trait-tag.villain-trait{background:#f9deeb;color:#86396d;border-color:#eec4dc}
.chat-row.rival-chat .avatar{box-shadow:0 0 0 2px #dfa6d0}
.profile-hero.rival-profile .avatar{box-shadow:0 0 0 8px #f4e5f4}
.choice-button[data-trait="villainous"].selected{background:#f9deeb;color:#86396d;border-color:#c46a9c;box-shadow:0 0 0 1px #c46a9c}
body.dark .rail{background:linear-gradient(175deg,#2b203e 0%,#352538 65%,#253b37 100%)}
body.dark .sidebar .create-card{background:linear-gradient(125deg,#392c55,#53313d 65%,#55402e);border-color:#60426e;box-shadow:0 10px 24px #0003}
body.dark .create-card h2{color:#f0dafa}body.dark .create-card p{color:#dfc2d3}body.dark .create-card .eyebrow{color:#cfaae6}body.dark .create-card .card-art{color:#d7a1e8}
body.dark .update-badge{background:#74485e;color:#ffe1ef}
body.dark .create-actions button:first-child{background:#a47be0;color:#20152d}body.dark .create-actions button:last-child{color:#e0bafa}
body.dark .conversation-header{background:linear-gradient(90deg,#25212e,#30243b)}
body.dark .chat-row.active{background:linear-gradient(110deg,#382748,#45303c);border-color:#604360}
body.dark .scene-pill{background:linear-gradient(100deg,#322943,#402c3d);border-color:#57405f}
body.dark .discover-card.rival-card{background:linear-gradient(105deg,#382a46,#4b303b);border-color:#64425d}
body.dark .discover-role,body.dark .rival-tag,body.dark .trait-tag.villain-trait{background:#693b59;color:#ffd9ef;border-color:#8b5675}
body.dark .choice-button[data-trait="villainous"].selected{background:#633d58;color:#ffdbed;border-color:#b27b9d;box-shadow:0 0 0 1px #b27b9d}
body.dark .profile-hero.rival-profile .avatar{box-shadow:0 0 0 8px #493049}
body.dark .discover-section-label{color:#d2ace5}
.suggested-rival{display:flex;align-items:center;gap:12px;width:100%;margin:0 0 7px;padding:12px 10px;border:1px dashed #d8b8e5;border-radius:13px;background:linear-gradient(110deg,#f7efff,#fff3ed);text-align:left}
.suggested-rival:hover{border-style:solid;background:linear-gradient(110deg,#f0e3fc,#ffebe5)}
.suggested-rival .avatar{width:42px;height:42px;box-shadow:0 0 0 2px #e7c9ef}
.suggested-rival .chat-row-top{margin-bottom:3px}.suggested-rival .chat-row-top strong{font-size:13px}
.suggested-rival .chat-preview{display:block;font-size:10px;color:#846d91}
.suggested-badge{padding:3px 5px;border-radius:5px;background:#f6dce9;color:#8d4279;font-size:8px;font-weight:800;letter-spacing:.4px}
.suggested-plus{display:grid;place-items:center;flex-shrink:0;width:25px;height:25px;border-radius:50%;background:#7b54c4;color:#fff}.suggested-plus svg{width:14px;height:14px}
.quick-rivals{margin:0 0 23px;padding:15px;border:1px solid #e7d5f4;border-radius:13px;background:linear-gradient(110deg,#f7efff,#fff2ec)}
.quick-rivals h3{font-size:12px;color:#66448d}.quick-rivals p{margin:5px 0 13px;color:#826f91;font-size:10px;line-height:1.5}
.quick-rivals>div{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.quick-rivals button{display:flex;align-items:center;gap:9px;min-width:0;padding:8px;border:1px solid #e2cfef;border-radius:10px;background:#fff9;text-align:left}
.quick-rivals button:hover{background:#fff;border-color:#b997d8}.quick-rivals .avatar{width:35px;height:35px}
.quick-rivals button span{display:flex;min-width:0;flex-direction:column}.quick-rivals button strong{font-size:11px}.quick-rivals button small{font-size:9px;color:#8b6f9a}
body.dark .suggested-rival{background:linear-gradient(110deg,#392b48,#47313d);border-color:#745273}
body.dark .suggested-rival:hover{background:linear-gradient(110deg,#493355,#573844)}body.dark .suggested-rival .chat-preview{color:#cfb6d1}
body.dark .suggested-badge{background:#6d405c;color:#ffdeed}body.dark .suggested-plus{background:#a780df;color:#24172f}
body.dark .quick-rivals{background:linear-gradient(110deg,#392b48,#49313c);border-color:#654968}
body.dark .quick-rivals h3{color:#e3c4f2}body.dark .quick-rivals p,body.dark .quick-rivals button small{color:#cbb4ce}
body.dark .quick-rivals button{background:#302639;border-color:#684e6d}body.dark .quick-rivals button:hover{background:#46324d}
@media(max-width:620px){.suggested-rival{padding:13px}.suggested-rival .avatar{width:49px;height:49px}.suggested-rival .chat-row-top strong{font-size:14px}.suggested-rival .chat-preview{font-size:11px}}
@media(max-width:360px){.quick-rivals>div{grid-template-columns:1fr}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}
.adventure-entry{display:flex;align-items:center;justify-content:space-between;width:calc(100% - 32px);margin:8px 16px;padding:12px 14px;border:1px solid var(--line, #dfd5eb);border-radius:12px;background:var(--surface, #fff);color:inherit;font:inherit;font-weight:700;cursor:pointer}
.adventure-entry span{min-width:1.6em;text-align:center;border-radius:99px;background:#e9dcff;color:#56339d;font-size:.8em}
.adventure-event{padding:14px 0;border-bottom:1px solid #ddd2e8}
.adventure-event time{font-size:.8em;opacity:.65}
.adventure-event h3{margin:5px 0 10px;font-size:1rem}
.adventure-event p{margin:7px 0;line-height:1.45;white-space:pre-wrap}
/* SECTION — Shared adventures and scene presence. */
.group-sidebar { padding: 12px 14px; border-top: 1px solid var(--border, #ddd5ee); }
.group-sidebar-title, .group-adventure-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.group-sidebar-title { margin-bottom: 10px; }
.group-adventure-row { margin: 10px 0 4px; font-size: .9rem; }
.group-scene-row { display: flex; width: 100%; justify-content: space-between; gap: 8px; padding: 9px 12px; border: 0; border-radius: 10px; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.group-scene-row.active { background: #eee7fb; color: #553398; }
.dark .group-scene-row.active { background: #403157; color: #f3eaff; }
.group-scene-row span, .group-empty { opacity: .7; font-size: .8rem; }
.group-heading { flex: 1; min-width: 0; }
.group-heading h2 { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.group-heading p { margin: 2px 0 0; font-size: .8rem; opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-scene-strip { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 8px 18px; }
.group-scene-strip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.group-address { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: .85rem; }
.group-address[hidden] { display: none; }
.group-address select, .group-person select { min-width: 0; padding: 6px 9px; border: 1px solid #cbbce4; border-radius: 8px; background: var(--surface, #fff); color: inherit; }
.group-speaker { font-weight: 700; font-size: .78rem; margin: 0 0 4px 4px; }
.group-profile { padding: 24px; }
.group-profile ul { padding-left: 22px; }
.group-person { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 9px 0; border-bottom: 1px solid #ddd5ee; }
.group-person .avatar { width: 36px; height: 36px; }
.group-person span { flex: 1; min-width: 100px; }
.group-person small { display: block; opacity: .7; }
.group-person .outline-button { padding: 7px 10px; }
.group-dialog-adventure { margin-bottom: 14px; }
.group-dialog-adventure button { margin: 4px; }

.user-avatar{display:grid;place-items:center;overflow:hidden;padding:0}
.user-avatar img{display:block;width:100%;height:100%;object-fit:cover;border-radius:50%}
.mobile-user-avatar{display:none;margin:0 0 0 auto;flex-shrink:0}
@media(max-width:620px){.wordmark .mobile-user-avatar{display:grid}}
.user-photo-row{display:flex;align-items:center;gap:16px;margin:15px 0 20px}
.user-photo-row>div:last-child{flex:1;min-width:0}
.user-photo-row .field{margin-bottom:5px}
.user-photo-preview{display:grid;place-items:center;width:76px;height:76px;flex-shrink:0;overflow:hidden;border-radius:50%;background:var(--lavender);color:var(--purple);font-size:28px;font-weight:700}
.user-photo-preview img{width:100%;height:100%;object-fit:cover}
.user-photo-row .text-button{padding:6px 0;color:#b15768}

/* Keep every desktop navigation action visible on narrow screens. */
.rail-bottom [data-action="install"] span,.rail-bottom [data-action="theme"] span,.rail-bottom [data-action="settings"] span{display:none}
@media(max-width:620px){
  .app-shell .rail{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:2px;align-items:stretch;width:100%;height:auto;min-height:0;flex:0 0 auto;overflow:visible;padding:max(6px,env(safe-area-inset-top)) 6px 6px;border-bottom:1px solid var(--line)}
  .rail .brand-mark,.rail-bottom .user-avatar{display:none}
  .rail-links,.rail-bottom,.rail-bottom form{display:contents}
  .rail-button,.rail-button.active{width:100%;height:46px;min-height:46px;padding:4px 1px;gap:2px;border-radius:9px;flex-direction:column;justify-content:center;text-align:center}
  .rail-button svg{width:18px;height:18px}
  .rail-button span{font-size:10px;font-weight:650;white-space:nowrap}
  .rail-bottom [data-action="install"] span,.rail-bottom [data-action="theme"] span,.rail-bottom [data-action="settings"] span{display:inline}
  .app-shell.mobile-chat .conversation{height:auto;min-height:0;flex:1}
}
