:root {
  --bg0: #e8f2ec;
  --bg1: #cfe3d6;
  --ink: #0b1f1a;
  --ink-soft: #35574c;
  --panel: rgba(255, 252, 247, 0.78);
  --panel-solid: #fffcf7;
  --line: rgba(11, 31, 26, 0.12);
  --accent: #1f8a5b;
  --accent-2: #96f28d;
  --accent-ink: #062319;
  --user: #12352b;
  --danger: #b42318;
  --shadow: 0 24px 60px rgba(11, 31, 26, 0.12);
  --radius: 22px;
  --font-display: "Syne", sans-serif;
  --font-body: "Manrope", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg0);
}

body {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 280px 1fr;
  overflow: hidden;
}

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

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(90% 70% at 12% -10%, #96f28d 0%, transparent 55%),
    radial-gradient(70% 60% at 100% 0%, #7eb8ff 0%, transparent 45%),
    radial-gradient(50% 40% at 70% 100%, #f3c96b 0%, transparent 50%),
    linear-gradient(160deg, var(--bg0), var(--bg1));
  animation: drift 18s ease-in-out infinite alternate;
}

@keyframes drift {
  from { filter: hue-rotate(0deg) saturate(1); transform: scale(1); }
  to { filter: hue-rotate(12deg) saturate(1.08); transform: scale(1.04); }
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.55);
  backdrop-filter: blur(18px);
  min-height: 100dvh;
}

.sidebar-top,
.topbar,
.settings header,
.settings-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.brand,
.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: 0;
}

.brand-name,
.topbar-brand strong,
.hero h1,
.settings h2 {
  font-family: var(--font-display);
  letter-spacing: -0.04em;
}

.brand-name {
  font-size: 1.2rem;
  font-weight: 800;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--accent-2);
  font-family: var(--font-display);
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(11, 31, 26, 0.25);
}

.brand-mark.sm {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  font-size: 0.85rem;
}

.ghost-btn,
.primary-btn,
.icon-btn,
.suggestions button,
.composer button {
  border: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.7);
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.ghost-btn:hover,
.icon-btn:hover,
.suggestions button:hover,
.composer button:hover,
.primary-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 138, 91, 0.45);
  background: #fff;
}

.ghost-btn.sm {
  padding: 8px 12px;
  font-size: 0.9rem;
}

.primary-btn,
.composer button {
  background: var(--ink);
  color: var(--accent-2);
  border-color: transparent;
}

.icon-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: grid;
  place-items: center;
}

.chat-list {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-right: 4px;
}

.chat-item {
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 14px;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--ink-soft);
}

.chat-item.active,
.chat-item:hover {
  background: rgba(11, 31, 26, 0.06);
  color: var(--ink);
}

.shell {
  min-width: 0;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  display: none;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.65);
  backdrop-filter: blur(16px);
}

.stage {
  overflow: auto;
  padding: 28px 20px 12px;
}

.hero {
  max-width: 760px;
  margin: 8vh auto 0;
  text-align: center;
  animation: rise 0.7s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--ink-soft);
  font-weight: 700;
}

.hero h1 {
  margin: 0;
  font-size: clamp(3.4rem, 10vw, 6.4rem);
  line-height: 0.9;
  font-weight: 800;
}

.lede {
  margin: 18px auto 0;
  max-width: 34rem;
  font-size: 1.12rem;
  line-height: 1.55;
  color: var(--ink-soft);
}

.suggestions {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.suggestions button {
  border-radius: 18px;
  text-align: left;
  padding: 14px 16px;
  line-height: 1.35;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.messages {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-bottom: 18px;
}

.msg {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  animation: rise 0.35s ease both;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
}

.msg.user .avatar {
  background: var(--user);
  color: #dfffe0;
}

.msg.assistant .avatar {
  background: var(--accent-2);
  color: var(--accent-ink);
}

.bubble {
  min-width: 0;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  line-height: 1.6;
  box-shadow: 0 10px 30px rgba(11, 31, 26, 0.05);
}

.msg.user .bubble {
  background: rgba(18, 53, 43, 0.92);
  color: #f4fff6;
  border-color: transparent;
}

.bubble p { margin: 0 0 0.8em; }
.bubble p:last-child { margin-bottom: 0; }
.bubble pre {
  overflow: auto;
  padding: 12px;
  border-radius: 12px;
  background: rgba(11, 31, 26, 0.08);
}
.msg.user .bubble pre { background: rgba(255, 255, 255, 0.08); }
.bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

.typing::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: currentColor;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink {
  50% { opacity: 0; }
}

.composer-wrap {
  padding: 10px 16px 18px;
}

.composer {
  max-width: 820px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border-radius: 28px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.composer textarea {
  width: 100%;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  max-height: 180px;
  padding: 10px 8px;
  line-height: 1.45;
}

.composer button {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  font-size: 1.2rem;
  font-weight: 700;
}

.composer button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.fineprint {
  max-width: 820px;
  margin: 10px auto 0;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.settings {
  width: min(520px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 0;
  background: var(--panel-solid);
  box-shadow: var(--shadow);
}

.settings::backdrop {
  background: rgba(11, 31, 26, 0.35);
  backdrop-filter: blur(6px);
}

.settings form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}

.settings label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.92rem;
  font-weight: 600;
}

.settings input,
.settings textarea {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
  font-weight: 500;
}

.hint {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.45;
}

.sidebar-foot {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    z-index: 30;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .topbar {
    display: flex;
  }

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

  .hero {
    margin-top: 4vh;
  }
}

@media (min-width: 901px) {
  #closeSidebar {
    display: none;
  }
}
