:root {
  color-scheme: light;
  --bg: #f6efe5;
  --bg-deep: #f0e4d5;
  --card: rgba(255, 252, 247, 0.78);
  --card-strong: rgba(255, 248, 239, 0.96);
  --text: #26160d;
  --muted: #70584a;
  --accent: #b64926;
  --accent-deep: #7d2b13;
  --accent-soft: #f2c6ae;
  --line: rgba(76, 42, 22, 0.12);
  --shadow: 0 24px 80px rgba(83, 44, 20, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --font-ui: "Manrope", "Noto Sans SC", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-ui);
  background:
    radial-gradient(circle at top left, rgba(255, 205, 178, 0.9), transparent 34%),
    radial-gradient(circle at bottom right, rgba(212, 158, 110, 0.35), transparent 28%),
    linear-gradient(135deg, var(--bg), var(--bg-deep));
  color: var(--text);
}

button,
textarea {
  font: inherit;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding: 40px 20px;
}

.aurora {
  position: absolute;
  border-radius: 999px;
  filter: blur(60px);
  opacity: 0.55;
  pointer-events: none;
}

.aurora-one {
  top: -80px;
  left: -40px;
  width: 260px;
  height: 260px;
  background: rgba(238, 130, 98, 0.35);
}

.aurora-two {
  right: -50px;
  bottom: 60px;
  width: 320px;
  height: 320px;
  background: rgba(189, 140, 74, 0.22);
}

.app-card {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 24px;
}

.hero,
.chat-card {
  backdrop-filter: blur(20px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero {
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 680px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.3rem, 5vw, 3.7rem);
  line-height: 0.95;
}

.hero-text {
  margin: 18px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.hero-meta {
  display: grid;
  gap: 14px;
}

.meta-item {
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: var(--card-strong);
  border: 1px solid rgba(98, 55, 30, 0.1);
}

.meta-item span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.meta-item strong {
  display: block;
  font-size: 1.05rem;
  line-height: 1.4;
}

.chat-card {
  display: flex;
  flex-direction: column;
  min-height: 680px;
  padding: 20px;
}

.chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 8px 18px;
}

.chat-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.chat-header p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.ghost-button {
  border: 1px solid rgba(90, 51, 30, 0.14);
  background: rgba(255, 255, 255, 0.45);
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.ghost-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.7);
}

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 10px 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(84%, 720px);
  animation: rise 200ms ease;
}

.message-role {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.message-bubble {
  padding: 16px 18px;
  border-radius: 22px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid transparent;
}

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

.message.user .message-bubble {
  background: linear-gradient(135deg, #d9673c, #b64926);
  color: #fffaf6;
  border-bottom-right-radius: 8px;
}

.message.assistant .message-bubble,
.message.system .message-bubble {
  background: rgba(255, 251, 246, 0.92);
  border-color: rgba(102, 58, 28, 0.08);
  color: var(--text);
  border-bottom-left-radius: 8px;
}

.message.assistant.is-streaming .message-bubble::after {
  content: "";
  display: inline-block;
  width: 0.65ch;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: -0.16em;
  background: rgba(182, 73, 38, 0.85);
  animation: blink 0.9s steps(1, end) infinite;
}

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

.message.system .message-bubble {
  background: rgba(253, 239, 222, 0.92);
  color: var(--accent-deep);
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-top: 18px;
  padding: 12px;
  border-radius: 24px;
  background: var(--card-strong);
  border: 1px solid rgba(92, 50, 27, 0.1);
}

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

.composer textarea::placeholder {
  color: rgba(97, 70, 53, 0.7);
}

.composer button {
  border: none;
  border-radius: 18px;
  min-width: 112px;
  min-height: 56px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fffdfb;
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease;
}

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

.composer button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.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 rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

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

  .hero,
  .chat-card {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 18px 12px;
  }

  .hero,
  .chat-card {
    border-radius: 22px;
  }

  .chat-header {
    flex-direction: column;
  }

  .message {
    max-width: 100%;
  }

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

  .composer button {
    width: 100%;
  }
}
