/* =====================================================================
   Sulan visual layer 2 — price badges, thinking animation, chat menu,
   stop button. Loaded after app.css so it wins on shared selectors.
   ===================================================================== */

/* ---------- price badge (coins near every model) ---------- */
.price-badge{
  display:inline-flex;align-items:flex-end;gap:1.5px;height:12px;
  flex-shrink:0;cursor:help;
}
.price-badge .coin{
  width:3.5px;border-radius:1px;background:var(--line);
  transition:background .2s,transform .2s;
}
.price-badge .coin:nth-child(1){height:5px}
.price-badge .coin:nth-child(2){height:7.5px}
.price-badge .coin:nth-child(3){height:10px}
.price-badge .coin:nth-child(4){height:12px}
.price-badge.t1 .coin.on{background:var(--ok)}
.price-badge.t2 .coin.on{background:#6fa8dc}
.price-badge.t3 .coin.on{background:var(--warn)}
.price-badge.t4 .coin.on{background:var(--bad)}
.pick-item:hover .price-badge .coin.on{transform:scaleY(1.14)}

.pi-price{
  font-size:10px;font-family:Consolas,monospace;color:var(--tx3);
  flex-shrink:0;letter-spacing:-.2px;
}
.pi-ctx{
  font-size:9.5px;padding:1.5px 6px;border-radius:5px;flex-shrink:0;
  background:var(--bg);border:1px solid var(--line);color:var(--tx3);
}
.pi-think{
  display:inline-flex;align-items:center;gap:3px;font-size:9.5px;
  padding:1.5px 6px;border-radius:5px;flex-shrink:0;
  background:rgba(var(--br-rgb),.12);border:1px solid rgba(var(--br-rgb),.34);color:var(--br2);
}
.pi-think svg{width:9px;height:9px}
.pi-warn{
  font-size:10px;color:var(--warn);margin-top:5px;display:flex;gap:5px;line-height:1.4;
}
.pi-warn::before{content:'!';font-weight:700;flex-shrink:0}
.pi-meta{display:flex;align-items:center;gap:7px;margin-top:6px;flex-wrap:wrap}

/* ---------- model button in the composer ---------- */
.model-pick{
  display:flex;align-items:center;gap:7px;padding:5px 10px;border-radius:8px;
  font-size:11.5px;color:var(--tx2);text-transform:none;letter-spacing:0;
  border:1px solid transparent;transition:.16s;
}
.model-pick:hover{background:var(--bg3);color:var(--tx);border-color:var(--line)}
.model-pick .price-badge{height:10px}

/* =====================================================================
   THINKING — the centrepiece animation.
   A soft breathing orb, a travelling light rail, and text that shimmers
   only while the step is alive. Replaces the flat spinner rows.
   ===================================================================== */
.think-panel{
  margin:0 0 14px;border-radius:14px;overflow:hidden;
  border:1px solid var(--line);background:var(--bg2);
  animation:panelIn .4s cubic-bezier(.22,1,.36,1) both;
}
@keyframes panelIn{
  from{opacity:0;transform:translateY(8px) scale(.985)}
  to{opacity:1;transform:none}
}
.think-panel.done{border-color:rgba(123,171,123,.28)}
.think-panel.stopped{border-color:rgba(217,167,87,.34)}

/* --- header: orb + title + timer + collapse --- */
.tp-head{
  display:flex;align-items:center;gap:11px;padding:11px 13px;
  cursor:pointer;user-select:none;position:relative;transition:background .16s;
}
.tp-head:hover{background:var(--bg3)}

/* the breathing orb */
.tp-orb{
  width:20px;height:20px;flex-shrink:0;position:relative;
  display:flex;align-items:center;justify-content:center;
}
.tp-orb .core{
  width:9px;height:9px;border-radius:50%;
  background:radial-gradient(circle at 32% 30%,#ffd7c4,var(--br) 62%);
  box-shadow:0 0 10px rgba(var(--br-rgb),.75);
  animation:breathe 2.1s cubic-bezier(.45,0,.55,1) infinite;
}
@keyframes breathe{
  0%,100%{transform:scale(.82);box-shadow:0 0 6px rgba(var(--br-rgb),.45)}
  50%{transform:scale(1.16);box-shadow:0 0 15px rgba(var(--br-rgb),.9)}
}
/* two rings pulsing outward, offset in time */
.tp-orb .ring{
  position:absolute;inset:0;border-radius:50%;
  border:1.4px solid var(--br);opacity:0;
  animation:ripple 2.1s cubic-bezier(.2,.6,.35,1) infinite;
}
.tp-orb .ring.r2{animation-delay:1.05s}
@keyframes ripple{
  0%{transform:scale(.42);opacity:.65}
  75%{transform:scale(1.35);opacity:0}
  100%{opacity:0}
}
/* a slow orbiting spark, only while thinking */
.tp-orb .orbit{
  position:absolute;inset:-3px;border-radius:50%;
  animation:spinSlow 3.4s linear infinite;
}
.tp-orb .orbit::after{
  content:'';position:absolute;top:-1px;left:50%;
  width:3px;height:3px;border-radius:50%;background:var(--br2);
  box-shadow:0 0 6px var(--br);
}
@keyframes spinSlow{to{transform:rotate(360deg)}}

/* finished / stopped: orb calms down into a solid dot */
.think-panel.done .tp-orb .core{
  animation:none;background:var(--ok);box-shadow:0 0 8px rgba(123,171,123,.6);
  transform:scale(1);
}
.think-panel.done .tp-orb .ring,
.think-panel.done .tp-orb .orbit,
.think-panel.stopped .tp-orb .ring,
.think-panel.stopped .tp-orb .orbit{display:none}
.think-panel.stopped .tp-orb .core{animation:none;background:var(--warn);box-shadow:none}

.tp-title{flex:1;min-width:0;font-size:13px;font-weight:500;color:var(--tx)}
.tp-sub{font-size:11px;color:var(--tx3);margin-top:1px}
.tp-time{
  font-size:10.5px;color:var(--tx3);font-variant-numeric:tabular-nums;flex-shrink:0;
}
.tp-caret{
  width:16px;height:16px;flex-shrink:0;color:var(--tx3);
  transition:transform .26s cubic-bezier(.22,1,.36,1);
}
.think-panel.closed .tp-caret{transform:rotate(-90deg)}

/* --- body: the step rail --- */
.tp-body{
  overflow:hidden;transition:max-height .34s cubic-bezier(.22,1,.36,1),opacity .24s;
  max-height:1400px;opacity:1;
}
.think-panel.closed .tp-body{max-height:0;opacity:0}
.tp-steps{padding:2px 13px 12px 13px;position:relative}

/* the rail itself: a gradient line the light travels down */
.tp-steps::before{
  content:'';position:absolute;left:19px;top:4px;bottom:12px;width:1.5px;
  background:linear-gradient(var(--brd),var(--line) 60%,transparent);
  border-radius:2px;
}

/* one step row */
.step{
  display:flex;align-items:flex-start;gap:12px;padding:6px 0;
  position:relative;font-size:12.5px;
  animation:stepIn .38s cubic-bezier(.22,1,.36,1) both;
}
@keyframes stepIn{
  from{opacity:0;transform:translateX(-7px)}
  to{opacity:1;transform:none}
}
.step-mark{
  width:13px;height:13px;flex-shrink:0;margin-top:2px;margin-left:0;
  border-radius:50%;background:var(--bg2);position:relative;z-index:1;
  display:flex;align-items:center;justify-content:center;
}
/* active step: a small pulsing ring travelling on the rail */
.step.live .step-mark::before{
  content:'';position:absolute;inset:1px;border-radius:50%;
  border:1.6px solid var(--br);border-top-color:transparent;
  animation:spin .8s linear infinite;
}
.step.live .step-mark::after{
  content:'';position:absolute;inset:-3px;border-radius:50%;
  border:1px solid var(--br);opacity:0;animation:ripple 1.7s ease-out infinite;
}
.step.ok .step-mark::before{
  content:'';width:7px;height:7px;border-radius:50%;background:var(--ok);
  animation:pop .34s cubic-bezier(.34,1.56,.64,1) both;
}
.step.bad .step-mark::before{
  content:'';width:7px;height:7px;border-radius:50%;background:var(--bad);
  animation:pop .34s cubic-bezier(.34,1.56,.64,1) both;
}
.step-body{flex:1;min-width:0}
.step-text{color:var(--tx2);transition:color .3s}
.step.live .step-text{color:var(--tx)}
.step-ms{
  font-size:10px;color:var(--tx3);font-variant-numeric:tabular-nums;
  margin-left:8px;opacity:0;animation:fadeIn .45s .08s both;
}

/* the shimmer that only ever runs on a live label */
.step.live .step-text.sheen{
  background:linear-gradient(100deg,var(--tx3) 34%,var(--tx) 50%,var(--tx3) 66%);
  background-size:280% 100%;
  -webkit-background-clip:text;background-clip:text;color:transparent;
  animation:sheen 1.9s cubic-bezier(.4,0,.6,1) infinite;
}

/* --- real reasoning text, when the provider actually streams it --- */
.tp-reason{
  margin:6px 0 2px 25px;padding:9px 12px;border-radius:10px;
  background:var(--bg);border:1px solid var(--line);
  font-size:11.5px;line-height:1.62;color:var(--tx2);
  white-space:pre-wrap;max-height:190px;overflow-y:auto;
  animation:stepIn .4s cubic-bezier(.22,1,.36,1) both;
}
.tp-reason.live{border-color:rgba(var(--br-rgb),.3)}
/* a soft caret while thinking text is arriving */
.tp-reason.live::after{
  content:'';display:inline-block;width:6px;height:12px;
  background:var(--br);margin-left:3px;vertical-align:-2px;
  animation:caret 1s steps(2) infinite;
}
@keyframes caret{50%{opacity:0}}

/* three dots used in the header while waiting */
.tp-dots{display:inline-flex;gap:3px;margin-left:5px;vertical-align:1px}
.tp-dots i{
  width:3.5px;height:3.5px;border-radius:50%;background:var(--br2);
  animation:bounce 1.25s infinite;
}
.tp-dots i:nth-child(2){animation-delay:.14s}
.tp-dots i:nth-child(3){animation-delay:.28s}

/* =====================================================================
   STOP button — replaces the send button while generating
   ===================================================================== */
.send-wrap{position:relative;width:29px;height:29px;flex-shrink:0}
.btn-stop{
  position:absolute;inset:0;width:29px;height:29px;border-radius:8px;
  background:var(--bad);color:#fff;display:flex;align-items:center;justify-content:center;
  animation:stopIn .22s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes stopIn{from{opacity:0;transform:scale(.6) rotate(-25deg)}to{opacity:1;transform:none}}
.btn-stop:hover{filter:brightness(1.12)}
.btn-stop:active{transform:scale(.92)}
.btn-stop .sq{width:9px;height:9px;border-radius:2px;background:#fff}
/* a ring that sweeps around the stop button while the model works */
.btn-stop::after{
  content:'';position:absolute;inset:-3px;border-radius:11px;
  border:1.5px solid var(--bad);border-right-color:transparent;
  animation:spin 1s linear infinite;opacity:.7;
}

/* =====================================================================
   THINK PICKER — animated level selector
   ===================================================================== */
.think-pick{
  display:flex;align-items:center;gap:6px;padding:5px 10px;border-radius:8px;
  font-size:11.5px;color:var(--tx2);border:1px solid transparent;transition:.16s;
}
.think-pick:hover{background:var(--bg3);color:var(--tx);border-color:var(--line)}
.think-pick.on{
  color:var(--br2);background:rgba(var(--br-rgb),.1);border-color:rgba(var(--br-rgb),.34);
}
/* the spark gently pulses when thinking is armed */
.think-pick.on svg{animation:sparkle 2.4s ease-in-out infinite}
@keyframes sparkle{
  0%,100%{transform:scale(1) rotate(0);opacity:.85}
  50%{transform:scale(1.18) rotate(9deg);opacity:1}
}

#think-menu{min-width:286px}
.tm-item{
  position:relative;overflow:hidden;justify-content:flex-start;gap:11px;
}
/* level strength shown as a tiny bar chart that fills on hover */
.lvl-bars{display:inline-flex;align-items:flex-end;gap:2px;height:12px;flex-shrink:0}
.lvl-bars i{
  width:3px;border-radius:1px;background:var(--line);transition:background .2s,transform .2s;
}
.lvl-bars i:nth-child(1){height:4px}
.lvl-bars i:nth-child(2){height:6.5px}
.lvl-bars i:nth-child(3){height:9px}
.lvl-bars i:nth-child(4){height:12px}
.tm-item .lvl-bars i.on{background:var(--br)}
.tm-item:hover .lvl-bars i.on{transform:scaleY(1.15)}
.tm-item.on .lvl-bars i.on{background:var(--br2);box-shadow:0 0 5px rgba(var(--br-rgb),.55)}
.tm-name{flex:1;text-align:left}
.tm-item.on{background:rgba(var(--br-rgb),.1)}
.tm-item.on::after{content:'✓';color:var(--br2);font-size:12px;margin-left:auto}
/* a light sweep crossing the row when it becomes the active level */
.tm-item.just::before{
  content:'';position:absolute;inset:0;
  background:linear-gradient(100deg,transparent 25%,rgba(var(--br-rgb),.28) 50%,transparent 75%);
  animation:sweep .55s ease-out both;
}
@keyframes sweep{from{transform:translateX(-100%)}to{transform:translateX(100%)}}
.tm-hint{
  font-size:10.5px;color:var(--tx3);padding:2px 11px 8px;line-height:1.5;
}
.tm-badge{
  font-size:9.5px;padding:1px 6px;border-radius:5px;flex-shrink:0;
  border:1px solid var(--line);color:var(--tx3);
}
.tm-badge.real{border-color:rgba(123,171,123,.4);color:var(--ok)}

/* =====================================================================
   CHAT MANAGEMENT — recents rows with a context menu
   ===================================================================== */
.rec{position:relative;padding-right:30px}
.rec-more{
  position:absolute;right:5px;top:50%;transform:translateY(-50%);
  width:21px;height:21px;border-radius:6px;color:var(--tx3);
  display:flex;align-items:center;justify-content:center;
  opacity:0;transition:.14s;font-size:13px;line-height:1;
}
.rec:hover .rec-more,.rec.menu-open .rec-more{opacity:1}
.rec-more:hover{background:var(--bg);color:var(--br2)}
.rec-pin{color:var(--br2);font-size:9px;flex-shrink:0;margin-right:3px}
.rec.archived{opacity:.62}
.rec-title-in{
  flex:1;background:var(--bg);border:1px solid var(--br);border-radius:6px;
  color:var(--tx);font:inherit;font-size:12.5px;padding:2px 6px;outline:none;min-width:0;
}
.rec.removing{animation:recOut .26s ease forwards}
@keyframes recOut{
  to{opacity:0;transform:translateX(-14px);max-height:0;padding-top:0;padding-bottom:0}
}

#chat-menu{
  position:fixed;z-index:130;min-width:196px;padding:5px;
  background:var(--bg2);border:1px solid var(--line);border-radius:11px;
  box-shadow:0 14px 44px rgba(0,0,0,.5);
  animation:menuIn .17s cubic-bezier(.22,1,.36,1) both;
}
.cm-item{
  width:100%;display:flex;align-items:center;gap:10px;padding:8px 10px;
  border-radius:8px;font-size:12.5px;color:var(--tx);text-align:left;transition:.12s;
}
.cm-item:hover{background:var(--bg3)}
.cm-item span[data-icon]{width:15px;height:15px;color:var(--tx3);flex-shrink:0}
.cm-item svg{width:15px;height:15px}
.cm-item.danger{color:var(--bad)}
.cm-item.danger span[data-icon]{color:var(--bad)}
.cm-item.danger:hover{background:rgba(217,112,112,.12)}
.cm-sep{height:1px;background:var(--line);margin:4px 4px}

.side-tabs{display:flex;gap:3px;margin:14px 6px 4px}
.side-tab{
  flex:1;padding:5px 8px;border-radius:7px;font-size:11px;color:var(--tx3);
  transition:.14s;text-align:center;
}
.side-tab:hover{background:var(--bg3);color:var(--tx2)}
.side-tab.on{background:var(--brd);color:var(--br2);font-weight:600}

/* =====================================================================
   Composer polish: the box lifts slightly when focused
   ===================================================================== */
.comp-box{
  transition:border-color .18s,box-shadow .22s,transform .22s cubic-bezier(.22,1,.36,1);
}
.comp-box:focus-within{transform:translateY(-1px)}

/* streaming answer: a soft caret at the tail */
.streaming::after{
  content:'';display:inline-block;width:6px;height:14px;
  background:var(--br);margin-left:2px;vertical-align:-2px;border-radius:1px;
  animation:caret 1.05s steps(2) infinite;
}

/* stopped notice */
.stop-note{
  display:flex;align-items:center;gap:8px;margin-top:9px;
  font-size:11.5px;color:var(--warn);animation:fadeIn .3s both;
}

/* =====================================================================
   MCP / skills settings rows
   ===================================================================== */
.mcp-list,.skill-list{display:flex;flex-direction:column;gap:8px;margin-top:6px}
.mcp-card{
  display:flex;align-items:center;gap:11px;padding:11px 13px;
  background:var(--bg);border:1px solid var(--line);border-radius:10px;transition:.15s;
}
.mcp-card:hover{border-color:var(--br)}
.mcp-dot{
  width:8px;height:8px;border-radius:50%;flex-shrink:0;background:var(--tx3);
}
.mcp-card.on .mcp-dot{background:var(--ok);box-shadow:0 0 7px rgba(123,171,123,.7)}
.mcp-body{flex:1;min-width:0}
.mcp-name{font-size:13px;font-weight:500}
.mcp-cmd{
  font:11px Consolas,monospace;color:var(--tx3);margin-top:2px;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.mcp-x{color:var(--tx3);font-size:15px;padding:2px 5px;border-radius:6px;transition:.14s}
.mcp-x:hover{color:var(--bad);background:rgba(217,112,112,.1)}
.add-row{display:flex;gap:8px;margin-top:10px;flex-wrap:wrap}
.add-row .input{flex:1;min-width:130px}
.empty-mini{
  padding:16px;text-align:center;font-size:12px;color:var(--tx3);
  border:1px dashed var(--line);border-radius:10px;
}

/* =====================================================================
   MODEL PICKER — stripped to a name and price bars (screenshot 5)
   ===================================================================== */
.pick-item{
  align-items:center;gap:10px;padding:9px 11px;
}
.pick-item .pi-name{
  flex:1;min-width:0;font-size:13px;font-weight:500;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.pick-item .price-badge{height:11px}
.pick-item .pi-check{margin-left:2px}

/* =====================================================================
   TOAST — the completion notification
   ===================================================================== */
#toasts{
  position:fixed;right:18px;bottom:18px;z-index:200;
  display:flex;flex-direction:column;gap:9px;align-items:flex-end;
  pointer-events:none;
}
.toast{
  display:flex;align-items:flex-start;gap:11px;
  min-width:250px;max-width:360px;padding:12px 14px;
  background:var(--bg2);border:1px solid var(--line);border-radius:12px;
  box-shadow:0 16px 44px rgba(0,0,0,.5);pointer-events:auto;
  animation:toastIn .42s cubic-bezier(.22,1,.36,1) both;
}
@keyframes toastIn{
  from{opacity:0;transform:translateX(26px) scale(.96)}
  to{opacity:1;transform:none}
}
.toast.out{animation:toastOut .3s ease forwards}
@keyframes toastOut{to{opacity:0;transform:translateX(26px) scale(.97)}}
.toast-ico{
  width:22px;height:22px;flex-shrink:0;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  background:rgba(123,171,123,.16);color:var(--ok);
}
.toast-ico svg{width:13px;height:13px}
.toast.warn .toast-ico{background:rgba(217,167,87,.16);color:var(--warn)}
.toast-body{flex:1;min-width:0}
.toast-title{font-size:12.5px;font-weight:600}
.toast-text{font-size:11.5px;color:var(--tx2);margin-top:2px;line-height:1.45}
.toast-x{
  color:var(--tx3);font-size:15px;line-height:1;padding:0 2px;
  border-radius:5px;transition:.14s;flex-shrink:0;
}
.toast-x:hover{color:var(--tx)}

/* =====================================================================
   SKILLS — folder cards with SKILL.md state
   ===================================================================== */
.skill-card{
  display:flex;align-items:flex-start;gap:11px;padding:12px 13px;
  background:var(--bg);border:1px solid var(--line);border-radius:11px;transition:.15s;
}
.skill-card:hover{border-color:var(--br)}
.skill-card.invalid{border-color:rgba(217,112,112,.4);background:rgba(217,112,112,.05)}
.sk-body{flex:1;min-width:0}
.sk-name{font-size:13px;font-weight:600;display:flex;align-items:center;gap:7px}
.sk-file{
  font:10px Consolas,monospace;padding:1px 6px;border-radius:5px;
  background:var(--bg2);border:1px solid var(--line);color:var(--tx3);
}
.skill-card.invalid .sk-file{border-color:rgba(217,112,112,.45);color:var(--bad)}
.sk-desc{font-size:11.5px;color:var(--tx2);margin-top:3px;line-height:1.45}
.sk-body-text{
  font-size:11px;color:var(--tx3);margin-top:5px;line-height:1.5;
  max-height:44px;overflow:hidden;
}
.sk-problem{font-size:11px;color:var(--bad);margin-top:5px}
.sk-path{
  margin-top:10px;padding:10px 12px;background:var(--bg);border:1px solid var(--line);
  border-radius:9px;font-size:11.5px;color:var(--tx2);line-height:1.6;
}
.sk-path code{
  font:11px Consolas,monospace;color:var(--br2);background:var(--bg2);
  padding:2px 6px;border-radius:5px;
}
.sk-actions{display:flex;gap:7px;align-items:center;flex-shrink:0}
.textarea{
  width:100%;background:var(--bg);border:1px solid var(--line);border-radius:9px;
  padding:10px 12px;color:var(--tx);font:inherit;font-size:12.5px;line-height:1.55;outline:none;
  resize:vertical;min-height:74px;transition:.14s;
}
.textarea:focus{border-color:var(--br)}

/* =====================================================================
   CONFIRM DIALOG — replaces the raw browser confirm() box
   ===================================================================== */
#confirm{
  position:fixed;inset:0;z-index:210;display:flex;
  align-items:center;justify-content:center;padding:24px;
  background:rgba(0,0,0,.55);backdrop-filter:blur(5px);
  animation:fadeIn .18s both;
}
#confirm.out{animation:fadeOut .18s both}
@keyframes fadeOut{to{opacity:0}}
.cf-card{
  width:min(392px,94vw);padding:22px;border-radius:16px;
  background:var(--bg2);border:1px solid var(--line);
  box-shadow:0 26px 70px rgba(0,0,0,.6);text-align:center;
  animation:cfIn .34s cubic-bezier(.22,1,.36,1) both;
}
#confirm.out .cf-card{animation:cfOut .2s ease both}
@keyframes cfIn{from{opacity:0;transform:translateY(14px) scale(.95)}to{opacity:1;transform:none}}
@keyframes cfOut{to{opacity:0;transform:scale(.97)}}
.cf-ico{
  width:44px;height:44px;margin:0 auto 14px;border-radius:50%;
  display:flex;align-items:center;justify-content:center;
  background:rgba(217,112,112,.14);color:var(--bad);
}
.cf-ico svg{width:21px;height:21px}
.cf-title{font-size:16px;font-weight:600;font-family:var(--serif)}
.cf-text{font-size:12.5px;color:var(--tx2);margin-top:7px;line-height:1.55}
.cf-btns{display:flex;gap:9px;margin-top:20px}
.cf-btn{
  flex:1;padding:11px;border-radius:10px;font-size:13px;font-weight:500;
  border:1px solid var(--line);background:var(--bg);transition:.15s;
}
.cf-btn:hover{background:var(--bg3)}
.cf-btn.danger{background:var(--bad);border-color:var(--bad);color:#fff}
.cf-btn.danger:hover{filter:brightness(1.1)}
.cf-btn:active{transform:scale(.98)}

/* =====================================================================
   Smooth removal of a chat row: it collapses instead of vanishing
   ===================================================================== */
.rec{
  overflow:hidden;
  transition:opacity .28s ease,transform .28s cubic-bezier(.22,1,.36,1),
             max-height .3s ease,margin .3s ease,padding .3s ease;
  max-height:44px;
}
.rec.removing{
  opacity:0;transform:translateX(-22px) scale(.96);
  max-height:0;padding-top:0;padding-bottom:0;margin:0;
}
/* wiping every chat: rows leave one after another */
.rec.wiping{animation:wipeOut .34s cubic-bezier(.4,0,1,1) forwards}
@keyframes wipeOut{
  30%{opacity:.6;transform:translateX(6px)}
  100%{opacity:0;transform:translateX(-30px) scale(.94);max-height:0;
       padding-top:0;padding-bottom:0;margin:0}
}

/* =====================================================================
   CHAT LAYOUT — matches the reference: a calm centred column.
   The user's message is a small bubble on the right; the answer is plain
   text on the left with a hover action row underneath.
   ===================================================================== */
:root{ --chat-w:768px; }

#messages{
  max-width:var(--chat-w);margin:0 auto;
  padding:34px 26px 20px;gap:30px;
}
.msg.user .bubble{
  background:var(--bub);border-radius:17px;padding:11px 16px;
  max-width:82%;font-size:14px;
}
.msg.bot .bubble{padding:0;max-width:100%;font-size:14.5px;line-height:1.68}

/* action row under an answer: appears on hover, like the reference */
.msg-acts{
  display:flex;align-items:center;gap:2px;margin-top:10px;
  opacity:0;transition:opacity .2s;
}
.msg.bot:hover .msg-acts,.msg-acts.pinned{opacity:1}
.act{
  width:27px;height:27px;border-radius:7px;color:var(--tx3);
  display:flex;align-items:center;justify-content:center;transition:.14s;
}
.act svg{width:15px;height:15px}
.act:hover{background:var(--bg3);color:var(--tx)}
.act.on{color:var(--br2)}
.act.copied{color:var(--ok)}

/* welcome screen: the S mark, centred, quietly animated */
#welcome{
  max-width:var(--chat-w);margin:0 auto;
  min-height:100%;display:flex;flex-direction:column;
  align-items:center;justify-content:center;text-align:center;padding:0 24px;
}
.w-logo{
  width:58px;height:58px;margin-bottom:20px;border-radius:16px;
  animation:logoIn .7s cubic-bezier(.22,1,.36,1) both;
  filter:drop-shadow(0 10px 30px rgba(var(--br-rgb),.3));
}
@keyframes logoIn{
  from{opacity:0;transform:translateY(12px) scale(.86)}
  to{opacity:1;transform:none}
}
#welcome h1{
  font-size:26px;font-weight:500;letter-spacing:-.3px;
  animation:logoIn .7s .08s cubic-bezier(.22,1,.36,1) both;
}

/* composer sits in the same column, never edge to edge */
#composer{padding:0 26px 20px}
.comp-box{max-width:var(--chat-w);border-radius:16px;padding:13px 15px 10px}
.comp-hint{max-width:var(--chat-w);justify-content:center;opacity:.75}

/* =====================================================================
   API KEY panel — the key defines which models exist
   ===================================================================== */
.key-row{display:flex;gap:8px;align-items:center}
.key-row .input{flex:1}
.key-models{display:flex;flex-direction:column;gap:5px;margin-top:12px}
.key-model{
  display:flex;align-items:center;gap:10px;padding:9px 12px;
  background:var(--bg);border:1px solid var(--line);border-radius:9px;
  cursor:pointer;transition:.14s;
}
.key-model:hover{border-color:var(--br)}
.key-model.on{border-color:var(--br);background:var(--brd)}
.km-name{
  flex:1;min-width:0;font:12.5px Consolas,monospace;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.key-model.on .km-name{color:var(--br2)}
.km-cur{font-size:10px;color:var(--br2);flex-shrink:0}

/* =====================================================================
   Settings overlay: guarantee only the active tab is visible and that the
   panel can always scroll. A stray unclosed div used to hide every tab.
   ===================================================================== */
.set-main{overflow-y:auto}
.set-tab{display:none}
.set-tab.active{display:block;animation:tabIn .26s cubic-bezier(.22,1,.36,1) both}
@keyframes tabIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.set-tab h3{font-size:17px;font-weight:600;margin-bottom:18px}

/* the settings card must never outgrow the window */
.set-card{max-height:90vh}
.set-side{overflow-y:auto;flex-shrink:0}

/* =====================================================================
   THINKING INDICATOR v2 — one tidy line with the S mark.
   Replaces the boxed panel; the old .think-panel rules are neutralised.
   ===================================================================== */
.think-panel{display:none!important}

.tk{margin:0 0 14px}

.tk-line{
  display:flex;align-items:center;gap:9px;
  font-size:13.5px;color:var(--tx2);
  animation:tkIn .3s cubic-bezier(.22,1,.36,1) both;
}
@keyframes tkIn{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}

/* the S mark: small, calm, quietly breathing */
.tk-mark{
  width:17px;height:17px;flex-shrink:0;display:flex;
  align-items:center;justify-content:center;border-radius:5px;
  animation:tkPulse 2.4s cubic-bezier(.45,0,.55,1) infinite;
}
.tk-mark svg{display:block;border-radius:5px}
@keyframes tkPulse{
  0%,100%{transform:scale(.94);filter:drop-shadow(0 0 0 rgba(var(--br-rgb),0))}
  50%{transform:scale(1.06);filter:drop-shadow(0 0 7px rgba(var(--br-rgb),.55))}
}

/* the status text shimmers softly while work is happening */
.tk-text{
  background:linear-gradient(100deg,var(--tx3) 32%,var(--tx) 50%,var(--tx3) 68%);
  background-size:290% 100%;
  -webkit-background-clip:text;background-clip:text;color:transparent;
  animation:sheen 2s cubic-bezier(.4,0,.6,1) infinite;
  min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.tk-dots{display:inline-flex;gap:3px;flex-shrink:0;align-items:center}
.tk-dots i{
  width:3.5px;height:3.5px;border-radius:50%;background:var(--br2);
  animation:bounce 1.3s infinite;
}
.tk-dots i:nth-child(2){animation-delay:.15s}
.tk-dots i:nth-child(3){animation-delay:.3s}

/* --- collapsible real reasoning --- */
.tk-reason{margin-top:10px;animation:tkIn .34s cubic-bezier(.22,1,.36,1) both}
.tk-rhead{
  display:inline-flex;align-items:center;gap:7px;
  padding:5px 11px;border-radius:9px;
  background:var(--bg2);border:1px solid var(--line);
  font-size:12px;color:var(--tx2);transition:.15s;
}
.tk-rhead:hover{border-color:var(--br);color:var(--tx)}
.tk-rcaret{display:flex;transition:transform .26s cubic-bezier(.22,1,.36,1)}
.tk-reason.closed .tk-rcaret{transform:rotate(-90deg)}
.tk-rbody{
  margin-top:8px;padding:11px 13px;border-radius:11px;
  background:var(--bg2);border:1px solid var(--line);
  font-size:12.5px;line-height:1.65;color:var(--tx2);
  white-space:pre-wrap;max-height:260px;overflow-y:auto;
  transition:max-height .3s ease,opacity .22s,margin .3s,padding .3s;
}
.tk-reason.closed .tk-rbody{
  max-height:0;opacity:0;margin-top:0;padding-top:0;padding-bottom:0;
  border-width:0;overflow:hidden;
}

/* =====================================================================
   BREATHING ROOM — the conversation was cramped against the composer and
   the window edges. One place sets the rhythm for the whole column.
   ===================================================================== */
:root{
  --chat-w:760px;
  --chat-pad:40px;     /* left/right air around the column */
  --chat-gap:34px;     /* space between messages */
}

#chat-scroll{padding-bottom:8px}

#messages{
  max-width:var(--chat-w);
  margin:0 auto;
  padding:40px var(--chat-pad) 34px;
  gap:var(--chat-gap);
}

/* the composer keeps clear of the last message and of the window bottom */
#composer{
  padding:14px var(--chat-pad) 26px;
  background:linear-gradient(transparent,var(--bg) 34%);
}
.comp-box{
  max-width:var(--chat-w);
  padding:14px 16px 11px;
  border-radius:17px;
}
.comp-bar{margin-top:10px;gap:8px}
.comp-hint{max-width:var(--chat-w);margin-top:9px;justify-content:center}

/* a little more room inside bubbles, so text is not glued to the edges */
.msg.user .bubble{padding:12px 17px}
.msg.bot .bubble{padding:0 1px}

/* on narrow windows the padding shrinks instead of squeezing the text */
@media (max-width:900px){
  :root{--chat-pad:22px;--chat-gap:26px}
}

/* reasoning header caption */
.tk-rcap{font-weight:500}

/* account row inside general settings */
#g-acc-email{
  font-size:11.5px;color:var(--tx3);font-style:normal;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:230px;display:block;
}
