:root {
  --bg: #212121;
  --bg-strong: #171717;
  --bg-soft: #2a2a2a;
  --bg-hover: #313131;
  --surface: #303030;
  --surface-soft: #262626;
  --line: #3a3a3a;
  --text: #ececec;
  --muted: #a9a9a9;
  --green: #10a37f;
  --green-soft: #153c34;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Plus Jakarta Sans", sans-serif;
  color: var(--text);
  background: var(--bg);
}

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

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  min-height: 100vh;
  padding: 0.9rem;
  display: grid;
  grid-template-rows: auto auto auto 1fr auto;
  gap: 1rem;
  background: var(--bg-strong);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 0.96rem;
}

.brand-mark,
.avatar,
.welcome-mark {
  display: inline-grid;
  place-items: center;
  font-weight: 700;
}

.brand-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--green);
  color: #f7fffc;
}

.new-chat-button,
.side-prompt,
.history-item,
.model-button,
.send-button,
.suggestion-chip {
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.new-chat-button {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
}

.new-chat-button:hover,
.side-prompt:hover,
.history-item:hover,
.model-button:hover,
.suggestion-chip:hover,
.send-button:hover {
  background: var(--bg-hover);
}

.sidebar-section {
  display: grid;
  gap: 0.7rem;
}

.sidebar-history {
  align-content: start;
}

.sidebar-label,
.eyebrow,
.status-pill,
.composer-note,
.sidebar-footer p {
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.08em;
}

.sidebar-label,
.sidebar-footer p,
.composer-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.sidebar-prompts,
.history-list {
  display: grid;
  gap: 0.4rem;
}

.side-prompt,
.history-item {
  width: 100%;
  text-align: left;
  padding: 0.8rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
}

.history-empty {
  margin: 0;
  padding: 0.8rem 0.9rem;
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
}

.sidebar-footer {
  align-self: end;
  display: grid;
  gap: 0.35rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-app {
  min-width: 0;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.chat-header {
  padding: 0.9rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.model-button,
.status-pill {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
}

.model-button {
  padding: 0.72rem 1rem;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.68rem 0.9rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.status-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: var(--green);
}

.chat-stage {
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto;
}

.chat-scroll {
  min-height: 0;
  overflow-y: auto;
  padding: 2rem 1.5rem 1rem;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 1.5rem;
}

.welcome-panel {
  width: min(100%, 760px);
  margin-top: min(10vh, 7rem);
  text-align: center;
}

.welcome-panel.is-hidden {
  display: none;
}

.welcome-mark {
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 1rem;
  border-radius: 999px;
  background: var(--green);
  color: #f7fffc;
  font-size: 1.2rem;
  box-shadow: 0 10px 30px rgba(16, 163, 127, 0.22);
}

.eyebrow {
  margin: 0 0 0.6rem;
  color: var(--green);
  font-size: 0.74rem;
  text-transform: uppercase;
}

.welcome-panel h1 {
  margin: 0 0 0.8rem;
  font-size: clamp(2.25rem, 5vw, 3.6rem);
  letter-spacing: -0.05em;
}

.welcome-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.suggestion-grid {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.suggestion-chip {
  padding: 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
  text-align: left;
}

.suggestion-chip strong,
.suggestion-chip span {
  display: block;
}

.suggestion-chip strong {
  margin-bottom: 0.4rem;
  font-size: 0.97rem;
}

.suggestion-chip span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.messages,
.typing-row {
  width: min(100%, 760px);
}

.messages {
  display: grid;
  gap: 1.6rem;
}

.message {
  width: 100%;
}

.message-assistant {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.message-user {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.9rem;
  align-items: start;
}

.avatar {
  width: 1.85rem;
  height: 1.85rem;
  border-radius: 999px;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.avatar-assistant {
  background: var(--green);
  color: #f7fffc;
}

.avatar-user {
  background: #5b5b5b;
  color: #f5f5f5;
  order: 2;
}

.message-bubble {
  min-width: 0;
}

.message-assistant .message-bubble {
  padding-top: 0.1rem;
}

.message-user .message-bubble {
  order: 1;
  justify-self: end;
  max-width: min(80%, 620px);
  padding: 0.9rem 1rem;
  border-radius: 22px;
  background: var(--surface);
}

.message-head {
  display: none;
}

.message-body {
  margin: 0;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.75;
}

.typing-row {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.9rem;
  align-items: center;
}

.typing-bubble {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: fit-content;
  padding: 0.72rem 0.9rem;
  border-radius: 999px;
  background: var(--surface-soft);
}

.typing-bubble span {
  width: 0.48rem;
  height: 0.48rem;
  border-radius: 999px;
  background: var(--green);
  animation: bounce 1s infinite ease-in-out;
}

.typing-bubble span:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-bubble span:nth-child(3) {
  animation-delay: 0.3s;
}

.composer {
  padding: 1rem 1.2rem 1.4rem;
}

.composer-box {
  width: min(100%, 820px);
  margin: 0 auto;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
}

.composer textarea {
  width: 100%;
  min-height: 56px;
  max-height: 220px;
  resize: none;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0.55rem 0.55rem 0.7rem;
  outline: none;
}

.composer textarea::placeholder {
  color: #868686;
}

.composer-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.composer-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.tool-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.84rem;
}

.send-button {
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 999px;
  background: var(--green);
  color: #f7fffc;
  font-weight: 700;
}

.send-button:hover {
  background: #0d8f70;
}

.send-button:disabled,
.new-chat-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.send-button:disabled {
  background: #2f6e60;
}

.composer-note {
  width: min(100%, 820px);
  margin: 0.7rem auto 0;
  text-align: center;
}

.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 bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.5;
  }

  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    grid-template-rows: auto auto auto auto;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .sidebar-footer {
    display: none;
  }
}

@media (max-width: 720px) {
  .chat-header {
    padding: 0.9rem 1rem;
  }

  .chat-scroll {
    padding: 1.25rem 1rem 0.75rem;
  }

  .welcome-panel {
    margin-top: 2rem;
  }

  .suggestion-grid {
    grid-template-columns: 1fr;
  }

  .message-assistant,
  .message-user,
  .typing-row {
    grid-template-columns: 1fr;
  }

  .avatar {
    display: none;
  }

  .message-user .message-bubble {
    max-width: 100%;
  }

  .composer {
    padding: 0.85rem 0.85rem 1.1rem;
  }

  .composer-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .composer-tools {
    justify-content: flex-start;
  }

  .send-button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}
