/* W111 — Full-height, keyboard-aware, app-like Junior AI chat. No outer card. */
:root{color-scheme:dark;--bg:#140d1c;--header:#160f20;--panel:#1e1528;--stroke:#32233d;--text:#faf5fd;--muted:#bfaecb;--purple:#a969df;--app-h:100dvh;--app-top:0px}
*{box-sizing:border-box}html{height:100%;background:var(--bg)}body{margin:0;height:100%;overflow:hidden;background:var(--bg);color:var(--text);font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;-webkit-tap-highlight-color:transparent}
button,textarea{font:inherit}button{touch-action:manipulation}a{color:inherit;text-decoration:none}button:focus-visible,a:focus-visible,textarea:focus-visible{outline:2px solid #dab1ff;outline-offset:3px}
.app-shell{position:fixed;top:var(--app-top);left:0;right:0;height:var(--app-h);display:flex;flex-direction:column;min-height:0;max-width:920px;margin:0 auto;background:linear-gradient(180deg,#180f22 0%,#140d1c 30%,#120c19 100%)}
.app-head{display:flex;align-items:center;gap:10px;flex-shrink:0;min-height:74px;padding:10px 16px;border-bottom:1px solid #34243f;background:rgba(24,15,33,.97);padding-top:max(10px,env(safe-area-inset-top))}
.back{height:44px;width:33px;display:grid;place-items:center;flex-shrink:0;border-radius:13px;color:#efe3f5}
.back svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.identity{display:flex;align-items:center;min-width:0;gap:10px;flex:1}.avatar{width:46px;height:46px;display:block;border-radius:50%;border:2px solid #74469b;object-fit:cover;object-position:center 34%;flex-shrink:0;background:#321b45}.identity-text{min-width:0}.identity-text h1{font-size:18px;line-height:1.18;letter-spacing:-.5px;margin:0;font-weight:750}.identity-text p{display:flex;align-items:center;gap:6px;margin:5px 0 0;color:#c6b1d0;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.status-dot{display:inline-block;flex-shrink:0;width:6px;height:6px;background:#78dbac;border-radius:50%;box-shadow:0 0 0 3px #78dbac1a}
.quota{display:flex;flex-direction:column;align-items:center;justify-content:center;flex-shrink:0;min-width:68px;height:43px;border-radius:13px;border:1px solid #4f3660;background:#2a1c35;padding:5px 7px;line-height:1.05}.quota-numeric{font-size:14px;font-weight:800;font-variant-numeric:tabular-nums}.quota small{margin-top:4px;font-size:9px;color:#cebcd6;text-align:center;line-height:1.1;max-width:80px}
.chat{display:flex;flex:1;flex-direction:column;min-height:0;min-width:0}.scroll{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:#614670 transparent;padding:24px max(18px,calc((100% - 720px)/2)) 20px;scroll-behavior:auto;touch-action:pan-y}
.message{display:flex;max-width:85%;margin:0 0 13px;align-items:flex-end}.message.owner{margin-left:auto;justify-content:flex-end}.message.junior{margin-right:auto}.bubble{padding:12px 15px;color:#f7f0fc;background:#291d34;border-radius:18px 18px 18px 6px;font-size:15px;line-height:1.52;white-space:pre-wrap;overflow-wrap:anywhere}.owner .bubble{background:#70419d;color:white;border-radius:18px 18px 6px 18px}.message.junior .bubble{border:1px solid #372542}.message+.message.owner{margin-top:8px}
.welcome{max-width:430px;margin:auto;padding:10px 4px 28px;text-align:center}.welcome[hidden],.writing[hidden],.notice[hidden]{display:none!important}.welcome-art{width:116px;height:130px;object-fit:cover;object-position:top center;border-radius:26px;margin:0 auto 14px;display:block;filter:drop-shadow(0 8px 18px #9e48db25)}.welcome h2{margin:0 0 9px;font-size:24px;letter-spacing:-.7px;line-height:1.15}.welcome p{color:#c8b9d0;line-height:1.55;font-size:14px;margin:0 auto;max-width:355px}.suggest{display:flex;justify-content:center;gap:9px;flex-wrap:wrap;margin-top:24px}.suggest button{background:#281b34;border:1px solid #674877;border-radius:999px;color:#e9d9f2;font-size:12px;line-height:1.3;padding:10px 13px;min-height:40px;cursor:pointer}.suggest button:active{background:#453050;transform:scale(.98)}
.writing{display:flex;align-items:center;gap:10px;width:max-content;max-width:100%;margin:8px 0 12px;padding:11px 15px;background:#281b33;border:1px solid #392845;border-radius:18px 18px 18px 6px;color:#cbb7d6;font-size:12px}.typing-dots{display:flex;gap:4px}.typing-dots i{height:6px;width:6px;border-radius:50%;background:#d7a7ff;animation:twinkle 1.2s infinite ease-in-out}.typing-dots i:nth-child(2){animation-delay:.18s}.typing-dots i:nth-child(3){animation-delay:.36s}@keyframes twinkle{0%,60%,100%{opacity:.4;transform:translateY(0)}30%{opacity:1;transform:translateY(-3px)}}
.proposal{width:min(100%,510px);margin:4px 0 19px;background:#251830;border:1px solid #8459a1;border-radius:18px;padding:17px 17px 15px;box-shadow:0 12px 28px #0603092b}.proposal strong{font-size:13px;display:block;margin-bottom:9px;color:#e0b8fb}.proposal p{margin:0 0 15px;font-size:14px;line-height:1.55;color:#f7ecff;white-space:pre-wrap;overflow-wrap:anywhere}.proposal-actions{display:flex;gap:9px}.proposal-actions button{flex:1;min-height:45px;border-radius:12px;border:1px solid transparent;background:#c58cef;color:#1f1029;font-weight:800;padding:10px;font-size:13px;cursor:pointer}.proposal-actions button:last-child{background:transparent;border-color:#61486d;color:#e8d7ed}.proposal-actions button:disabled{opacity:.5;cursor:wait}
.composer{flex-shrink:0;padding:10px 16px max(10px,env(safe-area-inset-bottom));background:#1a1123;border-top:1px solid #342640}.notice{font-size:12px;color:#f5b8ce;margin:0 3px 9px;line-height:1.4}.input-shell{display:flex;align-items:flex-end;gap:10px;min-height:50px;padding:5px 6px 5px 16px;border-radius:25px;border:1px solid #594466;background:#261b30;transition:border-color .16s}.input-shell:focus-within{border-color:#b67ade}.input-shell textarea{flex:1;min-width:0;max-height:130px;min-height:38px;padding:9px 0 8px;margin:0;background:transparent;outline:none;border:0;resize:none;color:#fff;font-size:16px;line-height:1.3;scrollbar-width:thin}.input-shell textarea::placeholder{color:#aa99b6}.input-shell textarea:focus-visible{outline:none}.send{width:40px;height:40px;min-width:40px;border:0;border-radius:50%;background:#ca9af1;color:#1d1026;display:grid;place-items:center;cursor:pointer;transition:opacity .15s,background .15s}.send svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}.send:disabled{opacity:.4;cursor:not-allowed;background:#91729f}.input-shell:has(textarea:disabled){opacity:.6}.composer-foot{margin:8px 0 0;text-align:center;color:#927e9e;font-size:10px;line-height:1.2}.composer-foot .dot{padding:0 4px}
@media(max-width:600px){.app-head{gap:7px;min-height:69px;padding-left:7px;padding-right:12px}.back{width:32px}.identity{gap:9px}.avatar{width:44px;height:44px}.identity-text h1{font-size:17px}.quota{min-width:66px}.quota small{max-width:67px;font-size:8px}.scroll{padding:18px 15px 15px}.message{max-width:88%;margin-bottom:10px}.bubble{font-size:15px;padding:11px 13px;line-height:1.48}.composer{padding:9px 12px max(9px,env(safe-area-inset-bottom))}.welcome{padding-top:10px;padding-bottom:14px}.welcome-art{width:103px;height:116px}.welcome h2{font-size:22px}.welcome p{font-size:13px}.suggest{margin-top:20px}.suggest button{font-size:12px}}
@media(max-height:570px){.composer-foot{display:none}.welcome-art{width:85px;height:90px}.welcome{padding:0 4px}.welcome h2{font-size:19px}.welcome p{font-size:12px}.suggest{margin-top:10px}.app-head{min-height:58px}.avatar{width:40px;height:40px}}
@media(min-width:601px){.app-shell{border-left:1px solid #31233b;border-right:1px solid #31233b;box-shadow:0 0 100px #0005}.app-head{padding-left:25px;padding-right:25px}.composer{padding-left:max(24px,calc((100% - 720px)/2));padding-right:max(24px,calc((100% - 720px)/2))}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important}}
/* Match a native messenger: short conversations sit above the composer; long ones scroll. */
.scroll{display:flex;flex-direction:column}
.scroll::before{content:"";flex:1 0 0}
.scroll:has(.welcome:not([hidden]))::before{display:none}
.scroll .message,.scroll .proposal,.scroll .writing{flex-shrink:0}

.status-dot.offline{background:#9a809e;box-shadow:none}
