/* Palette from Kate's brand (katenorthrup.com): gold #CC9F53, sea teal #5E7875,
   aqua #9FCECA, sand #D1C195, parchment #F7F5E7, rust #B06533. Theme: "money alchemy". */
:root {
  --bg: #F7F5E7;
  --bg-2: #EEEAD3;
  --ink: #23393A;
  --ink-2: #4C6663;
  --muted: #7C8C86;
  --line: rgba(35, 57, 58, .12);
  --glass: rgba(255, 254, 246, .62);
  --glass-strong: rgba(255, 254, 248, .88);
  --gold: #CC9F53;
  --gold-deep: #94702F;
  --gold-rgb: 204, 159, 83;
  --teal: #5E7875;
  --aqua: #9FCECA;
  --aqua-rgb: 159, 206, 202;
  --clay: #B06533;
  --blush: #E7CBB4;
  --user: #F1E7C7;
  --user-ink: #33291A;
  --shadow: 0 10px 40px -12px rgba(60, 70, 50, .22);
  --blob-a: #EBD39E;
  --blob-b: #BFE1DD;
  --blob-c: #D5EAE7;
  --blob-d: #E4DAB2;
  --sigil-opacity: .10;
  --leaf-0: #7E5C22; --leaf-1: #B58A3F; --leaf-2: #C79B4C;
  --star-opacity: .55;
  --veil-rgb: 247, 245, 231;
  --serif: "Fraunces", "Quincy CF", "Canela", Georgia, serif;
  --sans: "Karla", system-ui, -apple-system, sans-serif;
  --label: "Josefin Sans", "Karla", system-ui, sans-serif;
  --r: 22px;
  color-scheme: light;
}
/* night: midnight-teal sky, gold starlight */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C1A1B; --bg-2: #132627; --ink: #F2EEDC; --ink-2: #C8D3CB; --muted: #8EA19B;
    --line: rgba(242, 238, 220, .12); --glass: rgba(20, 38, 39, .55); --glass-strong: rgba(24, 44, 45, .88);
    --gold: #DDB56C; --gold-deep: #E7C98E; --gold-rgb: 221, 181, 108; --teal: #8DBDB8;
    --user: #22393A; --user-ink: #F2EEDC; --shadow: 0 10px 40px -12px rgba(0, 0, 0, .6);
    --blob-a: #5B4820; --blob-b: #1B4A47; --blob-c: #1F3D3C; --blob-d: #3A3422;
    --sigil-opacity: .12; --star-opacity: .9; --leaf-0: #A87B33; --leaf-1: #E9CB8B; --leaf-2: #F2DDA8; --veil-rgb: 12, 26, 27;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C1A1B; --bg-2: #132627; --ink: #F2EEDC; --ink-2: #C8D3CB; --muted: #8EA19B;
  --line: rgba(242, 238, 220, .12); --glass: rgba(20, 38, 39, .55); --glass-strong: rgba(24, 44, 45, .88);
  --gold: #DDB56C; --gold-deep: #E7C98E; --gold-rgb: 221, 181, 108; --teal: #8DBDB8;
  --user: #22393A; --user-ink: #F2EEDC; --shadow: 0 10px 40px -12px rgba(0, 0, 0, .6);
  --blob-a: #5B4820; --blob-b: #1B4A47; --blob-c: #1F3D3C; --blob-d: #3A3422;
  --sigil-opacity: .12; --star-opacity: .9; --leaf-0: #A87B33; --leaf-1: #E9CB8B; --leaf-2: #F2DDA8; --veil-rgb: 12, 26, 27;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--ink); font: 16.5px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
.display { font-family: var(--serif); font-weight: 350; letter-spacing: -.01em; font-optical-sizing: auto; }
.display em { font-style: italic; color: var(--gold-deep); font-weight: 300; }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  /* gold leaf: a slow shimmer across the italic line */
  .display em {
    background: linear-gradient(100deg, var(--gold-deep) 0%, var(--leaf-1) 30%, var(--leaf-0) 48%, var(--leaf-2) 62%, var(--gold-deep) 82%);
    background-size: 220% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: gildshimmer 9s ease-in-out infinite alternate; padding-right: .06em;
  }
}
@keyframes gildshimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }
.eyebrow { font-family: var(--label); font-size: 11.5px; font-weight: 600; letter-spacing: .28em; text-transform: uppercase;
  color: var(--gold-deep); margin: 0 0 10px; display: flex; align-items: center; justify-content: center; gap: 10px; }
.eyebrow::before, .eyebrow::after { content: ""; height: 1px; width: 26px; background: linear-gradient(90deg, transparent, var(--gold)); }
.eyebrow::after { transform: scaleX(-1); }
.muted { color: var(--muted); }
.fine { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.center { text-align: center; }

/* ---------- ambient sky ---------- */
.sky { position: fixed; inset: 0; overflow: hidden; z-index: 0; pointer-events: none; }
.sky i { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; will-change: transform; }
.sky .b1 { width: 52vmax; height: 52vmax; background: var(--blob-a); top: -18vmax; left: -12vmax; animation: drift1 38s ease-in-out infinite alternate; }
.sky .b2 { width: 44vmax; height: 44vmax; background: var(--blob-b); bottom: -20vmax; right: -10vmax; animation: drift2 44s ease-in-out infinite alternate; }
.sky .b3 { width: 34vmax; height: 34vmax; background: var(--blob-c); top: 30%; right: 18%; opacity: .35; animation: drift3 52s ease-in-out infinite alternate; }
.sky .b4 { width: 30vmax; height: 30vmax; background: var(--blob-d); bottom: 5%; left: 15%; opacity: .4; animation: drift1 60s ease-in-out infinite alternate-reverse; }
@keyframes drift1 { to { transform: translate(8vmax, 6vmax) scale(1.08); } }
@keyframes drift2 { to { transform: translate(-7vmax, -5vmax) scale(1.12); } }
@keyframes drift3 { to { transform: translate(-6vmax, 7vmax) scale(.92); } }

/* ---------- alchemy layer: a slow-turning sacred circle + gold starlight ---------- */
.sky .sigil { position: absolute; left: 50%; top: 46%; width: min(130vmin, 1100px); height: min(130vmin, 1100px);
  margin: calc(min(130vmin, 1100px) / -2) 0 0 calc(min(130vmin, 1100px) / -2); color: var(--gold);
  opacity: var(--sigil-opacity); animation: turn 420s linear infinite; }
.sky .stars { position: absolute; inset: 0; filter: none; border-radius: 0; will-change: opacity; opacity: var(--star-opacity); animation: twinkle 7s ease-in-out infinite alternate;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, rgba(var(--gold-rgb), .9), transparent 60%),
    radial-gradient(1px 1px at 27% 72%, rgba(var(--gold-rgb), .8), transparent 60%),
    radial-gradient(2px 2px at 44% 9%, rgba(var(--gold-rgb), .7), transparent 60%),
    radial-gradient(1px 1px at 63% 33%, rgba(var(--gold-rgb), .9), transparent 60%),
    radial-gradient(1.5px 1.5px at 78% 81%, rgba(var(--gold-rgb), .8), transparent 60%),
    radial-gradient(1px 1px at 88% 14%, rgba(var(--gold-rgb), .9), transparent 60%),
    radial-gradient(2px 2px at 92% 52%, rgba(var(--gold-rgb), .6), transparent 60%),
    radial-gradient(1px 1px at 6% 58%, rgba(var(--gold-rgb), .8), transparent 60%),
    radial-gradient(1.5px 1.5px at 35% 44%, rgba(var(--aqua-rgb), .8), transparent 60%),
    radial-gradient(1px 1px at 54% 91%, rgba(var(--gold-rgb), .7), transparent 60%),
    radial-gradient(1.5px 1.5px at 71% 6%, rgba(var(--aqua-rgb), .7), transparent 60%),
    radial-gradient(1px 1px at 19% 93%, rgba(var(--gold-rgb), .8), transparent 60%); }
.sky .stars.s2 { transform: rotate(180deg) scale(1.1); animation-duration: 11s; animation-delay: -4s; }
@keyframes turn { to { transform: rotate(360deg); } }
@keyframes twinkle { 0% { opacity: calc(var(--star-opacity) * .35); } 100% { opacity: var(--star-opacity); } }

/* ---------- orb (Abby) — breathes 4s in / 6s out ---------- */
.orb { position: relative; border-radius: 50%; flex: none; }
.orb span {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #FFF8E6 0%, #EFD39A 26%, var(--gold) 50%, var(--aqua) 80%, #5E7875 100%);
  box-shadow: 0 0 0 1px rgba(255,255,255,.35) inset, 0 8px 30px -6px rgba(var(--gold-rgb),.65), 0 0 60px -10px rgba(var(--aqua-rgb),.45);
  animation: breathe 10s ease-in-out infinite;
}
.orb span::after {
  content: ""; position: absolute; inset: 18% 22% 46% 20%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.75), transparent 70%); filter: blur(4px);
}
@keyframes breathe { 0% { transform: scale(.94); } 40% { transform: scale(1.06); } 100% { transform: scale(.94); } }
.orb-xl { width: 96px; height: 96px; margin: 0 auto 22px; }
.orb-xl::before, .orb-lg::before { content: ""; position: absolute; inset: -11px; border-radius: 50%;
  border: 1px solid rgba(var(--gold-rgb), .45); border-top-color: transparent; border-left-color: rgba(var(--gold-rgb), .15); animation: turn 24s linear infinite; }
.orb-lg { width: 78px; height: 78px; margin: 0 auto 20px; }
.orb-sm { width: 34px; height: 34px; }
.orb-xs { width: 28px; height: 28px; }
.thinking .orb span { animation: breathe 2.6s ease-in-out infinite, glow 2.6s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 1px rgba(255,255,255,.4) inset, 0 8px 40px -2px rgba(var(--gold-rgb),.9), 0 0 80px 0 rgba(var(--aqua-rgb),.55); } }

/* ---------- auth ---------- */
.auth { position: relative; z-index: 1; height: 100%; overflow-y: auto; display: grid; place-items: center; padding: 32px 16px; }
.auth-card {
  width: 100%; max-width: 440px; background: var(--glass); backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2); border: 1px solid var(--line); border-radius: 30px;
  padding: 40px 32px 28px; text-align: center; box-shadow: var(--shadow); animation: rise .9s cubic-bezier(.2,.8,.2,1) both;
}
.auth h1 { font-size: clamp(30px, 6vw, 38px); line-height: 1.12; margin: 0 0 14px; }
.lede { color: var(--ink-2); margin: 0 auto 26px; max-width: 34ch; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--bg-2); margin-bottom: 20px; }
.tab { flex: 1; border: 0; background: transparent; padding: 9px 10px; border-radius: 999px; font-weight: 500; color: var(--ink-2); transition: .25s; }
.tab.active { background: var(--glass-strong); color: var(--ink); box-shadow: 0 2px 10px -4px rgba(0,0,0,.18); }
form#authForm { text-align: left; display: grid; gap: 14px; }
.field span { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0 0 6px 4px; }
.field input {
  width: 100%; padding: 13px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--glass-strong);
  color: var(--ink); font: inherit; outline: none; transition: border .2s, box-shadow .2s;
}
.field input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(var(--gold-rgb),.18); }
.auth:not(.signup) .signup-only { display: none; }
.form-error { min-height: 1.2em; margin: 0; color: var(--clay); font-size: 14px; }
.btn-primary {
  border: 0; border-radius: 999px; padding: 14px 20px; font-weight: 600; letter-spacing: .02em; color: #2B2014;
  background: linear-gradient(135deg, #F0D9A4, var(--gold) 50%, #A9803A); box-shadow: 0 8px 24px -10px rgba(var(--gold-rgb),.8);
  transition: transform .2s, box-shadow .2s;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 28px -10px rgba(var(--gold-rgb),.9); }
.btn-primary:disabled { opacity: .6; transform: none; }
.btn-primary.sm { padding: 9px 18px; }
.auth .fine { margin: 22px 0 0; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }

.sso { text-align: left; }
.sso-status { text-align: center; color: var(--ink-2); margin: 0 0 18px; }
#ssoForm { display: grid; gap: 14px; }
.code-input { text-align: center; font-size: 26px !important; letter-spacing: .5em; font-family: var(--serif) !important; padding-left: calc(16px + .5em) !important; }
.sso-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; }

/* inside a Circle iframe: the frame is the page, keep it compact */
body.embedded .auth { padding: 16px; }
body.embedded .auth-card { padding: 28px 22px 20px; box-shadow: none; }
body.embedded .orb-xl { width: 72px; height: 72px; margin-bottom: 16px; }
body.embedded .welcome { padding-top: 3vh; }

/* ---------- app shell ---------- */
.app { position: relative; z-index: 1; height: 100%; display: flex; }
.sidebar {
  width: 290px; flex: none; display: flex; flex-direction: column; padding: 18px 14px; gap: 12px;
  background: var(--glass); backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px); border-right: 1px solid var(--line);
}
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 0 6px; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand b { font-family: var(--serif); font-weight: 500; font-size: 20px; display: block; line-height: 1.1; }
.brand small { color: var(--muted); font-size: 12.5px; }
.new-chat {
  display: flex; align-items: center; gap: 8px; justify-content: center; padding: 11px; border-radius: 14px;
  border: 1px dashed color-mix(in srgb, var(--gold) 60%, transparent); background: transparent; font-weight: 600; color: var(--ink-2); transition: .2s;
}
.new-chat:hover { background: var(--glass-strong); color: var(--ink); border-style: solid; }
.conv-list { flex: 1; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.conv-group { font-family: var(--label); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 16px 8px 6px; }
.conv {
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 9px 10px; border-radius: 12px; border: 0;
  background: transparent; text-align: left; color: var(--ink-2); font-size: 14.5px; transition: background .15s;
}
.conv:hover { background: color-mix(in srgb, var(--glass-strong) 70%, transparent); }
.conv.active { background: var(--glass-strong); color: var(--ink); box-shadow: 0 1px 0 var(--line); }
.conv .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .x { opacity: 0; border: 0; background: none; color: var(--muted); padding: 0 4px; border-radius: 6px; font-size: 13px; }
.conv:hover .x, .conv.active .x { opacity: 1; }
.conv .x:hover { color: var(--clay); }
.side-foot { display: flex; justify-content: space-between; padding: 8px 6px 0; border-top: 1px solid var(--line); }
.link-btn { border: 0; background: none; color: var(--muted); font-size: 13px; padding: 6px 2px; }
.link-btn:hover { color: var(--ink); }
.icon-btn { border: 0; background: transparent; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--ink-2); }
.icon-btn:hover { background: var(--glass-strong); color: var(--ink); }
.only-mobile { display: none; }
.scrim { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 14px 22px; min-height: 64px; }
.top-title { flex: 1; font-family: var(--serif); font-size: 17px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.breathe-pill {
  display: flex; align-items: center; gap: 8px; padding: 8px 15px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--glass); backdrop-filter: blur(12px); font-size: 14px; font-weight: 500; color: var(--ink-2); transition: .2s;
}
.breathe-pill:hover { color: var(--ink); background: var(--glass-strong); }
.breathe-pill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); animation: breathe 10s ease-in-out infinite; box-shadow: 0 0 12px var(--teal); }

.scroller { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.thread { max-width: 760px; margin: 0 auto; padding: 8px 22px 30px; }

/* welcome */
.welcome { text-align: center; padding: 7vh 0 10px; animation: rise 1s cubic-bezier(.2,.8,.2,1) both; }
.welcome h2 { font-size: clamp(30px, 5vw, 42px); line-height: 1.12; margin: 0 0 12px; }
.welcome-sub { color: var(--ink-2); max-width: 46ch; margin: 0 auto 30px; font-size: 17px; }
.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; text-align: left; }
.chip {
  border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  padding: 14px 16px; border-radius: 18px; color: var(--ink); font-size: 15px; text-align: left; line-height: 1.4; transition: transform .25s, background .25s, box-shadow .25s;
  animation: rise .8s cubic-bezier(.2,.8,.2,1) both;
}
.chip small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.chip:hover { transform: translateY(-2px); background: var(--glass-strong); box-shadow: var(--shadow); }

/* messages */
.msg { display: flex; gap: 14px; margin: 26px 0; animation: rise .5s cubic-bezier(.2,.8,.2,1) both; }
.msg.user { justify-content: flex-end; }
.msg.user .bubble {
  background: var(--user); color: var(--user-ink); padding: 12px 18px; border-radius: 22px 22px 6px 22px; max-width: 80%;
  white-space: pre-wrap; word-wrap: break-word; box-shadow: 0 4px 18px -10px rgba(110,80,40,.35);
}
.msg.abby .orb { margin-top: 4px; }
.msg.abby .body { flex: 1; min-width: 0; }
.msg.abby .content { font-size: 16.5px; line-height: 1.7; }
.content p { margin: 0 0 .85em; }
.content p:last-child { margin-bottom: 0; }
.content strong { font-weight: 600; color: var(--ink); background: linear-gradient(transparent 62%, rgba(var(--gold-rgb),.28) 62%); }
.content ul, .content ol { padding-left: 1.3em; margin: 0 0 .85em; }
.content li { margin: .25em 0; }
.content a { color: var(--gold-deep); }
.content blockquote { margin: 0 0 .85em; padding: 2px 0 2px 16px; border-left: 2px solid var(--gold); font-family: var(--serif); font-style: italic; color: var(--ink-2); }
.content h1, .content h2, .content h3 { font-family: var(--serif); font-weight: 450; font-size: 1.15em; margin: 1em 0 .4em; }
.status { color: var(--muted); font-style: italic; font-family: var(--serif); font-size: 16px; padding-top: 6px; transition: opacity .4s; }
.cursor::after { content: ""; display: inline-block; width: 7px; height: 7px; margin-left: 5px; border-radius: 50%; background: var(--gold); animation: pulse 1.2s ease-in-out infinite; vertical-align: middle; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.7); } }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.src { font-size: 12px; color: var(--ink-2); padding: 4px 10px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); }
.src-label { font-size: 12px; color: var(--muted); }
.fb { margin-left: auto; display: flex; gap: 2px; }
.fb button { border: 0; background: none; color: var(--muted); padding: 4px 6px; border-radius: 8px; font-size: 14px; }
.fb button:hover, .fb button.on { color: var(--gold-deep); background: var(--glass); }
.breathe-inline {
  display: inline-flex; align-items: center; gap: 10px; margin: 6px 0 14px; padding: 10px 18px 10px 10px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--teal) 45%, transparent); background: color-mix(in srgb, var(--teal) 10%, var(--glass));
  font-weight: 500; color: var(--ink); transition: .2s;
}
.breathe-inline:hover { background: color-mix(in srgb, var(--teal) 18%, var(--glass)); transform: translateY(-1px); }

/* composer */
.composer-wrap { padding: 8px 22px calc(14px + env(safe-area-inset-bottom)); }
.composer {
  max-width: 760px; margin: 0 auto; display: flex; align-items: flex-end; gap: 6px; padding: 8px 8px 8px 20px;
  background: var(--glass-strong); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border: 1px solid var(--line);
  border-radius: 28px; box-shadow: var(--shadow); transition: border-color .25s, box-shadow .25s;
}
.composer:focus-within { border-color: color-mix(in srgb, var(--gold) 70%, transparent); box-shadow: var(--shadow), 0 0 0 5px rgba(var(--gold-rgb),.14); }
.composer textarea {
  flex: 1; border: 0; outline: none; resize: none; background: transparent; color: var(--ink); font: inherit; line-height: 1.5;
  padding: 9px 0; max-height: 200px;
}
.composer textarea::placeholder { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mic.listening { color: var(--clay); animation: pulse 1.2s infinite; }
.send {
  width: 42px; height: 42px; border-radius: 50%; border: 0; display: grid; place-items: center; color: #2B2014;
  background: linear-gradient(135deg, #E9CC92, var(--gold)); transition: transform .2s, opacity .2s;
}
.send:disabled { opacity: .35; cursor: default; }
.send:not(:disabled):hover { transform: scale(1.06); }
.composer-wrap .fine { margin: 8px 0 0; }

/* breath overlay */
.breath {
  position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(26px); -webkit-backdrop-filter: blur(26px);
  animation: fade .6s ease both; text-align: center; padding: 24px;
}
@keyframes fade { from { opacity: 0; } }
.breath-close { position: absolute; top: 18px; right: 18px; }
.breath-sound { position: absolute; top: 18px; right: 62px; }
.sfx-toggle[aria-pressed="true"] .off, .sfx-toggle[aria-pressed="false"] .on { display: none; }
.sfx-toggle[aria-pressed="false"] { color: var(--muted); }
.breath-sound[aria-pressed="true"] .off, .breath-sound[aria-pressed="false"] .on { display: none; }
.breath-orb { width: 150px; height: 150px; position: relative; margin-bottom: 36px; }
.breath-orb span {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #FFF8E6 0%, #EFD39A 26%, var(--gold) 50%, var(--aqua) 80%, #5E7875 100%);
  box-shadow: 0 0 120px -10px rgba(var(--aqua-rgb),.6), 0 0 60px -10px rgba(var(--gold-rgb),.8);
  transform: scale(.7); transition: transform 4s cubic-bezier(.45,.05,.35,1);
}
.breath-orb.in span { transform: scale(1.35); transition-duration: 4s; }
.breath-orb.hold span { transform: scale(1.35); }
.breath-orb.out span { transform: scale(.7); transition-duration: 6s; }
.breath-word { font-family: var(--serif); font-size: clamp(28px, 6vw, 40px); font-weight: 300; margin: 0; min-height: 1.3em; transition: opacity .6s; max-width: 16ch; line-height: 1.2; }
.breath-sub { color: var(--ink-2); margin: 0; max-width: 34ch; min-height: 3em; transition: opacity .6s; }

/* voice call */
.voice {
  position: fixed; inset: 0; z-index: 55; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: color-mix(in srgb, var(--bg) 84%, transparent); backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px);
  animation: fade .5s ease both; padding: 24px; text-align: center;
}
.voice-orb { width: 170px; height: 170px; position: relative; margin-bottom: 18px; }
.voice-orb span {
  position: absolute; inset: 0; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #FFF8E6 0%, #EFD39A 26%, var(--gold) 50%, var(--aqua) 80%, #5E7875 100%);
  box-shadow: 0 0 120px -10px rgba(var(--aqua-rgb),.55), 0 0 60px -10px rgba(var(--gold-rgb),.8);
  transform: scale(var(--s, 1)); transition: transform .12s ease-out;
}
.voice-orb .ring { position: absolute; inset: -14px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--teal) 50%, transparent); opacity: 0; transform: scale(var(--r, 1)); transition: transform .15s ease-out, opacity .4s; }
.voice.listening .voice-orb .ring { opacity: .8; }
.voice.connecting .voice-orb span { animation: breathe 2.6s ease-in-out infinite; }
.voice-status { font-family: var(--serif); font-size: clamp(22px, 4.5vw, 30px); font-weight: 300; margin: 0; }
.voice-lines { max-width: 560px; min-height: 5.5em; display: grid; gap: 8px; color: var(--ink-2); font-size: 15.5px; line-height: 1.5; }
.voice-lines p { margin: 0; animation: rise .5s ease both; }
.voice-lines .you { color: var(--muted); font-style: italic; }
.voice-controls { display: flex; gap: 14px; align-items: center; margin-top: 6px; }
.voice-btn { width: 54px; height: 54px; border-radius: 50%; border: 1px solid var(--line); background: var(--glass-strong); display: grid; place-items: center; color: var(--ink-2); }
.voice-btn[aria-pressed="true"] { color: var(--clay); }
.voice-btn[aria-pressed="false"] .off, .voice-btn[aria-pressed="true"] .on { display: none; }
.voice-end { border: 0; border-radius: 999px; padding: 15px 30px; font-weight: 600; color: #fff; background: linear-gradient(135deg, #C98563, var(--clay)); box-shadow: 0 8px 24px -10px rgba(170,103,61,.8); }
.icon-btn.talk { width: auto; height: 38px; padding: 0 12px 0 10px; gap: 6px; display: flex; align-items: center; border-radius: 999px; color: var(--teal); font-size: 14px; font-weight: 600; background: color-mix(in srgb, var(--teal) 10%, transparent); }
.icon-btn.talk:hover { background: color-mix(in srgb, var(--teal) 18%, transparent); color: var(--teal); }

/* memory dialog */
.mem { border: 1px solid var(--line); border-radius: 24px; padding: 26px; max-width: 520px; width: calc(100% - 32px); background: var(--glass-strong); color: var(--ink); box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.mem::backdrop { background: rgba(20, 15, 10, .3); backdrop-filter: blur(4px); }
.mem h3 { margin: 0 0 6px; font-size: 26px; }
.mem-text { white-space: pre-wrap; background: var(--bg-2); border-radius: 14px; padding: 14px 16px; font-size: 14.5px; max-height: 50vh; overflow-y: auto; margin: 14px 0 18px; }
.mem-actions { display: flex; justify-content: space-between; align-items: center; }

/* ---------- mobile ---------- */
@media (max-width: 820px) {
  .only-mobile { display: grid; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 30; width: min(86vw, 320px); transform: translateX(-102%); transition: transform .35s cubic-bezier(.2,.8,.2,1); background: var(--glass-strong); }
  .app.side-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .scrim { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(20,15,10,.25); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .app.side-open .scrim { opacity: 1; pointer-events: auto; }
  .topbar { padding: 10px 12px; min-height: 56px; }
  .thread { padding: 4px 16px 24px; }
  .composer-wrap { padding: 6px 12px calc(10px + env(safe-area-inset-bottom)); }
  .chips { grid-template-columns: 1fr; }
  .welcome { padding-top: 3vh; }
  .msg.abby { gap: 10px; }
  .msg.abby .orb { width: 24px; height: 24px; }
  .msg.user .bubble { max-width: 88%; }
  .breathe-pill { padding: 7px 12px; }
  .auth-card { padding: 32px 20px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; transition-duration: .001s !important; }
}

/* ---------- opening-screen video (Kate) ---------- */
.auth-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; background: var(--bg); }
.auth-bg video { width: 100%; height: 100%; object-fit: cover; object-position: 72% 40%; display: block; }
/* soften the centre so the sign-in card stays easy to read */
.auth-bg::after { content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 60% 75% at 50% 50%, rgba(var(--veil-rgb),.78) 0%, rgba(var(--veil-rgb),.35) 55%, rgba(var(--veil-rgb),.05) 100%); }
:root[data-theme="dark"] .auth-bg::after { background: radial-gradient(ellipse 60% 75% at 50% 50%, rgba(var(--veil-rgb),.82) 0%, rgba(var(--veil-rgb),.45) 55%, rgba(var(--veil-rgb),.15) 100%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .auth-bg::after { background: radial-gradient(ellipse 60% 75% at 50% 50%, rgba(var(--veil-rgb),.82) 0%, rgba(var(--veil-rgb),.45) 55%, rgba(var(--veil-rgb),.15) 100%); } }
.auth { isolation: isolate; }
.auth .auth-card { position: relative; z-index: 1; }
@media (max-width: 700px) {
  /* phones: Kate's face sits above the card; the card scrolls up over her */
  .auth-bg video { object-position: 77% 0%; height: 62vh; }
  .auth-bg::after { background: linear-gradient(to bottom, rgba(var(--veil-rgb),0) 0%, rgba(var(--veil-rgb),0) 34%, var(--bg) 62%); }
  :root[data-theme="dark"] .auth-bg::after { background: linear-gradient(to bottom, rgba(var(--veil-rgb),.15) 0%, rgba(var(--veil-rgb),.15) 34%, var(--bg) 62%); }
  .auth { place-items: start center; padding-top: 38vh; }
}
@media (max-width: 700px) and (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .auth-bg::after { background: linear-gradient(to bottom, rgba(var(--veil-rgb),.15) 0%, rgba(var(--veil-rgb),.15) 34%, var(--bg) 62%); }
}

/* "Who is Brent?" reply */
.brent-video { display: block; width: min(100%, 420px); border-radius: 18px; background: #000;
  box-shadow: 0 10px 30px rgba(var(--veil-rgb), .18); }
.brent-wrap { position: relative; width: min(100%, 420px); }
.brent-wrap .brent-video { width: 100%; }
.brent-sound { position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  padding: 8px 14px; border: 0; border-radius: 999px; font: inherit; font-size: 14px; cursor: pointer;
  color: #1a1a1a; background: rgba(247, 245, 231, .92); box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.brent-sound[hidden] { display: none; }
