:root {
  color-scheme: light;
  --paper: #f3efe6;
  --ink: #17221d;
  --muted: #69736c;
  --line: rgba(23, 34, 29, 0.17);
  --green: #174c3c;
  --acid: #c9f066;
  --rust: #b94d31;
  --white: #fffdf7;
  --shadow: 0 20px 60px rgba(31, 43, 36, 0.11);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--paper); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(rgba(23, 34, 29, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 34, 29, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
}

button, textarea { font: inherit; }
button { color: inherit; }

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--acid);
  background: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand strong, .brand small { display: block; }
.brand strong { font-family: Georgia, serif; font-size: 21px; letter-spacing: -0.03em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: 0.16em; }

.topbar-actions { display: flex; align-items: center; gap: 22px; }
.status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 650; }
.status i { width: 7px; height: 7px; border-radius: 50%; background: #d19b36; box-shadow: 0 0 0 4px rgba(209, 155, 54, 0.13); }
.status.online i { background: #4d956c; box-shadow: 0 0 0 4px rgba(77, 149, 108, 0.13); }
.status.offline i { background: var(--rust); box-shadow: 0 0 0 4px rgba(185, 77, 49, 0.13); }

.text-button {
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(250px, 0.75fr);
  align-items: end;
  gap: 48px;
  padding: 62px 0 50px;
}

.eyebrow {
  grid-column: 1 / -1;
  margin: 0 0 -27px;
  color: var(--rust);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(50px, 7vw, 92px);
  font-weight: 400;
  line-height: 0.91;
  letter-spacing: -0.055em;
}

h1 em { color: var(--green); font-weight: 400; }

.lede {
  max-width: 390px;
  margin: 0 0 6px;
  color: var(--muted);
  font-family: Georgia, serif;
  font-size: 18px;
  line-height: 1.55;
}

.console {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(255, 253, 247, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.conversation {
  min-height: 300px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 14px 30px;
  scrollbar-color: rgba(23, 34, 29, 0.3) transparent;
}

.message {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 18px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
  animation: reveal 240ms ease-out both;
}

.message:last-child { border-bottom: 0; }
.message-label { padding-top: 3px; color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: 0.16em; }
.message-body { min-width: 0; margin: 0; font-size: 14px; line-height: 1.65; }
.message-body p { margin: 0; }

.user-message .message-body {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  color: var(--green);
}

.result-card > pre {
  max-height: 460px;
  overflow: auto;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  line-height: 1.65;
}

.assistant-message.error .result-card { color: var(--rust); }

.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.suggestions button, .artifact-list a {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--green);
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.suggestions button:hover, .artifact-list a:hover { border-color: var(--green); background: rgba(201, 240, 102, 0.22); }

.artifact-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.composer {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  padding: 22px 24px 38px;
  border-top: 1px solid var(--line);
  background: var(--white);
}

.composer textarea {
  width: 100%;
  min-height: 48px;
  max-height: 180px;
  resize: none;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 2px;
  outline: none;
  background: transparent;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.6;
}
.composer textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23, 76, 60, 0.08); }

.send-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-width: 116px;
  height: 48px;
  padding: 0 16px;
  border: 0;
  border-radius: 2px;
  color: var(--acid);
  background: var(--green);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.send-button:disabled { opacity: 0.55; cursor: wait; }

.composer-meta {
  position: absolute;
  right: 24px;
  bottom: 11px;
  left: 24px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
}

footer {
  display: flex;
  justify-content: space-between;
  padding: 25px 0 38px;
  color: var(--muted);
  font-size: 11px;
}
footer a { color: inherit; text-underline-offset: 3px; }

.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 { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 720px) {
  .shell { width: min(100% - 24px, 1180px); }
  .topbar { min-height: 74px; }
  .status { display: none; }
  .intro { grid-template-columns: 1fr; gap: 24px; padding: 46px 0 34px; }
  .eyebrow { margin: 0 0 -10px; }
  h1 { font-size: clamp(48px, 15vw, 72px); }
  .lede { font-size: 16px; }
  .conversation { min-height: 280px; padding: 8px 18px; }
  .message { grid-template-columns: 42px minmax(0, 1fr); gap: 9px; padding: 20px 0; }
  .composer { grid-template-columns: 1fr; padding: 16px 16px 42px; }
  .send-button { justify-self: stretch; width: 100%; }
  .composer-meta { right: 16px; left: 16px; }
  .composer-meta span:first-child { display: none; }
  .composer-meta { justify-content: flex-end; }
}

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


/* --- Sign-in gate ------------------------------------------------------- */
/* The author display below outranks the UA [hidden] rule, so state it here or
   the overlay keeps covering the console after a successful sign-in. */
.login-overlay[hidden] { display: none; }

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--paper);
}

.login-card {
  display: grid;
  gap: 14px;
  width: min(100%, 380px);
  padding: 34px 30px 30px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.login-card .brand-mark { justify-self: start; }

.login-card h2 {
  margin: 4px 0 0;
  font-size: 26px;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.login-lede {
  margin: -8px 0 6px;
  font-size: 14px;
  color: var(--muted);
}

.login-field {
  display: grid;
  gap: 6px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.login-field input {
  width: 100%;
  padding: 11px 13px;
  font: inherit;
  font-size: 15px;
  letter-spacing: normal;
  text-transform: none;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.login-field input:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 1px;
}

.login-error {
  margin: 0;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--rust);
  background: rgba(185, 77, 49, 0.09);
  border-radius: 9px;
}

.login-button {
  margin-top: 4px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 600;
  color: var(--white);
  background: var(--green);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.login-button:hover { background: #10382c; }
.login-button:disabled { opacity: 0.6; cursor: progress; }

.signed-in {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

@media (max-width: 720px) {
  .login-card { padding: 26px 22px 24px; }
  .signed-in { display: none; }
}
