/* (storyx4) The story page's AI chat: the chart's chat rules (chart-2.css, the chat bubbles, the chat1 composer, chips,
   Beppi's peek, the Answer length menu, credleft1 and reveal1) carried over as they draw on the chart, scoped to .sxc so
   they never touch the rest of the feed page. The colours are the chart's own variables. */
.sxc{--bg:#0a0a0f;--surface:#111118;--border:#1a1a2e;--text:#e0e0e0;--dim:#666;--accent:#00ff88;--red:#ff3355;--blue:#00aaff;--purple:#aa55ff;--tl-delta:#00ff88;
  position:relative;display:flex;flex-direction:column;min-height:0;height:100%;box-sizing:border-box;padding:10px 12px;
  background:var(--surface);color:var(--text);font:400 13px/normal 'SF Mono','Fira Code','Consolas',monospace;letter-spacing:normal;text-align:left;-webkit-font-smoothing:auto}
.sxc *,.sxc *::before,.sxc *::after{box-sizing:border-box}
.sxc button{font-family:inherit}
/* the header: TradeLabs AI and its round controls */
.sxc .ai-chat-header{display:flex;align-items:center;justify-content:space-between;gap:6px;margin-bottom:8px}
.sxc .rpanel-title{display:flex;align-items:center;gap:6px;font-size:10px;text-transform:uppercase;letter-spacing:2px;color:var(--accent);margin:0}
.sxc .sxc-free{font-size:9px;color:var(--dim);font-weight:400;letter-spacing:2px}
.sxc .ai-chat-controls{display:flex;gap:2px;align-items:center;padding:2px;border-radius:999px;border:1px solid var(--border);background:rgba(255,255,255,.03)}
.sxc .chat-hdr-btn{width:26px;height:26px;display:flex;align-items:center;justify-content:center;padding:0;margin:0;border:none;border-radius:50%;
  background:transparent;color:var(--dim);cursor:pointer;transition:background .14s,color .14s,transform .14s}
.sxc .chat-hdr-btn svg{width:14px;height:14px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.sxc .chat-hdr-btn:hover{background:rgba(0,255,136,.13);color:var(--accent);transform:translateY(-1px)}
.sxc .chat-hdr-btn:active{transform:scale(.9)}
.sxc .chat-hdr-btn:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
.sxc .sxc-clear:hover{background:rgba(255,77,94,.15);color:#ff6b78}
.sxc.docked .sxc-x{display:none}
/* the conversation's recessed well; the composer sticks to its bottom */
.sxc .sxc-scroll{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;background:rgba(0,0,0,.30);border:1px solid var(--border);border-radius:12px;
  padding:10px 10px 8px;display:flex;flex-direction:column;scrollbar-width:thin;scrollbar-color:rgba(167,139,250,.25) transparent}
.sxc .sxc-scroll::-webkit-scrollbar{width:4px}
.sxc .sxc-scroll::-webkit-scrollbar-thumb{background:rgba(167,139,250,.25);border-radius:2px}
.sxc .sxc-msgs{flex:1 0 auto;padding:0}
.sxc .sxc-dock{position:sticky;bottom:-8px;z-index:6;margin:8px -10px -8px;padding:8px 10px 6px;
  background:linear-gradient(180deg,rgba(0,0,0,0) 0,rgba(0,0,0,0) var(--tl-chips-h,0px),rgba(12,12,17,.92) calc(var(--tl-chips-h,0px) + 12px),rgba(12,12,17,.98) 100%);
  border-bottom-left-radius:11px;border-bottom-right-radius:11px}
/* the bubbles */
.sxc .chat-msg{display:flex;gap:8px;margin:9px 0;align-items:flex-end;animation:sxcFadeIn .3s ease}
@keyframes sxcFadeIn{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:translateY(0)}}
.sxc .chat-msg.user{flex-direction:row-reverse}
.sxc .chat-avatar{width:26px;height:26px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:13px;flex-shrink:0;margin-bottom:1px;box-shadow:0 2px 6px rgba(0,0,0,.35)}
.sxc .chat-avatar svg{display:block}
.sxc .chat-avatar.ai{background:rgba(0,255,136,.16);border:1px solid rgba(170,85,255,.55)}
.sxc .chat-avatar.user{background:linear-gradient(135deg,rgba(0,255,136,.35),rgba(0,170,255,.25));border:1px solid rgba(0,255,136,.5)}
.sxc .chat-bubble{max-width:78%;padding:9px 13px;border-radius:16px;font-size:13px;line-height:1.5;position:relative;word-wrap:break-word;overflow-wrap:anywhere;
  background:#343455;color:var(--text);border:1px solid rgba(170,85,255,.55);box-shadow:0 2px 10px rgba(0,0,0,.32)}
.sxc .chat-bubble.ai{border-top-left-radius:2px;border-bottom-left-radius:5px}
.sxc .chat-bubble.user{background:linear-gradient(135deg,rgba(0,255,136,.30),rgba(0,212,170,.22));border-color:rgba(0,255,136,.6);border-top-right-radius:2px;border-bottom-right-radius:5px;white-space:pre-wrap}
.sxc .chat-bubble b{color:var(--accent);font-weight:700}
.sxc .chat-bubble i{font-style:italic;color:#cfd3dc}
.sxc .chat-bubble .copy-btn{position:absolute;top:4px;right:4px;background:none;border:none;color:var(--dim);cursor:pointer;font-size:10px;opacity:0;transition:opacity .2s;padding:2px 4px;border-radius:2px}
.sxc .chat-bubble:hover .copy-btn,.sxc .chat-bubble .copy-btn:focus-visible{opacity:1}
.sxc .chat-bubble .copy-btn:hover{color:var(--accent);background:rgba(0,255,136,.12)}
.sxc .sxc-err{color:#ff8899}
.sxc .sxc-act{display:inline-block;margin-top:8px;background:linear-gradient(135deg,#00ff88,#00aaff);color:#000;border:none;padding:6px 16px;border-radius:4px;font-size:11px;font-weight:700;text-decoration:none;cursor:pointer}
.sxc .sxc-act:hover{filter:brightness(1.1)}
/* thinking: the orb row beside Beppi, not a bubble */
.sxc .chat-thinking{color:var(--dim);font-size:12px;display:flex;align-items:center;gap:6px}
.sxc .chat-thinking .dots{display:inline-flex;gap:3px}
.sxc .chat-thinking .dots span{width:4px;height:4px;border-radius:50%;background:var(--purple);animation:sxcThinkPulse 1.2s infinite}
.sxc .chat-thinking .dots span:nth-child(2){animation-delay:.2s}
.sxc .chat-thinking .dots span:nth-child(3){animation-delay:.4s}
@keyframes sxcThinkPulse{0%,80%,100%{opacity:.3;transform:scale(.8)}40%{opacity:1;transform:scale(1)}}
.sxc .chat-msg.ai .chat-bubble.ai.tl-think-bub{background:transparent;border-color:transparent;box-shadow:none;padding:2px;align-self:center}
.sxc .chat-bubble.tl-think-bub .chat-thinking.tl-thinking{display:flex;gap:10px;font-size:12.5px;color:var(--dim)}
.sxc .chat-msg.ai:has(.tl-think-bub){align-items:center}
/* who answered and how long it took, and the word-by-word arrival */
.sxc .ai-by{margin-top:6px;font-size:10px;color:var(--dim);opacity:.85}
.sxc .ai-by::after{content:attr(data-by)}
.sxc .ai-by[data-thought]::before{content:attr(data-thought)}
.sxc .ai-by[data-thought][data-by]::before{content:attr(data-thought) ' \00b7  '}
.sxc .chat-bubble.tl-reveal .tlw{opacity:0;filter:blur(3px);animation:sxcTlw .42s cubic-bezier(.23,1,.32,1) forwards}
.sxc .chat-bubble.tl-reveal.tl-reveal-lite .tlw{filter:none}
.sxc .chat-bubble.tl-reveal .ai-by{opacity:0;animation:sxcTlw .4s ease forwards;animation-delay:var(--tl-rv,0ms)}
.sxc .chat-bubble.tl-revealed .tlw,.sxc .chat-bubble.tl-revealed .ai-by{animation:none;opacity:1;filter:none}
@keyframes sxcTlw{to{opacity:1;filter:blur(0)}}
/* the suggestion chips: under the greeting at first, then in the dock above the box */
.sxc .chat-chips{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0 2px 34px;transition:opacity .24s ease,transform .24s ease}
.sxc .chat-chip{font-family:inherit;font-size:11.5px;line-height:1.25;color:var(--accent);text-align:left;background:rgba(0,255,136,.07);border:1px solid rgba(0,255,136,.28);
  padding:7px 12px;border-radius:14px;cursor:pointer;max-width:100%;opacity:0;transform:translateY(7px);animation:sxcChipIn .42s cubic-bezier(.22,1,.36,1) forwards;
  transition:background .16s ease,border-color .16s ease,transform .16s cubic-bezier(.22,1,.36,1),box-shadow .16s ease}
.sxc .chat-chip:nth-child(1){animation-delay:.06s}.sxc .chat-chip:nth-child(2){animation-delay:.12s}.sxc .chat-chip:nth-child(3){animation-delay:.18s}
.sxc .chat-chip:nth-child(4){animation-delay:.24s}.sxc .chat-chip:nth-child(5){animation-delay:.30s}.sxc .chat-chip:nth-child(6){animation-delay:.36s}
.sxc .chat-chip:hover{background:rgba(0,255,136,.14);border-color:rgba(0,255,136,.5);transform:translateY(-1px);box-shadow:0 4px 12px rgba(0,255,136,.14)}
.sxc .chat-chip:active{transform:translateY(0) scale(.97)}
.sxc .chat-chip:focus-visible{outline:2px solid rgba(0,255,136,.55);outline-offset:2px}
@keyframes sxcChipIn{to{opacity:1;transform:none}}
.sxc .sxc-dock .chat-chips{margin:-8px -10px 8px;padding:8px 52px 4px 10px;background:transparent;transition:opacity .18s ease,visibility 0s linear 0s}
.sxc .sxc-dock.tl-chips-away .chat-chips{opacity:0;visibility:hidden;pointer-events:none;transition:opacity .18s ease,visibility 0s linear .18s}
.sxc .chat-chips[hidden]{display:none}
/* (chat1) the composer: the box holds Ask, Beppi peeks over it, the options sit under it */
.sxc .chat-input-row{position:relative;display:flex;align-items:flex-start;gap:4px;min-width:0;margin:0;padding:3px 3px 3px 4px;background:#14141d;border:1px solid var(--border);border-radius:16px;transition:border-color .15s,box-shadow .15s}
.sxc .chat-input-row:focus-within{border-color:rgba(0,255,136,.55);box-shadow:0 0 0 3px rgba(0,255,136,.10)}
.sxc .chat-input-row textarea{flex:1;min-width:0;display:block;margin:0;min-height:0;-webkit-appearance:none;appearance:none;resize:none;overflow:hidden;max-height:160px;
  background:transparent;border:0;border-radius:12px;box-shadow:none;outline:none;color:var(--text);font:inherit;font-size:12.5px;line-height:1.36;padding:7px 8px;white-space:pre-wrap;overflow-wrap:anywhere}
.sxc .chat-input-row textarea:focus,.sxc .chat-input-row textarea:focus-visible{outline:none;border:0;box-shadow:none}
.sxc .chat-input-row textarea::placeholder{color:var(--dim);opacity:.85}
.sxc .chat-input-row textarea:placeholder-shown{white-space:nowrap;text-overflow:ellipsis}
.sxc .send-btn{background:linear-gradient(135deg,var(--accent),rgba(0,170,255,.8));border:none;color:#000;font-weight:700;padding:8px 15px;border-radius:12px;cursor:pointer;
  font-size:12px;letter-spacing:.3px;white-space:nowrap;transition:all .2s;flex-shrink:0}
.sxc .send-btn:hover{filter:brightness(1.15)}
.sxc .send-btn:disabled{opacity:.5;cursor:not-allowed}
.sxc .send-btn:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.sxc .ai-peek{position:absolute;right:13px;bottom:100%;margin-bottom:-3px;width:36px;height:26px;pointer-events:none;z-index:3;transform-origin:50% 100%}
.sxc .ai-peek svg{display:block;width:100%;height:100%;overflow:visible;transform-origin:50% 100%;animation:sxcPeekUp .55s cubic-bezier(.22,1,.36,1) .5s both}
.sxc .ai-peek .skin{fill:var(--tl-delta);stroke:rgba(0,0,0,.35);stroke-width:1.1;stroke-linejoin:round}
.sxc .ai-peek .hand{fill:var(--tl-delta);stroke:rgba(0,0,0,.35);stroke-width:1.1}
.sxc .ai-peek .eye{transform-box:fill-box;transform-origin:50% 50%;animation:sxcBlink 5.5s ease-in-out 2s infinite}
.sxc .ai-peek.tl-eyes .eye{animation:none}
.sxc .ai-peek.tl-eyes.tl-blink .eye{animation:sxcBlinkOnce .2s ease-in-out}
.sxc .ai-peek .pupil{transition:transform .25s ease}
.sxc .ai-peek.tl-eyes .pupil{transition:transform 1.2s cubic-bezier(.45,.05,.35,1)}
.sxc .chat-input-row:focus-within .ai-peek:not(.tl-eyes) .pupil{transform:translate(-1.8px,1.4px)}
.sxc.ai-thinking .ai-peek{animation:sxcPeekBob 1s ease-in-out infinite}
@keyframes sxcPeekUp{from{transform:translateY(55%);opacity:0}to{transform:none;opacity:1}}
@keyframes sxcBlink{0%,93%,100%{transform:scaleY(1)}96%{transform:scaleY(.12)}}
@keyframes sxcBlinkOnce{0%,100%{transform:scaleY(1)}40%,60%{transform:scaleY(.1)}}
@keyframes sxcPeekBob{0%,100%{transform:translateY(0)}50%{transform:translateY(-3px)}}
/* under the box: credits left and the Answer length menu */
.sxc .ai-chat-opts{display:flex;align-items:center;justify-content:space-between;gap:6px;margin-top:6px;padding:0 2px;border-top:0}
.sxc .ai-tools{display:flex;align-items:center;gap:2px;min-width:0}
.sxc .ai-credits{font-size:11px;color:#8a94a6;white-space:nowrap;cursor:default;margin-left:auto;padding:0 2px;font-variant-numeric:tabular-nums;transition:color .3s}
.sxc .ai-credits.low{color:#ff4d6a}
.sxc .ai-credits[hidden]{display:none}
.sxc .ai-model{position:relative;flex-shrink:0}
.sxc .ai-model-btn{display:flex;align-items:center;gap:5px;height:28px;padding:0 9px 0 10px;border-radius:14px;border:1px solid transparent;background:none;color:var(--text);font:inherit;font-size:11.5px;cursor:pointer;white-space:nowrap}
.sxc .ai-model-btn:hover,.sxc .ai-model-btn[aria-expanded="true"]{border-color:var(--border);background:rgba(255,255,255,.05)}
.sxc .ai-model-btn:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
.sxc .ai-model-btn svg{width:9px;height:6px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;opacity:.75}
.sxc .ai-model-menu{position:absolute;right:0;bottom:calc(100% + 6px);width:238px;max-width:80vw;max-height:340px;overflow-y:auto;background:#17171f;border:1px solid var(--border);border-radius:12px;padding:5px;box-shadow:0 14px 34px rgba(0,0,0,.55);z-index:80}
.sxc .ai-model-menu[hidden]{display:none}
.sxc .ai-model-head{padding:5px 9px 6px;font-size:10px;letter-spacing:.6px;text-transform:uppercase;color:var(--dim)}
.sxc .ai-model-opt{display:grid;grid-template-columns:1fr 14px;column-gap:8px;width:100%;text-align:left;padding:7px 9px;border:0;border-radius:8px;background:none;color:var(--text);font:inherit;cursor:pointer}
.sxc .ai-model-opt .nm{font-size:12px;font-weight:600;line-height:1.3}
.sxc .ai-model-opt .mk{grid-row:2;font-size:10.5px;color:var(--dim);line-height:1.35}
.sxc .ai-model-opt .ck{grid-row:1/3;grid-column:2;align-self:center;width:12px;height:10px;fill:none;stroke:var(--accent);stroke-width:2;stroke-linecap:round;stroke-linejoin:round;opacity:0}
.sxc .ai-model-opt.on .ck{opacity:1}
.sxc .ai-model-opt:hover,.sxc .ai-model-opt:focus-visible{background:rgba(0,255,136,.08);outline:none}
@media (prefers-reduced-motion:reduce){
  .sxc .chat-msg,.sxc .chat-chip,.sxc .ai-peek,.sxc .ai-peek svg,.sxc .ai-peek .eye,.sxc.ai-thinking .ai-peek{animation:none;opacity:1;transform:none}
  .sxc .chat-bubble.tl-reveal .tlw,.sxc .chat-bubble.tl-reveal .ai-by{animation:none;opacity:1;filter:none}
}
@media (max-width:480px){.sxc .chat-input-row textarea{font-size:16px}}
