:root {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #151515;
  --surface-2: #1b1b1b;
  --surface-3: #222222;
  --border: #303030;
  --border-strong: #464646;
  --text: #eeeeee;
  --muted: #a7a7a7;
  --quiet: #737373;
  --accent: #d8d8d8;
  --accent-strong: #f0f0f0;
  --accent-soft: rgba(255, 255, 255, 0.08);
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
  --radius-xl: 10px;
  --radius-lg: 7px;
  --radius-md: 5px;
  font-family:
    ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.brand,
.agent-lockup,
.topbar-actions,
.status-meter {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark,
.agent-avatar,
.message-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: #202020;
  color: var(--accent-strong);
  font-weight: 800;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  font-size: 1rem;
}

.brand-name,
.brand-tagline {
  display: block;
}

.brand-name {
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.brand-tagline {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.8rem;
}

.topbar-actions {
  gap: 10px;
}

.ghost-button,
.status-meter {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
}

.status-meter {
  gap: 8px;
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 0.8rem;
}

.ghost-button {
  border-radius: var(--radius-md);
  padding: 8px 14px;
  transition: 140ms ease;
}

.ghost-button:hover,
.prompt-chip:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 1px;
  background: var(--accent);
}

.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(280px, 0.84fr) minmax(390px, 1.16fr);
  gap: 18px;
  align-items: stretch;
}

.intro-card,
.chat-card {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.intro-card {
  min-height: 650px;
  padding: 30px;
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--accent);
  font-size: 0.73rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(2.7rem, 5vw, 4.4rem);
  line-height: 1;
  letter-spacing: -0.055em;
}

.intro-copy {
  max-width: 32rem;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 1.03rem;
  line-height: 1.65;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 28px;
}

.stat-grid div,
.prompt-panel {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-md);
}

.stat-grid div {
  padding: 13px;
}

.stat-grid span,
.stat-grid strong {
  display: block;
}

.stat-grid span,
.prompt-panel p {
  color: var(--quiet);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-grid strong {
  margin-top: 7px;
  font-size: 0.98rem;
}

.prompt-panel {
  margin-top: auto;
  padding: 16px;
}

.prompt-panel p {
  margin: 0 0 10px;
}

.prompt-chip {
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 11px 12px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  transition: 140ms ease;
}

.chat-card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 650px;
  overflow: hidden;
  border-radius: var(--radius-xl);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.agent-lockup {
  gap: 11px;
}

.agent-avatar,
.message-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-lg);
}

.agent-lockup strong,
.agent-lockup small {
  display: block;
}

.agent-lockup strong {
  font-weight: 750;
}

.agent-lockup small {
  margin-top: 2px;
  color: var(--muted);
}

.status-meter {
  min-width: 98px;
  justify-content: center;
  text-transform: lowercase;
}

.status-dot.thinking {
  background: var(--accent-strong);
}

.status-dot.typing {
  background: #bdbdbd;
}

.messages {
  min-height: 0;
  overflow-y: auto;
  padding: 22px 16px;
  scroll-behavior: smooth;
}

.messages.empty {
  display: grid;
  place-items: center;
}

.empty-state {
  max-width: 24rem;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  color: var(--muted);
  text-align: center;
}

.empty-state span {
  display: block;
  color: var(--text);
  font-size: 1rem;
  font-weight: 750;
}

.empty-state p {
  margin: 9px 0 0;
  line-height: 1.55;
}

.message {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin: 0 0 16px;
  animation: messageIn 180ms ease both;
}

.user-message {
  justify-content: flex-end;
}

.user-message .bubble {
  order: 1;
  max-width: min(76%, 34rem);
  background: var(--accent-soft);
}

.assistant-message .bubble {
  max-width: min(82%, 36rem);
}

.user-message .message-avatar {
  order: 2;
  background: #202020;
  color: var(--accent-strong);
}

.bubble {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 13px 14px;
  background: var(--surface-2);
}

.message-author {
  display: block;
  margin-bottom: 7px;
  color: var(--quiet);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bubble p {
  margin: 0;
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.thinking-bubble {
  min-width: 156px;
}

.thinking-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.orbital {
  position: relative;
  width: 24px;
  height: 24px;
  border: 1px solid var(--border-strong);
  border-radius: 1px;
  animation: spin 1.1s linear infinite;
}

.orbital::before {
  content: "";
  position: absolute;
  top: -3px;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--accent-strong);
}

.typing-dots {
  display: inline-flex;
  gap: 5px;
  margin-left: 6px;
  vertical-align: middle;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: currentColor;
  animation: pulse 800ms ease-in-out infinite;
}

.typing-dots span:nth-child(2) {
  animation-delay: 120ms;
}

.typing-dots span:nth-child(3) {
  animation-delay: 240ms;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

textarea {
  width: 100%;
  max-height: 150px;
  overflow-y: hidden;
  resize: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 15px;
  outline: none;
  background: var(--surface);
  color: var(--text);
  line-height: 1.45;
  transition: 140ms ease;
}

textarea::placeholder {
  color: var(--quiet);
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 0 17px;
  background: var(--accent);
  color: #111111;
  font-weight: 750;
  transition: 140ms ease;
}

.send-button:hover {
  background: var(--accent-strong);
}

.send-button:disabled {
  cursor: not-allowed;
  opacity: 0.64;
}

.send-button svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (max-width: 900px) {
  .shell {
    width: min(100% - 24px, 680px);
    padding: 18px 0;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .intro-card,
  .chat-card {
    min-height: auto;
  }

  .intro-card {
    padding: 24px;
  }

  h1 {
    max-width: 11ch;
    font-size: clamp(3rem, 12vw, 4.8rem);
  }

  .prompt-panel {
    margin-top: 28px;
  }

  .chat-card {
    height: min(710px, calc(100vh - 24px));
  }
}

@media (max-width: 560px) {
  .topbar,
  .chat-header {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .status-meter {
    width: 100%;
  }

  .ghost-button,
  .status-meter {
    justify-content: center;
  }

  .intro-card,
  .chat-card {
    border-radius: var(--radius-xl);
  }

  .intro-card {
    padding: 20px;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .prompt-panel {
    display: none;
  }

  .messages {
    padding: 18px 12px;
  }

  .assistant-message .bubble,
  .user-message .bubble {
    max-width: 82%;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  .send-button {
    width: 100%;
  }
}

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