:root {
  color-scheme: light;
  --bg: #f6f3ec;
  --panel: rgba(255, 252, 244, 0.82);
  --panel-solid: #fffaf0;
  --ink: #201b15;
  --muted: #756b5f;
  --line: rgba(64, 45, 24, 0.12);
  --accent: #146c5c;
  --accent-2: #d97a3e;
  --bubble-user: #173f37;
  --bubble-user-text: #fffaf0;
  --bubble-assistant: #ffffff;
  --shadow: 0 24px 80px rgba(78, 54, 25, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Trebuchet MS", "Avenir Next", Verdana, sans-serif;
  background:
    radial-gradient(circle at 16% 12%, rgba(217, 122, 62, 0.22), transparent 28%),
    radial-gradient(circle at 84% 16%, rgba(20, 108, 92, 0.2), transparent 24%),
    linear-gradient(135deg, #f8f0df 0%, #f2efe8 44%, #eaf2ed 100%);
}

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

.shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: 100vh;
  padding: 18px;
  gap: 18px;
}

.sidebar,
.main {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.sidebar {
  border-radius: 30px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-dot {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background:
    linear-gradient(135deg, var(--accent), #4fc4a9),
    var(--accent);
  box-shadow: 0 10px 24px rgba(20, 108, 92, 0.28);
}

.brand strong {
  display: block;
  font-size: 18px;
}

.brand small,
.hint,
.eyebrow {
  color: var(--muted);
}

.new-chat,
.ghost,
.composer button {
  border: 0;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.new-chat {
  width: 100%;
  padding: 14px 18px;
  border-radius: 18px;
  color: #fffaf0;
  background: linear-gradient(135deg, var(--accent), #1d8a76);
  box-shadow: 0 16px 30px rgba(20, 108, 92, 0.22);
}

.new-chat:hover,
.composer button:hover,
.ghost:hover {
  transform: translateY(-1px);
}

.control {
  display: grid;
  gap: 8px;
}

.control label {
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.control select,
.control input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 13px 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  outline: none;
}

.hidden {
  display: none;
}

.hint {
  margin-top: auto;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.52);
  line-height: 1.7;
  font-size: 13px;
}

.main {
  min-width: 0;
  border-radius: 34px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.topbar {
  padding: 28px 32px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 48px);
  letter-spacing: -0.06em;
}

.ghost {
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.56);
  padding: 11px 16px;
  border-radius: 999px;
}

.messages {
  overflow-y: auto;
  padding: 20px 32px 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.welcome {
  align-self: center;
  width: min(580px, 100%);
  margin-top: 8vh;
  padding: 34px;
  border-radius: 32px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.38)),
    var(--panel-solid);
  border: 1px solid var(--line);
}

.welcome span {
  display: inline-flex;
  padding: 8px 13px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(20, 108, 92, 0.1);
  font-weight: 800;
  font-size: 12px;
}

.welcome h2 {
  margin: 18px 0 10px;
  font-size: clamp(28px, 5vw, 54px);
  letter-spacing: -0.07em;
}

.message {
  display: grid;
  gap: 7px;
  max-width: min(820px, 92%);
  animation: rise 0.24s ease both;
}

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

.message.assistant {
  align-self: flex-start;
}

.role {
  font-size: 12px;
  color: var(--muted);
  padding: 0 10px;
}

.bubble {
  border-radius: 24px;
  padding: 16px 18px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}

.user .bubble {
  color: var(--bubble-user-text);
  background: var(--bubble-user);
  border-bottom-right-radius: 8px;
}

.assistant .bubble {
  background: var(--bubble-assistant);
  border: 1px solid var(--line);
  border-bottom-left-radius: 8px;
}

.bubble code {
  padding: 2px 5px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.06);
}

.composer {
  margin: 0 28px 28px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
}

.composer textarea {
  resize: none;
  min-height: 50px;
  max-height: 180px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  padding: 14px;
  line-height: 1.55;
}

.composer button {
  min-height: 50px;
  padding: 0 22px;
  border-radius: 18px;
  color: #fffaf0;
  background: linear-gradient(135deg, var(--accent-2), #ff9b70);
  font-weight: 800;
}

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

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

@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    padding: 10px;
  }

  .sidebar {
    border-radius: 24px;
  }

  .main {
    min-height: 78vh;
    border-radius: 26px;
  }

  .topbar,
  .messages {
    padding-left: 18px;
    padding-right: 18px;
  }

  .composer {
    margin: 0 14px 14px;
    grid-template-columns: 1fr;
  }

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