/* ai.syamx.com: syamx AI, a general AI assistant. Pure black, white and translucent white; the violet and teal of
   the syamx orb used small. Layout like ChatGPT and Claude: a chat-history sidebar (a drawer on phones) beside the
   conversation. Two states on <body>: .home (welcome screen over the night sky, message box in the middle) and
   .chatting (conversation, message box pinned to the bottom). The box moves between them with a FLIP animation in
   ai.js (no view transition: its page photo blanked the WebGL sky and flashed the background). Answer Markdown
   styles: /md.css. */

*, *::before, *::after { box-sizing: border-box; }

html {
  --kb: 0px;          /* iPhone keyboard height, set by ai.js */
  --dock-h: 150px;    /* height of the pinned message box, set by ai.js */
  --side: 272px;      /* sidebar width */
  --ease: cubic-bezier(.2, .9, .25, 1);
  background: #000;
  color: #fff;
  -webkit-text-size-adjust: 100%;
  scrollbar-color: rgb(255 255 255 / .16) transparent;
}
body {
  --side-w: var(--side); /* space the sidebar takes: 0 when it's closed or a drawer */
  margin: 0;
  min-height: 100svh;
  font: 400 16px/1.5 ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
body.side-closed { --side-w: 0px; }
::selection { background: #fff; color: #000; }
h1, p { margin: 0; }
img { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 60; padding: 10px 16px; border-radius: 999px; background: #fff; color: #000; text-decoration: none; font-size: 14px; }
.skip:focus { top: 12px; }
:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.nojs { position: fixed; inset: auto 0 24px; text-align: center; color: rgb(255 255 255 / .6); font-size: 14px; }
kbd { font: inherit; }

.icon-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: rgb(255 255 255 / .72);
  cursor: pointer;
  transition: background-color .2s, color .2s;
}
.icon-btn:hover { background: rgb(255 255 255 / .08); color: #fff; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- the night sky (fx.js "galaxy"), welcome screen only ---------- */
.sky { position: fixed; inset: 0 0 0 var(--side-w); z-index: 0; pointer-events: none; transition: opacity .7s ease, left .35s var(--ease); }
.sky canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity 1.6s ease; }
.sky canvas.on { opacity: 1; }
.sky::after { content: ""; position: absolute; inset: 0; background: radial-gradient(56% 46% at 50% 48%, rgb(0 0 0 / .55), rgb(0 0 0 / 0) 72%); }
.chatting .sky { opacity: 0; }

/* ---------- sidebar: chat history ---------- */
.side {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: var(--side);
  padding: 0 10px calc(10px + env(safe-area-inset-bottom));
  background: #0a0a0c;
  border-right: 1px solid rgb(255 255 255 / .07);
  transition: transform .35s var(--ease), visibility 0s;
}
.side-closed .side { transform: translateX(-100%); visibility: hidden; transition: transform .35s var(--ease), visibility 0s .35s; }
.side-head { display: flex; align-items: center; justify-content: space-between; height: 64px; padding: 0 0 0 4px; }
.brand { display: flex; align-items: center; gap: 11px; height: 40px; padding: 0 8px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; }
.brand img, .bar-brand img { width: 70px; height: auto; }
.brand-rule { width: 1px; height: 15px; background: rgb(255 255 255 / .22); }
.brand-ai { font-size: 15px; font-weight: 600; letter-spacing: .01em; color: rgb(255 255 255 / .82); }

.side-new {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  margin: 4px 0 6px;
  padding: 0 10px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color .2s;
}
.side-new:hover { background: rgb(255 255 255 / .07); }
.side-new svg, .side-search svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.side-new span { flex: 1; }
.side kbd { font-size: 12px; color: rgb(255 255 255 / .34); letter-spacing: .04em; }
.side-search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  margin-bottom: 8px;
  padding: 0 10px;
  border-radius: 12px;
  background: rgb(255 255 255 / .05);
  color: rgb(255 255 255 / .55);
  transition: background-color .2s;
}
.side-search:focus-within { background: rgb(255 255 255 / .08); color: #fff; }
.side-search input { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: transparent; color: #fff; font-size: 14.5px; }
.side-search input::placeholder { color: rgb(255 255 255 / .45); }
.side-search input::-webkit-search-cancel-button { filter: invert(1); opacity: .5; }

.side-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -4px; padding: 0 4px 8px; scrollbar-width: thin; }
.side-group { margin: 14px 0 4px; padding: 0 10px; font-size: 12px; font-weight: 500; color: rgb(255 255 255 / .42); }
.side-empty { margin: 18px 10px; font-size: 13.5px; line-height: 1.5; color: rgb(255 255 255 / .42); }
.row { position: relative; display: flex; align-items: center; height: 38px; border-radius: 10px; transition: background-color .15s; }
.row:hover, .row:focus-within { background: rgb(255 255 255 / .05); }
.row[aria-current="page"] { background: rgb(255 255 255 / .1); }
.row-open { flex: 1; min-width: 0; height: 100%; padding: 0 4px 0 10px; border: 0; border-radius: 10px; background: transparent; color: rgb(255 255 255 / .8); font-size: 14px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.row[aria-current="page"] .row-open { color: #fff; }
.row-more { width: 32px; height: 32px; margin-right: 3px; border-radius: 8px; opacity: 0; }
.row:hover .row-more, .row:focus-within .row-more, .row[aria-current="page"] .row-more, .row-more[aria-expanded="true"] { opacity: 1; }
.row-more svg { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.row-edit { flex: 1; min-width: 0; height: 30px; margin: 0 6px; padding: 0 8px; border: 1px solid rgb(255 255 255 / .28); border-radius: 8px; outline: 0; background: #000; color: #fff; font-size: 14px; }
.row.confirm { flex-wrap: wrap; gap: 6px; height: auto; padding: 8px 6px 8px 10px; background: rgb(255 255 255 / .07); }
.row.confirm p { flex: 1 1 100%; font-size: 13.5px; color: rgb(255 255 255 / .82); }
.mini { height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: rgb(255 255 255 / .1); font-size: 13px; font-weight: 500; cursor: pointer; transition: background-color .2s; }
.mini:hover { background: rgb(255 255 255 / .16); }
.mini.danger { background: #fff; color: #000; }
.mini.danger:hover { background: rgb(255 255 255 / .86); }

.menu {
  position: fixed;
  z-index: 50;
  min-width: 168px;
  padding: 6px;
  border: 1px solid rgb(255 255 255 / .1);
  border-radius: 14px;
  background: #151517;
  box-shadow: 0 18px 50px rgb(0 0 0 / .6);
  animation: menu-in .16s ease both;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; height: 38px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; font-size: 14px; text-align: left; cursor: pointer; }
.menu button:hover, .menu button:focus-visible { background: rgb(255 255 255 / .08); outline: 0; }
.menu svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.menu .danger { color: #ff9b91; }

.side-foot { padding: 10px 10px 0; border-top: 1px solid rgb(255 255 255 / .07); }
.side-foot a { display: inline-flex; align-items: center; gap: 5px; height: 32px; color: rgb(255 255 255 / .75); font-size: 13.5px; text-decoration: none; }
.side-foot a:hover { color: #fff; }
.side-foot a svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.side-foot p { font-size: 12px; color: rgb(255 255 255 / .38); }

.scrim { position: fixed; inset: 0; z-index: 35; background: rgb(0 0 0 / .6); animation: fade .25s ease both; }
.scrim[hidden] { display: none; }

/* ---------- top bar ---------- */
.bar {
  position: fixed;
  inset: 0 0 auto var(--side-w);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 64px;
  padding: 0 16px;
  isolation: isolate;
  transition: left .35s var(--ease);
}
.bar::before { content: ""; position: absolute; inset: 0 0 -14px; z-index: -1; background: linear-gradient(#000 52%, rgb(0 0 0 / 0)); opacity: 0; transition: opacity .7s ease; pointer-events: none; }
.chatting .bar::before { opacity: 1; }
.side-open, .bar-new, .bar-brand { display: none; }
.side-closed .side-open, .side-closed .bar-new { display: grid; }
.bar-brand { align-items: center; gap: 10px; height: 40px; color: #fff; text-decoration: none; }
.bar-title { min-width: 0; margin-left: 8px; font-size: 15px; font-weight: 500; color: rgb(255 255 255 / .82); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- the orb: violet, lilac and teal light turning inside a sphere ---------- */
.orb {
  position: relative;
  flex: none;
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  background: #1a1440;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .14);
}
.orb::before { content: ""; position: absolute; inset: -30%; background: conic-gradient(from 0deg, #7a5cff, #3fc7d9, #c4b5ff, #5b3df5, #7a5cff); filter: blur(5px); animation: orb-turn 6s linear infinite; }
.orb i { position: absolute; inset: 22% 26% 34% 22%; border-radius: 50%; background: radial-gradient(circle at 40% 35%, rgb(255 255 255 / .95), rgb(255 255 255 / 0) 70%); filter: blur(1.5px); animation: orb-drift 5s ease-in-out infinite alternate; }
.orb.big { width: 60px; height: 60px; box-shadow: inset 0 0 0 1px rgb(255 255 255 / .14), 0 0 40px rgb(122 92 255 / .22); }
.orb.big::before { filter: blur(10px); }
.msg.working .orb::before { animation-duration: 1.6s; }
.msg.working .orb { animation: orb-pulse 1.4s ease-in-out infinite; }
@keyframes orb-turn { to { transform: rotate(360deg); } }
@keyframes orb-drift { to { transform: translate(18%, 14%) scale(.85); } }
@keyframes orb-pulse { 50% { transform: scale(1.08); } }

/* ---------- layout: welcome screen ---------- */
.stage { position: relative; z-index: 1; margin-left: var(--side-w); transition: margin-left .35s var(--ease); }
.home .stage {
  display: grid;
  /* minmax(0, 1fr): the nowrap keyboard hint would otherwise set the column's minimum and overflow phones */
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  justify-items: center;
  gap: 28px;
  min-height: 100svh;
  padding: 96px 20px 13vh;
}
.welcome { display: grid; justify-items: center; gap: 24px; text-align: center; }
.welcome h1 { font-size: clamp(30px, 4.2vw, 46px); font-weight: 600; line-height: 1.1; letter-spacing: -.035em; text-wrap: balance; }
.welcome h1 span { display: block; color: rgb(255 255 255 / .46); }
.home .log, .chatting .welcome, .chatting .chips { display: none; }
.home .welcome > * { animation: rise .8s cubic-bezier(.22, 1, .36, 1) both; }
.home .welcome h1 { animation-delay: .08s; }
/* opacity only on the dock: a transform would trap the fixed note inside it */
.home .dock { animation: fade .8s .16s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes fade { from { opacity: 0; } }

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; width: min(760px, 100%); margin-top: -10px; }
.chip {
  height: 40px;
  padding: 0 16px;
  border: 1px solid rgb(255 255 255 / .1);
  border-radius: 999px;
  background: rgb(0 0 0 / .45);
  color: rgb(255 255 255 / .78);
  font-size: 14px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  animation: chip-in .6s cubic-bezier(.22, 1, .36, 1) forwards;
  animation-delay: calc(.3s + var(--i) * .06s);
  transition: background-color .2s, border-color .2s, color .2s;
}
.chip:hover { background: rgb(255 255 255 / .08); border-color: rgb(255 255 255 / .2); color: #fff; }
@keyframes chip-in { to { opacity: 1; transform: none; } }

/* ---------- layout: conversation ---------- */
.chatting .stage { padding: 88px 0 calc(var(--dock-h) + 28px); }
.log { display: flex; flex-direction: column; gap: 30px; width: min(760px, 100% - 48px); margin: 0 auto; }

.msg { animation: msg-in .45s cubic-bezier(.22, 1, .36, 1) both; }
.log.instant .msg { animation: none; }
@keyframes msg-in { from { opacity: 0; transform: translateY(10px); } }
.msg.user { align-self: flex-end; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; max-width: min(82%, 600px); }
.bubble { padding: 11px 18px; border-radius: 22px; background: rgb(255 255 255 / .09); }
.bubble p { font-size: 16px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-files { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.msg-files img { width: auto; max-width: 240px; max-height: 200px; border: 1px solid rgb(255 255 255 / .1); border-radius: 16px; object-fit: cover; }
.file-chip { display: flex; align-items: center; gap: 10px; max-width: 280px; height: 52px; padding: 0 14px 0 10px; border: 1px solid rgb(255 255 255 / .1); border-radius: 14px; background: rgb(255 255 255 / .05); }
.file-chip .ext { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; background: rgb(255 255 255 / .1); font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.file-chip > span:last-child { min-width: 0; }
.file-chip b { display: block; font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-chip small { display: block; font-size: 12px; color: rgb(255 255 255 / .45); }
.user-acts { display: flex; gap: 2px; margin-right: -6px; }
.user-acts .act { width: 34px; padding: 0; justify-content: center; }
.user-acts .act span { display: none; }

/* editing a sent message */
.editor { width: min(600px, 100%); padding: 10px; border: 1px solid rgb(255 255 255 / .2); border-radius: 20px; background: rgb(255 255 255 / .06); }
.editor textarea { display: block; width: 100%; min-height: 48px; max-height: 260px; padding: 6px 8px; resize: none; border: 0; outline: 0; background: transparent; color: #fff; font-size: 16px; line-height: 1.5; }
.editor-bar { display: flex; justify-content: flex-end; gap: 6px; padding-top: 6px; }

.msg.bot { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 16px; align-items: start; }
.bot-col { min-width: 0; padding-top: 2px; }
.bot-body { font-size: 16px; line-height: 1.7; color: rgb(255 255 255 / .88); }
.thought { margin: 0 0 8px; font-size: 13px; color: rgb(255 255 255 / .42); }
.cut { margin: 14px 0 0; font-size: 14px; color: rgb(255 255 255 / .6); }
.thinking {
  display: block;
  line-height: 24px;
  font-size: 15px;
  background: linear-gradient(90deg, rgb(255 255 255 / .32) 0%, #fff 50%, rgb(255 255 255 / .32) 100%) 0 0 / 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.err { margin-top: 10px; font-size: 15px; color: rgb(255 255 255 / .7); }
.retry { border: 0; padding: 0; background: none; color: #fff; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* actions under messages, always visible */
.acts { display: flex; gap: 2px; margin: 10px 0 0 -10px; }
.act {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgb(255 255 255 / .5);
  font-size: 13px;
  cursor: pointer;
  transition: background-color .2s, color .2s;
}
.act:hover { background: rgb(255 255 255 / .07); color: #fff; }
.act.done { color: #fff; }
.act svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- the message box ---------- */
.dock { width: min(760px, 100%); }
.chatting .dock {
  position: fixed;
  inset: auto 0 var(--kb) var(--side-w);
  z-index: 10;
  width: auto;
  padding: 36px 16px calc(10px + env(safe-area-inset-bottom));
  isolation: isolate;
  transition: left .35s var(--ease);
}
.chatting .dock > * { max-width: 760px; margin-inline: auto; }
.chatting .dock::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(rgb(0 0 0 / 0), #000 36px); animation: fade .7s ease both; pointer-events: none; }
.composer {
  position: relative;
  border-radius: 28px;
  background: rgb(15 15 18 / .94);
  border: 1px solid rgb(255 255 255 / .11);
  box-shadow: 0 24px 64px rgb(0 0 0 / .5);
  transition: border-color .25s, background-color .25s;
}
.composer:focus-within { border-color: rgb(255 255 255 / .24); background: rgb(19 19 23 / .96); }
/* while an answer is written, a thin line of the orb's light runs round the box */
@property --turn { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
.composer::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--turn), rgb(122 92 255 / 0) 0deg, rgb(122 92 255 / 0) 200deg, #7a5cff 270deg, #3fc7d9 320deg, #c4b5ff 350deg, rgb(196 181 255 / 0) 360deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s ease;
}
.busy .composer::before { opacity: 1; animation: turn 2.2s linear infinite; }
@keyframes turn { to { --turn: 360deg; } }

.tray { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 14px 0; }
.tray[hidden] { display: none; }
.tray-item { position: relative; }
.tray-item img { width: 60px; height: 60px; border: 1px solid rgb(255 255 255 / .1); border-radius: 14px; object-fit: cover; }
.tray-item .file-chip { height: 60px; max-width: 240px; }
.tray-x {
  position: absolute;
  top: -7px;
  right: -7px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid #0f0f12;
  border-radius: 50%;
  background: #fff;
  color: #000;
  cursor: pointer;
}
.tray-x::after { content: ""; position: absolute; inset: -8px; } /* a 40px tap area */
.tray-x svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.tray-item.reading { opacity: .5; }

.composer textarea {
  display: block;
  width: 100%;
  min-height: 52px;
  max-height: 240px;
  padding: 16px 22px 4px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font: 400 16px/1.5 ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  scrollbar-width: thin;
}
.home .composer textarea { min-height: 72px; padding-top: 18px; }
.composer textarea::placeholder { color: rgb(255 255 255 / .4); }
.tools { display: flex; align-items: center; gap: 10px; padding: 4px 10px 10px; }
.attach { width: 38px; height: 38px; border: 1px solid rgb(255 255 255 / .12); border-radius: 50%; }
.attach svg { width: 18px; height: 18px; stroke-width: 1.8; }
.hint { min-width: 0; font-size: 12px; color: rgb(255 255 255 / .34); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hint i { font-style: normal; padding: 0 4px; }
.hint kbd { padding: 1px 5px; border: 1px solid rgb(255 255 255 / .12); border-radius: 5px; }
.chatting .hint { display: none; }
.send {
  flex: none;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-left: auto;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #000;
  cursor: pointer;
  transition: background-color .2s, color .2s, transform .2s;
}
.send:disabled { background: rgb(255 255 255 / .1); color: rgb(255 255 255 / .38); cursor: default; }
.send:not(:disabled):hover { background: rgb(255 255 255 / .86); }
.send:not(:disabled):active { transform: scale(.92); }
.send svg { width: 18px; height: 18px; grid-area: 1 / 1; }
.i-send { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i-stop { fill: currentColor; display: none; }
.busy .i-send { display: none; }
.busy .i-stop { display: block; }

.note { padding: 10px 16px 0; text-align: center; font-size: 12px; color: rgb(255 255 255 / .38); }
.home .note { position: fixed; inset: auto 0 calc(18px + env(safe-area-inset-bottom)) var(--side-w); padding: 0 20px; transition: left .35s var(--ease); }

/* ---------- drag and drop, toasts ---------- */
.drop { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; background: rgb(0 0 0 / .72); pointer-events: none; animation: fade .15s ease both; }
.drop[hidden] { display: none; }
.drop > div { display: grid; justify-items: center; gap: 12px; width: min(460px, 100%); padding: 44px 24px; border: 1.5px dashed rgb(255 255 255 / .4); border-radius: 28px; text-align: center; }
.drop svg { width: 34px; height: 34px; fill: none; stroke: #fff; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.drop p { font-size: 17px; font-weight: 500; }
.toast { position: fixed; left: calc(50% + var(--side-w) / 2); bottom: calc(var(--dock-h) + 16px); z-index: 60; max-width: min(460px, 100vw - 32px); padding: 10px 16px; border-radius: 14px; background: #fff; color: #000; font-size: 14px; transform: translateX(-50%); animation: toast-in .25s var(--ease) both; }
.toast[hidden] { display: none; }
.home .toast { bottom: 64px; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* ---------- narrow screens: the sidebar becomes a drawer ---------- */
@media (max-width: 900px) {
  body, body.side-closed { --side-w: 0px; }
  .side, .side-closed .side { width: min(300px, 86vw); transform: translateX(-100%); visibility: hidden; box-shadow: 24px 0 60px rgb(0 0 0 / .5); transition: transform .35s var(--ease), visibility 0s .35s; }
  .side-shown .side { transform: none; visibility: visible; transition: transform .35s var(--ease), visibility 0s; }
  .side-close { display: none; }
  .side-open, .bar-new { display: grid; }
  .bar-new { order: 3; margin-left: auto; }
  .bar-brand, .bar-title { position: absolute; left: 64px; right: 64px; justify-content: center; margin: 0; text-align: center; }
  .home .bar-brand { display: flex; }
  .chatting .bar-brand, .home .bar-title { display: none; }
}

/* ---------- phones ---------- */
@media (max-width: 600px) {
  .bar { height: 56px; padding: 0 8px; }
  .bar-brand img { width: 62px; }
  .home .stage { gap: 24px; padding: 84px 16px 96px; }
  .welcome { gap: 20px; }
  .orb.big { width: 52px; height: 52px; }
  .chips { margin-top: -6px; }
  .chatting .stage { padding-top: 72px; }
  .log { width: calc(100% - 36px); gap: 28px; }
  .msg.bot { grid-template-columns: 24px minmax(0, 1fr); gap: 12px; }
  .msg.bot .orb { width: 24px; height: 24px; }
  .chatting .dock { padding: 28px 10px calc(8px + env(safe-area-inset-bottom)); }
  .composer { border-radius: 24px; }
  .composer textarea { padding: 14px 18px 2px; min-height: 48px; }
  .home .composer textarea { min-height: 60px; }
  .tools { padding: 2px 8px 8px; }
  .note { font-size: 11.5px; padding-top: 8px; }
  .home .note { bottom: calc(14px + env(safe-area-inset-bottom)); }
  .msg-files img { max-width: 180px; max-height: 160px; }
}
@media (hover: none) {
  .hint, .side kbd { display: none; }
  .act { height: 40px; }
  .user-acts .act { width: 40px; }
  .row-more { opacity: 1; }
}
@media (max-height: 560px) {
  .home .note { position: static; padding-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .orb::before, .orb i, .msg.working .orb, .thinking, .menu, .scrim, .drop, .toast { animation: none; }
  .home .welcome > *, .home .dock, .chip, .msg, .chatting .dock::before { animation: none; opacity: 1; transform: none; }
  .busy .composer::before { animation: none; }
  .sky, .sky canvas, .bar::before, .side, .bar, .stage, .chatting .dock, .home .note { transition: none; }
}
