/* AAO AI V36 — mobile-first layout and safe-area repair */
html,body{max-width:100%;overflow-x:hidden}
*,*::before,*::after{box-sizing:border-box}
img,video,canvas,svg,iframe{max-width:100%}
.chat-page,.chat-shell,.chat,.messages,.tool-home,.front-tool-groups,.front-tool-groups>*{min-width:0;max-width:100%}
.messages,.bubble,.answer-body,.answer-body p,.answer-body li,.composer-note{overflow-wrap:anywhere;word-break:normal}
.bubble pre,.bubble code{max-width:100%}.bubble pre{overflow:auto}
.remember-choice{display:flex!important;flex-direction:row!important;align-items:center;gap:9px}.remember-choice input{width:auto!important;margin:0!important}
.close-history{margin-left:auto!important;width:36px;height:36px;padding:0;border-radius:10px;background:#2b2b2b;color:#fff;font-size:20px}
.welcome-notice{position:relative;z-index:40;margin:8px auto 0;width:min(960px,calc(100% - 24px))}
.premium-dialog{width:min(520px,calc(100vw - 24px));padding:0;border:0;border-radius:20px;box-shadow:0 28px 90px #0006}.premium-dialog::backdrop{background:#0008}.premium-dialog .modal-card{position:relative}.premium-close{position:absolute;top:10px;right:10px;width:36px;height:36px;padding:0;border-radius:50%;background:#f1efe9;color:#222;font-size:22px}.premium-dialog h2{padding-right:34px}.premium-dialog p{line-height:1.6;color:#5f5a50}.premium-dialog .inline{flex-wrap:wrap}
.free-account .composer .attach-button,.free-account .composer .camera-button,.free-account #researchMode,.free-account #thinkHarder,.free-account [data-compose-mode="image"]{position:relative}.free-account .composer .attach-button::after,.free-account .composer .camera-button::after{content:"";position:absolute;right:2px;top:2px;width:7px;height:7px;border-radius:50%;background:#d6aa1f}

@media(max-width:800px){
  html:has(body.chat-mode),body.chat-mode{width:100%;height:100%;min-width:0;overflow:hidden!important;overscroll-behavior:none}
  .chat-page{position:fixed!important;inset:0!important;width:100%!important;height:var(--aao-visible-height,100dvh)!important;min-height:0!important;max-height:var(--aao-visible-height,100dvh)!important;overflow:hidden!important}
  .chat-shell{display:block!important;width:100%!important;height:100%!important}
  .chat{position:absolute!important;inset:0!important;display:grid!important;grid-template-rows:auto minmax(0,1fr) auto!important;width:100%!important;height:100%!important;min-height:0!important;max-height:100%!important;overflow:hidden!important}
  .threads{position:fixed!important;inset:0 auto 0 0!important;width:min(88vw,340px)!important;max-width:340px!important;height:100dvh!important;transform:translateX(-105%)!important;transition:transform .22s ease!important;z-index:60!important;overflow-y:auto!important;overscroll-behavior:contain}
  .chat-history-open .threads{transform:translateX(0)!important}
  .chat-history-open::after{content:"";position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:55}
  .chat-head{width:100%;min-width:0;padding:8px 10px!important;gap:7px!important}
  .chat-head>.mobile{flex:0 0 38px;width:38px;height:38px;margin:0!important;padding:0!important}
  .chat-head>#chatTitle{flex:1 1 auto;min-width:0;max-width:none!important;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:14px}
  .chat-tools{flex:0 0 auto;min-width:0;gap:4px!important}.model-pill{max-width:132px;padding:7px 9px!important}.model-pill span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px}
  .messages{position:relative;width:100%!important;height:auto!important;min-height:0!important;padding:14px 10px 24px!important;overflow-x:hidden!important;overflow-y:auto!important;overscroll-behavior:contain;scroll-padding-bottom:28px;-webkit-overflow-scrolling:touch}
  .tool-home{width:100%!important;margin:0!important;padding:14px 2px 28px!important}.tool-home>h1{font-size:clamp(23px,7vw,30px)!important;line-height:1.15!important}.tool-home>p{font-size:14px;line-height:1.55;padding:0 6px}
  .prompt-cards{width:100%;grid-template-columns:1fr!important;gap:8px!important}.prompt-cards button{width:100%;min-width:0;text-align:left}
  .front-tool-head{margin-top:18px!important}.front-tool-groups{grid-template-columns:1fr!important}.front-tool-groups section>div{grid-template-columns:1fr!important}
  .bubble{width:auto!important;max-width:100%!important;margin:10px 0!important;font-size:15px!important;line-height:1.58!important}.bubble.user{max-width:92%!important;margin-left:auto!important}.bubble.ai{padding-left:4px!important;padding-right:2px!important}
  .answer-table-wrap{max-width:100%;overflow:auto;-webkit-overflow-scrolling:touch}.answer-table-wrap table{min-width:560px}
  .composer-wrap{position:relative!important;inset:auto!important;bottom:auto!important;align-self:end!important;width:100%!important;min-width:0!important;max-width:100%!important;margin:0!important;padding:6px 8px max(10px,env(safe-area-inset-bottom))!important;background:linear-gradient(to bottom,rgba(255,255,255,.93),#fff 22%)!important;border-top:1px solid #eee;z-index:20!important;transform:translateZ(0)}
  .mode-bar{width:100%;max-width:100%!important;padding:0 0 6px!important;overflow-x:auto!important;scrollbar-width:none}.mode-bar::-webkit-scrollbar{display:none}.mode-bar button{flex:0 0 auto;white-space:nowrap}
  .chat form.composer{display:grid!important;grid-template-columns:36px 36px 36px minmax(0,1fr) 40px!important;align-items:end!important;width:100%!important;max-width:100%!important;min-width:0!important;margin:0!important;padding:6px!important;gap:3px!important;border-radius:18px!important;overflow:hidden!important}
  .chat form.composer .attach-button,.chat form.composer .tool-button{width:36px!important;min-width:36px!important;height:36px!important}.chat form.composer .send-button{width:40px!important;min-width:40px!important;height:40px!important}
  .chat form.composer textarea{width:100%!important;min-width:0!important;max-width:100%!important;min-height:40px!important;max-height:120px!important;margin:0!important;padding:9px 5px!important;font-size:16px!important;line-height:1.4!important;resize:none}
  .composer-note{width:100%;padding:0 3px;font-size:9px!important;white-space:nowrap!important;overflow:hidden;text-overflow:ellipsis}
  .creation-options{width:100%;max-width:100%;max-height:40vh;overflow:auto}.creation-options select{width:100%;flex:1 1 45%}
  .soft-notice{max-width:calc(100% - 16px);margin:6px 8px!important;font-size:12px}
  body>.pwa-install-prompt{bottom:calc(82px + env(safe-area-inset-bottom))!important;left:8px!important;right:8px!important;width:auto!important;max-width:none!important;grid-template-columns:32px minmax(0,1fr) auto auto!important;gap:7px!important;padding:9px!important}body>.pwa-install-prompt .pwa-close{position:static!important;width:30px!important;height:32px!important}body>.pwa-install-prompt span{display:none!important}
  .paywall{width:calc(100% - 20px);margin:18px 10px;padding:18px!important}.paywall h1{font-size:25px}.paywall form{width:100%}
}

@media(max-width:390px){
  .chat-head{padding-inline:6px!important}.model-pill{max-width:108px}.model-pill span{font-size:11px}
  .messages{padding-inline:7px!important}
  .chat form.composer{grid-template-columns:34px 34px 34px minmax(0,1fr) 38px!important;padding:5px!important;gap:2px!important}
  .chat form.composer .attach-button,.chat form.composer .tool-button{width:34px!important;min-width:34px!important;height:34px!important}.chat form.composer .send-button{width:38px!important;min-width:38px!important;height:38px!important}
  .chat form.composer textarea{font-size:16px!important;padding-inline:3px!important}
}

@supports not (height:100dvh){@media(max-width:800px){.chat-page{height:var(--aao-visible-height,100vh)!important;max-height:var(--aao-visible-height,100vh)!important}}}

@media(min-width:801px) and (max-width:1200px){
  .chat-shell{grid-template-columns:250px minmax(0,1fr)!important}.messages{padding-left:3vw!important;padding-right:3vw!important}.tool-home{padding-left:8px!important;padding-right:8px!important}
}

@media(display-mode:standalone){body{overscroll-behavior:none}.chat-page{height:100dvh}.pwa-install-prompt{display:none!important}}

/* V38 interaction polish: reliable drawers, downloads and visible sign-out */
.quick-signout{display:inline-flex;align-items:center;gap:7px;margin-left:auto;padding:8px 11px;border:1px solid #e2dccd;border-radius:11px;background:#fff;color:#28251d;text-decoration:none;font-size:12px;font-weight:750;white-space:nowrap}.quick-signout b{font-size:16px}.mobile-account-close{display:none}.export-menu>div{display:grid!important;min-width:300px;grid-template-columns:repeat(5,minmax(48px,1fr));white-space:nowrap}.export-menu>div button{min-width:48px;white-space:nowrap;word-break:normal!important}.landing-page{min-height:100%;overflow-y:auto;overscroll-behavior-y:auto;touch-action:pan-y}.landing-page main{overflow:visible}
@media(max-width:800px){
  .menu::after,.chat-history-open::after{pointer-events:none!important}.chat-history-open .threads{pointer-events:auto!important;filter:none!important;opacity:1!important}.close-history{position:relative;z-index:3;pointer-events:auto!important}
  body>aside{z-index:150!important}.mobile-account-close{display:grid;place-items:center;position:absolute;top:max(10px,env(safe-area-inset-top));right:10px;width:38px;height:38px;padding:0;border:0;border-radius:11px;background:#272727;color:#fff;font-size:24px;z-index:2}
  .quick-signout{padding:7px 9px}.chat-head .quick-signout span{display:none}.chat-head .quick-signout{flex:0 0 38px;width:38px;height:38px;justify-content:center;margin-left:2px;padding:0;border-radius:12px}
  .export-menu{position:static!important}.export-menu>div{position:fixed!important;left:12px!important;right:12px!important;bottom:calc(104px + env(safe-area-inset-bottom))!important;display:grid!important;min-width:0!important;width:auto!important;padding:9px!important;gap:6px!important;z-index:120!important}.export-menu>div button{min-width:0!important;padding:10px 4px!important;font-size:12px!important}
}
@media(max-width:390px){.quick-signout{padding:7px}.export-menu>div{grid-template-columns:repeat(3,1fr)!important}.export-menu>div button{min-height:38px!important}}

/* V39 compact mobile tools, consistent typography and reliable page scrolling */
@media(max-width:800px){
  body:not(.chat-mode){height:auto!important;min-height:100dvh!important;overflow-x:hidden!important;overflow-y:auto!important;overscroll-behavior-y:auto!important;touch-action:pan-y!important;-webkit-overflow-scrolling:touch}
  body:has(.tools-page),body:has(.tools-page) .main{height:auto!important;min-height:100dvh!important;overflow:visible!important}
  .tools-page{display:block!important;width:100%!important;max-width:100%!important;padding-bottom:70px!important}
  .tools-page .tool-groups{display:grid!important;gap:18px!important}.tools-page .tool-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
  .tools-page .tool-card{min-height:142px!important;padding:12px!important;border-radius:13px!important}.tools-page .tool-card h3{font-size:13px!important;line-height:1.25!important}.tools-page .tool-card p{display:-webkit-box!important;-webkit-box-orient:vertical!important;-webkit-line-clamp:3!important;overflow:hidden!important;font-size:11.5px!important;line-height:1.35!important}.tools-page .tool-card .button{padding:8px 9px!important;font-size:11.5px!important}
  .tool-home{font-family:Inter,system-ui,-apple-system,"Segoe UI",Arial,sans-serif!important}.tool-home>h1{margin:10px 0 7px!important;font-size:24px!important;font-weight:750!important;letter-spacing:-.025em!important}.tool-home>p{margin:0 auto 14px!important;max-width:520px!important;font-size:13px!important;line-height:1.45!important}
  .tool-home .prompt-cards{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:7px!important}.tool-home .prompt-cards button{min-height:46px!important;padding:9px 10px!important;border-radius:12px!important;font-size:12px!important;line-height:1.3!important;font-weight:700!important}
  .tool-home .front-tool-head{display:flex!important;align-items:center!important;flex-direction:row!important;margin:16px 0 9px!important;padding-top:13px!important}.tool-home .front-tool-head b{font-size:13px!important}.tool-home .front-tool-head a{font-size:11px!important;white-space:nowrap!important}
  .tool-home .front-tool-groups{gap:9px!important}.tool-home .front-tool-groups>section{padding:9px!important;border-radius:13px!important}.tool-home .front-tool-groups h2{margin:0 0 7px!important;font-size:13px!important}.tool-home .front-tool-groups section>div{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:6px!important}
  .tool-home .front-tool-groups a{min-height:46px!important;padding:7px!important;gap:7px!important;border-radius:10px!important}.tool-home .front-tool-groups a b{font-size:11.5px!important;line-height:1.2!important}.tool-home .front-tool-groups a small{display:none!important}.tool-home .tool-symbol{flex:0 0 25px!important;width:25px!important;height:25px!important;border-radius:7px!important;font-size:9px!important}
  .threads .new-chat{min-height:44px!important;font-size:14px!important;line-height:1.2!important}.history-label,.thread>a{font-family:Inter,system-ui,-apple-system,"Segoe UI",Arial,sans-serif!important}.thread>a{font-size:13px!important;line-height:1.25!important}
  .chat form.composer textarea{font-size:16px!important;font-weight:400!important;letter-spacing:0!important}.chat form.composer textarea::placeholder{color:#8c8c8c!important;font-size:14px!important;font-weight:400!important;opacity:1!important}
}
@media(max-width:360px){.tools-page .tool-grid{grid-template-columns:1fr!important}.tool-home .front-tool-head{align-items:flex-start!important;flex-direction:column!important}.tool-home .prompt-cards{grid-template-columns:1fr 1fr!important}.tool-home .front-tool-groups a{padding:6px!important}.tool-home .front-tool-groups a b{font-size:11px!important}}

/* V42 subtle free-account attribution shown after the complete answer */
.chat-promotion{display:flex;flex-wrap:wrap;align-items:center;gap:3px 8px;margin:18px 0 2px;padding-top:10px;border-top:1px solid #eadfbf;color:#786b4d;font-size:10.5px;line-height:1.35}.chat-promotion b{font-size:11px;color:#554824}.chat-promotion span{font-weight:400}.chat-promotion a{color:#956f00;font-weight:700;text-decoration:none}.chat-promotion a:hover{text-decoration:underline}
@media(max-width:600px){.chat-promotion{display:block;margin-top:14px;font-size:10px}.chat-promotion b,.chat-promotion span,.chat-promotion a{display:block;margin-top:2px}}
