/* =========================================================================
   Aulama Chat — 2026-10 redesign
   Minimal, quiet surfaces in the spirit of Claude / ChatGPT, with spring
   motion tuned to feel like UIKit. Built from scratch; the old stylesheet
   is no longer loaded.
   ========================================================================= */

@font-face {
  font-family: "Material Symbols Rounded";
  font-style: normal;
  font-weight: 400;
  font-display: block;
  src: url("/assets/material-symbols-rounded-400-v363.woff2") format("woff2");
}

/* ---------- tokens ------------------------------------------------------- */
:root {
  /* The site's own typeface (as before the redesign): Baskerville with
     Songti TC for Chinese, everywhere except code. */
  --font-serif: "Baskerville", "Times New Roman", "Songti TC", "Noto Serif TC", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Helvetica Neue", Arial, "PingFang HK", "PingFang TC", "Noto Sans HK", "Noto Sans CJK HK", "Microsoft JhengHei", sans-serif;
  --font-ui: var(--font-serif);
  --font-display: var(--font-serif);
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;
  --font-reply: var(--font-serif);

  /* Springs sampled from a damped oscillator (tools/springs.cjs). */
  --spring-snappy: linear(0, 0.007 1.1%, 0.025 2.3%, 0.1 5%, 0.523 15.5%, 0.708 21.2%, 0.843 27%, 0.893 30.2%, 0.933 33.6%, 0.962 36.9%, 0.982 40.5%, 0.996 44.6%, 1.004 49.5%, 1.007 57.9%, 1);
  --spring-smooth: linear(0, 0.021 2.1%, 0.085 4.8%, 0.466 15.8%, 0.648 22.2%, 0.78 28.7%, 0.832 32.3%, 0.874 36%, 0.91 40.2%, 0.94 45%, 0.961 50.4%, 0.977 56.6%, 0.994 72.2%, 1);
  --spring-bouncy: linear(0, 0.008 1%, 0.031 2.2%, 0.123 4.7%, 0.641 14.1%, 0.842 18.6%, 0.979 23.1%, 1.025 25.5%, 1.057 28%, 1.08 31.4%, 1.082 35.6%, 1.014 52.2%, 0.995 62.2%, 1);
  --spring-gentle: linear(0, 0.02 2.1%, 0.08 4.7%, 0.464 16%, 0.64 22.3%, 0.772 28.9%, 0.825 32.5%, 0.868 36.2%, 0.906 40.7%, 0.935 45.5%, 0.958 50.9%, 0.975 57.2%, 0.993 72.9%, 1);
  --dur-snappy: 444ms;
  --dur-smooth: 564ms;
  --dur-bouncy: 601ms;
  --dur-gentle: 745ms;
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-in: cubic-bezier(.4, 0, 1, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);

  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-2xl: 26px;

  --topbar-h: 56px;
  --frame: 6px;
  --rail-w: 60px;
  --sidebar-min: 240px;
  --sidebar-max: 480px;
  --column-w: 768px;
  --gutter: 24px;
  --row-h: 36px;
  --tap: 36px;
  --dock-h: 140px;

  --ui-scale: 1;
  --reply-scale: 1;
  --fs-ui: calc(14px * var(--ui-scale));
  --fs-small: calc(12.5px * var(--ui-scale));
  --fs-tiny: calc(11.5px * var(--ui-scale));
  --fs-user: calc(15.5px * var(--ui-scale));
  --fs-reply: calc(16px * var(--reply-scale));
  --fs-composer: calc(15.5px * var(--ui-scale));
  --fs-greeting: calc(30px * var(--ui-scale));

  /* Theme hue drives the faint tint of every neutral surface. */
  --h: 48;
  --tc: .008;
  --accent: #d97757;
  --accent-2: #e8a17f;
  --on-accent: #ffffff;

  color-scheme: dark;
}

html[data-ui-size="0"] { --ui-scale: .86; }
html[data-ui-size="1"] { --ui-scale: .9; }
html[data-ui-size="2"] { --ui-scale: .94; }
html[data-ui-size="3"] { --ui-scale: .97; }
html[data-ui-size="4"] { --ui-scale: 1; }
html[data-ui-size="5"] { --ui-scale: 1.06; }
html[data-ui-size="6"] { --ui-scale: 1.12; }
html[data-ui-size="7"] { --ui-scale: 1.18; }
html[data-ui-size="8"] { --ui-scale: 1.25; }
html[data-ui-size="9"] { --ui-scale: 1.32; }
html[data-ui-size="10"] { --ui-scale: 1.4; }
html[data-reply-size="0"] { --reply-scale: .84; }
html[data-reply-size="1"] { --reply-scale: .9; }
html[data-reply-size="2"] { --reply-scale: .95; }
html[data-reply-size="3"] { --reply-scale: 1; }
html[data-reply-size="4"] { --reply-scale: 1.08; }
html[data-reply-size="5"] { --reply-scale: 1.16; }
html[data-reply-size="6"] { --reply-scale: 1.25; }
html[data-reply-size="7"] { --reply-scale: 1.34; }
html[data-reply-size="8"] { --reply-scale: 1.44; }
html[data-reply-size="9"] { --reply-scale: 1.55; }
html[data-reply-size="10"] { --reply-scale: 1.66; }
html[data-reply-font="sans"] { --font-reply: var(--font-sans); }

/* Themes: accent, surface tint and a four-colour aurora palette ----------- */
:root, html[data-theme="aurora"] {
  --h: 270; --tc: .012; --accent: #7b8cff; --accent-2: #b07cff; --on-accent: #fff;
  --a1: #4f8dff; --a2: #9b6bff; --a3: #ff6fb1; --a4: #2fd6d0;
}
html[data-theme="ember"]    { --h: 48;  --tc: .008; --accent: #d97757; --accent-2: #eb9d7b; --on-accent: #fff; --a1: #ff8a4c; --a2: #ff5f6d; --a3: #ffc35a; --a4: #ff9fb3; }
html[data-theme="sunset"]   { --h: 30;  --tc: .012; --accent: #ff7a59; --accent-2: #ff9f6b; --on-accent: #fff; --a1: #ff7e5f; --a2: #ffb36b; --a3: #c56cf0; --a4: #ff5e9c; }
html[data-theme="rose"]     { --h: 355; --tc: .012; --accent: #ec5c8f; --accent-2: #f590b3; --on-accent: #fff; --a1: #ff5c9a; --a2: #ff9ec4; --a3: #b56bff; --a4: #ff7a7a; }
html[data-theme="violet"]   { --h: 292; --tc: .016; --accent: #9b7cf6; --accent-2: #f07ad3; --on-accent: #fff; --a1: #8b5cf6; --a2: #d16bff; --a3: #5b7cff; --a4: #ff7ad9; }
html[data-theme="midnight"] { --h: 268; --tc: .022; --accent: #6b8bff; --accent-2: #8f6bff; --on-accent: #fff; --a1: #3b5bff; --a2: #7a4dff; --a3: #00c2ff; --a4: #3d4bd1; }
html[data-theme="ocean"]    { --h: 245; --tc: .014; --accent: #2f8cff; --accent-2: #6db2ff; --on-accent: #fff; --a1: #00b4ff; --a2: #2f6bff; --a3: #00e0c6; --a4: #6fd6ff; }
html[data-theme="forest"]   { --h: 155; --tc: .012; --accent: #3fb27f; --accent-2: #7fd3a5; --on-accent: #fff; --a1: #3fd17f; --a2: #1fb5a4; --a3: #b4e05a; --a4: #2a9d8f; }
html[data-theme="citrus"]   { --h: 85;  --tc: .012; --accent: #f0b429; --accent-2: #ff8a3d; --on-accent: #1d1600; --a1: #ffd23f; --a2: #ff8a3d; --a3: #8be04e; --a4: #ffb84d; }
html[data-theme="graphite"] { --h: 260; --tc: 0;    --accent: #ececec; --accent-2: #b4b4b4; --on-accent: #111; --a1: #9aa0aa; --a2: #e3e6eb; --a3: #6e7681; --a4: #c3c7cf; }
html[data-theme="custom"]   {
  --h: 250; --tc: .006;
  --a1: var(--accent);
  --a2: color-mix(in oklch, var(--accent) 60%, #2fd5ff);
  --a3: color-mix(in oklch, var(--accent) 55%, #ff5ccf);
  --a4: color-mix(in oklch, var(--accent) 50%, #7b5cff);
}

/* Surfaces: dark (default) ------------------------------------------------ */
:root {
  --bg: oklch(.215 var(--tc) var(--h));
  --sidebar-bg: oklch(.185 var(--tc) var(--h));
  --panel: oklch(.255 var(--tc) var(--h));
  --panel-solid: oklch(.255 var(--tc) var(--h));
  --composer-bg: oklch(.262 var(--tc) var(--h));
  --text: oklch(.955 calc(var(--tc) * .5) var(--h));
  --muted: oklch(.74 calc(var(--tc) * .8) var(--h));
  --faint: oklch(.58 var(--tc) var(--h));
  --assistant-text: var(--text);

  --line: color-mix(in oklab, var(--text) 9%, transparent);
  --line-strong: color-mix(in oklab, var(--text) 15%, transparent);
  --hover: color-mix(in oklab, var(--text) 6.5%, transparent);
  --hover-strong: color-mix(in oklab, var(--text) 10%, transparent);
  --selected: color-mix(in oklab, var(--text) 11%, transparent);
  --press: color-mix(in oklab, var(--text) 14%, transparent);
  --bubble: color-mix(in oklab, var(--text) 8.5%, var(--bg));
  --code-bg: color-mix(in oklab, black 30%, var(--bg));
  --code-head: color-mix(in oklab, var(--text) 4%, var(--code-bg));
  --inline-code: color-mix(in oklab, var(--text) 9%, transparent);
  --accent-soft: color-mix(in oklab, var(--accent) 16%, transparent);
  --accent-ink: color-mix(in oklab, var(--accent) 82%, var(--text));
  --danger: #ff6961;
  --danger-soft: color-mix(in oklab, #ff6961 14%, transparent);
  --success: #4cd17f;
  --backdrop: rgba(0, 0, 0, .48);
  --topbar-bg: color-mix(in oklab, var(--bg) 82%, transparent);
  --composer-line: color-mix(in oklab, var(--text) 11%, transparent);
  --composer-line-focus: color-mix(in oklab, var(--text) 20%, transparent);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-md: 0 0 0 .5px rgba(0, 0, 0, .35), 0 6px 16px -4px rgba(0, 0, 0, .45), 0 2px 6px -2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 0 0 .5px rgba(0, 0, 0, .4), 0 24px 64px -12px rgba(0, 0, 0, .65), 0 8px 24px -8px rgba(0, 0, 0, .4);
  --composer-shadow: 0 0 0 .5px rgba(0, 0, 0, .25), 0 8px 28px -10px rgba(0, 0, 0, .55);
  --glass-blur: saturate(1.6) blur(22px);
}

html[data-mode="light"] {
  color-scheme: light;
  --bg: oklch(.995 calc(var(--tc) * .35) var(--h));
  --sidebar-bg: oklch(.975 calc(var(--tc) * .7) var(--h));
  --panel: oklch(1 0 0);
  --panel-solid: oklch(1 0 0);
  --composer-bg: oklch(1 0 0);
  --text: oklch(.215 calc(var(--tc) * .6) var(--h));
  --muted: oklch(.47 calc(var(--tc) * .8) var(--h));
  --faint: oklch(.62 var(--tc) var(--h));
  --line: color-mix(in oklab, var(--text) 9%, transparent);
  --line-strong: color-mix(in oklab, var(--text) 14%, transparent);
  --hover: color-mix(in oklab, var(--text) 5%, transparent);
  --hover-strong: color-mix(in oklab, var(--text) 8%, transparent);
  --selected: color-mix(in oklab, var(--text) 7.5%, transparent);
  --press: color-mix(in oklab, var(--text) 11%, transparent);
  --bubble: color-mix(in oklab, var(--text) 5.5%, var(--bg));
  --code-bg: color-mix(in oklab, var(--text) 3.5%, var(--bg));
  --code-head: color-mix(in oklab, var(--text) 6%, var(--bg));
  --inline-code: color-mix(in oklab, var(--text) 7%, transparent);
  --accent-soft: color-mix(in oklab, var(--accent) 13%, transparent);
  --accent-ink: color-mix(in oklab, var(--accent) 78%, var(--text));
  --danger: #e5484d;
  --danger-soft: color-mix(in oklab, #e5484d 10%, transparent);
  --success: #2f9e5b;
  --backdrop: rgba(20, 20, 24, .28);
  --composer-line: color-mix(in oklab, var(--text) 12%, transparent);
  --composer-line-focus: color-mix(in oklab, var(--text) 22%, transparent);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .06);
  --shadow-md: 0 0 0 .5px rgba(0, 0, 0, .08), 0 8px 20px -6px rgba(0, 0, 0, .14), 0 2px 6px -2px rgba(0, 0, 0, .06);
  --shadow-lg: 0 0 0 .5px rgba(0, 0, 0, .08), 0 28px 70px -16px rgba(0, 0, 0, .28), 0 10px 24px -10px rgba(0, 0, 0, .12);
  --composer-shadow: 0 0 0 .5px rgba(0, 0, 0, .04), 0 10px 30px -12px rgba(0, 0, 0, .16);
}
html[data-mode="light"][data-theme="graphite"] { --accent: #1f1f1f; --accent-2: #5d5d5d; --on-accent: #fff; }
html[data-mode="light"][data-theme="citrus"] { --accent: #d99a00; --on-accent: #1d1600; }

/* The custom theme writes --bg/--text/--accent/… inline on <html>; the
   derived tokens above follow automatically through color-mix(). */
html[data-theme="custom"] { --panel-solid: color-mix(in oklab, var(--text) 8%, var(--bg)); }
html[data-mode="light"][data-theme="custom"] { --panel-solid: color-mix(in oklab, var(--text) 2%, var(--bg)); }
/* ---------- base --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { height: 100%; background: var(--bg); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs-ui)/1.5 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "palt" 0;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; margin: 0; -webkit-user-select: none; user-select: none; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
kbd { font-family: var(--font-ui); }
::selection { background: color-mix(in oklab, var(--accent) 34%, transparent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid color-mix(in oklab, var(--accent) 70%, transparent); outline-offset: 2px; }

.material-symbols-rounded {
  font-family: "Material Symbols Rounded";
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  flex: none;
  width: 1em;
  height: 1em;
  overflow: hidden;
  -webkit-font-feature-settings: "liga";
  font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
}

.visually-hidden, .sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}

/* Thin, quiet scrollbars everywhere. */
* { scrollbar-width: thin; scrollbar-color: color-mix(in oklab, var(--text) 18%, transparent) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: color-mix(in oklab, var(--text) 16%, transparent); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background-color: color-mix(in oklab, var(--text) 28%, transparent); }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }

/* Generic controls -------------------------------------------------------- */
.icon-button {
  display: inline-grid;
  place-items: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: var(--r-md);
  color: var(--muted);
  transition: background-color .16s var(--ease-out), color .16s var(--ease-out), transform .3s var(--spring-snappy), opacity .2s;
}
.icon-button:hover { background: var(--hover); color: var(--text); }
.icon-button:active { background: var(--press); transform: scale(.94); transition-duration: .08s; }
.icon-button:disabled { opacity: .38; pointer-events: none; }

.button-primary, .button-secondary, .button-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  font-weight: 560;
  font-size: var(--fs-ui);
  transition: background-color .16s, transform .3s var(--spring-snappy), opacity .2s;
}
.button-primary { background: var(--text); color: var(--bg); }
.button-primary:hover { background: color-mix(in oklab, var(--text) 86%, var(--bg)); }
.button-secondary { background: var(--hover-strong); color: var(--text); }
.button-secondary:hover { background: var(--press); }
.button-danger { background: var(--danger); color: #fff; }
.button-danger:hover { background: color-mix(in oklab, var(--danger) 88%, black); }
.button-primary:active, .button-secondary:active, .button-danger:active { transform: scale(.96); transition-duration: .08s; }

.switch {
  position: relative;
  flex: none;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--press);
  transition: background-color .25s var(--ease-out);
}
.switch span {
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3), 0 0 0 .5px rgba(0, 0, 0, .06);
  transition: transform .44s var(--spring-snappy), width .2s var(--ease-out);
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] span { transform: translateX(18px); }
.switch:active span { width: 24px; }
.switch[aria-checked="true"]:active span { transform: translateX(14px); }

/* ---------- app shell ---------------------------------------------------- */
.app-shell {
  --sp: 1;
  --sidebar-width: var(--boot-sidebar-width, 280px);
  --sidebar-current-width: var(--sidebar-width);
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: var(--sidebar-current-width) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  background: var(--bg);
}
.app-shell[data-sidebar="closed"] { --sp: 0; --sidebar-current-width: var(--rail-w); }
html[data-sidebar-boot="closed"] .app-shell { --sp: 0; --sidebar-current-width: var(--rail-w); }

/* ---------- sidebar ------------------------------------------------------ */
.sidebar {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  z-index: 20;
  min-width: 0;
  height: calc(100% - var(--frame) * 2);
  margin: var(--frame) 0;
  overflow: hidden;
  border-radius: 0 28px 28px 0;
  background: linear-gradient(to bottom, color-mix(in oklab, var(--text) 2.5%, transparent), transparent 32%), var(--sidebar-bg);
  box-shadow: 0 0 0 1px var(--line), 14px 0 40px -20px rgba(0, 0, 0, .55);
}
html[data-mode="light"] .sidebar { box-shadow: 0 0 0 1px var(--line), 12px 0 32px -18px rgba(0, 0, 0, .14); }
.app-shell[data-sidebar="closed"] .sidebar { border-radius: 0 22px 22px 0; }
.sidebar-panel {
  position: absolute;
  inset: 0 auto 0 0;
  width: max(var(--sidebar-current-width), var(--sidebar-min));
  display: flex;
  flex-direction: column;
  opacity: clamp(0, calc((var(--sp) - .38) / .5), 1);
  transform: translate3d(calc((var(--sp) - 1) * 28px), 0, 0);
  will-change: opacity, transform;
}
.app-shell[data-sidebar="closed"]:not(.is-sidebar-moving) .sidebar-panel { visibility: hidden; }

.sidebar-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--topbar-h);
  padding: 0 10px 0 18px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 8px 0 6px;
  margin-left: -6px;
  border-radius: var(--r-md);
  transition: background-color .16s;
}
.brand:hover { background: var(--hover); }
.brand-logo { display: block; width: auto; height: 32px; }

.sidebar-nav {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 2px 8px 10px;
}
.sidebar-action {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: var(--row-h);
  padding: 0 12px;
  border-radius: var(--r-md);
  color: var(--text);
  font-size: var(--fs-ui);
  text-align: left;
  transition: background-color .14s var(--ease-out), transform .3s var(--spring-snappy);
}
.sidebar-action .material-symbols-rounded { font-size: 20px; color: var(--muted); }
.sidebar-action:hover { background: var(--hover); }
.sidebar-action:active { background: var(--press); transform: scale(.985); transition-duration: .08s; }
.sidebar-action-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-kbd, .menu-kbd {
  flex: none;
  font: 500 var(--fs-tiny)/1 var(--font-ui);
  color: var(--faint);
  letter-spacing: .04em;
  opacity: 0;
  transition: opacity .16s;
}
.sidebar-action:hover .sidebar-kbd, .sidebar-action:focus-visible .sidebar-kbd { opacity: 1; }
.menu-kbd { opacity: 1; margin-left: auto; }
html.is-touch .sidebar-kbd, html.is-touch .menu-kbd, html.is-touch kbd.sidebar-kbd { display: none; }

.sidebar-scroll-region {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 8px 18px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(to bottom, #000 0, #000 calc(100% - 24px), transparent);
}
.sidebar-scroll-region.is-scrolled {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18px, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(to bottom, transparent 0, #000 18px, #000 calc(100% - 24px), transparent);
}

/* Session list ------------------------------------------------------------ */
.session-list { display: flex; flex-direction: column; gap: 1px; }
.session-group-label {
  position: relative;
  padding: 18px 12px 6px;
  color: var(--faint);
  font-size: var(--fs-tiny);
  font-weight: 560;
  letter-spacing: .02em;
}
.session-group-label:first-child { padding-top: 6px; }
.session-item {
  position: relative;
  display: flex;
  align-items: center;
  height: var(--row-h);
  border-radius: var(--r-md);
  transition: background-color .14s var(--ease-out);
}
.session-item:hover, .session-item.is-menu-open { background: var(--hover); }
.session-item.is-active { background: var(--selected); }
.session-main {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px 0 12px;
  text-align: left;
  color: var(--text);
  font-size: var(--fs-ui);
  border-radius: inherit;
}
.session-main > span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  -webkit-mask-image: linear-gradient(to left, transparent 0, #000 22px);
  mask-image: linear-gradient(to left, transparent 0, #000 22px);
}
.session-main small { display: none; }
.session-pin-dot { font-size: 14px !important; color: var(--faint); margin-right: 4px; vertical-align: -2px; }
.session-item.is-unread .session-main > span { font-weight: 600; }
.session-tail {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 4px;
}
.session-status { flex: none; width: 8px; height: 8px; margin: 0 6px; border-radius: 50%; }
.session-status.is-idle { display: none; }
.session-status.is-done { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.session-status.is-pending {
  width: 14px; height: 14px;
  margin: 0 3px;
  background: conic-gradient(from 0deg, transparent 0 25%, var(--accent) 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  animation: spin .9s linear infinite;
}
.session-more {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  color: var(--muted);
  opacity: 0;
  transition: opacity .14s, background-color .14s;
}
.session-more .material-symbols-rounded { font-size: 18px; }
.session-more:hover { background: var(--hover-strong); color: var(--text); }
.session-item:hover .session-more,
.session-item:focus-within .session-more,
.session-item.is-menu-open .session-more,
.session-item.is-active .session-more { opacity: 1; }
html.is-touch .session-item:not(.is-active) .session-more { display: none; }
.session-item:hover .session-status.is-done,
.session-item.is-menu-open .session-status.is-done { display: none; }
.session-time, .session-actions, .session-tail-top { display: contents; }
.session-action { display: none; }
.session-empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--faint);
  font-size: var(--fs-small);
}

.session-rename-form { flex: 1; display: flex; padding: 0 4px; }
.session-rename-form input {
  width: 100%;
  height: 30px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  border: 1px solid color-mix(in oklab, var(--accent) 60%, transparent);
  background: var(--bg);
  box-shadow: 0 0 0 3px var(--accent-soft);
  font-size: var(--fs-ui);
  outline: none;
}

/* Sidebar footer / account ------------------------------------------------ */
.sidebar-foot { flex: none; position: relative; padding: 8px; }
.account-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 52px;
  padding: 0 10px 0 6px;
  border-radius: var(--r-lg);
  text-align: left;
  transition: background-color .14s, transform .3s var(--spring-snappy);
}
.account-button:hover, .account-button[aria-expanded="true"] { background: var(--hover); }
.account-button:active { transform: scale(.985); transition-duration: .08s; }
.account-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: var(--on-accent);
  font-weight: 650;
  font-size: 14px;
  background-size: cover;
  background-position: center;
}
.account-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.account-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.account-copy strong, .account-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-copy strong { font-size: var(--fs-ui); font-weight: 600; }
.account-copy small { font-size: var(--fs-tiny); color: var(--muted); }
.account-button-chevron { font-size: 18px !important; color: var(--faint); }

/* ---------- rail (collapsed sidebar) ------------------------------------ */
.sidebar-rail {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 8px 0;
  opacity: clamp(0, calc((.26 - var(--sp)) / .26), 1);
  transform: translate3d(calc(var(--sp) * -14px), 0, 0);
}
.app-shell[data-sidebar="open"]:not(.is-sidebar-moving) .sidebar-rail { visibility: hidden; }
.rail-action {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: var(--row-h);
  border-radius: var(--r-md);
  color: var(--muted);
  transition: background-color .14s, color .14s, transform .3s var(--spring-snappy);
}
.rail-action:hover { background: var(--hover); color: var(--text); }
.rail-action:active { transform: scale(.92); transition-duration: .08s; }
.rail-open { height: 40px; margin-bottom: 9px; }
.rail-account { height: 52px; width: 52px; border-radius: var(--r-lg); }
.rail-brand, .rail-open-icon { grid-area: 1 / 1; transition: opacity .18s var(--ease-out), transform .3s var(--spring-snappy); }
.rail-brand { width: 24px; height: auto; }
.rail-open-icon { opacity: 0; transform: scale(.8); }
.rail-open:hover .rail-brand, .rail-open:focus-visible .rail-brand { opacity: 0; transform: scale(.8); }
.rail-open:hover .rail-open-icon, .rail-open:focus-visible .rail-open-icon { opacity: 1; transform: none; }
.rail-spacer { flex: 1; }
.rail-account .account-avatar { width: 30px; height: 30px; font-size: 13px; }

/* ---------- resizer ----------------------------------------------------- */
.sidebar-resizer {
  position: absolute;
  z-index: 25;
  top: 0;
  bottom: 0;
  left: calc(var(--sidebar-current-width) - 5px);
  width: 10px;
  cursor: col-resize;
  touch-action: none;
  outline: none;
}
.sidebar-resizer-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 4px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0;
  transform: scaleY(.6);
  transition: opacity .2s var(--ease-out), transform .45s var(--spring-snappy);
}
.sidebar-resizer:hover .sidebar-resizer-line,
.sidebar-resizer:focus-visible .sidebar-resizer-line,
body.is-resizing-sidebar .sidebar-resizer-line { opacity: .55; transform: none; transition-delay: .12s, 0s; }
body.is-resizing-sidebar .sidebar-resizer-line { opacity: .9; transition-delay: 0s; }
body.is-resizing-sidebar,
body.is-resizing-sidebar * { cursor: col-resize !important; -webkit-user-select: none !important; user-select: none !important; }
body.is-resizing-sidebar.is-resize-at-min, body.is-resizing-sidebar.is-resize-at-min * { cursor: e-resize !important; }
body.is-resizing-sidebar.is-resize-at-max, body.is-resizing-sidebar.is-resize-at-max * { cursor: w-resize !important; }
body.is-sidebar-collapse-target .sidebar-resizer-line { background: var(--muted); }
.app-shell[data-sidebar="closed"] .sidebar-resizer { cursor: e-resize; }

.mobile-sidebar-backdrop { display: none; }

/* ---------- popover menus ----------------------------------------------- */
.popover-menu {
  position: fixed;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  min-width: 220px;
  max-width: calc(100vw - 24px);
  padding: 6px;
  border-radius: var(--r-lg);
  background: color-mix(in oklab, var(--panel-solid) 88%, transparent);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line);
  color: var(--text);
  overflow-y: auto;
  overscroll-behavior: contain;
  transform-origin: var(--origin, top right);
  opacity: 1;
  transform: none;
  transition:
    opacity .16s var(--ease-out),
    transform var(--dur-snappy) var(--spring-snappy),
    display .16s allow-discrete,
    overlay .16s allow-discrete;
}
.popover-menu[hidden] {
  opacity: 0;
  transform: scale(.97);
  transition-duration: .12s, .14s, .14s, .14s;
  transition-timing-function: var(--ease-in);
}
@starting-style {
  .popover-menu:not([hidden]) { opacity: 0; transform: scale(.94) translateY(var(--enter-y, -4px)); }
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: var(--fs-ui);
  text-align: left;
  white-space: nowrap;
  transition: background-color .1s;
}
.menu-item > .material-symbols-rounded:first-child { font-size: 19px; color: var(--muted); }
.menu-item:hover, .menu-item:focus-visible, .menu-item.is-focused { background: var(--hover-strong); outline: none; }
.menu-item:active { background: var(--press); }
.menu-item.is-danger, .menu-item.is-danger > .material-symbols-rounded:first-child { color: var(--danger); }
.menu-item.is-danger:hover { background: var(--danger-soft); }
.menu-item-trail { margin-left: auto; font-size: 16px !important; color: var(--faint); }
.menu-item > span:not(.material-symbols-rounded) { overflow: hidden; text-overflow: ellipsis; }
.menu-separator { height: 1px; margin: 5px 8px; background: var(--line); flex: none; }
.menu-label { padding: 8px 10px 4px; color: var(--faint); font-size: var(--fs-tiny); font-weight: 560; }

/* Account menu ------------------------------------------------------------ */
.account-menu { width: 280px; --origin: bottom left; --enter-y: 6px; }
.account-menu-head { display: flex; align-items: center; gap: 12px; padding: 8px 8px 10px; }
.avatar-edit-trigger { position: relative; flex: none; border-radius: 50%; }
.avatar-edit-trigger .account-avatar { width: 40px; height: 40px; font-size: 17px; }
.avatar-edit-badge {
  position: absolute;
  right: -3px;
  bottom: -3px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--panel-solid);
  color: var(--text);
  box-shadow: 0 0 0 1px var(--line-strong);
  transition: transform .3s var(--spring-bouncy);
}
.avatar-edit-badge .material-symbols-rounded { font-size: 12px; }
.avatar-edit-trigger:hover .avatar-edit-badge { transform: scale(1.12); }
.account-menu-user-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.account-menu-user-copy strong { font-size: calc(15px * var(--ui-scale)); font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-menu-user-copy small { font-size: var(--fs-small); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-quota {
  margin: 0 4px 6px;
  padding: 10px 12px 10px;
  border-radius: var(--r-md);
  background: var(--hover);
}
.account-quota-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: var(--fs-small); }
.account-quota-heading strong { font-weight: 620; }
.account-quota-heading span { color: var(--muted); font-variant-numeric: tabular-nums; }
.account-quota-meter { height: 5px; margin: 8px 0 6px; border-radius: 99px; background: var(--hover-strong); overflow: hidden; }
.account-quota-meter span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .8s var(--spring-gentle); }
.account-quota-summary { display: flex; justify-content: space-between; font-size: var(--fs-tiny); color: var(--muted); font-variant-numeric: tabular-nums; }
.account-quota p { margin: 4px 0 0; font-size: var(--fs-tiny); color: var(--faint); line-height: 1.45; }
.account-quota p:empty { display: none; }

/* ---------- topbar ------------------------------------------------------ */
.chat-main {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  isolation: isolate;
}
.chat-topbar {
  position: absolute;
  z-index: 30;
  top: var(--frame);
  left: 0;
  right: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 10px 0 16px;
  padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
  background: transparent;
  transition: background-color .25s var(--ease-out), box-shadow .25s var(--ease-out);
}
.chat-topbar::before {
  content: "";
  position: absolute;
  inset: calc(var(--frame) * -1) 0 0;
  z-index: -1;
  background: var(--topbar-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: 0 1px 0 var(--line);
  opacity: 0;
  transition: opacity .25s var(--ease-out);
}
.chat-main.is-scrolled .chat-topbar::before { opacity: 1; }
.topbar-sidebar-button { display: none; }
.title-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 2px;
}
.chat-title {
  min-width: 0;
  max-width: 100%;
  padding: 6px 8px;
  margin-left: -8px;
  border-radius: var(--r-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: calc(15px * var(--ui-scale));
  font-weight: 560;
  cursor: default;
  transition: background-color .14s, opacity .3s var(--ease-out), transform .45s var(--spring-snappy);
}
.chat-title:hover { background: var(--hover); }
.chat-title.is-renaming {
  cursor: text;
  text-overflow: clip;
  background: var(--bg);
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--accent) 60%, transparent), 0 0 0 4px var(--accent-soft);
}
.chat-title.is-swapping { opacity: 0; transform: translateY(-4px); transition: none; }
.app-shell[data-empty="true"] .chat-title, .app-shell[data-empty="true"] .title-rename { opacity: 0; pointer-events: none; }
.title-rename { width: 30px; height: 30px; opacity: 0; }
.title-rename .material-symbols-rounded { font-size: 17px; }
.title-wrap:hover .title-rename, .title-rename:focus-visible { opacity: 1; }
.topbar-actions { flex: none; display: flex; align-items: center; gap: 2px; }
.topbar-new-chat { display: none; }
.quota-pill {
  height: 28px;
  padding: 0 11px;
  margin-right: 6px;
  border-radius: 999px;
  color: var(--muted);
  font-size: var(--fs-tiny);
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 0 0 1px var(--line);
  white-space: nowrap;
  transition: background-color .14s, color .14s, transform .3s var(--spring-snappy);
}
.quota-pill:hover { background: var(--hover); color: var(--text); }
.quota-pill:active { transform: scale(.96); }
.mobile-chat-menu { position: absolute; top: calc(var(--topbar-h) + env(safe-area-inset-top) - 4px); right: 10px; --origin: top right; }
.menu-theme-row { display: flex; justify-content: space-between; gap: 4px; padding: 4px 12px 10px; }
.menu-theme-dot {
  position: relative;
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
  transition: transform .35s var(--spring-bouncy), box-shadow .2s;
}
.menu-theme-dot:hover { transform: scale(1.15); }
.menu-theme-dot[aria-checked="true"] { box-shadow: 0 0 0 2px var(--panel-solid), 0 0 0 3.5px var(--text); }
.mobile-title { display: none; }

/* ---------- tooltip & toast --------------------------------------------- */
.chat-tooltip {
  position: fixed;
  z-index: 3000;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  padding: 5px 9px;
  border-radius: var(--r-sm);
  background: color-mix(in oklab, var(--text) 92%, var(--bg));
  color: var(--bg);
  font-size: var(--fs-tiny);
  font-weight: 560;
  line-height: 1.3;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  opacity: 1;
  transform: translate3d(var(--tx, 0), var(--ty, 0), 0);
  transition: opacity .12s var(--ease-out), display .12s allow-discrete;
}
.chat-tooltip[hidden] { opacity: 0; }
@starting-style { .chat-tooltip:not([hidden]) { opacity: 0; } }
.chat-tooltip kbd { opacity: .62; font-weight: 500; letter-spacing: .04em; }

.chat-toast {
  position: fixed;
  z-index: 2000;
  top: calc(env(safe-area-inset-top) + 14px);
  left: 50%;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(440px, calc(100vw - 32px));
  padding: 10px 16px 10px 12px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--panel-solid) 90%, transparent);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line);
  font-size: var(--fs-ui);
  font-weight: 520;
  transform: translate3d(-50%, 0, 0) scale(.9);
  opacity: 0;
  transition: transform var(--dur-bouncy) var(--spring-bouncy), opacity .2s var(--ease-out);
}
.chat-toast::before {
  font-family: "Material Symbols Rounded";
  content: "check_circle";
  font-size: 20px;
  line-height: 1;
  color: var(--success);
  -webkit-font-feature-settings: "liga";
  font-feature-settings: "liga";
}
.chat-toast[data-type="error"]::before { content: "error"; color: var(--danger); }
.chat-toast.is-visible { opacity: 1; transform: translate3d(-50%, 0, 0) scale(1); }
/* ---------- conversation ------------------------------------------------ */
.messages {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: calc(var(--frame) + var(--topbar-h) + env(safe-area-inset-top) + 8px) var(--gutter) calc(var(--dock-h) + 40px);
  scroll-padding-top: calc(var(--topbar-h) + 16px);
  scroll-padding-bottom: calc(var(--dock-h) + 24px);
  -webkit-overflow-scrolling: touch;
  /* Content dissolves as it slides under the composer, so the aurora
     behind it reaches the bottom edge untouched. */
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - var(--dock-h) - 28px), rgba(0, 0, 0, .12) calc(100% - var(--dock-h) * .55), transparent calc(100% - var(--dock-h) * .3));
  mask-image: linear-gradient(to bottom, #000 calc(100% - var(--dock-h) - 28px), rgba(0, 0, 0, .12) calc(100% - var(--dock-h) * .55), transparent calc(100% - var(--dock-h) * .3));
}
.messages > .message,
.messages > .message-day {
  width: 100%;
  max-width: var(--column-w);
  margin-inline: auto;
}
.messages.is-switching > .message { animation: messageSwitchIn .38s var(--ease-out) both; }
.messages.is-switching > .message:nth-last-child(2) { animation-delay: .03s; }
.messages.is-switching > .message:nth-last-child(1) { animation-delay: .06s; }
@keyframes messageSwitchIn {
  from { opacity: 0; transform: translateY(10px); }
}

/* Empty state ------------------------------------------------------------- */
.empty-state {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% - var(--empty-dock-top, 46%) + 30px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 0 var(--gutter);
  text-align: center;
  pointer-events: none;
}
.app-shell[data-empty="false"] .empty-state { display: none; }
.empty-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
}
.empty-mark::before {
  content: "";
  position: absolute;
  inset: -34px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, var(--a1), var(--a2), var(--a3), var(--a4), var(--a1));
  -webkit-mask: radial-gradient(closest-side, #000, transparent);
  mask: radial-gradient(closest-side, #000, transparent);
  filter: blur(10px);
  opacity: .9;
  animation: emptyGlow 6s ease-in-out infinite;
}
.empty-logo { position: relative; width: 44px; height: auto; display: block; animation: emptyFloat 6s ease-in-out infinite; }
@keyframes emptyGlow { 50% { opacity: .55; transform: scale(.88); } }
@keyframes emptyFloat { 50% { transform: translateY(-3px); } }
#greeting-title {
  margin: 0;
  max-width: 20em;
  font: 620 var(--fs-greeting)/1.25 var(--font-display);
  white-space: pre-line;
  text-wrap: balance;
  min-height: 1.25em;
}
#greeting-title { min-height: 2.5em; }
#greeting-title .g-char {
  display: inline-block;
  white-space: pre;
  animation: greetCharIn .16s var(--ease-out) both;
}
@keyframes greetCharIn { from { opacity: 0; transform: translateY(.06em); } }
#greeting-title .greeting-caret {
  display: inline-block;
  width: 3px;
  height: .9em;
  margin-left: 5px;
  vertical-align: -.08em;
  border-radius: 2px;
  background: linear-gradient(to bottom, var(--a2), var(--a3));
  box-shadow: 0 0 10px color-mix(in oklab, var(--a3) 60%, transparent);
}
.empty-state.is-ready .greeting-caret { animation: caretBlink 1.06s steps(1, end) infinite; }
.empty-state.is-exiting .greeting-caret { opacity: 0; transition: opacity .2s; }
@keyframes caretBlink { 50% { opacity: 0; } }
.greeting-measure { position: absolute; left: 0; top: 0; visibility: hidden; white-space: pre; pointer-events: none; }

/* Messages ---------------------------------------------------------------- */
.message { position: relative; margin-top: 28px; }
.messages > .message:first-of-type,
.messages > .empty-state + .message { margin-top: 10px; }
.message.user + .message.assistant { margin-top: 20px; }
.message.meta { margin-top: 22px; }
.message.meta + .message { margin-top: 22px; }

.message.user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.message.user .message-body {
  max-width: min(82%, 620px);
  padding: 10px 16px;
  border-radius: 22px;
  background: var(--bubble);
  color: var(--text);
  font-size: var(--fs-user);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.user-message-content.is-collapsed {
  max-height: calc(var(--user-message-visible-lines, 10) * 1.6em);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 2.4em), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 2.4em), transparent);
  transition: max-height .44s var(--spring-smooth);
}
.user-message-expand {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-top: 4px;
  padding: 2px 8px 2px 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: var(--fs-small);
  font-weight: 560;
}
.user-message-expand:hover { background: var(--hover); color: var(--text); }
.user-message-expand .material-symbols-rounded { font-size: 18px; }
.message-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  margin-top: 4px;
  margin-right: -4px;
  opacity: 0;
  transition: opacity .18s var(--ease-out);
}
.message-meta time { color: var(--faint); font-size: var(--fs-tiny); font-variant-numeric: tabular-nums; padding: 0 4px; }
.message.user:hover .message-meta, .message.user:focus-within .message-meta { opacity: 1; }
html.is-touch .message.user .message-meta {
  height: 0;
  margin-top: 0;
  overflow: hidden;
  opacity: 0;
  transition: height .4s var(--spring-snappy), margin-top .4s var(--spring-snappy), opacity .2s;
}
html.is-touch .message.user.is-revealed .message-meta { height: 36px; margin-top: 4px; opacity: 1; }
html.is-touch .message.user .message-body { transition: transform .4s var(--spring-snappy); }
html.is-touch .message.user .message-body:active { transform: scale(.98); }

.message.user.is-arriving .message-body {
  animation: userBubbleIn var(--dur-snappy) var(--spring-snappy) both;
  transform-origin: 100% 100%;
}
@keyframes userBubbleIn {
  from { opacity: 0; transform: translateY(18px) scale(.94); }
}
.message.user.is-arriving .message-meta { animation: fadeIn .4s .2s both; }
.message.user.is-flying .message-body { animation: none; transform-origin: 0 0; }
.message.assistant.is-arriving { animation: assistantIn .5s var(--ease-out) both; animation-delay: .08s; }
@keyframes assistantIn { from { opacity: 0; transform: translateY(6px); } }
@keyframes fadeIn { from { opacity: 0; } }

/* Assistant body: markdown typography ------------------------------------ */
.message.assistant .message-body {
  color: var(--assistant-text);
  font-family: var(--font-reply);
  font-size: var(--fs-reply);
  line-height: 1.75;
  overflow-wrap: anywhere;
  letter-spacing: .003em;
}
.message-body > :first-child { margin-top: 0 !important; }
.message-body > :last-child { margin-bottom: 0 !important; }
.message.assistant .message-body p { margin: 0 0 .85em; }
.message.assistant .message-body h1,
.message.assistant .message-body h2,
.message.assistant .message-body h3,
.message.assistant .message-body h4 {
  margin: 1.5em 0 .55em;
  font-family: var(--font-display);
  font-weight: 640;
  line-height: 1.35;
}
.message.assistant .message-body h1 { font-size: 1.42em; }
.message.assistant .message-body h2 { font-size: 1.24em; }
.message.assistant .message-body h3 { font-size: 1.1em; }
.message.assistant .message-body h4 { font-size: 1em; }
.message.assistant .message-body ul,
.message.assistant .message-body ol { margin: .2em 0 .95em; padding-left: 1.55em; }
.message.assistant .message-body li { margin: .32em 0; padding-left: .2em; }
.message.assistant .message-body li > p { margin: 0 0 .4em; }
.message.assistant .message-body li::marker { color: var(--faint); }
.message.assistant .message-body ol > li::marker { font-variant-numeric: tabular-nums; font-weight: 560; }
.message.assistant .message-body strong { font-weight: 650; }
.message.assistant .message-body a { color: var(--accent-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; text-decoration-color: color-mix(in oklab, var(--accent) 45%, transparent); }
.message.assistant .message-body a:hover { text-decoration-color: currentColor; }
.message.assistant .message-body hr { border: 0; height: 1px; margin: 1.6em 0; background: var(--line); }
.message.assistant .message-body blockquote,
.message-blockquote {
  margin: 1em 0;
  padding: .1em 0 .1em 1em;
  border-left: 3px solid color-mix(in oklab, var(--accent) 55%, transparent);
  color: var(--muted);
}
.message-body :not(pre) > code {
  padding: .12em .38em;
  border-radius: 6px;
  background: var(--inline-code);
  font-family: var(--font-mono);
  font-size: .86em;
  overflow-wrap: anywhere;
}
.message-task-item { list-style: none; margin-left: -1.3em !important; }
.message-task-item input { margin: 0 .5em 0 0; accent-color: var(--accent); vertical-align: -1px; }

/* Code blocks -------------------------------------------------------------- */
.message-code-block {
  margin: 1.1em 0;
  border-radius: var(--r-lg);
  background: var(--code-bg);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow: hidden;
  font-family: var(--font-ui);
}
.message-code-block figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 38px;
  padding: 0 6px 0 16px;
  background: var(--code-head);
  color: var(--muted);
  font-size: var(--fs-tiny);
  font-weight: 560;
  letter-spacing: .02em;
  text-transform: lowercase;
}
.code-copy-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 8px;
  border-radius: var(--r-sm);
  color: var(--muted);
  transition: background-color .14s, color .14s;
}
.code-copy-button:hover { background: var(--hover-strong); color: var(--text); }
.code-copy-button .material-symbols-rounded { font-size: 16px; }
.message-code-block pre {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  margin: 0;
  padding: 14px 0 16px;
  overflow-x: auto;
  font: 400 calc(13.5px * var(--reply-scale))/1.65 var(--font-mono);
  tab-size: 2;
}
.code-line-gutter {
  display: flex;
  flex-direction: column;
  padding: 0 14px 0 16px;
  color: var(--faint);
  opacity: .55;
  text-align: right;
  font-variant-numeric: tabular-nums;
  -webkit-user-select: none;
  user-select: none;
}
.message-code-block pre code,
.message-code-block pre code.hljs { display: block; padding: 0 18px 0 0; overflow: visible; background: none !important; color: var(--text); white-space: pre; font-family: var(--font-mono); }
.message-code-block pre:not(:has(.code-line-gutter)) code { padding-left: 18px; }

/* highlight.js tokens tuned for both modes */
.hljs { background: transparent !important; color: var(--text) !important; }
.hljs-comment, .hljs-quote { color: var(--faint); font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-literal, .hljs-type, .hljs-doctag { color: #ff7aa8; }
.hljs-string, .hljs-regexp, .hljs-addition, .hljs-attribute, .hljs-meta .hljs-string { color: #9fdc8d; }
.hljs-number, .hljs-built_in, .hljs-symbol, .hljs-bullet { color: #f8b86d; }
.hljs-title, .hljs-title.function_, .hljs-section, .hljs-name { color: #7cc4ff; }
.hljs-attr, .hljs-variable, .hljs-template-variable, .hljs-property, .hljs-params { color: #c9b6ff; }
.hljs-meta, .hljs-selector-id, .hljs-selector-class { color: #6fd6d0; }
.hljs-deletion { color: #ff8b85; }
.hljs-subst, .hljs-punctuation, .hljs-operator { color: inherit !important; }
html[data-mode="light"] .hljs-keyword, html[data-mode="light"] .hljs-selector-tag, html[data-mode="light"] .hljs-literal, html[data-mode="light"] .hljs-type, html[data-mode="light"] .hljs-doctag { color: #c1235f; }
html[data-mode="light"] .hljs-string, html[data-mode="light"] .hljs-regexp, html[data-mode="light"] .hljs-addition, html[data-mode="light"] .hljs-attribute { color: #237a2c; }
html[data-mode="light"] .hljs-number, html[data-mode="light"] .hljs-built_in, html[data-mode="light"] .hljs-symbol, html[data-mode="light"] .hljs-bullet { color: #b05a00; }
html[data-mode="light"] .hljs-title, html[data-mode="light"] .hljs-title.function_, html[data-mode="light"] .hljs-section, html[data-mode="light"] .hljs-name { color: #0b5cad; }
html[data-mode="light"] .hljs-attr, html[data-mode="light"] .hljs-variable, html[data-mode="light"] .hljs-template-variable, html[data-mode="light"] .hljs-property, html[data-mode="light"] .hljs-params { color: #6b3fc4; }
html[data-mode="light"] .hljs-meta, html[data-mode="light"] .hljs-selector-id, html[data-mode="light"] .hljs-selector-class { color: #0b7a74; }

/* Tables -------------------------------------------------------------------- */
.message-table-wrap {
  margin: 1.1em 0;
  max-width: 100%;
  overflow-x: auto;
  border-radius: var(--r-lg);
  box-shadow: inset 0 0 0 1px var(--line);
}
.message-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .93em;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}
.message-table caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.message-table th, .message-table td { padding: 9px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.message-table th { font-weight: 620; background: var(--hover); white-space: nowrap; }
.message-table tr:last-child td { border-bottom: 0; }
.message-table .align-right { text-align: right; }
.message-table .align-center { text-align: center; }

/* Math --------------------------------------------------------------------- */
.message-math-block { margin: 1em 0; overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.message-math-inline .katex { font-size: 1.04em; }
.message-math-fallback { font-family: var(--font-mono); font-size: .9em; color: var(--muted); }
.katex-display { margin: .8em 0 !important; overflow-x: auto; overflow-y: hidden; }

/* Images ------------------------------------------------------------------- */
.message-image-wrap {
  position: relative;
  display: inline-block;
  max-width: min(100%, 520px);
  margin: .4em 0;
  border-radius: var(--r-xl);
  overflow: hidden;
  cursor: zoom-in;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .45s var(--spring-snappy);
}
.message-image-wrap:active { transform: scale(.985); }
.message-image { display: block; width: 100%; height: auto; }
.message-image-download {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  color: #fff;
  opacity: 0;
  transform: scale(.9);
  transition: opacity .18s, transform .3s var(--spring-snappy);
}
.message-image-download .material-symbols-rounded { font-size: 18px; }
.message-image-wrap:hover .message-image-download, html.is-touch .message-image-download { opacity: 1; transform: none; }

/* Actions under replies -------------------------------------------------- */
.message-actions { display: flex; align-items: center; gap: 0; }
.message.assistant > .message-actions {
  margin: 8px 0 0 -7px;
  height: 32px;
  opacity: 0;
  transition: opacity .2s var(--ease-out);
}
.message.assistant:hover > .message-actions,
.message.assistant:focus-within > .message-actions,
.message.assistant:last-child > .message-actions,
html.is-touch .message.assistant > .message-actions { opacity: 1; }
.message-actions button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  color: var(--faint);
  transition: background-color .12s, color .12s, transform .3s var(--spring-snappy);
}
.message-actions button .material-symbols-rounded { font-size: 18px; }
.message-actions button:hover { background: var(--hover); color: var(--text); }
.message-actions button:active { transform: scale(.88); transition-duration: .06s; }
.message-actions button[data-state="done"] { color: var(--success); }
.message-actions button[data-speech-state="playing"], .message-actions button.is-speaking { color: var(--accent); }
.message-actions button .material-symbols-rounded { transition: transform .35s var(--spring-bouncy), opacity .2s; }
.message-actions button[data-state="done"] .material-symbols-rounded { animation: popIn .45s var(--spring-bouncy); }
@keyframes popIn { from { transform: scale(.4); opacity: 0; } }

.assistant-timing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--faint);
  font-size: var(--fs-small);
  font-weight: 520;
}
.assistant-timing::before {
  content: "";
  width: 14px;
  height: 14px;
  background: url("/chat/brand/mark-96.png?v=2") center / contain no-repeat;
  opacity: .9;
}

.paused-reply { display: inline-flex; align-items: center; gap: 6px; color: var(--faint); font-size: var(--fs-ui); }
.paused-reply .material-symbols-rounded { font-size: 18px; }

/* Inline edit of a sent message ------------------------------------------ */
.message-edit {
  width: min(100%, 680px);
  padding: 10px;
  border-radius: 22px;
  background: var(--bubble);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  animation: assistantIn .3s var(--ease-out);
}
.message-edit textarea {
  display: block;
  width: 100%;
  min-height: 72px;
  max-height: 50vh;
  padding: 4px 6px;
  border: 0;
  background: transparent;
  resize: vertical;
  font-size: var(--fs-user);
  line-height: 1.6;
  outline: none;
}
.message-edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.message-edit-actions button { height: 34px; padding: 0 14px; border-radius: 999px; font-weight: 560; font-size: var(--fs-small); background: var(--hover-strong); }
.message-edit-actions button[type="submit"] { background: var(--text); color: var(--bg); }

/* System notes (model switch) ------------------------------------------- */
.message-system-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--faint);
  font-size: var(--fs-small);
}
.message-system-note::before, .message-system-note::after { content: ""; flex: 1; max-width: 120px; height: 1px; background: var(--line); }
.model-switch-icon { font-size: 16px !important; }
.model-switch-info { position: relative; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 11px; font-weight: 700; color: var(--muted); }
.model-switch-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  width: 240px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  background: var(--panel-solid);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line);
  color: var(--muted);
  font-size: var(--fs-tiny);
  font-weight: 450;
  line-height: 1.5;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px) scale(.96);
  transition: opacity .15s, transform .3s var(--spring-snappy);
}
.model-switch-info.is-open .model-switch-popover, .model-switch-info:hover .model-switch-popover { opacity: 1; transform: translate(-50%, 0); }

/* ---------- thinking ---------------------------------------------------- */
.message-body.is-thinking {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-height: 30px;
  font-family: var(--font-ui);
  animation: thinkingIn .5s var(--ease-out) both;
}
@keyframes thinkingIn { from { opacity: 0; transform: translateY(4px); } }
.thinking-mark {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-top: -1px;
}
.thinking-aura {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in oklab, var(--a2) 42%, transparent), color-mix(in oklab, var(--a1) 18%, transparent) 55%, transparent 78%);
  animation: thinkingAura 2.6s ease-in-out infinite;
}
.thinking-ribbon {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
}
.thinking-ribbon.is-outer {
  background: conic-gradient(from 0deg, transparent 0 12%, var(--a1) 36%, var(--a2) 58%, var(--a3) 80%, var(--a4) 94%, transparent 100%);
  animation: spin 1.15s linear infinite;
}
.thinking-ribbon.is-inner {
  inset: 4px;
  opacity: .5;
  background: conic-gradient(from 180deg, transparent 0 40%, var(--a4) 70%, var(--a2) 90%, transparent 100%);
  animation: spin 1.9s linear infinite reverse;
}
.thinking-core { position: relative; display: grid; place-items: center; width: 16px; height: 16px; animation: thinkingBreathe 2.2s ease-in-out infinite; }
.thinking-core img { width: 15px; height: auto; display: block; }
@keyframes thinkingAura { 0%, 100% { opacity: .55; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.08); } }
@keyframes thinkingBreathe { 0%, 100% { transform: scale(.9); } 50% { transform: scale(1.04); } }
@keyframes spin { to { transform: rotate(360deg); } }

.thinking-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; padding-top: 4px; }
.thinking-heading { display: inline-flex; align-items: baseline; gap: 8px; line-height: 22px; }
.thinking-label {
  font-size: var(--fs-ui);
  font-weight: 560;
  color: var(--muted);
  background: linear-gradient(100deg, var(--muted) 0%, var(--muted) 38%, var(--text) 50%, var(--muted) 62%, var(--muted) 100%);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: shimmer 2.1s linear infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0% 0; } }
.thinking-dots { display: none; }
.thinking-elapsed { color: var(--faint); font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.thinking-elapsed:empty { display: none; }
.thinking-progress { display: block; min-height: 20px; }
.thinking-progress-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--faint);
  font-size: var(--fs-small);
  line-height: 20px;
}
.thinking-progress-icon { font-size: 15px !important; }
.thinking-progress-row.is-done .thinking-progress-icon { color: var(--success); }
.thinking-wait-note { margin-top: 2px; color: var(--faint); font-size: var(--fs-tiny); }

/* Typing caret that rides the end of a reply while it is typed. */
.stream-fade { animation: streamFade .42s var(--ease-out) both; }
@keyframes streamFade { from { opacity: 0; } }
.stream-caret {
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: -.16em;
  border-radius: 1px;
  background: linear-gradient(to bottom, var(--a1), var(--a3));
  box-shadow: 0 0 8px color-mix(in oklab, var(--a2) 70%, transparent);
}
@keyframes caretPulse { 50% { transform: scale(.6); opacity: .5; } }

/* ---------- minimap ------------------------------------------------------ */
.message-minimap {
  position: absolute;
  z-index: 12;
  top: 50%;
  right: 10px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  max-height: 56vh;
  padding: 10px 6px;
  transform: translateY(-50%);
  overflow: visible;
}
.minimap-mark {
  position: relative;
  width: 18px;
  height: 8px;
  border-radius: 4px;
}
.minimap-mark::before {
  content: "";
  position: absolute;
  right: 0;
  top: 3px;
  width: 12px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  opacity: var(--mark-opacity, .28);
  transform: scaleX(var(--mark-scale, 1));
  transform-origin: right center;
  transition: transform .3s var(--spring-snappy), opacity .2s, background-color .2s;
}
.minimap-mark.is-current::before { background: var(--accent); opacity: 1; }
.minimap-mark.is-pending::before { background: var(--accent); animation: caretPulse 1.2s ease-in-out infinite; }
.minimap-active { position: absolute; display: none; }
.minimap-preview {
  position: absolute;
  right: 34px;
  width: 280px;
  padding: 10px 12px;
  border-radius: var(--r-lg);
  background: color-mix(in oklab, var(--panel-solid) 92%, transparent);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line);
  pointer-events: none;
  animation: fadeIn .14s var(--ease-out);
}
.minimap-preview strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: var(--fs-small); font-weight: 600; }
.minimap-preview p { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 4px 0 0; color: var(--muted); font-size: var(--fs-tiny); line-height: 1.5; }
.minimap-preview p:empty { display: none; }
/* ---------- composer dock ----------------------------------------------- */
.composer-dock {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 var(--gutter) max(12px, env(safe-area-inset-bottom));
  pointer-events: none;
}
.composer-dock > * { pointer-events: auto; }
.app-shell[data-empty="true"] .composer-dock {
  bottom: auto;
  top: var(--empty-dock-top, 46%);
}

.composer {
  position: relative;
  width: 100%;
  max-width: var(--column-w);
  border-radius: var(--r-2xl);
  background: var(--composer-bg);
  box-shadow: var(--composer-shadow), inset 0 0 0 1px var(--composer-line);
  transition: box-shadow .25s var(--ease-out), transform var(--dur-smooth) var(--spring-smooth);
  cursor: text;
}
.composer:focus-within { box-shadow: var(--composer-shadow), inset 0 0 0 1px var(--composer-line-focus); }
.composer.is-drag-over { box-shadow: var(--composer-shadow), inset 0 0 0 1.5px var(--accent), 0 0 0 5px var(--accent-soft); }
.composer.is-drag-over::after {
  content: attr(data-drop-label);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: inherit;
  background: color-mix(in oklab, var(--composer-bg) 86%, transparent);
  color: var(--accent-ink);
  font-weight: 600;
  animation: fadeIn .15s;
}
#prompt {
  display: block;
  width: 100%;
  min-height: 56px;
  max-height: min(40vh, 320px);
  padding: 17px 20px 6px;
  border: 0;
  outline: 0;
  background: transparent;
  resize: none;
  color: var(--text);
  font: 400 var(--fs-composer)/1.55 var(--font-ui);
  caret-color: var(--accent);
  scrollbar-width: thin;
}
#prompt::placeholder { color: var(--faint); opacity: 1; transition: opacity .2s; }
@supports (-webkit-touch-callout: none) { #prompt { font-size: max(16px, var(--fs-composer)); } }
.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px 10px;
  cursor: default;
}
.composer-left, .composer-right { display: flex; align-items: center; gap: 4px; min-width: 0; }
.composer-left { position: relative; flex: 1; }
.composer-right { flex: none; }
.composer-tool {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background-color .14s, color .14s, transform .35s var(--spring-snappy), box-shadow .14s;
}
.composer-tool .material-symbols-rounded { font-size: 21px; transition: transform .45s var(--spring-snappy); }
.composer-tool:hover { background: var(--hover); color: var(--text); }
.composer-tool:active { transform: scale(.9); transition-duration: .08s; }
#attach-button[aria-expanded="true"] { background: var(--hover-strong); color: var(--text); }
#attach-button[aria-expanded="true"] .material-symbols-rounded { transform: rotate(45deg); }
.gpt-live-trigger { box-shadow: none; }

.active-skill-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  max-width: 220px;
  padding: 0 8px 0 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: var(--fs-small);
  font-weight: 600;
  animation: chipIn var(--dur-bouncy) var(--spring-bouncy);
}
.active-skill-chip > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.active-skill-chip .material-symbols-rounded { font-size: 17px; }
.active-skill-remove { opacity: .65; transition: opacity .14s; }
.active-skill-chip:hover .active-skill-remove { opacity: 1; }
@keyframes chipIn { from { opacity: 0; transform: scale(.7); } }

.composer-plus-menu {
  position: absolute;
  left: -4px;
  bottom: calc(100% + 12px);
  min-width: 232px;
  --origin: bottom left;
  --enter-y: 6px;
}
.skills-trigger-dot { display: none; width: 7px; height: 7px; margin-left: auto; border-radius: 50%; background: var(--accent); }
.skills-trigger.is-active .skills-trigger-dot { display: block; }

/* Model picker button */
.model-control { position: relative; }
.model-control-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  max-width: min(46vw, 300px);
  padding: 0 8px 0 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: calc(13.5px * var(--ui-scale));
  font-weight: 560;
  white-space: nowrap;
  transition: background-color .14s, color .14s, transform .35s var(--spring-snappy);
}
.model-control-button:hover, .model-control.is-open .model-control-button { background: var(--hover); color: var(--text); }
.model-control-button:active { transform: scale(.96); transition-duration: .08s; }
.model-control-model { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.model-control-effort { color: var(--faint); font-weight: 500; }
.model-control-effort:empty { display: none; }
.model-control-fast { display: inline-grid; color: var(--accent); }
.model-control-fast .material-symbols-rounded { font-size: 16px; }
.model-control-chevron { font-size: 18px !important; transition: transform .4s var(--spring-snappy); }
.model-control.is-open .model-control-chevron { transform: rotate(180deg); }

/* Send / stop */
.send-button {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .18);
  transition: background-color .22s var(--ease-out), color .22s, transform .4s var(--spring-bouncy), box-shadow .22s, opacity .2s;
}
.send-button .material-symbols-rounded { font-size: 21px; font-variation-settings: "wght" 600; transition: transform .45s var(--spring-bouncy); }
.send-button:hover { transform: scale(1.06); }
.send-button:active { transform: scale(.9); transition-duration: .08s; }
.send-button:disabled, .send-button.is-empty {
  background: var(--hover-strong);
  color: var(--faint);
  box-shadow: none;
  transform: none;
}
.send-button.is-stopping { background: var(--text); color: var(--bg); }
.send-button.is-stopping .material-symbols-rounded { font-size: 18px; animation: iconSwap .4s var(--spring-bouncy); }
.send-button.is-queueing { background: var(--text); color: var(--bg); }
.send-button.is-sent .material-symbols-rounded { animation: sendLift .5s var(--ease-out); }
@keyframes iconSwap { from { transform: scale(.4) rotate(-90deg); opacity: 0; } }
@keyframes sendLift { 40% { transform: translateY(-14px); opacity: 0; } 41% { transform: translateY(14px); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* Queue & attachments ------------------------------------------------------ */
.composer-queue { display: flex; flex-direction: column; gap: 2px; padding: 8px 8px 0; }
.composer-queue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 4px 0 10px;
  border-radius: var(--r-md);
  background: var(--hover);
  color: var(--muted);
  font-size: var(--fs-small);
  animation: queueIn var(--dur-snappy) var(--spring-snappy);
}
.composer-queue-icon { font-size: 16px !important; color: var(--faint); }
.composer-queue-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.composer-queue-remove { display: grid; place-items: center; width: 28px; height: 28px; border-radius: var(--r-sm); color: var(--faint); }
.composer-queue-remove:hover { background: var(--hover-strong); color: var(--text); }
.composer-queue-remove .material-symbols-rounded { font-size: 16px; }
@keyframes queueIn { from { opacity: 0; transform: translateY(6px) scale(.98); } }

.attachment-list {
  display: flex;
  gap: 8px;
  padding: 12px 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.attachment-list::-webkit-scrollbar { display: none; }
.attachment-chip {
  position: relative;
  flex: none;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  width: 220px;
  height: 56px;
  padding: 8px 30px 8px 10px;
  border-radius: var(--r-lg);
  background: var(--hover);
  box-shadow: inset 0 0 0 1px var(--line);
  animation: chipIn var(--dur-bouncy) var(--spring-bouncy);
}
.attachment-chip > .material-symbols-rounded {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 20px;
  line-height: 36px;
  text-align: center;
}
.attachment-chip > span:not(.material-symbols-rounded) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-small); font-weight: 560; align-self: end; }
.attachment-chip > small { color: var(--faint); font-size: var(--fs-tiny); align-self: start; }
.attachment-chip.has-preview { width: auto; grid-template-columns: auto; padding: 0; height: 56px; background: none; }
.attachment-chip.has-preview .attachment-name { display: none; }
.attachment-thumb { display: block; width: 56px; height: 56px; object-fit: cover; border-radius: var(--r-lg); box-shadow: 0 0 0 1px var(--line); }
.attachment-chip.is-uploading::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(100deg, transparent 30%, color-mix(in oklab, var(--text) 10%, transparent) 50%, transparent 70%);
  background-size: 250% 100%;
  animation: shimmer 1.4s linear infinite;
}
.attachment-chip.is-error { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--danger) 50%, transparent); }
.attachment-chip.is-error > .material-symbols-rounded { background: var(--danger); color: #fff; }
.attachment-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  box-shadow: 0 0 0 2px var(--composer-bg);
  opacity: 0;
  transform: scale(.7);
  transition: opacity .15s, transform .3s var(--spring-bouncy);
}
.attachment-remove .material-symbols-rounded { font-size: 14px; }
.attachment-chip:hover .attachment-remove, html.is-touch .attachment-remove, .attachment-remove:focus-visible { opacity: 1; transform: none; }

/* Suggestions + footnote --------------------------------------------------- */
.composer-suggestions {
  display: none;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: var(--column-w);
  margin-top: 18px;
}
.app-shell[data-empty="true"] .composer-suggestions:not(:empty) { display: flex; }
.suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px 0 11px;
  border-radius: 999px;
  color: var(--muted);
  font-size: var(--fs-small);
  font-weight: 520;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background-color .14s, color .14s, transform .35s var(--spring-snappy), box-shadow .14s;
  animation: suggestionIn .6s var(--ease-out) both;
  animation-delay: calc(.12s + var(--i, 0) * 45ms);
}
.suggestion-chip .material-symbols-rounded { font-size: 18px; color: var(--faint); transition: color .14s; }
.suggestion-chip:hover { background: var(--hover); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.suggestion-chip:hover .material-symbols-rounded { color: var(--accent); }
.suggestion-chip:active { transform: scale(.95); transition-duration: .08s; }
@keyframes suggestionIn { from { opacity: 0; transform: translateY(8px); filter: blur(4px); } }
.composer-footnote {
  margin: 8px 0 0;
  color: var(--faint);
  font-size: var(--fs-tiny);
  text-align: center;
  line-height: 16px;
  transition: opacity .3s;
}
.app-shell[data-empty="true"] .composer-footnote { opacity: 0; pointer-events: none; }

/* Scroll-to-latest button */
.scroll-latest {
  position: absolute;
  top: -50px;
  left: 50%;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-left: -18px;
  border-radius: 50%;
  background: color-mix(in oklab, var(--panel-solid) 92%, transparent);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  color: var(--text);
  box-shadow: var(--shadow-md), inset 0 0 0 1px var(--line);
  opacity: 1;
  transform: none;
  transition: opacity .18s var(--ease-out), transform var(--dur-bouncy) var(--spring-bouncy), display .2s allow-discrete;
}
.scroll-latest[hidden] { opacity: 0; transform: translateY(10px) scale(.8); transition-timing-function: var(--ease-in); transition-duration: .15s; }
@starting-style { .scroll-latest:not([hidden]) { opacity: 0; transform: translateY(10px) scale(.8); } }
.scroll-latest .material-symbols-rounded { font-size: 20px; }
.scroll-latest.has-new::after {
  content: "";
  position: absolute;
  top: 1px;
  right: 1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg);
}
.scroll-latest:active { transform: scale(.9); }

/* ---------- model control menu ------------------------------------------ */
.model-control-menu {
  position: fixed;
  z-index: 1000;
  display: block;
  width: 300px;
  padding: 6px;
  border-radius: 18px;
  background: color-mix(in oklab, var(--panel-solid) 92%, transparent);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line);
  overflow: hidden;
  overscroll-behavior: contain;
  transform-origin: bottom right;
  interpolate-size: allow-keywords;
  transition:
    opacity .16s var(--ease-out),
    transform var(--dur-snappy) var(--spring-snappy),
    width .42s var(--spring-snappy),
    height .42s var(--spring-snappy),
    display .16s allow-discrete;
}
.model-control-menu[data-placement="bottom"] { transform-origin: top right; }
.model-control-menu[hidden] { opacity: 0; transform: scale(.96); transition-duration: .12s; transition-timing-function: var(--ease-in); }
@starting-style { .model-control-menu:not([hidden]) { opacity: 0; transform: scale(.93) translateY(8px); } }
.model-control-menu.is-closing { opacity: 0; transform: scale(.96); }
.model-control-page { display: flex; flex-direction: column; gap: 2px; animation: pageIn .38s var(--spring-snappy) both; }
.model-control-page.model-control-overview { animation-name: pageInBack; }
.model-control-menu:not([data-paged]) .model-control-page { animation: none; }
@keyframes pageIn { from { opacity: 0; transform: translateX(18px); } }
@keyframes pageInBack { from { opacity: 0; transform: translateX(-18px); } }

.model-overview-model, .model-overview-effort {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border-radius: var(--r-md);
  text-align: left;
  transition: background-color .12s;
}
.model-overview-model:hover, .model-overview-effort:hover { background: var(--hover-strong); }
.model-overview-model { min-height: 54px; padding: 8px 8px 8px 12px; }
.model-overview-model-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.model-overview-model-copy small, .model-overview-effort small { color: var(--faint); font-size: var(--fs-tiny); font-weight: 560; }
#model-control-current-model { font-size: calc(15px * var(--ui-scale)); font-weight: 620; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-overview-model > .material-symbols-rounded, .model-overview-effort > .material-symbols-rounded { font-size: 18px; color: var(--faint); }
.model-overview-head { display: flex; align-items: center; gap: 2px; }
.model-overview-effort { flex: 1; min-height: 40px; padding: 0 8px 0 12px; }
.model-overview-effort small { flex: none; }
#model-control-current-effort { flex: 1; text-align: right; font-weight: 560; font-size: var(--fs-small); }
.model-overview-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: var(--r-md); color: var(--muted); transition: background-color .12s, color .12s; }
.model-overview-icon:hover { background: var(--hover-strong); color: var(--text); }
.model-overview-icon .material-symbols-rounded { font-size: 19px; }
#model-control-speed-row.is-fast { color: var(--accent); background: var(--accent-soft); }
.model-thinking-row { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 8px 0 12px; font-size: var(--fs-small); font-weight: 560; }
.model-effort-slider-wrap { padding: 6px 12px 4px; }
.model-effort-track { position: relative; height: 28px; --effort-fill: 0%; }
.model-effort-track::before, .model-effort-track::after {
  content: "";
  position: absolute;
  top: 12px;
  left: 0;
  height: 4px;
  border-radius: 4px;
}
.model-effort-track::before { right: 0; background: var(--hover-strong); }
.model-effort-track::after { width: var(--effort-fill); background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .4s var(--spring-snappy); }
.model-effort-stops { position: absolute; inset: 12px 0 auto; height: 4px; display: flex; justify-content: space-between; z-index: 1; pointer-events: none; }
.model-effort-stops i { width: 4px; height: 4px; border-radius: 50%; background: color-mix(in oklab, var(--text) 30%, transparent); }
#model-effort-slider { position: relative; z-index: 2; width: 100%; height: 28px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
#model-effort-slider::-webkit-slider-runnable-track { height: 28px; background: transparent; }
#model-effort-slider::-moz-range-track { height: 28px; background: transparent; }
#model-effort-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35), 0 0 0 .5px rgba(0, 0, 0, .1); transition: transform .3s var(--spring-bouncy); }
#model-effort-slider::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
#model-effort-slider:active::-webkit-slider-thumb { transform: scale(1.12); }
#model-effort-slider:disabled { opacity: .45; cursor: default; }
.model-effort-range-labels { display: flex; justify-content: space-between; margin-top: 2px; color: var(--faint); font-size: var(--fs-tiny); }
.model-overview-quota { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; padding: 10px 12px 8px; border-top: 1px solid var(--line); color: var(--faint); font-size: var(--fs-tiny); }
#model-control-current-quota { color: var(--muted); font-weight: 560; font-variant-numeric: tabular-nums; }

.model-control-page-head { display: flex; align-items: center; gap: 4px; height: 40px; padding: 0 4px 0 0; }
.model-control-page-head button { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-md); color: var(--muted); }
.model-control-page-head button:hover { background: var(--hover-strong); color: var(--text); }
.model-control-page-head strong { font-size: var(--fs-ui); font-weight: 620; }
.model-control-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  margin: 2px 2px 6px;
  padding: 0 10px;
  border-radius: var(--r-md);
  background: var(--hover);
  color: var(--faint);
}
.model-control-search-wrap .material-symbols-rounded { font-size: 18px; }
#model-control-search { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: var(--fs-small); color: var(--text); }
#model-control-search::-webkit-search-cancel-button { display: none; }
.model-control-sources {
  display: flex;
  gap: 6px;
  padding: 0 14px 8px 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent);
}
.model-control-sources::-webkit-scrollbar { display: none; }
.model-source-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px 0 8px;
  border-radius: 999px;
  color: var(--muted);
  font-size: var(--fs-tiny);
  font-weight: 560;
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background-color .14s, color .14s, box-shadow .14s;
}
.model-source-chip img { width: 16px; height: 16px; object-fit: contain; border-radius: 4px; }
.model-source-chip:hover { background: var(--hover); color: var(--text); }
.model-source-chip[aria-pressed="true"] { background: var(--text); color: var(--bg); box-shadow: none; }
.model-control-options { display: flex; flex-direction: column; gap: 1px; max-height: min(52vh, 380px); overflow-y: auto; overscroll-behavior: contain; }
.model-control-group-label { padding: 8px 10px 4px; color: var(--faint); font-size: var(--fs-tiny); font-weight: 560; }
.model-control-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 6px 10px 6px 12px;
  border-radius: var(--r-md);
  text-align: left;
  transition: background-color .1s;
}
.model-control-option:hover { background: var(--hover-strong); }
.model-control-option-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.model-control-option-copy strong { font-size: var(--fs-ui); font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-control-option-copy small { color: var(--faint); font-size: var(--fs-tiny); }
.model-control-option > .material-symbols-rounded { font-size: 18px; color: var(--accent); opacity: 0; transform: scale(.6); transition: opacity .15s, transform .35s var(--spring-bouncy); }
.model-control-option.is-selected > .material-symbols-rounded { opacity: 1; transform: none; }
.model-control-option.is-selected .model-control-option-copy strong { font-weight: 650; }
/* ---------- sheets (projects / archive / avatar) ------------------------ */
.settings-drawer {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--backdrop);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 1;
  transition: opacity .22s var(--ease-out), display .22s allow-discrete;
}
.settings-drawer[hidden] { opacity: 0; transition-duration: .18s; transition-timing-function: var(--ease-in); }
@starting-style { .settings-drawer:not([hidden]) { opacity: 0; } }
.settings-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(480px, 100%);
  max-height: min(680px, calc(100dvh - 48px));
  padding: 6px 20px 20px;
  border-radius: 22px;
  background: var(--panel-solid);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line);
  overflow: hidden;
  transform: none;
  transition: transform var(--dur-smooth) var(--spring-smooth), opacity .2s;
}
.settings-drawer[hidden] .settings-card { transform: translateY(10px) scale(.97); transition-duration: .18s; transition-timing-function: var(--ease-in); }
@starting-style { .settings-drawer:not([hidden]) .settings-card { transform: translateY(18px) scale(.96); } }
.sheet-head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
}
.sheet-head h2 { margin: 0; font: 650 calc(18px * var(--ui-scale))/1.3 var(--font-display); }
.sheet-head .icon-button { margin-right: -8px; }
.drawer-note { margin: 0 0 14px; color: var(--muted); font-size: var(--fs-small); line-height: 1.55; }

.project-form { display: flex; gap: 8px; margin-bottom: 12px; }
.project-form input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 0;
  background: var(--hover);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: var(--fs-ui);
  outline: none;
  transition: box-shadow .15s;
}
.project-form input:focus { box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--accent) 60%, transparent), 0 0 0 4px var(--accent-soft); }
.project-form .button-primary { height: 40px; }
.project-list, .archive-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; margin: 0 -8px; padding: 0 8px 4px; overscroll-behavior: contain; }
.project-row, .archive-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 6px 6px 6px 12px;
  border-radius: var(--r-lg);
  transition: background-color .12s;
}
.project-row:hover, .archive-item:hover { background: var(--hover); }
.project-row.is-active { background: var(--selected); }
.project-main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; text-align: left; padding: 4px 0; }
.project-main span, .archive-item strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-ui); font-weight: 560; }
.project-main small, .archive-item small { color: var(--faint); font-size: var(--fs-tiny); }
.project-row.is-active .project-main span::after {
  content: "check";
  margin-left: 6px;
  font-family: "Material Symbols Rounded";
  font-size: 16px;
  line-height: 1;
  vertical-align: -3px;
  color: var(--accent);
  -webkit-font-feature-settings: "liga";
  font-feature-settings: "liga";
}
.project-actions, .archive-actions { flex: none; display: flex; align-items: center; gap: 2px; }
.project-actions button, .archive-delete-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  color: var(--muted);
}
.project-actions button:hover, .archive-delete-button:hover { background: var(--hover-strong); color: var(--text); }
.project-actions .material-symbols-rounded, .archive-delete-button .material-symbols-rounded { font-size: 18px; }
.archive-item > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.archive-actions button:not(.archive-delete-button) { height: 32px; padding: 0 12px; border-radius: 999px; background: var(--hover-strong); font-size: var(--fs-small); font-weight: 560; }
.archive-actions button:not(.archive-delete-button):hover { background: var(--press); }
.archive-delete-button:hover { color: var(--danger) !important; background: var(--danger-soft) !important; }
.archive-empty { margin: 24px 0; text-align: center; color: var(--faint); font-size: var(--fs-small); }

/* Avatar editor */
.avatar-editor-card { width: min(400px, 100%); align-items: stretch; }
.avatar-cropper {
  position: relative;
  width: min(280px, 100%);
  aspect-ratio: 1;
  margin: 4px auto 16px;
  border-radius: 20px;
  overflow: hidden;
  background: var(--hover);
  touch-action: none;
  cursor: grab;
}
.avatar-cropper:active { cursor: grabbing; }
#avatar-crop-image { position: absolute; top: 50%; left: 50%; max-width: none; transform-origin: center; -webkit-user-drag: none; user-select: none; }
.avatar-crop-ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(0, 0, 0, .5), inset 0 0 0 2px rgba(255, 255, 255, .85); pointer-events: none; }
.avatar-zoom-control { display: flex; align-items: center; gap: 10px; color: var(--muted); margin-bottom: 18px; }
.avatar-zoom-control .material-symbols-rounded { font-size: 18px; }
.avatar-editor-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Range inputs (settings, avatar) */
input[type="range"]:not(#model-effort-slider) {
  flex: 1;
  height: 24px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
input[type="range"]:not(#model-effort-slider)::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: var(--hover-strong); }
input[type="range"]:not(#model-effort-slider)::-moz-range-track { height: 4px; border-radius: 4px; background: var(--hover-strong); }
input[type="range"]:not(#model-effort-slider)::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
input[type="range"]:not(#model-effort-slider)::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35), 0 0 0 .5px rgba(0, 0, 0, .1); transition: transform .3s var(--spring-bouncy); }
input[type="range"]:not(#model-effort-slider)::-moz-range-thumb { width: 22px; height: 22px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
input[type="range"]:not(#model-effort-slider):active::-webkit-slider-thumb { transform: scale(1.12); }

/* ---------- dialogs (top layer) ----------------------------------------- */
dialog { color: var(--text); }
dialog::backdrop { background: var(--backdrop); }
.sheet-dialog, .palette-dialog, .image-lightbox {
  border: 0;
  padding: 0;
  margin: auto;
  background: transparent;
  max-width: none;
  max-height: none;
  overflow: visible;
}
.sheet-dialog[open], .palette-dialog[open] { display: flex; }
.sheet-dialog, .palette-dialog {
  opacity: 1;
  transform: none;
  transition:
    opacity .2s var(--ease-out),
    transform var(--dur-smooth) var(--spring-smooth),
    overlay .2s allow-discrete,
    display .2s allow-discrete;
}
.sheet-dialog:not([open]), .palette-dialog:not([open]) {
  opacity: 0;
  transform: translateY(8px) scale(.97);
  transition-duration: .16s;
  transition-timing-function: var(--ease-in);
}
@starting-style {
  .sheet-dialog[open] { opacity: 0; transform: translateY(18px) scale(.96); }
  .palette-dialog[open] { opacity: 0; transform: translateY(-8px) scale(.97); }
}
.sheet-dialog::backdrop, .palette-dialog::backdrop, .image-lightbox::backdrop {
  opacity: 1;
  transition: opacity .22s var(--ease-out), overlay .22s allow-discrete, display .22s allow-discrete;
}
.sheet-dialog:not([open])::backdrop, .palette-dialog:not([open])::backdrop, .image-lightbox:not([open])::backdrop { opacity: 0; }
@starting-style {
  .sheet-dialog[open]::backdrop, .palette-dialog[open]::backdrop, .image-lightbox[open]::backdrop { opacity: 0; }
}
.sheet-dialog.is-closing, .skills-dialog.is-closing { opacity: 0; transform: translateY(8px) scale(.97); }

/* Settings dialog */
.settings-dialog { width: min(760px, calc(100vw - 32px)); height: min(600px, calc(100dvh - 48px)); }
.settings-surface {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  border-radius: 24px;
  background: var(--panel-solid);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line);
  overflow: hidden;
}
.settings-head { padding: 0 14px 0 24px; border-bottom: 1px solid var(--line); }
.settings-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 200px minmax(0, 1fr); }
.settings-tabs { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; border-right: 1px solid var(--line); overflow-y: auto; }
.settings-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--r-md);
  color: var(--muted);
  font-size: var(--fs-ui);
  font-weight: 520;
  text-align: left;
  white-space: nowrap;
  transition: background-color .14s, color .14s;
}
.settings-tab .material-symbols-rounded { font-size: 19px; }
.settings-tab:hover { background: var(--hover); color: var(--text); }
.settings-tab[aria-selected="true"] { background: var(--selected); color: var(--text); }
.settings-panels { min-height: 0; overflow-y: auto; padding: 18px 24px 28px; overscroll-behavior: contain; }
.settings-panel { display: flex; flex-direction: column; gap: 18px; animation: panelIn .42s var(--spring-snappy) both; }
@keyframes panelIn { from { opacity: 0; transform: translateY(8px); } }
.settings-group { display: flex; flex-direction: column; border-radius: 16px; background: var(--hover); box-shadow: inset 0 0 0 1px var(--line); }
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  padding: 8px 14px 8px 16px;
}
.settings-row + .settings-row, .settings-group > * + * { box-shadow: inset 0 1px 0 var(--line); }
.settings-row-stack { flex-direction: column; align-items: stretch; gap: 10px; padding-top: 12px; padding-bottom: 14px; }
.settings-row-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.settings-row-stack .settings-row-copy { flex-direction: row; justify-content: space-between; align-items: baseline; }
.settings-row-copy strong { font-size: var(--fs-ui); font-weight: 560; }
.settings-row-copy small, .settings-row-copy output { color: var(--muted); font-size: var(--fs-small); }
.settings-note { margin: 0; color: var(--muted); font-size: var(--fs-small); }
.select-wrap { position: relative; flex: none; display: inline-flex; max-width: 60%; }
.select-wrap::after {
  content: "unfold_more";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-family: "Material Symbols Rounded";
  font-size: 18px;
  color: var(--faint);
  pointer-events: none;
  -webkit-font-feature-settings: "liga";
  font-feature-settings: "liga";
}
.select-wrap select {
  max-width: 100%;
  height: 34px;
  padding: 0 32px 0 12px;
  border: 0;
  border-radius: 10px;
  background: var(--hover-strong);
  color: var(--text);
  font-size: var(--fs-small);
  font-weight: 560;
  text-overflow: ellipsis;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.select-wrap select:hover { background: var(--press); }
.select-wrap select option, .select-wrap select optgroup { background: var(--panel-solid); color: var(--text); }
.range-wrap { display: flex; align-items: center; gap: 12px; }
.range-glyph { color: var(--muted); font-size: 18px; font-weight: 600; line-height: 1; }
.range-glyph.is-small { font-size: 12px; }
.segmented {
  position: relative;
  flex: none;
  display: inline-flex;
  padding: 2px;
  border-radius: 10px;
  background: var(--hover-strong);
}
.segmented button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: var(--fs-small);
  font-weight: 560;
  white-space: nowrap;
  transition: color .2s;
}
.segmented button .material-symbols-rounded { font-size: 16px; }
.segmented button[aria-checked="true"] { color: var(--text); }
.segmented-thumb {
  position: absolute;
  z-index: 0;
  top: 2px;
  bottom: 2px;
  left: 0;
  border-radius: 8px;
  background: var(--panel-solid);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .18), 0 0 0 .5px rgba(0, 0, 0, .06);
  transition: transform .5s var(--spring-snappy), width .5s var(--spring-snappy);
}
html[data-mode="dark"] .segmented-thumb { background: color-mix(in oklab, var(--text) 18%, var(--panel-solid)); }

.theme-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; }
.theme-swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 0; color: var(--muted); font-size: var(--fs-tiny); font-weight: 520; }
.theme-swatch-preview {
  position: relative;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--swatch-a, var(--accent));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08);
  transition: transform .4s var(--spring-bouncy), box-shadow .2s;
}
.theme-swatch:hover .theme-swatch-preview { transform: scale(1.08); }
.theme-swatch.is-active .theme-swatch-preview { box-shadow: 0 0 0 2px var(--panel-solid), 0 0 0 4px var(--swatch-a, var(--accent)); }
.theme-swatch.is-active { color: var(--text); }
.theme-swatch-check { color: #fff; font-size: 20px !important; opacity: 0; transform: scale(.5); transition: opacity .15s, transform .4s var(--spring-bouncy); }
.theme-swatch[data-theme-choice="graphite"] .theme-swatch-check, .theme-swatch[data-theme-choice="citrus"] .theme-swatch-check { color: #111; }
.theme-swatch.is-active .theme-swatch-check { opacity: 1; transform: none; }
.theme-swatch-preview-custom { background: conic-gradient(from 0deg, #ff5f6d, #ffc371, #47e891, #2fb8ff, #9b7cf6, #ff5f6d); }
.theme-swatch-tune { color: #fff; font-size: 20px !important; position: absolute; transition: opacity .15s; }
.theme-swatch.is-active .theme-swatch-tune { opacity: 0; }
.custom-theme-panel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 0 14px 14px; box-shadow: none !important; }
.color-field { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 44px; padding: 0 6px 0 12px; border-radius: 12px; background: var(--hover-strong); font-size: var(--fs-small); font-weight: 560; }
.color-field input[type="color"] { width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-field input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.color-field input[type="color"]::-moz-color-swatch { border: 0; border-radius: 50%; }

.shortcut-list .shortcut-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; padding: 0 14px 0 16px; font-size: var(--fs-ui); }
.shortcut-keys { display: inline-flex; gap: 4px; }
.shortcut-keys kbd, .palette-search kbd, .palette-foot kbd {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: 6px;
  background: var(--panel-solid);
  box-shadow: inset 0 0 0 1px var(--line-strong), 0 1px 0 var(--line-strong);
  color: var(--muted);
  font-size: var(--fs-tiny);
  font-weight: 560;
}

/* Command palette */
.palette-dialog { margin: max(10vh, 24px) auto auto; width: min(640px, calc(100vw - 24px)); }
.palette-surface {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: min(560px, calc(100dvh - 20vh));
  border-radius: 20px;
  background: color-mix(in oklab, var(--panel-solid) 94%, transparent);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line);
  overflow: hidden;
}
.palette-search { flex: none; display: flex; align-items: center; gap: 10px; height: 58px; padding: 0 14px 0 18px; border-bottom: 1px solid var(--line); color: var(--faint); }
.palette-search .material-symbols-rounded { font-size: 22px; }
#palette-input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: calc(16px * var(--ui-scale)); color: var(--text); }
#palette-input::placeholder { color: var(--faint); }
#palette-input::-webkit-search-cancel-button { display: none; }
.palette-results { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; overscroll-behavior: contain; scroll-padding: 6px; }
.palette-section { padding: 10px 12px 4px; color: var(--faint); font-size: var(--fs-tiny); font-weight: 560; }
.palette-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 6px 12px;
  border-radius: 12px;
  text-align: left;
  color: var(--text);
}
.palette-item > .material-symbols-rounded { font-size: 20px; color: var(--muted); }
.palette-item.is-selected { background: var(--hover-strong); }
.palette-item-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.palette-item-copy strong { font-size: var(--fs-ui); font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item-copy small { color: var(--muted); font-size: var(--fs-tiny); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item mark { background: color-mix(in oklab, var(--accent) 28%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.palette-item-meta { flex: none; color: var(--faint); font-size: var(--fs-tiny); font-variant-numeric: tabular-nums; }
.palette-empty { padding: 36px 16px; text-align: center; color: var(--faint); font-size: var(--fs-small); }
.palette-foot { flex: none; display: flex; gap: 16px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--faint); font-size: var(--fs-tiny); }
.palette-foot span { display: inline-flex; align-items: center; gap: 4px; }
html.is-touch .palette-foot, html.is-touch .palette-search kbd { display: none; }

/* Confirm dialog */
.confirm-dialog { width: min(360px, calc(100vw - 32px)); }
.confirm-surface { width: 100%; padding: 22px 22px 18px; border-radius: 22px; background: var(--panel-solid); box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line); }
.confirm-surface h2 { margin: 0 0 6px; font: 650 calc(17px * var(--ui-scale))/1.35 var(--font-display); }
.confirm-surface p { margin: 0 0 20px; color: var(--muted); font-size: var(--fs-small); line-height: 1.55; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Skills */
.skills-dialog { width: min(480px, calc(100vw - 32px)); }
.skills-surface { display: flex; flex-direction: column; width: 100%; max-height: min(640px, calc(100dvh - 48px)); padding: 6px 20px 16px; border-radius: 22px; background: var(--panel-solid); box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line); }
.skills-head { align-items: flex-start; padding-top: 14px; }
.skills-head p { margin: 2px 0 0; color: var(--muted); font-size: var(--fs-small); }
.skills-eyebrow { display: none; }
.skills-search { display: flex; align-items: center; gap: 8px; height: 40px; margin: 10px 0; padding: 0 12px; border-radius: 12px; background: var(--hover); color: var(--faint); }
.skills-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: var(--fs-ui); }
.skills-search input::-webkit-search-cancel-button { display: none; }
.skills-list { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; margin: 0 -8px; padding: 0 8px; overscroll-behavior: contain; }
.skill-option { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 10px; border-radius: 14px; text-align: left; transition: background-color .12s; }
.skill-option:hover { background: var(--hover); }
.skill-option.is-selected { background: var(--selected); }
.skill-option-icon { display: grid; place-items: center; width: 36px !important; height: 36px !important; border-radius: 10px; background: var(--hover-strong); color: var(--text); font-size: 20px !important; line-height: 36px !important; text-align: center; }
.skill-option.is-selected .skill-option-icon { background: var(--accent); color: var(--on-accent); }
.skill-option-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.skill-option-copy strong { font-size: var(--fs-ui); font-weight: 600; }
.skill-option-copy small { color: var(--muted); font-size: var(--fs-tiny); line-height: 1.45; }
.skill-option-check { color: var(--accent); opacity: 0; transform: scale(.5); transition: opacity .15s, transform .35s var(--spring-bouncy); }
.skill-option.is-selected .skill-option-check { opacity: 1; transform: none; }
.skills-empty { padding: 28px; text-align: center; color: var(--faint); }
.skills-foot { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--faint); font-size: var(--fs-tiny); line-height: 1.5; }
.skills-foot .material-symbols-rounded { font-size: 16px; }
.skills-foot p { margin: 0; }

/* GPT Live */
.gpt-live-dialog { width: min(440px, calc(100vw - 24px)); }
.gpt-live-surface { display: flex; flex-direction: column; gap: 18px; width: 100%; padding: 20px; border-radius: 28px; background: var(--panel-solid); box-shadow: var(--shadow-lg), inset 0 0 0 1px var(--line); }
.gpt-live-head { display: flex; justify-content: space-between; gap: 12px; }
.gpt-live-head h2 { margin: 4px 0 4px; font: 650 calc(20px * var(--ui-scale))/1.2 var(--font-display); }
.gpt-live-head p { margin: 0; color: var(--muted); font-size: var(--fs-small); line-height: 1.5; }
.gpt-live-eyebrow { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-ink); font-size: var(--fs-tiny); font-weight: 600; }
.gpt-live-eyebrow span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.gpt-live-stage { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 0 6px; }
.gpt-live-orb { position: relative; display: grid; place-items: center; width: 132px; height: 132px; margin-bottom: 12px; }
.gpt-live-orb span { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, var(--accent), var(--accent-2), var(--accent)); filter: blur(18px); opacity: .45; animation: spin 7s linear infinite; }
.gpt-live-orb span:nth-child(2) { inset: 14px; opacity: .55; animation-duration: 5s; animation-direction: reverse; }
.gpt-live-orb span:nth-child(3) { inset: 30px; filter: blur(8px); opacity: .8; animation-duration: 3.5s; }
.gpt-live-orb img { position: relative; width: 46px; height: auto; }
.gpt-live-stage[data-state="listening"] .gpt-live-orb, .gpt-live-stage[data-state="speaking"] .gpt-live-orb { animation: thinkingBreathe 1.6s ease-in-out infinite; }
#gpt-live-status { font-size: calc(16px * var(--ui-scale)); font-weight: 620; }
#gpt-live-detail { color: var(--muted); font-size: var(--fs-small); }
.gpt-live-wave { display: flex; align-items: center; gap: 4px; height: 26px; margin-top: 8px; }
.gpt-live-wave i { width: 4px; height: 6px; border-radius: 4px; background: var(--muted); opacity: .4; }
.gpt-live-stage:is([data-state="listening"], [data-state="speaking"]) .gpt-live-wave i { background: var(--accent); opacity: 1; animation: wave 1s ease-in-out infinite; }
.gpt-live-wave i:nth-child(2) { animation-delay: .1s !important; } .gpt-live-wave i:nth-child(3) { animation-delay: .2s !important; } .gpt-live-wave i:nth-child(4) { animation-delay: .3s !important; } .gpt-live-wave i:nth-child(5) { animation-delay: .2s !important; } .gpt-live-wave i:nth-child(6) { animation-delay: .1s !important; }
@keyframes wave { 50% { height: 24px; } }
.gpt-live-transcript { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 16px; background: var(--hover); }
.gpt-live-transcript p { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.gpt-live-transcript span { color: var(--faint); font-size: var(--fs-tiny); font-weight: 600; }
.gpt-live-transcript strong { font-size: var(--fs-small); font-weight: 500; line-height: 1.5; }
.gpt-live-controls { display: flex; gap: 8px; }
.gpt-live-controls button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 48px; border-radius: 999px; font-weight: 600; transition: transform .3s var(--spring-snappy), background-color .15s; }
.gpt-live-controls button:active { transform: scale(.96); }
.gpt-live-secondary { background: var(--hover-strong); }
.gpt-live-secondary.is-muted { color: var(--danger); }
.gpt-live-secondary:disabled { opacity: .45; }
.gpt-live-primary { background: var(--text); color: var(--bg); }
.gpt-live-end { background: var(--danger); color: #fff; }

/* Image lightbox */
.image-lightbox { width: 100vw; height: 100dvh; display: none; place-items: center; }
.image-lightbox[open] { display: grid; }
.image-lightbox::backdrop { background: rgba(0, 0, 0, .86); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
#image-lightbox-preview { max-width: calc(100vw - 48px); max-height: calc(100dvh - 96px); border-radius: 14px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); animation: lightboxIn var(--dur-smooth) var(--spring-smooth); }
@keyframes lightboxIn { from { opacity: 0; transform: scale(.9); } }
.image-lightbox-close { position: fixed; top: calc(env(safe-area-inset-top) + 16px); right: 16px; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); }
.image-lightbox-close:hover { background: rgba(255, 255, 255, .24); }
/* ---------- boot / entrance -------------------------------------------- */
body.is-layout-initializing *, body.is-layout-initializing *::before, body.is-layout-initializing *::after { transition: none !important; }
body.is-chat-booting .chat-main > :not(.chat-topbar),
body.is-chat-booting .session-list,
body.is-chat-booting .sidebar-foot { opacity: 0; }
body.is-chat-entering .composer { animation: chatComposerArrival .7s var(--spring-smooth) both; }
body.is-chat-entering .composer-dock > :not(.composer) { animation: fadeIn .6s .18s both; }
body.is-chat-entering .messages { animation: fadeIn .5s var(--ease-out) both; }
body.is-chat-entering .session-list > * { animation: sessionRowIn .5s var(--ease-out) both; animation-delay: calc(min(var(--row-i, 0), 14) * 18ms); }
body.is-chat-entering .sidebar-foot { animation: fadeIn .5s .1s both; }
@keyframes chatComposerArrival { from { opacity: 0; transform: translateY(22px) scale(.98); } }
@keyframes sessionRowIn { from { opacity: 0; transform: translateX(-8px); } }

/* Session list motion (FLIP from JS + enter/leave). */
.session-item.is-entering { animation: sessionEnter .5s var(--spring-snappy) both; }
@keyframes sessionEnter { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.session-ghost { position: absolute; pointer-events: none; z-index: 1; }

/* ---------- touch tuning ----------------------------------------------- */
html.is-touch .app-shell { top: var(--vvt, 0px); bottom: auto; height: var(--vvh, 100%); }
html.has-keyboard .composer-dock { padding-bottom: 8px; }
html.has-keyboard .composer-suggestions { display: none !important; }
html.is-touch {
  --row-h: 44px;
  --tap: 40px;
}
html.is-touch .menu-item { min-height: 44px; }
html.is-touch .sidebar-resizer { width: 22px; left: calc(var(--sidebar-current-width) - 11px); }
html.is-touch .sidebar-resizer-line { left: 10px; }

/* ---------- tablet & narrow desktop ------------------------------------ */
@media (max-width: 1100px) {
  :root { --gutter: 20px; }
  .message-minimap { right: 4px; }
}

/* ---------- overlay sidebar: phones, and phones held sideways -------- */
@media (max-width: 760px), (pointer: coarse) and (max-height: 520px) {
  :root {
    --topbar-h: 52px;
    --gutter: 16px;
    --fs-greeting: calc(26px * var(--ui-scale));
  }
  .app-shell { display: block; --drawer-p: 0; }
  .app-shell[data-sidebar="open"] { --drawer-p: 1; }
  .app-shell .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 60;
    height: auto;
    margin: 0;
    width: min(320px, 86vw);
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    box-shadow: none;
    border-radius: 0 22px 22px 0;
    transform: translate3d(calc((var(--drawer-p) - 1) * 104%), 0, 0);
    transition: transform var(--dur-smooth) var(--spring-smooth), box-shadow .3s;
    will-change: transform;
  }
  .app-shell[data-sidebar="open"] .sidebar { box-shadow: var(--shadow-lg); }
  .app-shell.is-drawer-dragging .sidebar,
  .app-shell.is-drawer-dragging .mobile-sidebar-backdrop { transition: none; }
  .app-shell .sidebar-panel { width: 100%; opacity: 1; transform: none; visibility: visible !important; }
  .app-shell .sidebar-rail, .app-shell .sidebar-resizer { display: none; }
  .mobile-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: var(--backdrop);
    opacity: var(--drawer-p);
    pointer-events: none;
    transition: opacity .4s var(--ease-out);
  }
  .app-shell[data-sidebar="open"] .mobile-sidebar-backdrop { pointer-events: auto; }
  .app-shell .chat-main { position: absolute; inset: 0; }
  #collapse-sidebar .material-symbols-rounded { font-size: 22px; }

  .chat-topbar { padding: 0 6px; padding-top: env(safe-area-inset-top); gap: 0; }
  .topbar-sidebar-button { display: inline-grid; }
  .topbar-new-chat { display: inline-grid; }
  .title-wrap {
    position: absolute;
    left: 96px;
    right: 96px;
    top: env(safe-area-inset-top);
    height: var(--topbar-h);
    justify-content: center;
    pointer-events: none;
  }
  .title-wrap > * { pointer-events: auto; }
  .topbar-actions { margin-left: auto; }
  .chat-title { margin: 0; font-size: calc(15px * var(--ui-scale)); }
  .title-rename { display: none; }
  .quota-pill, .desktop-chat-share { display: none; }
  .app-shell[data-empty="true"] .chat-title { opacity: 1; pointer-events: auto; }

  .messages { padding-left: max(var(--gutter), env(safe-area-inset-left)); padding-right: max(var(--gutter), env(safe-area-inset-right)); }
  .message.user .message-body { max-width: 86%; }
  .message-minimap { display: none !important; }

  .composer-dock { padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right)); padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .app-shell[data-empty="true"] .composer-dock { top: auto; bottom: 0; }
  .composer { border-radius: 24px; }
  #prompt { min-height: 50px; padding: 14px 16px 4px; max-height: 32vh; }
  .composer-bar { padding: 4px 8px 8px; }
  .composer-footnote { display: none; }
  .model-control-button { max-width: 42vw; padding: 0 6px 0 10px; }
  .model-control-effort { display: none; }
  .composer-suggestions {
    order: -1;
    flex-wrap: nowrap;
    justify-content: flex-start;
    margin: 0 0 10px;
    padding: 2px 6px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, transparent, #000 10px, #000 calc(100% - 18px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 10px, #000 calc(100% - 18px), transparent);
  }
  .composer-suggestions::-webkit-scrollbar { display: none; }
  .suggestion-chip { flex: none; background: var(--composer-bg); }
  .empty-state {
    top: var(--topbar-h);
    bottom: var(--dock-h);
    justify-content: center;
    gap: 14px;
  }
  .empty-mark { width: 44px; height: 44px; }
  .empty-logo { width: 38px; }
  .scroll-latest { top: -46px; }

  /* Sheets become bottom sheets */
  .settings-drawer { place-items: end center; padding: 0; }
  .settings-card {
    width: 100%;
    max-height: calc(100dvh - env(safe-area-inset-top) - 24px);
    padding: 0 18px max(18px, env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
  }
  .settings-card::before, .settings-surface::before, .skills-surface::before {
    content: "";
    align-self: center;
    flex: none;
    width: 38px;
    height: 5px;
    margin: 8px auto 0;
    border-radius: 3px;
    background: var(--line-strong);
  }
  .settings-drawer[hidden] .settings-card { transform: translateY(100%); transition-duration: .26s; }
  @starting-style { .settings-drawer:not([hidden]) .settings-card { transform: translateY(100%); } }

  .sheet-dialog { margin: auto 0 0; width: 100vw; max-width: 100vw; }
  .sheet-dialog:not([open]) { transform: translateY(100%); transition-duration: .26s; }
  @starting-style { .sheet-dialog[open] { opacity: 1; transform: translateY(100%); } }
  .sheet-dialog > * { border-radius: 24px 24px 0 0 !important; padding-bottom: max(16px, env(safe-area-inset-bottom)) !important; }
  .confirm-dialog { margin: auto; width: min(340px, calc(100vw - 32px)); }
  .confirm-dialog > * { border-radius: 22px !important; }
  .settings-dialog { height: calc(100dvh - env(safe-area-inset-top) - 12px); }
  .settings-head { padding: 0 10px 0 20px; }
  .settings-layout { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .settings-tabs { flex-direction: row; gap: 6px; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
  .settings-tabs::-webkit-scrollbar { display: none; }
  .settings-tab { flex: none; height: 34px; padding: 0 12px; border-radius: 999px; }
  .settings-tab .material-symbols-rounded { font-size: 17px; }
  .settings-panels { padding: 16px 16px max(28px, env(safe-area-inset-bottom)); }
  .settings-row { padding-left: 14px; }
  .segmented button { padding: 0 9px; }
  .segmented button .material-symbols-rounded { display: none; }
  .palette-dialog { margin-top: calc(env(safe-area-inset-top) + 10px); width: calc(100vw - 20px); }
  .palette-surface { max-height: calc(100dvh - env(safe-area-inset-top) - 80px); }
  .skills-surface { max-height: calc(100dvh - env(safe-area-inset-top) - 24px); }
  .gpt-live-dialog { width: 100vw; }
}

/* Phones held sideways: keep everything compact. */
@media (pointer: coarse) and (max-height: 520px) {
  :root { --topbar-h: 46px; --fs-greeting: calc(22px * var(--ui-scale)); }
  .composer-suggestions { display: none !important; }
  .empty-mark { display: none; }
  #prompt { min-height: 44px; padding-top: 11px; max-height: 26vh; }
  .composer-bar { padding: 2px 8px 6px; }
  .message { margin-top: 20px; }
  .settings-dialog { height: calc(100dvh - 8px); }
}

@media (max-width: 380px) {
  :root { --gutter: 14px; }
  .model-control-button { max-width: 38vw; }
  .composer-left { gap: 2px; }
}

@media (min-width: 761px) and (max-height: 640px) {
  :root { --fs-greeting: calc(25px * var(--ui-scale)); }
  .empty-mark { display: none; }
}

/* ---------- reduced motion --------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .thinking-label { -webkit-text-fill-color: currentColor; background: none; }
}
/* ---------- Liquid Glass material ------------------------------------- */
/* Floating controls are glass over the conversation: a translucent fill,
   strong blur with lifted saturation (so colour bleeds through), a specular
   rim brighter along the top edge, and a soft contact shadow. Real
   refraction would need SVG filters (Chromium only) re-run on every scroll
   frame, so the rim light carries the effect instead. */
:root {
  --glass-fill: color-mix(in oklab, var(--composer-bg) 78%, transparent);
  --glass-fill-strong: color-mix(in oklab, var(--panel-solid) 80%, transparent);
  --glass-filter: blur(22px) saturate(1.9) brightness(1.04);
  --glass-edge:
    inset 0 1px 0 rgba(255, 255, 255, .11),
    inset 0 -1px 0 rgba(255, 255, 255, .025),
    inset 1px 0 0 rgba(255, 255, 255, .035),
    inset -1px 0 0 rgba(255, 255, 255, .035);
}
html[data-mode="light"] {
  --glass-fill: rgba(255, 255, 255, .72);
  --glass-fill-strong: rgba(255, 255, 255, .8);
  --glass-filter: blur(22px) saturate(1.8);
  --glass-edge:
    inset 0 1px 0 rgba(255, 255, 255, .95),
    inset 0 -1px 0 rgba(0, 0, 0, .035),
    inset 1px 0 0 rgba(255, 255, 255, .6),
    inset -1px 0 0 rgba(255, 255, 255, .6);
}

.composer {
  background: var(--glass-fill);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
  box-shadow: var(--composer-shadow), var(--glass-edge), inset 0 0 0 1px var(--composer-line);
}
.composer:focus-within { box-shadow: var(--composer-shadow), var(--glass-edge), inset 0 0 0 1px var(--composer-line-focus); }

.popover-menu,
.model-control-menu,
.palette-surface,
.minimap-preview,
.scroll-latest,
.chat-toast {
  background: var(--glass-fill-strong);
  -webkit-backdrop-filter: var(--glass-filter);
  backdrop-filter: var(--glass-filter);
}
.popover-menu, .model-control-menu, .palette-surface, .minimap-preview { box-shadow: var(--shadow-lg), var(--glass-edge), inset 0 0 0 1px var(--line); }
.scroll-latest { box-shadow: var(--shadow-md), var(--glass-edge), inset 0 0 0 1px var(--line); }
.chat-toast { box-shadow: var(--shadow-lg), var(--glass-edge), inset 0 0 0 1px var(--line); }

/* Pressing a glass control lifts it, like iOS 26. */
.scroll-latest:active { transform: scale(1.1); transition: transform .5s var(--spring-bouncy); }

@media (prefers-reduced-transparency: reduce) {
  :root, html[data-mode="light"] { --glass-fill: var(--composer-bg); --glass-fill-strong: var(--panel-solid); --glass-filter: none; }
}
/* ---------- Aurora (Gemini-like colour light) ----------------------- */
@property --glow-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

/* The aurora itself is painted by chat-motion.js on a small canvas; CSS only
   scales it up past the edges so its soft falloff never shows a border. */
.aurora {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.aurora-canvas {
  position: absolute;
  left: -6%;
  top: -4%;
  width: 112%;
  height: 112%;
  filter: blur(22px) saturate(1.1);
}
html[data-mode="light"] .aurora-canvas { filter: blur(18px) saturate(1.05); }

/* Gradient greeting, like Gemini's "Hello". */
#greeting-title {
  --greet-gradient: linear-gradient(100deg, var(--a1) 0%, var(--a2) 42%, var(--a3) 78%, var(--a4) 100%);
}
#greeting-title:not(:has(.g-char)),
#greeting-title .g-char {
  background-image: var(--greet-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
#greeting-title .g-char {
  background-size: var(--gw, 100%) 100%;
  background-position: var(--gx, 0) 0;
  background-repeat: no-repeat;
  padding-bottom: .08em;
}
html[data-theme="graphite"] #greeting-title { --greet-gradient: linear-gradient(100deg, var(--text), var(--muted)); }
html[data-aurora="off"] #greeting-title .g-char,
html[data-aurora="off"] #greeting-title:not(:has(.g-char)) { background-image: none; -webkit-text-fill-color: currentColor; color: var(--text); }

/* Composer halo + glow ring. */
.composer-shell { position: relative; width: 100%; max-width: var(--column-w); }
.composer-shell > .composer { max-width: none; }
.composer-halo {
  position: absolute;
  inset: 8px 4% -6px;
  border-radius: 40px;
  background: linear-gradient(100deg, var(--a1), var(--a2) 35%, var(--a3) 70%, var(--a4));
  filter: blur(26px);
  opacity: 0;
  transform: scale(.94);
  transition: opacity .9s var(--ease-out), transform 1.2s var(--spring-gentle);
  pointer-events: none;
}
.app-shell[data-empty="true"] .composer-halo { opacity: .26; transform: scale(.98); }
.composer-shell:focus-within .composer-halo { opacity: .3; transform: none; }
.app-shell[data-busy="true"] .composer-halo { opacity: .5; transform: none; animation: haloBreathe 2.6s ease-in-out infinite; }
html[data-mode="light"] .composer-halo { filter: blur(30px); }
html[data-mode="light"] .app-shell[data-empty="true"] .composer-halo { opacity: .22; }
@keyframes haloBreathe {
  0%, 100% { opacity: .36; transform: scale(.97); }
  50% { opacity: .62; transform: scale(1.02); }
}
.composer-glow {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  padding: 1.5px;
  background: conic-gradient(from var(--glow-angle), var(--a1), var(--a2), var(--a3), var(--a4), var(--a1));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s var(--ease-out);
  animation: glowSpin 4.5s linear infinite paused;
}
.composer-shell:focus-within .composer-glow { opacity: .5; }
.app-shell[data-busy="true"] .composer-glow { opacity: 1; animation-play-state: running; }
.composer.is-drag-over .composer-glow { opacity: 1; animation-play-state: running; }
@keyframes glowSpin { to { --glow-angle: 360deg; } }
html[data-aurora="off"] .composer-halo, html[data-aurora="off"] .composer-glow { display: none; }

/* Theme picker: gradient cards. */
.theme-swatches { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 12px 10px; }
.theme-swatch-preview {
  width: 100%;
  height: 52px;
  border-radius: 14px;
  background: var(--swatch, var(--accent));
  overflow: hidden;
}
.theme-swatch:hover .theme-swatch-preview { transform: translateY(-2px); }
.theme-swatch.is-active .theme-swatch-preview { box-shadow: 0 0 0 2px var(--panel-solid), 0 0 0 4px var(--text); }
.theme-swatch-check { color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
[data-preview="aurora"], .menu-theme-dot[data-theme-choice="aurora"] { --swatch: linear-gradient(135deg, #4f8dff, #9b6bff 45%, #ff6fb1 80%, #2fd6d0); }
[data-preview="ember"], .menu-theme-dot[data-theme-choice="ember"] { --swatch: linear-gradient(135deg, #ff8a4c, #ff5f6d 50%, #ffc35a); }
[data-preview="sunset"], .menu-theme-dot[data-theme-choice="sunset"] { --swatch: linear-gradient(135deg, #ffb36b, #ff7e5f 40%, #ff5e9c 70%, #c56cf0); }
[data-preview="rose"], .menu-theme-dot[data-theme-choice="rose"] { --swatch: linear-gradient(135deg, #ff9ec4, #ff5c9a 50%, #b56bff); }
[data-preview="violet"], .menu-theme-dot[data-theme-choice="violet"] { --swatch: linear-gradient(135deg, #5b7cff, #8b5cf6 45%, #ff7ad9); }
[data-preview="midnight"], .menu-theme-dot[data-theme-choice="midnight"] { --swatch: linear-gradient(135deg, #00c2ff, #3b5bff 45%, #7a4dff); }
[data-preview="ocean"], .menu-theme-dot[data-theme-choice="ocean"] { --swatch: linear-gradient(135deg, #00e0c6, #00b4ff 45%, #2f6bff); }
[data-preview="forest"], .menu-theme-dot[data-theme-choice="forest"] { --swatch: linear-gradient(135deg, #b4e05a, #3fd17f 45%, #1fb5a4); }
[data-preview="citrus"], .menu-theme-dot[data-theme-choice="citrus"] { --swatch: linear-gradient(135deg, #ffd23f, #ffb84d 45%, #8be04e); }
[data-preview="graphite"], .menu-theme-dot[data-theme-choice="graphite"] { --swatch: linear-gradient(135deg, #f4f5f7, #9aa0aa 55%, #3a3f47); }
[data-preview="custom"], .menu-theme-dot[data-theme-choice="custom"] { --swatch: conic-gradient(from 0deg, #ff5f6d, #ffc371, #47e891, #2fb8ff, #9b7cf6, #ff5f6d); }
.theme-swatch[data-theme-choice="graphite"] .theme-swatch-check, .theme-swatch[data-theme-choice="citrus"] .theme-swatch-check { color: #111; text-shadow: none; }

@media (prefers-reduced-motion: reduce) {
  .composer-glow, .composer-halo { animation: none !important; }
}
