:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eff6ff;
  --bg: #ffffff;
  --bg-alt: #f8fafc;
  --ink: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow: 0 4px 14px rgba(15, 23, 42, .06);
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .10);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--blue-dark); }

.container { max-width: 1080px; margin: 0 auto; padding: 0 22px; }

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; letter-spacing: -.02em; color: var(--ink); }
.logo-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--blue), #60a5fa);
  display: flex; align-items: center; justify-content: center;
}
.back-link { font-size: .92rem; font-weight: 600; }

/* Hero / page intro */
.intro { padding: 44px 0 8px; }
.eyebrow {
  display: inline-block;
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  color: var(--blue); background: var(--blue-soft);
  padding: 5px 11px; border-radius: 999px; margin-bottom: 14px;
}
.intro h1 { font-size: 2.1rem; margin: 0 0 10px; letter-spacing: -.03em; }
.intro p { color: var(--muted); font-size: 1.05rem; max-width: 640px; margin: 0; }

section { padding: 24px 0 60px; }

/* Cards grid (home) */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 28px; }
.card {
  display: block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  background: #fff;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: #cbd5e1; }
.card .icon {
  width: 46px; height: 46px; border-radius: 11px;
  background: var(--blue-soft); color: var(--blue);
  display: flex; align-items: center; justify-content: center; margin-bottom: 16px;
}
.card h3 { margin: 0 0 6px; font-size: 1.18rem; letter-spacing: -.02em; color: var(--ink); }
.card p { margin: 0; color: var(--muted); font-size: .96rem; }
.card .cta { margin-top: 16px; font-weight: 600; color: var(--blue); font-size: .92rem; }

/* Panels / boxes */
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  padding: 22px;
}
.panel + .panel { margin-top: 20px; }
.panel h2 { margin: 0 0 4px; font-size: 1.15rem; letter-spacing: -.02em; }
.panel .hint { color: var(--muted); font-size: .9rem; margin: 0 0 16px; }

.note {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: .92rem;
  color: #334155;
}

/* Forms */
label { display: block; font-weight: 600; font-size: .88rem; margin: 0 0 6px; }
.field { margin-bottom: 16px; }
input[type="text"], textarea, select {
  width: 100%;
  font: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input[type="text"]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
textarea { resize: vertical; min-height: 90px; }
.row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600;
  border: 1px solid transparent; border-radius: 10px;
  padding: 11px 18px; cursor: pointer;
  transition: background .15s ease, transform .12s ease, border-color .15s ease;
}
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 4px 14px rgba(37,99,235,.3); }
.btn-primary:hover { background: var(--blue-dark); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: #fff; border-color: var(--border); color: var(--ink); }
.btn-ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn-sm { padding: 7px 12px; font-size: .85rem; }

/* Result output */
.output {
  margin-top: 16px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  white-space: pre-wrap;
  word-wrap: break-word;
  min-height: 40px;
}
pre.json {
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .88rem;
  color: #0f172a;
}
.output-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.output-head h3 { margin: 0; font-size: .95rem; }

.error { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }

.muted { color: var(--muted); }
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.5); border-top-color: #fff;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Chat */
.chat-window {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
  height: 420px;
  overflow-y: auto;
  padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.msg { max-width: 78%; padding: 10px 14px; border-radius: 14px; font-size: .96rem; }
.msg.user { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.bot.typing { color: var(--muted); }
.chat-input { display: flex; gap: 10px; margin-top: 14px; }
.chat-input input { flex: 1; }

/* iframe demo */
.frame-wrap {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); background: var(--bg-alt);
}
.frame-wrap iframe { width: 100%; height: 640px; border: 0; display: block; }

footer { border-top: 1px solid var(--border); padding: 26px 0; color: var(--muted); font-size: .85rem; }

@media (max-width: 720px) {
  .cards { grid-template-columns: 1fr; }
  .row { grid-template-columns: 1fr; }
  .intro h1 { font-size: 1.7rem; }
}
