:root {
  --accent: #4f46e5;
  --accent-dark: #4338ca;
  --ink: #1f2330;
  --ink-soft: #5b6072;
  --bg: #f6f7fb;
  --panel: #ffffff;
  --border: #e5e7f0;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.hero {
  background: linear-gradient(135deg, #4f46e5 0%, #6366f1 45%, #818cf8 100%);
  color: #fff;
  padding: 88px 24px 96px;
}
.hero-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}
.eyebrow {
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 700;
  opacity: 0.85;
  margin: 0 0 12px;
}
.hero h1 {
  font-size: 40px;
  line-height: 1.3;
  margin: 0 0 20px;
}
.lead {
  font-size: 16px;
  line-height: 1.8;
  opacity: 0.95;
  margin: 0 0 8px;
}
.lead.sub { font-size: 14px; opacity: 0.85; }

.content {
  max-width: 960px;
  margin: -48px auto 80px;
  padding: 0 24px;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.feature-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 12px 32px rgba(31,35,48,0.08);
}
.feature-card h3 {
  margin: 0 0 10px;
  font-size: 16px;
}
.feature-card p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--ink-soft);
}

@media (max-width: 720px) {
  .hero { padding: 64px 20px 80px; }
  .hero h1 { font-size: 30px; }
  .feature-grid { grid-template-columns: 1fr; }
}

/* ---------- chat widget ---------- */
#chat-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  font-family: inherit;
}

#chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(79,70,229,0.4);
  transition: transform 0.15s ease, background 0.15s ease;
}
#chat-toggle:hover { background: var(--accent-dark); transform: scale(1.05); }
#chat-toggle svg { width: 26px; height: 26px; }

#chat-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 140px);
  background: var(--panel);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(31,35,48,0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
#chat-widget.open #chat-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.chat-header {
  background: var(--accent);
  color: #fff;
  padding: 16px 18px;
}
.chat-header-title { display: flex; align-items: center; gap: 10px; }
.chat-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.chat-name { font-size: 14px; font-weight: 700; }
.chat-status { font-size: 11px; opacity: 0.85; }
.chat-status::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #4ade80;
  margin-right: 5px;
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.msg {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.msg.bot {
  align-self: flex-start;
  background: #f0f1f8;
  color: var(--ink);
  border-bottom-left-radius: 4px;
}
.msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.error {
  align-self: flex-start;
  background: #fee2e2;
  color: #b91c1c;
}

.chat-typing {
  padding: 0 16px 8px;
  display: flex;
  gap: 4px;
}
.chat-typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #b7bacb;
  animation: bounce 1.2s infinite ease-in-out;
}
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

#chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border);
}
#chat-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 13.5px;
  outline: none;
  font-family: inherit;
}
#chat-input:focus { border-color: var(--accent); }
#chat-form button {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
#chat-form button svg { width: 18px; height: 18px; }
#chat-form button:disabled { opacity: 0.5; cursor: default; }
