:root {
  color-scheme: dark;
  --md-primary: #d7b9ff;
  --md-on-primary: #3e1d78;
  --md-primary-container: #56358b;
  --md-on-primary-container: #f2e6ff;
  --md-secondary: #d8c2ec;
  --md-on-secondary: #382b47;
  --md-secondary-container: #51425f;
  --md-on-secondary-container: #f1dffb;
  --md-tertiary: #ffb8c6;
  --md-surface: #121016;
  --md-surface-1: #1b181f;
  --md-surface-2: #211d26;
  --md-surface-3: #29232f;
  --md-on-surface: #eee7f0;
  --md-on-surface-variant: #cbc1ce;
  --md-outline: #968d9b;
  --md-outline-variant: #4b4550;
  --md-error: #ffb4ab;
  --md-success: #94d7a8;
  --md-shape-xs: 4px;
  --md-shape-s: 8px;
  --md-shape-m: 12px;
  --md-shape-l: 16px;
  --md-shape-xl: 28px;
  --md-shape-full: 999px;
  --md-elevation-1: 0 1px 2px #0007, 0 2px 6px #0004;
  --md-elevation-2: 0 4px 8px #0007, 0 12px 24px #0004;
  --md-focus: 0 0 0 3px #d7b9ff45;
  font-family: "Roboto Flex", "Roboto", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  background: var(--md-surface);
  color: var(--md-on-surface);
}
* { box-sizing: border-box; }
html { min-width: 320px; background: var(--md-surface); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 76% -6%, #4b2e6a66 0, transparent 32rem), radial-gradient(circle at 10% 80%, #21183855 0, transparent 28rem), var(--md-surface); }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .13; background-image: linear-gradient(#fff 1px, transparent 1px), linear-gradient(90deg, #fff 1px, transparent 1px); background-size: 64px 64px; mask-image: linear-gradient(to bottom, #000, transparent 70%); }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; border: 0; }
button:disabled { cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; box-shadow: var(--md-focus); }
a { color: inherit; text-decoration: none; }
code { color: var(--md-primary); font-size: .92em; }
.md-icon { display: inline-grid; place-items: center; width: 20px; height: 20px; flex: 0 0 20px; }
.md-icon svg { display: block; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.md-icon svg path { vector-effect: non-scaling-stroke; }
.brand { display: flex; min-width: 0; gap: 12px; align-items: center; }
.brand img { width: 42px; height: 42px; filter: drop-shadow(0 6px 12px #0005); }
.brand strong { display: block; color: var(--md-on-surface); font-size: 17px; font-weight: 700; letter-spacing: .1px; }
.brand small { display: block; margin-top: 3px; color: var(--md-on-surface-variant); font-size: 11px; letter-spacing: .2px; }
.app { min-height: 100vh; display: grid; grid-template-columns: 296px minmax(0, 1fr); }
.drawer { display: flex; flex-direction: column; gap: 18px; padding: 22px 14px 16px; background: color-mix(in srgb, var(--md-surface-1) 92%, var(--md-primary) 8%); border-right: 1px solid #332c39; }
.drawer-top { display: flex; align-items: center; justify-content: space-between; padding: 0 8px 10px 10px; }
.drawer-top > .icon-btn { color: var(--md-on-surface-variant); }
.nav-section { padding: 8px 16px 0; color: #a79caa; font-size: 10px; font-weight: 700; letter-spacing: 1.25px; text-transform: uppercase; }
.recent-label { margin-top: 4px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item, .chat-item { display: flex; width: 100%; min-height: 48px; align-items: center; gap: 14px; padding: 0 16px; border-radius: var(--md-shape-full); color: var(--md-on-surface-variant); background: transparent; text-align: left; transition: background .18s ease, color .18s ease, transform .18s ease; }
.nav-item:hover, .chat-item:hover { background: #3a3044; color: var(--md-on-surface); }
.nav-item.active { color: var(--md-on-secondary-container); background: var(--md-secondary-container); box-shadow: inset 0 0 0 1px #a78bbf26; }
.nav-item.active .md-icon { color: var(--md-primary); }
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; }
.chat-list { display: flex; max-height: 31vh; flex-direction: column; gap: 3px; overflow: auto; padding: 0 2px; }
.chat-item-row { display: flex; align-items: center; gap: 2px; border-radius: var(--md-shape-m); transition: background .18s ease, transform .18s ease; }
.chat-item-row:hover { background: #3a3044; transform: translateX(2px); }.chat-item-row .chat-item { flex: 1; }
.chat-delete { display: inline-grid; width: 32px; height: 32px; place-items: center; border-radius: 50%; color: #a79caa; background: transparent; opacity: 0; transition: opacity .18s ease, color .18s ease, transform .18s ease; }.chat-item-row:hover .chat-delete, .chat-delete:focus-visible { opacity: 1; }.chat-delete:hover { color: var(--md-error); transform: scale(1.08); }.chat-delete .md-icon, .chat-delete .md-icon svg { width: 15px; height: 15px; }
.chat-item { min-height: 40px; padding: 0 12px; border-radius: var(--md-shape-m); font-size: 13px; }
.chat-item .md-icon { width: 17px; height: 17px; flex-basis: 17px; color: #9b91a0; }
.chat-item .md-icon svg { width: 17px; height: 17px; }
.chat-item span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-item.active { color: var(--md-on-surface); background: #322b3b; }
.drawer-footer { display: grid; gap: 10px; margin-top: auto; }
.connection-card { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px solid #4b4054; border-radius: var(--md-shape-l); background: #251f2b; }
.connection-card > div { min-width: 0; flex: 1; }
.connection-card strong, .connection-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connection-card strong { font-size: 12px; }
.connection-card small { margin-top: 3px; color: var(--md-on-surface-variant); font-size: 10px; }
.connection-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 32px; border-radius: 11px; color: var(--md-primary); background: #50376e; }
.connection-icon .md-icon, .connection-icon .md-icon svg { width: 17px; height: 17px; }
.logout { justify-content: flex-start; gap: 10px; padding: 8px 12px; color: var(--md-on-surface-variant); }
.content { display: flex; min-width: 0; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 3; display: flex; min-height: 92px; align-items: center; justify-content: space-between; gap: 20px; padding: 18px clamp(20px, 4vw, 58px); border-bottom: 1px solid #2e2833; background: #121016d9; backdrop-filter: blur(24px); }
.topbar-leading { display: flex; min-width: 0; align-items: center; gap: 14px; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.topbar-leading > div:last-child { min-width: 0; }
.eyebrow { margin-bottom: 5px; color: #a99caf; font-size: 10px; font-weight: 750; letter-spacing: 1.45px; text-transform: uppercase; }
.topbar h1 { overflow: hidden; margin: 0; color: var(--md-on-surface); font-size: clamp(22px, 3vw, 30px); font-weight: 650; letter-spacing: -.7px; text-overflow: ellipsis; white-space: nowrap; }
.topbar p { overflow: hidden; max-width: 720px; margin: 5px 0 0; color: var(--md-on-surface-variant); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn, .text-btn { display: inline-flex; min-width: 40px; min-height: 40px; align-items: center; justify-content: center; padding: 9px; border-radius: var(--md-shape-full); color: var(--md-on-surface); background: transparent; transition: background .18s ease, transform .18s ease; }
.icon-btn:hover, .text-btn:hover { background: #3a3044; }
.topbar-action:hover { color: var(--md-primary); transform: rotate(18deg); }
.menu-btn { display: none; }
.main { display: flex; width: min(100%, 1120px); flex: 1; flex-direction: column; gap: 20px; margin: 0 auto; padding: clamp(22px, 4vw, 58px); }
.surface { border: 1px solid #3a3241; border-radius: var(--md-shape-xl); background: color-mix(in srgb, var(--md-surface-1) 94%, var(--md-primary) 6%); box-shadow: var(--md-elevation-2); }
.welcome { display: grid; min-height: 340px; grid-template-columns: minmax(0, 1fr) 250px; gap: 28px; overflow: hidden; padding: clamp(25px, 5vw, 56px); background: radial-gradient(circle at 92% 14%, #8058ad40 0, transparent 16rem), linear-gradient(135deg, #302244, #211b28 68%); }
.welcome-copy { display: grid; align-content: center; gap: 17px; }
.welcome h2 { max-width: 700px; margin: 0; color: #f5ebff; font-size: clamp(35px, 5vw, 58px); font-weight: 630; letter-spacing: -2.5px; line-height: 1.02; }
.welcome h2 em { color: var(--md-primary); font-style: normal; }
.welcome p { max-width: 650px; margin: 0; color: #d5c8dc; font-size: 14px; line-height: 1.7; }
.status { display: flex; align-items: center; gap: 8px; color: var(--md-on-surface-variant); font-size: 12px; }
.status-icon { display: inline-grid; place-items: center; width: 24px; height: 24px; color: var(--md-primary); border-radius: 8px; background: #533873; }
.status-icon .md-icon, .status-icon .md-icon svg { width: 14px; height: 14px; }
.dot { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--md-success); box-shadow: 0 0 12px #94d7a8; }
.dot.off { background: var(--md-error); box-shadow: none; }
.welcome-visual { position: relative; min-height: 230px; align-self: center; }
.visual-orbit { position: absolute; inset: 50% auto auto 50%; border: 1px solid #c19ae866; border-radius: 50%; transform: translate(-50%, -50%) rotate(-22deg); }
.orbit-one { width: 205px; height: 112px; }.orbit-two { width: 180px; height: 180px; transform: translate(-50%, -50%) rotate(35deg); border-color: #efb4ce55; }
.visual-core { position: absolute; top: 50%; left: 50%; display: grid; width: 76px; height: 76px; place-items: center; color: var(--md-on-primary); border: 8px solid #f0dfff33; border-radius: 30px; background: var(--md-primary); box-shadow: 0 14px 30px #10081c88; transform: translate(-50%, -50%); }
.visual-core .md-icon, .visual-core .md-icon svg { width: 31px; height: 31px; }
.visual-dot { position: absolute; width: 11px; height: 11px; border-radius: 50%; background: var(--md-tertiary); box-shadow: 0 0 18px #ffb8c6aa; }
.dot-a { top: 23%; left: 16%; }.dot-b { right: 11%; bottom: 20%; background: var(--md-primary); }.dot-c { right: 21%; top: 12%; width: 7px; height: 7px; background: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 9px; }
.chip { display: inline-flex; min-height: 38px; align-items: center; gap: 8px; padding: 0 14px; border: 1px solid #80689a66; border-radius: var(--md-shape-full); color: var(--md-on-primary-container); background: #4f3972; font-size: 13px; transition: background .18s ease, transform .18s ease; }
.chip .md-icon, .chip .md-icon svg { width: 16px; height: 16px; }
.chip:hover { background: #684b90; transform: translateY(-1px); }
.messages { display: flex; flex-direction: column; gap: 18px; padding: 0 4px 10px; }
.message { display: flex; align-items: flex-start; gap: 12px; animation: rise .28s cubic-bezier(.2,0,0,1); }.message.user { justify-content: flex-end; }.message-body { min-width: 0; max-width: min(82%, 780px); }.message-meta { display: flex; min-height: 22px; align-items: center; justify-content: space-between; gap: 12px; }.message-actions { display: flex; align-items: center; gap: 2px; opacity: 0; transform: translateY(3px); transition: opacity .18s ease, transform .18s ease; }.message:hover .message-actions, .message-actions:focus-within { opacity: 1; transform: none; }.message-action { display: inline-grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; color: var(--md-on-surface-variant); background: transparent; transition: color .18s ease, background .18s ease, transform .18s ease; }.message-action:hover { color: var(--md-primary); background: #3a3044; transform: scale(1.08); }.message-action.danger:hover { color: var(--md-error); }.message-action .md-icon, .message-action .md-icon svg { width: 16px; height: 16px; }
.bubble { padding: 15px 18px; border-radius: 19px; line-height: 1.65; overflow-wrap: anywhere; transition: background .2s ease, box-shadow .2s ease; }
.assistant .bubble { border-bottom-left-radius: var(--md-shape-s); background: var(--md-surface-2); }.user .bubble { border-bottom-right-radius: var(--md-shape-s); color: var(--md-on-primary-container); background: var(--md-primary-container); }
.bubble p, .bubble h1, .bubble h2, .bubble h3, .bubble ul, .bubble ol, .bubble blockquote, .bubble pre { margin: 0 0 10px; }.bubble > :last-child { margin-bottom: 0; }.bubble h1, .bubble h2, .bubble h3 { color: var(--md-primary); font-size: 1.05em; }.bubble ul, .bubble ol { padding-left: 22px; }.bubble li + li { margin-top: 4px; }.bubble strong { color: #fff7ff; font-weight: 750; }.bubble em { color: #f0dffb; }.bubble a { color: var(--md-primary); text-decoration: underline; text-underline-offset: 3px; }.bubble blockquote { padding: 8px 12px; border-left: 3px solid var(--md-primary); color: var(--md-on-surface-variant); background: #30283a; }.bubble code { padding: 2px 5px; border-radius: 6px; color: #f6d9ff; background: #100d14; font: .9em ui-monospace, SFMono-Regular, monospace; }.bubble .markdown-code { position: relative; padding: 30px 13px 12px; overflow: auto; border: 1px solid #473c50; border-radius: var(--md-shape-m); color: #e8dced; background: #100e13; font: 12px/1.6 ui-monospace, SFMono-Regular, monospace; white-space: pre; }.bubble .markdown-code code { padding: 0; color: inherit; background: transparent; }.code-language { position: absolute; top: 7px; right: 10px; color: #aa9caf; font: 10px/1.2 ui-sans-serif, system-ui; text-transform: uppercase; }
.avatar { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; border: 1px solid #886fa566; border-radius: 12px; color: var(--md-primary); background: #3a2b4e; font-weight: 750; }
.avatar-pulse { animation: md3-avatar-pulse 1.5s ease-in-out infinite; }.message-streaming .bubble { min-width: 190px; border: 1px solid #67537a; box-shadow: 0 0 0 1px #d7b9ff12, 0 12px 32px #120b1c55; animation: md3-stream-in .35s cubic-bezier(.2,0,0,1); }.message-streaming.message-has-content .bubble { min-width: 0; }.message-streaming.message-complete .bubble { animation: md3-answer-settle .35s cubic-bezier(.2,0,0,1); }.message-streaming.message-error .bubble { border-color: #895c63; }.typing-indicator { display: inline-flex; align-items: center; gap: 5px; color: var(--md-on-surface-variant); font-size: 12px; }.typing-indicator i { width: 6px; height: 6px; border-radius: 50%; background: var(--md-primary); animation: md3-typing 1.15s ease-in-out infinite; }.typing-indicator i:nth-of-type(2) { animation-delay: .15s; }.typing-indicator i:nth-of-type(3) { animation-delay: .3s; }
.meta { margin-top: 6px; color: var(--md-on-surface-variant); font-size: 11px; }
.composer-wrap { position: sticky; bottom: 14px; z-index: 2; padding-top: 10px; }
.composer { display: flex; min-height: 68px; align-items: flex-end; gap: 8px; padding: 10px 10px 10px 14px; border: 1px solid #6b5b75; border-radius: 25px; background: color-mix(in srgb, var(--md-surface-2) 94%, var(--md-primary) 6%); box-shadow: 0 12px 35px #0009; }
.mode-wrap { display: inline-flex; min-height: 44px; align-items: center; gap: 3px; padding: 0 7px 0 10px; border: 1px solid #4b4053; border-radius: var(--md-shape-full); color: var(--md-primary); background: #2a2331; }
.mode-wrap .md-icon, .mode-wrap .md-icon svg { width: 16px; height: 16px; }.mode-wrap .md-icon:last-child { color: var(--md-on-surface-variant); }
.mode-wrap select { width: 92px; min-height: 42px; padding: 0 2px; border: 0; color: var(--md-on-surface); background: transparent; outline: 0; appearance: none; }
.composer textarea { min-height: 44px; max-height: 180px; flex: 1; resize: none; padding: 12px 8px; border: 0; outline: 0; color: var(--md-on-surface); background: transparent; }
.composer-stop { color: var(--md-on-surface-variant); }.composer-stop:disabled { opacity: .35; }
.send { display: inline-grid; width: 48px; height: 48px; flex: 0 0 48px; place-items: center; border-radius: 50%; color: var(--md-on-primary); background: var(--md-primary); transition: transform .2s ease, box-shadow .2s ease; }
.send .md-icon, .send .md-icon svg { width: 22px; height: 22px; }.send:hover { box-shadow: 0 5px 18px #d7b9ff55; transform: scale(1.06) rotate(-8deg); }.send:disabled { opacity: .45; }
.composer-footer { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px 0; }.secure-note { display: inline-flex; align-items: center; gap: 5px; color: #9f93a8; font-size: 10px; }.secure-note .md-icon, .secure-note .md-icon svg { width: 13px; height: 13px; }
.primary, .tonal { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px; border-radius: var(--md-shape-full); padding: 0 18px; font-weight: 700; transition: background .18s ease, box-shadow .18s ease, transform .18s ease; }
.primary { color: var(--md-on-primary); background: var(--md-primary); }.primary:hover { background: #e7d4ff; box-shadow: 0 5px 18px #d7b9ff33; transform: translateY(-1px); }.tonal { color: var(--md-on-secondary-container); background: var(--md-secondary-container); }.tonal:hover { background: #675572; transform: translateY(-1px); }
.new-chat { width: 100%; min-height: 50px; justify-content: flex-start; padding-left: 18px; }.new-chat .md-icon { color: var(--md-on-primary); }.danger { color: var(--md-error); }
.panel { display: grid; gap: 18px; padding: clamp(22px, 4vw, 32px); }.panel h2 { margin: 0; color: var(--md-on-surface); font-size: 26px; letter-spacing: -.7px; }.panel > .meta { max-width: 760px; margin: -7px 0 0; line-height: 1.6; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 12px; }.stat { min-width: 0; padding: 16px; border: 1px solid #3e3646; border-radius: var(--md-shape-l); background: var(--md-surface-2); }.stat b { display: block; margin-top: 7px; color: var(--md-on-surface); font-size: 24px; }.stat b.model-name { overflow-wrap: anywhere; font-size: 12px; line-height: 1.35; }.stat span { color: var(--md-on-surface-variant); font-size: 12px; }
.field { display: grid; gap: 9px; }.field label { color: var(--md-on-surface-variant); font-size: 13px; font-weight: 550; }
input, select, .field textarea { width: 100%; min-height: 48px; padding: 12px 15px; border: 1px solid #62586a; border-radius: var(--md-shape-m); color: var(--md-on-surface); background: var(--md-surface-2); outline: 0; }
select { color-scheme: dark; }
select option, select optgroup { color: var(--md-on-surface); background: var(--md-surface-2); }
input:hover, select:hover, .field textarea:hover { border-color: #a795b2; }input:focus, select:focus, .field textarea:focus { border-color: var(--md-primary); box-shadow: var(--md-focus); }.field textarea { min-height: 110px; resize: vertical; }.check { display: flex; align-items: center; gap: 10px; padding: 8px 2px; }.check input { width: 18px; min-height: 18px; accent-color: var(--md-primary); }
.studio { display: grid; min-height: 60vh; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; }.filetree { padding: 14px; }.file { padding: 11px 12px; border-radius: var(--md-shape-m); color: var(--md-on-surface-variant); cursor: pointer; }.file:hover, .file.active { color: var(--md-on-surface); background: var(--md-secondary-container); }.editor { min-height: 420px; padding: 16px; overflow: auto; border: 1px solid #38303e; border-radius: var(--md-shape-l); color: #d9cde1; background: #100e13; font: 13px/1.6 ui-monospace, SFMono-Regular, monospace; white-space: pre; }
.image-progress { display: grid; gap: 17px; padding: 18px; border: 1px solid #574967; border-radius: var(--md-shape-l); background: linear-gradient(135deg, #30263a, #211c27); box-shadow: var(--md-elevation-1); animation: md3-container-in .35s cubic-bezier(.2,0,0,1); }.image-progress[data-status="complete"] { border-color: #628c70; }.image-progress[data-status="error"] { border-color: #8e5f62; }.image-progress-head { display: flex; align-items: center; gap: 12px; }.image-progress-head > div:nth-child(2) { min-width: 0; flex: 1; }.image-progress-head strong, .image-progress-head span { display: block; }.image-progress-head strong { color: var(--md-on-surface); font-size: 14px; }.image-progress-head span { margin-top: 4px; color: var(--md-on-surface-variant); font-size: 11px; line-height: 1.45; }.image-progress-head .text-btn { min-height: 34px; padding: 0 10px; color: var(--md-on-surface-variant); font-size: 11px; }.progress-orb { display: grid; width: 42px; height: 42px; flex: 0 0 42px; place-items: center; border: 5px solid #f2ddff55; border-radius: 15px; color: var(--md-on-primary); background: var(--md-primary); box-shadow: 0 7px 18px #08050e66; animation: md3-orb-breathe 1.8s ease-in-out infinite; }.progress-orb .md-icon, .progress-orb .md-icon svg { width: 19px; height: 19px; }.linear-progress { position: relative; height: 6px; overflow: hidden; border-radius: var(--md-shape-full); background: #41354d; }.linear-progress::after { position: absolute; inset: 0 auto 0 -35%; width: 35%; content: ""; background: linear-gradient(90deg, transparent, #fff9, transparent); animation: md3-progress-shimmer 1.35s ease-in-out infinite; }.linear-progress > span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--md-primary), #f1b6d0); transition: width .55s cubic-bezier(.2,0,0,1); }.generation-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }.generation-step { display: flex; min-width: 0; align-items: center; gap: 7px; color: #918696; font-size: 10px; transition: color .25s ease, transform .25s ease; }.generation-step i { display: block; width: 9px; height: 9px; flex: 0 0 9px; border: 2px solid #71637a; border-radius: 50%; transition: border-color .25s ease, background .25s ease, box-shadow .25s ease; }.generation-step span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.generation-step.active { color: var(--md-primary); transform: translateY(-1px); }.generation-step.active i { border-color: var(--md-primary); box-shadow: 0 0 0 4px #d7b9ff22; animation: md3-step-pulse 1.2s ease-in-out infinite; }.generation-step.done { color: var(--md-success); }.generation-step.done i { border-color: var(--md-success); background: var(--md-success); box-shadow: 0 0 10px #94d7a855; }.generation-step.error { color: var(--md-error); }.generation-step.error i { border-color: var(--md-error); }.image-result-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }.image-result-card { display: block; overflow: hidden; border: 1px solid #514759; border-radius: var(--md-shape-l); background: #0e0c11; box-shadow: var(--md-elevation-1); animation: md3-result-in .45s cubic-bezier(.2,0,0,1) both; transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }.image-result-card:hover { border-color: var(--md-primary); box-shadow: 0 10px 28px #0008; transform: translateY(-3px); }.image-result-card img { display: block; width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }.image-result-card > span { display: flex; align-items: center; gap: 6px; padding: 9px 11px; color: var(--md-on-surface-variant); font-size: 11px; }.image-result-card .md-icon, .image-result-card .md-icon svg { width: 14px; height: 14px; }.generation-error { display: grid; gap: 5px; margin-top: 18px; padding: 14px 16px; border: 1px solid #895c63; border-radius: var(--md-shape-m); color: var(--md-error); background: #3c2933; animation: md3-container-in .3s cubic-bezier(.2,0,0,1); }.generation-error span { color: #e7cbd0; font-size: 12px; line-height: 1.45; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 5; max-width: min(420px, calc(100vw - 40px)); padding: 14px 18px; border: 1px solid #655571; border-radius: var(--md-shape-m); color: var(--md-on-surface); background: #3a3043; box-shadow: var(--md-elevation-2); }.auth { display: grid; min-height: 100vh; place-items: center; padding: 20px; }.auth-card { display: grid; width: min(100%, 460px); gap: 18px; padding: 36px; }.auth-card h1 { margin: 0; font-size: 30px; letter-spacing: -.8px; }.auth-card p { margin: 0; color: var(--md-on-surface-variant); line-height: 1.55; }.local-badge { display: inline-flex; width: fit-content; align-items: center; gap: 7px; padding: 7px 11px; border: 1px solid #6c5982; border-radius: var(--md-shape-full); color: var(--md-primary); background: #352648; font-size: 11px; font-weight: 700; }.local-badge .md-icon, .local-badge .md-icon svg { width: 14px; height: 14px; }.auth-switch { color: var(--md-primary); font-size: 13px; text-align: center; text-decoration: none; }.auth-switch:hover { text-decoration: underline; }.hidden { display: none !important; }
.monitor-shell { min-height: 100vh; background: radial-gradient(circle at 12% 5%, #3a2852 0, transparent 28rem), var(--md-surface); }.monitor { width: min(1180px, 100%); margin: 0 auto; padding: clamp(24px, 5vw, 64px); }.monitor-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }.monitor-top h1 { margin: 0; color: var(--md-on-surface); font-size: clamp(32px, 6vw, 58px); letter-spacing: -2px; }.monitor-top p { margin: 9px 0 0; color: var(--md-on-surface-variant); }.monitor-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }.monitor-actions a { text-decoration: none; }.monitor-live { display: inline-flex; align-items: center; gap: 7px; padding: 10px 13px; border: 1px solid #51465b; border-radius: var(--md-shape-full); color: var(--md-on-surface-variant); font-size: 11px; }.monitor-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--md-success); box-shadow: 0 0 12px #94d7a8; }.monitor-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 13px; }.monitor-card { min-width: 0; min-height: 118px; padding: 18px; border: 1px solid #3f3548; border-radius: var(--md-shape-l); background: #201b27e8; box-shadow: var(--md-elevation-1); }.monitor-card strong { display: block; margin-top: 14px; overflow-wrap: anywhere; color: var(--md-on-surface); font-size: 23px; letter-spacing: -.4px; }.monitor-card small { display: block; margin-top: 7px; overflow-wrap: anywhere; color: var(--md-on-surface-variant); font-size: 11px; line-height: 1.45; }.monitor-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--md-on-surface-variant); font-size: 12px; }.monitor-status { padding: 4px 7px; border-radius: var(--md-shape-full); color: #241b2d; background: var(--md-success); font-size: 9px; font-weight: 800; text-transform: uppercase; }.monitor-status.warning { color: #302212; background: #f1c888; }.monitor-lower { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 14px; margin-top: 14px; }.monitor-panel { min-width: 0; padding: 22px; }.monitor-panel h2 { margin: 0; font-size: 21px; }.monitor-panel-head { display: flex; justify-content: space-between; gap: 18px; }.monitor-panel-head p { margin: 5px 0 0; color: var(--md-on-surface-variant); font-size: 12px; }.event-list { display: grid; gap: 2px; margin-top: 18px; }.event-row, .monitor-kv { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid #342c3a; font-size: 12px; }.event-row span, .monitor-kv span { color: var(--md-on-surface-variant); }.event-row b, .monitor-kv b { overflow-wrap: anywhere; color: var(--md-on-surface); text-align: right; }.path-value { font-size: 10px; font-weight: 500; }.monitor-panel > .text-btn { margin-top: 14px; justify-content: flex-start; padding-left: 0; color: var(--md-error); }
@keyframes rise { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }@keyframes md3-container-in { from { opacity: 0; transform: translateY(8px) scale(.985); } to { opacity: 1; transform: none; } }@keyframes md3-result-in { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }@keyframes md3-orb-breathe { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.06) rotate(5deg); } }@keyframes md3-step-pulse { 0%, 100% { box-shadow: 0 0 0 3px #d7b9ff1a; } 50% { box-shadow: 0 0 0 7px #d7b9ff00; } }@keyframes md3-progress-shimmer { from { transform: translateX(0); } to { transform: translateX(390%); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
body.ios-shell { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); background: #121016; }body.ios-shell .app { display: block; min-height: 100svh; }body.ios-shell .drawer { display: none; }body.ios-shell .content { min-height: 100svh; }body.ios-shell .topbar { min-height: 76px; padding: calc(14px + env(safe-area-inset-top)) 18px 14px; }body.ios-shell .topbar h1 { font-size: 21px; }body.ios-shell .topbar p { font-size: 12px; }body.ios-shell .topbar .menu-btn { display: none; }body.ios-shell .topbar-action { min-width: 36px; min-height: 36px; }body.ios-shell .main { width: 100%; padding: 18px 14px calc(112px + env(safe-area-inset-bottom)); }body.ios-shell .welcome { grid-template-columns: 1fr; min-height: 0; padding: 25px 20px 20px; border-radius: 25px; }body.ios-shell .welcome h2 { font-size: 36px; }body.ios-shell .welcome-visual { min-height: 110px; }body.ios-shell .welcome-visual .orbit-one { width: 160px; height: 80px; }body.ios-shell .welcome-visual .orbit-two { width: 130px; height: 130px; }body.ios-shell .visual-core { width: 58px; height: 58px; border-width: 6px; border-radius: 22px; }body.ios-shell .visual-core .md-icon, body.ios-shell .visual-core .md-icon svg { width: 24px; height: 24px; }body.ios-shell .bubble { max-width: 92%; font-size: 15px; }body.ios-shell .composer-wrap { bottom: calc(76px + env(safe-area-inset-bottom)); }body.ios-shell .composer { min-height: 62px; border-radius: 24px; padding: 8px; }body.ios-shell .mode-wrap { padding-left: 7px; }body.ios-shell .mode-wrap select { width: 72px; }body.ios-shell .composer-footer { padding-left: 4px; padding-right: 4px; }
body.ios-shell .bottom-tabs { position: fixed; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); left: 12px; z-index: 4; display: flex; align-items: center; justify-content: space-around; padding: 7px; border: 1px solid #594d66; border-radius: 25px; background: #2a2332e8; box-shadow: var(--md-elevation-2); backdrop-filter: blur(20px); }body.ios-shell .bottom-tabs button { display: flex; min-width: 54px; min-height: 50px; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 6px 8px; border-radius: 18px; color: #d8ccdf; background: transparent; }body.ios-shell .bottom-tabs button .md-icon, body.ios-shell .bottom-tabs button .md-icon svg { width: 20px; height: 20px; }body.ios-shell .bottom-tabs button small { font-size: 10px; }body.ios-shell .bottom-tabs button.active { color: #211a2f; background: var(--md-primary); }
@media (max-width: 900px) { .app { grid-template-columns: 260px minmax(0, 1fr); }.welcome { grid-template-columns: minmax(0, 1fr) 180px; }.welcome-visual { transform: scale(.85); transform-origin: center; } }
@media (max-width: 760px) { .app { grid-template-columns: 1fr; }.drawer { position: fixed; inset: 0 auto 0 0; z-index: 5; width: min(86vw, 310px); transform: translateX(-102%); transition: transform .25s ease; box-shadow: 14px 0 40px #000b; }.drawer.open { transform: none; }.menu-btn { display: inline-flex; }.topbar { min-height: 82px; padding: 15px 18px; }.topbar p { max-width: 58vw; }.main { padding: 18px; }.welcome { grid-template-columns: 1fr; }.welcome-visual { min-height: 160px; }.studio { grid-template-columns: 1fr; }.filetree { max-height: 150px; overflow: auto; }.bubble { max-width: 90%; }.composer { gap: 4px; }.mode-wrap { gap: 0; padding-left: 7px; }.mode-wrap select { width: 70px; font-size: 12px; }.composer textarea { min-width: 0; }.composer-footer .meta { max-width: 65%; } }
@media (max-width: 760px) { .message-actions { opacity: 1; transform: none; }.message-body { max-width: 90%; }.chat-delete { opacity: 1; } }
@media (max-width: 480px) { .topbar-action { min-width: 36px; }.eyebrow { font-size: 9px; }.welcome h2 { font-size: 40px; }.welcome-visual { min-height: 130px; }.welcome p { font-size: 13px; }.chip { width: 100%; justify-content: flex-start; }.composer-stop { display: none; }.secure-note { display: none; } }
@media (max-width: 760px) { .monitor { padding: 24px 18px 42px; }.monitor-top { align-items: flex-start; flex-direction: column; }.monitor-actions { justify-content: flex-start; }.monitor-lower { grid-template-columns: 1fr; } }
.retry-image { width: fit-content; min-height: 38px; padding: 0 14px; font-size: 12px; }
.install-link { justify-content: flex-start; gap: 10px; padding: 8px 12px; color: var(--md-primary); }
.message-body { min-width: 0; max-width: min(82%, 780px); }.message-meta { display: flex; min-height: 22px; align-items: center; justify-content: space-between; gap: 12px; }.message-actions { display: flex; align-items: center; gap: 2px; opacity: 0; transform: translateY(3px); transition: opacity .18s ease, transform .18s ease; }.message:hover .message-actions, .message-actions:focus-within { opacity: 1; transform: none; }.message-action { display: inline-grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; color: var(--md-on-surface-variant); background: transparent; transition: color .18s ease, background .18s ease, transform .18s ease; }.message-action:hover { color: var(--md-primary); background: #3a3044; transform: scale(1.08); }.message-action.danger:hover { color: var(--md-error); }.message-action .md-icon, .message-action .md-icon svg { width: 16px; height: 16px; }.avatar-pulse { animation: md3-avatar-pulse 1.5s ease-in-out infinite; }.message-streaming .bubble { min-width: 190px; border: 1px solid #67537a; box-shadow: 0 0 0 1px #d7b9ff12, 0 12px 32px #120b1c55; animation: md3-stream-in .35s cubic-bezier(.2,0,0,1); }.message-streaming.message-has-content .bubble { min-width: 0; }.message-streaming.message-complete .bubble { animation: md3-answer-settle .35s cubic-bezier(.2,0,0,1); }.message-streaming.message-error .bubble { border-color: #895c63; }.typing-indicator { display: inline-flex; align-items: center; gap: 5px; color: var(--md-on-surface-variant); font-size: 12px; }.typing-indicator i { width: 6px; height: 6px; border-radius: 50%; background: var(--md-primary); animation: md3-typing 1.15s ease-in-out infinite; }.typing-indicator i:nth-of-type(2) { animation-delay: .15s; }.typing-indicator i:nth-of-type(3) { animation-delay: .3s; }
@keyframes md3-avatar-pulse { 0%, 100% { box-shadow: 0 0 0 0 #d7b9ff00; transform: scale(1); } 50% { box-shadow: 0 0 0 7px #d7b9ff18; transform: scale(1.04); } }@keyframes md3-stream-in { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }@keyframes md3-answer-settle { from { box-shadow: 0 0 0 4px #d7b9ff33; } to { box-shadow: 0 0 0 0 #d7b9ff00; } }@keyframes md3-typing { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-4px); } }

/* MD3 interaction and responsive polish */
html { scroll-behavior: smooth; scrollbar-color: #625371 #18141d; }
button, .primary, .tonal, .chip { position: relative; overflow: hidden; -webkit-tap-highlight-color: transparent; }
.md-ripple { position: absolute; z-index: 0; pointer-events: none; border-radius: 50%; background: currentColor; opacity: .16; transform: scale(0); animation: md3-ripple .55s ease-out forwards; }
button > *, .primary > *, .tonal > *, .chip > * { position: relative; z-index: 1; }
.content, .panel, .welcome, .auth-card { animation: md3-page-in .38s cubic-bezier(.2,0,0,1) both; }
.chat-main { padding-bottom: 24px; }
.chat-main .messages { flex: 1; }
.messages:not(:empty) { min-height: min(52vh, 620px); justify-content: flex-end; padding-top: 8px; }
.message.user .message-body { display: grid; justify-items: end; }
.message.user .message-meta { width: 100%; }
.message-meta .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-action:active, .send:active, .chip:active { transform: scale(.94); }
.composer:focus-within { border-color: #a987cf; box-shadow: 0 14px 42px #000a, 0 0 0 3px #d7b9ff19; }
.composer textarea { overflow-y: auto; transition: height .16s cubic-bezier(.2,0,0,1); }
.composer textarea { scrollbar-width: none; }
.composer textarea::-webkit-scrollbar { display: none; }
.toast { display: flex; align-items: center; gap: 10px; opacity: 0; transform: translateY(16px) scale(.96); transition: opacity .2s ease, transform .2s cubic-bezier(.2,0,0,1); }
.toast.show { opacity: 1; transform: none; }
.toast.success { border-color: #5f8f6c; background: #263b2d; }
.toast.error { border-color: #8e5f62; background: #442b32; }
.dialog-scrim { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; opacity: 0; background: #08060ab8; backdrop-filter: blur(8px); transition: opacity .18s ease; }
.dialog-scrim.open { opacity: 1; }
.md-dialog { display: grid; width: min(100%, 430px); gap: 14px; padding: 26px; border: 1px solid #5b4c68; border-radius: var(--md-shape-xl); background: #2a2330; box-shadow: 0 24px 70px #000c; transform: translateY(18px) scale(.95); transition: transform .24s cubic-bezier(.2,0,0,1); }
.dialog-scrim.open .md-dialog { transform: none; }
.dialog-icon { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 16px; color: var(--md-primary); background: #4a3564; }
.dialog-icon.danger { color: var(--md-error); background: #503038; }
.md-dialog h2 { margin: 0; font-size: 23px; letter-spacing: -.5px; }
.md-dialog p { margin: 0; color: var(--md-on-surface-variant); line-height: 1.55; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dialog-danger { color: #351317; background: var(--md-error); }
.install-state { display: flex; align-items: center; gap: 9px; padding: 12px 14px; border-radius: var(--md-shape-m); color: var(--md-success); background: #26382d; font-size: 12px; }
.install-state.warning { color: #f2c984; background: #3b3021; }
.install-state i { width: 9px; height: 9px; border-radius: 50%; background: currentColor; box-shadow: 0 0 12px currentColor; }
.image-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.image-options label { display: grid; gap: 7px; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-top: 14px; }
.image-result-card > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; }
.image-result-card > div a { display: inline-flex; align-items: center; gap: 6px; color: var(--md-on-surface-variant); font-size: 11px; }
.image-result-card > div a:hover { color: var(--md-primary); }
.memory-card { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-top: 10px; padding: 15px 16px; border: 1px solid #403747; border-radius: var(--md-shape-l); background: var(--md-surface-2); animation: md3-container-in .3s ease both; }
.memory-card span { color: var(--md-primary); font-size: 10px; font-weight: 750; letter-spacing: .8px; text-transform: uppercase; }
.memory-card p { margin: 7px 0 0; line-height: 1.5; }
.empty-state { display: grid; place-items: center; gap: 7px; min-height: 180px; color: var(--md-on-surface-variant); text-align: center; }
.empty-state > .md-icon { width: 34px; height: 34px; color: var(--md-primary); }
.empty-state > .md-icon svg { width: 34px; height: 34px; }
.empty-state span { font-size: 12px; }
.install-callout { display: flex; align-items: center; gap: 13px; padding: 15px; border: 1px solid #594a66; border-radius: var(--md-shape-l); background: #292130; }
.install-callout > .md-icon { color: var(--md-primary); }
.install-callout b, .install-callout span { display: block; }
.install-callout span { margin-top: 4px; color: var(--md-on-surface-variant); font-size: 11px; }
.result-head { display: flex; align-items: center; gap: 8px; margin: 12px 0 8px; color: var(--md-success); }
.budget-track { height: 9px; overflow: hidden; margin: 18px 0; border-radius: var(--md-shape-full); background: #403549; }
.budget-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--md-primary), var(--md-tertiary)); transition: width .5s cubic-bezier(.2,0,0,1); }
.monitor-budget { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.monitor-budget > div { padding: 12px; border-radius: var(--md-shape-m); background: var(--md-surface-2); }
.monitor-budget span, .monitor-budget b { display: block; }
.monitor-budget span { color: var(--md-on-surface-variant); font-size: 10px; }
.monitor-budget b { margin-top: 5px; font-size: 15px; }
.monitor-generated { padding: 18px 4px 0; color: var(--md-on-surface-variant); font-size: 10px; text-align: right; }
.skeleton { position: relative; overflow: hidden; }
.skeleton::after { position: absolute; inset: 0; content: ""; background: linear-gradient(100deg, transparent 30%, #ffffff0c 50%, transparent 70%); transform: translateX(-100%); animation: md3-skeleton 1.3s ease-in-out infinite; }
::view-transition-old(root) { animation: .16s ease both md3-view-out; } ::view-transition-new(root) { animation: .28s cubic-bezier(.2,0,0,1) both md3-view-in; }
@keyframes md3-ripple { to { opacity: 0; transform: scale(1); } }
@keyframes md3-page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes md3-view-out { to { opacity: 0; transform: scale(.99); } } @keyframes md3-view-in { from { opacity: 0; transform: translateY(7px) scale(.995); } }
@keyframes md3-skeleton { to { transform: translateX(100%); } }

@media (max-width: 760px) {
  .topbar { min-height: 72px; padding: 11px 14px; }
  .topbar p { display: none; }
  .main { gap: 14px; padding: 14px 12px 26px; }
  .messages:not(:empty) { min-height: 56vh; }
  .message { gap: 8px; }
  .avatar { width: 30px; height: 30px; flex-basis: 30px; border-radius: 10px; font-size: 12px; }
  .message-body { max-width: 91%; }
  .message-actions { opacity: 1; transform: none; }
  .bubble { padding: 13px 14px; font-size: 14px; }
  .composer-wrap { bottom: 8px; padding-top: 5px; }
  .composer { min-height: 58px; padding: 7px; border-radius: 22px; }
  .mode-wrap { min-height: 42px; }
  .composer textarea { min-height: 42px; padding: 10px 6px; }
  .send { width: 44px; height: 44px; flex-basis: 44px; }
  .composer-footer { display: none; }
  .image-options { grid-template-columns: 1fr; }
  .image-result-meta { align-items: flex-start; flex-direction: column; }
  .generation-steps { grid-template-columns: repeat(2, 1fr); }
  .monitor-budget { grid-template-columns: 1fr; }
  .dialog-scrim { align-items: end; padding: 12px; }
  .md-dialog { border-radius: 28px; transform: translateY(36px) scale(.98); }
  .toast { right: 12px; bottom: 92px; max-width: calc(100vw - 24px); }
}

body.ios-shell .topbar { min-height: 70px; padding: calc(10px + env(safe-area-inset-top)) 15px 10px; }
body.ios-shell .topbar-actions .danger { display: inline-flex; }
body.ios-shell .main { gap: 12px; padding: 12px 12px calc(190px + env(safe-area-inset-bottom)); }
body.ios-shell .main.chat-main { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
body.ios-shell .messages:not(:empty) { min-height: calc(100svh - 250px); padding-bottom: 108px; scroll-padding-bottom: 108px; }
body.ios-shell .composer-wrap { bottom: calc(91px + env(safe-area-inset-bottom)); padding-top: 4px; }
body.ios-shell .composer { background: #292330f2; backdrop-filter: blur(22px); }
body.ios-shell .bottom-tabs { box-shadow: 0 14px 38px #000c, inset 0 1px #ffffff0b; }
body.ios-shell .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }

@media (max-width: 420px) {
  body.ios-shell .topbar h1 { font-size: 19px; }
  body.ios-shell .eyebrow { margin-bottom: 3px; }
  body.ios-shell .welcome { padding: 20px 18px 16px; }
  body.ios-shell .welcome h2 { font-size: 32px; letter-spacing: -1.8px; }
  body.ios-shell .welcome p { line-height: 1.55; }
  body.ios-shell .welcome-visual { min-height: 92px; }
  body.ios-shell .mode-wrap .md-icon:first-child { display: none; }
  body.ios-shell .mode-wrap select { width: 61px; }
  body.ios-shell .bottom-tabs button { min-width: 49px; padding-inline: 5px; }
}

/* Attachments, multimodal chat and image-to-image editing */
.composer-attach { flex: 0 0 42px; color: var(--md-on-surface-variant); transition: color .2s ease, background .2s ease, transform .2s cubic-bezier(.2,0,0,1); }
.composer-attach:hover { color: var(--md-primary); background: #433650; transform: rotate(-7deg) scale(1.06); }
.attachment-tray { display: flex; max-width: 100%; gap: 9px; overflow-x: auto; padding: 7px 4px 10px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.attachment-chip { position: relative; display: grid; min-width: 210px; max-width: 280px; min-height: 64px; grid-template-columns: 48px minmax(0,1fr) 30px; align-items: center; gap: 10px; overflow: hidden; padding: 8px; border: 1px solid #584966; border-radius: 20px; background: color-mix(in srgb, var(--md-surface-2) 91%, var(--md-primary) 9%); box-shadow: 0 8px 24px #0005; scroll-snap-align: start; animation: md3-attachment-in .34s cubic-bezier(.2,0,0,1) both; }
.attachment-chip > img { width: 48px; height: 48px; border-radius: 14px; object-fit: cover; background: #17131b; animation: md3-thumbnail-reveal .38s cubic-bezier(.2,0,0,1) both; }
.attachment-file-icon { display: grid; width: 48px; height: 48px; place-items: center; border-radius: 14px; color: var(--md-primary); background: #49365c; }
.attachment-file-icon .md-icon, .attachment-file-icon svg { width: 23px; height: 23px; }
.attachment-chip > div { min-width: 0; }
.attachment-chip strong, .attachment-chip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-chip strong { color: var(--md-on-surface); font-size: 12px; }
.attachment-chip small { margin-top: 5px; color: var(--md-on-surface-variant); font-size: 10px; }
.attachment-chip > button { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; color: var(--md-on-surface-variant); background: transparent; transition: color .18s ease, background .18s ease, transform .18s ease; }
.attachment-chip > button:hover { color: var(--md-error); background: #56333b; transform: rotate(7deg) scale(1.08); }
.attachment-chip > button .md-icon, .attachment-chip > button svg { width: 16px; height: 16px; }
.attachment-chip > i { position: absolute; right: 0; bottom: 0; left: 0; height: 3px; background: linear-gradient(90deg, var(--md-primary) var(--upload), #51465a var(--upload)); transition: background .2s ease; }
.attachment-chip.uploading { border-color: #8f70ac; animation: md3-attachment-in .34s cubic-bezier(.2,0,0,1) both, md3-upload-breathe 1.7s ease-in-out infinite; }
.attachment-chip.error { border-color: #986167; background: #40282f; }
.message-attachments { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 240px)); justify-content: inherit; gap: 8px; margin-bottom: 7px; }
.message-image { overflow: hidden; margin: 0; border: 1px solid #51435c; border-radius: 20px; background: var(--md-surface-2); box-shadow: 0 10px 25px #0005; animation: md3-media-in .42s cubic-bezier(.2,0,0,1) both; }
.message-image > a { display: block; aspect-ratio: 4/3; overflow: hidden; background: #151219; }
.message-image img { width: 100%; height: 100%; object-fit: cover; transition: transform .45s cubic-bezier(.2,0,0,1), filter .3s ease; }
.message-image:hover img { transform: scale(1.035); filter: saturate(1.08); }
.message-image figcaption { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 42px; padding: 6px 8px 6px 12px; }
.message-image figcaption span { overflow: hidden; color: var(--md-on-surface-variant); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.message-image figcaption button { display: grid; width: 31px; height: 31px; flex: 0 0 31px; place-items: center; border-radius: 50%; color: var(--md-primary); background: #49375a; transition: transform .2s ease, background .2s ease; }
.message-image figcaption button:hover { transform: rotate(-8deg) scale(1.08); background: #59436e; }
.message-image figcaption .md-icon, .message-image figcaption svg { width: 16px; height: 16px; }
.message-file { display: flex; min-width: min(100%, 260px); align-items: center; gap: 10px; padding: 11px 12px; border: 1px solid #51435c; border-radius: 18px; color: var(--md-on-surface); background: var(--md-surface-2); text-decoration: none; animation: md3-media-in .38s cubic-bezier(.2,0,0,1) both; transition: border-color .2s ease, transform .2s ease, background .2s ease; }
.message-file:hover { border-color: #8b6eaa; background: #302737; transform: translateY(-2px); }
.message-file > .md-icon:first-child { color: var(--md-primary); }
.message-file > span { min-width: 0; flex: 1; }
.message-file b, .message-file small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-file b { font-size: 11px; }.message-file small { margin-top: 3px; color: var(--md-on-surface-variant); font-size: 9px; }
.drop-hint { position: absolute; inset: -8px; z-index: 6; display: grid; place-content: center; place-items: center; gap: 5px; visibility: hidden; opacity: 0; border: 2px dashed var(--md-primary); border-radius: 28px; color: var(--md-primary); background: #211a29f2; pointer-events: none; transform: scale(.97); transition: opacity .18s ease, transform .24s cubic-bezier(.2,0,0,1), visibility .18s; }
.drop-hint > .md-icon, .drop-hint svg { width: 34px; height: 34px; animation: md3-drop-bob 1.2s ease-in-out infinite; }
.drop-hint span { color: var(--md-on-surface-variant); font-size: 10px; }
[data-drop-target] { position: relative; }
[data-drop-target].drag-active > .drop-hint, .composer-wrap.drag-active > .drop-hint { visibility: visible; opacity: 1; transform: none; }
.reference-picker { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 16px; border: 1px dashed #766287; border-radius: 22px; background: linear-gradient(135deg, #2b2233, #241e2a); transition: border-color .2s ease, background .2s ease, transform .2s ease; }
.reference-picker:hover { border-color: var(--md-primary); background: linear-gradient(135deg, #34263f, #27202e); transform: translateY(-1px); }
.reference-picker > div { display: grid; grid-template-columns: 42px 1fr; column-gap: 11px; align-items: center; }
.reference-picker b, .reference-picker small { grid-column: 2; }.reference-picker b { font-size: 13px; }.reference-picker small { margin-top: 3px; color: var(--md-on-surface-variant); font-size: 10px; }
.reference-icon { grid-row: 1/3; display: grid; width: 42px; height: 42px; place-items: center; border-radius: 15px; color: var(--md-primary); background: #49345e; animation: md3-wand-float 2.8s ease-in-out infinite; }
.reference-route { margin-top: -4px; color: var(--md-primary); }
.reference-tray { padding: 3px 0 4px; }
@keyframes md3-attachment-in { from { opacity: 0; transform: translateY(10px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes md3-thumbnail-reveal { from { opacity: 0; transform: scale(.8) rotate(-3deg); filter: blur(5px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes md3-upload-breathe { 0%,100% { box-shadow: 0 8px 24px #0005, 0 0 0 0 #d7b9ff00; } 50% { box-shadow: 0 8px 24px #0005, 0 0 0 4px #d7b9ff16; } }
@keyframes md3-media-in { from { opacity: 0; transform: translateY(8px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes md3-drop-bob { 0%,100% { transform: translateY(2px) rotate(-5deg); } 50% { transform: translateY(-5px) rotate(5deg); } }
@keyframes md3-wand-float { 0%,100% { transform: translateY(0) rotate(-3deg); box-shadow: 0 0 0 0 #d7b9ff00; } 50% { transform: translateY(-3px) rotate(4deg); box-shadow: 0 0 0 6px #d7b9ff10; } }

@media (max-width: 760px) {
  .composer-attach { flex-basis: 38px; width: 38px; }
  .attachment-tray { margin-inline: -2px; padding-bottom: 7px; }
  .attachment-chip { min-width: 190px; min-height: 58px; grid-template-columns: 42px minmax(0,1fr) 28px; border-radius: 18px; }
  .attachment-chip > img, .attachment-file-icon { width: 42px; height: 42px; border-radius: 12px; }
  .message-attachments { grid-template-columns: minmax(0, 280px); }
  .reference-picker { align-items: stretch; flex-direction: column; padding: 13px; }
  .reference-picker > button { width: 100%; }
  .drop-hint { position: fixed; inset: 90px 12px 104px; }
}

@media (max-width: 430px) {
  .composer .mode-wrap { flex-basis: 62px; min-width: 62px; }
  .composer-attach { margin-left: -3px; }
  .message-image { max-width: 250px; }
  body.ios-shell .composer-wrap .attachment-tray { max-height: 76px; }
}

.mobile-history-btn { display: none; }
body.ios-shell .mobile-history-btn { display: inline-grid; }
.history-scrim { align-items: end; padding: 0; }
.history-sheet { display: grid; width: min(100%, 620px); max-height: min(82svh, 760px); grid-template-rows: auto auto auto minmax(0,1fr); gap: 14px; overflow: hidden; padding: 8px 16px calc(18px + env(safe-area-inset-bottom)); border: 1px solid #645371; border-bottom: 0; border-radius: 30px 30px 0 0; background: #241e2aee; box-shadow: 0 -20px 60px #000b; backdrop-filter: blur(26px); transform: translateY(105%); transition: transform .34s cubic-bezier(.2,0,0,1); }
.history-scrim.open .history-sheet { transform: none; }
.sheet-handle { width: 36px; height: 4px; margin: 0 auto; border-radius: 5px; background: #776b7f; }
.history-sheet > header { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.history-sheet h2 { margin: 3px 0 0; font-size: 23px; letter-spacing: -.6px; }
.history-new { width: 100%; min-height: 48px; }
.history-list { display: grid; align-content: start; gap: 5px; overflow-y: auto; overscroll-behavior: contain; padding: 2px 2px 8px; }
.history-row { display: grid; grid-template-columns: minmax(0,1fr) 42px; align-items: center; border: 1px solid transparent; border-radius: 19px; background: #2c2533; animation: md3-history-row-in .32s cubic-bezier(.2,0,0,1) both; transition: background .18s ease, border-color .18s ease; }
.history-row:nth-child(2) { animation-delay: 30ms; }.history-row:nth-child(3) { animation-delay: 60ms; }.history-row:nth-child(4) { animation-delay: 90ms; }
.history-row.active { border-color: #745c8b; background: #3b2e46; }
.history-row > button:first-child { display: grid; min-width: 0; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 11px 7px 11px 13px; color: var(--md-on-surface); background: transparent; text-align: left; }
.history-row > button:first-child > .md-icon { color: var(--md-primary); }
.history-row > button span { min-width: 0; }
.history-row b, .history-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-row b { font-size: 12px; }.history-row small { margin-top: 4px; color: var(--md-on-surface-variant); font-size: 9px; }
.history-row i { padding: 4px 7px; border-radius: 20px; color: var(--md-primary); background: #4b3959; font-size: 8px; font-style: normal; font-weight: 750; text-transform: uppercase; }
.history-delete { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; color: var(--md-on-surface-variant); background: transparent; }
.history-delete:hover { color: var(--md-error); background: #503139; }
.history-delete .md-icon, .history-delete svg { width: 16px; height: 16px; }
.prompt-warning { display: flex; align-items: flex-start; gap: 11px; margin-top: 18px; padding: 13px 15px; border: 1px solid #9a7849; border-radius: 18px; color: #f6d596; background: #3a3025; animation: md3-container-in .3s cubic-bezier(.2,0,0,1); }
.prompt-warning > .md-icon { flex: 0 0 20px; margin-top: 1px; }.prompt-warning strong, .prompt-warning span { display: block; }.prompt-warning span { margin-top: 4px; color: #dcc9a8; font-size: 11px; line-height: 1.45; }
@keyframes md3-history-row-in { from { opacity: 0; transform: translateY(9px) scale(.98); } to { opacity: 1; transform: none; } }

@media (hover: none), (pointer: coarse) {
  button:hover, .chip:hover, .message-action:hover, .composer-attach:hover, .attachment-chip > button:hover, .message-image figcaption button:hover, .message-file:hover, .reference-picker:hover, .history-delete:hover { transform: none; }
  button:active, .primary:active, .tonal:active, .chip:active, .message-action:active, .send:active, .composer-attach:active, .bottom-tabs button:active { transform: scale(.96) !important; transition-duration: .08s; }
  .bottom-tabs button, .topbar .icon-btn, .send, .composer-attach { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
