/* =========================================================================
   AMICORTEX WEB — STYLES
   Gemini-style layout in the Amicortex palette (Theme.kt neutrals + the
   chosen accent). The accent is only for buttons, links, active chips and
   small highlights; surfaces stay neutral. Mobile first, then laptop.
   ========================================================================= */

:root {
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --accent: #B9A5FF; --accent-end: #F9A8D4; --on-accent: #15151A; --accent-soft: #2C2642;
  --brand-a: #B9A5FF; --brand-b: #F9A8D4;
  --sb-w: 284px; --rail-w: 68px; --top-h: 60px; --content: 780px;
  --r-lg: 28px; --r-md: 18px; --r-sm: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --tb-h: 0px;
}

:root[data-theme="dark"] {
  --bg: #101014; --bg-2: #0C0C10; --surface: #17171C; --surface-2: #1C1C22; --bubble: #1E1E25;
  --composer: #1D1D24; --border: #2A2A32; --border-2: #34343E;
  --text: #F0F0F3; --dim: #9B9BA6; --dim-2: #6F6F7A;
  --danger: #FF7A7A; --ok: #5FDDAE;
  --hover: rgba(255, 255, 255, .06); --press: rgba(255, 255, 255, .1);
  --shadow: 0 18px 50px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .4);
  --glow-a: 26%; --glow-b: 12%;
  --brand-ink: #F0F0F3;
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #FFFFFF; --bg-2: #F7F7F9; --surface: #F4F4F7; --surface-2: #ECECF1; --bubble: #F1F1F5;
  --composer: #F2F2F6; --border: #E3E3E9; --border-2: #D6D6DE;
  --text: #15151A; --dim: #6B6B76; --dim-2: #9A9AA5;
  --danger: #D93B3B; --ok: #0F8A5F;
  --hover: rgba(20, 20, 30, .05); --press: rgba(20, 20, 30, .09);
  --shadow: 0 18px 50px rgba(30, 20, 60, .14), 0 2px 8px rgba(30, 20, 60, .08);
  --glow-a: 14%; --glow-b: 7%;
  --brand-ink: #241C33;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; overflow: hidden;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; opacity: .5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-track { background: transparent; }

.ic { width: 20px; height: 20px; flex: none; display: block; }
.grow { flex: 1; }

/* ---------------- installed-app title bar (Window Controls Overlay) ---------------- */
.titlebar { display: none; }
.wco { --tb-h: env(titlebar-area-height, 36px); }
.wco .titlebar {
  display: flex; align-items: center; gap: 8px; position: fixed; top: 0;
  left: env(titlebar-area-x, 0); width: env(titlebar-area-width, 100%); height: env(titlebar-area-height, 36px);
  padding: 0 14px; font-size: 13px; font-weight: 600; color: var(--dim); background: var(--surface);
  -webkit-app-region: drag; app-region: drag; z-index: 5; user-select: none;
}
.wco .titlebar .logo-mark { width: 15px; height: 15px; }
.wco #app { padding-top: var(--tb-h); height: 100%; }

#app { height: 100%; }

/* ---------------- boot ---------------- */
.boot { height: 100%; display: grid; place-items: center; }
.boot-mark { width: 54px; height: 54px; animation: breathe 1.6s var(--ease) infinite; }
@keyframes breathe { 0%, 100% { transform: scale(.92); opacity: .65; } 50% { transform: scale(1); opacity: 1; } }

.logo-mark { width: 26px; height: 26px; flex: none; display: block; }
.logo-mark.lg { width: 40px; height: 40px; }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 20px;
  border-radius: 999px; font-weight: 600; font-size: 14.5px; transition: background .15s, transform .1s, opacity .15s; white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn.sm { height: 34px; padding: 0 14px; font-size: 13.5px; }
.btn.block { width: 100%; height: 48px; font-size: 15px; }
.btn.primary { background: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: var(--hover); color: var(--text); }
.btn.ghost:hover { background: var(--press); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.danger-ghost { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.btn.loading { opacity: .75; pointer-events: none; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 999px; display: inline-grid; place-items: center; color: var(--dim);
  transition: background .15s, color .15s; flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm .ic { width: 17px; height: 17px; }
.link-btn { color: var(--accent); font-weight: 600; }
.link-btn:hover { text-decoration: underline; }
.link-btn.right { align-self: flex-end; font-size: 13.5px; }

/* ---------------- fields ---------------- */
.field {
  width: 100%; height: 48px; padding: 0 16px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--border);
  outline: none; transition: border .15s, box-shadow .15s; font-size: 15px;
}
textarea.field { height: auto; padding: 12px 16px; resize: vertical; min-height: 84px; }
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.field::placeholder { color: var(--dim-2); }

/* =========================================================================
   AUTH
   ========================================================================= */
.auth-page { position: relative; height: 100%; overflow: auto; display: grid; place-items: center; padding: 32px 16px; }
.glow {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(60% 50% at 50% 62%, color-mix(in srgb, var(--accent) var(--glow-a), transparent) 0%, transparent 70%),
    radial-gradient(40% 35% at 70% 75%, color-mix(in srgb, var(--accent-end) var(--glow-b), transparent) 0%, transparent 70%);
  filter: blur(10px);
}
.auth-wrap { position: relative; z-index: 1; width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.auth-brand { display: flex; align-items: center; gap: 12px; font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.auth-card {
  width: 100%; background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--border); border-radius: 26px;
  padding: 30px 26px; box-shadow: var(--shadow); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.auth-title { margin: 0 0 6px; font-size: 24px; font-weight: 700; letter-spacing: -.02em; text-align: center; }
.auth-sub { margin: 0 0 22px; color: var(--dim); text-align: center; font-size: 14.5px; }
.auth-ic { width: 52px; height: 52px; border-radius: 16px; margin: 0 auto 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.auth-ic .ic { width: 26px; height: 26px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.f { position: relative; display: flex; flex-direction: column; gap: 6px; }
.f-label { font-size: 13px; font-weight: 600; color: var(--dim); padding-left: 4px; }
.f-eye { position: absolute; right: 10px; bottom: 9px; height: 30px; padding: 0 10px; border-radius: 10px; font-size: 12.5px; font-weight: 600; color: var(--dim); }
.f-eye:hover { background: var(--hover); color: var(--text); }
.f-hint { margin: -4px 0 0 4px; font-size: 12.5px; color: var(--dim-2); }
.code-field { text-align: center; font-size: 26px; letter-spacing: .5em; font-weight: 700; height: 60px; padding-left: calc(16px + .5em); }
.auth-error { color: var(--danger); font-size: 13.5px; padding: 2px 4px; }
.auth-switch { margin: 16px 0 0; text-align: center; font-size: 14px; color: var(--dim); }
.auth-legal { font-size: 12.5px; color: var(--dim-2); text-align: center; max-width: 340px; }
.auth-legal a { color: var(--dim); text-decoration: underline; }
.or { display: flex; align-items: center; gap: 12px; color: var(--dim-2); font-size: 12.5px; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.g-wrap { display: flex; justify-content: center; min-height: 44px; }
/* Google draws its button in a light-scheme iframe; matching the scheme stops the browser painting a white box behind it */
.g-btn { color-scheme: light; background: transparent; border-radius: 999px; overflow: hidden; }
.g-off { font-size: 13px; color: var(--dim); text-align: center; }

/* =========================================================================
   SHELL
   ========================================================================= */
.shell { display: flex; height: 100%; position: relative; }

.sidebar {
  width: var(--sb-w); flex: none; height: 100%; background: var(--surface); display: flex; flex-direction: column;
  padding: 10px 10px 10px; transition: width .25s var(--ease), transform .25s var(--ease); z-index: 30; overflow: hidden;
}
.sb-top { display: flex; align-items: center; gap: 4px; height: 48px; padding: 0 2px; }
.sb-brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; color: var(--text); font-weight: 700; font-size: 18px; letter-spacing: -.02em; padding: 6px 6px; border-radius: 12px; }
.sb-brand:hover { text-decoration: none; }
.sb-brand .logo-mark { width: 24px; height: 24px; }
.sb-name { white-space: nowrap; }
.stg-badge { font-size: 9.5px; font-weight: 700; letter-spacing: .06em; padding: 3px 6px; border-radius: 6px; background: #E0A526; color: #1a1300; }
.sb-toggle { order: 3; }
.sb-search { order: 2; }
.sb-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.sb-item {
  display: flex; align-items: center; gap: 14px; height: 44px; padding: 0 14px; border-radius: 999px; color: var(--text);
  font-weight: 500; font-size: 14.5px; text-align: left; white-space: nowrap; transition: background .15s;
}
.sb-item:hover { background: var(--hover); }
.sb-item.active { background: var(--accent-soft); color: var(--text); }
.sb-item .sb-ic { color: var(--dim); display: grid; place-items: center; }
.sb-item.active .sb-ic { color: var(--accent); }
.sb-tx { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sb-hint { font-size: 11.5px; color: var(--dim-2); opacity: 0; transition: opacity .15s; }
.sb-item:hover .sb-hint { opacity: 1; }
.sb-item.rail-only { display: none; }
.sb-label { margin: 20px 14px 6px; font-size: 12.5px; font-weight: 600; color: var(--dim); white-space: nowrap; }
.sb-list { flex: 1; overflow-y: auto; overflow-x: hidden; margin: 0 -4px; padding: 0 4px 8px; }
.sb-group { font-size: 11.5px; font-weight: 600; color: var(--dim-2); padding: 14px 14px 6px; letter-spacing: .02em; }
.sb-chat { display: flex; align-items: center; border-radius: 999px; position: relative; }
.sb-chat:hover { background: var(--hover); }
.sb-chat.active { background: var(--accent-soft); }
.sb-chat-link { flex: 1; min-width: 0; display: block; padding: 9px 6px 9px 14px; color: var(--text); font-size: 14px; }
.sb-chat-link:hover { text-decoration: none; }
.sb-chat-link span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-more { opacity: 0; margin-right: 4px; }
.sb-chat:hover .sb-more, .sb-chat.active .sb-more, .sb-more:focus-visible { opacity: 1; }
.sb-empty { padding: 14px; font-size: 13px; color: var(--dim-2); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.sb-bottom { display: flex; align-items: center; gap: 4px; padding-top: 8px; border-top: 1px solid var(--border); margin-top: 6px; }
.sb-user { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 999px; text-align: left; }
.sb-user:hover { background: var(--hover); }
.sb-uname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: 14.5px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; object-fit: cover; }
.avatar.initials { display: grid; place-items: center; font-weight: 700; font-size: 13px; color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--accent-end)); }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }

/* collapsed rail (laptop) */
.shell.collapsed .sidebar { width: var(--rail-w); padding: 10px 10px; }
.shell.collapsed .sb-top { flex-direction: column; height: auto; gap: 6px; }
.shell.collapsed .sb-brand, .shell.collapsed .sb-search { display: none; }
.shell.collapsed .sb-toggle { order: 0; }
.shell.collapsed .sb-item { width: 48px; padding: 0; justify-content: center; }
.shell.collapsed .sb-item .sb-tx, .shell.collapsed .sb-item .sb-hint { display: none; }
.shell.collapsed .sb-item.rail-only { display: flex; }
.shell.collapsed .sb-label, .shell.collapsed .sb-list { visibility: hidden; }
.shell.collapsed .sb-bottom { flex-direction: column-reverse; border-top: 0; gap: 8px; }
.shell.collapsed .sb-user { padding: 4px; flex: none; }
.shell.collapsed .sb-uname { display: none; }

.sb-scrim { display: none; }

/* ---------------- main ---------------- */
.main { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; position: relative; background: var(--bg); }
.topbar { height: var(--top-h); flex: none; display: flex; align-items: center; gap: 8px; padding: 0 16px; position: relative; z-index: 5; }
.top-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.top-title .logo-mark { width: 22px; height: 22px; }
.top-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 999px; font-weight: 600; font-size: 14.5px;
  transition: filter .15s, background .15s, transform .1s;
}
.top-pill:active { transform: scale(.98); }
.top-pill .ic { width: 18px; height: 18px; }
.top-pill.ghost { background: var(--surface); color: var(--text); }
.top-pill.ghost:hover { background: var(--surface-2); }
.top-pill.upgrade { background: linear-gradient(135deg, var(--accent), var(--accent-end)); color: var(--on-accent); box-shadow: 0 6px 22px color-mix(in srgb, var(--accent) 30%, transparent); }
.top-pill.upgrade:hover { filter: brightness(1.06); }
.top-pill.plan { background: var(--accent-soft); color: var(--accent); }
.only-mobile { display: none !important; }

.view { flex: 1; min-height: 0; position: relative; }

/* =========================================================================
   CHAT
   ========================================================================= */
.chat { position: absolute; inset: 0; display: flex; flex-direction: column; }
.chat > .glow { opacity: 0; transition: opacity .5s; }
.chat.empty > .glow { opacity: 1; }
.thread-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; z-index: 1; scroll-behavior: auto; }
.thread { max-width: var(--content); margin: 0 auto; padding: 8px 24px 28px; display: flex; flex-direction: column; gap: 26px; }
.hero { display: none; position: relative; z-index: 1; text-align: center; padding: 0 24px; }
.chat.empty { justify-content: center; }
.chat.empty .thread-scroll { display: none; }
.chat.empty .hero { display: block; margin-bottom: 28px; margin-top: -8vh; }
.hero-title { margin: 0; font-size: clamp(30px, 4.2vw, 46px); font-weight: 600; letter-spacing: -.03em; line-height: 1.15; }
.grad { background: linear-gradient(90deg, var(--accent) 0%, var(--accent-end) 55%, var(--accent) 100%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: gradmove 8s linear infinite; }
@keyframes gradmove { to { background-position: -200% 0; } }
.hero-sub { margin: 10px 0 0; color: var(--dim); font-size: clamp(17px, 2vw, 21px); }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; }
.chip {
  height: 40px; padding: 0 18px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 80%, transparent); border: 1px solid var(--border);
  font-size: 14px; font-weight: 500; color: var(--text); transition: background .15s, border-color .15s, transform .1s;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.chip:hover { background: var(--surface-2); border-color: var(--border-2); }
.chip:active { transform: scale(.98); }

/* composer */
.composer-wrap { position: relative; z-index: 2; padding: 0 24px 10px; }
.composer {
  max-width: var(--content); margin: 0 auto; background: var(--composer); border-radius: var(--r-lg); padding: 10px 10px 8px 12px;
  border: 1px solid var(--border); box-shadow: 0 10px 40px rgba(0, 0, 0, .18); transition: border-color .15s, box-shadow .2s;
}
.composer:focus-within { border-color: var(--border-2); box-shadow: 0 10px 40px rgba(0, 0, 0, .22), 0 0 0 4px color-mix(in srgb, var(--accent) 10%, transparent); }
.chat.drag .composer { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.composer-input {
  width: 100%; border: 0; outline: none; background: transparent; resize: none; font-size: 16px; line-height: 1.55;
  padding: 8px 8px 6px; max-height: 35vh; min-height: 30px; display: block;
}
.composer-input::placeholder { color: var(--dim); }
.composer-row { display: flex; align-items: center; gap: 4px; }
.model-btn { display: inline-flex; align-items: center; gap: 4px; height: 38px; padding: 0 10px 0 14px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--text); }
.model-btn:hover { background: var(--hover); }
.model-btn .mb-ic .ic { width: 17px; height: 17px; color: var(--dim); }
.mic-btn.on { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger) 10%, transparent); } }
.send-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; margin-left: 2px;
  background: var(--hover); color: var(--dim-2); transition: background .15s, color .15s, transform .1s; pointer-events: none;
}
.send-btn.ready { background: var(--accent); color: var(--on-accent); pointer-events: auto; }
.send-btn.ready:active { transform: scale(.94); }
.send-btn.stop { background: var(--text); color: var(--bg); pointer-events: auto; }
.disclaimer { text-align: center; font-size: 12px; color: var(--dim-2); padding-top: 8px; }
.chat.empty .disclaimer { visibility: hidden; }
.attach-row { padding: 4px 4px 6px; display: flex; gap: 8px; }
.attach-chip { position: relative; width: 64px; height: 64px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); }
.attach-chip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.attach-x { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0, 0, 0, .65); color: #fff; display: grid; place-items: center; }
.attach-x .ic { width: 14px; height: 14px; }

.jump-btn {
  position: absolute; left: 50%; bottom: 120px; transform: translate(-50%, 10px); z-index: 3; width: 38px; height: 38px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border); display: grid; place-items: center; color: var(--text); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; box-shadow: var(--shadow);
}
.jump-btn.show { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.jump-btn .ic { width: 18px; height: 18px; }

/* messages */
.msg { display: flex; gap: 14px; animation: rise .28s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.msg.user { flex-direction: column; align-items: flex-end; gap: 4px; }
.bubble {
  max-width: min(78%, 620px); padding: 11px 18px; border-radius: 22px 22px 6px 22px; font-size: 15.5px; line-height: 1.6;
  border: 1px solid transparent;
  background: linear-gradient(var(--bubble), var(--bubble)) padding-box,
              linear-gradient(135deg, color-mix(in srgb, var(--accent) 45%, transparent), color-mix(in srgb, var(--accent-end) 35%, transparent)) border-box;
}
.bubble.card-bubble { padding: 0; background: none; border: 0; max-width: min(78%, 360px); }
.user-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .15s; margin-top: 2px; }
.msg:hover .msg-actions, .msg-actions:focus-within { opacity: 1; }
.msg.ai { align-items: flex-start; }
.ai-avatar { width: 32px; height: 32px; flex: none; display: grid; place-items: center; margin-top: 1px; }
.ai-avatar .logo-mark { width: 24px; height: 24px; }
.ai-avatar.thinking .logo-mark { animation: think 1.6s var(--ease) infinite; }
@keyframes think { 0% { transform: rotate(0) scale(.9); } 50% { transform: rotate(180deg) scale(1.05); } 100% { transform: rotate(360deg) scale(.9); } }
.ai-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.msg.ai .msg-actions { margin-left: -6px; }
.msg.note { justify-content: center; }
.divider-note { display: flex; align-items: center; gap: 12px; width: 100%; color: var(--dim); font-size: 12.5px; font-weight: 600; }
.divider-note::before, .divider-note::after { content: ""; flex: 1; height: 1.5px; }
.divider-note::before { background: linear-gradient(90deg, transparent, var(--accent)); }
.divider-note::after { background: linear-gradient(90deg, var(--accent-end), transparent); }
.divider-note span { padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); }

.status-line { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 14.5px; min-height: 26px; }
.sl-ic .ic { width: 18px; height: 18px; color: var(--accent); }
.spin-soft { animation: spin 2.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sl-favs { display: flex; }
.sl-favs img { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid var(--bg); margin-left: -6px; }
.sl-favs img:first-child { margin-left: 0; }
.shimmer {
  background: linear-gradient(90deg, var(--dim) 0%, var(--text) 40%, var(--dim) 80%); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.6s linear infinite; font-weight: 500;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.img-forming {
  width: min(100%, 360px); aspect-ratio: 1; border-radius: 20px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--accent-soft), color-mix(in srgb, var(--accent-end) 18%, var(--surface)));
}
.img-forming::after { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .22) 50%, transparent 80%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }

/* rich text */
.rich { font-size: 15.5px; line-height: 1.72; overflow-wrap: anywhere; }
.rich > :first-child { margin-top: 0; }
.rich > :last-child { margin-bottom: 0; }
.rich p { margin: 0 0 .85em; }
.rich h1, .rich h2, .rich h3, .rich h4 { line-height: 1.3; letter-spacing: -.015em; margin: 1.3em 0 .5em; font-weight: 700; }
.rich h1 { font-size: 1.45em; } .rich h2 { font-size: 1.28em; } .rich h3 { font-size: 1.12em; } .rich h4 { font-size: 1em; }
.rich ul, .rich ol { margin: 0 0 .85em; padding-left: 1.4em; }
.rich li { margin: .28em 0; }
.rich li::marker { color: var(--dim); }
.rich blockquote { margin: 0 0 .85em; padding: 4px 0 4px 16px; border-left: 3px solid var(--accent); color: var(--dim); }
.rich hr { border: 0; height: 1px; background: var(--border); margin: 1.4em 0; }
.rich strong { font-weight: 700; }
.rich a { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-underline-offset: 3px; }
.rich :not(pre) > code { font-family: var(--mono); font-size: .87em; background: var(--surface-2); padding: .14em .42em; border-radius: 6px; }
.table-wrap { overflow-x: auto; margin: 0 0 1em; border: 1px solid var(--border); border-radius: 14px; }
.rich table { border-collapse: collapse; width: 100%; font-size: .94em; }
.rich th, .rich td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.rich th { background: var(--surface); font-weight: 600; }
.rich tr:last-child td { border-bottom: 0; }
.code-block { margin: 0 0 1em; border-radius: 16px; overflow: hidden; background: #0D0D12; border: 1px solid var(--border); }
:root[data-theme="light"] .code-block { border-color: #1f1f28; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 16px; background: #17171E; color: #9B9BA6; font-size: 12.5px; }
.code-lang { font-family: var(--mono); }
.code-copy { height: 28px; padding: 0 10px; border-radius: 8px; color: #C9C9D2; font-weight: 600; font-size: 12.5px; }
.code-copy:hover { background: rgba(255, 255, 255, .08); }
.code-block pre { margin: 0; padding: 14px 16px 16px; overflow-x: auto; }
.code-block code.hljs { font-family: var(--mono); font-size: 13.5px; line-height: 1.6; background: transparent; padding: 0; color: #E6E6EC; }
.math-display { overflow-x: auto; overflow-y: hidden; margin: .4em 0 1em; padding: 2px 0; }
.katex { font-size: 1.08em; }
.svg-card { background: #fff; border-radius: 16px; padding: 14px; margin: 0 0 1em; border: 1px solid var(--border); max-width: 520px; }
.svg-card svg { width: 100%; height: auto; display: block; }
.web-fig { margin: 0 0 1em; max-width: 460px; border-radius: 16px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.web-fig img { display: block; width: 100%; max-height: 420px; object-fit: contain; background: #fff; cursor: zoom-in; }
.web-fig figcaption { padding: 8px 12px; font-size: 12.5px; color: var(--dim); display: flex; gap: 8px; flex-wrap: wrap; }
.fig-title { color: var(--text); font-weight: 500; }
.gsearch { width: 100%; height: 64px; border: 0; border-radius: 14px; background: transparent; display: block; margin: 0 0 .6em; }

/* cards */
.card { border: 1px solid var(--border); background: var(--surface); border-radius: 18px; }
.image-card { margin: 0; overflow: hidden; max-width: 420px; }
.gen-img { display: block; width: 100%; cursor: zoom-in; background: var(--surface-2); min-height: 120px; }
.ic-bar { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px 14px; }
.ai-label { font-size: 12px; color: var(--dim); font-weight: 500; }
.failed-card { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; color: var(--text); background: color-mix(in srgb, var(--danger) 9%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); font-size: 14.5px; }
.failed-card .fc-ic { color: var(--danger); }
.upgrade-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, var(--surface)), color-mix(in srgb, var(--accent-end) 8%, var(--surface))); }
.uc-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--accent-end)); flex: none; }
.uc-tx { flex: 1; min-width: 0; font-size: 14.5px; }
.uc-tx p { margin: 2px 0 0; color: var(--dim); font-size: 13.5px; }
.file-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; max-width: 420px; color: var(--text); }
.file-card.link:hover { background: var(--surface-2); text-decoration: none; }
.fc-ic { width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.fc-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.fc-tx strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-tx span { color: var(--dim); font-size: 12.5px; }
.fc-go { color: var(--dim); }
.mc-thumb { width: 54px; height: 40px; border-radius: 8px; object-fit: cover; }
.media-card { padding: 14px; max-width: 440px; display: flex; flex-direction: column; gap: 10px; }
.mc-head { display: flex; align-items: center; gap: 12px; }
.mc-head > div { display: flex; flex-direction: column; }
.mc-ic { width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.media-card audio { width: 100%; }
.media-card video { width: 100%; border-radius: 12px; background: #000; max-height: 480px; }
.vc-state { color: var(--dim); font-size: 14px; }
.lyrics summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 13.5px; }
.lyrics pre { white-space: pre-wrap; font-family: var(--font); font-size: 14px; color: var(--dim); margin: 8px 0 0; }
.run-card { max-width: 100%; overflow: hidden; }
.run-card summary { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; font-size: 14px; font-weight: 600; list-style: none; }
.run-card summary::-webkit-details-marker { display: none; }
.rc-ic { color: var(--ok); display: grid; }
.run-card.failed .rc-ic { color: var(--danger); }
.rc-lang { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--dim); font-weight: 400; }
.rc-code, .rc-out pre { margin: 0; padding: 12px 14px; font-family: var(--mono); font-size: 12.5px; overflow-x: auto; background: var(--bg-2); border-top: 1px solid var(--border); white-space: pre; }
.rc-label { padding: 8px 14px 0; font-size: 12px; color: var(--dim); background: var(--bg-2); border-top: 1px solid var(--border); }
.rc-files { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--border); }
.rc-img { max-width: 220px; border-radius: 10px; cursor: zoom-in; background: #fff; }
.site-card { display: flex; align-items: center; gap: 14px; padding: 10px; max-width: 460px; color: var(--text); }
.site-card:hover { background: var(--surface-2); text-decoration: none; }
.sc-shot { width: 92px; height: 64px; border-radius: 10px; object-fit: cover; object-position: top; flex: none; background: var(--surface-2); }
.sc-shot.ph { display: grid; place-items: center; color: var(--accent); }
.sc-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 14px; }
.sc-tx span { color: var(--dim); font-size: 12.5px; }

.thread-loading { display: flex; flex-direction: column; gap: 14px; padding-top: 30px; }
.skel { height: 16px; border-radius: 8px; background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.skel.short { width: 55%; }
.thread-empty { color: var(--dim); text-align: center; padding: 60px 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* =========================================================================
   PAGES (Library)
   ========================================================================= */
.page { position: absolute; inset: 0; overflow-y: auto; padding: 8px 32px 40px; }
.page-head { max-width: 1100px; margin: 0 auto 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -.025em; }
.lib-count { color: var(--dim); font-size: 14px; }
.page-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg-btn { height: 34px; padding: 0 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--dim); display: inline-flex; align-items: center; gap: 6px; }
.seg-btn .ic { width: 16px; height: 16px; }
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--bg); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .18); }
:root[data-theme="dark"] .seg-btn.on { background: var(--surface-2); }
.lib-grid { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.lib-tile { position: relative; aspect-ratio: 1; border-radius: 18px; overflow: hidden; background: var(--surface); transition: transform .15s; }
.lib-tile img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s var(--ease); }
.lib-tile:hover img { transform: scale(1.04); }
.lib-tile.skel { animation: shimmer 1.3s linear infinite; }
.lib-tile.chosen { outline: 3px solid var(--accent); outline-offset: -3px; }
.lib-check { position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .5); color: transparent; border: 2px solid #fff; }
.lib-tile.chosen .lib-check { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.lib-check .ic { width: 14px; height: 14px; }
.lib-empty { grid-column: 1 / -1; text-align: center; color: var(--dim); padding: 80px 0; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.le-ic { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--surface); color: var(--accent); }
.le-ic .ic { width: 30px; height: 30px; }

/* =========================================================================
   OVERLAYS
   ========================================================================= */
.modal-back {
  position: fixed; inset: 0; z-index: 100; background: rgba(5, 5, 10, .55); display: grid; place-items: center; padding: 20px;
  opacity: 0; transition: opacity .2s; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal-back.in { opacity: 1; }
.modal-panel {
  width: 100%; max-height: min(88vh, 860px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: 26px; box-shadow: var(--shadow); transform: translateY(10px) scale(.98); transition: transform .22s var(--ease); outline: none;
}
.modal-back.in .modal-panel { transform: none; }
.modal-panel.size-sm { max-width: 420px; }
.modal-panel.size-md { max-width: 560px; }
.modal-panel.size-lg { max-width: 900px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 6px 24px; }
.modal-title { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.015em; }
.modal-body { padding: 10px 24px 18px; overflow-y: auto; }
.modal-text { margin: 0 0 6px; color: var(--dim); line-height: 1.6; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 20px 20px; flex-wrap: wrap; }

.menu-shield { position: fixed; inset: 0; z-index: 110; }
.menu {
  position: fixed; z-index: 111; background: var(--surface-2); border: 1px solid var(--border); border-radius: 18px; padding: 6px; box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-4px) scale(.98); transform-origin: top; transition: opacity .14s, transform .14s var(--ease); max-height: 70vh; overflow-y: auto;
}
.menu.in { opacity: 1; transform: none; }
.menu-head { padding: 8px 12px 6px; font-size: 12px; color: var(--dim); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 12px; text-align: left; font-size: 14px; }
.menu-item:hover { background: var(--hover); }
.menu-item.danger { color: var(--danger); }
.menu-item .mi-ic { color: var(--dim); display: grid; }
.menu-item.danger .mi-ic { color: var(--danger); }
.menu-item .mi-ic .ic { width: 18px; height: 18px; }
.mi-tx { flex: 1; font-weight: 500; white-space: nowrap; }
.mi-hint { font-size: 12px; color: var(--dim-2); white-space: nowrap; }
.mi-check { color: var(--accent); display: grid; }
.mi-check .ic { width: 18px; height: 18px; }
.menu-item.active { background: var(--accent-soft); }

.toast-host { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 18px 11px 14px; border-radius: 999px; background: var(--text); color: var(--bg);
  font-size: 14px; font-weight: 500; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s var(--ease); pointer-events: auto;
}
.toast.in { opacity: 1; transform: none; }
.toast-ic .ic { width: 18px; height: 18px; }
.toast.error .toast-ic { color: var(--danger); }
.toast.ok .toast-ic { color: var(--ok); }
:root[data-theme="dark"] .toast.error .toast-ic { color: #D93B3B; }
:root[data-theme="dark"] .toast.ok .toast-ic { color: #0F8A5F; }

.viewer { position: fixed; inset: 0; z-index: 150; background: rgba(0, 0, 0, .92); display: flex; flex-direction: column; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s; }
.viewer.in { opacity: 1; }
.viewer-bar { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 6px; padding: 12px 12px 12px 20px; color: #fff; }
.viewer-bar .icon-btn { color: #ddd; }
.viewer-bar .icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.viewer-cap { flex: 1; font-size: 14px; color: #ccc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-img { max-width: 92vw; max-height: 84vh; border-radius: 14px; object-fit: contain; }

.update-bar { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 210; display: flex; align-items: center; gap: 14px; padding: 8px 8px 8px 18px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); box-shadow: var(--shadow); font-size: 14px; }

/* search */
.search { display: flex; flex-direction: column; gap: 12px; }
.search-results { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow-y: auto; }
.sr-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; text-align: left; }
.sr-item:hover { background: var(--hover); }
.sr-ic { color: var(--dim); display: grid; }
.sr-ic .ic { width: 18px; height: 18px; }
.sr-tx { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14.5px; }
.sr-when { font-size: 12px; color: var(--dim-2); white-space: nowrap; }
.sr-empty { padding: 30px 0; text-align: center; color: var(--dim); }

/* report */
.radio-list { display: flex; flex-direction: column; gap: 2px; margin: 10px 0 12px; }
.radio { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer; }
.radio:hover { background: var(--hover); }
.radio input { accent-color: var(--accent); width: 18px; height: 18px; }

/* settings */
.settings { display: grid; grid-template-columns: 200px 1fr; gap: 20px; min-height: 420px; }
.set-nav { display: flex; flex-direction: column; gap: 2px; }
.set-tab { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 14px; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--dim); text-align: left; }
.set-tab:hover { background: var(--hover); color: var(--text); }
.set-tab.on { background: var(--accent-soft); color: var(--text); }
.set-tab.on .set-ic { color: var(--accent); }
.set-ic { display: grid; color: var(--dim); }
.set-ic .ic { width: 19px; height: 19px; }
.set-group { display: flex; flex-direction: column; gap: 4px; }
.set-row { display: flex; align-items: center; gap: 14px; padding: 14px 4px; border-bottom: 1px solid var(--border); cursor: default; }
label.set-row { cursor: pointer; }
.set-row.col { flex-direction: column; align-items: stretch; gap: 12px; }
.set-top { display: flex; align-items: center; gap: 14px; }
.set-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.set-tx strong { font-size: 14.5px; font-weight: 600; }
.set-tx span { font-size: 13px; color: var(--dim); }
.set-foot { font-size: 12.5px; color: var(--dim-2); margin: 14px 4px 0; line-height: 1.6; }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch .knob { position: absolute; inset: 0; border-radius: 999px; background: var(--border-2); transition: background .2s; }
.switch .knob::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.switch input:checked + .knob { background: var(--accent); }
.switch input:checked + .knob::after { transform: translateX(18px); }
.switch input:focus-visible + .knob { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; padding-left: 33px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--sw) 55%, var(--sw2)); border: 2px solid transparent; box-shadow: 0 0 0 1px var(--border); transition: transform .12s; }
.swatch:hover { transform: scale(1.08); }
.swatch.on { border-color: var(--bg); box-shadow: 0 0 0 2px var(--sw); }
.set-row.col .seg { margin-left: 33px; align-self: flex-start; }
.acct-card { display: flex; align-items: center; gap: 16px; padding: 6px 4px 18px; border-bottom: 1px solid var(--border); }
.acct-tx { display: flex; flex-direction: column; min-width: 0; }
.acct-tx strong { font-size: 17px; }
.acct-tx span { color: var(--dim); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; }
.about-brand { display: flex; flex-direction: column; padding: 4px 4px 14px; }
.about-brand span { color: var(--dim); font-size: 13px; }
.set-link { display: flex; align-items: center; justify-content: space-between; padding: 14px 4px; border-bottom: 1px solid var(--border); color: var(--text); font-weight: 500; }
.set-link:hover { text-decoration: none; color: var(--accent); }

/* upgrade */
.upgrade-reason { margin: 0 0 14px; padding: 10px 14px; border-radius: 12px; background: var(--accent-soft); font-size: 14px; }
.plan-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.plan-card { position: relative; border: 1px solid var(--border); border-radius: 22px; padding: 22px 20px; background: var(--bg-2); display: flex; flex-direction: column; gap: 6px; }
.plan-card.popular { border: 1.5px solid transparent; background: linear-gradient(var(--bg-2), var(--bg-2)) padding-box, linear-gradient(135deg, var(--accent), var(--accent-end)) border-box; }
.plan-card.current { box-shadow: inset 0 0 0 2px var(--accent); }
.plan-flag { position: absolute; top: -11px; left: 20px; font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: linear-gradient(135deg, var(--accent), var(--accent-end)); color: var(--on-accent); letter-spacing: .02em; }
.plan-name { font-size: 18px; font-weight: 700; }
.plan-tag { font-size: 13px; color: var(--dim); min-height: 36px; }
.plan-price { display: flex; align-items: baseline; gap: 6px; margin: 6px 0 8px; }
.plan-price .now { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.plan-price .per { color: var(--dim); font-size: 13px; }
.plan-price .was { color: var(--dim-2); font-size: 13px; margin-left: 4px; }
.feats { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.feat { display: flex; align-items: flex-start; gap: 8px; }
.feat-ic { color: var(--ok); display: grid; margin-top: 1px; }
.feat-ic .ic { width: 16px; height: 16px; }
.feat.off { color: var(--dim-2); }
.feat.off .feat-ic { color: var(--dim-2); }
.plan-current { margin-top: 10px; font-size: 13px; font-weight: 700; color: var(--accent); }
.upgrade-note { display: flex; gap: 14px; align-items: flex-start; margin-top: 18px; padding: 16px; border-radius: 18px; background: var(--bg-2); border: 1px dashed var(--border-2); }
.upgrade-note p { margin: 4px 0 0; color: var(--dim); font-size: 13.5px; }
.un-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }

/* =========================================================================
   PHONE / SMALL WINDOW (≤ 860px)
   ========================================================================= */
@media (max-width: 860px) {
  .only-mobile { display: inline-grid !important; }
  .top-title.only-mobile { display: flex !important; }
  .sidebar {
    position: fixed; left: 0; top: var(--tb-h); bottom: 0; transform: translateX(-102%); width: min(86vw, 320px) !important;
    box-shadow: var(--shadow); padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
  .shell.collapsed .sidebar { width: min(86vw, 320px); }
  .shell.collapsed .sb-brand, .shell.collapsed .sb-search { display: flex; }
  .shell.collapsed .sb-top { flex-direction: row; }
  .shell.collapsed .sb-item { width: auto; padding: 0 14px; justify-content: flex-start; }
  .shell.collapsed .sb-item .sb-tx { display: block; }
  .shell.collapsed .sb-item.rail-only { display: none; }
  .shell.collapsed .sb-label, .shell.collapsed .sb-list { visibility: visible; }
  .shell.collapsed .sb-bottom { flex-direction: row; border-top: 1px solid var(--border); }
  .shell.collapsed .sb-uname { display: block; }
  .shell.collapsed .sb-user { flex: 1; padding: 6px 8px; }
  .shell.drawer .sidebar { transform: none; }
  .sb-scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity .25s; }
  .shell.drawer .sb-scrim { opacity: 1; pointer-events: auto; }
  .sb-more { opacity: 1; }
  .sb-hint { display: none; }
  .topbar { padding: 0 6px; padding-top: env(safe-area-inset-top); height: calc(var(--top-h) + env(safe-area-inset-top)); gap: 4px; }
  .top-pill { height: 36px; padding: 0 14px; font-size: 13.5px; }
  .top-pill.ghost { display: none; }
  .thread { padding: 4px 14px 20px; gap: 22px; }
  .composer-wrap { padding: 0 10px calc(8px + env(safe-area-inset-bottom)); }
  .composer { border-radius: 26px; }
  .composer-input { font-size: 16px; }
  .chat.empty { justify-content: flex-end; }
  .chat.empty .hero { flex: 1; display: flex; flex-direction: column; justify-content: center; margin: 0; padding: 0 18px; }
  .chat.empty .disclaimer { display: none; }
  .chips { margin-top: 22px; }
  .bubble { max-width: 88%; }
  .msg { gap: 10px; }
  .ai-avatar { width: 26px; height: 26px; }
  .ai-avatar .logo-mark { width: 20px; height: 20px; }
  .msg-actions { opacity: 1; }
  .jump-btn { bottom: 108px; }
  .page { padding: 4px 14px 30px; }
  .page-title { font-size: 26px; }
  .lib-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .lib-tile { border-radius: 14px; }
  .modal-back { align-items: end; padding: 0; }
  .modal-panel { border-radius: 26px 26px 0 0; max-height: 92vh; padding-bottom: env(safe-area-inset-bottom); }
  .modal-panel.size-sm, .modal-panel.size-md, .modal-panel.size-lg { max-width: 100%; }
  .settings { grid-template-columns: 1fr; gap: 10px; min-height: 0; }
  .set-nav { flex-direction: row; overflow-x: auto; }
  .set-tab { flex: none; }
  .plan-grid { grid-template-columns: 1fr; }
  .swatches, .set-row.col .seg { padding-left: 0; margin-left: 0; }
  .toast-host { bottom: calc(96px + env(safe-area-inset-bottom)); }
  .update-bar { top: calc(10px + env(safe-area-inset-top)); width: calc(100vw - 24px); justify-content: space-between; }
}

@media (max-width: 420px) {
  .hero-title { font-size: 30px; }
  .chip { height: 38px; padding: 0 14px; font-size: 13.5px; }
  .model-btn { padding: 0 6px 0 10px; }
}

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

@media print {
  .sidebar, .topbar, .composer-wrap, .msg-actions, .jump-btn { display: none !important; }
  body { overflow: visible; }
  .chat, .thread-scroll { position: static; overflow: visible; }
}

/* =========================================================================
   v1.0.2 — Android parity: thinking dots, media cards, action rows, sidebar
   ========================================================================= */

/* thinking dots + shimmer words (Android GetplexThinking) */
.live-status { display: flex; flex-direction: column; gap: 6px; }
.think-row { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.think-dots { display: block; flex: none; }
.think-label { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.web-line { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 14px; padding-left: 4px; }
.wl-ic .ic { width: 17px; height: 17px; color: var(--accent); }

/* action row under every reply / card — always visible on AI replies, like Android */
.msg.ai .msg-actions { opacity: 1; }
.msg-actions .icon-btn.on { color: var(--accent); background: var(--accent-soft); }
.msg-actions .icon-btn.on svg path { fill: color-mix(in srgb, var(--accent) 28%, transparent); }

/* the AI mark on made pictures / songs / videos */
.ai-mark { position: absolute; right: 12px; bottom: 12px; width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 255, 255, .88); display: grid; place-items: center; box-shadow: 0 2px 10px rgba(0, 0, 0, .25); z-index: 2; }
.ai-mark .logo-mark { width: 18px; height: 18px; --brand-ink: #241C33; }

/* picture card — the picture itself, rounded, no frame (Android) */
.image-card { position: relative; margin: 0; width: min(100%, 400px); border-radius: 24px; overflow: hidden; background: var(--surface); }
.image-card:not(.loaded) { aspect-ratio: 1; }
.image-card:not(.loaded)::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(100deg, transparent 20%, color-mix(in srgb, var(--text) 8%, transparent) 50%, transparent 80%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.image-card .gen-img { display: block; width: 100%; height: auto; min-height: 0; cursor: zoom-in; background: transparent; }
.card-bubble .image-card { width: 100%; }

/* song card (Android SongCard) */
.song-card { width: min(100%, 360px); display: flex; flex-direction: column; gap: 8px; }
.song-cover {
  position: relative; aspect-ratio: 1; border-radius: 28px; overflow: hidden; color: #fff;
  background: linear-gradient(180deg, var(--deep), #07070A); display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.sc-orb { position: absolute; left: 50%; top: 42%; width: 124%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--glow) 62%, transparent) 0%, color-mix(in srgb, var(--glow) 12%, transparent) 45%, transparent 70%);
  transition: opacity .4s; opacity: .85; }
.sc-orb::after { content: ""; position: absolute; left: 50%; top: 50%; width: 21%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: var(--glow); opacity: .9; box-shadow: 0 0 40px var(--glow); }
.song-cover.playing .sc-orb { animation: orb 1.8s ease-in-out infinite alternate; }
@keyframes orb { from { opacity: .7; transform: translate(-50%, -50%) scale(.97); } to { opacity: 1; transform: translate(-50%, -50%) scale(1.04); } }
.sc-play { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 50%; background: #fff; color: #111114; display: grid; place-items: center; box-shadow: 0 8px 26px rgba(0, 0, 0, .35); transition: transform .12s; z-index: 2; }
.sc-play:hover { transform: translate(-50%, -50%) scale(1.05); }
.sc-play .ic { width: 22px; height: 22px; }
.song-cover.loading .sc-play { animation: pulse 1s infinite; }
.sc-meta { position: absolute; left: 22px; right: 22px; bottom: 22px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; z-index: 1; }
.sc-title { font-size: 24px; line-height: 1.2; font-weight: 700; color: #F3E6C8; letter-spacing: -.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; padding-right: 30px; padding-left: 30px; }
.sc-bar { position: relative; width: 100%; height: 18px; cursor: pointer; }
.sc-track, .sc-fill { position: absolute; left: 0; top: 50%; height: 3px; transform: translateY(-50%); border-radius: 2px; }
.sc-track { right: 0; background: rgba(255, 255, 255, .25); }
.sc-fill { width: 0; background: rgba(255, 255, 255, .92); }
.sc-time { font-size: 12px; color: rgba(255, 255, 255, .8); min-height: 16px; }

/* video card (Android VideoCard) */
.video-card { position: relative; border-radius: 24px; overflow: hidden; }
.video-card.tall { width: min(100%, 260px); aspect-ratio: 9 / 16; }
.video-card.wide { width: min(100%, 520px); aspect-ratio: 16 / 9; }
.video-card video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }
.vc-shimmer { position: absolute; inset: 0; background: linear-gradient(100deg, var(--surface) 20%, var(--surface-2) 50%, var(--surface) 80%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.video-card.making { aspect-ratio: auto; width: auto; overflow: visible; border-radius: 0; }
.vc-sub { color: var(--dim); font-size: 12.5px; padding: 2px 0 0 2px; }

/* sidebar: sub items, notebooks, pins */
.sb-label:first-child { margin-top: 14px; }
.sb-item.sb-sub { height: 40px; font-size: 14px; }
.sb-emoji { width: 20px; text-align: center; font-size: 16px; line-height: 1; }
.sb-pin { color: var(--dim-2); display: grid; margin-right: 2px; }
.sb-pin .ic { width: 15px; height: 15px; }
.shell.collapsed .sb-list { display: none; }

/* pages coming to the web */
.page.soon { display: grid; place-items: center; }
.soon-card { max-width: 520px; text-align: center; padding: 40px 28px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.soon-ic { width: 76px; height: 76px; border-radius: 24px; display: grid; place-items: center; color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--accent-end)); box-shadow: 0 14px 40px color-mix(in srgb, var(--accent) 30%, transparent); }
.soon-ic .ic { width: 36px; height: 36px; }
.soon-title { margin: 10px 0 0; font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.soon-text { margin: 0; color: var(--dim); font-size: 15.5px; line-height: 1.6; }
.soon-badge { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; padding: 6px 14px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 13px; }
.soon-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s infinite; }
.soon-sub { margin: 0; color: var(--dim-2); font-size: 13px; }
.soon-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 8px; }
.soon-actions a:hover { text-decoration: none; }

@media (max-width: 860px) {
  .shell.collapsed .sb-list { display: block; }
  .sc-title { font-size: 21px; }
}

/* =========================================================================
   v1.0.3 — tooltips, bigger type, icon motion, Wave button, editor
   ========================================================================= */

/* bigger, Gemini-size reading type */
body { font-size: 16px; }
.rich { font-size: 16.5px; line-height: 1.78; }
.bubble { font-size: 16.5px; }
.composer-input { font-size: 17px; }
.sb-item { font-size: 15.5px; height: 46px; }
.sb-item.sb-sub { font-size: 15px; height: 42px; }
.sb-chat-link { font-size: 15px; padding-top: 10px; padding-bottom: 10px; }
.sb-label { font-size: 13px; }
.sb-uname { font-size: 15.5px; }
.menu-item { font-size: 15px; padding: 10px 14px; }
.model-btn { font-size: 15px; }
.think-label { font-size: 15.5px; }
.chip { font-size: 15px; height: 42px; }
.top-pill { font-size: 15.5px; }

/* tooltip pill (replaces the browser's white box) */
.tooltip {
  position: fixed; z-index: 300; pointer-events: none; padding: 7px 13px; border-radius: 12px;
  font: 500 13.5px/1.2 var(--font); letter-spacing: .01em; white-space: nowrap;
  background: #E9E9EE; color: #15151A; box-shadow: 0 6px 22px rgba(0, 0, 0, .35);
  opacity: 0; transform: translateY(3px) scale(.98); transition: opacity .14s, transform .14s var(--ease);
}
:root[data-theme="light"] .tooltip { background: #24242B; color: #F4F4F7; }
.tooltip.in { opacity: 1; transform: none; }

/* sidebar icon motion on hover (one short play, like Claude's sidebar) */
.sb-item:hover .sb-ic svg, .sb-item:focus-visible .sb-ic svg { animation-duration: .9s; animation-timing-function: cubic-bezier(.3, 1.4, .5, 1); animation-iteration-count: 1; }
.sb-item:hover .ic-newChat svg { animation-name: ic-write; transform-origin: 20% 80%; }
.sb-item:hover .ic-search svg { animation-name: ic-seek; }
.sb-item:hover .ic-photos svg { animation-name: ic-tilt; }
.sb-item:hover .ic-books svg { animation-name: ic-hop; }
.sb-item:hover .ic-clipboard svg { animation-name: ic-pop; }
.sb-item:hover .ic-mail svg { animation-name: ic-fly; }
.sb-item:hover .ic-camcorder svg { animation-name: ic-rec; }
.sb-item:hover .ic-clipPlus svg { animation-name: ic-spin-plus; }
.sb-item:hover .ic-notebook svg, .sb-item:hover .ic-bulb svg { animation-name: ic-pop; }
@keyframes ic-write { 0%, 100% { transform: none; } 20% { transform: rotate(-14deg); } 45% { transform: rotate(8deg) translateX(2px); } 70% { transform: rotate(-5deg); } }
@keyframes ic-seek { 0%, 100% { transform: none; } 30% { transform: translate(-2px, -2px) scale(1.12); } 60% { transform: translate(2px, 1px); } }
@keyframes ic-tilt { 0%, 100% { transform: none; } 35% { transform: rotate(-10deg) scale(1.1); } 70% { transform: rotate(6deg); } }
@keyframes ic-hop { 0%, 100% { transform: none; } 30% { transform: translateY(-4px); } 55% { transform: translateY(1px) scaleY(.94); } 75% { transform: translateY(-1px); } }
@keyframes ic-pop { 0%, 100% { transform: none; } 35% { transform: scale(1.2); } 65% { transform: scale(.94); } }
@keyframes ic-fly { 0%, 100% { transform: none; } 40% { transform: translate(4px, -3px) rotate(-8deg); opacity: .6; } 41% { transform: translate(-5px, 3px); opacity: .2; } 75% { transform: none; opacity: 1; } }
@keyframes ic-rec { 0%, 100% { transform: none; } 25% { transform: translateX(-2px) rotate(-4deg); } 50% { transform: translateX(2px) rotate(4deg); } 75% { transform: translateX(-1px); } }
@keyframes ic-spin-plus { 0%, 100% { transform: none; } 50% { transform: rotate(90deg) scale(1.1); } }

/* send / wave / stop */
.send-btn.wave { pointer-events: auto; background: var(--accent-soft); color: var(--accent); }
.send-btn.wave:hover { background: color-mix(in srgb, var(--accent) 26%, transparent); }
.send-btn.wave svg path { animation: wave-bars 1.6s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes wave-bars { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.6); } }
.wave-soon { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.wave-orb { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; margin: 4px 0 10px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%); }
.modal-text.small { font-size: 13.5px; color: var(--dim-2); }

/* scroll-to-latest: dots while out, arrow on hover; sits clear of the box */
.jump-btn { bottom: calc(100% - 100% + 150px); width: 42px; height: 42px; }
.chat .jump-btn { bottom: var(--jump-bottom, 150px); }
.jump-btn .jb-arrow { position: absolute; inset: 0; display: grid; place-items: center; opacity: 0; transform: translateY(-3px); transition: opacity .15s, transform .15s; }
.jump-btn .jb-dots { display: grid; place-items: center; transition: opacity .15s; }
.jump-btn:hover .jb-arrow, .jump-btn:focus-visible .jb-arrow { opacity: 1; transform: none; }
.jump-btn:hover .jb-dots, .jump-btn:focus-visible .jb-dots { opacity: 0; }
@media (hover: none) { .jump-btn .jb-arrow { opacity: 1; transform: none; } .jump-btn .jb-dots { opacity: 0; } }

/* picture: quick tools on hover (Gemini) */
.img-tools { position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; opacity: 0; transform: translateY(-4px); transition: opacity .18s, transform .18s; z-index: 3; }
.image-card:hover .img-tools, .image-card:focus-within .img-tools { opacity: 1; transform: none; }
.it-btn { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgba(20, 20, 26, .55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); transition: background .15s; }
.it-btn:hover { background: rgba(20, 20, 26, .8); }
.it-btn .ic { width: 18px; height: 18px; }
@media (hover: none) { .img-tools { display: none; } }

/* chat ⋮ in the top bar */
.chat-more .ic { width: 22px; height: 22px; }

/* image editor (full screen) */
.viewer.editor { background: #0B0B0F; display: block; }
.ed-bg { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(50px) brightness(.35); transform: scale(1.1); }
.ed-top { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 6px; padding: 14px 16px; z-index: 2; }
.ed-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #EDEDF2; transition: background .15s; }
.ed-btn:hover { background: rgba(255, 255, 255, .1); }
.ed-btn:disabled { opacity: .35; }
.ed-btn .ic { width: 22px; height: 22px; }
.ed-save { height: 44px; padding: 0 22px; border-radius: 999px; background: #EDEDF2; color: #15151A; font-weight: 600; font-size: 15px; margin-left: 8px; }
.ed-stage { position: absolute; left: 0; right: 0; top: 76px; bottom: 150px; display: grid; place-items: center; z-index: 1; }
.viewer.editor .ed-stage { touch-action: none; }
.ed-canvas { display: block; border-radius: 6px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5); max-width: 100%; }
.ed-stage.drawing .ed-canvas { cursor: crosshair; }
.ed-stage.texting .ed-canvas { cursor: text; }
.ed-text { position: absolute; transform: translate(-50%, -50%); min-width: 120px; background: rgba(0, 0, 0, .45); border: 1.5px dashed rgba(255, 255, 255, .7); border-radius: 8px; padding: 6px 10px; font: 700 22px var(--font); text-align: center; outline: none; }
.ed-caption { flex: 0 1 auto; min-width: 0; margin-left: 6px; color: rgba(255, 255, 255, .7); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
@media (max-width: 860px) { .ed-caption { display: none; } }
.ed-bottom { position: absolute; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 0 16px max(18px, env(safe-area-inset-bottom)); z-index: 2; }
.ed-colors { display: flex; gap: 14px; }
.ed-color { width: 30px; height: 30px; border-radius: 50%; border: 2px solid transparent; box-shadow: 0 0 0 1px rgba(255, 255, 255, .15); transition: transform .12s; }
.ed-color:hover { transform: scale(1.1); }
.ed-color.on { transform: scale(1.18); border-color: #fff; box-shadow: 0 0 0 2px rgba(0, 0, 0, .4); }
.ed-tools { display: flex; gap: 22px; }
.ed-tool { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #EDEDF2; font-size: 14px; font-weight: 600; }
.ed-tool-ic { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .1); transition: background .15s, color .15s; }
.ed-tool-ic .ic { width: 26px; height: 26px; }
.ed-tool:hover .ed-tool-ic { background: rgba(255, 255, 255, .18); }
.ed-tool.on .ed-tool-ic { background: #EDEDF2; color: #15151A; }
@media (max-width: 860px) {
  .ed-top { padding: max(10px, env(safe-area-inset-top)) 8px 8px; gap: 0; }
  .ed-btn { width: 40px; height: 40px; }
  .ed-save { padding: 0 16px; height: 40px; }
  .ed-stage { top: 64px; bottom: 170px; }
  .ed-colors { gap: 10px; }
}

/* Download PDF (browser print) — just the conversation */
@media print {
  .titlebar, .topbar, .composer-wrap, .msg-actions, .jump-btn, .img-tools, .sb-scrim, .toast-host, .chat > .glow { display: none !important; }
  .shell, .main, .view { display: block; height: auto; }
  .thread { max-width: none; padding: 0; }
  .msg { break-inside: avoid; }
  body { background: #fff; color: #000; }
}

.image-card.failed { aspect-ratio: auto; padding: 18px; display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 14px; }
.image-card.failed::before { display: none; }

/* =========================================================================
   v1.0.4 — Gemini-black surfaces, capsule box, tools, menus, edit, retry
   ========================================================================= */

/* pure neutral blacks (no blue tint) — like Gemini */
:root[data-theme="dark"] {
  --bg: #0E0E0F; --bg-2: #0A0A0B; --surface: #1B1B1C; --surface-2: #242426; --bubble: #262628;
  --composer: #1E1E20; --border: #2C2C2F; --border-2: #3A3A3E;
}
.sidebar { background: var(--surface); }
:root[data-theme="dark"] .menu, :root[data-theme="dark"] .menu.side { background: #242426; border-color: #313134; }

/* the message box: a soft capsule, no outline, no glow ring */
.composer { border-radius: 32px; border: 0; background: var(--composer); padding: 12px 12px 10px 14px; box-shadow: 0 8px 30px rgba(0, 0, 0, .28); }
.composer:focus-within { border: 0; box-shadow: 0 8px 30px rgba(0, 0, 0, .32); }
:root[data-theme="light"] .composer { box-shadow: 0 6px 24px rgba(20, 20, 40, .1); border: 1px solid var(--border); }
.composer-input { padding: 10px 10px 8px; }

/* photo waiting in the box — Gemini size, opens the editor */
.attach-row { padding: 2px 2px 4px; }
.attach-chip { width: 132px; height: 132px; border-radius: 22px; border: 0; cursor: zoom-in; background: var(--surface-2); }
.attach-chip:hover img { filter: brightness(.9); }
.attach-x { top: 8px; right: 8px; width: 26px; height: 26px; background: rgba(0, 0, 0, .7); }
@media (max-width: 860px) { .attach-chip { width: 104px; height: 104px; border-radius: 18px; } }

/* the tool chip beside + (e.g. "Image") */
.tool-slot { display: flex; }
.tool-chip { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 14.5px; margin-left: 4px; }
.tool-chip .ic { width: 18px; height: 18px; }
.tool-chip .tc-x { opacity: .7; display: grid; }
.tool-chip .tc-x .ic { width: 15px; height: 15px; }
.tool-chip:hover .tc-x { opacity: 1; }

/* menus: two-line rows, side panels, switches */
.menu { border-radius: 22px; padding: 8px; }
.menu-item.two { align-items: center; padding: 9px 14px; }
.mi-tx { display: flex; flex-direction: column; min-width: 0; }
.mi-label { font-weight: 500; white-space: nowrap; }
.mi-sub { font-size: 13px; color: var(--dim); white-space: nowrap; margin-top: 1px; }
.menu-item .mi-ic:empty { width: 18px; }
.mi-more { margin-left: auto; color: var(--dim); display: grid; }
.mi-more .ic { width: 16px; height: 16px; }
.menu-item.has-sub.open { background: var(--hover); }
.menu-item .mi-check { margin-left: auto; }
.menu.side { position: fixed; z-index: 112; min-width: 230px; }
.mi-switch { margin-left: auto; position: relative; width: 40px; height: 24px; border-radius: 999px; background: var(--border-2); flex: none; transition: background .2s; }
.mi-switch .knob { position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); }
.mi-switch.on { background: var(--accent); }
.mi-switch.on .knob { transform: translateX(16px); }

/* your message: a clean capsule; edit + copy under it */
.bubble { border: 0; background: var(--bubble); border-radius: 26px; padding: 12px 20px; }
:root[data-theme="light"] .bubble { background: #EEF0F4; }
.bubble.card-bubble { background: none; padding: 0; border-radius: 22px; }
.edit-wrap { align-self: flex-end; width: min(100%, 640px); background: var(--bubble); border-radius: 24px; padding: 12px 14px 10px; display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--border-2); }
.edit-box { width: 100%; border: 0; outline: none; background: transparent; resize: none; font-size: 16.5px; line-height: 1.6; color: var(--text); }
.edit-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* failure card + Retry (Android) */
.failed-card { align-items: center; flex-wrap: wrap; }
.failed-card .fc-why { flex: 1; min-width: 180px; }
.retry-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 999px; background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--text); font-weight: 600; font-size: 13.5px; }
.retry-btn:hover { background: color-mix(in srgb, var(--danger) 26%, transparent); }
.retry-btn .ic { width: 16px; height: 16px; }

/* scroll-to-latest: arrow normally; while a reply is being written it shows
   the dots, and the arrow on hover (Claude / Gemini) */
.jump-btn { background: var(--surface-2); border: 0; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); }
.jump-btn .jb-arrow { opacity: 1; transform: none; }
.jump-btn .jb-dots { opacity: 0; position: absolute; inset: 0; display: grid; place-items: center; }
.jump-btn.busy .jb-dots { opacity: 1; }
.jump-btn.busy .jb-arrow { opacity: 0; }
.jump-btn.busy:hover .jb-dots { opacity: 0; }
.jump-btn.busy:hover .jb-arrow { opacity: 1; }
@media (hover: none) { .jump-btn.busy .jb-dots { opacity: 1; } .jump-btn.busy .jb-arrow { opacity: 0; } }
