:root {
  color-scheme: dark;
  --ink: #f2f5ef;
  --muted: #9aa9a1;
  --panel: rgba(16, 27, 23, 0.92);
  --panel-soft: rgba(25, 42, 35, 0.72);
  --line: rgba(223, 240, 230, 0.12);
  --accent: #b8f252;
  --accent-strong: #d5ff87;
  --accent-ink: #17220f;
  --warning: #ffcf70;
  --danger: #ff7c73;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.38);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 5%, rgba(104, 145, 98, 0.2), transparent 36rem),
    linear-gradient(145deg, #0a100e 0%, #111b17 48%, #0c1512 100%);
  overflow-x: hidden;
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.ambient {
  position: fixed;
  width: 22rem;
  height: 22rem;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.16;
  pointer-events: none;
}

.ambient-one {
  top: -8rem;
  right: 10%;
  background: var(--accent);
}

.ambient-two {
  bottom: -10rem;
  left: 5%;
  background: #4ebd98;
}

.shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(18rem, 0.72fr) minmax(0, 1.55fr);
  width: min(1180px, calc(100% - 2rem));
  min-height: min(820px, calc(100vh - 3rem));
  margin: 1.5rem auto;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(9, 16, 13, 0.75);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2rem;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(30, 50, 41, 0.76), rgba(15, 27, 22, 0.88)),
    repeating-linear-gradient(135deg, transparent 0 18px, rgba(255, 255, 255, 0.016) 18px 19px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 2.55rem;
  height: 2.55rem;
  place-items: center;
  border-radius: 12px;
  color: var(--accent-ink);
  background: var(--accent);
  font-weight: 900;
  box-shadow: 0 0 28px rgba(184, 242, 82, 0.24);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  letter-spacing: -0.02em;
}

.brand small {
  margin-top: 0.12rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.intro {
  margin-top: clamp(3.5rem, 9vh, 7.5rem);
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.intro h1 {
  max-width: 11ch;
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.75rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.intro > p:last-child {
  max-width: 31rem;
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.65;
}

.capabilities {
  display: grid;
  gap: 0.65rem;
  margin-top: 2rem;
}

.capability {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.82rem;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.025);
}

.capability-icon {
  display: grid;
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border-radius: 9px;
  color: var(--accent-ink);
  background: var(--accent);
  font-size: 0.65rem;
  font-weight: 900;
}

.capability.pending .capability-icon {
  color: var(--warning);
  background: rgba(255, 207, 112, 0.11);
}

.capability strong,
.capability small {
  display: block;
}

.capability strong {
  font-size: 0.82rem;
}

.capability small {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.7rem;
}

.privacy-note {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 2rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.privacy-note span {
  color: var(--accent);
  font-size: 0.58rem;
  text-shadow: 0 0 12px var(--accent);
}

.chat-panel {
  display: grid;
  grid-template-rows: auto auto minmax(16rem, 1fr) auto auto auto;
  min-width: 0;
  background: var(--panel);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem 1.6rem;
  border-bottom: 1px solid var(--line);
}

.agent {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.agent-avatar,
.message-avatar {
  display: grid;
  place-items: center;
  border: 1px solid rgba(184, 242, 82, 0.32);
  color: var(--accent);
  background: rgba(184, 242, 82, 0.08);
  font-weight: 900;
}

.agent-avatar {
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 14px;
  font-size: 0.75rem;
}

.agent strong {
  font-size: 0.91rem;
}

.connection-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.7rem;
}

.status-dot {
  width: 0.46rem;
  height: 0.46rem;
  border-radius: 50%;
  background: var(--warning);
}

.status-dot.online {
  background: var(--accent);
  box-shadow: 0 0 10px rgba(184, 242, 82, 0.75);
}

.status-dot.offline {
  background: var(--danger);
}

.status-dot.checking {
  animation: pulse 1.2s ease-in-out infinite;
}

.ghost-button {
  padding: 0.62rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 0.72rem;
  transition: 160ms ease;
}

.ghost-button:hover {
  color: var(--ink);
  border-color: rgba(223, 240, 230, 0.25);
  background: rgba(255, 255, 255, 0.035);
}

.notice {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 1rem 1.6rem 0;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(255, 207, 112, 0.15);
  border-radius: 12px;
  color: #d6ccba;
  background: rgba(255, 207, 112, 0.045);
  font-size: 0.72rem;
}

.notice-badge {
  padding: 0.2rem 0.42rem;
  border-radius: 6px;
  color: #211b0e;
  background: var(--warning);
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.messages {
  min-height: 0;
  padding: 1.5rem 1.6rem;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.message {
  display: flex;
  align-items: flex-end;
  gap: 0.65rem;
  max-width: min(88%, 42rem);
  margin-bottom: 1.25rem;
  animation: enter 220ms ease-out both;
}

.message.user {
  flex-direction: row-reverse;
  margin-left: auto;
}

.message-avatar {
  flex: 0 0 auto;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 9px;
  font-size: 0.62rem;
}

.message.user .message-avatar {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
}

.bubble {
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 17px 17px 17px 5px;
  background: var(--panel-soft);
}

.message.user .bubble {
  color: var(--accent-ink);
  border-color: transparent;
  border-radius: 17px 17px 5px;
  background: var(--accent);
}

.bubble p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.58;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-meta {
  display: block;
  margin-top: 0.48rem;
  color: var(--muted);
  font-size: 0.62rem;
}

.message.user .message-meta {
  color: rgba(23, 34, 15, 0.62);
  text-align: right;
}

.typing-dots {
  display: inline-flex;
  gap: 0.26rem;
  padding: 0.25rem 0;
}

.typing-dots span {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--muted);
  animation: bounce 1.1s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 120ms;
}

.typing-dots span:nth-child(3) {
  animation-delay: 240ms;
}

.suggestions {
  display: flex;
  gap: 0.55rem;
  padding: 0 1.6rem 0.85rem;
  overflow-x: auto;
}

.suggestions button {
  flex: 0 0 auto;
  padding: 0.55rem 0.72rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #b4c0ba;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
  font-size: 0.69rem;
  transition: 150ms ease;
}

.suggestions button:hover {
  color: var(--accent-strong);
  border-color: rgba(184, 242, 82, 0.25);
  background: rgba(184, 242, 82, 0.05);
}

.composer {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  margin: 0 1.6rem;
  padding: 0.7rem;
  border: 1px solid rgba(223, 240, 230, 0.16);
  border-radius: 17px;
  background: rgba(5, 11, 9, 0.52);
  transition: 160ms ease;
}

.composer:focus-within {
  border-color: rgba(184, 242, 82, 0.42);
  box-shadow: 0 0 0 3px rgba(184, 242, 82, 0.06);
}

.composer textarea {
  flex: 1;
  min-height: 2.5rem;
  max-height: 8rem;
  padding: 0.65rem;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 0.86rem;
  line-height: 1.45;
}

.composer textarea::placeholder {
  color: #6f7c75;
}

.send-button {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.55rem;
  padding: 0 0.95rem;
  border: 0;
  border-radius: 12px;
  color: var(--accent-ink);
  background: var(--accent);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 800;
  transition: 150ms ease;
}

.send-button:hover:not(:disabled) {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.send-button:disabled {
  cursor: wait;
  opacity: 0.45;
}

.arrow {
  font-size: 0.9rem;
}

.disclaimer {
  margin: 0.75rem 1.6rem 1.1rem;
  color: #66736c;
  font-size: 0.62rem;
  text-align: center;
}

.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 pulse {
  50% { opacity: 0.35; }
}

@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-4px); opacity: 1; }
}

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

@media (max-width: 820px) {
  .shell {
    grid-template-columns: 1fr;
    min-height: calc(100vh - 1rem);
    width: calc(100% - 1rem);
    margin: 0.5rem;
    border-radius: 20px;
  }

  .sidebar {
    display: none;
  }

  .chat-panel {
    min-height: calc(100vh - 1rem);
  }
}

@media (max-width: 520px) {
  .chat-header,
  .messages {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .notice,
  .composer {
    margin-left: 1rem;
    margin-right: 1rem;
  }

  .suggestions {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .ghost-button {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    overflow: hidden;
    color: transparent;
  }

  .ghost-button::after {
    content: "↻";
    display: grid;
    width: 100%;
    height: 100%;
    place-items: center;
    color: var(--muted);
    font-size: 1.2rem;
  }

  .message {
    max-width: 95%;
  }

  .send-button span:first-child {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

