/* ============ vereon — liquid glass ============ */

@font-face {
  font-family: 'Onest'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/onest-latin-wght-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Onest'; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url(fonts/onest-latin-ext-wght-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Unbounded'; font-style: normal; font-weight: 500; font-display: swap;
  src: url(fonts/unbounded-latin-500-normal.woff2) format('woff2');
}

/* ---- Tokens: light ---- */
:root {
  --bg: #ffffff;
  --ink: #121217;
  --ink-2: #5d5e6a;
  --ink-3: #9a9ca8;
  --glass: rgba(255, 255, 255, 0.52);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-hover: rgba(18, 18, 23, 0.045);
  --stroke: rgba(18, 18, 23, 0.08);
  --inner-hi: rgba(255, 255, 255, 0.95);
  --shadow: 0 30px 70px -34px rgba(52, 58, 92, 0.38);
  --danger: #d4325a;

  /* prism */
  --c1: #4fd0f2;
  --c2: #9d82ff;
  --c3: #ff7fb8;
  --c4: #ffc95c;
  --rim-base: rgba(18, 18, 23, 0.10);
  --rim-tint: 0.85;

  /* tubes in the background */
  --tube-body: #f6f7fa;
  --tube-rim: url(#chromeLight);
  --tube-core: rgba(255, 255, 255, 1);
  --tube-fringe-op: 0.85;
  --veil-strength: 0.94;

  --font: 'Onest', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mark: 'Unbounded', 'Onest', sans-serif;
  --mono: ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, monospace;

  color-scheme: light;
}

/* ---- Tokens: dark ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #000000;
    --ink: #f1f1f5;
    --ink-2: #a2a2ae;
    --ink-3: #6a6a76;
    --glass: rgba(255, 255, 255, 0.045);
    --glass-strong: rgba(14, 14, 18, 0.78);
    --glass-hover: rgba(255, 255, 255, 0.06);
    --stroke: rgba(255, 255, 255, 0.08);
    --inner-hi: rgba(255, 255, 255, 0.12);
    --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9);
    --danger: #ff6b8e;
    --c1: #8fe9ff;
    --c2: #c3a6ff;
    --c3: #ffa8d2;
    --c4: #ffe29a;
    --rim-base: rgba(255, 255, 255, 0.10);
    --rim-tint: 0.75;
    --tube-body: #020203;
    --tube-rim: url(#chromeDark);
    --tube-core: rgba(255, 255, 255, 0.38);
    --tube-fringe-op: 0.75;
    --veil-strength: 0.92;
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #000000;
  --ink: #f1f1f5;
  --ink-2: #a2a2ae;
  --ink-3: #6a6a76;
  --glass: rgba(255, 255, 255, 0.045);
  --glass-strong: rgba(14, 14, 18, 0.78);
  --glass-hover: rgba(255, 255, 255, 0.06);
  --stroke: rgba(255, 255, 255, 0.08);
  --inner-hi: rgba(255, 255, 255, 0.12);
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9);
  --danger: #ff6b8e;
  --c1: #8fe9ff;
  --c2: #c3a6ff;
  --c3: #ffa8d2;
  --c4: #ffe29a;
  --rim-base: rgba(255, 255, 255, 0.10);
  --rim-tint: 0.75;
  --tube-body: #020203;
  --tube-rim: url(#chromeDark);
  --tube-core: rgba(255, 255, 255, 0.38);
  --tube-fringe-op: 0.75;
  --veil-strength: 0.92;
  color-scheme: dark;
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background-color .4s ease, color .4s ease;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--c2); outline-offset: 2px; border-radius: 8px; }
::selection { background: color-mix(in srgb, var(--c2) 35%, transparent); }
[hidden] { display: none !important; }

/* ---- Background scene ---- */
.scene { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.scene svg { width: 100%; height: 100%; display: block; }
.t-fringe { stroke: url(#prism); opacity: var(--tube-fringe-op); filter: url(#soft); }
.t-rim { stroke: var(--tube-rim); }
.t-body { stroke: var(--tube-body); }
.t-core { stroke: var(--tube-core); }
.scene path, .scene use { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.veil {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse 52% 62% at 56% 50%,
    color-mix(in srgb, var(--bg) calc(var(--veil-strength) * 100%), transparent) 40%,
    transparent 78%);
}
body:has(.app.in-chat) .veil {
  background: radial-gradient(ellipse 60% 80% at 56% 50%,
    var(--bg) 46%, transparent 86%);
}

#root { position: relative; z-index: 1; height: 100dvh; }

/* ---- Glass material ---- */
.glass {
  position: relative;
  background: var(--glass);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  backdrop-filter: blur(26px) saturate(180%);
  box-shadow: inset 0 1px 0 var(--inner-hi), var(--shadow);
  isolation: isolate;
}
/* iridescent rim: light caught by the edge of the glass */
.glass::before {
  content: '';
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from 210deg,
    var(--rim-base) 0deg,
    color-mix(in srgb, var(--c1) calc(var(--rim-tint) * 100%), transparent) 40deg,
    color-mix(in srgb, var(--c2) calc(var(--rim-tint) * 100%), transparent) 70deg,
    var(--rim-base) 110deg,
    var(--rim-base) 200deg,
    color-mix(in srgb, var(--c3) calc(var(--rim-tint) * 100%), transparent) 235deg,
    color-mix(in srgb, var(--c4) calc(var(--rim-tint) * 100%), transparent) 260deg,
    var(--rim-base) 300deg);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: -1;
}

/* ---- Wordmark + emblem ---- */
.mark {
  font: 500 19px/1 var(--font-mark);
  letter-spacing: 0.06em;
  margin: 0;
  background: linear-gradient(100deg, var(--ink) 35%, var(--c1) 42%, var(--c2) 47%, var(--c3) 53%, var(--c4) 58%, var(--ink) 65%);
  background-size: 300% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.emblem { display: block; overflow: visible; }
.emblem use { fill: none; stroke-linecap: round; }
.emblem .e-fringe { stroke: url(#prism); filter: url(#softSm); opacity: var(--tube-fringe-op); }
.emblem .e-rim { stroke: var(--tube-rim); }
.emblem .e-body { stroke: var(--tube-body); }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 14px;
  font-weight: 500; font-size: 15px;
  transition: background-color .2s, transform .15s, opacity .2s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { opacity: .9; }
.btn-primary:disabled { opacity: .45; cursor: default; }
.btn-ghost { color: var(--ink-2); }
.btn-ghost:hover { background: var(--glass-hover); color: var(--ink); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px;
  display: inline-grid; place-items: center; color: var(--ink-2);
  transition: background-color .2s, color .2s;
}
.icon-btn:hover { background: var(--glass-hover); color: var(--ink); }
.icon-btn svg, .btn svg { width: 19px; height: 19px; }
svg.i { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Fields ---- */
.field { display: grid; gap: 6px; }
.field label { font-size: 13.5px; color: var(--ink-2); padding-left: 4px; }
.input {
  height: 48px; padding: 0 16px; border-radius: 14px;
  background: var(--glass-hover);
  border: 1px solid var(--stroke);
  outline: none;
  transition: border-color .2s, background-color .2s;
}
.input:focus { border-color: color-mix(in srgb, var(--c2) 60%, var(--stroke)); background: transparent; }
.input.code { font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase; }

/* ============ Auth / offline screen ============ */
.center-screen {
  height: 100%; display: grid; place-items: center; padding: 24px 16px;
  overflow-y: auto;
}
.auth-card {
  width: min(400px, 100%);
  border-radius: 30px;
  padding: 40px 32px 32px;
  display: grid; gap: 22px;
}
.auth-head { display: grid; justify-items: center; gap: 18px; text-align: center; margin-bottom: 4px; }
.auth-head .emblem { width: 92px; height: 54px; }
.auth-head .mark { font-size: 26px; }
.auth-head p { margin: 0; color: var(--ink-2); font-size: 15px; }
.seg {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 4px; border-radius: 14px; background: var(--glass-hover);
}
.seg button {
  height: 36px; border-radius: 10px; font-size: 14px; font-weight: 500; color: var(--ink-2);
  transition: background-color .2s, color .2s;
}
.seg button[aria-pressed='true'] { background: var(--glass-strong); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12), inset 0 1px 0 var(--inner-hi); }
.auth-form { display: grid; gap: 14px; }
.auth-form .btn { margin-top: 6px; height: 48px; }
.form-error { color: var(--danger); font-size: 14px; margin: 0; min-height: 0; }
.note { color: var(--ink-2); font-size: 14.5px; text-align: center; margin: 0; }

/* ============ App layout ============ */
.app {
  height: 100%;
  display: grid;
  grid-template-columns: 284px 1fr;
  gap: 0;
}
.sidebar {
  margin: 12px 0 12px 12px;
  border-radius: 26px;
  display: flex; flex-direction: column;
  min-height: 0;
  padding: 18px 12px 12px;
}
.side-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 8px 16px 10px; }
.new-chat { justify-content: flex-start; width: 100%; height: 42px; padding: 0 12px; color: var(--ink); }
.chat-list { grid-template-columns: minmax(0, 1fr); list-style: none; margin: 10px 0 0; padding: 0; overflow-y: auto; flex: 1; min-height: 0; display: grid; align-content: start; gap: 2px; scrollbar-width: thin; }
.chat-item {
  display: flex; align-items: center; gap: 4px; min-width: 0;
  border-radius: 12px; padding-right: 4px;
  transition: background-color .15s;
}
.chat-item:hover, .chat-item.active { background: var(--glass-hover); }
.chat-item.active .chat-open { color: var(--ink); }
.chat-open {
  flex: 1; min-width: 0; text-align: left;
  padding: 9px 12px; font-size: 14.5px; color: var(--ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-item .row-actions { display: flex; opacity: 0; transition: opacity .15s; }
.chat-item:hover .row-actions, .chat-item.active .row-actions, .chat-item:focus-within .row-actions { opacity: 1; }
.row-actions .icon-btn { width: 30px; height: 30px; border-radius: 9px; }
.row-actions .icon-btn svg { width: 16px; height: 16px; }
.row-actions .confirm { color: var(--danger); font-size: 13px; font-weight: 500; padding: 0 8px; width: auto; }
.chat-rename { flex: 1; height: 36px; margin: 2px 4px; padding: 0 10px; border-radius: 10px; }
.list-label { font-size: 13px; color: var(--ink-3); padding: 14px 12px 6px; }
.side-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 6px 2px 10px; margin-top: 8px;
  border-top: 1px solid var(--stroke);
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 14px; font-weight: 600;
  background: conic-gradient(from 200deg, var(--c1), var(--c2), var(--c3), var(--c4), var(--c1));
  color: #0b0b10;
}
.who { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Main column ---- */
.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: none; }
.thread { flex: 1; overflow-y: auto; min-height: 0; scroll-behavior: smooth; scrollbar-width: thin; }
.thread-inner { width: min(760px, 100%); margin: 0 auto; padding: 40px 24px 200px; display: grid; gap: 28px; }

/* empty state */
.empty {
  flex: 1; display: grid; place-items: center; align-content: center; gap: 26px;
  padding: 24px 24px 180px; text-align: center;
}
.empty .emblem { width: 150px; height: 88px; }
.empty h1 {
  margin: 0; font-weight: 500; font-size: clamp(26px, 4.4vw, 38px); line-height: 1.15; letter-spacing: -0.02em;
}
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 560px; }
.chip {
  height: 38px; padding: 0 16px; border-radius: 999px; font-size: 14px; color: var(--ink-2);
  border: 1px solid var(--stroke); background: var(--glass);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  transition: color .2s, border-color .2s;
}
.chip:hover { color: var(--ink); border-color: color-mix(in srgb, var(--c2) 50%, var(--stroke)); }

/* messages */
.msg { display: grid; gap: 10px; min-width: 0; }
.msg.user { justify-items: end; }
.bubble {
  max-width: min(82%, 600px);
  padding: 12px 18px; border-radius: 22px 22px 8px 22px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg.assistant .body { overflow-wrap: anywhere; }

/* thinking dropdown */
.think { border-radius: 16px; width: fit-content; max-width: 100%; }
.think summary {
  list-style: none; cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 14px 7px 10px; border-radius: 999px;
  font-size: 14px; color: var(--ink-2);
  border: 1px solid var(--stroke);
  transition: background-color .2s, color .2s;
}
.think summary::-webkit-details-marker { display: none; }
.think summary:hover { background: var(--glass-hover); color: var(--ink); }
.think .chev { width: 14px; height: 14px; transition: transform .25s ease; }
.think[open] .chev { transform: rotate(90deg); }
.orb {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  background: conic-gradient(from 0deg, var(--c1), var(--c2), var(--c3), var(--c4), var(--c1));
  -webkit-mask: radial-gradient(circle, transparent 3.5px, #000 4px);
          mask: radial-gradient(circle, transparent 3.5px, #000 4px);
}
.think.live .orb { animation: spin 1.4s linear infinite; }
.think.live .think-label {
  background: linear-gradient(100deg, var(--ink-2) 30%, var(--c1) 45%, var(--c3) 55%, var(--ink-2) 70%);
  background-size: 250% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: sheen 2.2s linear infinite;
}
.think-body {
  margin: 10px 0 4px 6px; padding: 2px 0 2px 18px;
  border-left: 2px solid transparent;
  border-image: linear-gradient(var(--c1), var(--c2), var(--c3)) 1;
  color: var(--ink-2); font-size: 14.5px; line-height: 1.65;
  white-space: pre-wrap; max-height: 340px; overflow-y: auto;
}

/* rendered markdown */
.body > :first-child { margin-top: 0; }
.body > :last-child { margin-bottom: 0; }
.body p, .body ul, .body ol { margin: 0 0 .85em; }
.body ul, .body ol { padding-left: 1.4em; }
.body li { margin: .25em 0; }
.body h1, .body h2, .body h3 { font-weight: 600; line-height: 1.3; margin: 1.3em 0 .5em; letter-spacing: -0.01em; }
.body h1 { font-size: 1.35em; } .body h2 { font-size: 1.2em; } .body h3 { font-size: 1.05em; }
.body a { color: inherit; text-decoration-color: var(--c2); text-underline-offset: 3px; }
.body strong { font-weight: 600; }
.body blockquote { margin: 0 0 .85em; padding-left: 14px; border-left: 2px solid var(--stroke); color: var(--ink-2); }
.body code { font-family: var(--mono); font-size: .88em; padding: .12em .4em; border-radius: 6px; background: var(--glass-hover); }
.body pre {
  position: relative; margin: 0 0 .9em; padding: 16px 18px; border-radius: 16px;
  background: var(--glass-hover); border: 1px solid var(--stroke);
  overflow-x: auto; font-size: 14px; line-height: 1.55;
}
.body pre code { background: none; padding: 0; font-size: inherit; }
.copy-code {
  position: absolute; top: 8px; right: 8px; height: 28px; padding: 0 10px; border-radius: 8px;
  font-size: 12.5px; color: var(--ink-2); background: var(--glass-strong); border: 1px solid var(--stroke);
  opacity: 0; transition: opacity .2s;
}
.body pre:hover .copy-code, .copy-code:focus-visible { opacity: 1; }
.body table { border-collapse: collapse; margin: 0 0 .9em; font-size: 14.5px; display: block; overflow-x: auto; }
.body th, .body td { border: 1px solid var(--stroke); padding: 7px 12px; text-align: left; }
.body hr { border: 0; border-top: 1px solid var(--stroke); margin: 1.4em 0; }
.cursor:empty::after,
.cursor > :is(p, h1, h2, h3, blockquote):last-child::after,
.cursor > :is(ul, ol):last-child > li:last-child::after {
  content: ''; display: inline-block; width: 8px; height: 8px; margin-left: 4px; border-radius: 50%;
  background: conic-gradient(var(--c1), var(--c2), var(--c3), var(--c4), var(--c1));
  vertical-align: middle; animation: pulse 1s ease-in-out infinite;
}
.msg-error {
  color: var(--danger); font-size: 14.5px; padding: 10px 14px; border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent);
  background: color-mix(in srgb, var(--danger) 7%, transparent);
}

/* ---- Composer ---- */
.composer-wrap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 28px 24px calc(16px + env(safe-area-inset-bottom));
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--bg) 62%);
}
.app:not(.in-chat) .composer-wrap { background: none; }
.composer {
  pointer-events: auto;
  width: min(760px, 100%); margin: 0 auto;
  border-radius: 28px;
  display: flex; align-items: flex-end; gap: 8px;
  padding: 8px 8px 8px 22px;
}
.composer textarea {
  flex: 1; resize: none; border: 0; outline: none; background: transparent;
  max-height: 220px; min-height: 26px; padding: 12px 0; line-height: 1.5; font-size: 16px;
}
.composer textarea::placeholder { color: var(--ink-3); }
.send {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--ink); color: var(--bg);
  position: relative;
  transition: transform .15s, opacity .2s;
}
.send::before {
  content: ''; position: absolute; inset: -3px; border-radius: 50%; z-index: -1;
  background: conic-gradient(from 180deg, var(--c1), var(--c2), var(--c3), var(--c4), var(--c1));
  filter: blur(6px); opacity: .55; transition: opacity .2s;
}
.send:hover::before { opacity: .9; }
.send:disabled { opacity: .35; cursor: default; }
.send:disabled::before { opacity: 0; }
.send:active:not(:disabled) { transform: scale(.94); }
.send svg { width: 20px; height: 20px; }
.hint { text-align: center; font-size: 12.5px; color: var(--ink-3); margin: 10px 0 0; pointer-events: auto; }

/* ---- Modal ---- */
.modal-back {
  position: fixed; inset: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 45%, transparent);
  display: grid; place-items: center; padding: 16px;
  animation: fade .2s ease;
}
.modal {
  width: min(460px, 100%); max-height: min(720px, 92dvh); overflow-y: auto;
  border-radius: 28px; padding: 24px;
  background: var(--glass-strong);
  animation: rise .25s cubic-bezier(.2,.8,.2,1);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h2 { margin: 0; font-size: 19px; font-weight: 600; }
.section { display: grid; gap: 12px; padding: 18px 0; border-top: 1px solid var(--stroke); }
.section:first-of-type { border-top: 0; padding-top: 4px; }
.section h3 { margin: 0; font-size: 15px; font-weight: 600; }
.section p { margin: 0; color: var(--ink-2); font-size: 14.5px; }
.invite-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.invite {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px 8px 14px; border-radius: 14px; background: var(--glass-hover);
}
.invite code { font-family: var(--mono); font-size: 14px; letter-spacing: .04em; }
.invite .state { flex: 1; font-size: 13px; color: var(--ink-3); text-align: right; }
.invite.used code { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--ink-3); }

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); z-index: 30;
  transform: translateX(-50%);
  padding: 10px 18px; border-radius: 999px; font-size: 14px;
  animation: rise .25s ease;
}

/* ---- Motion ---- */
@keyframes spin { to { transform: rotate(1turn); } }
@keyframes sheen { from { background-position: 100% 0; } to { background-position: -150% 0; } }
@keyframes pulse { 50% { transform: scale(.6); opacity: .5; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.toast { animation-name: toastIn; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } }

/* one orchestrated moment: the wordmark catches the light when vereon opens */
.mark.shine { animation: markShine 2.4s cubic-bezier(.3,.1,.2,1) .3s both; }
.side-top:hover .mark { animation: markShine 1.6s cubic-bezier(.3,.1,.2,1) both; }
@keyframes markShine { from { background-position: 100% 0; } to { background-position: 0% 0; } }

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

/* ============ Phone ============ */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 15; top: 0; bottom: 0; left: 0;
    width: min(300px, 84vw);
    margin: 0; border-radius: 0 26px 26px 0;
    padding-top: calc(18px + env(safe-area-inset-top));
    background: var(--glass-strong);
    transform: translateX(-105%);
    transition: transform .3s cubic-bezier(.2,.8,.2,1);
  }
  .app.drawer .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 14; background: color-mix(in srgb, var(--bg) 40%, transparent); animation: fade .2s; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: calc(8px + env(safe-area-inset-top)) 10px 8px;
  }
  .topbar .title { flex: 1; min-width: 0; text-align: center; font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .thread-inner { padding: 16px 16px 180px; gap: 24px; }
  .composer-wrap { padding: 0 12px calc(12px + env(safe-area-inset-bottom)); }
  .composer { padding-left: 18px; }
  .hint { display: none; }
  .bubble { max-width: 88%; }
  .empty { padding-bottom: 160px; }
  .empty .emblem { width: 118px; height: 70px; }
  .auth-card { padding: 32px 22px 24px; border-radius: 26px; }
  .chat-item .row-actions { opacity: 1; }
  .veil, body:has(.app.in-chat) .veil {
    background: radial-gradient(ellipse 90% 70% at 50% 52%, var(--bg) 40%, transparent 92%);
  }
}
