/* RASM رسم - design system. Dark plum and burgundy, frosted glass, thin magenta light. */
:root {
  --midnight: #111315; --burgundy: #1e1f22; --plum: #2b2c2f;
  --magenta: #e2e2e2; --pink: #f7f7f7; --purple: #f7f7f7;
  --ink: #f5f5f5; --ink-2: #d7d7d7; --muted: #a7a7a7; --faint: #7a7a7a;
  --glass: rgba(43,44,47,.38); --glass-2: rgba(30,31,34,.62); --glass-hi: rgba(247,247,247,.08);
  --line: rgba(226,226,226,.18); --line-2: rgba(226,226,226,.32);
  --grad: linear-gradient(135deg, var(--magenta), var(--pink) 55%, var(--purple));
  --r-s: 10px; --r: 14px; --r-l: 22px; --r-xl: 28px;
  --side: 284px; --read: 780px;
  --t: .18s cubic-bezier(.2, .7, .2, 1);
  --font: "Sora", "Segoe UI Variable Text", system-ui, -apple-system, "Noto Sans Arabic", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--midnight); color: var(--ink); font: 15px/1.6 var(--font);
  -webkit-font-smoothing: antialiased; }
body { overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; border-radius: 8px; }
* { scrollbar-width: thin; scrollbar-color: rgba(226,226,226,.45) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(226,226,226,.4); border-radius: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ambient background: soft plum light and two thin magenta lines - minimal, never busy */
.ambient { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  background: radial-gradient(1200px 700px at 85% 10%, rgba(43,44,47,.9), transparent 60%),
              radial-gradient(900px 600px at 10% 100%, rgba(30,31,34,.95), transparent 65%), var(--midnight); }
.ambient i { position: absolute; height: 1px; transform-origin: left center; opacity: .55;
  background: linear-gradient(90deg, transparent, rgba(226,226,226,.55), rgba(247,247,247,.25), transparent); }
.ambient i:nth-child(1) { left: 20%; top: 18%; width: 90%; transform: rotate(-9deg); }
.ambient i:nth-child(2) { left: -10%; top: 74%; width: 80%; transform: rotate(5deg); opacity: .3; }

.shell { position: relative; z-index: 1; height: 100dvh; display: flex; }

/* ---------------------------------------------------------------- sidebar */
.side { width: var(--side); flex: none; display: flex; flex-direction: column; gap: 12px; padding: 14px 12px;
  background: var(--glass-2); border-right: 1px solid var(--line); backdrop-filter: blur(22px) saturate(140%);
  transition: margin-left var(--t), transform var(--t); }
.shell.collapsed .side { margin-left: calc(-1 * var(--side)); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 6px; }
.brand img { flex: none; filter: drop-shadow(0 0 8px rgba(226,226,226,.45)); }
.brand .wordmark { width: 150px; height: auto; margin: -4px 0 0 -4px; }
.brand div { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.brand b { font-size: 17px; letter-spacing: .14em; }
.brand small { font-size: 11px; color: var(--muted); letter-spacing: .03em; white-space: nowrap; }
.brand b span { font-family: "Noto Sans Arabic", var(--font); letter-spacing: 0; margin-left: 6px; color: var(--pink); font-weight: 600; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; flex: none;
  border: 1px solid transparent; border-radius: var(--r-s); background: transparent; color: var(--ink-2); transition: background var(--t), color var(--t); }
.iconbtn:hover { background: var(--glass-hi); color: var(--ink); border-color: var(--line); }
.brand .iconbtn { margin-left: auto; }
.newchat { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; border-radius: var(--r);
  border: 1px solid var(--line-2); background: linear-gradient(135deg, rgba(226,226,226,.22), rgba(247,247,247,.14));
  color: var(--ink); font-weight: 600; font-size: 14px; transition: border-color var(--t), background var(--t); }
.newchat:hover { border-color: var(--pink); background: linear-gradient(135deg, rgba(226,226,226,.32), rgba(247,247,247,.2)); }
.newchat kbd { margin-left: auto; font: 11px var(--mono); color: var(--muted); }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(17,19,21,.5); color: var(--muted); }
.search input { flex: 1; min-width: 0; height: 36px; border: 0; outline: 0; background: transparent; font-size: 13.5px; }
.search input::placeholder { color: var(--faint); }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a.navbtn { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 0; border-radius: var(--r-s);
  background: transparent; color: var(--ink-2); font: inherit; font-weight: 500; font-size: 13.5px; text-decoration: none; cursor: pointer; }
.nav a.navbtn:hover { background: var(--glass-hi); color: var(--ink); }
.nav button { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 0; border-radius: var(--r-s);
  background: transparent; color: var(--ink-2); font-size: 13.5px; text-align: left; }
.nav button:hover:not(:disabled) { background: var(--glass-hi); color: var(--ink); }
.nav button:disabled { color: var(--faint); cursor: default; }
.nav button .tag { margin-left: auto; font: 10px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--faint);
  border: 1px solid rgba(167,167,167,.25); border-radius: 6px; padding: 1px 6px; }
.lists { flex: 1; min-height: 0; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.group { margin-top: 10px; }
.group h3 { margin: 0 0 4px; padding: 0 10px; font: 600 10.5px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.group h3 button { all: unset; cursor: pointer; }
.row { position: relative; display: flex; align-items: center; gap: 6px; padding: 7px 6px 7px 10px; border-radius: var(--r-s);
  font-size: 13.5px; color: var(--ink-2); cursor: pointer; }
.row:hover, .row.on { background: var(--glass-hi); color: var(--ink); }
.row.on { box-shadow: inset 2px 0 0 var(--pink); }
.row .t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .pin { color: var(--pink); flex: none; }
.row .more { opacity: 0; width: 28px; height: 28px; }
.row:hover .more, .row.on .more, .row .more[aria-expanded="true"], .row .more:focus-visible { opacity: 1; }
.empty-list { padding: 8px 10px; color: var(--faint); font-size: 13px; }
.sidefoot { display: flex; align-items: center; gap: 8px; padding: 10px 8px 2px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--muted); }
.dotok { width: 8px; height: 8px; border-radius: 50%; background: #d9d9d9; box-shadow: 0 0 8px rgba(217,217,217,.7); }
.dotoff { width: 8px; height: 8px; border-radius: 50%; background: #d9d9d9; }

/* menus and dialogs: frosted glass */
.menu { position: fixed; z-index: 60; min-width: 180px; padding: 6px; border-radius: var(--r); border: 1px solid var(--line-2);
  background: rgba(26,27,29,.92); backdrop-filter: blur(20px); box-shadow: 0 16px 40px rgba(0,0,0,.5); animation: rise .14s ease-out; }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: 8px;
  background: transparent; font-size: 13.5px; text-align: left; }
.menu button:hover, .menu button:focus-visible { background: var(--glass-hi); }
.menu .danger { color: #f7f7f7; }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } }
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(13,14,16,.6); backdrop-filter: blur(4px); animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.dialog { position: fixed; z-index: 70; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(440px, 92vw);
  padding: 20px; border-radius: var(--r-l); border: 1px solid var(--line-2); background: rgba(26,27,29,.95);
  backdrop-filter: blur(24px); box-shadow: 0 24px 60px rgba(0,0,0,.6); animation: rise .16s ease-out; }
.dialog h2 { margin: 0 0 6px; font-size: 16px; }
.dialog p { margin: 0 0 14px; color: var(--ink-2); font-size: 14px; }
.dialog input { width: 100%; height: 40px; padding: 0 12px; border-radius: var(--r-s); border: 1px solid var(--line-2);
  background: rgba(17,19,21,.7); outline: 0; }
.dialog input:focus { border-color: var(--pink); }
.dialog .btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.btn { padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; font-size: 13.5px; font-weight: 600; }
.btn:hover { background: var(--glass-hi); }
.btn.primary { border-color: transparent; background: var(--grad); color: #fff; }
.btn.danger { border-color: transparent; background: #bcbcbc; color: #fff; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 80; transform: translateX(-50%); padding: 9px 16px; border-radius: 999px;
  border: 1px solid var(--line-2); background: rgba(26,27,29,.95); font-size: 13px; animation: rise .15s ease-out; }

/* ---------------------------------------------------------------- main */
.main { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 8px; padding: 10px 16px; min-height: 56px; }
.top .title { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 600; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--glass); font-size: 13px; color: var(--ink-2); backdrop-filter: blur(12px); }
.shell:not(.collapsed) .top .opener { display: none; }

.scroller { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; }
.thread { width: min(var(--read), 100%); margin: 0 auto; padding: 8px 20px 40px; display: flex; flex-direction: column; gap: 22px; }
.msg { display: flex; flex-direction: column; gap: 6px; min-width: 0; animation: rise .2s ease-out; }
.msg .body, .md, .codeblock, .md-table { min-width: 0; max-width: 100%; }   /* wide tables and code scroll inside, never the page */
.top, .composer, .composer form, .box { min-width: 0; max-width: 100%; }
.msg.user { align-items: flex-end; }
.msg.user .body { max-width: 85%; padding: 11px 16px; border-radius: 20px 20px 6px 20px; white-space: pre-wrap; word-wrap: break-word;
  background: linear-gradient(135deg, rgba(226,226,226,.3), rgba(247,247,247,.22)); border: 1px solid var(--line-2); }
.msg.assistant .who { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.msg.assistant .who .av { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: var(--grad); color: #fff; font-size: 11px; }
.msg.assistant .body { word-wrap: break-word; }
.msg.error .body { color: #f7f7f7; padding: 10px 14px; border-radius: var(--r); border: 1px solid rgba(247,247,247,.35); background: rgba(78,78,78,.35); }
.meta { display: flex; align-items: center; gap: 2px; color: var(--faint); font-size: 12px; min-height: 28px; }
.meta time { padding: 0 6px; }
.msg .meta .act { opacity: .0; transition: opacity var(--t); }
.msg:hover .meta .act, .msg:focus-within .meta .act, .msg.last .meta .act { opacity: 1; }
.act { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent;
  color: var(--muted); font-size: 12px; }
.act:hover { color: var(--ink); background: var(--glass-hi); }
a.act { text-decoration: none; }
.edited { font-style: italic; }
.editbox { width: min(100%, 640px); display: flex; flex-direction: column; gap: 8px; }
.editbox textarea { width: 100%; min-height: 80px; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--pink);
  background: rgba(17,19,21,.7); outline: 0; resize: vertical; }
.editbox .btns { display: flex; justify-content: flex-end; gap: 8px; }
.typing { display: inline-flex; gap: 5px; padding: 8px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--pink); animation: blink 1.2s infinite both; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: none; } }

/* markdown */
.md > :first-child { margin-top: 0; } .md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 10px; }
.md h2, .md h3, .md h4, .md h5 { margin: 16px 0 8px; line-height: 1.3; }
.md h2 { font-size: 19px; } .md h3 { font-size: 17px; } .md h4, .md h5 { font-size: 15px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 22px; } .md li { margin: 3px 0; }
.md a { color: var(--pink); text-underline-offset: 3px; }
.md code { font: 13px var(--mono); padding: 2px 6px; border-radius: 6px; background: rgba(226,226,226,.12); }
.md blockquote { margin: 0 0 10px; padding: 4px 14px; border-left: 2px solid var(--pink); color: var(--ink-2); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.md-table { overflow-x: auto; margin: 0 0 12px; border: 1px solid var(--line); border-radius: var(--r-s); }
.md table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.md th, .md td { padding: 7px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.md th { background: var(--glass); font-weight: 600; }
.codeblock { margin: 0 0 12px; border-radius: var(--r); border: 1px solid var(--line); background: rgba(15,16,18,.82); overflow: hidden; }
.codehead { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px 14px; border-bottom: 1px solid var(--line);
  font: 12px var(--mono); color: var(--muted); }
.codehead .act { height: 26px; }
.codeblock pre { margin: 0; padding: 14px 16px; overflow-x: auto; font: 13px/1.55 var(--mono); }
.codeblock code { background: none; padding: 0; }
.tk-k { color: #f7f7f7; } .tk-s { color: #e9e9e9; } .tk-c { color: #7a7a7a; font-style: italic; } .tk-n { color: #f7f7f7; } .tk-f { color: #f7f7f7; }

/* welcome */
.welcome { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px; padding: 30px 20px; text-align: center; }
.welcome .hero { width: clamp(200px, 40vw, 320px); height: auto; margin-bottom: -6px; filter: drop-shadow(0 0 28px rgba(226,226,226,.35)); }
.welcome h1 { margin: 0; font-size: clamp(24px, 4vw, 32px); font-weight: 600; letter-spacing: -.01em; }
.welcome h1 span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: min(640px, 100%); }
.chip { padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line); background: var(--glass); text-align: left;
  font-size: 13.5px; color: var(--ink-2); backdrop-filter: blur(14px); transition: border-color var(--t), transform var(--t); }
.chip:hover { border-color: var(--line-2); color: var(--ink); transform: translateY(-1px); }
.chip b { display: block; color: var(--ink); font-size: 13.5px; margin-bottom: 2px; }

/* composer */
.composer { padding: 6px 20px 14px; }
.composer form { width: min(var(--read), 100%); margin: 0 auto; }
.slogan { text-align: center; font-size: 11.5px; color: var(--faint); letter-spacing: .06em; margin: 0 0 8px; }
/* Native classic chat bar: pill box + pink glow (matches rasm_app PAGE) */
.box { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 20px; border-radius: 999px;
  border: 1px solid rgba(247,247,247,.45); background: var(--glass); backdrop-filter: blur(22px) saturate(140%);
  box-shadow: 0 0 30px rgba(247,247,247,.2); transition: border-color var(--t), box-shadow var(--t); }
.box:focus-within { border-color: rgba(247,247,247,.6); box-shadow: 0 0 30px rgba(247,247,247,.28), 0 0 0 4px rgba(226,226,226,.08); }
.box textarea { flex: 1; min-width: 0; max-height: 220px; min-height: 24px; padding: 9px 0; border: 0; outline: 0; resize: none;
  background: transparent; line-height: 1.5; }
.box textarea::placeholder { color: var(--faint); }
.mic { width: 46px; height: 46px; flex: none; border-radius: 50%; border: 1px solid rgba(247,247,247,.45);
  background: transparent; color: var(--ink); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.mic.on { background: #bebebe; box-shadow: 0 0 20px rgba(247,247,247,.8); animation: micpulse 1s infinite; }
@keyframes micpulse { 50% { box-shadow: 0 0 6px rgba(247,247,247,.4); } }
.send { width: 46px; height: 46px; flex: none; border-radius: 50%; border: 0;
  background: linear-gradient(135deg, #d9d9d9, #e1e1e1); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 0 18px rgba(247,247,247,.55); transition: transform var(--t), opacity var(--t); }
.send:hover { transform: scale(1.05); } .send:disabled { opacity: .4; cursor: default; transform: none; }
.send.stop { background: var(--ink); color: var(--midnight); box-shadow: none; }
.hint { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; padding: 0 12px; font-size: 11.5px; color: var(--faint); }

/* ---------------------------------------------------------------- SOURA صورة */
.tool { display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; margin-left: -10px; flex: none;
  border-radius: 999px; border: 1px solid transparent; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600;
  letter-spacing: .06em; transition: color var(--t), background var(--t), border-color var(--t); }
.tool:hover { color: var(--ink); background: var(--glass-hi); }
.tool[aria-pressed="true"] { color: #fff; border-color: var(--line-2); background: linear-gradient(135deg, rgba(226,226,226,.35), rgba(247,247,247,.25));
  box-shadow: 0 0 18px rgba(226,226,226,.3); }
.box.soura { border-color: rgba(226,226,226,.65); box-shadow: 0 10px 40px rgba(17,19,21,.5), 0 0 26px rgba(226,226,226,.18); }
.soura-bar { margin: 0 0 8px; padding: 10px 12px; border-radius: var(--r-l); border: 1px solid var(--line-2); background: var(--glass-2);
  backdrop-filter: blur(22px) saturate(140%); display: flex; flex-direction: column; gap: 8px; animation: rise .16s ease-out; }
.soura-head { display: flex; align-items: center; gap: 10px; }
.soura-name { font-weight: 700; letter-spacing: .16em; font-size: 13px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.soura-name span { font-family: "Noto Sans Arabic", var(--font); letter-spacing: 0; margin-left: 4px; }
.soura-engine { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.soura-engine.warn { color: #f7f7f7; }
.soura-head .iconbtn { width: 30px; height: 30px; }
.soura-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; border: 1px solid var(--line); background: rgba(17,19,21,.5); }
.seg button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 0; border-radius: 999px; background: transparent;
  color: var(--muted); font-size: 12.5px; }
.seg button[aria-checked="true"] { background: linear-gradient(135deg, rgba(226,226,226,.4), rgba(247,247,247,.3)); color: #fff; }
.shape { display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; }
.shape.sq { width: 11px; height: 11px; } .shape.pt { width: 9px; height: 12px; } .shape.ls { width: 13px; height: 9px; }
.soura-pick select { height: 32px; padding: 0 28px 0 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(17,19,21,.7);
  color: var(--ink-2); font-size: 12.5px; outline: 0; }
.soura-pick select:focus { border-color: var(--pink); }
.pillbtn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--ink-2); font-size: 12.5px; }
.pillbtn:hover:not(:disabled) { border-color: var(--line-2); background: var(--glass-hi); color: var(--ink); }
.pillbtn:disabled { opacity: .45; cursor: default; }
.soura-src { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-2); }
.soura-src img { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line-2); }
.soura-src span { flex: 1; }
/* a picture in the chat */
.soura-card { width: min(100%, 520px); border-radius: var(--r-l); border: 1px solid var(--line-2); background: rgba(15,16,18,.7); overflow: hidden;
  box-shadow: 0 0 30px rgba(226,226,226,.12); }
.soura-card .frame { position: relative; display: grid; place-items: center; background: rgba(17,19,21,.6); }
.soura-card .frame img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.soura-card .cap { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 9px 14px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted); }
.soura-card .cap b { color: var(--ink-2); font-weight: 600; }
.soura-card .cap .tag { font: 600 10.5px var(--mono); letter-spacing: .12em; color: var(--pink); }
.soura-card .gone { padding: 36px 16px; text-align: center; color: var(--faint); font-size: 13px; }
.soura-card.working .frame { aspect-ratio: var(--ar, 1); }
.soura-wait { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px; text-align: center; font-size: 13px; color: var(--ink-2); }
.soura-wait .orb { width: 46px; height: 46px; border-radius: 50%; background: conic-gradient(from 0deg, var(--magenta), var(--purple), var(--pink), var(--magenta));
  -webkit-mask: radial-gradient(circle, transparent 55%, #000 57%); mask: radial-gradient(circle, transparent 55%, #000 57%); animation: spin 1.1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.soura-wait .bar { width: min(260px, 80%); height: 4px; border-radius: 4px; background: rgba(226,226,226,.15); overflow: hidden; }
.soura-wait .bar i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .3s; }
.soura-wait small { color: var(--faint); font-size: 11.5px; }
.lightbox { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px; background: rgba(13,14,16,.88);
  backdrop-filter: blur(6px); cursor: zoom-out; animation: fade .15s; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: var(--r); box-shadow: 0 0 60px rgba(226,226,226,.25); }
@media (max-width: 600px) { .tool span { display: none; } .tool { padding: 0 10px; } .seg button { padding: 5px 8px; } }

.tobottom { position: absolute; left: 50%; bottom: 130px; transform: translateX(-50%); z-index: 5; width: 36px; height: 36px;
  border-radius: 50%; border: 1px solid var(--line-2); background: rgba(26,27,29,.9); color: var(--ink); backdrop-filter: blur(12px); }

/* ---------------------------------------------------------------- tablet and phone */
@media (max-width: 900px) {
  .side { position: fixed; inset: 0 auto 0 0; z-index: 50; transform: translateX(-105%); margin-left: 0 !important; box-shadow: 20px 0 50px rgba(0,0,0,.5); }
  .shell.drawer .side { transform: none; }
  .top .opener { display: inline-flex !important; }
}
@media (max-width: 600px) {
  .thread { padding: 6px 14px 30px; } .composer { padding: 4px 10px 10px; }
  .chips { grid-template-columns: 1fr; } .chip:nth-child(n+3) { display: none; }
  .msg.user .body { max-width: 92%; } .hint span:last-child { display: none; }
  .model span.long { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
