:root {
  --bg: #09090b;
  --surface: #111216;
  --surface-2: #171920;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #fafafa;
  --muted: #a1a1aa;
  --subtle: #71717a;
  --teal: #5eead4;
  --blue: #38bdf8;
  --amber: #f59e0b;
  --danger: #f87171;
  --radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  line-height: 1.55;
  overflow-x: clip;
}

a { color: inherit; text-decoration: none; }

.wrap {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 18px 16px 72px;
}
@media (min-width: 640px) {
  .wrap { padding: 26px 24px 88px; }
}

/* Header & Nav */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 34px;
}
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.brand sup { font-size: 0.6em; color: var(--muted); }
.brand-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--teal);
  background: rgba(94, 234, 212, 0.1);
  border: 1px solid rgba(94, 234, 212, 0.25);
  padding: 2px 8px;
  border-radius: 999px;
}
nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
nav a {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--muted);
  padding: 7px 11px;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
nav a.active {
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
}
nav a.nav-cta {
  color: #042f2e;
  background: var(--teal);
  font-weight: 600;
}
nav a.nav-cta:hover { filter: brightness(1.06); background: var(--teal); color: #042f2e; }

/* Typography */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 12px;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
h1 {
  font-size: clamp(1.8rem, 4.8vw, 3.05rem);
  line-height: 1.1;
  letter-spacing: -0.035em;
  font-weight: 800;
  margin: 0 0 14px;
  max-width: 820px;
}
h2 {
  font-size: clamp(1.2rem, 3vw, 1.48rem);
  letter-spacing: -0.025em;
  margin: 0;
  font-weight: 700;
}
h3 { margin: 0 0 6px; font-size: 1.02rem; letter-spacing: -0.015em; }
.sub {
  color: var(--muted);
  font-size: clamp(0.95rem, 2.2vw, 1.08rem);
  max-width: 700px;
  margin: 0 0 24px;
}
.muted { color: var(--muted); }
.subtle { color: var(--subtle); font-size: 0.82rem; }

/* Buttons — proportional on mobile & desktop */
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  min-height: 42px;
  border-radius: 10px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  white-space: nowrap;
  width: auto;
  max-width: 100%;
}
.btn:hover { border-color: rgba(255,255,255,0.3); background: #1f222b; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--text); color: #09090b; border-color: var(--text); }
.btn-primary:hover { background: #e4e4e7; border-color: #e4e4e7; }
.btn-teal { background: var(--teal); color: #042f2e; border-color: var(--teal); }
.btn-teal:hover { filter: brightness(1.06); background: var(--teal); }
.btn-danger { background: rgba(248, 113, 113, 0.12); color: var(--danger); border-color: rgba(248, 113, 113, 0.35); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.22); }
.btn-sm { padding: 6px 12px; min-height: 32px; font-size: 0.8rem; border-radius: 8px; }

/* Cards & Grids (strict minmax(0, 1fr) prevents mobile horizontal blowout) */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 22px;
  min-width: 0;
  overflow: hidden;
}
@media (min-width: 640px) { .card { padding: 26px; } }
.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.section-sub { color: var(--muted); font-size: 0.88rem; margin: 0; }

.grid2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
@media (min-width: 860px) {
  .grid2 { grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 24px; }
  .grid2.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
.grid2 > * { min-width: 0; }

.grid4 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 600px) { .grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 980px) { .grid4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.grid4 > * { min-width: 0; }

.grid3 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
@media (min-width: 760px) { .grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.grid3 > * { min-width: 0; }

/* Stats strip */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 28px; }
@media (min-width: 768px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; } }
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  min-width: 0;
}
.stat .v { font-size: clamp(1.15rem, 3vw, 1.45rem); font-weight: 700; letter-spacing: -0.02em; }
.stat .v.accent { color: var(--teal); }
.stat .l { font-size: 0.78rem; color: var(--muted); margin-top: 3px; }

/* Sub-cards / Tiers */
.subcard {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  min-width: 0;
}
.subcard.featured {
  border-color: rgba(94, 234, 212, 0.45);
  background: linear-gradient(180deg, rgba(94, 234, 212, 0.06) 0%, var(--bg) 55%);
}
.badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 700;
  color: var(--teal);
  margin-bottom: 8px;
}
.badge.amber { color: var(--amber); }
.price { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.025em; margin: 6px 0 2px; }
.price span { font-size: 0.82rem; font-weight: 500; color: var(--muted); }
.billing-note { font-size: 0.8rem; color: var(--teal); font-weight: 600; margin-bottom: 10px; }
.billing-note.amber { color: var(--amber); }
.feat-list { list-style: none; padding: 0; margin: 0 0 18px; font-size: 0.84rem; color: var(--muted); flex: 1; }
.feat-list li { padding: 4px 0 4px 18px; position: relative; }
.feat-list li::before { content: "✓"; position: absolute; left: 0; color: var(--teal); font-weight: 700; }

/* Pilot callout banner */
.pilot-banner {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08) 0%, var(--bg) 65%);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 14px;
  padding: 20px;
}
@media (min-width: 760px) {
  .pilot-banner { flex-direction: row; align-items: center; justify-content: space-between; padding: 24px 26px; }
}

/* Forms */
.field { margin-bottom: 14px; }
label { display: block; font-size: 0.82rem; font-weight: 500; color: var(--muted); margin-bottom: 6px; }
select, input[type="email"], input[type="password"], input[type="text"] {
  width: 100%;
  max-width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
}
select:focus, input:focus { outline: none; border-color: var(--teal); }
input[type="range"] { width: 100%; accent-color: var(--teal); margin: 4px 0; }
.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.86rem;
  cursor: pointer;
  margin: 12px 0;
  user-select: none;
}
.check-row input { width: 16px; height: 16px; accent-color: var(--teal); flex-shrink: 0; }

/* Playground */
.drop {
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.015);
  transition: border-color 0.15s, background 0.15s;
}
.drop:hover, .drop.drag { border-color: var(--teal); background: rgba(94, 234, 212, 0.04); }
.drop strong { display: block; font-size: 0.95rem; margin-bottom: 4px; }
.stage {
  margin-top: 14px;
  background: #050507;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  display: none;
  text-align: center;
}
.stage.visible { display: block; }
canvas {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  max-height: 58vh;
  width: auto;
  height: auto;
  border-radius: 6px;
}
.legend { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 10px; font-size: 0.78rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.swatch.face { border: 2px solid var(--teal); }
.swatch.content { border: 2px dashed var(--amber); }

.result-bar { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 12px; }
.chip {
  font-size: 0.8rem;
  padding: 5px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.chip b { color: var(--text); font-weight: 600; }
.chip.ok b { color: var(--teal); }

/* Code & Tables */
.code-wrap { position: relative; max-width: 100%; }
.code-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; gap: 8px; }
pre {
  margin: 0;
  background: #050507;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  overflow-x: auto;
  max-width: 100%;
  max-height: 260px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #d4d4d8;
  -webkit-overflow-scrolling: touch;
}
details {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0b0c10;
  padding: 10px 12px;
}
summary {
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
summary::-webkit-details-marker { display: none; }
details[open] summary { margin-bottom: 10px; color: var(--text); }

.table-scroll { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; min-width: 540px; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; }
td.good { color: var(--teal); font-weight: 600; }

/* Progress & alerts */
.meter { width: 100%; height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.meter > div { height: 100%; background: var(--teal); transition: width 0.25s; }
.alert { padding: 12px 14px; border-radius: 10px; font-size: 0.86rem; margin-bottom: 14px; }
.alert.err { background: rgba(248,113,113,0.1); border: 1px solid rgba(248,113,113,0.35); color: var(--danger); }
.alert.ok { background: rgba(94,234,212,0.08); border: 1px solid rgba(94,234,212,0.35); color: var(--teal); }
.tabs { display: inline-flex; gap: 4px; background: var(--bg); border: 1px solid var(--border); padding: 4px; border-radius: 10px; margin-bottom: 16px; }
.tabs button {
  background: transparent; color: var(--muted); border: none; padding: 7px 14px;
  border-radius: 7px; font: inherit; font-size: 0.84rem; font-weight: 600; cursor: pointer;
}
.tabs button.active { background: var(--surface-2); color: var(--text); }

footer {
  margin-top: 44px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--subtle);
}
