/* Palette sampled from the Claude iOS app (dark) + Claude's ivory light theme. */
:root {
  --bg: #faf9f5;
  --drawer: #f3f1ea;
  --raised: #ffffff;          /* composer, chips */
  --control: #ebe9e1;         /* circular buttons */
  --control-2: #e0ddd3;       /* + inside composer */
  --row-active: #e8e5dc;
  --sheet: #faf9f5;
  --group: #ffffff;
  --divider: #e7e4dc;
  --check: #2f6fde;
  --effort-text: #8a877e;
  --chip: #ffffff;
  --pill: #efede6;
  --hairline: rgb(0 0 0 / .07);
  --text: #1f1e1d;
  --text-soft: #3d3c39;
  --muted: #73726c;
  --greeting: #4a4945;
  --border: #e4e1d8;
  --clay: #d97757;
  --primary: #1f1e1d;         /* send button, primary pills */
  --primary-text: #faf9f5;
  --user-bubble: #f0eee6;
  --reply: #1f1e1d;
  --action: #5e5d59;          /* icons under replies, step rows */
  --disclaimer: #8b8a85;
  --send: #c6613f;
  --code-bg: #f5f4ef;
  --danger: #c8412f;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 8px 24px rgb(0 0 0 / .06);
  --drawer-w: min(82vw, 340px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --serif: ui-serif, "New York", "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --p: 0; /* drawer progress 0..1 */
  --spring: cubic-bezier(.32, .72, 0, 1); /* iOS sheet/spring curve */
  --out: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151515;
    --drawer: #111111;
    --raised: #333333;
    --control: #343434;
    --control-2: #444444;
    --row-active: #222222;
    --sheet: #151515;
    --group: #20201f;
    --divider: #363635;
    --check: #5a9ef7;
    --effort-text: #97958d;
    --chip: #333333;
    --pill: #2e2e2c;
    --hairline: rgb(255 255 255 / .08);
    --text: #f2f1ee;
    --text-soft: #dfdfde;
    --muted: #9b9a96;
    --greeting: #c2c0b6;
    --border: #2f2f2f;
    --primary: #f9f9f7;
    --primary-text: #151515;
    --user-bubble: #2c2c2a;
    --reply: #f9f9f7;
    --action: #c3c2b7;
    --disclaimer: #898781;
    --send: #b96647;
    --code-bg: #1d1d1d;
    --danger: #f07b6b;
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 8px 28px rgb(0 0 0 / .45);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { overflow: hidden; }
html { background: var(--bg); }
/* Only for home-screen apps installed while the status bar was black-translucent (iOS keeps the
   style it saw at install). iOS 26 WebKit bug 301108 makes that viewport short by the status bar;
   a root as tall as the screen makes iOS grow it. JS sets .sb-under when it detects that mode.
   In the normal (default status bar) mode 100lvh is too tall, so this must not apply there. */
html.sb-under { height: 100lvh; min-height: var(--screen-h, 100lvh); }

/* iOS reads the status-bar colour from the fixed box at the top-centre of the page (4px down).
   This one is invisible but carries the page colour, so the bar always matches the app instead of
   whatever happens to be under it. Sits below sheets/scrims so they dim the status bar too. */
.status-strip {
  position: fixed; top: 0; left: 0; right: 0; height: 11px; z-index: 30; pointer-events: none;
  background-color: var(--bg); -webkit-background-clip: text; background-clip: text;
}
#app.shifted ~ .status-strip { background-color: var(--drawer); }
#app[hidden] ~ .status-strip { background-color: var(--bg); }
/* iOS: the page never scrolls or jumps. body is sized from JS (--app-h), not from the viewport
   iOS reports, which is short by the status bar in standalone mode; `contain: layout` makes body
   the frame for every position:fixed element (app, login, sheets, toast, lightbox). */
body {
  position: fixed; top: 0; left: 0; right: 0; height: var(--app-h, 100%); overflow: hidden; contain: layout;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 var(--sans);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}
.md, .bubble, .tool pre, textarea, input { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
button:not(:disabled):active { transform: scale(.95); }
button { transition: transform .08s ease, background-color .15s ease, opacity .15s ease; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.spark { stroke: none; }

/* ---------- login ---------- */
.login { position: fixed; inset: 0; display: grid; place-items: center; padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom)); }
.login-card { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login-spark svg { width: 44px; height: 44px; }
.login-card h1 { font: 500 30px/1.2 var(--serif); color: var(--greeting); margin: 10px 0 14px; letter-spacing: -.01em; }
.login-card input { font-size: 17px; padding: 14px 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--raised); color: var(--text); outline: none; }
.login-card input:focus { border-color: var(--muted); }
.btn-primary { display: block; text-decoration: none; padding: 14px; border-radius: 14px; background: var(--primary); color: var(--primary-text); font-weight: 600; }
.error { color: var(--danger); min-height: 1.4em; margin: 0; font-size: 14px; }

/* ---------- layout ---------- */
.app { position: fixed; inset: 0; overflow: hidden; background: var(--drawer); }
.app.kb .dock { padding-bottom: 8px; } /* keyboard up: no home-indicator inset */
.main {
  position: absolute; inset: 0; display: flex; flex-direction: column; background: var(--bg); z-index: 2;
  transform: translate3d(calc(var(--drawer-w) * var(--p)), 0, 0);
  will-change: transform;
}
.app.animating .main { transition: transform .32s cubic-bezier(.2, .8, .2, 1), border-radius .32s; }
.app.shifted .main { border-radius: 22px 0 0 44px; overflow: hidden; box-shadow: -1px 0 0 var(--border); }
.shade { position: absolute; inset: 0; background: rgb(0 0 0 / .35); opacity: var(--p); pointer-events: none; z-index: 20; }
.app.animating .shade { transition: opacity .32s; }
.app.shifted .shade { pointer-events: auto; }

.topbar {
  display: flex; align-items: center; gap: 8px; flex: none;
  padding: var(--safe-top) calc(16px + var(--safe-right)) 0 calc(16px + var(--safe-left));
  position: absolute; top: 0; left: 0; right: 0; z-index: 6; pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.topbar .title { pointer-events: none; }
.topbar::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: max(28px, calc(var(--safe-top) + 20px)); z-index: -1; pointer-events: none;
  background: linear-gradient(var(--bg) 40%, rgb(from var(--bg) r g b / 0));
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  -webkit-mask-image: linear-gradient(#000 55%, transparent); mask-image: linear-gradient(#000 55%, transparent);
}
.top-pill { margin-left: auto; display: flex; width: 99px; height: 44px; border-radius: 22px; background: var(--control); border: 1px solid var(--hairline); color: var(--text-soft); flex: none; }
/* No overflow:hidden here: iOS WebKit clips the pill's own rounded ends with it. */
.top-pill button { flex: 1; display: grid; place-items: center; border-radius: 21px; }
.top-pill button:not(:disabled):active { transform: none; background: var(--control-2); }
.top-pill svg { width: 23px; height: 23px; stroke-width: 1.9; }
.top-pill svg.dots { fill: currentColor; stroke: none; width: 22px; }
.circle { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--control); color: var(--text-soft); border: 1px solid var(--hairline); flex: none; }
.circle.ghost { background: transparent; border-color: transparent; }
#menu svg { stroke-width: 2.1; }
.title { flex: 1; min-width: 0; font-weight: 600; font-size: 16px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 10px 4px; color: var(--text); }
.title:empty { visibility: hidden; }

/* ---------- drawer ---------- */
.drawer {
  position: absolute; inset: 0 auto 0 0; width: var(--drawer-w); z-index: 1;
  display: flex; flex-direction: column; background: var(--drawer);
  padding: var(--safe-top) 0 max(12px, calc(var(--safe-bottom) - 6px)) var(--safe-left);
  opacity: calc(.4 + var(--p) * .6);
}
.drawer-head { display: flex; align-items: center; justify-content: space-between; height: 44px; padding: 0 10px 0 16px; }
.wordmark { font: 500 28px/1 var(--serif); letter-spacing: -.02em; color: var(--text); }
.search { margin: 6px 16px 4px; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 12px; background: var(--control); color: var(--muted); }
.search svg { width: 18px; height: 18px; }
.search input { flex: 1; min-width: 0; border: 0; background: none; color: var(--text); font-size: 17px; padding: 10px 0; outline: none; }
.chat-list { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 10px 12px; overscroll-behavior: contain; }
.chat-list h4 { margin: 20px 14px 4px; font-size: 15.5px; font-weight: 600; color: var(--muted); }
.chat-row { display: flex; align-items: center; gap: 12px; width: 100%; height: 50px; text-align: left; padding: 0 16px; border-radius: 14px; color: var(--text-soft); font-size: 18.5px; font-weight: 550; letter-spacing: -.01em; }
.chat-row.current { background: var(--row-active); color: var(--text); }
.chat-row svg { width: 22px; height: 22px; color: var(--text-soft); stroke-width: 1.7; }
.chat-row span.dots { flex: none; overflow: visible; }
.chat-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-row:active { background: var(--row-active); transform: none; }
.chat-list .empty-list { color: var(--muted); padding: 16px 14px; font-size: 15px; }
.drawer-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 28px 0 28px; }
.avatar { width: 48px; height: 48px; border-radius: 50%; background: var(--control); color: var(--text); font-weight: 600; font-size: 17px; display: grid; place-items: center; }
.pill-new { display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 17px 0 14px; border-radius: 999px; background: var(--primary); color: var(--primary-text); font-weight: 600; font-size: 17px; }
.pill-new svg { width: 20px; height: 20px; stroke-width: 2.2; }


/* ---------- messages ---------- */
.scroller { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.empty { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(var(--safe-top) + 60px) 28px var(--dock-h, 100px); text-align: center; }
.empty-spark svg { width: 36px; height: 36px; }
.empty h2 { font: 500 25px/1.25 var(--serif); letter-spacing: -.01em; color: var(--greeting); margin: 14px 0 0; text-wrap: balance; }
.messages { list-style: none; margin: 0 auto; padding: calc(var(--safe-top) + 74px) calc(16px + var(--safe-right)) calc(var(--dock-h, 100px) + 28px) calc(16px + var(--safe-left)); max-width: 760px; display: flex; flex-direction: column; gap: 27px; }
.messages:empty { display: none; }
.msg { min-width: 0; }
.msg.user { align-self: flex-end; max-width: 85%; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.bubble { background: var(--user-bubble); padding: 12px 16px; border-radius: 24px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 17px; line-height: 24px; text-align: left; cursor: pointer; }
.msg.assistant { align-self: stretch; overflow-wrap: anywhere; }
.msg .meta { font-size: 14px; color: var(--muted); margin-top: 8px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.msg .meta.err { color: var(--danger); }
.live { display: flex; align-items: center; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 15px; min-height: 28px; }
.live { gap: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.actions { display: flex; margin: 12px 0 0 -6px; color: var(--action); align-items: center; }
.actions button { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 10px; }
.actions button:active { background: var(--control); }
.actions svg { width: 20px; height: 20px; stroke-width: 1.65; }
.disclaimer { margin: 15px 0 0; font: 15px/19px var(--sans); color: var(--disclaimer); }
.msg:not(:last-child) .disclaimer { display: none; }

/* user attachments */
.msg-atts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.msg-atts img { width: 128px; height: 128px; object-fit: cover; border-radius: 16px; cursor: zoom-in; background: var(--control); }
.file-chip { display: inline-flex; align-items: center; gap: 10px; max-width: 250px; padding: 9px 12px 9px 9px; border-radius: 16px; background: var(--raised); border: 1px solid var(--border); font-size: 14px; color: var(--text); text-decoration: none; text-align: left; }
.file-chip .ficon { width: 36px; height: 36px; border-radius: 10px; background: var(--control); color: var(--muted); display: grid; place-items: center; font-size: 10px; font-weight: 700; flex: none; text-transform: uppercase; }
.file-chip .fname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.file-chip small { display: block; color: var(--muted); font-weight: 400; }

/* edit mode */
.edit-box { width: min(560px, 85vw); display: flex; flex-direction: column; gap: 10px; }
.edit-box textarea { width: 100%; min-height: 90px; font: 17px/1.45 var(--sans); padding: 12px 14px; border-radius: 18px; border: 1px solid var(--muted); background: var(--raised); color: var(--text); resize: none; outline: none; }
.edit-box .row { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.edit-box small { color: var(--muted); margin-right: auto; font-size: 13px; text-align: left; }
.btn { padding: 9px 16px; border-radius: 999px; font-size: 15px; font-weight: 600; }
.btn.primary { background: var(--primary); color: var(--primary-text); }
.btn.ghost { background: var(--control); }

/* markdown (assistant prose in serif, like the app) */
.msg.assistant .md { font: 17px/27.3px var(--serif); color: var(--reply); }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md blockquote, .md table, .md pre { margin: 0 0 .85em; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--serif); font-weight: 600; line-height: 1.3; margin: 1.2em 0 .5em; }
.md h1 { font-size: 1.3em; } .md h2 { font-size: 1.18em; } .md h3 { font-size: 1.06em; }
.md ul, .md ol { padding-left: 1.35em; }
.md li { padding-left: .15em; }
.md li + li { margin-top: .3em; }
.md li::marker { color: var(--muted); }
.md a { color: inherit; text-decoration: underline; text-decoration-color: var(--muted); text-underline-offset: 2px; }
.md strong { font-weight: 650; }
.md blockquote { border-left: 3px solid var(--border); padding-left: 14px; color: var(--muted); }
.md code { font: .84em/1.5 var(--mono); background: var(--code-bg); padding: .12em .38em; border-radius: 6px; border: 1px solid var(--border); }
.md pre { position: relative; background: var(--code-bg); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.md pre code { display: block; padding: 40px 16px 14px; overflow-x: auto; background: none; border: 0; font-size: 13.5px; line-height: 1.55; -webkit-overflow-scrolling: touch; }
.md pre .code-head { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 6px 6px 0 16px; font: 12.5px var(--sans); color: var(--muted); }
.md pre .copy { font-size: 12.5px; color: var(--muted); padding: 5px 10px; border-radius: 8px; }
.md pre .copy:active { background: var(--control); }
.md .hljs { background: none; padding: 40px 16px 14px; }
.md table { border-collapse: collapse; display: block; overflow-x: auto; max-width: 100%; font: 15px/1.45 var(--sans); }
.md th, .md td { border-bottom: 1px solid var(--border); padding: 8px 12px; text-align: left; }
.md th { font-weight: 600; }
.md img { max-width: 100%; border-radius: 12px; }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.4em 0; }

/* thinking + tools */
.steps { margin: 0 0 12px; font: 17px/24px var(--sans); }
.steps summary { list-style: none; display: flex; align-items: center; gap: 12px; min-height: 30px; color: var(--action); cursor: pointer; }
.steps summary::-webkit-details-marker { display: none; }
.steps .sicon svg { width: 22px; height: 22px; stroke-width: 1.6; display: block; }
.steps .slabel { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps .schev svg { width: 8px; height: 14px; stroke-width: 1.9; display: block; transition: transform .15s; }
.steps[open] .schev svg { transform: rotate(90deg); }
span.dots { display: flex; gap: 4px; width: 22px; justify-content: center; align-items: center; flex: none; }
span.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--clay); animation: dot 1.2s ease-in-out infinite; }
span.dots i:nth-child(2) { animation-delay: .15s; } span.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 100% { opacity: .35; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
.steps.running .slabel { background: linear-gradient(90deg, var(--muted) 0%, var(--text) 50%, var(--muted) 100%); background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.6s linear infinite; }
.steps-body { margin: 8px 0 4px 11px; padding-left: 22px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.msg.assistant .steps-body .md { color: var(--muted); font: italic 14px/1.5 var(--serif); }
.steps-body .tool { margin: 0; }
.tool { font: 15px/1.5 var(--sans); }
.tool summary { list-style: none; display: flex; gap: 8px; align-items: center; cursor: pointer; color: var(--muted); padding: 4px 0; }
.tool summary::-webkit-details-marker { display: none; }
@keyframes shimmer { to { background-position: -200% 0; } }
.tool { border: 1px solid var(--border); border-radius: 14px; background: var(--raised); }
.tool summary { padding: 10px 14px; }
.tool .ticon { width: 18px; height: 18px; color: var(--muted); }
.tool .tname { font-weight: 600; color: var(--text-soft); flex: none; font-size: 14px; }
.tool .targ { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12.5px var(--mono); }
.tool .state { margin-left: auto; flex: none; font-size: 12px; }
.tool .state.running::before { content: ""; display: inline-block; width: 11px; height: 11px; border: 2px solid var(--muted); border-right-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
.tool .state.error { color: var(--danger); }
.tool pre { margin: 0; padding: 10px 14px 14px; max-height: 280px; overflow: auto; white-space: pre-wrap; font: 12.5px/1.45 var(--mono); color: var(--muted); border-top: 1px solid var(--border); }

.to-bottom {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--dock-h, 100px) + 10px);
  width: 40px; height: 40px; border-radius: 50%; background: var(--control); border: 1px solid var(--hairline);
  display: grid; place-items: center; box-shadow: var(--shadow); color: var(--text-soft); z-index: 5;
  opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(8px) scale(.85);
  transition: opacity .2s ease, transform .28s var(--spring);
}
.to-bottom.show { opacity: 1; pointer-events: auto; transform: translateX(-50%); }
.to-bottom.show:active { transform: translateX(-50%) scale(.92); }
.to-bottom svg { width: 18px; height: 18px; }

/* ---------- dock & composer ---------- */
.dock { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px calc(16px + var(--safe-right)) calc(8px + var(--safe-bottom)) calc(16px + var(--safe-left)); max-width: 784px; width: 100%; margin: 0 auto; z-index: 4; }
.dock::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--safe-bottom) + 44px); z-index: -1; pointer-events: none;
  background: rgb(from var(--bg) r g b / .85);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  -webkit-mask-image: linear-gradient(transparent, #000 45%); mask-image: linear-gradient(transparent, #000 45%);
}
.recent-chip {
  display: inline-flex; align-items: center; gap: 10px; max-width: calc(100% - 72px); margin: 0 0 8px;
  height: 46px; padding: 0 20px 0 16px; border-radius: 999px; background: var(--chip); border: 1px solid var(--hairline); font-size: 16px; color: var(--text);
}
.recent-chip svg { width: 22px; height: 22px; color: var(--text-soft); }
.recent-chip strong { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-chip small { color: var(--muted); font-size: 16px; flex: none; }

.composer {
  display: grid; align-items: center; column-gap: 8px;
  grid-template-columns: auto 1fr auto auto;
  grid-template-areas: "atts atts atts atts" "plus input input send";
  background: var(--raised); border: 1px solid var(--hairline); border-radius: 26px; box-shadow: var(--shadow);
  padding: 7px; transition: border-radius .18s ease, margin .18s ease;
}
.composer.expanded { grid-template-areas: "atts atts atts atts" "input input input input" "plus model . send"; border-radius: 26px; row-gap: 0; padding: 7px; }
.composer.focused { margin: 0 -8px; }
.composer.expanded :is(.plus, .model-chip, .send) { margin-top: 6px; }
.composer #attachments { grid-area: atts; }
.composer textarea {
  grid-area: input; display: block; width: 100%; resize: none; max-height: 36vh; min-height: 36px;
  font: 18px/24px var(--sans); padding: 6px 8px; border: 0; background: none; color: var(--text); outline: none;
}
.composer.expanded textarea { padding: 8px 4px 8px 5px; min-height: 40px; }
.composer textarea::placeholder { color: var(--muted); }
.plus { grid-area: plus; width: 36px; height: 36px; border-radius: 50%; background: var(--control-2); display: grid; place-items: center; color: var(--text-soft); }
.plus svg { width: 21px; height: 21px; }
.model-chip { grid-area: model; display: none; align-items: center; gap: 6px; height: 36px; padding: 0 16px; border-radius: 999px; background: var(--control-2); font-size: 14.5px; justify-self: start; max-width: 100%; white-space: nowrap; overflow: hidden; }
.composer.expanded .model-chip { display: inline-flex; }
.model-chip b { font-weight: 600; color: var(--text); }
.model-chip i { font-style: normal; color: var(--effort-text); }
.send { grid-area: send; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--send); color: #fff; }
.send svg { width: 20px; height: 20px; stroke-width: 2.3; }
.send:disabled { background: var(--control-2); color: var(--muted); }
.send.stop { background: var(--control-2); color: var(--text); }
.send.stop svg { fill: currentColor; stroke: none; }

/* pending attachments */
.att-row { display: flex; gap: 8px; overflow-x: auto; padding: 0 0 6px; -webkit-overflow-scrolling: touch; }
.att { position: relative; flex: none; }
.att img { width: 80px; height: 80px; object-fit: cover; border-radius: 16px; display: block; }
.att .file-chip { height: 80px; padding-right: 40px; max-width: 210px; }
.att .rm { position: absolute; top: 8px; right: 8px; width: 24px; height: 24px; border-radius: 50%; background: rgb(249 249 247 / .94); color: #111; display: grid; place-items: center; }
.att .rm svg { width: 13px; height: 13px; stroke-width: 2.2; }
.att .progress { position: absolute; inset: 0; border-radius: 16px; background: rgb(0 0 0 / .45); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.att.failed .progress { background: rgb(200 65 47 / .8); }

/* ---------- sheets ---------- */
.sheet-scrim { position: fixed; inset: 0; background: rgb(0 0 0 / .4); z-index: 40; animation: fade .25s ease; }
.sheet-scrim.closing { opacity: 0; transition: opacity .22s ease; pointer-events: none; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 41; margin: 0 auto; max-width: 560px;
  background: var(--sheet); border-radius: 40px; box-shadow: var(--shadow); border: 1px solid var(--hairline);
  padding: 6px 8px max(16px, calc(var(--safe-bottom) - 8px)); max-height: calc(100dvh - var(--safe-top) - 16px); overflow-y: auto; overscroll-behavior: contain;
  animation: up .45s var(--spring);
}
.sheet.closing { transition: transform .25s cubic-bezier(.4, 0, 1, 1); transform: translateY(105%); pointer-events: none; }
@keyframes up { from { transform: translateY(105%); } }
.sheet-grip { width: 58px; height: 5px; border-radius: 3px; background: var(--control-2); margin: 0 auto 6px; }
.sheet h3 { margin: 4px 6px 12px; font-size: 17px; font-weight: 600; text-align: center; }
.sheet-head { display: grid; grid-template-columns: 52px 1fr 52px; align-items: center; margin: 0 8px 22px; }
.sheet-head h3 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.sheet-head .circle { width: 44px; height: 44px; background: var(--control); }
.pill-tag { font-size: 12px; line-height: 16px; font-weight: 600; color: var(--greeting); background: var(--pill); padding: 3px 10px; border-radius: 999px; }
.sheet h3.left { text-align: left; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 6px 14px; border-radius: 18px; background: var(--control); font-size: 14px; font-weight: 500; color: var(--text-soft); }
.tile svg { width: 26px; height: 26px; }
.group { background: var(--group); border-radius: 28px; overflow: hidden; margin: 0 8px 16px; }
.row-btn { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 14px 21px 14px 20px; font-size: 17.5px; line-height: 23px; color: var(--text); }

.row-btn .val { margin-left: auto; color: var(--muted); font-size: 16px; display: inline-flex; align-items: center; gap: 6px; }
.row-btn .val svg { width: 8px; height: 14px; margin-left: 8px; stroke-width: 2; }
.row-btn.danger { color: var(--danger); }
.row-btn svg.lead { width: 22px; height: 22px; color: var(--muted); }
.group > * { position: relative; }
.group > * + *::before { content: ""; position: absolute; left: 20px; right: 20px; top: 0; height: 1px; background: var(--divider); }
.row-btn:active { transform: none; background: var(--control); }
.model-opt .mtext { flex: 1; min-width: 0; }
.model-opt strong { display: block; font-weight: 500; font-size: 17.5px; line-height: 22px; }
.model-opt small { display: block; color: var(--greeting); font-size: 14.5px; font-weight: 500; line-height: 19px; margin-top: 3px; }
.model-opt { padding: 13px 17px 13px 20px; }
.model-opt .check { width: 26px; height: 26px; color: var(--check); visibility: hidden; stroke-width: 2.9; }
.model-opt[aria-selected=true] .check { visibility: visible; }
.seg-wrap { padding: 12px 16px 14px; }
.seg-wrap .label { font-size: 15px; color: var(--muted); margin-bottom: 8px; }
.seg { display: flex; background: var(--control-2); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { flex: 1; padding: 8px 2px; border-radius: 9px; font-size: 14px; color: var(--muted); white-space: nowrap; }
.seg button[aria-checked=true] { background: var(--sheet); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgb(0 0 0 / .18); }
.toggle-row { display: flex; align-items: center; gap: 12px; padding: 13px 16px; cursor: pointer; }
.toggle-row > span:first-child { flex: 1; font-size: 17px; }
.toggle-row small { display: block; color: var(--muted); font-size: 14px; }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 51px; height: 31px; border-radius: 16px; background: var(--control-2); position: relative; transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; transition: transform .2s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 2px 4px rgb(0 0 0 / .25); }
.toggle-row input:checked + .switch { background: #34c759; }
.toggle-row input:checked + .switch::after { transform: translateX(20px); }
.sheet-input { width: 100%; font-size: 17px; padding: 13px 14px; border-radius: 14px; border: 1px solid var(--border); background: var(--bg); color: var(--text); outline: none; margin-bottom: 12px; }
.sheet-actions { display: flex; gap: 10px; }
.sheet-actions .btn { flex: 1; padding: 13px; font-size: 17px; }
.btn.danger { background: var(--danger); color: #fff; }
.sheet .note { color: var(--muted); font-size: 15px; text-align: center; margin: -4px 8px 16px; }

.lightbox { position: fixed; inset: 0; z-index: 60; background: rgb(0 0 0 / .94); display: grid; place-items: center; padding: var(--safe-top) 0 var(--safe-bottom); animation: fade .15s; }
.lightbox img { max-width: 100vw; max-height: 100dvh; object-fit: contain; }

.toast {
  position: fixed; left: 50%; top: calc(64px + var(--safe-top)); transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 14px; font-size: 15px; z-index: 70;
  max-width: calc(100vw - 32px); box-shadow: var(--shadow); animation: toast-in .4s var(--spring);
  transition: opacity .25s ease, transform .25s ease;
}
.toast.leaving { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(.96); }
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(-14px) scale(.96); } }

/* ---------- motion ---------- */
/* Enter animations survive re-renders: JS sets a negative --age (ms since the thing appeared),
   so a replaced element continues the animation instead of restarting it. */
.msg.user.enter { animation: msg-in .42s var(--spring) both; animation-delay: calc(var(--age, 0) * -1ms); transform-origin: 100% 100%; }
@keyframes msg-in { from { opacity: 0; transform: translateY(18px) scale(.96); } }
.msg.assistant.done :is(.actions, .disclaimer) { animation: rise .4s var(--out) both; animation-delay: calc(var(--age, 0) * -1ms); }
.msg.assistant.done .disclaimer { animation-delay: calc(80ms - var(--age, 0) * 1ms); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.msg.assistant.done .steps .sicon { animation: pop .35s var(--spring) both; animation-delay: calc(var(--age, 0) * -1ms); }
/* Newly streamed words fade in (wrapped by JS; delay is negative so re-renders don't restart). */
.ink { animation: ink .5s ease-out both; }
@keyframes ink { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } }
.send:enabled:not(.stop), .send.stop { animation: pop .3s var(--spring); }
.bubble { transition: transform .15s ease, filter .15s ease; }
.bubble:active { transform: scale(.98); filter: brightness(.96); }
.steps-body { overflow: hidden; }
.empty.enter > * { animation: rise .55s var(--out) both; }
.empty.enter > :nth-child(2) { animation-delay: 70ms; }
.empty.enter .empty-spark svg { animation: spark-in .8s var(--spring) both; }
@keyframes spark-in { from { opacity: 0; transform: rotate(-90deg) scale(.6); } }
.messages.enter { animation: fade .25s ease both; }
.recent-chip:not([hidden]) { animation: rise .4s var(--out) .12s both; }
.att { animation: pop .3s var(--spring) both; animation-delay: calc(var(--age, 99999) * -1ms); }
.chat-row { transition: background-color .15s ease; }

/* ⋯ menu: an iOS-style popover that grows out of the button */
.menu-pop {
  position: fixed; z-index: 45; min-width: 230px; padding: 6px; border-radius: 22px;
  background: rgb(from var(--raised) r g b / .9); -webkit-backdrop-filter: blur(30px) saturate(1.6); backdrop-filter: blur(30px) saturate(1.6);
  border: 1px solid var(--hairline); box-shadow: 0 10px 40px rgb(0 0 0 / .28);
  transform-origin: var(--ox, 100%) var(--oy, 0); animation: menu-in .38s var(--spring) both;
}
.menu-pop.closing { animation: menu-out .18s ease-in both; pointer-events: none; }
@keyframes menu-in { from { opacity: 0; transform: scale(.4); } }
@keyframes menu-out { to { opacity: 0; transform: scale(.7); } }
.menu-pop button { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 11px 14px; border-radius: 14px; font-size: 17px; color: var(--text); text-align: left; }
.menu-pop button:active { transform: none; background: var(--control); }
.menu-pop button svg { width: 21px; height: 21px; color: var(--text-soft); stroke-width: 1.7; }
.menu-pop button.danger, .menu-pop button.danger svg { color: var(--danger); }
.menu-pop hr { border: 0; height: 1px; background: var(--divider); margin: 4px 10px; }
.menu-catch { position: fixed; inset: 0; z-index: 44; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}
.contents { display: contents; }
.popin { animation: pop .3s var(--spring); }

/* =====================================================================================
   Desktop (≥900px): fixed sidebar, centred reading column, popovers instead of sheets.
   Layout and dark palette follow claude.ai on desktop; phones keep the iOS-app look above.
   ===================================================================================== */
.uacts, .row-more, .model-chip .mchev { display: none; }
@media (max-width: 899.98px) { .desk-only { display: none !important; } }
@media (min-width: 900px) {
  .mobile-only { display: none !important; }
  :root {
    --side-w: 288px;
    --rail-w: 52px;
    --hover: rgb(0 0 0 / .045);
    --kbd: rgb(0 0 0 / .05);
  }
}
@media (min-width: 900px) and (prefers-color-scheme: dark) {
  :root {
    --bg: #191919;
    --drawer: #1f1f1f;
    --raised: #303030;
    --control: #2a2a2a;
    --control-2: #3a3a3a;
    --row-active: #353535;
    --sheet: #242424;
    --group: #2c2c2c;
    --border: #303030;
    --divider: #3a3a3a;
    --chip: #222222;
    --user-bubble: #2c2c2a;
    --code-bg: #141414;
    --hover: rgb(255 255 255 / .055);
    --kbd: rgb(255 255 255 / .07);
  }
}
@media (min-width: 900px) {
  body { font-size: 15px; }
  .app { display: flex; background: var(--bg); }
  .shade, #menu, .top-pill, .topbar .title, .recent-chip { display: none !important; }

  /* ---- sidebar ---- */
  .drawer {
    position: relative; inset: auto; flex: none; width: var(--side-w); opacity: 1; overflow: hidden;
    padding: 0; border-right: 1px solid var(--border); transition: width .22s var(--out);
  }
  .drawer-head { height: 52px; padding: 0 10px; gap: 8px; justify-content: flex-start; flex: none; }
  .wordmark { font-size: 21px; white-space: nowrap; }
  .side-toggle { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); flex: none; }
  .side-toggle svg { width: 20px; height: 20px; stroke-width: 1.6; }
  .side-nav { display: flex; flex-direction: column; gap: 1px; padding: 2px 8px 6px; flex: none; }
  .nav-row { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 8px 0 7px; border-radius: 8px; font-size: 14.5px; color: var(--text); white-space: nowrap; text-align: left; }
  .nav-ic { width: 20px; height: 20px; display: grid; place-items: center; flex: none; color: var(--text-soft); }
  .nav-ic svg { width: 19px; height: 19px; stroke-width: 1.7; }
  .nav-ic.new { border-radius: 50%; background: var(--clay); color: #fff; }
  .nav-ic.new svg { width: 14px; height: 14px; stroke-width: 2.4; }
  .kbd { margin-left: auto; font: 11px/1 var(--sans); color: var(--muted); padding: 4px 6px; border-radius: 5px; background: var(--kbd); opacity: 0; transition: opacity .15s; }
  .nav-row:hover .kbd, .nav-row:focus-visible .kbd { opacity: 1; }
  .search { margin: 2px 12px 6px; border-radius: 8px; padding: 0 10px; flex: none; }
  .search svg { width: 16px; height: 16px; }
  .search input { font-size: 14px; padding: 7px 0; }
  .chat-list { padding: 0 8px 12px; scrollbar-width: thin; scrollbar-color: var(--control-2) transparent; }
  .chat-list h4 { margin: 14px 10px 4px; font-size: 12.5px; font-weight: 500; color: var(--muted); }
  .chat-list .empty-list { font-size: 13.5px; padding: 10px; }
  .chat-row { height: 34px; padding: 0 4px 0 10px; gap: 8px; border-radius: 8px; font-size: 14px; font-weight: 400; letter-spacing: 0; color: var(--text-soft); }
  .chat-row > span:first-child > svg:not(.spark) { display: none; }
  .chat-row span.dots { width: 18px; gap: 3px; margin-right: 2px; }
  .chat-row span.dots i { width: 4px; height: 4px; }
  .chat-row > span:not(.row-more):not(.dots) { flex: 1; }
  .chat-row.current { color: var(--text); }
  .row-more { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 6px; color: var(--muted); opacity: 0; }
  .row-more svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
  .chat-row:hover .row-more, .chat-row.current .row-more, .row-more:focus-visible { opacity: 1; }
  .row-more:hover { color: var(--text); background: var(--hover); }
  .drawer-foot { padding: 8px; border-top: 1px solid var(--border); flex: none; }
  .account { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px; border-radius: 10px; text-align: left; }
  .account:not(:disabled):active { transform: none; }
  .avatar.sm { width: 28px; height: 28px; font-size: 13px; background: var(--clay); color: #fff; flex: none; }
  .acct-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .acct-chev { width: 16px; height: 16px; color: var(--muted); }
  :is(.side-toggle, .nav-row, .chat-row, .account):hover { background: var(--hover); }
  .chat-row.current, .chat-row.current:hover { background: var(--row-active); }
  :is(.nav-row, .chat-row, .side-toggle):not(:disabled):active { transform: none; }

  /* collapsed: icon rail */
  .app.rail .drawer { width: var(--rail-w); }
  .app.rail :is(.wordmark, .nav-label, .kbd, .chat-list, .search, .acct-name, .acct-chev) { display: none !important; }
  .app.rail .side-nav { flex: 1; padding: 2px 10px; }
  .app.rail .nav-row { width: 32px; padding: 0; justify-content: center; }
  .app.rail .drawer-foot { border-top-color: transparent; padding: 8px 9px; }
  .app.rail .account { width: 34px; padding: 3px; }

  /* ---- main column ---- */
  .main { position: relative; flex: 1; min-width: 0; transform: none !important; }
  .app.shifted .main { border-radius: 0; box-shadow: none; }
  .topbar { height: 52px; padding: 0 14px; }
  .topbar::before { height: 64px; }
  .title-btn { display: inline-flex; align-items: center; gap: 4px; max-width: min(60%, 560px); height: 32px; padding: 0 6px 0 8px; border-radius: 8px; font-size: 14.5px; color: var(--text); }
  .title-btn span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .title-btn svg { width: 16px; height: 16px; color: var(--muted); }
  .title-btn:hover { background: var(--hover); }
  .title-btn:not(:disabled):active { transform: none; }
  .scroller { scrollbar-width: thin; scrollbar-color: var(--control-2) transparent; }

  .messages { padding: 76px 32px calc(var(--dock-h, 100px) + 36px); max-width: 832px; gap: 30px; }
  .msg.user { max-width: 80%; gap: 4px; }
  .bubble { font-size: 15.5px; line-height: 1.6; padding: 10px 16px; border-radius: 18px; cursor: text; }
  .bubble:active { transform: none; filter: none; }
  .msg.assistant .md { font: 16.5px/1.7 var(--serif); }
  .md pre code, .md .hljs { font-size: 13px; }
  .uacts { display: flex; gap: 2px; margin-right: -4px; color: var(--action); opacity: 0; transition: opacity .15s; }
  .msg.user:hover .uacts, .uacts:focus-within { opacity: 1; }
  .uacts button, .actions button { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; }
  .uacts svg, .actions svg { width: 17px; height: 17px; stroke-width: 1.7; }
  :is(.uacts, .actions) button:hover { background: var(--hover); color: var(--text); }
  .actions { margin-top: 10px; }
  .disclaimer { font-size: 13px; }
  .steps { font-size: 15px; }
  .steps summary:hover .slabel { color: var(--text); }
  .md pre .copy:hover { background: var(--hover); color: var(--text); }
  .edit-box { width: min(640px, 70vw); }
  .edit-box textarea { font-size: 15.5px; border-radius: 14px; }
  .btn { font-size: 14px; border-radius: 10px; padding: 8px 14px; }

  /* ---- composer ---- */
  .dock { max-width: 832px; padding: 0 32px 18px; display: flex; flex-direction: column; }
  .composer, .composer.expanded {
    grid-template-columns: auto 1fr auto auto;
    grid-template-areas: "atts atts atts atts" "input input input input" "plus . model send";
    row-gap: 0; border-radius: 20px; padding: 10px 10px 10px 12px; margin: 0;
    border: 1px solid var(--border); box-shadow: 0 2px 10px rgb(0 0 0 / .07);
    transition: border-color .15s ease;
  }
  .composer:focus-within { border-color: rgb(from var(--text) r g b / .22); }
  .composer textarea, .composer.expanded textarea { font: 16px/24px var(--sans); padding: 6px 6px 10px; min-height: 52px; max-height: 40vh; }
  .composer.expanded :is(.plus, .model-chip, .send) { margin-top: 0; }
  .plus { width: 32px; height: 32px; border-radius: 8px; background: transparent; border: 1px solid var(--border); }
  .plus svg { width: 18px; height: 18px; }
  .plus:hover { background: var(--hover); }
  .composer .model-chip { display: inline-flex; justify-self: end; height: 32px; padding: 0 6px 0 10px; margin-right: 6px; border-radius: 8px; background: transparent; font-size: 14px; gap: 6px; }
  .model-chip b { font-weight: 500; }
  .model-chip .mchev { display: block; width: 14px; height: 14px; color: var(--muted); }
  .model-chip:hover { background: var(--hover); }
  .send { width: 32px; height: 32px; border-radius: 9px; }
  .send svg { width: 18px; height: 18px; }
  .send:not(:disabled):active, .plus:active, .model-chip:active { transform: scale(.96); }

  /* ---- new chat: greeting + composer centred, starters underneath ---- */
  .app.is-empty .empty { flex-direction: row; justify-content: center; align-items: flex-end; gap: 14px; min-height: 0; height: calc(50% - 34px); padding: 0 32px 30px; }
  .empty-spark svg { width: 38px; height: 38px; display: block; }
  .empty h2 { font-size: 40px; line-height: 1.1; font-weight: 400; margin: 0; color: var(--text-soft); }
  .empty.enter > :nth-child(2) { animation-delay: 40ms; }
  .app.is-empty .dock { top: calc(50% - 34px); bottom: auto; }
  .app.is-empty .dock::before { display: none; }
  .starters { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }
  .starters:not([hidden]) { animation: rise .4s var(--out) .08s both; }
  .starter { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px 0 11px; border-radius: 10px; border: 1px solid var(--border); background: var(--chip); font-size: 14px; color: var(--text-soft); }
  .starter svg { width: 16px; height: 16px; color: var(--muted); stroke-width: 1.7; }
  .starter svg.spark { width: 15px; height: 15px; }
  .starter:hover { color: var(--text); border-color: rgb(from var(--text) r g b / .2); }

  /* ---- drag & drop ---- */
  .drop-zone { position: absolute; inset: 0; z-index: 30; display: grid; place-items: center; pointer-events: none; background: rgb(from var(--bg) r g b / .82); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade .15s ease; }
  .drop-zone > div { border: 2px dashed rgb(from var(--text) r g b / .3); border-radius: 22px; padding: 44px 60px; font-size: 16px; color: var(--text-soft); }

  /* ---- sheets become centred dialogs ---- */
  .sheet-scrim { background: rgb(0 0 0 / .5); }
  .sheet {
    top: 50%; left: 50%; right: auto; bottom: auto; margin: 0; width: min(440px, calc(100vw - 48px)); max-width: none;
    transform: translate(-50%, -50%); border-radius: 18px; padding: 20px 18px 18px; max-height: calc(100dvh - 64px);
    animation: dlg-in .2s var(--out);
  }
  .sheet.closing { transition: opacity .15s ease, transform .15s ease; opacity: 0; transform: translate(-50%, -50%) scale(.97); }
  @keyframes dlg-in { from { opacity: 0; transform: translate(-50%, -48%) scale(.97); } }
  .sheet-grip { display: none; }
  .sheet h3 { text-align: left; margin: 0 4px 14px; font-size: 17px; }
  .sheet .note { text-align: left; margin: -6px 4px 18px; font-size: 14.5px; }
  .sheet-actions { justify-content: flex-end; }
  .sheet-actions .btn { flex: none; padding: 9px 16px; font-size: 14px; }
  .sheet-input { font-size: 15px; padding: 10px 12px; border-radius: 10px; }
  .sheet .group { margin: 0 0 12px; border-radius: 14px; }
  .row-btn { font-size: 15px; padding: 11px 16px; }
  .row-btn:hover { background: var(--hover); }

  /* ---- popover menus ---- */
  .menu-pop {
    min-width: 210px; max-width: 340px; padding: 5px; border-radius: 12px; background: var(--raised);
    -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: 0 10px 34px rgb(0 0 0 / .22);
    transform-origin: var(--ox, 100%) var(--oy, 0); animation: menu-in-d .14s var(--out) both;
  }
  .menu-pop.closing { animation: menu-out-d .1s ease-in both; }
  @keyframes menu-in-d { from { opacity: 0; transform: scale(.96); } }
  @keyframes menu-out-d { to { opacity: 0; transform: scale(.98); } }
  .menu-pop button { flex-direction: row-reverse; justify-content: flex-end; gap: 10px; padding: 7px 10px; border-radius: 8px; font-size: 14px; }
  .menu-pop button svg { width: 17px; height: 17px; }
  .menu-pop button:hover, .menu-pop button:focus-visible { background: var(--hover); outline: none; }
  .menu-pop button:not(:disabled):active { transform: none; }
  .menu-pop hr { margin: 4px 6px; }
  .menu-pop .pop-head { padding: 7px 10px 6px; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .menu-pop .pop-label { padding: 6px 10px 6px; font-size: 12.5px; color: var(--muted); margin: 0; }
  .menu-pop button.mopt { flex-direction: row; justify-content: space-between; gap: 18px; padding: 8px 10px; }
  .mopt .mtext { min-width: 0; text-align: left; }
  .mopt strong { display: block; font-weight: 500; font-size: 14px; line-height: 19px; }
  .mopt small { display: block; color: var(--muted); font-size: 12.5px; line-height: 17px; }
  .mopt .check { width: 18px; height: 18px; stroke-width: 2.4; color: var(--check); visibility: hidden; }
  .mopt[aria-checked=true] .check { visibility: visible; }
  .menu-pop .seg { margin: 0 6px 6px; background: var(--control); border-radius: 9px; }
  .menu-pop .seg button { flex: 1; justify-content: center; padding: 5px 4px; font-size: 12.5px; border-radius: 7px; color: var(--muted); }
  .menu-pop .seg button[aria-checked=true] { background: var(--bg); color: var(--text); }

  .toast { font-size: 14px; top: 64px; }
  .tool summary:hover .tname { color: var(--text); }
}
