:root {
  color-scheme: light;
  --bg: #f4f6f0;
  --paper: #fffdf7;
  --ink: #17211c;
  --muted: #66716a;
  --line: #d8ddd3;
  --accent: #0d7f5f;
  --accent-dark: #07543f;
  --soft: #e7eee7;
  --danger: #a9433a;
  --radius: 18px;
  font-family:
    "Aptos",
    "Segoe UI",
    system-ui,
    -apple-system,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(135deg, rgb(244 246 240 / 0.95), rgb(232 239 232 / 0.92)),
    radial-gradient(circle at 78% 8%, rgb(13 127 95 / 0.18), transparent 30%);
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
textarea {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--muted);
  font-size: 14px;
}

.nav-links a:hover {
  color: var(--ink);
}

.hero {
  min-height: calc(100dvh - 76px);
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  align-items: center;
  gap: clamp(32px, 7vw, 96px);
  padding: 48px 0 72px;
}

.hero-copy {
  max-width: 760px;
}

.kicker {
  margin: 0 0 14px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 24px;
  font-size: clamp(46px, 7vw, 92px);
  line-height: 0.96;
  letter-spacing: 0;
}

.hero-lede {
  max-width: 620px;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.button,
.send-button,
.mode-chip {
  border: 0;
  cursor: pointer;
  transition:
    transform 180ms ease,
    background 180ms ease,
    color 180ms ease,
    border-color 180ms ease;
}

.button:active,
.send-button:active,
.mode-chip:active {
  transform: translateY(1px);
}

.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 20px;
  font-weight: 800;
}

.button.primary {
  background: var(--accent);
  color: #ffffff;
}

.button.ghost {
  border: 1px solid var(--line);
  background: rgb(255 255 255 / 0.54);
  color: var(--ink);
}

.signal-panel,
.chat-card,
.mode-panel {
  border: 1px solid rgb(23 33 28 / 0.12);
  border-radius: var(--radius);
  background: rgb(255 253 247 / 0.78);
  box-shadow: 0 22px 70px rgb(31 47 39 / 0.1);
  backdrop-filter: blur(18px);
}

.signal-panel {
  padding: 18px;
}

.signal-head,
.signal-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.signal-head {
  padding: 4px 4px 18px;
  color: var(--muted);
  font-size: 13px;
}

.signal-line {
  min-height: 86px;
  border-top: 1px solid var(--line);
  padding: 18px 4px;
}

.signal-line span {
  font-size: 28px;
  font-weight: 850;
}

.signal-line b {
  color: var(--muted);
  font-size: 14px;
}

.signal-line.active span {
  color: var(--accent-dark);
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 22px;
  padding: 24px 0 80px;
}

.chat-card {
  min-height: 720px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
  padding: 22px;
}

.chat-header h2 {
  margin: 0;
  font-size: 30px;
}

.status-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-dark);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
}

.status-badge.error {
  background: #f5dfda;
  color: var(--danger);
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  overflow-y: auto;
}

.message {
  width: fit-content;
  max-width: min(680px, 88%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.message.assistant {
  align-self: flex-start;
  background: #ffffff;
}

.message.user {
  align-self: flex-end;
  border-color: rgb(13 127 95 / 0.22);
  background: var(--accent);
  color: #ffffff;
}

.message.loading {
  color: var(--muted);
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 16px;
  background: rgb(255 253 247 / 0.86);
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: none;
  padding: 14px 16px;
  color: var(--ink);
  background: #ffffff;
  line-height: 1.5;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgb(13 127 95 / 0.12);
}

.send-button {
  min-width: 102px;
  border-radius: 16px;
  padding: 0 18px;
  background: var(--ink);
  color: #ffffff;
  font-weight: 850;
}

.send-button[disabled] {
  cursor: wait;
  opacity: 0.58;
}

.mode-panel {
  align-self: start;
  position: sticky;
  top: 18px;
  padding: 18px;
}

.panel-section + .panel-section,
.deploy-box {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mode-chip {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.mode-chip.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.boundary-list {
  display: grid;
  gap: 10px;
}

.boundary-list span,
.deploy-box code {
  display: block;
  border-radius: 12px;
  background: #ffffff;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 14px;
}

.deploy-box code + code {
  margin-top: 8px;
}

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

@media (prefers-reduced-motion: no-preference) {
  .hero-copy,
  .signal-panel,
  .chat-layout {
    animation: rise 640ms ease both;
  }

  .signal-panel {
    animation-delay: 120ms;
  }

  .chat-layout {
    animation-delay: 180ms;
  }

  @keyframes rise {
    from {
      opacity: 0;
      transform: translateY(14px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

@media (max-width: 920px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 18px 0;
  }

  .nav-links {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

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

  .hero {
    min-height: auto;
    padding-top: 42px;
  }

  .mode-panel {
    position: static;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1180px);
  }

  h1 {
    font-size: 42px;
    line-height: 1.02;
  }

  .signal-line {
    align-items: flex-start;
    flex-direction: column;
    min-height: auto;
  }

  .chat-card {
    min-height: 680px;
  }

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

  .chat-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .composer {
    display: flex;
    flex-direction: column;
  }

  .send-button {
    min-height: 48px;
  }

  .message {
    max-width: 96%;
  }
}
