:root {
  --bg: #f6f3ee;
  --surface: #ffffff;
  --ink: #1d2523;
  --muted: #66706d;
  --line: #e4ded4;
  --brand: #0f3d3e;
  --brand-2: #1f6f6b;
  --accent: #e8813a;
  --bubble-me: #0f3d3e;
  --bubble-me-ink: #ffffff;
  --bubble-bot: #ffffff;
  --error: #b42318;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(15, 61, 62, 0.08);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.01em; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 60%, var(--accent) 140%);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,0.25);
}
.lang { display: flex; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.lang-btn {
  border: 0; background: transparent; padding: 4px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.lang-btn.is-active { background: var(--brand); color: #fff; }

.main { flex: 1; padding: 16px 16px 8px; display: flex; flex-direction: column; gap: 12px; }

.hero { padding: 8px 2px 4px; animation: rise .5s ease both; }
.hero-kicker { margin: 0 0 6px; color: var(--accent); font-weight: 700; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; }
.hero-title { margin: 0 0 8px; font-size: clamp(24px, 7vw, 30px); line-height: 1.15; letter-spacing: -0.02em; }
.hero-sub { margin: 0 0 14px; color: var(--muted); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.steps li {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px;
}
.step-n {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  background: color-mix(in srgb, var(--brand) 10%, white); color: var(--brand);
}
.hero.is-compact .hero-sub, .hero.is-compact .steps { display: none; }
.hero.is-compact .hero-title { font-size: 18px; }

.chat { display: flex; flex-direction: column; gap: 8px; }
.msg {
  max-width: 85%; padding: 10px 14px; border-radius: var(--radius);
  white-space: pre-wrap; overflow-wrap: anywhere;
  animation: pop .22s ease both;
}
.msg.bot { align-self: flex-start; background: var(--bubble-bot); border: 1px solid var(--line); border-bottom-left-radius: 6px; box-shadow: var(--shadow); }
.msg.me { align-self: flex-end; background: var(--bubble-me); color: var(--bubble-me-ink); border-bottom-right-radius: 6px; }
.msg.note { align-self: center; background: transparent; color: var(--muted); font-size: 14px; padding: 2px 8px; }
.thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.thumbs img { width: 56px; height: 56px; object-fit: cover; border-radius: 10px; border: 2px solid rgba(255,255,255,0.4); }

.typing { display: inline-flex; gap: 4px; padding: 14px 16px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .4; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); display: grid; gap: 10px;
  animation: rise .3s ease both;
}
.panel-title { margin: 0; font-weight: 700; }
.panel-hint { margin: 0; color: var(--muted); font-size: 14px; }
.panel-error { margin: 0; color: var(--error); font-size: 14px; }

.demo-card { grid-template-columns: 48px 1fr; align-items: center; border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.demo-card .btn { grid-column: 1 / -1; }
.demo-card-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; font-size: 26px; background: color-mix(in srgb, var(--accent) 16%, white); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 16px; border-radius: 14px; border: 1px solid transparent;
  font-weight: 650; text-decoration: none; cursor: pointer; user-select: none;
  transition: transform .12s ease, background .2s ease;
}
.btn:active { transform: scale(.98); }
.btn-block { width: 100%; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-accent { background: var(--accent); color: #fff; font-size: 17px; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--brand); }
.btn[aria-disabled="true"], .btn:disabled { opacity: .55; pointer-events: none; }

.contact-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.callme { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.callme .panel-hint, .callme .panel-error { grid-column: 1 / -1; }
.callme input {
  min-width: 0; min-height: 46px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--bg);
}
.contact-done { margin: 0; color: var(--brand-2); font-weight: 600; }
.contact-phone a { color: var(--brand); }

.turnstile:empty { display: none; }

.composer {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; gap: 8px; align-items: flex-end;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.composer textarea {
  flex: 1; min-width: 0; resize: none; max-height: 120px;
  padding: 12px 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--surface);
  line-height: 1.35;
}
.composer textarea:focus, .callme input:focus { outline: 2px solid color-mix(in srgb, var(--brand) 40%, transparent); outline-offset: 1px; }
.send {
  flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0;
  background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.send:disabled { opacity: .5; }

@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: .9; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
