:root {
  color-scheme: light;
  --background: #fdfdfc;
  --surface: #fdfdfc;
  --surface-low: #f3f3f3;
  --surface-high: #e8e8e8;
  --text: #1a1c1c;
  --muted: #5e5e5e;
  --line: rgba(0, 0, 0, 0.1);
  --line-strong: #000000;
  --error-bg: #ffdad6;
  --error: #93000a;
  --container-max: 720px;
  --gutter: 40px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 17px;
  line-height: 1.7;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 32px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: "liga";
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
  font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 24;
}

.chat-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: var(--container-max);
  margin: 0 auto;
  background: var(--surface);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
  padding: 16px var(--gutter);
  border-bottom: 1px solid var(--line);
  background: rgba(253, 253, 252, 0.94);
  backdrop-filter: blur(10px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.topbar h1 {
  margin: 0;
  font-family: "Plus Jakarta Sans", Arial, sans-serif;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.05em;
}

.topbar p {
  margin: 0;
  padding-left: 16px;
  border-left: 1px solid rgba(0, 0, 0, 0.2);
  color: var(--muted);
  font-family: "Plus Jakarta Sans", Arial, sans-serif;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.1em;
}

.ghost-button {
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 8px 0;
  cursor: pointer;
  font-family: "Plus Jakarta Sans", Arial, sans-serif;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ghost-button:hover {
  text-decoration: underline;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 80px var(--gutter);
  display: flex;
  flex-direction: column;
}

.message {
  display: flex;
  flex-direction: column;
  width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message + .message {
  margin-top: 32px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}

.message-label {
  margin-bottom: 16px;
  color: #444748;
  font-family: "Plus Jakarta Sans", Arial, sans-serif;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.message-content {
  max-width: 680px;
  color: var(--text);
  font-size: 19px;
  line-height: 1.7;
  letter-spacing: 0.01em;
}

.message.user {
  align-items: flex-end;
}

.message.user .message-content {
  max-width: min(640px, 92%);
  padding: 16px;
  background: var(--surface-low);
}

.message.status .message-content {
  color: var(--muted);
  font-size: 17px;
}

.message.error .message-content {
  padding: 16px;
  background: var(--error-bg);
  color: var(--error);
}

.composer {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: var(--gutter);
  padding: 48px var(--gutter);
  background: rgba(253, 253, 252, 0.96);
  backdrop-filter: blur(10px);
}

textarea {
  width: 100%;
  max-height: 220px;
  resize: none;
  border: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 0;
  padding: 16px 0;
  background: transparent;
  color: var(--text);
  font-size: 17px;
  line-height: 1.7;
  outline: none;
  overflow: hidden;
}

textarea::placeholder {
  color: rgba(68, 71, 72, 0.45);
}

textarea:focus {
  border-bottom-color: var(--line-strong);
}

.send-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 48px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: opacity 160ms ease;
}

.send-button:hover {
  opacity: 0.5;
}

#sendButton:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #000;
}

@media (max-width: 640px) {
  :root {
    --gutter: 24px;
  }

  .chat-shell {
    min-height: 100dvh;
  }

  .topbar {
    gap: 16px;
    padding: 16px var(--gutter);
  }

  .brand-lockup {
    gap: 12px;
  }

  .topbar p {
    padding-left: 12px;
  }

  .messages {
    padding-top: 48px;
    padding-bottom: 48px;
  }

  .message-content {
    font-size: 17px;
  }

  .composer {
    gap: 16px;
    padding: 24px var(--gutter);
  }
}
