
/* Chat reading layout: unbranded text replies and standalone image results. */
body:has(main.chat-page){background:var(--app-bg)!important}
body:has(main.chat-page) .app-root{background:radial-gradient(circle at 5% 0,rgba(196,164,119,0.2),transparent 27rem),radial-gradient(circle at 100% 24rem,rgba(196,164,119,0.1),transparent 25rem),var(--app-bg)!important}
main.chat-page #messages .bubble.assistant{
 background:transparent!important;border:0!important;box-shadow:none!important;border-radius:0!important;
 padding:12px 0!important;color:#f7f1e8!important;
 font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif!important;
 font-size:16px!important;font-weight:400!important;line-height:1.65!important;letter-spacing:normal!important;
 text-shadow:none!important;filter:none!important;backdrop-filter:none!important;
}
main.chat-page #messages .bubble.assistant::before,main.chat-page #messages .bubble.assistant::after{content:none!important;display:none!important}
main.chat-page #messages .bubble.assistant .message-content,main.chat-page #messages .bubble.assistant .stream-content{
 color:inherit!important;font:inherit!important;text-shadow:none!important;filter:none!important;letter-spacing:normal!important;
}
main.chat-page #messages .bubble.assistant .message-content p{line-height:inherit}
main.chat-page #messages .bubble.assistant .free-cost{display:none!important}
main.chat-page #messages .bubble.assistant.generated-image-only{
 padding:0!important;max-width:min(560px,100%)!important;background:transparent!important;
}
main.chat-page #messages .chat-generated-image-link{
 border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important;max-width:560px;
}
main.chat-page #messages .chat-generated-image{background:transparent!important;max-height:62vh}
main.chat-page #messages .generated-image-only .message-time,
main.chat-page #messages .generated-image-only .cost,
main.chat-page #messages .generated-image-only .chat-generated-image-meta{display:none!important}
body:has(main.chat-page) .composer::before{content:none!important;display:none!important}

/* Native long-press and mouse selection for both sides of the conversation. */
main.chat-page #messages,main.chat-page #messages .bubble,main.chat-page #messages .message-content,
main.chat-page #messages .message-content *,main.chat-page #messages .stream-content,
main.chat-page #messages .stream-content *{
 -webkit-user-select:text!important;user-select:text!important;-webkit-touch-callout:default!important;
}
main.chat-page #messages .answer-actions,main.chat-page #messages .answer-copy-top,
main.chat-page #messages .copy-answer{display:none!important}
main.chat-page #messages ::selection{background:#5c4530;color:#f7f1e8}

/* A single chat viewport keeps scrolling inside message bounds. */
body:has(main.chat-page){overflow:hidden!important;overscroll-behavior:none}
body:has(main.chat-page) .app-root{height:100dvh;min-height:0!important;padding-bottom:0!important;overflow:hidden}
main.app-wrap.chat-page{box-sizing:border-box;height:100dvh;display:flex;flex-direction:column;overflow:hidden;padding-top:calc(var(--app-content-safe-top,0px) + 8px);padding-bottom:var(--chat-composer-space,210px)!important}
main.chat-page #messages{flex:1;min-height:0;overflow-y:auto;overscroll-behavior-y:none;-webkit-overflow-scrolling:touch;padding-bottom:12px}
main.chat-page .chat-top-panel{flex:0 0 auto;display:flex!important;align-items:center;gap:8px;flex-wrap:nowrap;height:auto!important;min-height:52px;margin:0 0 12px!important;padding:8px!important;border:1px solid rgba(196,164,119,0.208);border-radius:16px;background:rgba(17,17,31,0.94)}
main.chat-page .chat-top-panel .app-home-trigger{min-width:0!important;height:38px!important;padding:0 10px!important;box-shadow:none!important;background:transparent!important;border:0!important}
main.chat-page .chat-top-theme{display:flex;align-items:center;margin-left:auto}
main.chat-page .chat-top-panel .chat-balance-chip{position:static!important;top:auto!important;right:auto!important;min-height:38px;padding:0 8px;font-size:11px;box-shadow:none!important;background:transparent!important;border:0!important;backdrop-filter:none!important}
@media(max-width:380px){main.chat-page .chat-top-panel{gap:3px}main.chat-page .chat-top-panel .app-home-trigger{font-size:11px!important;padding:0 5px!important}main.chat-page .chat-top-panel .chat-balance-chip{padding:0 4px;font-size:10px}}

/* Readable assistant tables; scrolling stays within the table on narrow screens. */
main.chat-page #messages .bubble.assistant{min-width:0;max-width:100%}
main.chat-page #messages .bubble.assistant .table-scroll{
 max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;
 margin:18px 0;border:1px solid rgba(196,164,119,0.3);border-radius:14px;
 background:#171728;-webkit-overflow-scrolling:touch;
}
main.chat-page #messages .bubble.assistant table{
 width:100%;min-width:420px;border-collapse:separate;border-spacing:0;
 background:transparent;color:inherit;font-size:14px;line-height:1.55;
}
main.chat-page #messages .bubble.assistant th,
main.chat-page #messages .bubble.assistant td{
 padding:12px 16px;vertical-align:top;text-align:left;
 white-space:normal;overflow-wrap:anywhere;min-width:100px;
 border-bottom:1px solid rgba(196,164,119,0.2);border-right:1px solid rgba(196,164,119,0.15);
}
main.chat-page #messages .bubble.assistant th{background:#221f30;color:#f7f1e8;font-weight:650}
main.chat-page #messages .bubble.assistant tbody tr:nth-child(even){background:rgba(196,164,119,0.06)}
main.chat-page #messages .bubble.assistant tr:last-child td{border-bottom:0}
main.chat-page #messages .bubble.assistant th:last-child,
main.chat-page #messages .bubble.assistant td:last-child{border-right:0}
main.chat-page #messages .bubble.assistant td p{margin:0 0 .5em}
main.chat-page #messages .bubble.assistant td p:last-child{margin-bottom:0}
@media(max-width:560px){main.chat-page #messages .bubble.assistant th,main.chat-page #messages .bubble.assistant td{padding:10px 12px}}

/* Messages must keep their natural height inside the scrolling flex column. */
main.chat-page #messages>.bubble,main.chat-page #messages>div{flex-shrink:0!important}
main.chat-page .chat-top-panel{box-sizing:border-box;min-width:0;width:100%;overflow:hidden}
main.chat-page .chat-top-panel>*{min-width:0}
@media(max-width:600px){
 main.chat-page .chat-top-panel{gap:4px;padding:6px!important;min-height:46px}
 main.chat-page .chat-top-panel .app-home-trigger{flex:0 0 auto;font-size:11px!important;padding:0 6px!important;height:34px!important;gap:4px!important}
 main.chat-page .chat-top-panel .app-home-trigger svg{width:16px;height:16px}
 main.chat-page .chat-top-theme{flex:0 0 72px;margin-left:auto}
 main.chat-page .chat-top-panel .chat-balance-chip{flex:0 1 auto;min-width:0;min-height:34px;font-size:10px;padding:0 4px;gap:4px;white-space:nowrap}
 main.chat-page .chat-balance-label{display:none}
 main.chat-page .chat-top-panel .chat-balance-chip img{width:16px;height:16px}
}
/* Composer height includes the tool menu, attachments and multiline input. */

/* Hide chat scrollbars without disabling touch, wheel or keyboard scrolling. */
body:has(main.chat-page),
body:has(main.chat-page) *{
 scrollbar-width:none!important;
 -ms-overflow-style:none!important;
}
body:has(main.chat-page)::-webkit-scrollbar,
body:has(main.chat-page) *::-webkit-scrollbar{
 display:none!important;
 width:0!important;
 height:0!important;
}

/* Crisp emphasis: avoid inherited glow/strokes and excessive nested bold weight. */
main.chat-page #messages .bubble :is(strong,b,h1,h2,h3,h4,h5,h6),
body:has(main.chat-page) .composer :is(.chat-tool,.chat-tools-toggle){
 text-shadow:none!important;
 -webkit-text-stroke:0!important;
 filter:none!important;
 font-synthesis:none;
}
main.chat-page #messages .bubble :is(strong,b,h1,h2,h3,h4,h5,h6){
 font-weight:700!important;
 letter-spacing:.02em!important;
}
main.chat-page #messages .bubble :is(strong,b) :is(strong,b){
 font-weight:inherit!important;
 letter-spacing:inherit!important;
}
body:has(main.chat-page) .composer .chat-tool span{
 font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;
 font-weight:600!important;
 letter-spacing:.02em!important;
 text-shadow:none!important;
 -webkit-text-stroke:0!important;
}
@media(min-width:1024px){
 main.chat-page #messages .bubble.assistant,
 main.chat-page #messages .bubble.user{
  font-size:18px!important;
  line-height:1.65!important;
 }
 main.chat-page #messages .bubble.assistant table{font-size:16px}
 body:has(main.chat-page) .composer textarea{font-size:18px!important;line-height:1.5}
 body:has(main.chat-page) .composer .chat-tool span{font-size:13px!important;line-height:1.4}
 body:has(main.chat-page) .composer .chat-tools-panel .chat-tool{min-height:60px;padding:9px 12px}
 body:has(main.chat-page) .composer .chat-tools-toggle,
 body:has(main.chat-page) .composer .chat-tools-hint{font-size:13px}
}

/* The empty conversation is a responsive Sol poster. */
main.chat-page #messages .empty.chat-sol-welcome{
 position:relative;isolation:isolate;display:grid;grid-template-columns:minmax(0,1fr) 176px;
 align-items:center;gap:20px;flex-shrink:0;width:100%;max-width:100%;box-sizing:border-box;
 padding:26px 30px;text-align:left;border:1px solid #e8bc7359;border-radius:24px;
 background:radial-gradient(ellipse at 95% 30%,#b68b4e20,transparent 55%),linear-gradient(130deg,#201e2c,#141420);
 color:#f7f1e8;overflow:hidden;
}
.chat-sol-welcome-copy{position:relative;z-index:1;min-width:0}
.chat-sol-welcome-kicker{display:block;color:#edc780;font-size:10px;letter-spacing:.16em;line-height:1.6}
main.chat-page .chat-sol-welcome h2{margin:10px 0 12px;font-size:clamp(30px,3.5vw,40px);font-weight:650;line-height:1.15;letter-spacing:-.025em}
.chat-sol-welcome h2 span{color:#edc780}
.chat-sol-welcome-lead{font-size:clamp(17px,1.8vw,20px);line-height:1.5;margin:0 0 10px;color:#f7f1e8}
.chat-sol-welcome-lead strong{color:#edc780;font-weight:600;letter-spacing:.02em;text-shadow:none}
.chat-sol-welcome-description{max-width:390px;font-size:14px;line-height:1.65;color:#c2b9cc;margin:0 0 14px}
.chat-sol-welcome-link{display:inline-flex;align-items:center;gap:10px;min-height:42px;padding:9px 14px;border:1px solid #e8bc734d;border-radius:12px;color:#f1cf96;text-decoration:none;font-size:13px;line-height:1.4;background:#e8bc730b}
.chat-sol-welcome-link:hover{background:#e8bc7320;color:#ffe1ac}
.chat-sol-welcome-link:focus-visible{outline:2px solid #edc780;outline-offset:4px}
.chat-sol-welcome-art{display:grid;place-items:center;min-width:0}
.chat-sol-welcome-art img{display:block;width:100%;max-width:176px;height:auto;object-fit:contain;filter:drop-shadow(0 12px 28px #dfb56225)}
@media(max-width:600px){
 main.chat-page #messages .empty.chat-sol-welcome{grid-template-columns:minmax(0,1fr);padding:20px;gap:8px}
 .chat-sol-welcome-art{grid-row:1;justify-items:start}
 .chat-sol-welcome-art img{width:84px}
 main.chat-page .chat-sol-welcome h2{font-size:30px;margin-top:8px}
 .chat-sol-welcome-kicker{font-size:9px}
 .chat-sol-welcome-description{font-size:13px}
}

/* Lightweight CSS stars: no canvas, JSON assets or pointer interception. */
main.app-wrap.chat-page{isolation:isolate}
main.app-wrap.chat-page::before,
main.app-wrap.chat-page::after{
 content:"";position:fixed;inset:0;z-index:-1;pointer-events:none;
 background-repeat:repeat;will-change:opacity;
}
main.app-wrap.chat-page::before{
 background-image:radial-gradient(circle at 28px 41px,#f5dfb3 0 .8px,transparent 1.4px),
 radial-gradient(circle at 146px 112px,#d4cbed 0 .65px,transparent 1.3px),
 radial-gradient(circle at 87px 173px,#f7f1e8 0 .6px,transparent 1.2px);
 background-size:263px 241px,347px 293px,409px 367px;
 opacity:.16;animation:chat-star-shimmer 7s ease-in-out infinite alternate;
}
main.app-wrap.chat-page::after{
 background-image:radial-gradient(circle at 104px 63px,#edc780 0 .8px,transparent 1.5px),
 radial-gradient(circle at 211px 196px,#ede8ff 0 .65px,transparent 1.25px);
 background-size:313px 277px,457px 389px;
 opacity:.26;animation:chat-star-shimmer 9s ease-in-out -4s infinite alternate-reverse;
}
.chat-sol-welcome-art img{
 animation:chat-sol-orbit 7s ease-in-out infinite,chat-sol-glow 5s ease-in-out infinite alternate;
}
@keyframes chat-star-shimmer{0%,15%{opacity:.1}55%{opacity:.32}100%{opacity:.18}}
@keyframes chat-sol-orbit{0%,100%{transform:translateY(0) rotate(-2deg)}50%{transform:translateY(-7px) rotate(2deg)}}
@keyframes chat-sol-glow{
 from{filter:drop-shadow(0 6px 18px #dfb56230)}
 to{filter:drop-shadow(0 10px 32px #edc78070)}
}
@media(prefers-reduced-motion:reduce){
 main.app-wrap.chat-page::before,main.app-wrap.chat-page::after,
 .chat-sol-welcome-art img{animation:none!important;will-change:auto}
 main.app-wrap.chat-page::before,main.app-wrap.chat-page::after{opacity:.16}
}

/* Home and balance share normal layout space, including on narrow screens. */
html body main.chat-page .sidebar-menu-row.chat-top-panel{
 display:flex!important;flex-wrap:wrap!important;align-items:center!important;
 justify-content:space-between!important;gap:8px!important;overflow:visible!important;
 height:auto!important;min-width:0!important;
}
html body main.chat-page .chat-top-panel .app-home-trigger,
html body main.chat-page .chat-top-panel .chat-balance-chip{
 position:static!important;inset:auto!important;transform:none!important;
 float:none!important;flex:0 0 auto!important;max-width:100%!important;
 box-sizing:border-box!important;
}
html body main.chat-page .chat-top-panel .app-home-trigger{
 width:auto!important;min-width:0!important;margin:0!important;
}
html body main.chat-page .chat-top-panel .chat-balance-chip{
 width:auto!important;min-width:0!important;margin:0 0 0 auto!important;
 white-space:nowrap!important;line-height:1.4!important;
}

/* Desktop uses the conversation title; mobile keeps Home and the full balance. */
main.chat-page .chat-desktop-heading{display:none}
@media(min-width:980px){
 html body main.chat-page .sidebar-menu-row.chat-top-panel,
 html body main.chat-page .chat-top-panel,
 html body:has(main.chat-page) [data-chat-balance]{display:none!important}
 main.chat-page .chat-desktop-heading{
  display:block;flex:0 0 auto;min-width:0;padding:14px 4px 18px;margin-bottom:12px;
  border-bottom:1px solid rgba(196,164,119,.18);
 }
 main.chat-page .chat-desktop-heading h1{
  margin:0;color:var(--app-text,#f7f1e8);font-size:22px;font-weight:600;
  line-height:1.4;letter-spacing:.01em;text-shadow:none;overflow-wrap:anywhere;
 }
}
@media(max-width:979px){
 html body main.chat-page .chat-top-panel .chat-balance-label{display:inline!important}
 html body main.chat-page .chat-top-panel .chat-balance-chip{font-size:12px!important}
}
