:root {
  color-scheme: dark;
  --ink: #f4f0e8;
  --muted: #a8afa8;
  --night: #07110f;
  --panel: rgba(16, 31, 27, 0.78);
  --line: rgba(230, 239, 228, 0.14);
  --green: #8fe0ad;
  --lime: #d8f17b;
  --danger: #ff9b8f;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--night);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 30% 0%, rgba(57, 114, 89, 0.18), transparent 40%),
    linear-gradient(145deg, #07110f 0%, #091411 52%, #050b0a 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

.glow {
  position: fixed;
  z-index: 0;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  opacity: 0.12;
}

.glow-one {
  top: 15%;
  right: -12rem;
  background: var(--green);
}

.glow-two {
  bottom: -14rem;
  left: -8rem;
  background: var(--lime);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 40px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.masthead {
  min-height: 108px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(143, 224, 173, 0.55);
  border-radius: 50%;
  color: var(--green);
  font-family: Georgia, serif;
  font-size: 14px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  letter-spacing: 0.13em;
  font-size: 15px;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.03em;
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.status span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 16px var(--green);
}

.welcome {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.75fr);
  align-items: center;
  gap: clamp(50px, 8vw, 110px);
  padding: 70px 0 80px;
}

.eyebrow,
.step {
  margin: 0 0 22px;
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(52px, 7.2vw, 92px);
  font-weight: 400;
  line-height: 0.93;
  letter-spacing: -0.055em;
}

h1 em {
  color: var(--lime);
  font-weight: 400;
}

.lede {
  max-width: 610px;
  margin: 34px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.key-card {
  padding: clamp(28px, 4vw, 46px);
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.23);
  backdrop-filter: blur(18px);
}

.key-card h2,
.chat-sidebar h2,
.empty-state h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}

.key-card h2 {
  font-size: 34px;
}

.key-card > p {
  margin: 15px 0 30px;
  color: var(--muted);
  line-height: 1.55;
}

.key-card label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.key-row {
  display: grid;
  gap: 10px;
}

input,
textarea,
select {
  color: var(--ink);
  border: 1px solid var(--line);
  outline: none;
  background: rgba(3, 10, 8, 0.55);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(143, 224, 173, 0.68);
  box-shadow: 0 0 0 3px rgba(143, 224, 173, 0.08);
}

input {
  width: 100%;
  padding: 14px 15px;
  border-radius: 3px;
}

button {
  border: 0;
}

.key-row button,
#send-button {
  color: #08100d;
  background: var(--green);
  font-weight: 750;
}

.key-row button {
  display: flex;
  justify-content: space-between;
  padding: 14px 16px;
  border-radius: 3px;
}

.key-row button:hover,
#send-button:hover {
  background: #a5e9bd;
}

.key-row button:disabled,
#send-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.privacy-note {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.privacy-note span {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-weight: 700;
}

.error {
  min-height: 18px;
  margin: 10px 0 0 !important;
  color: var(--danger) !important;
  font-size: 12px;
}

.chat {
  flex: 1;
  min-height: calc(100vh - 168px);
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  margin: 28px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: rgba(8, 18, 15, 0.72);
}

.chat-sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 34px 28px;
  border-right: 1px solid var(--line);
  background: rgba(17, 34, 28, 0.52);
}

.chat-sidebar h2 {
  font-size: 31px;
  line-height: 1.08;
}

.chat-sidebar p:not(.eyebrow) {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.sidebar-actions {
  display: grid;
  gap: 10px;
}

.quiet-button {
  padding: 11px 13px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  text-align: left;
}

.text-button {
  padding: 7px 0;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-size: 12px;
}

.chat-main {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(320px, 1fr) auto auto;
}

.chat-toolbar {
  min-height: 66px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
}

.chat-toolbar label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

select {
  padding: 8px 30px 8px 10px;
  border-radius: 3px;
  font-size: 12px;
}

.model-note {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
}

.messages {
  min-height: 0;
  overflow-y: auto;
  padding: 34px clamp(22px, 5vw, 70px);
  scroll-behavior: smooth;
}

.empty-state {
  height: 100%;
  display: grid;
  place-content: center;
  text-align: center;
}

.spark {
  color: var(--lime);
  font-size: 25px;
}

.empty-state h2 {
  margin-top: 15px;
  font-size: 32px;
}

.empty-state p {
  color: var(--muted);
}

.message {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 18px;
  padding: 24px 0;
  border-bottom: 1px solid rgba(230, 239, 228, 0.08);
}

.message-role {
  padding-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.message.assistant .message-role {
  color: var(--green);
}

.message-content {
  min-width: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.7;
}

.reasoning {
  margin: 0 0 17px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(3, 10, 8, 0.42);
}

.reasoning summary {
  padding: 10px 13px;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.reasoning pre {
  margin: 0;
  padding: 0 13px 13px;
  color: #b7c3ba;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.6;
}

.cursor::after {
  content: "▋";
  margin-left: 2px;
  color: var(--green);
  animation: blink 0.8s steps(2, start) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.composer {
  margin: 0 clamp(18px, 4vw, 54px);
  padding: 14px 15px 11px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(3, 10, 8, 0.65);
}

.composer:focus-within {
  border-color: rgba(143, 224, 173, 0.55);
}

textarea {
  width: 100%;
  max-height: 180px;
  resize: none;
  padding: 4px;
  border: 0;
  background: transparent;
  box-shadow: none !important;
  line-height: 1.5;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
}

.composer-footer > div {
  display: flex;
  gap: 8px;
}

#send-button,
.stop-button {
  padding: 8px 13px;
  border-radius: 3px;
  font-size: 12px;
}

.stop-button {
  color: var(--ink);
  border: 1px solid var(--line);
  background: transparent;
}

.disclaimer {
  margin: 10px 0 15px;
  color: #77827b;
  text-align: center;
  font-size: 10px;
}

footer {
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: #6f7973;
  border-top: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: 0.05em;
}

.hidden {
  display: none !important;
}

.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 (max-width: 860px) {
  .welcome {
    grid-template-columns: 1fr;
    padding-top: 50px;
  }

  .intro {
    max-width: 680px;
  }

  .chat {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    display: none;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 24px, 1180px);
  }

  .masthead {
    min-height: 84px;
  }

  .brand small,
  .status {
    display: none;
  }

  h1 {
    font-size: 52px;
  }

  .welcome {
    gap: 44px;
    padding: 44px 0 55px;
  }

  .key-card {
    padding: 25px 20px;
  }

  .chat {
    min-height: calc(100vh - 112px);
    margin: 14px 0;
  }

  .chat-toolbar,
  .messages {
    padding-left: 16px;
    padding-right: 16px;
  }

  .model-note {
    display: none;
  }

  .message {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .composer {
    margin: 0 10px;
  }

  .composer-footer > span {
    display: none;
  }

  .composer-footer {
    justify-content: flex-end;
  }

  footer {
    justify-content: center;
  }

  footer span:last-child {
    display: none;
  }
}
