:root {
  --paper: #fbfaf5;
  --paper-soft: #f4f5ef;
  --card: rgba(255, 255, 255, .78);
  --ink: #24352f;
  --muted: #718079;
  --line: rgba(38, 64, 55, .11);
  --green: #116f68;
  --green-soft: #e8f4ef;
  --voice: #c65d24;
  --error: #a73e32;
  color: var(--ink);
  background: #e8eee8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; overflow: hidden; background: #e8eee8; color: var(--ink); }
button, input, textarea, select { font: inherit; }
button { border: 0; color: inherit; cursor: pointer; }
button:disabled { cursor: wait; opacity: .52; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(18, 125, 118, .25);
  outline-offset: 2px;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.eyebrow { margin-bottom: 8px; color: var(--green); font-size: 10px; font-weight: 900; letter-spacing: .15em; }
.fine { color: var(--muted); font-size: 11px; line-height: 1.55; }
.section-label, .section-title, .personal-subhead {
  color: #829089;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.section-title { margin-top: 2px; }

.welcome {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 30px 20px;
  background:
    radial-gradient(circle at 50% 28%, rgba(121, 211, 195, .22), transparent 30%),
    linear-gradient(145deg, #f8f8f2, #e7eee8);
}
.welcome-card {
  width: min(100%, 480px);
  padding: 38px;
  border: 1px solid rgba(33, 67, 57, .1);
  border-radius: 30px;
  background: rgba(255, 255, 255, .74);
  box-shadow: 0 28px 90px rgba(34, 64, 55, .13);
  text-align: center;
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 850; letter-spacing: -.04em; }
.welcome-brand { justify-content: center; margin-bottom: 42px; }
.brand-mark {
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #0b6d67, #2aa596);
  color: white;
  box-shadow: 0 8px 20px rgba(16, 112, 103, .2);
  font-family: Georgia, serif;
  font-size: 24px;
  font-style: italic;
}
.welcome h1 { margin: 12px 0 17px; font-family: Georgia, serif; font-size: clamp(42px, 7vw, 62px); font-weight: 400; line-height: 1.02; letter-spacing: -.045em; }
.welcome .lead { margin-bottom: 28px; color: var(--muted); font-size: 14px; line-height: 1.65; }
.welcome label { display: block; margin-bottom: 7px; font-size: 11px; font-weight: 800; text-align: left; }
.welcome label small { color: var(--muted); font-weight: 500; }
.welcome input, .panel input, .panel select, .proposal input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px;
  background: rgba(255, 255, 255, .8);
  color: var(--ink);
}
.primary {
  border-radius: 13px;
  padding: 12px 17px;
  background: linear-gradient(145deg, #127d76, #0b635e);
  color: white;
  font-weight: 800;
}
.guest-button { display: flex; width: 100%; justify-content: space-between; margin-top: 10px; }
.scope-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin: 25px 0 16px; }
.scope-chips span { border: 1px solid var(--line); border-radius: 999px; padding: 6px 9px; color: var(--muted); font-size: 9px; font-weight: 700; }

.app {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr) 318px;
  overflow: hidden;
  background: var(--paper);
}
.left, .right {
  z-index: 8;
  display: flex;
  height: 100dvh;
  min-height: 0;
  flex-direction: column;
  padding: 19px;
  background: rgba(251, 250, 246, .93);
  backdrop-filter: blur(18px);
}
.left { border-right: 1px solid var(--line); }
.right { gap: 12px; overflow-y: auto; border-left: 1px solid var(--line); }
.online {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 17px 0 18px;
  border: 1px solid #e2ebe4;
  border-radius: 14px;
  padding: 10px 12px;
  background: #f0f6f1;
  color: #587068;
  font-size: 12px;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #30a56e; box-shadow: 0 0 0 4px rgba(48, 165, 110, .1); }
.nav { display: flex; flex-direction: column; gap: 5px; }
.nav button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 9px;
  border-radius: 13px;
  padding: 10px 11px;
  background: transparent;
  color: #59655f;
  font-size: 12px;
  font-weight: 750;
  text-align: left;
}
.nav button.active, .nav button:hover { background: #edf4ef; color: #173b34; }
.nav-icon { width: 21px; text-align: center; }
.count { margin-left: auto; border-radius: 999px; padding: 2px 6px; background: #e5ece6; color: #587068; font-size: 9px; font-weight: 850; }
.section-label { margin: 22px 10px 8px; }
.conversation-list { flex: 1; min-height: 48px; overflow-y: auto; }
.conversation-list button {
  display: block;
  width: 100%;
  overflow: hidden;
  border-radius: 10px;
  padding: 9px 10px;
  background: transparent;
  color: #77837d;
  font-size: 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-list button:hover, .conversation-list button.active { background: #f0f4ef; color: #27483f; }
.tiny-card { margin-top: 12px; border: 1px solid var(--line); border-radius: 17px; padding: 13px; background: rgba(255, 255, 255, .72); }
.tiny-card strong { font-size: 11px; }
.tiny-card p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.profile { display: flex; align-items: center; gap: 9px; margin-top: 12px; border-top: 1px solid var(--line); padding-top: 13px; font-size: 11px; font-weight: 750; }
.profile small { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 500; }
.profile-badge { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 12px; background: #253934; color: white; font-weight: 850; }

.stage {
  --scene-a: #f5dfb9;
  --scene-b: #d8f0e7;
  --scene-c: #eff4dc;
  --accent: #157b72;
  --avatar-1: #7ce1cf;
  --avatar-2: #2cab99;
  --avatar-3: #146f67;
  position: relative;
  min-width: 0;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 68% 18%, rgba(255,255,255,.66), transparent 31%),
    radial-gradient(circle at 15% 85%, rgba(255,255,255,.48), transparent 28%),
    linear-gradient(135deg, var(--scene-a), var(--scene-b) 48%, var(--scene-c));
  transition: background .55s ease, color .35s ease;
}
.stage[data-vibe="focus"] { --scene-a: #dfe8ff; --scene-b: #d9f0ed; --scene-c: #e9e4ff; --accent: #4567a9; --avatar-1: #93c6ff; --avatar-2: #5b87d8; --avatar-3: #4054a0; }
.stage[data-vibe="cheer"] { --scene-a: #ffe1a4; --scene-b: #ffd3c4; --scene-c: #e4f4ca; --accent: #d77a22; --avatar-1: #ffca7f; --avatar-2: #f08c55; --avatar-3: #c75759; }
.stage[data-vibe="cozy"] { --scene-a: #f1d6cc; --scene-b: #eadfd4; --scene-c: #e5d7e8; --accent: #8d5d66; --avatar-1: #e7a89f; --avatar-2: #bf7b86; --avatar-3: #75546f; }
.stage[data-vibe="playful"] { --scene-a: #f8d4ef; --scene-b: #d7e9ff; --scene-c: #d9f3d8; --accent: #6755bd; --avatar-1: #b49bf0; --avatar-2: #745cc5; --avatar-3: #5945a0; }
.stage[data-vibe="festive"] { --scene-a: #ffd88c; --scene-b: #f5a3a5; --scene-c: #b4e5d3; --accent: #b85e26; --avatar-1: #ffd070; --avatar-2: #e68159; --avatar-3: #a95262; }
.stage[data-vibe="night"] { --scene-a: #dbe4f1; --scene-b: #d8dfed; --scene-c: #e9e0ef; --accent: #506c9b; --avatar-1: #8fd8d2; --avatar-2: #3b9c99; --avatar-3: #26566c; }
.topbar {
  position: relative;
  z-index: 12;
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 14px 22px;
}
.top-date { color: #61716a; font-size: 11px; font-weight: 800; }
.current-title { display: block; max-width: 400px; overflow: hidden; margin-top: 4px; color: #86918c; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.toolbar { display: flex; align-items: center; gap: 8px; }
.pill {
  min-height: 36px;
  width: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, .72);
  color: #455851;
  font-size: 10px;
  font-weight: 800;
}
select.pill { padding-right: 30px; }
.icon-pill { min-width: 36px; padding: 7px; }
.connection-note, .due-banner {
  position: relative;
  z-index: 14;
  margin: 0 22px;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 10px;
  line-height: 1.45;
}
.connection-note { border: 1px solid #e4b999; background: #fff4e9; color: #8b4c28; }
.due-banner { display: flex; justify-content: space-between; border: 1px solid #a9d2b1; background: #eff8f0; color: #386c43; }
.due-banner button { background: transparent; color: inherit; text-decoration: underline; }

.companion-space { position: absolute; inset: 69px 0 var(--composer-height, 126px); overflow: hidden; }
.halo {
  position: absolute;
  top: 46%;
  left: 50%;
  width: min(59vw, 550px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.76), rgba(255,255,255,0) 65%);
}
.orbit {
  position: absolute;
  top: 47%;
  left: 50%;
  width: min(46vw, 410px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(26, 114, 101, .08);
  border-radius: 50%;
  animation: orbit 16s linear infinite;
}
.orbit::before, .orbit::after { content: ""; position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 18px var(--accent); }
.orbit::before { top: 15%; left: 8%; }
.orbit::after { right: 3%; bottom: 30%; width: 5px; height: 5px; }
.floaties i { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: rgba(35, 145, 126, .24); animation: float 5s ease-in-out infinite; }
.floaties i:nth-child(1) { top: 25%; left: 18%; }
.floaties i:nth-child(2) { top: 19%; right: 18%; animation-delay: -1s; }
.floaties i:nth-child(3) { bottom: 22%; left: 27%; animation-delay: -2s; }
.floaties i:nth-child(4) { bottom: 27%; right: 24%; animation-delay: -3s; }
.floaties i:nth-child(5) { top: 52%; right: 10%; animation-delay: -4s; }

.avatar-wrap {
  position: absolute;
  z-index: 3;
  top: 48%;
  left: 36%;
  width: 205px;
  height: 255px;
  transform: translate(-50%, -50%);
  animation: avatarFloat 4.2s ease-in-out infinite;
  transition: top .28s ease, left .28s ease, scale .28s ease, opacity .28s ease;
}
.avatar-shadow { position: absolute; bottom: 4px; left: 50%; width: 130px; height: 22px; transform: translateX(-50%); border-radius: 50%; background: rgba(30, 79, 67, .15); filter: blur(10px); }
.avatar-3d { position: absolute; inset: 0; }
.head-3d {
  position: absolute;
  z-index: 3;
  top: 25px;
  left: 22px;
  width: 162px;
  height: 150px;
  border-radius: 48% 52% 46% 54%;
  background: linear-gradient(145deg, var(--avatar-1), var(--avatar-2) 58%, var(--avatar-3));
  box-shadow: inset 14px 11px 26px rgba(255,255,255,.3), inset -13px -16px 25px rgba(5,76,71,.2), 0 18px 30px rgba(24,104,95,.18);
}
.body-3d { position: absolute; bottom: 21px; left: 42px; width: 122px; height: 118px; border-radius: 52% 48% 43% 44%; background: linear-gradient(145deg, var(--avatar-1), var(--avatar-2) 55%, var(--avatar-3)); box-shadow: inset 10px 8px 18px rgba(255,255,255,.18); }
.ear { position: absolute; z-index: 1; top: 63px; width: 48px; height: 64px; border-radius: 50%; background: linear-gradient(145deg, var(--avatar-1), var(--avatar-3)); }
.left-ear { left: 1px; transform: rotate(-19deg); }
.right-ear { right: 1px; transform: rotate(19deg); }
.eye { position: absolute; top: 52px; width: 28px; height: 36px; border-radius: 50%; background: #153932; box-shadow: inset 0 -4px 0 rgba(0,0,0,.16); overflow: hidden; }
.left-eye { left: 40px; }
.right-eye { right: 40px; }
.pupil { position: absolute; top: 7px; left: 7px; width: 14px; height: 17px; border-radius: 50%; background: #061b17; transition: transform .12s; }
.pupil i { position: absolute; top: 1px; left: 2px; width: 5px; height: 5px; border-radius: 50%; background: white; }
.cheek { position: absolute; top: 96px; width: 23px; height: 12px; border-radius: 50%; background: rgba(245,139,139,.32); filter: blur(1px); }
.left-cheek { left: 21px; }.right-cheek { right: 21px; }
.mouth { position: absolute; top: 103px; left: 69px; width: 25px; height: 13px; border-bottom: 4px solid #174e46; border-radius: 50%; }
.avatar-badge { position: absolute; z-index: 4; right: 23px; bottom: 35px; display: grid; width: 31px; height: 31px; place-items: center; border-radius: 50%; background: #fff3d5; color: #c47a24; box-shadow: 0 5px 14px rgba(95,70,30,.13); }
.avatar-2d, .avatar-mini { display: none; position: absolute; inset: 0; }
.avatar-2d svg { width: 100%; height: 100%; filter: drop-shadow(0 17px 16px rgba(57,39,90,.17)); }
.avatar-mini { place-items: center; }
.mini-body { position: relative; width: 118px; height: 118px; border-radius: 43% 57% 49% 51%; background: linear-gradient(145deg, #f4a17f, #c95c68); box-shadow: inset 10px 8px 18px rgba(255,255,255,.22), 0 18px 30px rgba(126,55,66,.17); }
.mini-body > span { position: absolute; top: 42px; width: 13px; height: 18px; border-radius: 50%; background: #4b2930; }
.mini-body > span:first-child { left: 31px; }.mini-body > span:nth-child(2) { right: 31px; }
.mini-body i { position: absolute; top: 70px; left: 48px; width: 24px; height: 10px; border-bottom: 3px solid #62313a; border-radius: 50%; }
.avatar-wrap[data-avatar="2d"] .avatar-3d { display: none; }
.avatar-wrap[data-avatar="2d"] .avatar-2d { display: block; }
.avatar-wrap[data-avatar="mini"] .avatar-3d { display: none; }
.avatar-wrap[data-avatar="mini"] .avatar-mini { display: grid; }
.avatar-wrap.speaking .mouth { animation: talk .22s ease-in-out infinite alternate; }

.speech-card {
  position: absolute;
  z-index: 6;
  top: 10%;
  right: clamp(18px, 4vw, 70px);
  width: min(390px, 43%);
  max-height: 55%;
  overflow: hidden;
  border: 1px solid rgba(41, 68, 61, .1);
  border-radius: 22px 22px 6px 22px;
  padding: 17px 18px;
  background: rgba(255, 255, 255, .84);
  box-shadow: 0 18px 42px rgba(42, 69, 60, .1);
  backdrop-filter: blur(14px);
  scrollbar-color: rgba(77, 99, 91, .38) transparent;
  scrollbar-width: thin;
  transition: top .28s ease, right .28s ease, bottom .28s ease, width .28s ease,
    max-height .28s ease, border-radius .28s ease;
}
.speech-card::-webkit-scrollbar { width: 5px; }
.speech-card::-webkit-scrollbar-track { background: transparent; }
.speech-card::-webkit-scrollbar-thumb { border-radius: 99px; background: rgba(77, 99, 91, .32); }
.chat-mode-head { display: none; }
.stage.chat-open .companion-space { inset: 69px 0 var(--composer-height, 90px); background: rgba(251, 250, 246, .92); }
.stage.chat-open .halo,
.stage.chat-open .orbit,
.stage.chat-open .floaties,
.stage.chat-open .avatar-wrap { visibility: hidden; opacity: 0; pointer-events: none; }
.stage.chat-open .speech-card {
  inset: 0;
  width: auto;
  max-height: none;
  overflow-y: auto;
  border: 0;
  border-radius: 0;
  padding: 18px clamp(22px, 6vw, 72px) 30px;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
.stage.chat-open .chat-mode-head {
  position: sticky;
  z-index: 4;
  top: -18px;
  display: flex;
  width: min(100%, 780px);
  align-items: center;
  justify-content: space-between;
  margin: 0 auto 24px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0 14px;
  background: rgba(251, 250, 246, .96);
  color: #5d6d66;
  font-size: 11px;
}
.chat-mode-head button {
  border-radius: 999px;
  padding: 7px 10px;
  background: #edf3ef;
  color: #355048;
  font-size: 10px;
  font-weight: 800;
}
.stage.chat-open .empty-chat {
  width: min(100%, 700px);
  margin: clamp(50px, 14vh, 130px) auto 0;
  text-align: center;
}
.stage.chat-open .messages {
  width: min(100%, 780px);
  margin: 0 auto;
}
.empty-chat h1 { margin: 4px 0 8px; font-family: Georgia, serif; font-size: 22px; font-weight: 400; line-height: 1.18; }
.empty-chat p:last-child { margin-bottom: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.companion-reply { color: #40534c; }
.companion-reply-label { display: block; margin-bottom: 7px; color: var(--accent); font-size: 8px; font-weight: 900; letter-spacing: .15em; }
.companion-reply-text {
  max-height: 10.85em;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.companion-reply small { display: block; margin-top: 9px; color: var(--muted); font-size: 8px; }
.companion-reply.pending .companion-reply-label::after { content: " · responding…"; letter-spacing: normal; text-transform: none; }
.stage.chat-open .companion-reply { display: none; }
.messages { display: flex; flex-direction: column; gap: 12px; }
.bubble { max-width: 94%; overflow-wrap: anywhere; color: #41534c; font-size: 12px; line-height: 1.55; white-space: pre-wrap; }
.bubble.user { align-self: flex-end; border-radius: 14px 14px 3px 14px; padding: 9px 11px; background: #edf3ee; color: #33443e; }
.bubble.assistant { align-self: flex-start; white-space: normal; }
.bubble.assistant::before { content: "MELEN"; display: block; margin-bottom: 4px; color: var(--green); font-size: 7px; font-weight: 900; letter-spacing: .15em; }
.stage.chat-open .bubble { font-size: 14px; line-height: 1.65; }
.stage.chat-open .bubble.user { max-width: 78%; padding: 10px 13px; }
.stage.chat-open .bubble.assistant { width: 100%; max-width: 100%; padding: 8px 0 18px; }
.bubble.assistant p { margin: 0 0 10px; }
.bubble.assistant p:last-child { margin-bottom: 0; }
.bubble.assistant h3, .bubble.assistant h4, .bubble.assistant h5 { margin: 17px 0 8px; font-size: 1em; }
.bubble.assistant ul, .bubble.assistant ol { margin: 8px 0 12px; padding-left: 22px; }
.bubble.assistant li { margin: 4px 0; }
.bubble.assistant blockquote { margin: 10px 0; border-left: 3px solid #a7c9bf; padding-left: 12px; color: #62736c; }
.bubble.assistant code { border-radius: 5px; padding: 2px 5px; background: #eef2ee; font-size: .9em; }
.bubble.assistant pre { overflow-x: auto; border-radius: 12px; padding: 13px; background: #24332f; color: #f3f6f4; }
.bubble.assistant pre code { padding: 0; background: transparent; color: inherit; }
.message-table-wrap { max-width: 100%; overflow-x: auto; margin: 10px 0 14px; }
.message-table-wrap table { width: 100%; min-width: 520px; border-collapse: collapse; font-size: .9em; }
.message-table-wrap th, .message-table-wrap td { border: 1px solid #dce5df; padding: 8px 10px; text-align: left; vertical-align: top; }
.message-table-wrap th { background: #edf3ef; color: #304b43; }
.bubble.draft { opacity: .65; }
.bubble.failed { border-left: 2px solid #c7685e; padding-left: 9px; }
.bubble.searching { color: #977349; }
.source-link { color: #0e776f; text-underline-offset: 2px; }
.turn-note { margin-top: 5px; color: var(--muted); font-size: 9px; white-space: normal; }
.retry { display: block; margin-top: 7px; border-radius: 8px; padding: 6px 9px; background: #eef3ef; color: var(--green); font-size: 9px; font-weight: 800; }
.memory-note { align-self: flex-start; border-radius: 999px; padding: 6px 9px; background: #eaf5eb; color: #417149; font-size: 9px; }
.proposal { align-self: stretch; border: 1px solid #ddc4a7; border-radius: 13px; padding: 12px; background: #fffaf1; font-size: 10px; }
.proposal h3 { margin-bottom: 7px; font-size: 11px; }.proposal p { margin-bottom: 8px; }
.proposal label { display: block; margin: 8px 0 4px; color: var(--muted); font-size: 9px; }
.proposal .actions { display: flex; gap: 7px; margin-top: 10px; }
.proposal .actions button { border-radius: 8px; padding: 7px 9px; background: #edf1ec; font-size: 9px; font-weight: 800; }
.proposal .actions .primary { background: var(--green); color: white; }

.moodline { position: absolute; z-index: 7; right: 0; bottom: calc(var(--composer-height, 126px) - 9px); left: 0; display: flex; justify-content: center; pointer-events: none; }
.moodchip { border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; background: rgba(255,255,255,.68); color: #61716a; font-size: 9px; font-weight: 800; box-shadow: 0 8px 20px rgba(40,69,59,.05); }
.composer-shell {
  position: absolute;
  z-index: 15;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 9px 20px 14px;
  background: linear-gradient(0deg, rgba(251,250,245,.98), rgba(251,250,245,.52) 74%, transparent);
  backdrop-filter: blur(5px);
}
.stage.chat-open .composer-shell { background: rgba(251, 250, 246, .98); }
.stage.chat-open .quickies, .stage.chat-open .moodline { display: none; }
.quickies { display: flex; justify-content: center; gap: 7px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; scrollbar-width: none; }
.quickies button { flex: 0 0 auto; scroll-snap-align: start; border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; background: rgba(255,255,255,.74); color: #52635c; font-size: 9px; font-weight: 780; }
.control-dock { position: relative; display: flex; width: max-content; max-width: 100%; height: 62px; align-items: center; justify-content: center; gap: 10px; margin: auto; transition: width .24s ease; }
.composer-shell.text-open .control-dock { width: min(100%, 720px); }
.dock-button {
  position: relative;
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  place-items: center;
  border: 1px solid rgba(44,74,65,.11);
  border-radius: 16px;
  background: rgba(255,255,255,.9);
  color: #59645f;
  box-shadow: 0 7px 17px rgba(43,66,58,.08);
}
.dock-mic { z-index: 2; width: 62px; height: 62px; flex-basis: 62px; border-radius: 50%; background: linear-gradient(150deg, #d46b31, var(--voice)); color: white; font-size: 25px; box-shadow: 0 10px 24px rgba(183,77,28,.28), inset 0 1px 0 rgba(255,255,255,.22); }
.mic-stop { display: none; font-size: 16px; }
.dock-mic.listening .mic-normal { display: none; }.dock-mic.listening .mic-stop { display: inline; }
.dock-mic.listening { background: linear-gradient(150deg, #b94d23, #8e3618); }
.voice-ripple { position: absolute; inset: -3px; border: 1px solid rgba(198,93,36,.34); border-radius: 50%; opacity: 0; pointer-events: none; }
.dock-mic.listening .voice-ripple { animation: voiceRing 1.45s ease-out infinite; }
.dock-mic.listening .ripple-two { animation-delay: .48s; }
.dock-side.active { border-color: rgba(198,93,36,.24); background: #fff4ec; color: var(--voice); }
.dock-text-field {
  display: flex;
  min-width: 0;
  width: 0;
  height: 52px;
  flex: 0 0 0;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  border: 0 solid rgba(41,68,61,.13);
  border-radius: 18px;
  padding: 0;
  background: rgba(255,255,255,.92);
  opacity: 0;
  pointer-events: none;
  transition: flex-basis .24s, width .24s, padding .24s, opacity .18s;
}
.composer-shell.text-open .dock-text-field {
  width: auto;
  flex: 1 1 auto;
  border-width: 1px;
  padding: 7px 8px 7px 15px;
  box-shadow: 0 12px 28px rgba(38,65,57,.1);
  opacity: 1;
  pointer-events: auto;
}
.dock-text-field textarea { min-width: 0; max-height: 72px; flex: 1; resize: none; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; line-height: 1.45; }
.dock-text-field textarea::placeholder { color: #8a9791; }
.text-send { display: grid; width: 37px; height: 37px; flex: 0 0 37px; place-items: center; border-radius: 12px; background: #23332f; color: white; font-size: 17px; }
.text-send.stop { background: #8a4939; }
.composer-shell.text-open #text-toggle { border-color: rgba(198,93,36,.2); background: #fff4ec; color: var(--voice); }
.composer-meta { display: flex; width: min(100%, 680px); justify-content: space-between; gap: 10px; margin: 4px auto 0; color: #84908b; font-size: 8px; }
.error { width: min(100%, 720px); margin: 0 auto 8px; border: 1px solid #dfa89e; border-radius: 11px; padding: 8px 11px; background: #fff0ec; color: var(--error); font-size: 10px; line-height: 1.45; }

.right-head { display: flex; align-items: center; justify-content: space-between; }
.mobile-close { display: none; }
.right-card { border: 1px solid var(--line); border-radius: 19px; padding: 13px; background: var(--card); box-shadow: 0 10px 24px rgba(44,70,61,.04); }
.right-card h2 { margin: 0; font-size: 13px; letter-spacing: -.02em; }
.right-card p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.nudge { display: flex; align-items: center; gap: 10px; }
.nudge-icon { display: grid; width: 36px; height: 36px; flex: 0 0 36px; place-items: center; border-radius: 13px; background: #fff2d9; }
.nudge strong { display: block; font-size: 11px; }.nudge small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.avatar-select { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 9px; }
.avatar-option { border: 1px solid var(--line); border-radius: 13px; padding: 7px 4px; background: #f7f8f4; text-align: center; }
.avatar-option.active { border-color: #81bdb0; background: #edf7f4; box-shadow: inset 0 0 0 1px #a7d7cd; }
.avatar-option strong, .avatar-option small { display: block; }
.avatar-option strong { font-size: 9px; }.avatar-option small { margin-top: 2px; color: var(--muted); font-size: 7px; }
.preview { display: block; width: 31px; height: 31px; margin: 0 auto 5px; border-radius: 48% 52% 44% 56%; }
.preview.tara { background: linear-gradient(145deg,#70d8c6,#187a71); }.preview.aru { border-radius: 50% 50% 42% 42%; background: #7552b4; }.preview.mini { background: linear-gradient(145deg,#f4a17f,#c95c68); }
.personal-subhead { margin-top: 12px; }
.vibes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 7px; }
.vibe { border: 1px solid var(--line); border-radius: 11px; padding: 7px 4px; background: #f8f9f5; font-size: 8px; font-weight: 800; transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease; }
.vibe:hover { transform: translateY(-1px); }
.vibe.active { border-color: #4ca797; background: #e5f5f0; box-shadow: inset 0 0 0 1px rgba(76,167,151,.22); }
.voice-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.voice-row strong, .voice-row small { display: block; }.voice-row strong { font-size: 10px; }.voice-row small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.switch { width: 42px; height: 24px; flex: 0 0 42px; border-radius: 999px; padding: 3px; background: #c9d0cc; transition: .2s; }
.switch span { display: block; width: 18px; height: 18px; border-radius: 50%; background: white; box-shadow: 0 2px 6px rgba(0,0,0,.15); transition: .2s; }
.switch.on { background: var(--green); }.switch.on span { transform: translateX(18px); }
.memory-heading { display: flex; align-items: center; justify-content: space-between; }
.memory-heading .count { margin: 0; }
.memory-preview-list { max-height: 180px; overflow-y: auto; margin: 8px 0; }
.saved-item { display: flex; align-items: flex-start; gap: 7px; margin: 6px 0; border-bottom: 1px solid var(--line); padding: 7px 0; font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.saved-item:last-child { border-bottom: 0; }
.saved-item .item-text { min-width: 0; flex: 1; }.saved-item small { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; }
.saved-item button { padding: 3px; background: transparent; color: #b35438; font-size: 8px; font-weight: 800; }
.saved-item.due { color: #26663d; }
.outline-button { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 9px; background: #f7f8f4; color: #4b5d56; font-size: 9px; font-weight: 800; }
.safety-card span { display: inline-block; margin: 8px 4px 0 0; border-radius: 8px; padding: 5px 6px; background: #f0f2ed; color: #5f6e68; font-size: 7px; font-weight: 850; }

.panel { width: min(520px, calc(100% - 28px)); max-height: 88dvh; overflow: hidden; border: 1px solid var(--line); border-radius: 22px; padding: 0; background: #fbfaf6; color: var(--ink); box-shadow: 0 28px 100px rgba(26,48,40,.3); }
.panel::backdrop { background: rgba(13,26,22,.3); backdrop-filter: blur(5px); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 20px 22px 14px; }
.panel-head h2 { margin: 0; font-family: Georgia, serif; font-size: 26px; font-weight: 400; }
.panel-body { max-height: calc(88dvh - 82px); overflow-y: auto; padding: 18px 22px 24px; }
.panel label { display: block; margin: 14px 0 6px; font-size: 10px; font-weight: 800; }
.panel .primary { width: 100%; margin: 15px 0 8px; }
.panel hr { margin: 21px 0; border: 0; border-top: 1px solid var(--line); }
.panel h3 { font-size: 12px; }.checkbox { display: flex !important; align-items: center; gap: 8px; font-weight: 500 !important; }.checkbox input { width: auto; }
.close { background: transparent; color: var(--muted); font-size: 24px; line-height: 1; }
.danger { padding: 8px 0; background: transparent; color: #b64e40; font-size: 9px; font-weight: 800; }
.toast { position: fixed; z-index: 80; bottom: 20px; left: 50%; max-width: 90%; transform: translateX(-50%); border: 1px solid rgba(34,65,55,.15); border-radius: 12px; padding: 10px 15px; background: #263a34; color: white; box-shadow: 0 10px 35px rgba(25,47,40,.25); font-size: 10px; }
#mobile-history { display: none; }
.mobile-action-label { display: none; }

@keyframes orbit { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes float { 50% { transform: translateY(-12px); opacity: .45; } }
@keyframes avatarFloat { 50% { transform: translate(-50%, calc(-50% - 8px)); } }
@keyframes talk { to { height: 8px; transform: translateY(3px); } }
@keyframes voiceRing { from { opacity: .55; transform: scale(.9); } to { opacity: 0; transform: scale(1.55); } }

@media (max-width: 1100px) {
  .app { grid-template-columns: 205px minmax(0,1fr); }
  .right { position: fixed; z-index: 40; top: 0; right: 0; width: min(318px, 92vw); transform: translateX(105%); box-shadow: -18px 0 50px rgba(30,55,46,.15); transition: transform .25s; }
  .right.open { transform: translateX(0); }
  .mobile-close { display: block; }
  .avatar-wrap { left: 34%; }
  .speech-card { right: 24px; width: min(370px, 46%); }
}

@media (max-width: 900px) and (min-width: 721px) {
  .avatar-wrap { left: 29%; scale: .86; }
  .speech-card { right: 18px; width: min(330px, 49%); }
}

@media (max-width: 720px) {
  body { overflow: auto; }
  .app { grid-template-columns: 1fr; grid-template-rows: 58px minmax(0,1fr); height: 100dvh; }
  .left { grid-row: 1; height: 58px; flex-direction: row; align-items: center; gap: 8px; padding: 9px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .left .brand span:last-child, .online, .section-label, .conversation-list, .tiny-card, .profile, .nav button:not(#new-chat):not(#settings-button):not(#reminders-button) { display: none; }
  .left .brand-mark { width: 32px; height: 32px; }
  .left .nav { flex: 1; flex-direction: row; justify-content: flex-end; }
  .left .nav button { width: 55px; height: 44px; flex-direction: column; justify-content: center; gap: 1px; padding: 0; }
  .left .nav button > span:not(.nav-icon):not(.count):not(.mobile-action-label) { display: none; }
  .left .nav-icon { width: auto; line-height: 1; }
  .left .nav .mobile-action-label { display: block; font-size: 7px; line-height: 1; }
  #reminders-button { position: relative; }
  .left #reminder-count { position: absolute; top: 1px; right: 1px; margin: 0; }
  .stage { grid-row: 2; height: calc(100dvh - 58px); }
  .topbar { min-height: 58px; padding: 9px 12px; }
  .current-title { max-width: 120px; }
  .pill { min-height: 33px; padding: 6px 9px; }
  #memory-button { display: none; }
  #mobile-history { position: absolute; z-index: 13; top: 58px; left: 12px; display: block; width: calc(100% - 24px); border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; background: rgba(255,255,255,.86); color: var(--muted); font-size: 9px; }
  .companion-space { top: 90px; right: 0; bottom: var(--composer-height, 132px); left: 0; }
  .avatar-wrap { top: 35%; left: 50%; width: 155px; height: 195px; scale: .78; }
  .speech-card { top: auto; right: 13px; bottom: 8px; left: 13px; width: auto; max-height: 42%; border-radius: 17px; padding: 12px 13px; }
  .empty-chat h1 { font-size: 18px; }
  .bubble { max-width: 96%; font-size: 11px; }
  .moodline { display: none; }
  .quickies { justify-content: flex-start; padding-right: 28px; }
  .composer-shell { padding-right: 9px; padding-bottom: max(14px, env(safe-area-inset-bottom)); padding-left: 9px; }
  .control-dock { gap: 6px; }
  .dock-button { width: 40px; height: 40px; flex-basis: 40px; border-radius: 13px; }
  .dock-mic { width: 54px; height: 54px; flex-basis: 54px; }
  .dock-text-field { height: 47px; }
  .composer-shell.text-open .dock-text-field { width: auto; flex: 1; padding-left: 10px; }
  .composer-meta span:last-child { display: none; }
  .right { top: 58px; height: calc(100dvh - 58px); }
  .stage.chat-open .companion-space { top: 90px; right: 0; bottom: var(--composer-height, 80px); left: 0; }
  .stage.chat-open .speech-card {
    inset: 0;
    width: auto;
    max-height: none;
    border-radius: 0;
    padding: 0 14px 22px;
  }
  .stage.chat-open .chat-mode-head { top: 0; margin-bottom: 14px; padding: 11px 0; }
  .stage.chat-open .empty-chat { margin-top: 18vh; }
  .stage.chat-open .bubble { max-width: 100%; font-size: 13px; }
  .stage.chat-open .bubble.user { max-width: 88%; }
  .stage.chat-open .composer-shell { padding-top: 7px; }
  .stage.chat-open .control-dock { width: 100%; }
}

@media (max-height: 680px) and (min-width: 721px) {
  .companion-space { bottom: 112px; }
  .avatar-wrap { transform: translate(-50%, -50%) scale(.82); }
  .speech-card { max-height: 54%; }
  .quickies { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
