:root {
  --ink: #0b1220;
  --ink-2: #111a2e;
  --paper: #f6f8fb;
  --card: #ffffff;
  --line: #e2e7f0;
  --line-2: #2a3552;
  --muted: #5b6577;
  --muted-2: #93a0b8;
  --accent: #1f4bff;
  --accent-ink: #1436d8;
  --accent-soft: #eaefff;
  --signal: #c6f24e;
  --radius: 14px;
  --maxw: 980px;
  --font: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 0% -10%, rgba(31, 75, 255, 0.12), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(198, 242, 78, 0.14), transparent 50%),
    var(--paper);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
}

.mono { font-family: var(--mono); font-weight: 500; }

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.95rem 1.25rem;
  background: rgba(246, 248, 251, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.nav-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.nav-link:hover { text-decoration: underline; }

.brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.logo-mark {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.brand-name span { color: var(--accent); }

.brand-sub {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 1.4rem 1.25rem 2.2rem;
  display: grid;
  gap: 1rem;
}

.hero {
  animation: rise 0.45s ease both;
}

.hero h1 {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin-bottom: 0.45rem;
}

.lead {
  max-width: 38rem;
  color: var(--muted);
  font-size: 1.02rem;
}

.chat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 50px -28px rgba(11, 18, 32, 0.35);
  min-height: min(66vh, 700px);
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  animation: rise 0.55s ease 0.05s both;
}

.chat-head {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.05rem;
  background: var(--ink);
  color: #fff;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--signal);
}

.status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 3px rgba(198, 242, 78, 0.22);
  animation: pulse 1.8s ease infinite;
}

.messages {
  padding: 1.1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background:
    linear-gradient(180deg, #fbfcff 0%, var(--card) 40%);
}

.msg {
  max-width: min(85%, 640px);
  padding: 0.85rem 1rem;
  border-radius: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  animation: pop 0.28s ease;
}

.msg.bot {
  align-self: flex-start;
  background: var(--accent-soft);
  border: 1px solid #d7e0ff;
  color: var(--ink);
}

.msg.user {
  align-self: flex-end;
  background: var(--ink);
  color: #f5f7fb;
}

.msg .meta {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.62;
  margin-bottom: 0.3rem;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem;
  padding: 0.9rem;
  border-top: 1px solid var(--line);
  background: #fbfcff;
}

.confirm-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0.75rem 0.9rem 0;
  background: #fbfcff;
  border-top: 1px solid var(--line);
}

.confirm-bar.hidden { display: none; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0 1rem;
  min-height: 44px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.btn-ghost.hidden { display: none; }

.btn-primary.hidden { display: none; }

.btn-ghost:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
}

.composer input {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0.9rem 1rem;
  font: inherit;
  outline: none;
  background: #fff;
  color: var(--ink);
}

.composer input:focus {
  border-color: rgba(31, 75, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(31, 75, 255, 0.14);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  border: 0;
  border-radius: 11px;
  padding: 0 1.15rem;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(31, 75, 255, 0.28);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.2s ease;
}

.btn-primary:hover {
  background: var(--accent-ink);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(31, 75, 255, 0.36);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.arrow {
  font-family: var(--mono);
  font-weight: 700;
}

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

@keyframes pop {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

@media (max-width: 720px) {
  .top {
    position: static;
  }

  .chat { min-height: 62vh; }

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

  .btn-primary { justify-content: center; min-height: 48px; }
}
