:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  color: #ecedef;
  background: #111215;
  --quiet: #a4a8b1;
  --line: #33363d;
  --surface: #1b1d22;
  --accent: #b9ee78;
  --error: #ffb6aa;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, textarea, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  white-space: nowrap;
  overflow: hidden;
  clip-path: inset(50%);
}

.shell { width: min(100% - 48px, 860px); margin: 0 auto; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 20px;
  min-height: 74px;
  padding-block: 12px;
  border-bottom: 1px solid var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; }
.mark {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid #536747;
  border-radius: 7px;
  color: var(--accent);
  background: #232c21;
  font: 700 13px Consolas, monospace;
}

.access { font-size: 0.83rem; color: var(--quiet); }
main { padding: clamp(26px, 6vw, 60px) 0 32px; }
.chat-heading { margin-bottom: 28px; }
.chat-heading h1 { margin: 0 0 8px; font-size: clamp(1.8rem, 5vw, 2.8rem); letter-spacing: -0.035em; }
.chat-heading p { margin: 0; color: var(--quiet); line-height: 1.5; }
.notice { margin: 0 0 14px; padding: 10px 14px; border-left: 2px solid var(--line); color: var(--quiet); }
.notice[data-error="true"] { border-color: var(--error); color: var(--error); }
.invite {
  max-width: 520px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.invite label { display: block; margin-bottom: 8px; font-weight: 600; }
.invite-actions { display: flex; gap: 8px; }
.invite input {
  min-width: 0;
  flex: 1;
  padding: 8px 10px;
  color: inherit;
  background: #111215;
  border: 1px solid var(--line);
  border-radius: 7px;
}
.invite p { margin: 10px 0 0; color: var(--quiet); font-size: 0.88rem; }
.conversation { min-height: clamp(148px, 26vh, 235px); min-width: 0; }
.empty { padding: 25px 0; }
.empty-title { margin: 0 0 14px; font-weight: 600; }
.examples { display: flex; flex-wrap: wrap; gap: 8px; }
.examples button, .copy {
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.examples button { padding: 9px 12px; font-size: 0.9rem; }
.examples button:hover, .copy:hover { border-color: var(--accent); }

.messages { display: grid; gap: 14px; min-width: 0; }
.bubble {
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 15px 18px;
  background: var(--surface);
  scroll-margin-block-end: 155px;
}
.bubble.user { justify-self: end; width: fit-content; max-width: min(100%, 650px); background: #262c24; border-color: #404a3a; }
.bubble.assistant { justify-self: start; width: min(100%, 760px); }
.speaker { margin: 0 0 7px; font-size: 0.8rem; font-weight: 700; color: var(--accent); }
.bubble.user .speaker { color: #d2d8cc; }
.message-text, .checks p { white-space: pre-wrap; overflow-wrap: anywhere; }
.message-text { margin: 0; line-height: 1.65; }

.code-block { margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; background: #131518; }
.code-top {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 10px 5px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--quiet);
  font-size: 0.8rem;
}
.copy { padding: 3px 8px; }
.code-block pre { overflow: auto; margin: 0; padding: 12px; }
code { font: 0.84rem/1.55 Consolas, ui-monospace, monospace; }
.checks, .evidence { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--quiet); font-size: 0.88rem; }
.checks p { margin: 0 0 6px; }
.checks .check-title, .evidence h3 { color: #e0e3e7; font-weight: 600; }
.checks .check-title[data-status="passed"] { color: var(--accent); }
.checks .check-title[data-status="failed"] { color: var(--error); }
.review summary { width: fit-content; cursor: pointer; }
.review p { padding-top: 7px; line-height: 1.45; }
.evidence h3 { margin: 0 0 6px; font-size: inherit; }
.source-list { margin: 0; padding-left: 19px; line-height: 1.55; overflow-wrap: anywhere; }

.progress { display: flex; align-items: center; gap: 8px; padding: 14px 2px; color: var(--quiet); font-size: 0.88rem; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .pulse { animation: breathe 1.5s ease-in-out infinite alternate; }
  @keyframes breathe { from { opacity: 0.4; } to { opacity: 1; } }
}

.composer {
  position: sticky;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 1;
  margin-top: 20px;
  border: 1px solid #484d55;
  border-radius: 13px;
  padding: 8px;
  background: #202227;
  box-shadow: 0 6px 24px #08090b9c;
}
.composer:focus-within { border-color: #8caa65; }
.composer textarea {
  display: block;
  width: 100%;
  min-height: 62px;
  max-height: 160px;
  resize: vertical;
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 9px;
  color: inherit;
  line-height: 1.45;
}
.composer textarea::placeholder { color: var(--quiet); }
.actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.web { display: inline-flex; align-items: center; gap: 6px; padding: 5px; font-size: 0.87rem; color: var(--quiet); }
.web input { margin: 0; width: 17px; height: 17px; accent-color: var(--accent); }
.send { min-height: 39px; padding: 8px 13px; border: 0; border-radius: 8px; color: #161d10; background: var(--accent); font-weight: 700; }
.send span { margin-left: 5px; }
.send:not(:disabled):hover { background: #d0ffa0; }
.send:disabled { background: #3c4436; color: #afb7ac; }

@media (max-width: 540px) {
  .shell { width: calc(100% - 24px); }
  .topbar { min-height: 56px; }
  .access { font-size: 0.71rem; }
  .bubble { padding: 12px; }
  .chat-heading { margin-bottom: 16px; }
  .composer textarea { min-height: 56px; }
}
