:root {
  --bg: #f6efe4;
  --panel: rgba(255, 251, 245, 0.88);
  --panel-strong: rgba(255, 248, 240, 0.96);
  --line: rgba(35, 44, 60, 0.12);
  --text: #1f2430;
  --muted: #5c6474;
  --accent: #d6613c;
  --accent-strong: #b44526;
  --accent-soft: rgba(214, 97, 60, 0.14);
  --assistant: #fff7ef;
  --user: #17344f;
  --shadow: 0 24px 60px rgba(39, 31, 20, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  font-family: "Noto Sans SC", sans-serif;
  color: var(--text);
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(255, 196, 133, 0.65), transparent 28%),
    radial-gradient(circle at right center, rgba(123, 181, 170, 0.32), transparent 32%),
    linear-gradient(135deg, #f8f1e8 0%, #f6efe4 42%, #efe7da 100%);
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(12px);
}

body::before {
  width: 220px;
  height: 220px;
  right: 8%;
  top: 10%;
  background: rgba(214, 97, 60, 0.12);
}

body::after {
  width: 280px;
  height: 280px;
  left: -80px;
  bottom: -80px;
  background: rgba(82, 154, 140, 0.14);
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto;
  height: calc(100dvh - 48px);
  min-height: 0;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
}

.panel {
  position: relative;
  z-index: 1;
  min-height: 0;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.intro-panel {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: auto;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  color: var(--accent-strong);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.02;
}

h2 {
  font-size: 1.35rem;
}

.lede {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.stack-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.guide-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.8;
}

.field-heading,
.meta-card div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.field-heading span,
.meta-card span,
.field-tip,
.composer-footer p {
  color: var(--muted);
  font-size: 0.92rem;
}

.key-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(28, 36, 48, 0.14);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  border-radius: 16px;
  padding: 14px 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(214, 97, 60, 0.55);
  box-shadow: 0 0 0 4px rgba(214, 97, 60, 0.12);
}

textarea {
  min-height: 132px;
  resize: vertical;
  line-height: 1.7;
}

button {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.ghost-button {
  background: rgba(20, 35, 48, 0.08);
  color: var(--text);
}

.primary-button {
  background: linear-gradient(135deg, var(--accent) 0%, #e78253 100%);
  color: #fff;
  box-shadow: 0 14px 28px rgba(214, 97, 60, 0.24);
}

.chat-panel {
  padding: 22px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: 16px;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.chat-header,
.composer-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.status-banner {
  min-height: 24px;
  color: var(--muted);
  font-size: 0.95rem;
}

.status-banner.is-error {
  color: #a33030;
}

.chat-list {
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(28, 36, 48, 0.08);
  border-radius: 24px;
  padding: 18px;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.intro-panel::-webkit-scrollbar,
.chat-list::-webkit-scrollbar {
  width: 10px;
}

.intro-panel::-webkit-scrollbar-track,
.chat-list::-webkit-scrollbar-track {
  background: rgba(20, 35, 48, 0.05);
  border-radius: 999px;
}

.intro-panel::-webkit-scrollbar-thumb,
.chat-list::-webkit-scrollbar-thumb {
  background: rgba(214, 97, 60, 0.42);
  border-radius: 999px;
}

.intro-panel::-webkit-scrollbar-thumb:hover,
.chat-list::-webkit-scrollbar-thumb:hover {
  background: rgba(214, 97, 60, 0.62);
}

.welcome-card {
  padding: 20px;
  border-radius: 22px;
  background: linear-gradient(135deg, rgba(255, 245, 232, 0.96), rgba(255, 252, 247, 0.92));
  border: 1px solid rgba(214, 97, 60, 0.12);
}

.welcome-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.message {
  max-width: min(720px, 88%);
  padding: 16px 18px;
  border-radius: 20px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid transparent;
}

.message--assistant {
  align-self: flex-start;
  background: var(--assistant);
  border-color: rgba(214, 97, 60, 0.16);
}

.message--user {
  align-self: flex-end;
  background: var(--user);
  color: #f5f8fb;
}

.message-meta {
  display: block;
  margin-bottom: 8px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.72;
}

.loading-bubble {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.loading-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: bounce 1.05s infinite ease-in-out;
}

.loading-dot:nth-child(2) {
  animation-delay: 0.12s;
}

.loading-dot:nth-child(3) {
  animation-delay: 0.24s;
}

.prompt-chip-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.prompt-chip {
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  border: 1px solid rgba(28, 36, 48, 0.1);
  padding: 10px 14px;
}

.composer-form {
  background: rgba(255, 252, 247, 0.92);
  border: 1px solid rgba(28, 36, 48, 0.1);
  border-radius: 24px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.composer-form label {
  font-weight: 600;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: scale(0.85);
    opacity: 0.45;
  }

  40% {
    transform: scale(1.15);
    opacity: 1;
  }
}

@media (max-width: 960px) {
  .page-shell {
    width: min(100% - 24px, 100%);
    height: calc(100dvh - 24px);
    grid-template-columns: 1fr;
    grid-template-rows: minmax(250px, 0.9fr) minmax(0, 1.1fr);
  }

  .chat-panel {
    height: 100%;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: calc(100% - 16px);
    height: calc(100dvh - 16px);
    margin: 8px auto;
    grid-template-rows: minmax(220px, 0.85fr) minmax(0, 1.15fr);
  }

  .intro-panel,
  .chat-panel {
    padding: 18px;
    border-radius: 22px;
  }

  .chat-header,
  .composer-footer,
  .field-heading,
  .meta-card div {
    flex-direction: column;
    align-items: flex-start;
  }

  .message {
    max-width: 100%;
  }

  .key-row {
    grid-template-columns: 1fr;
  }
}
