:root {
  --foman: #04a8cb;
  --foman-deep: #017489;
  --ink: #102f39;
  --muted: #647a82;
  --line: #dcebed;
  --ice: #edf9fb;
  --white: #ffffff;
  --sun: #ffcf4a;
  --shadow: 0 24px 70px rgba(1, 74, 89, 0.14);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --foman: #35c7e4;
  --foman-deep: #54d3ea;
  --ink: #eaf8fa;
  --muted: #9eb6bd;
  --line: #294c56;
  --ice: #153a44;
  --white: #102b33;
  --shadow: 0 24px 70px rgba(0, 0, 0, .38);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: #eaf6f8; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  background:
    linear-gradient(145deg, rgba(255,255,255,.9), rgba(231,247,250,.9)),
    radial-gradient(circle at 5% 10%, rgba(4,168,203,.2), transparent 28%);
  overflow-x: hidden;
}

button, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

body, .workspace, .chat-panel, .header-button, .quick-topics button,
.bubble, .article-card, .followup-buttons button, .scope-symbol,
.thinking-emblem, .composer, .brand-name small, .message-meta,
.composer-note, .site-footer {
  transition: color .22s ease, background-color .22s ease, border-color .22s ease, box-shadow .22s ease;
}

.ambient {
  position: fixed;
  border-radius: 50%;
  filter: blur(2px);
  pointer-events: none;
}

.ambient-one {
  width: 22rem;
  height: 22rem;
  right: -8rem;
  top: -10rem;
  background: rgba(4, 168, 203, .12);
}

.ambient-two {
  width: 14rem;
  height: 14rem;
  left: -7rem;
  bottom: -3rem;
  background: rgba(255, 207, 74, .16);
}

.app-shell {
  width: min(1380px, calc(100% - 36px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 0 28px;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 58px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
}

.brand {
  width: max-content;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--foman-deep);
  text-decoration: none;
  font-family: "Manrope", sans-serif;
  font-weight: 800;
}

.brand-logo { width: 46px; height: 46px; object-fit: contain; filter: drop-shadow(0 6px 10px rgba(1,116,137,.16)); }
.brand-name { display: flex; flex-direction: column; line-height: 1; }
.brand-name strong { font-size: 1.02rem; letter-spacing: .1em; }
.brand-name small { margin-top: 4px; color: #70858b; font: 700 .61rem/1 "DM Sans", sans-serif; letter-spacing: .07em; text-transform: uppercase; }

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 600;
}

.status-pill span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--foman);
  box-shadow: 0 0 0 5px rgba(4,168,203,.12);
}

.topbar-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-button {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.65);
  color: var(--foman-deep);
  cursor: pointer;
  font-weight: 700;
}

.header-button:hover { background: white; }
.header-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle {
  width: 42px;
  height: 42px;
  min-width: 42px;
  justify-content: center;
  padding: 0;
  border-radius: 50%;
}
.theme-toggle svg { width: 19px; height: 19px; }
.theme-toggle .sun-icon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun-icon { display: block; }
:root[data-theme="dark"] .theme-toggle .moon-icon { display: none; }

.workspace {
  flex: 1;
  min-height: 720px;
  margin-top: 16px;
  display: grid;
  grid-template-columns: minmax(300px, .76fr) minmax(560px, 1.55fr);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.85);
  border-radius: 30px;
  background: rgba(255,255,255,.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.companion-panel {
  position: relative;
  overflow: hidden;
  padding: 38px clamp(26px, 3vw, 48px) 34px;
  background:
    radial-gradient(circle at 50% 25%, rgba(255,255,255,.34), transparent 31%),
    linear-gradient(155deg, #04a8cb 0%, #01839b 54%, #01677c 100%);
  color: white;
  display: flex;
  flex-direction: column;
}

.companion-panel::before {
  content: "";
  position: absolute;
  inset: 22px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 24px;
  pointer-events: none;
}

.halo {
  position: absolute;
  width: 310px;
  height: 310px;
  top: 54px;
  left: 50%;
  translate: -50% 0;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.25);
  box-shadow: 0 0 0 34px rgba(255,255,255,.04), 0 0 0 68px rgba(255,255,255,.025);
}

.mascot-wrap {
  position: relative;
  height: 330px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1;
}

.mascot-thought {
  position: absolute;
  z-index: 3;
  top: 42px;
  right: 7%;
  width: 58px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--foman-deep);
  background: white;
  box-shadow: 0 12px 24px rgba(0,70,84,.18);
  font: 800 1.4rem/1 "Manrope", sans-serif;
  opacity: 0;
  transform: translateY(9px) scale(.7);
  transition: opacity .25s ease, transform .25s ease;
}

.mascot-thought i {
  position: absolute;
  width: 10px;
  height: 10px;
  left: -10px;
  bottom: 2px;
  border-radius: 50%;
  background: rgba(255,255,255,.92);
}

.mascot-thought i:nth-child(2) { width: 6px; height: 6px; left: -20px; bottom: -5px; }
.mascot-wrap[data-state="thinking"] .mascot-thought,
.mascot-wrap[data-state="writing"] .mascot-thought { opacity: 1; transform: translateY(0) scale(1); }
.mascot-wrap[data-state="thinking"] img { animation: mascot-think 1.35s ease-in-out infinite; }
.mascot-wrap[data-state="writing"] img { animation: mascot-write .72s ease-in-out infinite; }
.mascot-wrap[data-state="writing"] .mascot-thought span { font-size: 0; }
.mascot-wrap[data-state="writing"] .mascot-thought span::after { content: "✦"; font-size: 1.25rem; color: #f1b900; }

@keyframes mascot-think {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-9px) rotate(2deg); }
}

@keyframes mascot-write {
  0%, 100% { transform: translateY(-2px) rotate(-.7deg) scale(1); }
  50% { transform: translateY(-6px) rotate(.9deg) scale(1.012); }
}

.mascot-wrap img {
  width: min(330px, 93%);
  max-height: 360px;
  object-fit: contain;
  filter: drop-shadow(0 22px 19px rgba(0,65,79,.26));
  transform-origin: bottom center;
  animation: hello 4.8s ease-in-out infinite;
}

@keyframes hello { 0%, 100% { transform: translateY(0) rotate(-.3deg); } 50% { transform: translateY(-7px) rotate(.5deg); } }

.companion-copy { position: relative; z-index: 2; margin-top: 6px; }
.eyebrow { margin: 0 0 8px; font-size: .73rem; font-weight: 800; letter-spacing: .16em; opacity: .78; }
.companion-copy h1 { margin: 0 0 12px; font: 800 clamp(2rem, 3vw, 3rem)/1.02 "Manrope", sans-serif; letter-spacing: -.045em; }
.companion-copy h1 span { color: var(--sun); }
.companion-copy > p:last-child { max-width: 34rem; margin: 0; font-size: 1rem; line-height: 1.65; color: rgba(255,255,255,.9); }

.principle-card {
  position: relative;
  z-index: 2;
  margin-top: auto;
  padding: 16px;
  display: flex;
  gap: 12px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 18px;
  background: rgba(0,73,87,.28);
}

.principle-card svg { flex: 0 0 auto; width: 26px; fill: none; stroke: var(--sun); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.principle-card p { margin: 0; font-size: .88rem; line-height: 1.5; color: rgba(255,255,255,.82); }
.principle-card strong { color: white; }

.chat-panel {
  min-width: 0;
  padding: 38px clamp(25px, 4vw, 58px) 24px;
  display: flex;
  flex-direction: column;
  background: rgba(255,255,255,.88);
}

.chat-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.chat-heading .eyebrow { color: var(--foman-deep); }
.chat-heading h2 { margin: 0; font: 800 clamp(1.65rem, 2.5vw, 2.25rem)/1.1 "Manrope", sans-serif; letter-spacing: -.04em; }
.resource-links { display: flex; align-items: center; gap: 14px; margin-top: 15px; }
.chat-heading a { color: var(--foman-deep); font-size: .88rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.chat-heading a:hover { text-decoration: underline; }

.quick-topics {
  display: flex;
  gap: 8px;
  margin: 23px 0 18px;
  padding-bottom: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.quick-topics button {
  flex: 0 0 auto;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: #3f616b;
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  transition: .18s ease;
}

.quick-topics button:hover, .quick-topics button:focus-visible { color: var(--foman-deep); border-color: #86d2df; background: var(--ice); transform: translateY(-1px); }

.messages {
  flex: 1;
  min-height: 300px;
  max-height: 500px;
  overflow-y: auto;
  padding: 18px 8px 24px 0;
  border-top: 1px solid #edf3f4;
  scroll-behavior: smooth;
}

.message-row { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 22px; animation: appear .3s ease both; }
@keyframes appear { from { opacity: 0; transform: translateY(8px); } }
.message-content { max-width: min(690px, 88%); }
.avatar, .user-avatar { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 13px; }
.avatar { overflow: hidden; background: linear-gradient(145deg, #dff7fb, #bcebf3); box-shadow: inset 0 0 0 1px rgba(4,168,203,.16); }
.avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; transform: scale(1.35); }
.user-avatar { display: grid; place-items: center; background: #e6eef0; color: #587078; font-size: .63rem; font-weight: 800; }
.message-meta { display: flex; align-items: center; gap: 8px; margin: 0 5px 6px; color: #8a9ba0; font-size: .72rem; }
.message-meta strong { color: var(--foman-deep); font-size: .74rem; letter-spacing: .06em; }
.bubble { padding: 15px 17px; border-radius: 8px 19px 19px 19px; background: var(--ice); border: 1px solid #d9eef2; font-size: .95rem; line-height: 1.58; }
.bubble p { margin: 0 0 10px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 8px 0 0; padding-left: 20px; }
.bubble li + li { margin-top: 5px; }
.bubble strong { color: #0b5969; }

.user-message { justify-content: flex-end; }
.user-message .message-content { display: flex; flex-direction: column; align-items: flex-end; }
.user-message .message-meta { justify-content: flex-end; }
.user-message .message-meta strong { color: #536971; }
.user-message .bubble { color: white; background: var(--foman-deep); border: 0; border-radius: 19px 8px 19px 19px; }

.guide-label { display: flex; align-items: center; gap: 7px; color: var(--foman-deep); font-weight: 800; font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; }
.guide-label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--sun); }
.warm-opening { display: flex; align-items: flex-start; gap: 8px; color: #315762; font-size: 1rem; }
.warm-opening span { flex: 0 0 auto; color: var(--foman-deep); }
.guiding-question { margin-top: 15px !important; padding: 12px 13px; border-left: 3px solid var(--sun); border-radius: 0 10px 10px 0; background: rgba(255,207,74,.11); }

.article-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 14px;
  padding: 13px 14px;
  color: inherit;
  text-decoration: none;
  border: 1px solid #bfe3e9;
  border-radius: 13px;
  background: white;
  transition: .18s ease;
}

.article-card:hover { border-color: var(--foman); box-shadow: 0 8px 20px rgba(1,116,137,.09); transform: translateY(-1px); }
.article-card small { display: block; margin-bottom: 3px; color: var(--foman-deep); font-weight: 800; letter-spacing: .07em; }
.article-card strong { display: block; color: var(--ink); line-height: 1.35; }
.article-card span { align-self: center; width: 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; color: white; background: var(--foman-deep); font-size: 1rem; }
.article-card p { margin: 5px 0 0; color: #6e838a; font-size: .8rem; line-height: 1.38; }
.article-card.secondary { margin-top: 8px; background: rgba(255,255,255,.7); }
.recommendation-copy { margin-top: 16px !important; color: #4d6870; font-size: .88rem; }
.resource-stack { margin-top: 4px; }

.followup-buttons { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.followup-buttons button { padding: 8px 10px; border: 1px solid #c9e5ea; border-radius: 999px; color: var(--foman-deep); background: white; cursor: pointer; font-size: .8rem; font-weight: 700; }
.followup-buttons button:hover { background: #e5f7fa; }
.followup-buttons button:disabled, .quick-topics button:disabled { opacity: .48; cursor: default; transform: none; }

.scope-response { padding: 2px 0; }
.scope-response p { color: #48656d; }
.scope-symbol {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  margin-bottom: 11px;
  border: 1px solid #bfe3e9;
  border-radius: 13px;
  color: var(--foman-deep);
  background: white;
  box-shadow: 0 6px 16px rgba(1,116,137,.08);
  font-size: 1rem;
  font-weight: 900;
}
.social-response .scope-symbol { color: #b16c00; background: #fff9e8; border-color: #f1d893; }
.scope-invitation { margin-top: 14px !important; color: #70868c !important; font-size: .84rem; }
.scope-buttons { margin-top: 9px; }
.out-of-scope-response { padding-left: 13px; border-left: 3px solid var(--sun); }

.thinking-message .avatar {
  animation: thinking-avatar 1.45s ease-in-out infinite;
  box-shadow: 0 0 0 5px rgba(4,168,203,.1), inset 0 0 0 1px rgba(4,168,203,.16);
}

@keyframes thinking-avatar {
  0%, 100% { transform: rotate(-2deg) translateY(0); }
  50% { transform: rotate(3deg) translateY(-2px); }
}

.thinking-state {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 13px;
}

.thinking-emblem {
  position: relative;
  flex: 0 0 auto;
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--foman-deep);
  background: white;
  box-shadow: 0 8px 18px rgba(1,116,137,.1);
}

.thinking-emblem svg {
  width: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  animation: idea-glow 1.15s ease-in-out infinite;
}

.thinking-emblem i {
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--sun);
  box-shadow: 0 0 0 3px rgba(255,207,74,.18);
  animation: thought-orbit 1.4s ease-in-out infinite;
}

.thinking-emblem i:nth-of-type(1) { top: -3px; right: 3px; }
.thinking-emblem i:nth-of-type(2) { top: 5px; right: -8px; animation-delay: .16s; }
.thinking-emblem i:nth-of-type(3) { top: 17px; right: -11px; animation-delay: .32s; }

@keyframes idea-glow {
  0%, 100% { transform: scale(.94); opacity: .66; }
  50% { transform: scale(1.06); opacity: 1; }
}

@keyframes thought-orbit {
  0%, 100% { transform: translateY(2px) scale(.72); opacity: .36; }
  50% { transform: translateY(-2px) scale(1); opacity: 1; }
}

.thinking-copy { display: flex; flex-direction: column; gap: 2px; }
.thinking-copy strong { color: var(--foman-deep); font-size: .91rem; }
.thinking-copy small { color: #789096; font-size: .76rem; line-height: 1.35; }

.response-bubble.is-streaming::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 3px;
  vertical-align: -.15em;
  border-radius: 2px;
  background: var(--foman);
  animation: writing-cursor .75s steps(1) infinite;
}

@keyframes writing-cursor { 50% { opacity: 0; } }

.skip-response {
  margin: 7px 3px 0;
  padding: 5px 8px;
  border: 0;
  border-radius: 8px;
  color: #71868c;
  background: transparent;
  font-size: .73rem;
  font-weight: 700;
  cursor: pointer;
}

.skip-response:hover { color: var(--foman-deep); background: var(--ice); }

.typing { display: flex; gap: 5px; padding: 15px 17px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: #5bbfd2; animation: typing 1s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .13s; }
.typing span:nth-child(3) { animation-delay: .26s; }
@keyframes typing { 0%, 70%, 100% { transform: translateY(0); opacity: .45; } 35% { transform: translateY(-4px); opacity: 1; } }

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 12px;
  padding: 8px 8px 8px 18px;
  border: 1px solid #cfe3e7;
  border-radius: 19px;
  background: white;
  box-shadow: 0 9px 28px rgba(16,47,57,.08);
}

.composer:focus-within { border-color: var(--foman); box-shadow: 0 0 0 4px rgba(4,168,203,.1), 0 9px 28px rgba(16,47,57,.08); }
.composer textarea { width: 100%; max-height: 120px; padding: 10px 0; resize: none; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 1rem; line-height: 1.45; }
.composer textarea::placeholder { color: #91a2a7; }
.composer button { width: 46px; height: 46px; display: grid; place-items: center; border: 0; border-radius: 14px; color: white; background: linear-gradient(145deg, var(--foman), var(--foman-deep)); cursor: pointer; box-shadow: 0 7px 16px rgba(1,116,137,.22); }
.composer button:hover { filter: brightness(1.05); }
.composer button:disabled { opacity: .45; cursor: default; }
.composer button svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.composer-note { margin: 9px 5px 0; color: #88999e; font-size: .73rem; text-align: center; }

.site-footer {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 14px 18px 0;
  color: #6f858b;
  font-size: .76rem;
  text-align: center;
}

.site-footer img { width: 29px; height: 29px; object-fit: contain; }
.site-footer p { margin: 0; }
.site-footer a { color: var(--foman-deep); font-weight: 800; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

:root[data-theme="dark"],
:root[data-theme="dark"] body {
  background: #081b21;
}

:root[data-theme="dark"] body {
  background:
    linear-gradient(145deg, rgba(8,27,33,.98), rgba(11,38,46,.96)),
    radial-gradient(circle at 5% 10%, rgba(53,199,228,.16), transparent 28%);
}

:root[data-theme="dark"] .ambient-one { background: rgba(53,199,228,.09); }
:root[data-theme="dark"] .ambient-two { background: rgba(255,207,74,.08); }
:root[data-theme="dark"] .brand-name small { color: #8ca7ae; }
:root[data-theme="dark"] .header-button { background: rgba(16,43,51,.72); }
:root[data-theme="dark"] .header-button:hover { background: #173e48; }
:root[data-theme="dark"] .workspace { border-color: rgba(90,181,198,.14); background: rgba(12,36,43,.82); }
:root[data-theme="dark"] .companion-panel {
  background:
    radial-gradient(circle at 50% 25%, rgba(117,224,242,.12), transparent 31%),
    linear-gradient(155deg, #087f98 0%, #075f73 54%, #064654 100%);
}
:root[data-theme="dark"] .chat-panel { background: rgba(12,34,41,.94); }
:root[data-theme="dark"] .quick-topics button,
:root[data-theme="dark"] .article-card,
:root[data-theme="dark"] .followup-buttons button,
:root[data-theme="dark"] .scope-symbol,
:root[data-theme="dark"] .thinking-emblem,
:root[data-theme="dark"] .composer { background: #102b33; }
:root[data-theme="dark"] .quick-topics button { color: #c1d9de; }
:root[data-theme="dark"] .quick-topics button:hover,
:root[data-theme="dark"] .quick-topics button:focus-visible,
:root[data-theme="dark"] .followup-buttons button:hover,
:root[data-theme="dark"] .skip-response:hover { background: #19424c; }
:root[data-theme="dark"] .messages { border-top-color: #24434b; }
:root[data-theme="dark"] .avatar { background: linear-gradient(145deg, #174753, #1d5b68); }
:root[data-theme="dark"] .user-avatar { background: #29464e; color: #c0d4d8; }
:root[data-theme="dark"] .message-meta { color: #8ca5ab; }
:root[data-theme="dark"] .user-message .message-meta strong { color: #bad0d5; }
:root[data-theme="dark"] .bubble { border-color: #24505b; }
:root[data-theme="dark"] .bubble strong { color: #8ee4f2; }
:root[data-theme="dark"] .user-message .bubble { color: #fff; background: #087f98; }
:root[data-theme="dark"] .warm-opening,
:root[data-theme="dark"] .scope-response p { color: #c4d9dd; }
:root[data-theme="dark"] .article-card { border-color: #2a5661; }
:root[data-theme="dark"] .article-card.secondary { background: rgba(16,43,51,.82); }
:root[data-theme="dark"] .article-card p,
:root[data-theme="dark"] .recommendation-copy { color: #a8bec3; }
:root[data-theme="dark"] .followup-buttons button { border-color: #32616b; }
:root[data-theme="dark"] .social-response .scope-symbol { color: #ffd56a; background: #3b321d; border-color: #6f5b27; }
:root[data-theme="dark"] .scope-invitation,
:root[data-theme="dark"] .thinking-copy small,
:root[data-theme="dark"] .skip-response,
:root[data-theme="dark"] .composer-note,
:root[data-theme="dark"] .site-footer { color: #91aab0 !important; }
:root[data-theme="dark"] .composer textarea::placeholder { color: #78939a; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid rgba(4,168,203,.35); outline-offset: 2px; }

@media (max-width: 950px) {
  .app-shell { width: min(100% - 22px, 760px); padding-top: 10px; }
  .workspace { grid-template-columns: 1fr; min-height: auto; }
  .companion-panel { min-height: 245px; display: grid; grid-template-columns: 190px 1fr; align-items: center; gap: 16px; padding: 22px 28px; }
  .mascot-wrap { height: 215px; }
  .mascot-wrap img { width: 205px; max-height: 235px; }
  .halo { width: 190px; height: 190px; top: 28px; left: 116px; }
  .mascot-thought { top: 18px; right: 2%; transform-origin: bottom left; }
  .companion-copy { margin: 0; }
  .companion-copy h1 { font-size: 2rem; }
  .principle-card { display: none; }
  .chat-panel { min-height: 610px; padding: 28px; }
  .messages { max-height: 430px; }
}

@media (max-width: 620px) {
  .app-shell { width: 100%; padding: 0; }
  .topbar { min-height: 62px; padding: 0 16px; grid-template-columns: 1fr auto; }
  .status-pill { display: none; }
  .header-button span { display: none; }
  .header-button { min-width: 0; padding: 9px; }
  .workspace { margin: 0; border: 0; border-radius: 0; }
  .companion-panel { min-height: 188px; grid-template-columns: 125px 1fr; padding: 18px 20px; }
  .companion-panel::before { inset: 10px; }
  .mascot-wrap { height: 164px; align-self: end; }
  .mascot-wrap img { width: 160px; max-height: 177px; }
  .halo { width: 145px; height: 145px; left: 72px; top: 23px; }
  .mascot-thought { width: 46px; height: 39px; top: 17px; right: 0; font-size: 1.05rem; }
  .mascot-thought i { width: 8px; height: 8px; left: -8px; }
  .mascot-thought i:nth-child(2) { width: 5px; height: 5px; left: -15px; }
  .companion-copy h1 { font-size: 1.55rem; margin-bottom: 8px; }
  .companion-copy > p:last-child { font-size: .86rem; line-height: 1.45; }
  .companion-copy .eyebrow { font-size: .62rem; }
  .chat-panel { min-height: calc(100vh - 250px); padding: 24px 15px 16px; }
  .chat-heading h2 { font-size: 1.52rem; }
  .chat-heading a { font-size: .78rem; }
  .quick-topics { margin: 18px 0 11px; }
  .messages { max-height: none; min-height: 330px; padding-right: 2px; }
  .message-content { max-width: calc(100% - 49px); }
  .bubble { font-size: .91rem; }
  .composer { position: sticky; bottom: 7px; }
}

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