:root {
  /* light theme — purple kept as the brand accent */
  --bg: #ffffff;
  --bg2: #f5f3fb;
  --card: #ffffff;
  --border: #e4dff2;
  --text: #1c1728;
  --muted: #5d5a6e;
  --accent: #7645d4;   /* TNT purple */
  --accent2: #6d28d9;  /* darker for text contrast on white */
  --green: #15803d;
  --red: #e11d48;
  --mono: 'SF Mono', 'Cascadia Code', Consolas, monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { overflow-x: hidden; } /* safety net: nothing leaks past the right edge */
body {
  background: var(--bg);
  color: var(--text);
  font: 17px/1.65 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  min-height: 100vh;
}
/* flex/grid children must be able to shrink so wide content scrolls inside, not out */
.grid > *, .calc > *, .story-step > div, .chat-input input, .calc-row > span { min-width: 0; }
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.mono { font-family: var(--mono); }

/* nav */
nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
nav .container { display: flex; align-items: center; justify-content: space-between; height: 76px; }
.logo { font-family: var(--mono); font-weight: 700; font-size: 22px; color: var(--text); }
.logo span { color: var(--accent); }
nav .links { display: flex; gap: 30px; align-items: center; }
nav .links a { color: var(--muted); font-size: 16px; font-weight: 500; }
nav .links a:hover { color: var(--text); text-decoration: none; }
nav .links a.btn-primary { padding: 11px 24px; font-size: 16px; }

/* buttons */
.btn {
  display: inline-block; padding: 10px 20px; border-radius: 8px;
  font-size: 15px; font-weight: 600; cursor: pointer; border: none;
  transition: transform 0.1s, box-shadow 0.2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); color: #fff; }
.btn-primary:hover { box-shadow: 0 4px 24px rgba(118, 69, 212, 0.4); text-decoration: none; color: #fff; }
nav .links a.btn-primary, nav .links a.btn-primary:hover { color: #fff; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--muted); text-decoration: none; }
.btn-sm { padding: 6px 14px; font-size: 14px; }
.btn-danger { background: transparent; color: var(--red); border: 1px solid rgba(225, 29, 72, 0.4); }

/* hero */
.hero { padding: 96px 0 72px; text-align: center; }
.hero h1 { font-size: 52px; line-height: 1.1; font-weight: 800; letter-spacing: -1px; }
.hero h1 em { font-style: normal; background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.sub { margin: 20px auto 0; max-width: 640px; color: var(--muted); font-size: 20px; }
.hero-bullets {
  list-style: none; margin: 28px auto 0; max-width: 680px;
  display: flex; flex-direction: column; gap: 12px; text-align: left;
}
.hero-bullets li {
  position: relative; padding-left: 34px; font-size: 19px; color: var(--text);
}
.hero-bullets li::before {
  content: '▸'; position: absolute; left: 8px; top: 0;
  color: var(--accent2); font-size: 20px;
}
.hero-bullets b { color: var(--accent2); font-weight: 700; }
.hero .cta { margin-top: 36px; display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.badge-row { display: flex; gap: 12px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }
.badge {
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 5px 14px;
}
.badge b { color: var(--green); font-weight: 600; }

/* GLM-5.2 "X" — we are better and cheaper */
.glm-x {
  margin: 40px auto 0; max-width: 560px;
  display: flex; align-items: center; justify-content: center; gap: 20px; flex-wrap: wrap;
  background: rgba(225, 29, 72, 0.05); border: 1px solid rgba(225, 29, 72, 0.3);
  border-radius: 16px; padding: 22px 28px;
}
.glm-x-name {
  font-family: var(--mono); font-size: 44px; font-weight: 800; letter-spacing: -1px;
  color: var(--muted); position: relative;
}
.glm-x-mark {
  font-size: 52px; font-weight: 800; color: var(--red); line-height: 1;
  transform: rotate(-8deg); text-shadow: 0 0 24px rgba(225, 29, 72, 0.3);
}
.glm-x-copy { font-size: 16px; color: var(--muted); max-width: 260px; text-align: left; }
.glm-x-copy b { color: var(--green); }

/* story steps */
.story { display: flex; flex-direction: column; gap: 28px; max-width: 860px; }
.story-step {
  display: flex; gap: 20px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 24px 28px;
}
.story-n {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; font-weight: 800; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.story-step h3 { font-size: 20px; margin-bottom: 8px; }
.story-step p { color: var(--muted); font-size: 16px; }
.story-step b { color: var(--text); }

/* sections */
section { padding: 72px 0; }
section h2 { font-size: 34px; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 12px; }
section .lead { color: var(--muted); max-width: 720px; margin-bottom: 40px; }
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 900px) {
  nav .container { height: 68px; }
  .logo { font-size: 20px; }
  nav .links { gap: 20px; }
  nav .links a { font-size: 15px; }
  nav .links a.btn-primary { padding: 9px 18px; font-size: 15px; }
}
@media (max-width: 800px) {
  nav .links a.btn-primary { display: none; } /* CTA lives in the hero — keep the nav from wrapping */
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .hero { padding: 56px 0 48px; }
  .hero h1 { font-size: 34px; }
  .hero-bullets li { font-size: 17px; }
  .glm-x { padding: 16px 18px; gap: 12px; }
  .glm-x-name { font-size: 32px; }
  .glm-x-mark { font-size: 38px; }
  .glm-x-copy { max-width: none; font-size: 15px; }
  .story-step { flex-direction: column; gap: 12px; padding: 20px; }
  .dash-main { padding: 20px 16px; }
  .dash-side { border-right: none; border-bottom: 1px solid var(--border); }
  .calc-row { flex-direction: column; gap: 2px; }
  .chat-input { flex-wrap: wrap; }
  .chat-input input { min-width: 0; width: 100%; }
  .chat-input .btn { width: 100%; }
  footer .container { flex-direction: column; text-align: center; }
  section { padding: 48px 0; }
  section h2 { font-size: 27px; }
}
@media (max-width: 560px) {
  nav .container { height: 60px; }
  .logo { font-size: 18px; }
  nav .links { gap: 12px; }
  nav .links a { font-size: 13px; }
  nav .links a.btn-primary { display: none; } /* keep the nav from wrapping on tiny screens */
  .hero h1 { font-size: 29px; }
  .container { padding: 0 16px; }
}

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; padding: 24px;
  overflow-x: auto; /* wide tables/code scroll inside the card, never past the viewport */
}
.card h3 { font-size: 18px; margin-bottom: 8px; }
.card p { color: var(--muted); font-size: 15px; }

/* pricing table */
.price-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.price-table th {
  text-align: left; color: var(--muted); font-weight: 500; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.5px; padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.price-table td { padding: 16px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.price-table tr:last-child td { border-bottom: none; }
.price-table .sku-name { font-weight: 700; font-size: 15px; }
.price-table .sku-price { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--accent2); white-space: nowrap; }
.price-table .sku-price small { font-size: 12px; color: var(--muted); font-weight: 400; }
.hero-sku { position: relative; }
.hero-sku td { background: rgba(118, 69, 212, 0.08); }
.tag {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px;
  border-radius: 999px; margin-left: 8px; vertical-align: middle;
}
.tag-hero { background: rgba(118, 69, 212, 0.18); color: var(--accent2); }
.tag-note { background: rgba(93, 90, 110, 0.1); color: var(--muted); }

/* calculator */
.calc { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 800px) { .calc { grid-template-columns: 1fr; } }
.calc label { display: block; font-size: 13px; color: var(--muted); margin: 16px 0 6px; }
.calc input[type=number] {
  width: 100%; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg2); color: var(--text); font-size: 15px; font-family: var(--mono);
}
.calc input:focus { outline: none; border-color: var(--accent); }
.calc-result { font-family: var(--mono); }
.calc-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.calc-row .win { color: var(--green); font-weight: 700; }
.calc-row .lose { color: var(--muted); }

/* code blocks */
pre {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 10px;
  padding: 18px; overflow-x: auto; font-family: var(--mono); font-size: 13px; line-height: 1.5;
}
code { font-family: var(--mono); font-size: 0.92em; }
.inline-code { background: var(--bg2); padding: 2px 7px; border-radius: 5px; border: 1px solid var(--border); }

/* chat */
.chat-box { display: flex; flex-direction: column; height: 420px; }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.chat-msg { max-width: 85%; padding: 10px 14px; border-radius: 12px; font-size: 15px; white-space: pre-wrap; overflow-wrap: break-word; }
.chat-msg.user { align-self: flex-end; background: rgba(118, 69, 212, 0.18); border: 1px solid rgba(118, 69, 212, 0.4); }
.chat-msg.bot { align-self: flex-start; background: var(--bg2); border: 1px solid var(--border); }
/* markdown-rendered bot replies */
.chat-msg.md { white-space: normal; }
.chat-msg.md > p:first-child { margin-top: 0; }
.chat-msg.md > p:last-child { margin-bottom: 0; }
.chat-msg.md p { margin: 6px 0; }
.chat-msg.md h4 { font-size: 15px; margin: 10px 0 4px; }
.chat-msg.md ul { margin: 6px 0 6px 20px; padding: 0; }
.chat-msg.md li { margin: 3px 0; }
.chat-msg.md .md-code {
  background: var(--bg2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; margin: 8px 0; overflow-x: auto; font-family: var(--mono);
  font-size: 13px; line-height: 1.5; white-space: pre;
}
.chat-input { display: flex; gap: 10px; padding: 12px; border-top: 1px solid var(--border); }
.chat-input input {
  flex: 1; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg2); color: var(--text); font-size: 15px;
}
.chat-input input:focus { outline: none; border-color: var(--accent); }

/* forms */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg2); color: var(--text); font-size: 15px;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); }

/* dashboard */
.dash-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 60px); }
@media (max-width: 800px) { .dash-layout { grid-template-columns: minmax(0, 1fr); } }
.dash-side { border-right: 1px solid var(--border); padding: 24px 16px; background: var(--bg2); min-width: 0; }
.dash-side a { display: block; padding: 9px 14px; border-radius: 8px; color: var(--muted); font-size: 14px; margin-bottom: 4px; }
.dash-side a.active, .dash-side a:hover { background: var(--card); color: var(--text); text-decoration: none; }
.dash-side.locked a { opacity: 0.45; pointer-events: none; }
.dash-main { padding: 32px; min-width: 0; }
.dash-main h2 { margin-bottom: 24px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 28px; }
@media (max-width: 800px) { .stat-row { grid-template-columns: 1fr; } }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.stat .v { font-family: var(--mono); font-size: 26px; font-weight: 700; }
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.status-pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.st-running { background: rgba(21, 128, 61, 0.12); color: var(--green); }
.st-stopped, .st-failed { background: rgba(225, 29, 72, 0.1); color: var(--red); }
.st-pending { background: rgba(118, 69, 212, 0.12); color: var(--accent2); }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th { text-align: left; color: var(--muted); font-size: 12px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
table.data td { padding: 12px; border-bottom: 1px solid var(--border); font-family: var(--mono); font-size: 13px; }
.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--card); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 20px; font-size: 14px; z-index: 100;
  box-shadow: 0 8px 24px rgba(28, 23, 40, 0.12); display: none;
}
.toast.err { border-color: var(--red); }
footer { border-top: 1px solid var(--border); padding: 40px 0; color: var(--muted); font-size: 15px; }
footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
