:root {
  /* Light: neutral, like ChatGPT. The only colour on the page is HoodBot. */
  --bg: #ffffff;
  --bg-2: #f4f4f4;
  --surface: #ffffff;
  --composer: #ffffff;
  --line: #e8e8e8;
  --line-2: #d9d9d9;
  --ink: #0d0d0d;
  --ink-2: #5d5d5d;
  --ink-3: #8f8f8f;
  --lime: #ccff00;
  --hot: #ff5c1f;
  --accent: var(--lime);
  --btn: #0d0d0d;
  --btn-ink: #ffffff;
  --btn-2: #f2f2f2;
  --btn-2-ink: #0d0d0d;
  --user-bubble: #f4f4f4;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-2: 0 0 0 1px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.08);
  --ground: rgba(0, 0, 0, 0);

  --top: 64px;
  --mascot-x: 50vw;
  --dock-h: 260px;
  --radius: 28px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-move: cubic-bezier(0.16, 1, 0.3, 1);
  --font: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
/* Dark: near-black, like x.ai */
:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-2: #171717;
  --surface: #171717;
  --composer: #262626;
  --line: #262626;
  --line-2: #333333;
  --ink: #fafafa;
  --ink-2: #9a9da3;
  --ink-3: #6b6e74;
  --btn: #ffffff;
  --btn-ink: #0a0a0a;
  --btn-2: #212121;
  --btn-2-ink: #ffffff;
  --user-bubble: #262626;
  --shadow-1: none;
  --shadow-2: 0 0 0 1px rgba(255, 255, 255, 0.04);
  color-scheme: dark;
}
body[data-mode="degen"] { --accent: var(--hot); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  --mascot-h: min(calc(100dvh - var(--top) - var(--dock-h) - 20px), 92vw, 620px);
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
  transition: background-color 500ms ease;
}
::selection { background: var(--lime); color: var(--ink); }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Header ---------- */
.top {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--top);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, env(safe-area-inset-right)) 0 max(24px, env(safe-area-inset-left));
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark { width: 30px; height: 30px; border-radius: 50%; }
.top-right { display: flex; align-items: center; gap: 10px; }
.btn-primary, .btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 160ms ease, transform 160ms var(--ease-out), background-color 200ms ease;
}
.btn-primary { padding: 0 16px; background: var(--btn); color: var(--btn-ink); }
.btn-icon { width: 38px; background: var(--btn-2); color: var(--btn-2-ink); font-size: 1.05rem; }
.btn-primary:active, .btn-icon:active { transform: scale(0.96); }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover { opacity: 0.86; }
  .btn-icon:hover { opacity: 0.8; }
}

/* ---------- Mascot ---------- */
.stage { position: fixed; inset: 0; pointer-events: none; z-index: 1; }
.hood {
  position: absolute;
  /* Centered with left, not a transform: the drop animation's squash and stretch then
     scale around the true middle and the character never drifts sideways. */
  left: calc(var(--mascot-x) - var(--mascot-h) * 300 / 570);
  bottom: calc(var(--dock-h) + 4px);
  height: var(--mascot-h);
  width: calc(var(--mascot-h) * 600 / 570);
  overflow: visible;
  display: block;
  transform-origin: 50% 100%;
  opacity: 0;
}
/* The drop starts only once the page has measured itself, so it lands in the right place. */
body.measured .hood { opacity: 1; animation: hood-drop 1150ms both; }
/* Intro: HoodBot drops in, lands with a squash, the hat catches up a beat later */
@keyframes hood-drop {
  0% { translate: 0 -80vh; scale: 0.92 1.1; opacity: 0; animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  10% { opacity: 1; }
  42% { translate: 0 0; scale: 1.16 0.82; animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1); }
  60% { translate: 0 -5%; scale: 0.95 1.07; animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  74% { translate: 0 0; scale: 1.05 0.95; animation-timing-function: ease-out; }
  88% { scale: 0.99 1.01; }
  100% { translate: 0 0; scale: 1 1; opacity: 1; }
}
body.measured .hood .hat-base { animation: hat-lag 1150ms both; }
@keyframes hat-lag {
  0% { translate: 0 -30px; }
  42% { translate: 0 -64px; animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  62% { translate: 0 10px; animation-timing-function: ease-out; }
  78% { translate: 0 -5px; }
  100% { translate: 0 0; }
}
.top { animation: fade-up 700ms var(--ease-out) 150ms both; }
.hero-copy { animation: fade-up 700ms var(--ease-out) 650ms both; }
.composer { animation: fade-up 700ms var(--ease-out) 760ms both; }
.chips { animation: fade-up 700ms var(--ease-out) 860ms both; }
.fineprint { animation: fade-up 700ms var(--ease-out) 960ms both; }
@keyframes fade-up {
  from { opacity: 0; translate: 0 12px; }
  to { opacity: 1; translate: 0 0; }
}


body.ready .hood { transition: left 800ms var(--ease-move), bottom 800ms var(--ease-move), height 800ms var(--ease-move); }

.hood .rig {
  transform-box: view-box;
  transform-origin: 300px 566px;
  animation: breathe 4.2s ease-in-out infinite;
  transition: transform 500ms var(--ease-out);
}
@keyframes breathe {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(1.012, 0.988); }
}
.hood .feather { transform-box: fill-box; transform-origin: 8% 96%; animation: sway 3.6s ease-in-out infinite; }
@keyframes sway {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(4deg); }
}
.hood .feather-fill { transition: fill 300ms ease; }
.hood .eye-inner { transform-box: fill-box; transform-origin: 50% 50%; transition: transform 220ms var(--ease-out); }
.hood .glint { transition: fill 300ms ease, transform 220ms var(--ease-out); transform-box: fill-box; transform-origin: center; }
.hood .blush { transition: opacity 300ms ease; }
.hood .brows { opacity: 0; transform: translateY(-14px); transition: opacity 250ms ease, transform 300ms var(--ease-out); }
.hood.blink .eye-inner { animation: blink 150ms ease-in-out; }
@keyframes blink {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.08); }
}
.hood.mood-unimpressed .eye-inner { transform: scaleY(0.55); transform-origin: 50% 100%; }
.hood.mood-happy .eye-inner { transform: scaleY(0.32); }
.hood.mood-happy .blush { opacity: 1; }
.hood.mood-stare .eye-inner { transform: scale(1.08); }
.hood.mood-stare .glint { transform: scale(1.25); }
.hood.is-staring .rig { animation: none; transform: scale(1.035); }
.hood.is-thinking #hat .hat-base { animation: ponder 1.4s ease-in-out infinite; }
@keyframes ponder {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -6px; }
}
.hood.is-talking .rig { animation: talk 280ms ease-in-out infinite alternate; }
@keyframes talk {
  from { transform: scale(1.02, 0.985) translateY(0); }
  to { transform: scale(0.995, 1.01) translateY(-6px); }
}
body[data-mode="degen"] .hood .feather-fill { fill: var(--hot); }
body[data-mode="degen"] .hood .glint { fill: var(--hot); }
body[data-mode="degen"] .hood .brows { opacity: 1; transform: none; }


/* ---------- Speech bubble next to HoodBot ---------- */
.quip {
  position: fixed;
  left: 0; top: 0;
  z-index: 6;
  max-width: min(320px, calc(100vw - 24px));
  text-wrap: balance;
  padding: 10px 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-2);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
  color: var(--ink);
  pointer-events: none;
  opacity: 0;
  scale: 0.85;
  transform-origin: 0% 100%;
  transition: opacity 160ms ease, scale 160ms var(--ease-out);
}
.quip[data-side="left"] { transform-origin: 100% 100%; }
.quip.is-on {
  opacity: 1;
  scale: 1;
  transition: opacity 180ms ease, scale 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.quip::after {
  content: "";
  position: absolute;
  bottom: -6px;
  left: 20px;
  width: 11px; height: 11px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-bottom-right-radius: 3px;
  rotate: 45deg;
}
.quip[data-side="left"]::after { left: auto; right: 20px; }
.quip[data-side="top"] { transform-origin: 50% 100%; }
.quip[data-side="top"]::after { left: calc(50% - 6px); }
@media (prefers-reduced-motion: reduce) {
  .quip, .quip.is-on { scale: 1; transition: opacity 160ms ease; }
}

/* the drawn parts of HoodBot can be poked */
.hood #rig { pointer-events: visiblePainted; cursor: pointer; }
.hood.poked .rig { animation: poked 360ms var(--ease-out); }
@keyframes poked {
  0% { transform: scale(1, 1); }
  30% { transform: scale(1.06, 0.92); }
  60% { transform: scale(0.97, 1.04); }
  100% { transform: scale(1, 1); }
}


/* ---------- Token block ---------- */
.token { display: none; }
.token.is-on { display: flex; align-items: center; gap: 6px; }
.token-top.is-on {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.token-dock.is-on { display: none; }
.token-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 6px 0 14px;
  border-radius: 999px;
  background: var(--btn-2);
  color: var(--ink);
  font-size: 0.875rem;
  max-width: 100%;
}
.token-pill .t-label { color: var(--ink-2); font-weight: 500; }
.token-pill .t-ca {
  font-family: var(--mono);
  font-size: 0.8125rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.token-pill .t-soon { color: var(--ink-2); padding-right: 8px; }
.token-copy {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: var(--btn);
  color: var(--btn-ink);
  font-size: 0.75rem;
  font-weight: 500;
  transition: transform 160ms var(--ease-out), opacity 160ms ease;
}
.token-copy:active { transform: scale(0.95); }
.token-link {
  display: inline-grid; place-items: center;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--btn-2);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 160ms ease;
}
@media (hover: hover) and (pointer: fine) {
  .token-copy:hover, .token-link:hover { opacity: 0.85; }
}
@media (max-width: 860px) {
  .token-top.is-on { display: none; }
  .token-dock.is-on { display: flex; justify-content: center; margin-top: 12px; }
  body.has-chat .token-dock.is-on { display: none; }
}

/* ---------- Roast me ---------- */
.roast-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
}
.roast-btn i { color: var(--hot); font-size: 0.95rem; }
.roast-btn:active { transform: scale(0.96); }
.roast-btn:disabled { opacity: 0.4; cursor: default; }
@media (hover: hover) and (pointer: fine) {
  .roast-btn:hover { background: var(--btn-2); color: var(--ink); }
}
@media (max-width: 560px) {
  .roast-btn span { display: none; }
  .roast-btn { padding: 0 9px; }
}
.btn-icon[aria-pressed="true"] { background: var(--btn); color: var(--btn-ink); }

/* ---------- Sleep, sweat, emotions, cheat code ---------- */
.hood .zzz { opacity: 0; pointer-events: none; }
.hood .zzz text { fill: var(--ink); font-family: var(--font); font-weight: 700; }
.hood.is-asleep .zzz { opacity: 1; }
.hood.is-asleep .zzz text { animation: zfloat 2.4s ease-in-out infinite; }
.hood.is-asleep .zzz text:nth-child(2) { animation-delay: 0.4s; }
.hood.is-asleep .zzz text:nth-child(3) { animation-delay: 0.8s; }
@keyframes zfloat {
  0% { opacity: 0; translate: 0 10px; }
  30% { opacity: 1; }
  100% { opacity: 0; translate: -10px -24px; }
}
.hood.is-asleep .eye-inner { transform: scaleY(0.08); }
.hood.is-asleep .rig { animation-duration: 6s; }
.hood.is-startled .rig { animation: startle 520ms var(--ease-out); }
@keyframes startle {
  0% { transform: translateY(0) scale(1); }
  30% { transform: translateY(-34px) scale(0.96, 1.06); }
  60% { transform: translateY(0) scale(1.06, 0.94); }
  100% { transform: translateY(0) scale(1); }
}

.hood .sweat { opacity: 0; transform-box: fill-box; transform-origin: 50% 0%; transition: opacity 200ms ease; }
.hood.emo-scared .sweat { opacity: 1; animation: drip 1.6s ease-in infinite; }
@keyframes drip {
  0% { translate: 0 -6px; }
  70% { translate: 0 10px; opacity: 1; }
  100% { translate: 0 18px; opacity: 0; }
}
.hood.emo-scared .eye-inner { transform: scale(1.15, 1.22); }
.hood.emo-scared .rig { animation: shiver 90ms linear infinite; }
@keyframes shiver {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(3px); }
}

.hood.emo-angry .brows { opacity: 1; transform: none; }
.hood.emo-angry .blush { fill: #ff4d2e; opacity: 0.55; }
.hood.emo-angry .rig { animation: fume 120ms linear 6; }
@keyframes fume {
  0%, 100% { transform: translateX(0) rotate(0); }
  25% { transform: translateX(-4px) rotate(-1deg); }
  75% { transform: translateX(4px) rotate(1deg); }
}

.hood.emo-laugh .eye-inner { transform: scaleY(0.28); }
.hood.emo-laugh .blush { opacity: 1; }
.hood.emo-laugh .rig { animation: giggle 180ms ease-in-out 8 alternate; }
@keyframes giggle {
  from { transform: translateY(0) scale(1, 1); }
  to { transform: translateY(-8px) scale(1.02, 0.98); }
}

/* Konami code: one full spin and a golden feather for the rest of the visit */
.hood.is-spinning .rig { animation: spin 900ms var(--ease-out); }
@keyframes spin {
  0% { transform: rotate(0) scale(1); }
  50% { transform: rotate(200deg) scale(0.9); }
  100% { transform: rotate(360deg) scale(1); }
}
body.cheater .hood .feather-fill { fill: #ffc531; }

@media (prefers-reduced-motion: reduce) {
  .hood.is-asleep .zzz text, .hood.emo-scared .sweat, .hood.emo-scared .rig, .hood.emo-angry .rig,
  .hood.emo-laugh .rig, .hood.is-startled .rig, .hood.is-spinning .rig { animation: none; }
}

/* ---------- Panel ---------- */
.panel {
  position: fixed;
  z-index: 3;
  left: 50%;
  bottom: 0;
  width: min(720px, 100%);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  padding: 0 20px max(16px, env(safe-area-inset-bottom));
}
.thread { display: none; }
.dock { width: 100%; }

.hero-copy { text-align: center; margin-bottom: 26px; }
.hero-copy h1 {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.22em;
  font-size: clamp(2.25rem, 1.4rem + 2.2vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
  font-weight: 500;
}
.h1-logo { width: 1.05em; height: 1.05em; border-radius: 50%; }
.hero-copy p {
  margin: 12px auto 0;
  max-width: 34em;
  color: var(--ink-2);
  font-size: 1.0625rem;
  line-height: 1.5;
  text-wrap: balance;
}
body.has-chat .hero-copy { display: none; }

.composer {
  background: var(--composer);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  padding: 14px 10px 10px 20px;
  transition: box-shadow 200ms ease;
}
.composer textarea {
  display: block;
  width: 100%;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  font-size: 1.0625rem;
  line-height: 1.5;
  padding: 2px 6px 10px 0;
  max-height: 160px;
  caret-color: var(--ink);
}
.composer textarea::placeholder { color: var(--ink-2); }
.composer-bar { display: flex; align-items: center; gap: 8px; margin-left: -6px; }

.model-wrap { position: relative; }
.model-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-2);
  transition: background-color 160ms ease, color 160ms ease;
}
.model-btn i { font-size: 0.75rem; }
.model-btn[aria-expanded="true"] { background: var(--btn-2); color: var(--ink); }
.menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: 270px;
  padding: 6px;
  background: var(--composer);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
  transform-origin: 20% 100%;
  animation: menu-in 180ms var(--ease-out);
  z-index: 20;
}
.menu[hidden] { display: none; }
@keyframes menu-in {
  from { opacity: 0; transform: scale(0.96) translateY(4px); }
  to { opacity: 1; transform: none; }
}
.menu-item {
  display: grid;
  grid-template-columns: 1fr auto;
  width: 100%;
  text-align: left;
  border: 0;
  background: none;
  border-radius: 10px;
  padding: 8px 10px;
  transition: background-color 120ms ease;
}
.menu-item .mi-title { font-size: 0.875rem; font-weight: 500; }
.menu-item .mi-sub { grid-column: 1; font-size: 0.75rem; color: var(--ink-3); }
.menu-item i { grid-row: 1 / span 2; grid-column: 2; align-self: center; color: var(--ink); }
.menu-item[aria-checked="false"] .mi-title { color: var(--ink-3); }
.menu-note { margin: 4px 10px 6px; font-size: 0.75rem; color: var(--ink); min-height: 0; }
.menu-note:empty { display: none; }

.mode {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--btn-2);
}
.mode button {
  display: inline-flex; align-items: center; gap: 5px;
  height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background-color 200ms ease, color 200ms ease, box-shadow 200ms ease;
}
.mode button i { font-size: 0.875rem; }
.mode button[aria-checked="true"] { background: var(--btn); color: var(--btn-ink); }
.mode button[data-mode="degen"] i { color: var(--hot); }

.send {
  margin-left: auto;
  flex: none;
  width: 38px; height: 38px;
  border-radius: 999px;
  border: 0;
  background: var(--btn);
  color: var(--btn-ink);
  display: grid; place-items: center;
  font-size: 1.1rem;
  transition: transform 160ms var(--ease-out), opacity 200ms ease, background-color 200ms ease;
}
.send:active { transform: scale(0.94); }
.send:disabled { opacity: 0.25; cursor: default; }
.send:not(:disabled) { background: var(--btn); }

.chips { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; margin-top: 14px; }
body.has-chat .chips { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-size: 0.9375rem;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
}
.chip i { font-size: 1.05rem; width: 1.05rem; height: 1.05rem; display: inline-block; }
.chip:active { transform: scale(0.97); }

.fineprint { margin: 14px 0 0; text-align: center; font-size: 0.75rem; color: var(--ink-3); }

@media (hover: hover) and (pointer: fine) {
  .chip:hover { background: var(--btn-2); color: var(--ink); }
  .model-btn:hover { background: var(--btn-2); color: var(--ink); }
  .menu-item:hover { background: var(--btn-2); }
  .mode button:not([aria-checked="true"]):hover { color: var(--ink); }
}

/* ---------- Messages ---------- */
.thread-inner { display: flex; flex-direction: column; gap: 26px; padding: 28px 4px 20px; }
.msg { animation: msg-in 380ms var(--ease-out) both; }
@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.msg-user {
  align-self: flex-end;
  max-width: 80%;
  background: var(--user-bubble);
  border-radius: 22px;
  padding: 10px 18px;
  font-size: 1rem;
  overflow-wrap: anywhere;
}
.msg-bot { display: grid; grid-template-columns: 32px 1fr; column-gap: 12px; }
.msg-bot .avatar { width: 32px; height: 32px; grid-row: 1 / span 4; border-radius: 50%; }
.msg-bot .meta { display: flex; align-items: baseline; gap: 8px; font-size: 0.875rem; height: 32px; align-items: center; }
.msg-bot .meta b { font-weight: 600; }
.msg-bot .meta span { color: var(--ink-3); font-family: var(--mono); font-size: 0.6875rem; }
.msg-bot .answer {
  font-size: 1.125rem;
  line-height: 1.6;
  letter-spacing: -0.005em;
  font-weight: 400;
  overflow-wrap: anywhere;
  min-height: 1.55em;
  text-wrap: pretty;
}
.msg-bot .answer .caret {
  display: inline-block;
  width: 8px; height: 8px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--ink);
  vertical-align: 0.1em;
}

.think { margin: 2px 0 8px; }
.think-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; background: none;
  padding: 2px 0;
  color: var(--ink-3);
  font-size: 0.8125rem;
}
.think-toggle i { font-size: 0.75rem; transition: transform 200ms var(--ease-out); }
.think[data-open="true"] .think-toggle i { transform: rotate(90deg); }
.think.is-live .think-label {
  background: linear-gradient(90deg, var(--ink-3) 0%, var(--ink) 45%, var(--ink-3) 90%) 0 0 / 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { to { background-position: -220% 0; } }
.think-steps {
  list-style: none;
  margin: 8px 0 0;
  padding: 2px 0 2px 14px;
  border-left: 2px solid var(--line);
  font-size: 0.8125rem;
  line-height: 1.75;
  color: var(--ink-2);
}
.think[data-open="false"] .think-steps { display: none; }
.think-steps li { animation: msg-in 280ms var(--ease-out) both; }

.actions { display: flex; gap: 2px; margin: 8px 0 0 -8px; opacity: 0; transition: opacity 300ms ease; }
.msg-bot.done .actions { opacity: 1; }
.act {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px;
  padding: 0 8px;
  border: 0; border-radius: 8px;
  background: none;
  color: var(--ink-3);
  font-size: 0.8125rem;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
}
.act i { font-size: 1rem; }
.act:active { transform: scale(0.96); }
@media (hover: hover) and (pointer: fine) {
  .act:hover { background: var(--btn-2); color: var(--ink); }
}

/* ---------- Chat layouts ---------- */
body.has-chat .thread {
  display: block;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
  mask-image: linear-gradient(to bottom, transparent 0, #000 28px);
}

/* Desktop: HoodBot keeps the left side, the conversation lives on the right */
@media (min-width: 1024px) {
  body.has-chat {
    --panel-w: min(600px, 44vw);
    --left-w: calc(100vw - var(--panel-w) - 72px);
    --mascot-x: calc(var(--left-w) / 2 + 12px);
    --mascot-h: min(calc(100dvh - var(--top) - 9dvh), calc(var(--left-w) * 0.82), 680px);
  }
  body.has-chat .hood { bottom: 7dvh; }
  body.has-chat .panel {
    left: auto;
    right: 36px;
    top: calc(var(--top) + 8px);
    bottom: 20px;
    width: var(--panel-w);
    transform: none;
    padding: 0;
  }
  body.has-chat .thread { padding: 0 12px 0 4px; }
  body.has-chat .fineprint { margin-top: 8px; }
}

/* Phones and tablets: the conversation is a sheet below HoodBot */
@media (max-width: 1023px) {
  body.has-chat { --sheet: 54dvh; --mascot-h: min(calc(100dvh - var(--top) - var(--sheet) - 12px), 92vw); }
  body.has-chat .hood { bottom: calc(var(--sheet) - 6px); }
  body.has-chat .panel {
    top: calc(100dvh - var(--sheet));
    width: 100%;
    max-width: 760px;
    background: var(--bg);
    border-top: 1px solid var(--line);
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -16px 40px -28px rgba(0, 0, 0, 0.3);
    animation: sheet-up 650ms var(--ease-move) both;
  }
  @keyframes sheet-up {
    from { transform: translate(-50%, 100%); }
    to { transform: translate(-50%, 0); }
  }
}

@media (max-width: 560px) {
  :root { --top: 60px; }
  .top { padding: 0 16px; }
  .btn-primary span { display: none; }
  .btn-primary { width: 38px; padding: 0; }
  .panel { padding: 0 14px max(12px, env(safe-area-inset-bottom)); }
  .hero-copy { margin-bottom: 16px; }
  .hero-copy p { font-size: 0.9375rem; }
  .chips { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; margin: 14px -14px 0; padding: 0 14px; }
  .chip { flex: none; }
  .model-btn { padding: 0 6px; }
  .model-btn span { max-width: 58px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mode button { padding: 0 9px; }
  .composer { padding: 12px 10px 8px 16px; }
  .composer-bar { gap: 4px; }
  .hero-copy h1 { font-size: 2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .hood .rig, .hood .feather, .hood.is-talking .rig, .hood.is-thinking #hat .hat-base, .hood, .hood .hat-base { animation: none; }
  .top, .hero-copy, .composer, .chips, .fineprint { animation-duration: 1ms; animation-delay: 0ms; }
  .hood { transition: none; }
  .msg, .think-steps li, body.has-chat .panel, .think.is-live .think-label, .menu { animation-duration: 1ms; }
}
