:root {
  --orange: #FF4103;
  --orange-dark: #D9370A;
  --orange-light: #FF6A13;
  --orange-soft: #FFEAD9;
  --orange-cream: #FFF8F4;
  --blue: #00A1FF;
  --ink: #212529;
  --ink-soft: #4A5560;
  --muted: #6B7280;
  --bg: #FAFAFA;
  --white: #ffffff;
  --border: #F0E4D8;
  --shadow: 0 6px 24px rgba(255, 65, 3, 0.08);
  --shadow-sm: 0 2px 6px rgba(33, 37, 41, 0.06);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-weight: 400;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.orange { color: var(--orange); }

/* ---------- Site header ---------- */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.1rem 2rem;
  background: white;
  border-bottom: 1px solid var(--border);
}
.site-logo img { height: 40px; display: block; }
.site-logo.small img { height: 32px; }
.site-tagline {
  color: var(--orange); font-weight: 600; font-size: .85rem;
  letter-spacing: .01em;
}
.site-tagline sup { font-size: .55em; }

/* ---------- Landing ---------- */
.hero {
  min-height: calc(100vh - 130px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 3rem 2rem;
  background:
    radial-gradient(ellipse at top left, rgba(255, 65, 3, 0.05), transparent 60%),
    radial-gradient(ellipse at bottom right, rgba(0, 161, 255, 0.04), transparent 60%),
    var(--bg);
}
.hero-inner { max-width: 720px; text-align: center; }
.badge-pill {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .4rem .9rem;
  background: var(--orange-soft); color: var(--orange-dark);
  border-radius: 999px; font-size: .82rem; font-weight: 600;
  margin-bottom: 2rem;
}
.badge-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--orange);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

h1.title {
  font-size: clamp(2rem, 5vw, 3.4rem); line-height: 1.1;
  margin: 0 0 1.3rem; font-weight: 700; letter-spacing: -0.02em;
  color: var(--ink);
}
.subtitle {
  font-size: 1.1rem; color: var(--ink-soft); margin: 0 0 2.5rem;
  font-weight: 400;
}

.cta-btn {
  display: inline-block;
  padding: 1.1rem 2.4rem;
  font-size: 1.05rem; font-weight: 600;
  background: linear-gradient(135deg, var(--orange), var(--orange-dark));
  color: white; border: none; border-radius: var(--radius);
  cursor: pointer; box-shadow: 0 8px 24px rgba(255, 65, 3, 0.35);
  transition: transform .15s ease, box-shadow .15s ease;
  font-family: inherit;
}
.cta-btn:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(255, 65, 3, 0.4); }
.cta-btn:active { transform: translateY(0); }
.cta-btn:disabled { opacity: .7; cursor: not-allowed; transform: none; }

.features {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;
  margin-top: 3rem;
}
.feature {
  background: white; padding: 1.5rem 1rem; border-radius: var(--radius);
  border: 1px solid var(--border); text-align: center;
  font-size: .9rem; color: var(--ink-soft);
  box-shadow: var(--shadow-sm);
}
.feature strong { color: var(--ink); display: block; margin-bottom: .3rem; font-weight: 600; }
.feature-icon { font-size: 1.6rem; display: block; margin-bottom: .6rem; }
@media (max-width: 600px) {
  .features { grid-template-columns: 1fr; }
  .site-header { padding: 1rem; }
}

.footer {
  text-align: center; padding: 1.5rem 1rem; font-size: .78rem; color: var(--muted);
  max-width: 720px; margin: 0 auto;
}

/* ---------- Chat ---------- */
body.chat-body { background: var(--bg); }
.chat-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg);
}

.chat-header {
  display: flex; align-items: center; gap: 1.5rem;
  position: sticky; top: 0; z-index: 10;
  background: white; border-bottom: 1px solid var(--border);
  padding: .8rem 1.2rem;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.chat-progress { flex: 1; max-width: 780px; }
.chat-progress-meta {
  display: flex; justify-content: space-between; align-items: center;
  font-size: .78rem; color: var(--ink-soft); margin-bottom: .35rem;
  flex-wrap: wrap; gap: .5rem;
}
.progress-track {
  height: 8px; background: var(--orange-soft); border-radius: 4px; overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--orange), var(--orange-light));
  width: 0%; transition: width .4s ease;
  border-radius: 4px;
}
.chapter-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  background: var(--orange-soft); color: var(--orange-dark);
  padding: .2rem .7rem; border-radius: 999px; font-weight: 600;
}

.messages {
  flex: 1; overflow-y: auto;
  padding: 1.5rem 1rem;
  display: flex; flex-direction: column; gap: 1rem;
}
.messages-inner {
  max-width: 780px; width: 100%; margin: 0 auto;
  display: flex; flex-direction: column; gap: 1rem;
}

.msg {
  max-width: 88%; padding: 1rem 1.15rem;
  border-radius: 18px; line-height: 1.55; font-size: .98rem;
  animation: fadeIn .3s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.msg-assistant {
  background: white; border: 1px solid var(--border);
  align-self: flex-start; border-top-left-radius: 6px;
  box-shadow: var(--shadow-sm);
}
.msg-assistant .avatar {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .78rem; font-weight: 600; color: var(--orange);
  margin-bottom: .35rem;
}
.msg-user {
  background: var(--orange); color: white;
  align-self: flex-end; border-top-right-radius: 6px;
  box-shadow: 0 4px 12px rgba(255, 65, 3, 0.25);
}
.msg strong { font-weight: 600; }
.msg em { color: var(--muted); font-style: italic; font-size: .9em; }
.msg ul { margin: .4rem 0 .4rem 1.2rem; padding: 0; }
.msg p { margin: .3rem 0; }

.typing {
  display: inline-flex; gap: 4px; padding: 4px 0;
}
.typing span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--orange-light);
  animation: bounce 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0);opacity:.5} 30%{transform:translateY(-6px);opacity:1} }

.input-zone {
  padding: 1rem;
  background: white; border-top: 1px solid var(--border);
}
.input-inner { max-width: 780px; margin: 0 auto; }
.choice-buttons {
  display: flex; flex-wrap: wrap; gap: .5rem;
  justify-content: flex-start;
}
.choice-btn {
  padding: .75rem 1.25rem; font-size: .95rem; font-weight: 500;
  background: white; color: var(--ink); border: 1.5px solid var(--border);
  border-radius: 999px; cursor: pointer; font-family: inherit;
  transition: all .15s ease;
}
.choice-btn:hover {
  border-color: var(--orange); background: var(--orange-soft); color: var(--orange-dark);
  transform: translateY(-1px);
}
.choice-btn.primary {
  background: var(--orange); color: white; border-color: var(--orange);
}
.choice-btn.primary:hover {
  background: var(--orange-dark); border-color: var(--orange-dark); color: white;
}
.choice-btn.blue {
  background: var(--blue); color: white; border-color: var(--blue);
}
.choice-btn.blue:hover {
  background: #007fcc; border-color: #007fcc; color: white;
}

.text-input-row {
  display: flex; gap: .5rem;
}
.text-input {
  flex: 1; padding: .85rem 1.1rem; font-size: 1rem;
  border: 1.5px solid var(--border); border-radius: 999px; background: white;
  font-family: inherit; color: var(--ink);
}
.text-input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }
.send-btn {
  padding: .85rem 1.5rem; font-weight: 600;
  background: var(--orange); color: white; border: none; border-radius: 999px; cursor: pointer;
  font-family: inherit;
}
.send-btn:hover { background: var(--orange-dark); }
.send-btn:disabled { background: var(--muted); cursor: not-allowed; }

/* ---------- Consent checkboxes ---------- */
.consent-block {
  background: var(--orange-cream); border: 1px solid var(--orange-soft);
  border-radius: 12px; padding: 1rem 1.1rem; margin-bottom: .75rem;
}
.consent-row {
  display: flex; align-items: flex-start; gap: .7rem;
  padding: .5rem 0; cursor: pointer;
  font-size: .92rem; color: var(--ink);
}
.consent-row input {
  margin-top: .25rem; accent-color: var(--orange);
  width: 18px; height: 18px; flex-shrink: 0;
}
.consent-row + .consent-row {
  border-top: 1px solid var(--orange-soft);
}

/* ---------- Certificate reveal card ---------- */
.cert-reveal {
  background: linear-gradient(135deg, #FFF8F4 0%, #FFEAD9 100%);
  border: 2px solid var(--orange);
  border-radius: 16px;
  padding: 1.4rem;
  margin: 1rem 0;
  box-shadow: 0 8px 24px rgba(255, 65, 3, 0.15);
  text-align: center;
}
.cert-reveal-title {
  color: var(--orange); font-weight: 700; font-size: 1.2rem;
  margin-bottom: .3rem;
}
.cert-reveal-sub {
  color: var(--ink-soft); font-size: .85rem;
  font-style: italic;
}

.footer-mini {
  text-align: center; font-size: .72rem; color: var(--muted); padding: .6rem 0 0;
  margin: .5rem 0 0;
}
.footer-mini sup { font-size: .7em; }

.debug-link {
  position: fixed; bottom: 8px; right: 8px;
  font-size: .68rem; color: var(--muted); opacity: .5;
  background: white; padding: 2px 8px; border-radius: 4px;
  border: 1px solid var(--border);
}
.debug-link:hover { opacity: 1; }
