/* =========================================================
   Chat — studio Chat mode + dedicated chat environment (liquid glass)
   ========================================================= */
:root{--answer:"Instrument Sans","Inter",ui-sans-serif,system-ui,sans-serif}

/* ---------- studio composer in Chat mode ---------- */
.prompt-col .chat-tools{display:none}
body.mode-chat .director,body.mode-chat .prompt-col .tools{display:none!important}
body.mode-chat .prompt-col .chat-tools{display:flex}
body.mode-chat .g-label{font-size:0}
body.mode-chat .g-label::after{content:"Ask";font-size:15px}
body.mode-chat .g-inr{display:none}
body.mode-chat textarea#prompt{min-height:72px}

/* ---------- shared chat controls ---------- */
.chat-tools{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-top:auto;min-width:0}
.ct-model,.ct-tog,.effort{height:36px;border-radius:999px;display:inline-flex;align-items:center;gap:7px;padding:0 12px;font-size:13px;font-weight:700;color:#fff;white-space:nowrap;
  background:linear-gradient(180deg,rgba(255,255,255,.17),rgba(255,255,255,.06));box-shadow:inset 0 1px 0 rgba(255,255,255,.45),inset 0 0 0 1px rgba(255,255,255,.09);transition:background .15s,box-shadow .2s}
.ct-model{padding:0 10px 0 5px}
.ct-model svg{width:13px;height:13px;opacity:.75}
.ct-model:hover,.ct-tog:hover{background:linear-gradient(180deg,rgba(255,255,255,.26),rgba(255,255,255,.1))}
.ct-tog svg{width:15px;height:15px;opacity:.8}
.ct-tog.on{color:#141800;background:linear-gradient(180deg,#efff70,var(--accent) 55%,var(--accent-2));box-shadow:inset 0 1px 0 rgba(255,255,255,.7),0 0 16px -4px rgba(220,255,31,.6)}
.ct-tog.on svg{opacity:1}
.llm-logo{width:26px;height:26px;flex:none;border-radius:8px;display:grid;place-items:center;background:rgba(15,12,10,.55);box-shadow:inset 0 0 0 1px rgba(255,255,255,.14)}
.llm-logo img{width:70%;height:70%;object-fit:contain}
.llm-logo.xl{width:64px;height:64px;border-radius:20px;background:linear-gradient(180deg,rgba(255,255,255,.22),rgba(255,255,255,.06));box-shadow:inset 0 1.5px 0 rgba(255,255,255,.6),inset 0 0 0 1px rgba(255,255,255,.14),0 16px 40px -14px rgba(0,0,0,.6)}

/* liquid-glass effort slider */
.effort{gap:9px;padding:0 12px;cursor:pointer;touch-action:none;-webkit-user-select:none;user-select:none}
.effort:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.ef-k{font-size:11px;font-weight:600;color:rgba(255,255,255,.65)}
.ef-track{position:relative;width:118px;height:8px;border-radius:999px;background:rgba(0,0,0,.28);box-shadow:inset 0 1px 3px rgba(0,0,0,.45),0 1px 0 rgba(255,255,255,.18)}
.ef-fill{position:absolute;left:0;top:0;bottom:0;border-radius:999px;background:linear-gradient(90deg,#b9f5ff,#ff9ad0 55%,var(--accent));box-shadow:0 0 10px rgba(255,140,210,.5);transition:width .25s var(--ease)}
.ef-dot{position:absolute;top:50%;width:4px;height:4px;margin:-2px;border-radius:50%;background:rgba(255,255,255,.4)}
.ef-dot.on{background:rgba(20,16,12,.5)}
.ef-thumb{position:absolute;top:50%;width:22px;height:22px;margin:-11px;border-radius:50%;transition:left .25s cubic-bezier(.3,1.35,.4,1);
  background:radial-gradient(circle at 35% 30%,#fff,rgba(255,255,255,.85) 40%,rgba(230,230,240,.7));box-shadow:inset 0 -2px 3px rgba(0,0,0,.18),0 0 0 1px rgba(255,255,255,.6),0 4px 10px rgba(0,0,0,.4)}
.effort:active .ef-thumb{transform:scale(1.18)}
.ef-v{min-width:66px;font-size:12.5px;font-weight:800}

/* chat model pop */
.llm-opt{display:flex;align-items:center;gap:10px;width:100%;padding:9px 10px;border-radius:14px;text-align:left}
.llm-opt:hover,.llm-opt.on{background:rgba(255,255,255,.12)}
.llm-opt.on{box-shadow:inset 0 0 0 1.5px var(--accent-line)}
.llm-opt .llm-logo{width:34px;height:34px;border-radius:11px}
.llm-opt b{display:block;font-size:14px;font-weight:700}
.llm-opt small{display:block;font-size:11.5px;color:rgba(255,255,255,.65);max-width:260px}
.llm-opt em{margin-left:auto;font-style:normal;font:500 11.5px var(--mono);color:var(--accent)}
.pop-effort{padding:4px 4px 2px}
.pop-effort .effort{width:100%;justify-content:space-between}
.pop-effort .ef-track{flex:1}
.pop-note{margin:6px 10px 6px;font-size:11.5px;color:rgba(255,255,255,.6);max-width:320px}

/* ---------- dedicated chat environment ---------- */
.chat{position:fixed;inset:0;z-index:66;display:grid;grid-template-columns:280px minmax(0,1fr);gap:10px;padding:10px;
  background:rgba(24,18,14,.36);-webkit-backdrop-filter:blur(42px) saturate(170%);backdrop-filter:blur(42px) saturate(170%);
  opacity:0;transform:scale(.985);transition:opacity .25s,transform .25s var(--ease)}
.chat.on{opacity:1;transform:none}
.chat[hidden]{display:none}
.ch-side{display:flex;flex-direction:column;gap:8px;padding:12px;border-radius:26px;min-height:0;
  background:var(--lg-fill);box-shadow:var(--lg-edge),var(--lg-lift)}
.ch-side-head{display:flex;align-items:center;justify-content:space-between;padding:2px 4px 6px}
.ch-side-head b{font-size:15px;font-weight:800}
.ch-new{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 12px;border-radius:999px;font-size:12.5px;font-weight:700;color:#141800;background:linear-gradient(180deg,#efff70,var(--accent) 55%,var(--accent-2));box-shadow:0 2px 0 rgba(120,150,0,.9),inset 0 1px 0 rgba(255,255,255,.7)}
.ch-new svg{width:14px;height:14px}
.ch-list{flex:1;overflow:auto;display:flex;flex-direction:column;gap:3px;scrollbar-width:none}
.ch-item{display:block;width:100%;text-align:left;padding:9px 11px;border-radius:14px;color:rgba(255,255,255,.85)}
.ch-item b{display:block;font-size:13px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ch-item small{display:block;font-size:11px;color:rgba(255,255,255,.55);margin-top:1px}
.ch-item:hover{background:rgba(255,255,255,.08)}
.ch-item.on{background:linear-gradient(180deg,rgba(255,255,255,.24),rgba(255,255,255,.1));box-shadow:inset 0 1px 0 rgba(255,255,255,.5)}
.ch-empty-list,.ch-side-foot{font-size:12px;color:rgba(255,255,255,.6);padding:6px 8px;margin:0;line-height:1.45}
.ch-main{display:flex;flex-direction:column;min-height:0;min-width:0}
.ch-top{display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:22px;background:var(--lg-fill);box-shadow:var(--lg-edge),0 10px 30px -18px rgba(0,0,0,.6);flex:none}
.ch-top .grow{flex:1}
.ch-title{display:flex;flex-direction:column;min-width:0;line-height:1.25}
.ch-title b{font-size:14.5px;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:56vw}
.ch-title small{font-size:11.5px;color:rgba(255,255,255,.65)}
.ch-icon{width:38px;height:38px;flex:none;border-radius:50%;display:grid;place-items:center;color:#fff;background:linear-gradient(180deg,rgba(255,255,255,.18),rgba(255,255,255,.06));box-shadow:inset 0 1px 0 rgba(255,255,255,.5),inset 0 0 0 1px rgba(255,255,255,.1)}
.ch-icon svg{width:18px;height:18px}
.ch-hist{display:none}
.ch-thread{flex:1;min-height:0;overflow-y:auto;padding:22px 6px 12px;scrollbar-width:thin;overscroll-behavior:contain}
.ch-col{max-width:800px;margin:0 auto;display:flex;flex-direction:column;gap:22px}

/* empty state */
.ch-hello{max-width:720px;margin:6vh auto 0;text-align:center;padding:0 10px}
.ch-orb{display:grid;place-items:center;margin-bottom:16px}
.ch-hello h2{margin:0;font:700 clamp(26px,4vw,38px)/1.1 var(--answer);letter-spacing:-.03em;text-shadow:0 2px 18px rgba(0,0,0,.25)}
.ch-hello p{margin:10px auto 22px;max-width:520px;color:rgba(255,255,255,.82);font:400 15px/1.55 var(--answer)}
.ideas{display:grid;grid-template-columns:1fr 1fr;gap:10px;text-align:left}
.idea{display:flex;align-items:flex-start;gap:10px;padding:14px;border-radius:18px;font:500 14px/1.4 var(--answer);color:#fff;
  background:linear-gradient(180deg,rgba(255,255,255,.16),rgba(255,255,255,.05));box-shadow:var(--lg-edge),0 10px 24px -16px rgba(0,0,0,.6);transition:transform .2s var(--ease)}
.idea:hover{transform:translateY(-2px)}
.idea svg{width:18px;height:18px;flex:none;margin-top:1px;color:var(--accent)}

/* messages */
.msg.me{display:flex;justify-content:flex-end}
.bubble{max-width:78%;padding:11px 15px;border-radius:20px 20px 6px 20px;font:500 15px/1.5 var(--answer);color:#fff;white-space:pre-wrap;overflow-wrap:anywhere;
  background:linear-gradient(180deg,rgba(255,255,255,.26),rgba(255,255,255,.12));box-shadow:inset 0 1px 0 rgba(255,255,255,.55),inset 0 0 0 1px rgba(255,255,255,.12),0 8px 20px -12px rgba(0,0,0,.5)}
.msg.ai{padding:16px 18px;border-radius:24px;background:linear-gradient(180deg,rgba(255,255,255,.11),rgba(255,255,255,.04));box-shadow:var(--lg-edge),0 16px 36px -24px rgba(0,0,0,.6)}
.ai-head{display:flex;align-items:center;gap:8px;margin-bottom:8px}
.ai-head b{font-size:13.5px;font-weight:800}
.ef-badge{font-size:11px;font-weight:700;padding:2px 8px;border-radius:999px;background:rgba(255,255,255,.14);box-shadow:inset 0 1px 0 rgba(255,255,255,.3)}
.ai-cost{margin-left:auto;font:500 11px var(--mono);color:rgba(255,255,255,.6)}
.think{margin:0 0 10px;font-size:12.5px;color:rgba(255,255,255,.7)}
.think summary{cursor:pointer;list-style:none;display:inline-flex;align-items:center;gap:6px;font-weight:600}
.think summary::-webkit-details-marker{display:none}
.think summary::before{content:"";width:6px;height:6px;border-right:1.6px solid currentColor;border-bottom:1.6px solid currentColor;transform:rotate(-45deg);transition:transform .2s}
.think[open] summary::before{transform:rotate(45deg)}
.think ol{margin:8px 0 0;padding-left:20px;display:flex;flex-direction:column;gap:3px}
.think li{animation:tin .3s var(--ease)}
.think li.live{color:#fff}
.shimmer{background:linear-gradient(90deg,rgba(255,255,255,.5),#fff,rgba(255,255,255,.5));background-size:200% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;animation:shim 1.2s linear infinite}
@keyframes shim{to{background-position:-200% 0}}
.srcs{margin:0 0 12px}
.srcs-h{display:flex;align-items:center;gap:6px;font-size:12px;font-weight:700;color:rgba(255,255,255,.75);margin-bottom:8px}
.srcs-h svg{width:13px;height:13px}
.src-row{display:flex;gap:8px;overflow-x:auto;scrollbar-width:none;padding-bottom:2px}
.src{flex:none;display:flex;align-items:center;gap:8px;width:190px;padding:7px;border-radius:14px;text-align:left;
  background:linear-gradient(180deg,rgba(255,255,255,.15),rgba(255,255,255,.05));box-shadow:inset 0 1px 0 rgba(255,255,255,.4)}
.src img{width:38px;height:38px;border-radius:10px;object-fit:cover;flex:none}
.src img.contain{object-fit:contain;background:rgba(15,12,10,.5);padding:4px}
.src b{display:block;font-size:12.5px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:130px}
.src small{display:block;font-size:10.5px;color:rgba(255,255,255,.6)}
.ai-body{font:400 15.5px/1.7 var(--answer);color:rgba(255,255,255,.95);letter-spacing:-.003em}
.ai-body>*{animation:tin .35s var(--ease)}
.ai-body p{margin:0 0 12px}
.ai-body h3{margin:6px 0 8px;font:700 19px/1.3 var(--answer);letter-spacing:-.02em}
.ai-body ul{margin:0 0 12px;padding-left:20px}
.ai-body li{margin:4px 0}
.ai-body b{font-weight:700;color:#fff}
.cite{font:600 10px var(--mono);padding:1px 5px;border-radius:5px;background:rgba(255,255,255,.18);margin-left:3px}
.muted-note{display:flex;align-items:center;gap:6px;font-size:12.5px!important;color:rgba(255,255,255,.62)}
.muted-note svg{width:14px;height:14px;flex:none}
.caret{display:inline-block;width:8px;height:16px;border-radius:2px;background:var(--accent);vertical-align:-2px;animation:breathe .8s ease-in-out infinite}
.prompt-card{margin:0 0 10px;padding:12px 14px;border-radius:18px;background:rgba(0,0,0,.14);box-shadow:inset 0 0 0 1px rgba(255,255,255,.12),inset 0 1px 0 rgba(255,255,255,.18)}
.pc-head{display:flex;flex-wrap:wrap;align-items:baseline;gap:4px 10px;margin-bottom:6px}
.pc-head b{font-size:13px;font-weight:800;color:var(--accent)}
.pc-head span{font-size:11.5px;color:rgba(255,255,255,.65)}
.prompt-card p{margin:0 0 10px;font-size:15px}
.pc-acts{display:flex;gap:6px;flex-wrap:wrap}
.plan-row{display:flex;gap:12px;align-items:flex-start;margin:0 0 8px;padding:12px;border-radius:18px;background:rgba(0,0,0,.12);box-shadow:inset 0 0 0 1px rgba(255,255,255,.1)}
.pr-n{width:28px;height:28px;flex:none;border-radius:50%;display:grid;place-items:center;font:800 13px var(--answer);color:#141800;background:var(--accent)}
.pr-main{flex:1;min-width:0}
.pr-main b{font-size:14px}
.pr-main p{margin:3px 0 6px;font-size:14px;line-height:1.55;color:rgba(255,255,255,.88)}
.pr-tags{display:flex;flex-wrap:wrap;gap:4px}
.pr-tags span{font:500 10.5px var(--mono);padding:2px 7px;border-radius:6px;background:rgba(255,255,255,.12)}
.pr-side{flex:none;display:flex;flex-direction:column;align-items:flex-end;gap:3px;font-size:11px;color:rgba(255,255,255,.7);text-align:right;max-width:110px}
.pr-side b{font:600 12px var(--mono);color:var(--accent)}
.plan-total{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:6px 0 4px;padding:12px 14px;border-radius:18px;background:linear-gradient(180deg,rgba(220,255,31,.16),rgba(220,255,31,.05));box-shadow:inset 0 0 0 1px rgba(220,255,31,.35)}
.plan-total span{font-size:13px;color:rgba(255,255,255,.75)}
.plan-total b{font:600 14px var(--mono);margin-right:auto}
.ai-foot{display:flex;align-items:center;gap:6px;margin-top:10px}
.ch-mini{display:inline-flex;align-items:center;gap:5px;height:30px;padding:0 11px;border-radius:999px;font-size:12px;font-weight:600;color:rgba(255,255,255,.85);background:rgba(255,255,255,.1);box-shadow:inset 0 1px 0 rgba(255,255,255,.3)}
.ch-mini svg{width:13px;height:13px}
.ch-mini:hover{background:rgba(255,255,255,.18)}
.stopped{font-size:12px;font-weight:700;color:#ffb3c6;margin-right:4px}
.follow{display:flex;flex-wrap:wrap;gap:6px;margin-top:12px}
.fchip{display:inline-flex;align-items:center;gap:6px;padding:8px 12px;border-radius:999px;font:500 13px var(--answer);color:#fff;text-align:left;
  background:linear-gradient(180deg,rgba(255,255,255,.16),rgba(255,255,255,.05));box-shadow:inset 0 1px 0 rgba(255,255,255,.4),inset 0 0 0 1px rgba(255,255,255,.08)}
.fchip svg{width:13px;height:13px;transform:rotate(45deg);opacity:.7}
.fchip:hover{background:linear-gradient(180deg,rgba(255,255,255,.26),rgba(255,255,255,.1))}

/* dock */
.ch-dock{flex:none;padding:8px 0 0}
.ch-composer{max-width:800px;margin:0 auto;padding:8px;border-radius:26px;background:var(--lg-fill);-webkit-backdrop-filter:var(--lg-blur);backdrop-filter:var(--lg-blur);box-shadow:var(--lg-edge),var(--lg-lift),0 0 40px -14px rgba(255,45,135,.45)}
.ch-composer textarea{display:block;width:100%;resize:none;background:transparent;border:0;outline:0;color:#fff;font:400 16px/1.5 var(--answer);padding:10px 12px 6px;min-height:46px;max-height:160px}
.ch-composer textarea::placeholder{color:rgba(255,255,255,.55)}
.ch-row{display:flex;align-items:flex-end;gap:8px}
.ch-row .chat-tools{flex:1;margin:0}
.ch-send{width:44px;height:44px;flex:none;border-radius:50%;display:grid;place-items:center;color:#141800;
  background:linear-gradient(180deg,#efff70,var(--accent) 50%,var(--accent-2));box-shadow:0 3px 0 rgba(120,150,0,.9),0 8px 20px -6px rgba(220,255,31,.55),inset 0 2px 0 rgba(255,255,255,.8);transition:transform .1s}
.ch-send svg{width:20px;height:20px}
.ch-send:active{transform:translateY(2px)}
.ch-send.stop{color:#fff;background:linear-gradient(180deg,#ff7a9c,#ff3b6b);box-shadow:0 3px 0 #a3142e,inset 0 2px 0 rgba(255,255,255,.5)}

/* ---------- tablet ---------- */
@media (max-width:1100px){
  .chat{grid-template-columns:240px minmax(0,1fr)}
}
/* ---------- phone ---------- */
@media (max-width:767px){
  /* studio composer in chat mode: one swipe row of chat controls */
  body.mode-chat .prompt-col .chat-tools{flex-wrap:nowrap;overflow-x:auto;margin:6px -4px 0;padding:0 4px 2px;scrollbar-width:none;
    -webkit-mask:linear-gradient(90deg,#000 85%,transparent);mask:linear-gradient(90deg,#000 85%,transparent)}
  body.mode-chat .prompt-col .chat-tools::-webkit-scrollbar{display:none}
  .chat-tools>*{flex:none}
  .ct-model,.ct-tog,.effort{height:34px;font-size:12.5px}
  .ef-track{width:84px}
  .ef-v{min-width:0}
  .ef-k{display:none}
  .ct-model span{max-width:120px;overflow:hidden;text-overflow:ellipsis}
  body.mode-chat .g-label::after{content:""}

  .chat{grid-template-columns:minmax(0,1fr);padding:6px 6px calc(6px + var(--safe-b));gap:0}
  .ch-side{position:fixed;left:6px;top:6px;bottom:6px;width:min(300px,84vw);z-index:3;transform:translateX(-110%);transition:transform .3s var(--ease);
    -webkit-backdrop-filter:var(--lg-blur);backdrop-filter:var(--lg-blur)}
  .ch-side.open{transform:none;background:linear-gradient(180deg,rgba(52,40,34,.86),rgba(34,26,22,.92));box-shadow:var(--lg-edge),0 0 0 100vmax rgba(10,7,5,.35),0 30px 60px -20px #000}
  .ch-hist{display:grid}
  .ch-top{border-radius:20px;padding:6px}
  .ch-icon{width:36px;height:36px}
  .ch-title b{max-width:52vw;font-size:14px}
  .ch-thread{padding:14px 2px 8px}
  .ch-col{gap:16px}
  .ch-hello{margin-top:3vh}
  .ideas{grid-template-columns:1fr}
  .idea{padding:12px;font-size:14px}
  .bubble{max-width:88%;font-size:15px}
  .msg.ai{padding:13px 13px;border-radius:20px}
  .ai-body{font-size:15px;line-height:1.65}
  .plan-row{flex-wrap:wrap;padding:10px;gap:10px}
  .pr-side{flex-direction:row;align-items:center;max-width:none;width:100%;justify-content:flex-start;gap:8px;padding-left:38px}
  .src{width:160px}
  .ch-composer{border-radius:24px;padding:6px}
  .ch-composer textarea{padding:8px 10px 4px}
  .ch-row .chat-tools{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;-webkit-mask:linear-gradient(90deg,#000 85%,transparent);mask:linear-gradient(90deg,#000 85%,transparent)}
  .ch-row .chat-tools::-webkit-scrollbar{display:none}
  .ch-send{width:42px;height:42px}
}

/* =========================================================
   v3 — smooth effort slider, Max glow, attachments, history,
   clearer chat glass, skeletons
   ========================================================= */

/* ---- effort slider: continuous position via --p, spring snap on release ---- */
.effort{--p:0;--spring:cubic-bezier(.34,1.56,.5,1)}
.ef-track{transition:box-shadow .35s var(--ease),background .35s var(--ease)}
.ef-fill{width:calc(var(--p)*100%);transition:width .42s var(--spring),box-shadow .35s,filter .35s}
.ef-thumb{left:calc(var(--p)*100%);transition:left .42s var(--spring),transform .2s var(--ease),box-shadow .35s}
.ef-dot{transition:background .2s,transform .25s var(--ease)}
.ef-dot.on{transform:scale(.8)}
.effort.dragging .ef-fill,.effort.dragging .ef-thumb{transition:none}
.effort.dragging .ef-thumb{transform:scale(1.22);box-shadow:inset 0 -2px 3px rgba(0,0,0,.18),0 0 0 1px rgba(255,255,255,.7),0 6px 16px rgba(0,0,0,.45),0 0 0 6px rgba(255,255,255,.12)}
.ef-v{transition:color .3s,text-shadow .3s}

/* Max: the whole stick lights up */
.effort.max{box-shadow:inset 0 1px 0 rgba(255,255,255,.5),inset 0 0 0 1px rgba(255,150,210,.45),0 0 22px -4px rgba(255,60,150,.65),0 0 44px -10px rgba(200,255,90,.45)}
.effort.max .ef-track{background:rgba(255,80,160,.22);box-shadow:inset 0 1px 2px rgba(0,0,0,.35),0 0 0 1px rgba(255,170,220,.55),0 0 14px rgba(255,70,160,.75),0 0 28px rgba(210,255,90,.4)}
.effort.max .ef-fill{background:linear-gradient(90deg,#9ff2ff,#ff7cc4,#e8ff5a,#ff7cc4,#9ff2ff);background-size:250% 100%;
  animation:efFlow 2.4s linear infinite,efPulse 1.6s ease-in-out infinite;box-shadow:0 0 12px rgba(255,90,170,.95),0 0 26px rgba(220,255,80,.55)}
.effort.max .ef-thumb{background:radial-gradient(circle at 35% 30%,#fff,#ffe3f2 45%,#ffb4dc);box-shadow:inset 0 -2px 3px rgba(160,0,80,.25),0 0 0 1px #fff,0 0 14px 2px rgba(255,90,170,.9),0 0 30px 6px rgba(220,255,90,.45)}
.effort.max .ef-dot{background:rgba(255,255,255,.85);box-shadow:0 0 6px #fff}
.effort.max .ef-v{color:#fff;text-shadow:0 0 10px rgba(255,90,170,.95),0 0 20px rgba(220,255,90,.6)}
@keyframes efFlow{to{background-position:-250% 0}}
@keyframes efPulse{50%{filter:brightness(1.3) saturate(1.2)}}
@media (prefers-reduced-motion:reduce){.effort.max .ef-fill{animation:none}}

/* ---- attach button ---- */
.ct-att{position:relative;flex:none;width:36px;height:36px;border-radius:50%;display:grid;place-items:center;color:#fff;
  background:linear-gradient(180deg,rgba(255,255,255,.17),rgba(255,255,255,.06));box-shadow:inset 0 1px 0 rgba(255,255,255,.45),inset 0 0 0 1px rgba(255,255,255,.09);transition:background .15s,transform .2s var(--ease)}
.ct-att svg{width:17px;height:17px;transition:transform .25s var(--ease)}
.ct-att:hover{background:linear-gradient(180deg,rgba(255,255,255,.26),rgba(255,255,255,.1))}
.ct-att.open svg{transform:rotate(45deg)}
.ct-att:active{transform:scale(.92)}
.ct-att em{position:absolute;top:-3px;right:-3px;min-width:16px;height:16px;padding:0 4px;border-radius:9px;font:800 10px/16px var(--sans,inherit);font-style:normal;color:#14110f;background:var(--accent);box-shadow:0 0 0 2px rgba(20,16,14,.5)}

/* ---- attachment tray (both composers) ---- */
.attach-tray{display:flex;gap:6px;overflow-x:auto;scrollbar-width:none;padding:4px 4px 2px;align-items:center;animation:tin .25s var(--ease)}
.attach-tray::-webkit-scrollbar{display:none}
.prompt-col .attach-tray{display:none}
body.mode-chat .prompt-col .attach-tray:not([hidden]){display:flex}
.att-chip{flex:none;display:inline-flex;align-items:center;gap:7px;height:38px;padding:3px 4px 3px 3px;border-radius:13px;max-width:200px;animation:chipIn .3s var(--spring,cubic-bezier(.34,1.56,.5,1));
  background:linear-gradient(180deg,rgba(255,255,255,.2),rgba(255,255,255,.07));box-shadow:inset 0 1px 0 rgba(255,255,255,.45),inset 0 0 0 1px rgba(255,255,255,.1)}
.att-chip b{font-size:12px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;min-width:0}
.att-chip.k-char b{color:var(--accent)}
.att-chip button{flex:none;width:22px;height:22px;border-radius:50%;display:grid;place-items:center;color:rgba(255,255,255,.75);background:rgba(0,0,0,.25)}
.att-chip button:hover{color:#fff;background:rgba(255,60,120,.55)}
.att-chip button svg{width:11px;height:11px}
.att-count{flex:none;font:600 11px var(--mono,monospace);color:rgba(255,255,255,.5);padding:0 4px}
@keyframes chipIn{from{opacity:0;transform:scale(.7)}}
.att-th{position:relative;flex:none;width:32px;height:32px;border-radius:10px;overflow:hidden;display:block;background:rgba(0,0,0,.3)}
.att-th img,.att-th video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.att-th.k-char{border-radius:50%;box-shadow:0 0 0 1.5px var(--accent)}
.att-ph{position:absolute;inset:0;display:grid;place-items:center;color:rgba(255,255,255,.7)}
.att-ph svg{width:15px;height:15px}
.att-play{position:absolute;right:2px;bottom:2px;width:13px;height:13px;border-radius:4px;display:grid;place-items:center;background:rgba(0,0,0,.6)}
.att-play svg{width:9px;height:9px;color:#fff}
.drop{box-shadow:inset 0 0 0 2px var(--accent),0 0 40px -6px rgba(210,255,80,.6)!important}
.drop::after{content:"Drop to attach";position:absolute;inset:0;display:grid;place-items:center;border-radius:inherit;font-weight:800;font-size:14px;color:#fff;background:rgba(20,16,14,.45);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);pointer-events:none;z-index:5}
.ch-composer{position:relative}

/* ---- attach menu (pop) ---- */
.att-menu{width:300px;padding:4px;display:flex;flex-direction:column;gap:2px}
.att-menu.wide{width:360px}
.att-menu .pop-h{display:flex;align-items:center;gap:8px;padding:6px 8px 8px}
.att-menu .pop-h b{font-size:14px;font-weight:800;flex:1}
.att-menu .pop-h small{font:600 11px var(--mono,monospace);color:rgba(255,255,255,.55)}
.att-back{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;background:rgba(255,255,255,.1)}
.att-back svg{width:15px;height:15px}
.att-opt{display:flex;align-items:center;gap:11px;padding:8px;border-radius:14px;text-align:left;width:100%;transition:background .15s}
.att-opt:hover{background:rgba(255,255,255,.1)}
.att-opt>span:nth-child(2){flex:1;min-width:0}
.att-opt b{display:block;font-size:13.5px;font-weight:700}
.att-opt small{display:block;font-size:11.5px;color:rgba(255,255,255,.6);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.att-opt>svg{width:15px;height:15px;opacity:.55}
.ao-ic{flex:none;width:36px;height:36px;border-radius:12px;display:grid;place-items:center;box-shadow:inset 0 1px 0 rgba(255,255,255,.45)}
.ao-ic svg{width:18px;height:18px}
.i-img{background:linear-gradient(160deg,rgba(120,200,255,.55),rgba(60,120,255,.3))}
.i-vid{background:linear-gradient(160deg,rgba(255,130,200,.6),rgba(255,50,130,.3))}
.i-chr{background:linear-gradient(160deg,rgba(220,255,110,.55),rgba(140,200,40,.3))}
.i-lib{background:linear-gradient(160deg,rgba(255,200,120,.55),rgba(255,140,60,.3))}
.att-hint{margin:4px 8px 4px;font-size:11px;color:rgba(255,255,255,.5)}
.att-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px;max-height:min(330px,52vh);overflow-y:auto;padding:2px 4px 6px;scrollbar-width:thin}
.att-cell{position:relative;display:flex;flex-direction:column;gap:3px;text-align:left;padding:3px;border-radius:14px;transition:background .15s,transform .15s}
.att-cell:hover{background:rgba(255,255,255,.08)}
.att-cell:active{transform:scale(.95)}
.ac-img{display:block;position:relative;aspect-ratio:1;border-radius:11px;overflow:hidden;box-shadow:inset 0 0 0 1px rgba(255,255,255,.12)}
.ac-img img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.att-cell b{font-size:11px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:0 2px}
.att-cell small{font-size:9.5px;color:rgba(255,255,255,.5);padding:0 2px;margin-top:-3px}
.ac-ok{position:absolute;top:7px;right:7px;width:20px;height:20px;border-radius:50%;display:grid;place-items:center;background:var(--accent);color:#14110f;opacity:0;transform:scale(.5);transition:.22s cubic-bezier(.34,1.56,.5,1)}
.ac-ok svg{width:12px;height:12px}
.att-cell.on .ac-img{box-shadow:inset 0 0 0 2px var(--accent)}
.att-cell.on .ac-ok{opacity:1;transform:none}

/* ---- attachments in the thread ---- */
.me-col{display:flex;flex-direction:column;align-items:flex-end;gap:6px;max-width:78%}
.me-col .bubble{max-width:100%}
.me-att{display:flex;gap:5px;flex-wrap:wrap;justify-content:flex-end}
.me-att .att-th{width:58px;height:58px;border-radius:14px;box-shadow:inset 0 0 0 1px rgba(255,255,255,.2),0 8px 18px -10px rgba(0,0,0,.6)}
.me-att .att-th.k-char{border-radius:50%;box-shadow:0 0 0 2px var(--accent)}
.att-note{display:flex;align-items:flex-start;gap:8px;padding:9px 12px;border-radius:14px;font-size:13.5px!important;line-height:1.5;background:rgba(210,255,90,.1);box-shadow:inset 0 0 0 1px rgba(210,255,90,.25)}
.att-note svg{flex:none;width:15px;height:15px;margin-top:3px;color:var(--accent)}

/* ---- thinking skeleton ---- */
.sk-lines{display:flex;flex-direction:column;gap:9px;padding:4px 0 6px}
.sk-lines i{display:block;height:11px;border-radius:6px;background:linear-gradient(90deg,rgba(255,255,255,.07) 20%,rgba(255,255,255,.2) 50%,rgba(255,255,255,.07) 80%);background-size:220% 100%;animation:skel 1.3s ease-in-out infinite}
.sk-lines i:nth-child(1){width:92%}
.sk-lines i:nth-child(2){width:78%;animation-delay:.12s}
.sk-lines i:nth-child(3){width:54%;animation-delay:.24s}
@keyframes skel{from{background-position:120% 0}to{background-position:-120% 0}}

/* ---- history: search + delete ---- */
.ch-search{display:flex;align-items:center;gap:7px;height:36px;margin:0 2px 8px;padding:0 11px;border-radius:12px;background:rgba(255,255,255,.08);box-shadow:inset 0 1px 2px rgba(0,0,0,.2),inset 0 0 0 1px rgba(255,255,255,.08);transition:box-shadow .2s}
.ch-search:focus-within{box-shadow:inset 0 0 0 1.5px rgba(255,255,255,.35)}
.ch-search svg{width:14px;height:14px;opacity:.6;flex:none}
.ch-search input{flex:1;min-width:0;background:transparent;border:0;outline:0;color:#fff;font:500 13px inherit;font-family:inherit}
.ch-search input::placeholder{color:rgba(255,255,255,.5)}
.ch-item{display:flex;align-items:center;padding:0;gap:0;position:relative}
.ch-open{flex:1;min-width:0;text-align:left;padding:9px 6px 9px 11px;color:inherit}
.ch-del{flex:none;width:30px;height:30px;margin-right:5px;border-radius:9px;display:grid;place-items:center;color:rgba(255,255,255,.6);opacity:0;transition:opacity .15s,background .15s}
.ch-del svg{width:14px;height:14px}
.ch-item:hover .ch-del,.ch-item.on .ch-del,.ch-del:focus-visible{opacity:1}
.ch-del:hover{color:#fff;background:rgba(255,60,120,.5)}
@media (hover:none){.ch-del{opacity:.75}}

/* ---- clearer chat glass ---- */
.ch-composer{background:linear-gradient(180deg,rgba(255,255,255,.1),rgba(255,255,255,.03) 60%,rgba(255,255,255,.06));
  -webkit-backdrop-filter:blur(18px) saturate(170%);backdrop-filter:blur(18px) saturate(170%);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.5),inset 0 0 0 1px rgba(255,255,255,.14),inset 0 -1px 0 rgba(255,255,255,.08),0 18px 40px -22px rgba(0,0,0,.55),0 0 40px -16px rgba(255,45,135,.4);
  transition:box-shadow .3s var(--ease),background .3s}
.ch-composer:focus-within{background:linear-gradient(180deg,rgba(255,255,255,.14),rgba(255,255,255,.05) 60%,rgba(255,255,255,.08));box-shadow:inset 0 1px 0 rgba(255,255,255,.6),inset 0 0 0 1px rgba(255,255,255,.22),0 18px 40px -22px rgba(0,0,0,.55),0 0 50px -12px rgba(255,45,135,.55)}
.msg.ai{background:linear-gradient(180deg,rgba(255,255,255,.07),rgba(255,255,255,.02))}
.bubble{background:linear-gradient(180deg,rgba(255,255,255,.2),rgba(255,255,255,.08))}

/* ---- site-wide image skeletons ---- */
img:not(.ld){background:linear-gradient(90deg,rgba(255,255,255,.05) 20%,rgba(255,255,255,.16) 50%,rgba(255,255,255,.05) 80%);background-size:220% 100%;animation:skel 1.3s ease-in-out infinite}
img.fade{animation:imgIn .5s var(--ease)}
@keyframes imgIn{from{opacity:0;filter:blur(8px)}}

/* ---- smoothness ---- */
.chat-tools button,.ct-tog,.ct-model{transition:background .15s,box-shadow .2s,transform .18s var(--ease)}
.ct-tog:active,.ct-model:active{transform:scale(.96)}
.ch-thread{scroll-behavior:smooth;overscroll-behavior:contain}
#chList{overscroll-behavior:contain}

@media (max-width:767px){
  .ct-att{width:34px;height:34px}
  .att-menu,.att-menu.wide{width:100%}
  .att-grid{grid-template-columns:repeat(4,minmax(0,1fr));max-height:46vh}
  .att-chip{height:34px;max-width:160px}
  .att-th{width:28px;height:28px}
  .me-col{max-width:88%}
  .me-att .att-th{width:50px;height:50px}
}
@media (max-width:360px){.att-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
.ef-track{margin:0 5px 0 4px}
.ch-row .chat-tools{flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;padding:2px 2px 2px 0}
.ch-row .chat-tools::-webkit-scrollbar{display:none}
.ch-row .chat-tools>*{flex:none}
.ct-att em{top:-2px;right:-2px}
.ch-row .chat-tools{padding-top:3px;padding-bottom:3px}
