:root {
  color-scheme: dark;
  --background: #212121;
  --surface: #2f2f2f;
  --surface-hover: #383838;
  --text: #ececec;
  --muted: #b4b4b4;
  --faint: #787878;
  --border: rgba(255, 255, 255, 0.1);
  --page-gutter: clamp(1.25rem, 5vw, 2rem);
  --column-width: 42rem;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 20rem;
  min-height: 100%;
  background: var(--background);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background: var(--background);
  color: var(--text);
  font-family:
    ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

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

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: 0 var(--page-gutter);
}

.conversation {
  width: min(100%, var(--column-width));
  margin: 0 auto;
  padding: clamp(5.25rem, 15vh, 9.5rem) 0 12rem;
}

.response {
  width: 100%;
}

.thinking {
  display: flex;
  align-items: center;
  height: 1.75rem;
  opacity: 0;
  filter: blur(6px);
  transform: translateY(4px);
  animation: reveal 700ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.thinking.is-leaving {
  animation: dissolve 450ms ease forwards;
}

.thinking-dot {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 1rem rgba(255, 255, 255, 0.15);
  animation: breathe 1.15s ease-in-out infinite;
}

.message {
  position: relative;
}

.scene-text {
  margin: 0;
}

.content .scene-text--greeting {
  margin-bottom: 0;
}

.scene-text--greeting {
  min-height: 1.75rem;
  color: var(--text);
  font-size: clamp(1.05rem, 2.3vw, 1.125rem);
  font-weight: 400;
  letter-spacing: -0.012em;
}

.scene-text--heading {
  margin: 1.75rem 0 1rem;
  color: var(--text);
  font-size: clamp(1.15rem, 3vw, 1.35rem);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.025em;
}

.scene-text--eyebrow {
  margin: 1.5rem 0 0.65rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tool-call {
  width: fit-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 1.6rem 0 1.7rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
  opacity: 0;
  filter: blur(7px);
  transform: translateY(5px);
}

.tool-call.is-visible {
  animation: reveal 550ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.tool-call.is-changing .tool-label {
  animation: label-change 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.tool-icon {
  width: 1.15rem;
  height: 1.15rem;
  flex: 0 0 auto;
  color: var(--muted);
}

.tool-icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.tool-icon .tool-icon-line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  stroke-linecap: round;
}

.tool-pulse {
  width: 0.25rem;
  height: 0.25rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: currentColor;
  animation: breathe 1.25s ease-in-out infinite;
}

.tool-call.is-complete .tool-pulse {
  animation: none;
  opacity: 0.42;
}

.content {
  color: var(--text);
  font-size: clamp(1rem, 2.2vw, 1.06rem);
  letter-spacing: -0.008em;
}

.content p {
  margin: 0 0 1.35rem;
}

.content p:last-child {
  margin-bottom: 0;
}

.content a {
  color: inherit;
  text-decoration-color: rgba(236, 236, 236, 0.46);
  text-decoration-thickness: 0.075rem;
  text-underline-offset: 0.21em;
  transition:
    color 180ms ease,
    text-decoration-color 180ms ease;
}

.content a:hover,
.content a:focus-visible {
  color: #fff;
  text-decoration-color: #fff;
}

.content a:focus-visible,
.composer:focus-within {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 4px;
  border-radius: 0.4rem;
}

.stream-block {
  opacity: 0;
  filter: blur(8px);
  transform: translateY(7px);
  animation: reveal 680ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.word {
  opacity: 0;
  filter: blur(4px);
  animation: word-in 340ms ease forwards;
}

.inline-figure {
  margin: 1.75rem 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: var(--surface);
}

.inline-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.inline-figure > a {
  display: block;
}

.inline-figure figcaption {
  padding: 0.75rem 0.9rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 1.6rem 0;
}

.content .action {
  display: inline-flex;
  min-height: 2.65rem;
  align-items: center;
  justify-content: center;
  padding: 0.58rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.content .action:hover {
  transform: translateY(-1px);
}

.action--primary {
  border-color: var(--text) !important;
  background: var(--text);
  color: var(--background) !important;
}

.action--primary:hover {
  background: #fff;
}

.action--secondary {
  background: var(--surface);
}

.action--secondary:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: var(--surface-hover);
}

.callout {
  margin: 1.6rem 0;
  padding: 1rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.035);
}

.content .callout p {
  margin: 0;
}

.callout__eyebrow {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.callout__title {
  margin-top: 0.22rem !important;
  font-weight: 600;
}

.callout__body {
  margin-top: 0.25rem !important;
  color: var(--muted);
  font-size: 0.94rem;
}

.portfolio-list {
  margin: 1.25rem 0 1.5rem;
  padding-left: 1.35rem;
}

.portfolio-list li {
  margin: 0.38rem 0;
  padding-left: 0.25rem;
}

.scene-divider {
  height: 1px;
  margin: 1.75rem 0;
  border: 0;
  background: var(--border);
}

.composer-wrap {
  position: fixed;
  z-index: 5;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 2rem var(--page-gutter) max(1.25rem, env(safe-area-inset-bottom));
  background: linear-gradient(
    to bottom,
    rgba(33, 33, 33, 0),
    rgba(33, 33, 33, 0.96) 38%,
    var(--background) 64%
  );
  opacity: 0;
  filter: blur(10px);
  transform: translateY(14px);
}

.composer-wrap.is-visible {
  animation: reveal 800ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.composer {
  width: min(100%, var(--column-width));
  min-height: 3.65rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.55rem 0.5rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 1.85rem;
  background: var(--surface);
  box-shadow: 0 0.15rem 0.5rem rgba(0, 0, 0, 0.08);
  transition:
    background 180ms ease,
    border-color 180ms ease;
}

.composer:hover {
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.14);
}

.composer input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  caret-color: transparent;
  font-size: 1rem;
}

.composer input::placeholder {
  color: #a6a6a6;
  opacity: 1;
}

.composer button {
  width: 2.45rem;
  height: 2.45rem;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #676767;
  color: #bcbcbc;
  cursor: not-allowed;
}

.composer button svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer-note {
  width: min(100%, var(--column-width));
  max-height: 0;
  margin: 0.35rem auto 0;
  overflow: hidden;
  color: var(--faint);
  font-size: 0.75rem;
  line-height: 1.2;
  text-align: center;
  opacity: 0;
  filter: blur(4px);
  transition:
    max-height 280ms ease,
    opacity 280ms ease,
    filter 280ms ease;
}

.composer-wrap.is-notice-visible .composer-note {
  max-height: 1.5rem;
  opacity: 1;
  filter: blur(0);
}

.noscript {
  position: fixed;
  top: 15vh;
  left: 50%;
  width: min(calc(100% - 2.5rem), var(--column-width));
  transform: translateX(-50%);
}

.noscript h1 {
  font-size: 1.125rem;
  font-weight: 400;
}

.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;
}

@keyframes reveal {
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@keyframes dissolve {
  to {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(-4px) scale(0.92);
  }
}

@keyframes word-in {
  to {
    opacity: 1;
    filter: blur(0);
  }
}

@keyframes label-change {
  0% {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
  43% {
    opacity: 0;
    filter: blur(6px);
    transform: translateY(-3px);
  }
  44% {
    opacity: 0;
    transform: translateY(4px);
  }
  100% {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 40rem) {
  .conversation {
    padding-top: 12vh;
    padding-bottom: 10.5rem;
  }

  .tool-call {
    margin-top: 1.4rem;
  }

  .composer-wrap {
    padding-top: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
  }
}
