/* =============================================================
   SuJai Script Studio — the look of the site.
   Colours are defined once here as "variables" so you can change
   the whole theme by editing just these lines.
   ============================================================= */
:root {
  --bg: #040a1c;
  --bg-2: #071330;
  --panel: rgba(10, 24, 60, 0.72);
  --panel-border: rgba(80, 150, 255, 0.18);
  --text: #eaf1ff;
  --muted: #8ea3c9;
  --blue: #2f7dff;
  --blue-2: #47b4ff;
  --cyan: #7fd8ff;
  --silver: #dfe6f2;
  --gold: #f5b82e;
  --danger: #ff6b81;
  --radius: 18px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--panel-border);
  --glow: 0 0 24px rgba(47, 125, 255, 0.55);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 80% -10%, #0c2a6b 0%, transparent 60%), var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Background "circuit" grid + glow */
.bg-grid {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background-image:
    linear-gradient(rgba(71, 180, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(71, 180, 255, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 0%, #000 30%, transparent 75%);
}
.bg-glow {
  position: fixed; z-index: -1; pointer-events: none;
  width: 700px; height: 700px; right: -200px; top: 200px;
  background: radial-gradient(circle, rgba(47, 125, 255, 0.18), transparent 65%);
  filter: blur(20px);
}

/* ---------- Wordmark (matches the logo) ---------- */
.wordmark { font-family: "Exo 2", sans-serif; font-weight: 900; font-style: italic; letter-spacing: -0.02em; font-size: 28px; line-height: 1; }
.wordmark .su { background: linear-gradient(180deg, #fff 20%, #b9c4d8 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.wordmark .jai { background: linear-gradient(180deg, var(--cyan), var(--blue) 80%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 10px rgba(47,125,255,.5)); }
.wordmark.small { font-size: 22px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(4, 10, 28, 0.7); backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(80, 150, 255, 0.1);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--blue-2), var(--blue)); box-shadow: var(--glow);
}
.brand-mark svg { width: 18px; fill: #fff; }
.brand-sub { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; padding-left: 10px; border-left: 1px solid var(--panel-border); }
.nav-links { display: flex; align-items: center; gap: 22px; font-size: 14px; font-weight: 500; }
.nav-links > a:not(.btn) { color: var(--muted); transition: color .2s; }
.nav-links > a:not(.btn):hover { color: var(--text); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 11px 20px; font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: transform .15s, box-shadow .2s, background .2s, opacity .2s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, var(--blue-2), var(--blue)); color: #fff; box-shadow: 0 8px 24px rgba(47, 125, 255, .35); }
.btn-primary:hover { box-shadow: 0 10px 32px rgba(47, 125, 255, .6); }
.btn-ghost { background: rgba(80, 150, 255, .08); border: 1px solid var(--panel-border); }
.btn-ghost:hover { background: rgba(80, 150, 255, .16); }
.btn-sm { padding: 8px 16px; font-size: 14px; }
.btn-lg { width: 100%; padding: 16px; font-size: 16px; border-radius: 14px; }
.btn-lg svg { width: 18px; fill: currentColor; }
.btn[disabled] { opacity: .6; cursor: progress; }
.pill { background: var(--blue); color: #fff; border-radius: 99px; padding: 0 8px; font-size: 12px; }

/* ---------- Hero ---------- */
.hero { text-align: center; max-width: 860px; margin: 0 auto; padding: 72px 20px 40px; }
.eyebrow { display: inline-flex; align-items: center; gap: 12px; font-family: "Exo 2"; font-style: italic; font-weight: 800; letter-spacing: .12em; font-size: 14px; color: var(--silver); margin: 0 0 18px; }
.eyebrow i { width: 7px; height: 7px; border-radius: 50%; background: var(--blue-2); box-shadow: var(--glow); }
.hero h1 { font-family: "Exo 2", sans-serif; font-weight: 800; font-size: clamp(36px, 6vw, 64px); line-height: 1.05; letter-spacing: -0.02em; margin: 0 0 20px; }
.grad { background: linear-gradient(90deg, var(--cyan), var(--blue)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { color: var(--muted); font-size: clamp(16px, 2vw, 19px); max-width: 680px; margin: 0 auto 26px; }
.hero-badges { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.hero-badges span { font-size: 13px; padding: 7px 14px; border-radius: 99px; background: rgba(80, 150, 255, .08); border: 1px solid var(--panel-border); color: var(--silver); }

/* ---------- Studio layout ---------- */
.studio {
  display: grid; grid-template-columns: minmax(340px, 440px) 1fr; gap: 24px;
  max-width: 1280px; margin: 20px auto 0; padding: 0 clamp(16px, 4vw, 48px);
  align-items: start;
}
.panel { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(16px); padding: 24px; }
.form-panel { position: sticky; top: 84px; }
.panel-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.panel-head h2 { font-family: "Exo 2"; font-size: 20px; margin: 0; }
.panel-head p { margin: 0; color: var(--muted); font-size: 14px; }
.step { width: 32px; height: 32px; flex: none; border-radius: 10px; display: grid; place-items: center; font-weight: 700; background: rgba(47, 125, 255, .15); color: var(--blue-2); border: 1px solid rgba(47, 125, 255, .4); }

/* ---------- Form fields ---------- */
.field { display: block; border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.label { display: block; font-size: 13px; font-weight: 600; color: var(--silver); margin-bottom: 8px; padding: 0; }
.label em { color: var(--muted); font-weight: 400; font-style: normal; }
.label-sm { font-size: 12px; color: var(--muted); }
.hint { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; }
textarea, input, select {
  width: 100%; background: rgba(2, 8, 24, .6); border: 1px solid var(--panel-border);
  border-radius: 12px; padding: 12px 14px; outline: none; transition: border-color .2s, box-shadow .2s;
}
textarea { resize: vertical; min-height: 104px; }
textarea:focus, input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 125, 255, .25); }
select { appearance: none; background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='%238ea3c9' stroke-width='2' fill='none'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
select option { background: var(--bg-2); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -8px 0 18px; }
.chip-example { font-size: 12px; background: none; border: 1px dashed rgba(80, 150, 255, .3); color: var(--muted); padding: 4px 10px; border-radius: 99px; cursor: pointer; text-align: left; }
.chip-example:hover { color: var(--text); border-color: var(--blue-2); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: rgba(2, 8, 24, .5); border: 1px solid var(--panel-border); padding: 8px 14px;
  border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 500; transition: all .15s;
}
.chip:hover { border-color: rgba(71, 180, 255, .6); }
.chip.active { background: linear-gradient(135deg, rgba(71, 180, 255, .25), rgba(47, 125, 255, .3)); border-color: var(--blue-2); box-shadow: 0 0 0 1px var(--blue-2) inset, 0 0 18px rgba(47, 125, 255, .3); }
.seg { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.seg .chip { padding: 8px 4px; text-align: center; font-size: 13px; font-weight: 600; }
.seg .chip small { display: block; font-size: 10px; font-weight: 400; color: var(--muted); margin-top: 2px; }

.form-error { color: var(--danger); font-size: 14px; min-height: 0; margin: 0 0 12px; }
.form-error:empty { display: none; }
.form-error .btn { margin-top: 10px; width: 100%; }
.usage-pill { font-size: 13px; color: var(--silver); padding: 6px 12px; border-radius: 99px; background: rgba(80,150,255,.08); border: 1px solid var(--panel-border); white-space: nowrap; }
.usage-pill b { color: var(--cyan); }
.user-button:empty { display: none; }
.user-button { display: flex; align-items: center; }
.clerk-pricing { max-width: 900px; margin: 30px auto 0; }
.btn-disabled { opacity: .55; cursor: default; }

/* ---------- Output ---------- */
.output-panel { min-height: 640px; display: flex; flex-direction: column; }
.output-head { flex-wrap: wrap; }
.output-head > div:nth-child(2) { flex: 1; }
.actions { display: flex; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; font-size: 13px; font-weight: 600;
  background: rgba(80, 150, 255, .08); border: 1px solid var(--panel-border); cursor: pointer; transition: background .2s;
}
.icon-btn:hover { background: rgba(80, 150, 255, .18); }
.icon-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.output { flex: 1; position: relative; border-top: 1px solid var(--panel-border); padding-top: 8px; }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-icon { width: 72px; height: 72px; margin: 0 auto 18px; border-radius: 22px; display: grid; place-items: center; background: rgba(47, 125, 255, .12); border: 1px solid rgba(47, 125, 255, .35); box-shadow: var(--glow); }
.empty-icon svg { width: 30px; fill: var(--blue-2); }
.empty h3 { color: var(--text); font-family: "Exo 2"; font-size: 22px; margin: 0 0 6px; }
.includes { list-style: none; padding: 0; margin: 18px auto 0; max-width: 440px; text-align: left; display: grid; gap: 10px; }
.includes li { background: rgba(2, 8, 24, .45); border: 1px solid var(--panel-border); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
.includes b { color: var(--text); }

.loading { text-align: center; padding: 70px 20px; color: var(--muted); }
.pulse { width: 56px; height: 56px; margin: 0 auto 20px; border-radius: 50%; background: radial-gradient(circle, var(--blue-2), var(--blue)); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(.8); box-shadow: 0 0 0 0 rgba(47,125,255,.6); } 50% { transform: scale(1); box-shadow: 0 0 0 24px rgba(47,125,255,0); } }

/* The script itself */
.script { font-size: 16px; color: #d7e2f7; max-width: 760px; }
.script:empty { display: none; }
.script h1 { font-family: "Exo 2"; font-size: 30px; line-height: 1.15; color: #fff; margin: 18px 0 12px; }
.script h2 {
  font-family: "Exo 2"; font-size: 19px; color: #fff; margin: 30px 0 10px; padding: 10px 14px;
  background: linear-gradient(90deg, rgba(47,125,255,.18), transparent); border-left: 3px solid var(--blue-2); border-radius: 6px;
}
.script h3 { font-family: "Exo 2"; color: var(--cyan); margin: 26px 0 8px; }
.script p { margin: 0 0 14px; }
.script strong { color: #fff; }
.script em { color: var(--cyan); font-style: italic; opacity: .9; }
.script hr { border: 0; border-top: 1px solid var(--panel-border); margin: 30px 0; }
.script blockquote { margin: 16px 0; padding: 12px 16px; border-radius: 12px; background: rgba(245, 184, 46, .08); border: 1px solid rgba(245, 184, 46, .35); color: #f8e2a8; }
.script blockquote p { margin: 0; }
.script ul, .script ol { padding-left: 22px; }
.script li { margin-bottom: 6px; }
.script code { background: rgba(80,150,255,.12); padding: 1px 6px; border-radius: 6px; font-size: 14px; }
.script.streaming > :last-child::after { content: ""; display: inline-block; width: 8px; height: 18px; margin-left: 3px; vertical-align: text-bottom; background: var(--blue-2); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Sections ---------- */
.section { max-width: 1100px; margin: 0 auto; padding: 100px clamp(16px, 4vw, 48px) 0; }
.section-title { font-family: "Exo 2"; font-size: clamp(26px, 4vw, 38px); text-align: center; margin: 0 0 40px; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px; }
.f-icon { font-size: 28px; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 16px; background: rgba(47,125,255,.12); border: 1px solid rgba(47,125,255,.3); margin-bottom: 16px; }
.feature h3 { font-family: "Exo 2"; margin: 0 0 6px; }
.feature p { margin: 0; color: var(--muted); }

.pricing { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; align-items: stretch; }
.plan { position: relative; background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px; display: flex; flex-direction: column; }
.plan.featured { box-shadow: 0 0 0 1.5px var(--blue-2), 0 20px 60px rgba(47,125,255,.25); }
.plan h3 { font-family: "Exo 2"; margin: 0; color: var(--muted); font-size: 16px; text-transform: uppercase; letter-spacing: .08em; }
.price { font-family: "Exo 2"; font-size: 46px; font-weight: 800; margin: 8px 0 16px; }
.price span { font-size: 16px; color: var(--muted); font-weight: 500; }
.plan ul { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 10px; flex: 1; }
.plan li::before { content: "✓"; color: var(--blue-2); font-weight: 700; margin-right: 10px; }
.ribbon { position: absolute; top: -12px; right: 20px; background: linear-gradient(135deg, var(--gold), #ff9d2e); color: #2a1600; font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 99px; }

.footer { display: flex; flex-wrap: wrap; gap: 16px 28px; align-items: center; justify-content: center; padding: 80px 20px 40px; color: var(--silver); font-size: 14px; }
.muted { color: var(--muted); }
.small-text { font-size: 13px; margin: 0 0 16px; }

/* ---------- History drawer ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 92vw); z-index: 50;
  background: var(--bg-2); border-left: 1px solid var(--panel-border); padding: 24px;
  transform: translateX(100%); transition: transform .3s ease; overflow-y: auto;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer-head h2 { font-family: "Exo 2"; margin: 0; }
.history { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.history li { background: var(--panel); border: 1px solid var(--panel-border); border-radius: 12px; padding: 12px 14px; cursor: pointer; transition: border-color .2s; }
.history li:hover { border-color: var(--blue-2); }
.history .h-title { font-weight: 600; font-size: 14px; display: block; }
.history .h-meta { font-size: 12px; color: var(--muted); }
.history .empty-h { cursor: default; color: var(--muted); font-size: 14px; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .3s; }
.scrim.show { opacity: 1; pointer-events: auto; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 120px); background: var(--blue); color: #fff; padding: 10px 20px; border-radius: 12px; font-weight: 600; font-size: 14px; box-shadow: var(--glow); transition: transform .3s, opacity .3s; opacity: 0; z-index: 60; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- Phones & tablets ---------- */
@media (max-width: 960px) {
  .studio { grid-template-columns: 1fr; }
  .form-panel { position: static; }
  .output-panel { min-height: 420px; }
  .features, .pricing { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .nav-links > a:not(.btn), .brand-sub, .usage-pill, #startBtn { display: none !important; }
  .nav-links { gap: 10px; }
  .hero { padding-top: 48px; }
  .row { grid-template-columns: 1fr; }
  .seg { grid-template-columns: repeat(3, 1fr); }
  .panel { padding: 18px; }
  .actions { width: 100%; }
  .actions .icon-btn { flex: 1; justify-content: center; }
}
