:root {
  --bg-1: #f3efe6;
  --bg-2: #d9e7db;
  --ink: #1b1f1c;
  --ink-soft: #3c4440;
  --panel: #fffaf2;
  --accent: #e4572e;
  --accent-2: #1b998b;
  --accent-3: #0f6466;
  --shadow: 0 22px 45px rgba(27, 31, 28, 0.14);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 15% 15%, #f7f2e8 0%, var(--bg-1) 50%, var(--bg-2) 100%);
  min-height: 100vh;
}

body::before,
body::after {
  content: "";
  position: fixed;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  z-index: -1;
  filter: blur(0);
  opacity: 0.35;
}

body::before {
  background: radial-gradient(circle, rgba(27, 153, 139, 0.35), transparent 70%);
  top: -120px;
  right: -80px;
}

body::after {
  background: radial-gradient(circle, rgba(228, 87, 46, 0.35), transparent 70%);
  bottom: -120px;
  left: -100px;
}

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.hero {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  animation: rise 0.6s ease;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.72rem;
  color: var(--accent-3);
  margin-bottom: 12px;
}

h1 {
  font-family: "Fraunces", serif;
  font-size: clamp(2.2rem, 4vw, 3.2rem);
  margin: 0 0 8px;
}

.lead {
  max-width: 520px;
  color: var(--ink-soft);
  margin: 0;
  font-size: 1.05rem;
}

.hero-badges {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.badge {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(27, 153, 139, 0.12);
  color: var(--accent-3);
  font-weight: 600;
  font-size: 0.85rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.6fr);
  gap: 24px;
}

.panel {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  border: 1px solid rgba(27, 31, 28, 0.05);
  animation: rise 0.7s ease;
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 1.2rem;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  min-height: 560px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.status {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  background: rgba(27, 31, 28, 0.08);
}

.status[data-tone="good"] {
  background: rgba(27, 153, 139, 0.18);
  color: var(--accent-3);
}

.status[data-tone="bad"] {
  background: rgba(228, 87, 46, 0.18);
  color: var(--accent);
}

.status[data-tone="warn"] {
  background: rgba(246, 178, 107, 0.22);
  color: #8a4b10;
}

.chat {
  flex: 1;
  background: #f6f0e4;
  border-radius: 14px;
  padding: 18px;
  overflow-y: auto;
  border: 1px solid rgba(27, 31, 28, 0.08);
}

.message {
  padding: 12px 14px;
  border-radius: 14px;
  margin-bottom: 12px;
  max-width: 85%;
  animation: pop 0.4s ease;
}

.message-meta {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
  color: rgba(27, 31, 28, 0.6);
}

.message-body {
  white-space: pre-wrap;
}

.message-user {
  margin-left: auto;
  background: rgba(27, 153, 139, 0.18);
  border: 1px solid rgba(27, 153, 139, 0.35);
}

.message-assistant {
  margin-right: auto;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(27, 31, 28, 0.08);
}

.message-system {
  margin: 0 auto 12px;
  text-align: center;
  background: rgba(228, 87, 46, 0.12);
  border: 1px dashed rgba(228, 87, 46, 0.35);
  max-width: 100%;
}

.typing .message-body {
  display: flex;
  gap: 6px;
}

.typing .message-body span {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--accent-2);
  border-radius: 50%;
  animation: pulse 1s infinite ease-in-out;
}

.typing .message-body span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing .message-body span:nth-child(3) {
  animation-delay: 0.4s;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  margin-top: 16px;
}

textarea,
input,
select {
  font-family: "Space Grotesk", sans-serif;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(27, 31, 28, 0.15);
  background: #fff;
  font-size: 0.95rem;
}

textarea {
  min-height: 90px;
  resize: vertical;
}

button {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(228, 87, 46, 0.3);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(228, 87, 46, 0.4);
}

.controls-panel label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 6px;
  color: var(--ink-soft);
}

.controls-panel input,
.controls-panel select {
  width: 100%;
  margin-bottom: 14px;
}

.controls-panel button {
  width: 100%;
  margin-top: 6px;
}

.note {
  margin-top: 14px;
  font-size: 0.85rem;
  color: rgba(27, 31, 28, 0.7);
  line-height: 1.4;
}

.footer {
  margin-top: 28px;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(27, 31, 28, 0.6);
}

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

@keyframes pop {
  from {
    transform: scale(0.97);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  50% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

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

  .hero {
    flex-direction: column;
    align-items: flex-start;
  }
}
