﻿*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
:root{
  --sidebar-w:60px;
  --compiler-w:520px;
  --resizer-w:4px;
  --artifact-editor-size:52%;

  --bg:#0c120d;
  --sidebar:#101713;
  --surface:#18211b;
  --surface2:#1d2a22;
  --border:#284233;
  --border2:#355342;
  --text:#effcf3;
  --muted:#98b5a2;
  --accent:#22c55e;
  --accent2:#4ade80;
  --green:#22c55e;
  --red:#e05555;
  --blue:#5b8dd9;
  --accent-rgb:34,197,94;
  --accent-strong:rgba(var(--accent-rgb),.92);
  --accent-soft:rgba(var(--accent-rgb),.16);
  --accent-faint:rgba(var(--accent-rgb),.08);
  --accent-border:rgba(var(--accent-rgb),.38);
  --accent-glow:rgba(var(--accent-rgb),.24);
  --accent-ring:rgba(var(--accent-rgb),.52);
  --display-font:"Instrument Serif","Iowan Old Style","Palatino Linotype",serif;
  --ui-font:"Geist","Segoe UI",system-ui,sans-serif;
  --mono-font:"IBM Plex Mono","Cascadia Code","Consolas",monospace;
}
html,body{
  height:100%;
  background:
    radial-gradient(circle at top,rgba(var(--accent-rgb),.09),transparent 35%),
    linear-gradient(180deg,#101010 0%,#0d0d0d 100%);
  color:var(--text);
  font-family:var(--ui-font);
  overflow:hidden;
}
.app{display:flex;height:100vh;background:transparent;}

/* â”€â”€ SIDEBAR â”€â”€ */
.sidebar{
  width:var(--sidebar-w);
  background:rgba(15,15,15,.72);
  border-right:1px solid rgba(255,255,255,.06);
  display:flex;flex-direction:column;align-items:center;
  padding:10px 0;gap:2px;flex-shrink:0;
  z-index:40;
  backdrop-filter:blur(12px);
  box-shadow:inset -1px 0 0 rgba(255,255,255,.04);
  position:relative;
}
.sidebar::before{
  content:'';position:absolute;inset:0;
  background:linear-gradient(180deg,rgba(255,255,255,.02),transparent 26%,transparent);
  pointer-events:none;
}
.sb-top{display:flex;flex-direction:column;align-items:center;gap:2px;flex:1}
.sb-bot{display:flex;flex-direction:column;align-items:center;gap:6px;padding-bottom:10px}
.sb-divider{width:28px;height:1px;background:var(--border);margin:4px 0}
.sb-btn{
  width:38px;height:38px;border-radius:10px;border:none;
  background:transparent;color:var(--muted);cursor:pointer;
  display:flex;align-items:center;justify-content:center;
  transition:all .2s ease;position:relative;
}
.sb-btn:hover{
  background:var(--accent-faint);color:var(--text);
  transform:translateY(-2px);
  box-shadow:0 0 0 1px var(--accent-border),0 0 12px var(--accent-glow);
}
.sb-btn.active{background:var(--accent-soft);color:var(--text);box-shadow:inset 0 0 0 1px var(--accent-border);}
.sb-btn svg{width:18px;height:18px;stroke:currentColor;fill:none;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
.sb-btn[data-tip]::after{
  content:attr(data-tip);position:absolute;left:calc(100% + 10px);top:50%;transform:translateY(-50%);
  background:#111;color:var(--text);font-size:11px;font-family:sans-serif;padding:4px 9px;
  border-radius:6px;white-space:nowrap;pointer-events:none;opacity:0;transition:opacity .15s;
  border:1px solid var(--border);z-index:99;
}
.sb-btn[data-tip]:hover::after{opacity:1}
.avatar{
  width:30px;height:30px;border-radius:50%;background:var(--surface2);
  color:var(--muted);font-size:11px;font-family:sans-serif;font-weight:700;
  display:flex;align-items:center;justify-content:center;cursor:pointer;
  border:1px solid var(--border2);transition:all .2s ease;
}
.avatar:hover{border-color:var(--accent);}

/* â”€â”€ CHAT PANEL â”€â”€ */
.chat-panel{
  position:fixed;top:0;left:var(--sidebar-w);width:280px;height:100vh;
  background:rgba(18,18,18,.82);border-right:1px solid rgba(255,255,255,.05);
  transform:translateX(calc(-100% - var(--sidebar-w) - 20px));
  transition:transform .25s ease;z-index:25;display:flex;flex-direction:column;
  backdrop-filter:blur(12px);box-shadow:20px 0 50px rgba(0,0,0,.28);
}
.chat-panel.open{transform:translateX(0)}
.cp-header{display:flex;align-items:center;justify-content:space-between;padding:14px 14px 10px;border-bottom:1px solid rgba(255,255,255,.06)}
.cp-header h3{font-size:11px;font-family:sans-serif;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}
.cp-new{width:26px;height:26px;border-radius:6px;border:none;background:transparent;color:var(--muted);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s ease}
.cp-new:hover{background:var(--accent-faint);color:var(--text);}
.cp-new svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.cp-list{flex:1;overflow-y:auto;padding:8px}
.cp-list::-webkit-scrollbar{width:3px}
.cp-list::-webkit-scrollbar-thumb{background:var(--border2);border-radius:4px}
.chat-item{
  padding:10px 12px 10px 14px;border-radius:14px;font-size:12px;font-family:sans-serif;
  color:var(--muted);cursor:pointer;transition:all .2s ease;
  display:flex;align-items:center;justify-content:space-between;
  border-left:2px solid transparent;
}
.chat-item:hover{background:var(--accent-faint);color:var(--text);transform:translateY(-1px);}
.chat-item.active{background:rgba(255,255,255,.05);border-left-color:var(--accent);color:var(--text);}
.chat-item svg{width:12px;height:12px;flex-shrink:0;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.chat-item-main{display:flex;align-items:center;gap:8px;min-width:0;flex:1}
.chat-item-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.chat-menu-btn{width:28px;height:28px;border:none;border-radius:8px;background:transparent;color:var(--muted);cursor:pointer;display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;transition:all .2s ease}
.chat-menu-btn:hover{background:var(--accent-faint);color:var(--text);}
.chat-menu{position:absolute;right:8px;top:36px;min-width:172px;padding:6px;border-radius:14px;background:rgba(17,17,17,.96);border:1px solid rgba(255,255,255,.08);box-shadow:0 24px 54px rgba(0,0,0,.42);display:none;z-index:50}
.chat-menu.open{display:block}
.chat-menu-item{width:100%;display:flex;align-items:center;gap:8px;border:none;background:transparent;color:var(--text);border-radius:10px;padding:9px 10px;cursor:pointer;font:12px/1.2 sans-serif;text-align:left;transition:all .2s ease}
.chat-menu-item:hover{background:var(--accent-faint);}
.chat-menu-item.danger{color:#ff9e9e}
.chat-menu-item svg,.chat-menu-btn svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}

/* â”€â”€ SETTINGS PANEL â”€â”€ */
.settings-panel{
  position:fixed;top:0;left:var(--sidebar-w);width:320px;height:100vh;
  background:rgba(18,18,18,.82);border-right:1px solid rgba(255,255,255,.05);
  transform:translateX(calc(-100% - var(--sidebar-w) - 20px));
  transition:transform .25s ease;z-index:25;display:flex;flex-direction:column;overflow:hidden;
  backdrop-filter:blur(12px);box-shadow:20px 0 50px rgba(0,0,0,.28);
}
.settings-panel.open{transform:translateX(0)}
.sp-header{display:flex;align-items:center;justify-content:space-between;padding:14px 16px 10px;border-bottom:1px solid rgba(255,255,255,.06);flex-shrink:0}
.sp-header h3{font-size:11px;font-family:sans-serif;font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--muted)}
.sp-close{width:26px;height:26px;border-radius:6px;border:none;background:transparent;color:var(--muted);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s ease}
.sp-close:hover{background:var(--accent-faint);color:var(--text);}
.sp-close svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.sp-body{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:16px}
.sp-body::-webkit-scrollbar{width:3px}
.sp-body::-webkit-scrollbar-thumb{background:var(--border2);border-radius:4px}
.form-group{display:flex;flex-direction:column;gap:6px}
.form-label{font-size:11px;font-family:sans-serif;font-weight:600;color:var(--muted);text-transform:uppercase;letter-spacing:.06em}
.form-input{width:100%;background:rgba(255,255,255,.03);border:1px solid var(--border2);border-radius:8px;padding:9px 12px;font-size:13px;font-family:sans-serif;color:var(--text);outline:none;transition:border-color .15s}
.form-input:focus{border-color:var(--accent)}
.form-input::placeholder{color:var(--muted)}
.provider-presets{display:flex;flex-wrap:wrap;gap:6px}
.preset-btn{padding:5px 10px;border-radius:6px;border:1px solid var(--border2);background:transparent;color:var(--muted);font-size:11px;font-family:sans-serif;cursor:pointer;transition:all .2s ease}
.preset-btn:hover{background:var(--accent-faint);color:var(--text);border-color:var(--accent-border);}
.preset-btn.sel{background:var(--accent-soft);color:var(--text);border-color:var(--accent-border)}
.save-btn{width:100%;padding:10px;border-radius:14px;border:none;background:linear-gradient(180deg,color-mix(in srgb,var(--accent) 84%, white),var(--accent));color:#fff;font-size:13px;font-family:sans-serif;font-weight:600;cursor:pointer;transition:all .2s ease}
.save-btn:hover{filter:brightness(1.08);transform:translateY(-1px);}
.save-btn:active{transform:scale(.98)}
.status-bar{display:flex;align-items:center;gap:8px;padding:10px 12px;border-radius:8px;border:1px solid var(--border2);font-size:12px;font-family:sans-serif;display:none;background:rgba(255,255,255,.03)}
.s-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0}
.s-dot.ok{background:var(--green)}
.s-dot.err{background:var(--red)}
.s-dot.spin{background:#f0a030;animation:blink 1s infinite}
@keyframes blink{0%,100%{opacity:1}50%{opacity:.3}}
.settings-tabs{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:4px;border-radius:16px;background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.06)}
.settings-tab{border:none;padding:10px 12px;border-radius:12px;background:transparent;color:var(--muted);cursor:pointer;font:600 12px/1.1 sans-serif;transition:all .2s ease}
.settings-tab.active{color:var(--text);background:var(--accent-soft);box-shadow:inset 0 0 0 1px var(--accent-border)}
.settings-panel-body{display:none;flex-direction:column;gap:16px}
.settings-panel-body.active{display:flex}
.settings-section{padding-top:12px;border-top:1px solid rgba(255,255,255,.06)}
.toggle-row{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 12px;border-radius:12px;background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.06)}
.toggle-copy{display:flex;flex-direction:column;gap:3px}
.toggle-title{font-size:12px;color:var(--text)}
.toggle-sub{font-size:11px;color:var(--muted)}
.switch{position:relative;width:44px;height:24px;display:inline-flex;flex-shrink:0}
.switch input{opacity:0;width:0;height:0}
.switch-slider{position:absolute;inset:0;border-radius:999px;background:#2a2a2a;transition:.2s}
.switch-slider::before{content:'';position:absolute;width:18px;height:18px;left:3px;top:3px;border-radius:50%;background:#fff;transition:.2s}
.switch input:checked + .switch-slider{background:var(--accent-strong)}
.switch input:checked + .switch-slider::before{transform:translateX(20px)}
.bg-actions{display:flex;gap:8px;flex-wrap:wrap}
.bg-meta{font:12px/1.55 sans-serif;color:var(--muted);padding:10px 12px;border-radius:12px;background:rgba(255,255,255,.025);border:1px solid rgba(255,255,255,.06)}
.theme-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
.theme-btn{display:flex;align-items:center;gap:8px;padding:10px 12px;border-radius:12px;border:1px solid rgba(255,255,255,.08);background:rgba(255,255,255,.03);color:var(--text);cursor:pointer;transition:all .2s ease}
.theme-btn:hover{background:var(--accent-faint);border-color:var(--accent-border);}
.theme-btn.active{border-color:var(--accent-border);background:var(--accent-soft)}
.theme-swatch{width:18px;height:18px;border-radius:999px;flex-shrink:0;border:1px solid rgba(255,255,255,.18)}

/* â”€â”€ WORKSPACE â”€â”€ */
.workspace{flex:1;display:flex;overflow:hidden;position:relative;}
.main{
  flex:1;display:flex;flex-direction:column;
  overflow:hidden;position:relative;
}
.main::before{
  content:'';position:absolute;inset:0;
  background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.92' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E");
  pointer-events:none;opacity:.24;z-index:0;
}

/* Background media layer */
.bg-media-layer{position:absolute;inset:0;pointer-events:none;z-index:0;overflow:hidden;opacity:0;transition:opacity .35s ease,filter .35s ease}
.bg-media-layer.active{opacity:.38}
.bg-media-layer.blurred{filter:blur(10px) saturate(.92)}
.bg-media-layer img,.bg-media-layer video{width:100%;height:100%;object-fit:cover;transform:scale(1.04)}

/* FX grid */
.fx-grid{position:fixed;inset:0;pointer-events:none;z-index:1;}
.fx-grid::before{content:'';position:absolute;inset:0;background:linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);background-size:44px 44px;mask-image:radial-gradient(circle at center,rgba(0,0,0,.95),transparent 82%);opacity:.26;}
.fx-grid::after{content:'';position:absolute;inset:0;background:radial-gradient(circle at 52% 18%, rgba(var(--accent-rgb),.15), transparent 24%),radial-gradient(circle at 18% 82%, rgba(var(--accent-rgb),.09), transparent 20%),radial-gradient(circle at 80% 16%, rgba(255,255,255,.03), transparent 18%);filter:blur(28px);opacity:.9;}
.cursor-glow{position:absolute;width:340px;height:340px;left:0;top:0;margin-left:-170px;margin-top:-170px;border-radius:50%;pointer-events:none;z-index:0;opacity:.78;background:radial-gradient(circle, rgba(var(--accent-rgb),.16) 0%, rgba(var(--accent-rgb),.08) 24%, rgba(var(--accent-rgb),.035) 46%, rgba(var(--accent-rgb),0) 72%);filter:blur(18px);transform:translate3d(0,0,0);}

/* â”€â”€ TOPBAR â”€â”€ */
.topbar{
  position:relative;z-index:5;
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:16px 24px 12px;flex-shrink:0;
  background:linear-gradient(180deg,rgba(13,13,13,.95),rgba(13,13,13,.78),transparent);
}
.topbar-left,.topbar-right{display:flex;align-items:center;gap:10px}
.topbar-right{position:relative}
.brandmark{display:flex;align-items:center;gap:10px;min-width:0}
.brand-orb{width:32px;height:32px;border-radius:10px;display:grid;place-items:center;background:linear-gradient(180deg,rgba(var(--accent-rgb),.22),rgba(var(--accent-rgb),.08));border:1px solid var(--accent-border);color:#d5fce5;font-size:16px}
.brand-orb svg{width:70%;height:70%;display:block}
.brand-copy{display:flex;flex-direction:column;gap:2px}
.brand-title{font-family:var(--display-font);font-size:24px;line-height:1;color:#fff;letter-spacing:.02em}
.brand-sub{font-size:11px;text-transform:uppercase;letter-spacing:.12em;color:var(--accent);opacity:.78}
.topbar-btn{border:1px solid rgba(255,255,255,.06);background:rgba(255,255,255,.03);color:var(--muted);border-radius:14px;height:38px;padding:0 14px;display:flex;align-items:center;gap:8px;cursor:pointer;transition:all .2s ease}
.topbar-btn:hover{background:var(--accent-faint);color:var(--text);border-color:var(--accent-border);transform:translateY(-1px);}
.topbar-btn svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.topbar-btn.primary{background:linear-gradient(180deg,color-mix(in srgb,var(--accent) 84%, white),var(--accent));color:#fff;border-color:var(--accent-border)}
.topbar-btn.primary:hover{filter:brightness(1.08);}

/* â”€â”€ WELCOME SCREEN â”€â”€ */
.welcome{
  flex:1;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:16px;padding:0 24px 180px;
  position:relative;z-index:1;text-align:center;
  opacity:1;transform:none;pointer-events:auto;
  transition:opacity .4s ease,transform .4s ease;
}
.welcome.hidden{opacity:0;transform:translateY(-20px);pointer-events:none;position:absolute;inset:0;}
.hero-badge{display:inline-flex;align-items:center;gap:8px;padding:8px 12px;border-radius:999px;background:rgba(255,255,255,.04);border:1px solid var(--accent-border);font-size:12px;color:#cabeb2;}
.hero-badge-dot{color:var(--accent);font-size:16px;line-height:1}
.w-logo{width:72px;height:72px;border-radius:24px;display:grid;place-items:center;background:linear-gradient(180deg,rgba(var(--accent-rgb),.17),rgba(var(--accent-rgb),.07));border:1px solid var(--accent-border);font-size:28px;box-shadow:0 16px 42px rgba(0,0,0,.28),0 0 0 1px var(--accent-border),inset 0 1px 0 rgba(255,255,255,.04)}
.w-logo svg{width:56%;height:56%;display:block}
.w-title{font-family:var(--display-font);font-size:42px;font-weight:400;color:var(--text);letter-spacing:-.01em;line-height:1.04;margin-top:4px}
.w-sub{font-size:15px;color:var(--muted);font-family:var(--ui-font);max-width:520px;line-height:1.65;margin-top:2px}
.w-cta{padding:9px 20px;border-radius:10px;border:1px solid rgba(255,255,255,.08);background:rgba(255,255,255,.03);color:var(--muted);font-size:12px;font-family:sans-serif;cursor:pointer;transition:all .2s ease;display:flex;align-items:center;gap:8px;margin-top:2px}
.w-cta:hover{background:var(--accent-faint);color:var(--text);border-color:var(--accent-border);transform:translateY(-2px);}
.w-cta svg{width:13px;height:13px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.w-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:center}

/* â”€â”€ MESSAGES â”€â”€ */
.messages{
  flex:1;
  width:100%;max-width:860px;margin:0 auto;
  overflow-y:auto;
  padding:12px 24px 24px;
  display:flex;flex-direction:column;gap:22px;
  position:relative;z-index:1;
  scroll-behavior:smooth;
}
.messages::-webkit-scrollbar{width:4px}
.messages::-webkit-scrollbar-thumb{background:var(--accent);border-radius:4px}
.msg-group{display:flex;flex-direction:column;gap:8px;animation:msgIn .25s ease-out}
@keyframes msgIn{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:translateY(0)}}
.msg-user{display:flex;justify-content:flex-end}
.msg-user .msg-bubble{
  background:linear-gradient(180deg,rgba(var(--accent-rgb),.22),rgba(var(--accent-rgb),.13));
  border:1px solid rgba(var(--accent-rgb),.18);
  border-radius:20px;border-bottom-right-radius:8px;
  padding:14px 16px;font-size:14px;line-height:1.6;font-family:var(--ui-font);
  max-width:min(76%,640px);word-break:break-word;
  animation:replyFade .28s ease both;
}
.msg-ai{display:flex;flex-direction:column;gap:4px}
.msg-ai-header{display:flex;align-items:center;gap:7px;margin-bottom:2px}
.msg-ai-header .ast{color:var(--accent);font-size:16px;line-height:1;user-select:none}
.msg-ai-name{font-size:12px;font-family:var(--ui-font);color:#d9d9d9;font-weight:600;letter-spacing:.03em}
.msg-ai .msg-bubble{
  background:transparent;color:var(--text);padding:0 0 4px 24px;
  font-size:14px;line-height:1.75;font-family:var(--ui-font);max-width:100%;
  animation:replyFade .28s ease both;
}
@keyframes replyFade{from{opacity:0;filter:blur(2px)}to{opacity:1;filter:blur(0)}}
.msg-bubble p{margin-bottom:8px}
.msg-bubble p:last-child{margin-bottom:0}
.msg-bubble strong{color:#eee}
.msg-bubble em{color:#ccc;font-style:italic}
.msg-bubble h1,.msg-bubble h2,.msg-bubble h3{color:var(--text);font-family:var(--ui-font);font-weight:700;margin:10px 0 4px}
.msg-bubble h1{font-size:17px}.msg-bubble h2{font-size:15px}.msg-bubble h3{font-size:14px}
.msg-bubble ul,.msg-bubble ol{padding-left:20px;margin:6px 0}
.msg-bubble li{margin-bottom:3px;line-height:1.6}
.msg-bubble pre{background:#111;border:1px solid rgba(255,255,255,.08);border-radius:18px;padding:16px;margin:8px 0;overflow-x:auto;font-size:13px;position:relative}
.msg-bubble code{font-family:var(--mono-font);font-size:13px}
.msg-bubble :not(pre)>code{background:var(--surface);padding:1px 5px;border-radius:4px;font-size:12px}
.msg-bubble hr{border:none;border-top:1px solid var(--border);margin:10px 0}
.msg-bubble blockquote{border-left:3px solid var(--accent);padding-left:12px;color:var(--muted);margin:8px 0}
.code-block-wrap{position:relative;margin:8px 0}
.code-block-wrap pre{margin:0;padding-right:100px}
.code-block-actions{position:absolute;top:10px;right:10px;display:flex;gap:4px}
.cb-btn{font-size:10px;font-family:sans-serif;padding:5px 10px;border-radius:999px;border:1px solid rgba(255,255,255,.08);background:rgba(255,255,255,.06);color:var(--muted);cursor:pointer;transition:all .2s ease;white-space:nowrap}
.cb-btn:hover{background:var(--accent-faint);color:var(--text);border-color:var(--accent-border);}
.cb-btn.run{background:rgba(34,197,94,.9);color:#111;border-color:var(--accent)}
.cb-btn.run:hover{background:rgba(74,222,128,.9)}
.msg-actions{display:flex;align-items:center;gap:4px;padding-left:24px;opacity:0;transition:opacity .15s}
.msg-group:hover .msg-actions{opacity:1}
.act-btn{background:transparent;border:none;color:var(--muted);font-size:11px;font-family:sans-serif;cursor:pointer;padding:3px 7px;border-radius:5px;display:flex;align-items:center;gap:4px;transition:all .2s ease}
.act-btn:hover{background:var(--accent-faint);color:var(--text);}
.act-btn svg{width:12px;height:12px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.typing{display:flex;gap:4px;align-items:center;padding:6px 0}
.typing span{width:6px;height:6px;background:var(--accent);border-radius:50%;animation:d 1.2s infinite}
.typing span:nth-child(2){animation-delay:.2s}
.typing span:nth-child(3){animation-delay:.4s}
@keyframes d{0%,80%,100%{opacity:.3;transform:scale(.9)}40%{opacity:1;transform:scale(1.1)}}
.err-bubble{padding:10px 14px;border-radius:10px;background:#2a1515;border:1px solid #5a2a2a;color:#e07070;font-size:13px;font-family:sans-serif;max-width:92%}
.stream-cursor::after{content:'â–‹';display:inline-block;color:var(--accent);opacity:.9;animation:cur .6s steps(1) infinite;margin-left:1px;font-size:.85em;vertical-align:baseline}
@keyframes cur{0%,100%{opacity:.9}50%{opacity:0}}

/* â”€â”€ CHAT AREA â”€â”€ */
.home-area{flex:1;display:flex;flex-direction:column;overflow:hidden;}
.chat-area{flex:1;display:flex;flex-direction:column;overflow:hidden;display:none;}
.chat-area.visible{display:flex;}
.home-area.hidden{display:none;}

/* â”€â”€ INPUT BOX â”€â”€ */
.input-wrap{
  width:100%;max-width:860px;margin:0 auto;
  padding:8px 24px 16px;
  position:relative;z-index:6;flex-shrink:0;
}
.input-card{
  background:rgba(21,21,21,.84);
  border:1px solid rgba(255,255,255,.08);
  border-radius:28px;
  padding:16px 16px 12px;
  display:flex;flex-direction:column;gap:10px;
  box-shadow:0 20px 50px rgba(0,0,0,.35),inset 0 1px 0 rgba(255,255,255,.03);
  backdrop-filter:blur(18px);
  transition:border-color .2s,box-shadow .2s;
}
.input-card:focus-within{
  border-color:var(--accent-ring);
  box-shadow:0 20px 50px rgba(0,0,0,.35),inset 0 1px 0 rgba(255,255,255,.03),0 0 0 1px var(--accent-border),0 0 32px var(--accent-glow);
}
.input-card.shake{animation:shake .32s ease}
@keyframes shake{0%,100%{transform:translateX(0)}20%{transform:translateX(-6px)}40%{transform:translateX(6px)}60%{transform:translateX(-4px)}80%{transform:translateX(4px)}}
.input-ta{width:100%;background:transparent;border:none;outline:none;color:var(--text);font-family:var(--display-font);font-size:15px;line-height:1.6;resize:none;min-height:26px;max-height:168px;overflow-y:auto}
.input-ta::placeholder{color:var(--muted)}
.input-ta::-webkit-scrollbar{width:3px}
.input-ta::-webkit-scrollbar-thumb{background:var(--border2);border-radius:4px}
.input-foot{display:flex;align-items:center;justify-content:space-between}
.i-left{display:flex;gap:4px;align-items:center}
.i-right{display:flex;align-items:center;gap:8px;position:relative}
.icon-btn{width:40px;height:40px;border-radius:999px;border:1px solid rgba(255,255,255,.06);background:rgba(255,255,255,.04);color:var(--muted);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s ease}
.icon-btn:hover{background:var(--accent-faint);color:var(--text);border-color:var(--accent-border);}
.icon-btn svg{width:16px;height:16px;stroke:currentColor;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.m-pill{
  height:40px;padding:0 14px;border-radius:999px;
  background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.06);
  font-size:11px;font-family:sans-serif;color:var(--muted);cursor:pointer;
  display:flex;align-items:center;gap:5px;max-width:150px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  transition:all .2s ease;
}
.m-pill:hover{background:var(--accent-faint);color:var(--text);border-color:var(--accent-border);}
.m-dot{width:6px;height:6px;border-radius:50%;background:var(--accent);flex-shrink:0}
.m-dot.off{background:var(--red)}
.send-btn{width:40px;height:40px;border-radius:999px;border:none;background:linear-gradient(180deg,color-mix(in srgb,var(--accent) 88%, white),var(--accent));color:#fff;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s ease;flex-shrink:0}
.send-btn:hover:not(:disabled){filter:brightness(1.08);transform:translateY(-1px);}
.send-btn:active:not(:disabled){transform:scale(.97)}
.send-btn svg{width:15px;height:15px;stroke:#fff;fill:none;stroke-width:2.2;stroke-linecap:round;stroke-linejoin:round}
.attach-list{display:flex;flex-wrap:wrap;gap:8px;margin-top:2px}
.attach-chip{display:inline-flex;align-items:center;gap:8px;padding:6px 10px;border-radius:999px;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.08);font-size:11px;color:#d8d8d8}
.attach-chip button{border:none;background:transparent;color:var(--muted);cursor:pointer;font-size:13px;line-height:1}

/* Provider quick-pick row */
.provider-row{
  display:flex;flex-wrap:wrap;justify-content:center;gap:8px;
  padding:6px 24px 10px;
  position:relative;z-index:5;flex-shrink:0;
  transition:opacity .3s ease;
}
.provider-row.hidden{opacity:0;pointer-events:none;height:0;overflow:hidden;padding:0;}
.provider-btn{padding:8px 12px;border-radius:999px;border:1px solid rgba(255,255,255,.08);background:rgba(255,255,255,.025);color:var(--text);font-size:11px;cursor:pointer;transition:all .2s ease}
.provider-btn:hover{background:var(--accent-faint);border-color:var(--accent-border);transform:translateY(-1px);}

/* model picker */
.mpicker{position:absolute;bottom:calc(100% + 8px);right:0;background:rgba(17,17,17,.94);border:1px solid rgba(255,255,255,.08);border-radius:18px;padding:6px;min-width:210px;box-shadow:0 8px 32px rgba(0,0,0,.6);display:none;z-index:30;backdrop-filter:blur(12px);}
.mpicker.open{display:block}
.mp-sec{font-size:10px;color:var(--muted);text-transform:uppercase;letter-spacing:.08em;padding:6px 10px 3px;font-family:sans-serif}
.mp-item{padding:8px 10px;border-radius:6px;font-size:12px;font-family:sans-serif;color:var(--muted);cursor:pointer;transition:all .15s;display:flex;align-items:center;justify-content:space-between}
.mp-item:hover{background:var(--accent-faint);color:var(--text)}
.mp-item.cur{color:var(--text)}
.mp-ck{color:var(--accent)}

/* â”€â”€ RESIZER â”€â”€ */
.resizer{width:4px;background:var(--border);cursor:col-resize;flex-shrink:0;transition:background .15s;position:relative;z-index:10;display:none}
.resizer:hover,.resizer.dragging{background:var(--accent)}
.resizer.visible{display:block}

/* â”€â”€ COMPILER PANEL â”€â”€ */
.compiler-panel{
  width:var(--compiler-w);min-width:320px;max-width:72vw;
  background:linear-gradient(180deg,#171717 0%,#131313 100%);
  border-left:1px solid rgba(255,255,255,.06);
  display:flex;flex-direction:column;flex-shrink:0;
  transform:translateX(100%);
  transition:transform .3s ease;
  position:absolute;right:0;top:0;height:100%;z-index:12;
  box-shadow:-24px 0 60px rgba(0,0,0,.38);
}
.compiler-panel.open{transform:translateX(0);position:relative}
.cp2-header{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;padding:14px 14px 12px;border-bottom:1px solid rgba(255,255,255,.07);background:linear-gradient(180deg,rgba(255,255,255,.02),rgba(255,255,255,0));flex-shrink:0}
.cp2-titlewrap{display:flex;flex-direction:column;gap:8px;min-width:0;flex:1}
.cp2-kicker{font-size:10px;font-family:sans-serif;font-weight:700;color:#9e8f84;text-transform:uppercase;letter-spacing:.14em}
.cp2-title{font-size:17px;font-family:sans-serif;font-weight:600;color:#f1ece7;letter-spacing:-.02em}
.cp2-sub{font-size:12px;font-family:sans-serif;color:#8f8a84;line-height:1.45;max-width:290px}
.cp2-tabs{display:inline-flex;align-items:center;gap:6px;padding:4px;border-radius:999px;background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.06);width:max-content}
.cp2-tab{padding:7px 12px;font-size:11px;font-family:sans-serif;font-weight:600;color:var(--muted);cursor:pointer;border:none;background:transparent;border-radius:999px;transition:all .15s;white-space:nowrap;letter-spacing:.04em;text-transform:uppercase}
.cp2-tab:hover{color:var(--text)}
.cp2-tab.active{color:#f4eee8;background:var(--accent-soft);box-shadow:inset 0 0 0 1px var(--accent-border)}
.cp2-actions{display:flex;align-items:center;gap:6px;flex-shrink:0;padding-top:2px}
.cp2-btn{width:32px;height:32px;border-radius:10px;border:1px solid rgba(255,255,255,.06);background:rgba(255,255,255,.03);color:var(--muted);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s ease}
.cp2-btn:hover{background:var(--accent-faint);color:var(--text);border-color:var(--accent-border);}
.cp2-btn:active{transform:scale(.97)}
.cp2-btn svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.editor-pane{flex:1;display:flex;flex-direction:column;overflow:hidden;padding:14px;gap:12px}
.artifact-shell{flex:1;display:flex;flex-direction:column;gap:12px;min-height:0}
.editor-toolbar{display:flex;align-items:center;gap:8px;padding:10px 12px;border:1px solid rgba(255,255,255,.06);border-radius:16px;background:rgba(255,255,255,.025);backdrop-filter:blur(10px);flex-shrink:0}
.et-label{font-size:10px;font-family:sans-serif;color:#9b938b;text-transform:uppercase;letter-spacing:.1em;flex:1}
.et-lang{font-size:11px;font-family:sans-serif;background:rgba(255,255,255,.04);border:1px solid rgba(255,255,255,.08);color:var(--text);border-radius:999px;padding:7px 12px;cursor:pointer;outline:none}
.et-lang option{background:var(--sidebar)}
.run-btn{padding:8px 14px;border-radius:999px;border:none;background:linear-gradient(180deg,color-mix(in srgb,var(--accent) 84%, white),var(--accent));color:#fff;font-size:11px;font-family:sans-serif;font-weight:700;cursor:pointer;transition:all .2s ease;display:flex;align-items:center;gap:6px;letter-spacing:.05em;text-transform:uppercase;box-shadow:0 8px 18px rgba(var(--accent-rgb),.28)}
.run-btn:hover{filter:brightness(1.06);transform:translateY(-1px);}
.run-btn:active{transform:scale(.97)}
.run-btn svg{width:11px;height:11px;stroke:currentColor;fill:none;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}
.run-btn.running{background:linear-gradient(180deg,#e8b462,#d69a3a);color:#111;box-shadow:none}
.clear-btn{padding:7px 11px;border-radius:999px;border:1px solid rgba(255,255,255,.08);background:transparent;color:var(--muted);font-size:11px;font-family:sans-serif;cursor:pointer;transition:all .2s ease}
.clear-btn:hover{background:var(--accent-faint);color:var(--text);border-color:var(--accent-border);}
.artifact-grid{flex:1;display:flex;flex-direction:column;min-height:0;gap:10px}
.editor-card{flex:0 0 var(--artifact-editor-size,52%)}
.preview-card{flex:1 1 auto}
.artifact-resizer{position:relative;height:12px;cursor:row-resize;flex:0 0 12px}
.artifact-resizer::before{content:'';position:absolute;left:50%;top:50%;width:64px;height:4px;border-radius:999px;transform:translate(-50%,-50%);background:rgba(255,255,255,.14)}
.artifact-resizer:hover::before,.artifact-resizer.dragging::before{background:var(--accent-strong)}
.artifact-card{display:flex;flex-direction:column;min-height:0;border:1px solid rgba(255,255,255,.06);border-radius:20px;background:linear-gradient(180deg,rgba(255,255,255,.03),rgba(255,255,255,.015));overflow:hidden;box-shadow:inset 0 1px 0 rgba(255,255,255,.03)}
.artifact-card.preview-card{background:linear-gradient(180deg,#1d1d1d 0%,#181818 100%)}
.artifact-card-head{display:flex;align-items:center;gap:10px;padding:12px 14px;border-bottom:1px solid rgba(255,255,255,.06);flex-shrink:0}
.artifact-card-title{font-size:11px;font-family:sans-serif;font-weight:700;color:#f1ece7;letter-spacing:.08em;text-transform:uppercase}
.artifact-card-sub{font-size:11px;font-family:sans-serif;color:#8b8680;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.artifact-spacer{flex:1}
.artifact-badge{padding:4px 9px;border-radius:999px;background:var(--accent-soft);border:1px solid var(--accent-border);font-size:10px;font-family:sans-serif;color:var(--accent);letter-spacing:.06em;text-transform:uppercase}
.editor-area{flex:1;overflow:hidden;position:relative;min-height:0}
.code-editor{width:100%;height:100%;background:transparent;color:var(--text);border:none;outline:none;font-family:var(--mono-font);font-size:13px;line-height:1.65;padding:16px 18px;resize:none;tab-size:2;overflow:auto}
.code-editor::placeholder{color:#77716b}
.code-editor::-webkit-scrollbar{width:4px}
.code-editor::-webkit-scrollbar-thumb{background:var(--accent);border-radius:4px}
.output-pane{display:flex;flex-direction:column;flex-shrink:0;overflow:hidden;min-height:0;flex:1}
.output-header{display:flex;align-items:center;padding:12px 14px;border-bottom:1px solid rgba(255,255,255,.06);gap:8px;flex-shrink:0}
.out-label{font-size:10px;font-family:sans-serif;color:#9b938b;text-transform:uppercase;letter-spacing:.1em;flex:1}
.out-status{width:8px;height:8px;border-radius:50%;background:var(--muted);flex-shrink:0;transition:background .3s,box-shadow .3s}
.out-status.ok{background:var(--green);box-shadow:0 0 0 4px rgba(34,197,94,.14)}
.out-status.err{background:var(--red);box-shadow:0 0 0 4px rgba(224,85,85,.12)}
.out-status.run{background:#f0a030;animation:blink 1s infinite;box-shadow:0 0 0 4px rgba(240,160,48,.12)}
.out-type-btn{font-size:10px;font-family:sans-serif;padding:6px 10px;border-radius:999px;border:1px solid rgba(255,255,255,.08);background:transparent;color:var(--muted);cursor:pointer;transition:all .15s;text-transform:uppercase;letter-spacing:.06em}
.out-type-btn.active{background:var(--accent-soft);color:var(--text);border-color:var(--accent-border)}
.output-content{flex:1;overflow:auto;position:relative;min-height:0;background:#121212}
.output-content::-webkit-scrollbar{width:4px}
.output-content::-webkit-scrollbar-thumb{background:var(--accent);border-radius:4px}
.preview-frame{width:100%;height:100%;border:none;background:#fff}
.console-out{padding:14px 16px;font-family:var(--mono-font);font-size:12px;line-height:1.75;color:#aaa;white-space:pre-wrap;word-break:break-word;min-height:100%}
.console-line{display:flex;gap:8px;align-items:flex-start;padding:3px 0}
.console-line.log .cl-icon{color:#aaa}
.console-line.error .cl-icon{color:var(--red)}
.console-line.error .cl-text{color:#e07070}
.console-line.warn .cl-icon{color:#f0a030}
.console-line.warn .cl-text{color:#f0c060}
.console-line.info .cl-icon{color:var(--blue)}
.console-line.success .cl-text{color:var(--green)}
.cl-icon{font-size:11px;flex-shrink:0;padding-top:1px}
.cl-text{flex:1}
.history-pane{flex:1;display:flex;flex-direction:column;overflow:hidden;padding:14px;gap:12px}
.history-list{flex:1;overflow-y:auto;padding:4px}
.history-list::-webkit-scrollbar{width:3px}
.history-list::-webkit-scrollbar-thumb{background:var(--accent);border-radius:4px}
.history-item{padding:12px 13px;border-radius:14px;border:1px solid rgba(255,255,255,.06);margin-bottom:8px;cursor:pointer;transition:all .2s ease;background:rgba(255,255,255,.02)}
.history-item:hover{background:var(--accent-faint);border-color:var(--accent-border);transform:translateY(-1px)}
.history-item.active-item{border-color:var(--accent-border);box-shadow:inset 0 0 0 1px rgba(var(--accent-rgb),.18)}
.hi-top{display:flex;align-items:center;gap:8px;margin-bottom:4px}
.hi-lang{font-size:10px;font-family:sans-serif;background:var(--surface2);color:var(--muted);padding:2px 6px;border-radius:4px;text-transform:uppercase;letter-spacing:.04em}
.hi-time{font-size:10px;font-family:sans-serif;color:var(--muted);margin-left:auto}
.hi-status{width:6px;height:6px;border-radius:50%;flex-shrink:0}
.hi-status.ok{background:var(--green)}
.hi-status.err{background:var(--red)}
.hi-preview{font-family:var(--mono-font);font-size:11px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hi-meta{display:flex;align-items:center;gap:8px}
.hi-status-text{font-size:10px;text-transform:uppercase;letter-spacing:.08em;color:#b2a79f}
.hi-title{font-size:12px;color:#f4eee8;font-weight:600;margin-bottom:6px}
.hi-output{font-size:11px;color:#8c867f;line-height:1.5;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.compiler-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;padding:28px;text-align:center}
.ce-icon{color:#3e3a37;font-size:42px;line-height:1}
.ce-title{font-size:14px;color:#d2cbc4;font-family:sans-serif}
.ce-sub{font-size:12px;color:#7f7871;font-family:sans-serif;line-height:1.6;max-width:280px}

/* â”€â”€ TOAST â”€â”€ */
.toast{position:fixed;bottom:24px;right:24px;background:var(--surface2);border:1px solid var(--border2);border-radius:10px;padding:10px 16px;font-size:12px;font-family:sans-serif;color:var(--text);z-index:999;opacity:0;transform:translateY(10px);transition:opacity .25s,transform .25s;pointer-events:none;max-width:300px;display:flex;align-items:center;gap:8px}
.toast.show{opacity:1;transform:translateY(0)}
.toast.ok{border-color:var(--green)}
.toast.err{border-color:var(--red)}

/* â”€â”€ SNOW â”€â”€ */
.snow-layer{position:fixed;inset:0;pointer-events:none;z-index:2;overflow:hidden;display:none}
.snow-layer.active{display:block}
.snowflake{position:absolute;top:-20px;color:rgba(255,255,255,.75);font-size:var(--size,12px);animation:snowFall linear infinite}
@keyframes snowFall{from{transform:translate3d(var(--drift-start,0),-10vh,0);opacity:0}10%{opacity:.9}to{transform:translate3d(var(--drift-end,30px),110vh,0);opacity:0}}

/* CORS help */
#cors-help{display:none;font-size:12px;font-family:sans-serif;color:#ccc;background:#1a1a2a;border:1px solid #3a3a6a;border-radius:8px;padding:12px;line-height:1.6}

::-webkit-scrollbar{width:4px;height:4px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--accent);border-radius:4px}

@media (max-width:900px){
  .main{padding:0}
  .topbar{padding:14px 16px 12px}
  .brand-title{font-size:20px}
  .topbar-btn span.hide-sm{display:none}
  .input-wrap{padding:8px 14px 12px}
  .messages{padding:8px 14px 24px}
  .compiler-panel{min-width:0;max-width:none;width:min(100vw - var(--sidebar-w),680px)}
}

