:root {
  --bg: #FAF8F4;
  --surface: #FFFFFF;
  --paper: #F1ECE2;
  --ink: #141218;
  --muted: #4D4657;
  --spirit: #4A2C9B;
  --spirit-hover: #361D78;
  --spirit-soft: #EDE9FE;
  --amber: #9A3412;
  --amber-bg: #FEF3C7;
  --ok-bg: #ECFDF5;
  --ok-ink: #065F46;
  --border: #D9D2C5;
  --font-display: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
}
a { color: var(--spirit); text-decoration: none; transition: color 150ms ease; }
a:hover { color: var(--spirit-hover); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--spirit); outline-offset: 2px; }

.ts-wrap { max-width: 1180px; margin: 0 auto; padding: 0 22px; }

/* Studio Top Bar & Header */
.ts-header { background: var(--surface); border-bottom: 1px solid var(--border); }
.ts-ribbon {
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 0;
}
.ts-ribbon-flex { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.ts-nav-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 16px 0;
  flex-wrap: wrap;
}
.ts-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.ts-brand:hover { color: var(--spirit); text-decoration: none; }
.ts-brand-badge {
  background: var(--spirit);
  color: #FFFFFF;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}
.ts-nav { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }
.ts-nav a { color: var(--ink); font-size: 14px; font-weight: 600; padding: 6px 4px; }
.ts-nav a:hover { color: var(--spirit); text-decoration: none; }
.ts-nav-cta {
  background: var(--spirit);
  color: #FFFFFF;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}
.ts-nav-cta:hover { background: var(--spirit-hover); color: #FFFFFF; text-decoration: none; }

/* Hero */
.ts-hero { padding: 40px 0 28px; border-bottom: 1px solid var(--border); }
.ts-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--spirit);
  margin-bottom: 10px;
}
h1, h2, h3 { font-family: var(--font-display); color: var(--ink); line-height: 1.18; margin-top: 0; }
h1 { font-size: clamp(32px, 4.4vw, 50px); font-weight: 700; margin-bottom: 12px; letter-spacing: -0.02em; }
h2 { font-size: clamp(24px, 3vw, 34px); font-weight: 700; margin: 38px 0 14px; }
h3 { font-size: 20px; font-weight: 700; margin: 22px 0 8px; }
.ts-lead { font-size: 17px; color: var(--muted); max-width: 68ch; margin: 0; }

/* Workbench */
.ts-tool-section { padding: 28px 0; }
.ts-bench {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(20, 18, 24, 0.06);
}
.ts-bench-head {
  background: var(--ink);
  color: var(--bg);
  padding: 13px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 13px;
}
.ts-bench-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(290px, 1fr);
  gap: 0;
}
.ts-stage-col { padding: 20px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 14px; }
.ts-ctrl-col { padding: 20px; background: var(--bg); display: flex; flex-direction: column; gap: 13px; }

.ts-drop {
  border: 2px dashed var(--border);
  border-radius: 10px;
  background: var(--paper);
  padding: 14px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}
.ts-drop:hover { border-color: var(--spirit); background: var(--spirit-soft); }

.ts-pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.ts-pill {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}
.ts-pill:hover, .ts-pill.is-active {
  background: var(--spirit);
  color: #FFFFFF;
  border-color: var(--spirit);
}

.ts-canvas-frame {
  position: relative;
  width: 100%;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
}
.ts-canvas-frame canvas { display: block; width: 100%; height: auto; max-height: 520px; object-fit: contain; }

.ts-split-tags {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.ts-range { width: 100%; accent-color: var(--spirit); cursor: pointer; }

.ts-field { display: flex; flex-direction: column; gap: 5px; }
.ts-field label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.ts-input, .ts-select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-family: var(--font-sans);
}
.ts-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.ts-ai-box {
  background: var(--spirit-soft);
  border: 1px solid var(--spirit);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ts-ai-title { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--spirit); margin: 0; }
.ts-ai-note { font-size: 13px; color: var(--ink); margin: 0; }

.ts-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--spirit);
  color: #FFFFFF;
  border: 1px solid var(--spirit);
  border-radius: 8px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: background 150ms ease, border-color 150ms ease;
}
.ts-btn:hover { background: var(--spirit-hover); border-color: var(--spirit-hover); color: #FFFFFF; text-decoration: none; }
.ts-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.ts-btn-outline { background: var(--surface); color: var(--ink); border: 1px solid var(--ink); }
.ts-btn-outline:hover { background: var(--ink); color: #FFFFFF; border-color: var(--ink); text-decoration: none; }

/* Utility Strip & Cards */
.ts-tools-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 28px 0;
}
.ts-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}
.ts-card h3 { margin: 0; font-size: 18px; }
.ts-card p { margin: 0; font-size: 14px; color: var(--muted); }
.ts-tag {
  display: inline-block;
  align-self: flex-start;
  background: var(--paper);
  color: var(--spirit);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
}

/* Pricing Grid */
.ts-pricing-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0 32px;
}
.ts-plan {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}
.ts-plan-featured {
  border: 2px solid var(--spirit);
  box-shadow: 0 12px 28px rgba(74, 44, 155, 0.12);
}
.ts-price { font-family: var(--font-display); font-size: 36px; font-weight: 700; color: var(--ink); line-height: 1.1; }
.ts-price-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.ts-plan-list { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }

.ts-notice {
  background: var(--ok-bg);
  color: var(--ok-ink);
  border: 1px solid var(--ok-ink);
  border-radius: 10px;
  padding: 14px 18px;
  font-weight: 600;
  margin-bottom: 18px;
}
.ts-notice-warn {
  background: var(--amber-bg);
  color: var(--amber);
  border-color: var(--amber);
}

.ts-auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 1fr);
  gap: 20px;
  align-items: center;
  margin: 26px 0;
}
.ts-input-row { display: flex; gap: 10px; flex-wrap: wrap; }
.ts-input-row .ts-input { flex: 1; min-width: 180px; }
.ts-auth-msg { font-size: 13px; color: var(--muted); margin-top: 8px; }

/* Prose & FAQ */
.ts-prose { max-width: 78ch; padding: 12px 0 24px; }
.ts-prose table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 14px; background: var(--surface); }
.ts-prose th, .ts-prose td { border: 1px solid var(--border); padding: 10px 12px; text-align: left; }
.ts-prose th { background: var(--paper); font-weight: 700; }
.ts-prose ul, .ts-prose ol { padding-left: 22px; }
.ts-prose li { margin-bottom: 6px; }

.ts-faq { padding: 12px 0 36px; max-width: 78ch; }
.ts-faq details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 10px;
}
.ts-faq summary { font-weight: 700; cursor: pointer; color: var(--ink); }
.ts-faq details p { margin: 10px 0 0; color: var(--muted); font-size: 15px; }

.ts-cta-banner {
  background: var(--ink);
  color: var(--bg);
  border-radius: 14px;
  padding: 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 26px 0 36px;
}
.ts-cta-banner h2 { color: var(--bg); margin: 0 0 6px; font-size: 24px; }
.ts-cta-banner p { color: var(--paper); margin: 0; font-size: 15px; }
.ts-cta-banner .ts-btn-outline { background: transparent; color: var(--bg); border-color: var(--bg); }
.ts-cta-banner .ts-btn-outline:hover { background: var(--bg); color: var(--ink); }

/* Footer */
.ts-footer {
  background: var(--ink);
  color: var(--paper);
  padding: 40px 0 28px;
  margin-top: 36px;
}
.ts-footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}
.ts-footer h3 { color: var(--bg); font-size: 15px; margin: 0 0 10px; }
.ts-footer ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.ts-footer a { color: var(--paper); }
.ts-footer a:hover { color: #FFFFFF; }
.ts-footer-bottom {
  border-top: 1px solid #2D2838;
  padding-top: 18px;
  font-size: 13px;
  color: #C7C0D4;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 980px) {
  .ts-pricing-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .ts-bench-grid, .ts-tools-strip, .ts-auth-card, .ts-footer-grid { grid-template-columns: 1fr; }
  .ts-stage-col { border-right: none; border-bottom: 1px solid var(--border); }
  .ts-pricing-grid { grid-template-columns: 1fr; }
}
.ts-card-h { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin: 0 0 8px; line-height: 1.25; }
.ts-footer-h { font-family: var(--font-display); color: var(--bg); font-size: 15px; font-weight: 700; margin: 0 0 10px; }
