/* Pocket Box — one calm surface: warm paper, soft aurora light, frosted
   glass, big friendly type, and motion that eases out like a breath. */

:root {
  --paper: #f6f4f0;
  --paper-2: #efece6;
  --ink: #17161b;
  --ink-2: #3a3842;
  --muted: #6f6c78;
  --faint: #a19eaa;
  --line: rgba(23, 22, 27, 0.07);
  --line-2: rgba(23, 22, 27, 0.12);
  --glass: rgba(255, 255, 255, 0.66);
  --glass-strong: rgba(255, 255, 255, 0.86);
  --glass-edge: rgba(255, 255, 255, 0.9);
  --shadow: 0 1px 1px rgba(30, 24, 50, 0.03), 0 8px 24px -10px rgba(30, 24, 60, 0.14), 0 24px 64px -24px rgba(40, 30, 90, 0.16);
  --shadow-lift: 0 2px 4px rgba(30, 24, 50, 0.04), 0 16px 40px -12px rgba(30, 24, 60, 0.22), 0 40px 90px -30px rgba(60, 40, 120, 0.25);
  --aura-1: #ffd8c4;
  --aura-2: #dccdff;
  --aura-3: #c6e4ff;
  --aura-4: #d9f5e4;
  --accent: #6b57f5;
  --accent-soft: rgba(107, 87, 245, 0.12);
  --good: #1f9d6b;
  --good-soft: rgba(31, 157, 107, 0.12);
  --warn: #c7741a;
  --warn-soft: rgba(199, 116, 26, 0.13);
  --bad: #d64545;
  --bad-soft: rgba(214, 69, 69, 0.11);
  --btn: #17161b;
  --btn-ink: #ffffff;
  --r-xl: 32px;
  --r-lg: 24px;
  --r-md: 18px;
  --r-sm: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --sans: "Inter Tight", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f0e13; --paper-2: #15141b; --ink: #f3f1f7; --ink-2: #d4d1dc; --muted: #9b97a6; --faint: #6d6a77;
    --line: rgba(255, 255, 255, 0.07); --line-2: rgba(255, 255, 255, 0.12);
    --glass: rgba(30, 28, 38, 0.62); --glass-strong: rgba(34, 32, 43, 0.9); --glass-edge: rgba(255, 255, 255, 0.08);
    --shadow: 0 1px 1px rgba(0, 0, 0, 0.3), 0 12px 32px -12px rgba(0, 0, 0, 0.6);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.35), 0 24px 60px -20px rgba(0, 0, 0, 0.7);
    --aura-1: #4a2a2a; --aura-2: #33275e; --aura-3: #1d3550; --aura-4: #1c3b2d;
    --accent: #9d8cff; --accent-soft: rgba(157, 140, 255, 0.16);
    --btn: #f3f1f7; --btn-ink: #121117;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f0e13; --paper-2: #15141b; --ink: #f3f1f7; --ink-2: #d4d1dc; --muted: #9b97a6; --faint: #6d6a77;
  --line: rgba(255, 255, 255, 0.07); --line-2: rgba(255, 255, 255, 0.12);
  --glass: rgba(30, 28, 38, 0.62); --glass-strong: rgba(34, 32, 43, 0.9); --glass-edge: rgba(255, 255, 255, 0.08);
  --shadow: 0 1px 1px rgba(0, 0, 0, 0.3), 0 12px 32px -12px rgba(0, 0, 0, 0.6);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.35), 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  --aura-1: #4a2a2a; --aura-2: #33275e; --aura-3: #1d3550; --aura-4: #1c3b2d;
  --accent: #9d8cff; --accent-soft: rgba(157, 140, 255, 0.16);
  --btn: #f3f1f7; --btn-ink: #121117;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
img, svg { display: block; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 10px; }

/* ---- the aurora behind everything ---- */
.aura { position: fixed; inset: -20vmax; z-index: -1; pointer-events: none; filter: blur(70px) saturate(1.1); opacity: 0.9; }
.aura i { position: absolute; border-radius: 50%; width: 52vmax; height: 52vmax; opacity: 0.75; animation: drift 28s var(--ease) infinite alternate; }
.aura i:nth-child(1) { background: var(--aura-1); left: 4%; top: 2%; }
.aura i:nth-child(2) { background: var(--aura-2); right: 0; top: 10%; animation-duration: 34s; animation-delay: -8s; }
.aura i:nth-child(3) { background: var(--aura-3); left: 22%; bottom: 0; animation-duration: 40s; animation-delay: -16s; }
.aura i:nth-child(4) { background: var(--aura-4); right: 18%; bottom: 8%; width: 36vmax; height: 36vmax; animation-duration: 31s; animation-delay: -4s; }
@keyframes drift {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(4vmax, -3vmax, 0) scale(1.08); }
  100% { transform: translate3d(-3vmax, 4vmax, 0) scale(0.96); }
}
.grain { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0.035; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }

/* ---- layout ---- */
.shell { max-width: 760px; margin: 0 auto; padding: 0 16px calc(120px + env(safe-area-inset-bottom)); min-height: 100dvh; }
.wide { max-width: 1040px; }
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 4px 10px; margin: 0 -4px;
}
.top::before {
  content: ""; position: absolute; inset: 0 -100vw; z-index: -1;
  background: var(--paper); opacity: 0.9;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  -webkit-mask: linear-gradient(to bottom, #000 72%, transparent); mask: linear-gradient(to bottom, #000 72%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; letter-spacing: -0.02em; }
.brand .mark { width: 30px; height: 30px; border-radius: 10px; background: conic-gradient(from 210deg, var(--aura-2), var(--aura-1), var(--aura-4), var(--aura-3), var(--aura-2)); box-shadow: inset 0 0 0 1px var(--glass-edge), 0 4px 14px -4px rgba(80, 60, 160, 0.35); display: grid; place-items: center; }
.brand .mark::after { content: ""; width: 10px; height: 10px; border-radius: 4px; background: var(--ink); opacity: 0.85; }
.spacer { flex: 1; }

/* ---- type ---- */
.display { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 9vw, 64px); line-height: 1.02; letter-spacing: -0.02em; margin: 0; }
.display em { font-style: italic; background: linear-gradient(100deg, var(--accent), #e46fa0 60%, #f29a5b); -webkit-background-clip: text; background-clip: text; color: transparent; padding-right: 0.06em; }
.h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.025em; margin: 0; }
.h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.015em; margin: 0; }
.lede { font-size: 18px; color: var(--muted); margin: 12px 0 0; max-width: 34em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.mono { font-family: var(--mono); font-size: 13px; }

/* ---- surfaces ---- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(28px) saturate(1.5);
  backdrop-filter: blur(28px) saturate(1.5);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow);
  border-radius: var(--r-lg);
}
.card { padding: 20px; }
.stack > * + * { margin-top: 12px; }
.stack-lg > * + * { margin-top: 24px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.sep { height: 1px; background: var(--line); margin: 16px 0; border: 0; }

/* ---- buttons ---- */
.btn {
  appearance: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 999px; font-weight: 550; font-size: 15px; letter-spacing: -0.01em;
  background: var(--btn); color: var(--btn-ink); text-decoration: none; white-space: nowrap;
  transition: transform 0.35s var(--spring), box-shadow 0.35s var(--ease), background 0.25s var(--ease), opacity 0.2s;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, 0 6px 18px -8px rgba(20, 16, 40, 0.5);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, 0 12px 26px -10px rgba(20, 16, 40, 0.55); }
.btn:active { transform: scale(0.96); transition-duration: 0.12s; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn.soft { background: var(--glass-strong); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: none; }
.btn.ghost:hover { background: var(--line); }
.btn.accent { background: linear-gradient(135deg, #7a64ff, #b45ee0 55%, #ee7d76); color: #fff; }
.btn.danger { background: var(--bad-soft); color: var(--bad); box-shadow: none; }
.btn.sm { min-height: 34px; padding: 0 14px; font-size: 13.5px; }
.btn.icon { width: 44px; padding: 0; }
.btn.sm.icon { width: 34px; }
.btn .spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.chip {
  appearance: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 500;
  background: var(--glass-strong); box-shadow: inset 0 0 0 1px var(--line-2);
  transition: transform 0.3s var(--spring), background 0.2s, box-shadow 0.2s;
}
.chip:hover { transform: translateY(-1px); }
.chip:active { transform: scale(0.96); }
.chip.on { background: var(--ink); color: var(--paper); box-shadow: none; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; letter-spacing: 0.01em; background: var(--line); color: var(--ink-2); white-space: nowrap; }
.pill.good { background: var(--good-soft); color: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.dot.live { animation: pulse 1.6s var(--ease) infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---- fields ---- */
.field { display: block; }
.field > span { display: block; font-size: 13px; font-weight: 550; color: var(--ink-2); margin: 0 0 6px 4px; }
.input, .textarea, select.input {
  width: 100%; border: 0; outline: 0; border-radius: var(--r-md); padding: 13px 16px; font-size: 16px;
  background: var(--glass-strong); box-shadow: inset 0 0 0 1px var(--line-2);
  transition: box-shadow 0.25s var(--ease), background 0.25s;
}
.input:focus, .textarea:focus { box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 5px var(--accent-soft); }
.textarea { resize: none; min-height: 52px; line-height: 1.5; }

/* ---- the composer (the big "ask" box) ---- */
.composer { position: relative; border-radius: var(--r-xl); padding: 8px; transition: box-shadow 0.4s var(--ease), transform 0.4s var(--ease); }
.composer:focus-within { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.composer textarea { width: 100%; border: 0; outline: 0; background: transparent; resize: none; padding: 14px 14px 6px; font-size: 18px; line-height: 1.45; min-height: 92px; max-height: 40vh; }
.composer textarea::placeholder { color: var(--faint); }
.composer .bar { display: flex; align-items: center; gap: 8px; padding: 4px 4px 4px 10px; }
.composer.slim textarea { font-size: 16px; min-height: 48px; padding: 12px 12px 4px; }
.send { width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; background: var(--btn); color: var(--btn-ink); display: grid; place-items: center; transition: transform 0.35s var(--spring), opacity 0.2s; }
.send:active { transform: scale(0.9); }
.send[disabled] { opacity: 0.25; cursor: default; }
.mic { width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer; background: transparent; color: var(--muted); display: grid; place-items: center; position: relative; transition: transform 0.35s var(--spring), background 0.25s, color 0.25s; -webkit-tap-highlight-color: transparent; }
.mic:hover { background: var(--line); color: var(--ink); }
.mic:active { transform: scale(0.9); }
.mic.listening { background: linear-gradient(135deg, #7a64ff, #e46fa0 60%, #f29a5b); color: #fff; }
.mic.listening::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid #e46fa0; opacity: 0.6; animation: mic-ring 1.4s var(--ease) infinite; }
@keyframes mic-ring { from { transform: scale(0.9); opacity: 0.7; } to { transform: scale(1.35); opacity: 0; } }

/* ---- agents list ---- */
.agent-card { display: flex; gap: 14px; align-items: center; padding: 16px; text-decoration: none; transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease); }
.agent-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.agent-card:active { transform: scale(0.985); transition-duration: 0.15s; }
.avatar { flex: none; width: 52px; height: 52px; border-radius: 17px; display: grid; place-items: center; font-size: 26px; background: linear-gradient(145deg, var(--glass-strong), var(--paper-2)); box-shadow: inset 0 0 0 1px var(--glass-edge), 0 6px 16px -8px rgba(40, 30, 90, 0.35); }
.avatar.sm { width: 34px; height: 34px; border-radius: 12px; font-size: 18px; }
.avatar.xl { width: 72px; height: 72px; border-radius: 24px; font-size: 38px; }
.agent-card .meta { min-width: 0; flex: 1; }
.agent-card .title { font-weight: 600; letter-spacing: -0.02em; font-size: 16.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-card .sub { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }

/* ---- stage tracker ---- */
.stages { display: flex; gap: 4px; align-items: center; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.stages::-webkit-scrollbar { display: none; }
.stage { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 550; color: var(--faint); white-space: nowrap; transition: background 0.5s var(--ease), color 0.5s var(--ease); }
.stage.done { color: var(--ink-2); }
.stage.done::before { content: "✓"; font-size: 11px; }
.stage.now { background: var(--ink); color: var(--paper); }
.stage-line { width: 10px; height: 1px; background: var(--line-2); flex: none; }

/* ---- thread ---- */
.thread { display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 12px; align-items: flex-start; }
.msg .body { min-width: 0; flex: 1; }
.msg .who { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.msg .who .when { font-weight: 400; color: var(--faint); font-size: 12px; }
.msg .bubble { margin-top: 6px; padding: 14px 16px; border-radius: 6px var(--r-lg) var(--r-lg) var(--r-lg); }
.msg .summary { font-weight: 500; letter-spacing: -0.012em; }
.msg.owner { flex-direction: row-reverse; }
.msg.owner .who { justify-content: flex-end; }
.msg.owner .bubble { background: var(--ink); color: var(--paper); border-radius: var(--r-lg) 6px var(--r-lg) var(--r-lg); box-shadow: var(--shadow); border: 0; }
.msg.system .bubble { background: transparent; box-shadow: none; border: 1px dashed var(--line-2); -webkit-backdrop-filter: none; backdrop-filter: none; }
.msg.doc .bubble { border-left: 3px solid var(--accent); }
.more { appearance: none; border: 0; background: none; padding: 0; margin-top: 8px; color: var(--accent); font-size: 13.5px; font-weight: 550; cursor: pointer; }
.prose { font-size: 15px; line-height: 1.6; color: var(--ink-2); overflow-wrap: anywhere; }
.msg.owner .prose { color: inherit; }
.prose h1, .prose h2, .prose h3, .prose h4 { color: var(--ink); letter-spacing: -0.02em; line-height: 1.25; margin: 18px 0 6px; }
.prose h1 { font-size: 20px; } .prose h2 { font-size: 17px; } .prose h3, .prose h4 { font-size: 15px; }
.prose p { margin: 8px 0; }
.prose ul, .prose ol { margin: 8px 0; padding-left: 22px; }
.prose li { margin: 3px 0; }
.prose code { font-family: var(--mono); font-size: 0.88em; background: var(--line); padding: 1px 6px; border-radius: 6px; }
.prose pre { background: var(--paper-2); border-radius: var(--r-sm); padding: 12px 14px; overflow-x: auto; box-shadow: inset 0 0 0 1px var(--line); }
.prose pre code { background: none; padding: 0; font-size: 12.5px; line-height: 1.55; }
.prose blockquote { margin: 8px 0; padding: 4px 14px; border-left: 3px solid var(--line-2); color: var(--muted); }
.prose table { border-collapse: collapse; font-size: 13.5px; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.prose a { color: var(--accent); }

.thinking { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 999px; width: fit-content; max-width: 100%; }
.thinking .label { font-size: 14px; font-weight: 500; background: linear-gradient(90deg, var(--muted) 0%, var(--ink) 40%, var(--muted) 80%); background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 2.2s linear infinite; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }
.orb { flex: none; width: 22px; height: 22px; border-radius: 50%; background: conic-gradient(from 0deg, #7a64ff, #e46fa0, #f2a65b, #6fd0b4, #7a64ff); animation: spin 2.4s linear infinite; position: relative; filter: saturate(1.2); }
.orb::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--glass-strong); filter: blur(1px); }

/* ---- dock: actions pinned at the bottom of an agent ---- */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); pointer-events: none; }
.dock-inner { max-width: 760px; margin: 0 auto; pointer-events: auto; }
.dock .composer { box-shadow: var(--shadow-lift); }
.cta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; justify-content: flex-end; }

/* ---- tabs ---- */
.tabs { display: inline-flex; gap: 2px; padding: 4px; border-radius: 999px; }
.tab { appearance: none; border: 0; cursor: pointer; background: transparent; padding: 7px 14px; border-radius: 999px; font-size: 14px; font-weight: 550; color: var(--muted); transition: background 0.35s var(--ease), color 0.35s var(--ease); }
.tab.on { background: var(--ink); color: var(--paper); }

/* ---- lists ---- */
.list { padding: 6px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-md); }
.item + .item { border-top: 1px solid var(--line); border-radius: 0; }
.item .grow { flex: 1; min-width: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ---- auth screens ---- */
.center { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.auth { width: min(100%, 420px); padding: 32px 28px; border-radius: var(--r-xl); }
.auth .display { font-size: 44px; }
.link { appearance: none; border: 0; background: none; padding: 0; cursor: pointer; color: var(--accent); font-weight: 550; text-decoration: none; }
.note { padding: 12px 14px; border-radius: var(--r-md); font-size: 14px; background: var(--accent-soft); color: var(--ink-2); }
.note.bad { background: var(--bad-soft); color: var(--bad); }
.note.good { background: var(--good-soft); color: var(--good); }
.note.warn { background: var(--warn-soft); color: var(--warn); }

/* ---- toast ---- */
.toasts { position: fixed; left: 0; right: 0; margin: 0 auto; top: calc(14px + env(safe-area-inset-top)); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 440px); }
.toast { pointer-events: auto; max-width: 100%; text-align: center; overflow-wrap: anywhere; padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 500; background: var(--glass-strong); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); box-shadow: var(--shadow-lift); border: 1px solid var(--glass-edge); animation: toast-in 0.5s var(--spring); }
.toast.bad { color: var(--bad); }
.toast.out { animation: toast-out 0.35s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(0.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px) scale(0.97); } }

/* ---- sheet ---- */
.scrim { position: fixed; inset: 0; z-index: 60; background: rgba(15, 12, 25, 0.28); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fade 0.35s var(--ease); display: flex; align-items: flex-end; justify-content: center; }
.sheet { width: min(100%, 560px); max-height: 88dvh; overflow: auto; border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); background: var(--glass-strong); -webkit-backdrop-filter: blur(30px) saturate(1.4); backdrop-filter: blur(30px) saturate(1.4); box-shadow: var(--shadow-lift); animation: sheet-in 0.55s var(--ease); }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto 14px; }
.scrim.out { animation: fade-out 0.3s var(--ease) forwards; }
.scrim.out .sheet { animation: sheet-out 0.3s var(--ease) forwards; }
@media (min-width: 640px) { .scrim { align-items: center; } .sheet { border-radius: var(--r-xl); padding-bottom: 24px; } }
@keyframes fade { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
@keyframes sheet-out { to { transform: translateY(30px); opacity: 0; } }

/* ---- motion: everything arrives softly ---- */
.rise { animation: rise 0.7s var(--ease) both; }
.rise:nth-child(2) { animation-delay: 0.05s; } .rise:nth-child(3) { animation-delay: 0.1s; } .rise:nth-child(4) { animation-delay: 0.15s; }
.rise:nth-child(5) { animation-delay: 0.2s; } .rise:nth-child(6) { animation-delay: 0.25s; } .rise:nth-child(n+7) { animation-delay: 0.3s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); filter: blur(4px); } }
.pop { animation: pop 0.5s var(--spring) both; }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(6px); } }

::view-transition-old(root) { animation: vt-out 0.22s var(--ease) both; }
::view-transition-new(root) { animation: vt-in 0.42s var(--ease) both; }
@keyframes vt-out { to { opacity: 0; transform: translateY(-6px); filter: blur(3px); } }
@keyframes vt-in { from { opacity: 0; transform: translateY(10px); filter: blur(3px); } }

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

/* ---- runtime specifics ---- */
.phone-hero { text-align: center; padding: 28px 8px 8px; }
.run-card { padding: 16px; }
.run-card .row + .row { margin-top: 10px; }
.feed-item { padding: 12px 14px; border-radius: var(--r-md); background: var(--glass-strong); box-shadow: inset 0 0 0 1px var(--line); }
.feed-item .t { font-weight: 600; font-size: 14.5px; }
.feed-item .b { font-size: 14px; color: var(--ink-2); margin-top: 2px; white-space: pre-wrap; }
.feed-item .m { font-size: 12px; color: var(--faint); margin-top: 6px; }

@media (max-width: 520px) {
  .card { padding: 16px; }
  .auth { padding: 26px 20px; }
  .composer textarea { font-size: 17px; }
  .hide-sm { display: none !important; }
}

/* ---- install guide ---- */
.install-steps { margin: 4px 0 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 10px; }
.install-steps li { counter-increment: step; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); background: var(--glass); box-shadow: inset 0 0 0 1px var(--line); font-size: 15px; line-height: 1.45; }
.install-steps li::before { content: counter(step); flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: var(--ink); color: var(--paper); margin-top: 1px; }
[data-install-slot]:empty { display: none; }
.install-steps li > span { flex: 1; min-width: 0; }
.install-steps svg { margin: 0 2px; }
