/* ==========================================================================
   AI Maker Studio — shared stylesheet
   Sections:
     1. Design tokens & themes
     2. Base / reset
     3. Layout helpers
     4. Header & navigation
     5. Buttons, chips, badges
     6. Hero (home + builder pages)
     7. Cards & grids
     8. Builder workspace (panels, forms, tabs)
     9. Output previews (per builder)
    10. Footer
    11. Utilities & animations
   ========================================================================== */

/* 1. Design tokens & themes ------------------------------------------------ */
:root {
  --bg: #0b0d17;
  --bg-elev: #121528;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-strong: rgba(255, 255, 255, 0.08);
  --border: rgba(255, 255, 255, 0.1);
  --text: #e8eaf6;
  --text-muted: #9aa0c3;
  --heading: #ffffff;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6);
  --radius: 18px;
  --radius-sm: 10px;
  --container: 1200px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* default accent — overridden per builder via body class */
  --accent: #8b5cf6;
  --accent-2: #06b6d4;
  --accent-soft: rgba(139, 92, 246, 0.16);
  --gradient: linear-gradient(135deg, var(--accent), var(--accent-2));
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-elev: #ffffff;
  --surface: rgba(15, 23, 42, 0.03);
  --surface-strong: rgba(15, 23, 42, 0.06);
  --border: rgba(15, 23, 42, 0.1);
  --text: #1e2340;
  --text-muted: #5b6285;
  --heading: #0b0d17;
  --shadow: 0 20px 40px -24px rgba(30, 35, 64, 0.35);
  color-scheme: light;
}

.theme-chatbot  { --accent: #8b5cf6; --accent-2: #6366f1; --accent-soft: rgba(139, 92, 246, 0.16); }
.theme-image    { --accent: #ec4899; --accent-2: #f97316; --accent-soft: rgba(236, 72, 153, 0.16); }
.theme-video    { --accent: #ef4444; --accent-2: #f59e0b; --accent-soft: rgba(239, 68, 68, 0.16); }
.theme-agent    { --accent: #10b981; --accent-2: #06b6d4; --accent-soft: rgba(16, 185, 129, 0.16); }
.theme-prompt   { --accent: #f59e0b; --accent-2: #eab308; --accent-soft: rgba(245, 158, 11, 0.16); }
.theme-app      { --accent: #3b82f6; --accent-2: #8b5cf6; --accent-soft: rgba(59, 130, 246, 0.16); }
.theme-workflow { --accent: #06b6d4; --accent-2: #3b82f6; --accent-soft: rgba(6, 182, 212, 0.16); }
.theme-voice    { --accent: #14b8a6; --accent-2: #84cc16; --accent-soft: rgba(20, 184, 166, 0.16); }

/* 2. Base / reset ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  /* ambient glow */
  content: "";
  position: fixed;
  inset: -20% -10% auto -10%;
  height: 70vh;
  background:
    radial-gradient(40% 60% at 20% 30%, var(--accent-soft), transparent 70%),
    radial-gradient(35% 50% at 80% 20%, color-mix(in srgb, var(--accent-2) 18%, transparent), transparent 70%);
  pointer-events: none;
  z-index: -1;
}

h1, h2, h3, h4 { color: var(--heading); line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.8rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); letter-spacing: -0.01em; }
h3 { font-size: 1.15rem; }
p  { margin: 0 0 1em; }

a { color: inherit; }
a:hover { color: var(--accent); }

img, svg { max-width: 100%; display: block; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  padding: 0.6rem 1rem;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  z-index: 100;
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 1rem; color: #fff; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* 3. Layout helpers -------------------------------------------------------- */
.container { width: min(100% - 2.5rem, var(--container)); margin-inline: auto; }

.section { padding: clamp(3.5rem, 8vw, 6rem) 0; }
.section--tight { padding: clamp(2rem, 5vw, 3.5rem) 0; }

.section-head { max-width: 680px; margin-bottom: 2.5rem; }
.section-head.center { text-align: center; margin-inline: auto; }
.section-head p { color: var(--text-muted); font-size: 1.08rem; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.grid { display: grid; gap: 1.25rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }

/* 4. Header & navigation --------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  border-bottom: 1px solid var(--border);
}

.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--heading);
  text-decoration: none;
}
.brand:hover { color: var(--heading); }
.brand img { width: 32px; height: 32px; }

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-nav a {
  display: block;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 0.2s, color 0.2s;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--heading);
  background: var(--surface-strong);
}

.nav-actions { display: flex; align-items: center; gap: 0.5rem; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 1.1rem;
  transition: background 0.2s, transform 0.2s;
}
.icon-btn:hover { background: var(--surface-strong); transform: translateY(-1px); }

.nav-toggle { display: none; }

@media (max-width: 880px) {
  .nav-toggle { display: inline-grid; }
  .site-nav {
    position: absolute;
    inset: 68px 0 auto 0;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: none;
  }
  .site-nav.is-open { display: block; }
  .site-nav ul {
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem 1.25rem 1.25rem;
  }
  .site-nav a { border-radius: var(--radius-sm); padding: 0.75rem 1rem; }
}

/* 5. Buttons, chips, badges ------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.35rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.97rem;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s, opacity 0.2s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn:disabled { opacity: 0.6; cursor: progress; transform: none; }

.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 10px 30px -10px var(--accent);
}
.btn-primary:hover { color: #fff; box-shadow: 0 14px 34px -10px var(--accent); }

.btn-ghost {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface-strong); color: var(--heading); }

.btn-sm { padding: 0.5rem 0.95rem; font-size: 0.86rem; }
.btn-block { width: 100%; }

.chip-group { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.chip {
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.chip:hover { color: var(--heading); border-color: var(--accent); }
.chip.is-active,
.chip[aria-pressed="true"],
.chip[aria-checked="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--heading);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
}
.badge--muted { background: var(--surface-strong); color: var(--text-muted); }
.badge--success { background: rgba(16, 185, 129, 0.15); color: #10b981; }

/* 6. Hero ------------------------------------------------------------------ */
.hero {
  position: relative;
  padding: clamp(4rem, 10vw, 7.5rem) 0 clamp(3rem, 6vw, 5rem);
  text-align: center;
  overflow: hidden;
}

.hero h1 { max-width: 900px; margin-inline: auto; }

.hero-lead {
  max-width: 680px;
  margin: 0 auto 2rem;
  color: var(--text-muted);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
}

.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; }

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem 0.35rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}
.hero-pill .badge { background: var(--gradient); color: #fff; }

.hero-orbs { position: absolute; inset: 0; pointer-events: none; z-index: -1; }
.hero-orbs span {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.45;
  animation: float 14s ease-in-out infinite;
}
.hero-orbs span:nth-child(1) { width: 320px; height: 320px; background: #8b5cf6; top: 5%; left: 8%; }
.hero-orbs span:nth-child(2) { width: 260px; height: 260px; background: #06b6d4; top: 20%; right: 6%; animation-delay: -4s; }
.hero-orbs span:nth-child(3) { width: 220px; height: 220px; background: #ec4899; bottom: 0; left: 40%; animation-delay: -8s; }

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(1.5rem, 5vw, 4rem);
  margin-top: 3.5rem;
  padding: 0;
  list-style: none;
}
.hero-stats strong { display: block; font-size: 1.8rem; color: var(--heading); }
.hero-stats span { color: var(--text-muted); font-size: 0.9rem; }

/* Floating builder icons strip on home hero */
.icon-orbit {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 3rem auto 0;
  padding: 0;
  list-style: none;
}
.icon-orbit a {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  font-size: 1.6rem;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 0.25s, border-color 0.25s;
}
.icon-orbit a:hover { transform: translateY(-6px) rotate(-4deg); border-color: var(--accent); }

/* Builder page hero */
.builder-hero {
  padding: clamp(2.5rem, 6vw, 4.5rem) 0 2rem;
}
.builder-hero-inner {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 2.5rem;
  align-items: center;
}
@media (max-width: 880px) {
  .builder-hero-inner { grid-template-columns: 1fr; }
}
.builder-hero h1 { font-size: clamp(2rem, 4.5vw, 3.2rem); }
.builder-hero .lead { color: var(--text-muted); font-size: 1.12rem; max-width: 600px; }

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.breadcrumb li + li::before { content: "/"; margin-right: 0.4rem; opacity: 0.5; }
.breadcrumb a { text-decoration: none; color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }

.builder-icon {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  font-size: 2rem;
  background: var(--gradient);
  box-shadow: 0 14px 34px -12px var(--accent);
  margin-bottom: 1.25rem;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}
.hero-meta li {
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hero-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(160deg, var(--accent-soft), var(--surface));
  padding: 1.5rem;
  box-shadow: var(--shadow);
}
.hero-card h2 { font-size: 1rem; margin-bottom: 1rem; }
.hero-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 0; }
.hero-card dt { font-size: 0.8rem; color: var(--text-muted); }
.hero-card dd { margin: 0; font-size: 1.4rem; font-weight: 700; color: var(--heading); }

/* 7. Cards & grids --------------------------------------------------------- */
.card {
  position: relative;
  padding: 1.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 60%, transparent); box-shadow: var(--shadow); }
.card p { color: var(--text-muted); margin-bottom: 0; }

.card-icon {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  font-size: 1.5rem;
  background: var(--accent-soft);
  margin-bottom: 1rem;
}

/* Builder CTA cards (home) */
.builder-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1.6rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  position: relative;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}
.builder-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, var(--accent-soft), transparent 55%);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.builder-card:hover { transform: translateY(-6px); border-color: var(--accent); box-shadow: 0 24px 48px -24px var(--accent); color: inherit; }
.builder-card:hover::after { opacity: 1; }
.builder-card .builder-icon { width: 54px; height: 54px; font-size: 1.6rem; margin: 0; border-radius: 15px; }
.builder-card h3 { margin: 0.25rem 0 0; font-size: 1.2rem; }
.builder-card p { color: var(--text-muted); margin: 0; flex: 1; }
.builder-card .card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent);
}
.builder-card .card-foot span:last-child { transition: transform 0.25s; }
.builder-card:hover .card-foot span:last-child { transform: translateX(4px); }
.builder-card[hidden] { display: none; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.search-field {
  position: relative;
  flex: 1 1 260px;
  max-width: 360px;
}
.search-field input[type="search"] { padding-left: 2.5rem; }
.search-field::before {
  content: "🔎";
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9rem;
  opacity: 0.7;
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

/* Steps */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; }
.steps .card::before {
  content: counter(step, decimal-leading-zero);
  display: block;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

/* CTA band */
.cta-band {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--radius) + 6px);
  padding: clamp(2rem, 6vw, 4rem);
  background: var(--gradient);
  color: #fff;
  text-align: center;
}
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255, 255, 255, 0.85); max-width: 560px; margin: 0 auto 1.5rem; }
.cta-band .btn-ghost { background: rgba(255, 255, 255, 0.15); border-color: rgba(255, 255, 255, 0.35); color: #fff; }
.cta-band .btn-light { background: #fff; color: #111; }
.cta-band .btn-light:hover { color: #111; }

/* Template cards (builder pages) */
.template-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.template-card .template-thumb {
  height: 110px;
  border-radius: 12px;
  margin-bottom: 0.75rem;
  background: var(--gradient);
  display: grid;
  place-items: center;
  font-size: 2.2rem;
  position: relative;
  overflow: hidden;
}
.template-card .template-thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.35), transparent 50%);
}
.template-card .template-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.75rem;
}
.template-card[hidden] { display: none; }

/* Feature list */
.feature-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.75rem; }
.feature-list li { display: flex; gap: 0.75rem; align-items: flex-start; color: var(--text-muted); }
.feature-list li::before {
  content: "✓";
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
  margin-top: 2px;
}

/* Builder pager / related builders */
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
  gap: 0.75rem;
  list-style: none;
  padding: 0;
  margin: 0;
}
.related-grid a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  transition: border-color 0.2s, transform 0.2s;
}
.related-grid a:hover { border-color: var(--accent); transform: translateY(-2px); }
.related-grid a[aria-current="page"] { border-color: var(--accent); background: var(--accent-soft); }

/* 8. Builder workspace ----------------------------------------------------- */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 960px) {
  .workspace { grid-template-columns: 1fr; }
}

.panel {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.panel-head h2, .panel-head h3 { font-size: 1rem; margin: 0; }
.panel-body { padding: 1.25rem; }

.window-dots { display: inline-flex; gap: 6px; }
.window-dots i { width: 11px; height: 11px; border-radius: 50%; background: #ef4444; }
.window-dots i:nth-child(2) { background: #f59e0b; }
.window-dots i:nth-child(3) { background: #10b981; }

/* Forms */
.form-grid { display: grid; gap: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

.field { display: grid; gap: 0.4rem; }
.field > label,
.field > .label,
fieldset > legend {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--heading);
}
.field .hint { font-size: 0.78rem; color: var(--text-muted); }

fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 0.5rem; }

input[type="text"],
input[type="search"],
input[type="url"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 2rem; }
select option { background: var(--bg-elev); color: var(--text); }
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input[type="range"] { width: 100%; accent-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }
input[type="color"] {
  width: 44px; height: 36px; padding: 2px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer;
}

.range-label { display: flex; justify-content: space-between; align-items: center; }
.range-label output { font-family: var(--mono); font-size: 0.82rem; color: var(--accent); }

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.9rem;
  cursor: pointer;
}
.toggle input {
  appearance: none;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  position: relative;
  cursor: pointer;
  flex: none;
  transition: background 0.2s;
}
.toggle input::after {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.toggle input:checked { background: var(--accent); border-color: var(--accent); }
.toggle input:checked::after { transform: translateX(18px); }

.option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 0.5rem; }
.option-card {
  position: relative;
  display: grid;
  place-items: center;
  gap: 0.25rem;
  padding: 0.75rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.option-card input { position: absolute; opacity: 0; pointer-events: none; }
.option-card .emoji { font-size: 1.4rem; }
.option-card:hover { border-color: var(--accent); }
.option-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--heading); }
.option-card:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.swatches { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; }
.swatch span {
  display: block;
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid transparent;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}
.swatch input:checked + span { border-color: var(--heading); }
.swatch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Tabs */
.tabs [role="tablist"] {
  display: flex;
  gap: 0.25rem;
  padding: 0.35rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs [role="tab"] {
  flex: 1 0 auto;
  padding: 0.5rem 1rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.tabs [role="tab"][aria-selected="true"] {
  background: var(--gradient);
  color: #fff;
}
.tabs [role="tabpanel"] { padding-top: 1.25rem; }
@media (max-width: 520px) {
  .tabs [role="tablist"] { flex-wrap: wrap; border-radius: 16px; }
}
.tabs [role="tabpanel"][hidden] { display: none; }

/* Progress */
.progress {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-strong);
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gradient);
  transition: width 0.25s linear;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  min-height: 1.5em;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2); }
.is-generating .status-dot { background: var(--accent-2); animation: pulse 1s infinite; }

/* 9. Output previews ------------------------------------------------------- */
.preview-surface {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem;
  min-height: 220px;
}

.code-block {
  margin: 0;
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: #0a0c16;
  color: #c9d1f5;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.6;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  white-space: pre;
}
.code-block .k { color: #c792ea; }
.code-block .s { color: #c3e88d; }
.code-block .n { color: #f78c6c; }
.code-block .c { color: #697098; }

/* Chat */
.chat-window { display: flex; flex-direction: column; gap: 0.75rem; max-height: 420px; overflow-y: auto; padding: 0.25rem; }
.msg { display: flex; gap: 0.6rem; align-items: flex-end; max-width: 85%; animation: rise 0.35s ease both; }
.msg .avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-size: 1rem; background: var(--accent-soft); }
.msg .bubble { padding: 0.7rem 1rem; border-radius: 16px 16px 16px 4px; background: var(--surface-strong); font-size: 0.92rem; }
.msg.user { align-self: flex-end; flex-direction: row-reverse; }
.msg.user .bubble { background: var(--gradient); color: #fff; border-radius: 16px 16px 4px 16px; }
.chat-input { display: flex; gap: 0.5rem; margin-top: 1rem; }
.chat-input input { flex: 1; }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }

/* Image grid */
.image-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.image-tile {
  position: relative;
  aspect-ratio: 1;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-strong);
  animation: rise 0.4s ease both;
}
.image-tile .art { position: absolute; inset: 0; }
.image-tile figcaption {
  position: absolute;
  left: 0.5rem; right: 0.5rem; bottom: 0.5rem;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.72rem;
  backdrop-filter: blur(6px);
}
.image-grid[data-ratio="16:9"] .image-tile { aspect-ratio: 16 / 9; }
.image-grid[data-ratio="9:16"] .image-tile { aspect-ratio: 9 / 16; }
.image-grid[data-ratio="4:3"] .image-tile { aspect-ratio: 4 / 3; }

/* Video */
.video-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(135deg, #1f1147, #3b0d2c 60%, #4a1d0a);
  display: grid;
  place-items: center;
  color: #fff;
}
.video-stage .scene-title { position: relative; z-index: 1; text-align: center; padding: 1rem; }
.video-stage .scene-title strong { display: block; font-size: clamp(1.1rem, 3vw, 1.7rem); }
.video-stage .play {
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(6px);
  font-size: 1.4rem;
  margin: 0 auto 0.75rem;
  border: 0; color: #fff; cursor: pointer;
}
.video-stage .rec {
  position: absolute; top: 0.75rem; left: 0.75rem;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em;
  padding: 0.2rem 0.55rem; border-radius: 6px; background: rgba(239, 68, 68, 0.85);
}
.video-stage .timecode { position: absolute; bottom: 0.75rem; right: 0.75rem; font-family: var(--mono); font-size: 0.78rem; opacity: 0.85; }
.timeline { margin-top: 1rem; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
.track { display: flex; gap: 4px; align-items: center; }
.track-label { width: 64px; flex: none; font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.track .clip {
  height: 34px;
  border-radius: 8px;
  background: var(--gradient);
  display: flex;
  align-items: center;
  padding: 0 0.6rem;
  font-size: 0.72rem;
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
  animation: rise 0.35s ease both;
}
.track .clip.alt { background: color-mix(in srgb, var(--accent-2) 70%, #000 0%); }
.track .clip.audio {
  background: repeating-linear-gradient(90deg, var(--accent-soft) 0 3px, transparent 3px 6px), var(--surface-strong);
  color: var(--text);
}

/* Agent graph & log */
.agent-graph { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.agent-node {
  flex: 1 1 100px;
  text-align: center;
  padding: 0.85rem 0.5rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.8rem;
  transition: border-color 0.3s, background 0.3s;
}
.agent-node .emoji { display: block; font-size: 1.4rem; }
.agent-node.is-active { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 4px var(--accent-soft); }
.agent-node.is-done { border-color: #10b981; }
.agent-arrow { color: var(--text-muted); flex: none; }
.log { list-style: none; margin: 0; padding: 0; font-family: var(--mono); font-size: 0.8rem; display: grid; gap: 0.4rem; max-height: 260px; overflow-y: auto; }
.log li { padding: 0.45rem 0.7rem; border-radius: 8px; background: var(--surface); border-left: 3px solid var(--accent); animation: rise 0.3s ease both; }
.log li.ok { border-left-color: #10b981; }
.log li.tool { border-left-color: var(--accent-2); }

/* Prompt */
.prompt-output { font-family: var(--mono); font-size: 0.88rem; line-height: 1.7; white-space: pre-wrap; }
.prompt-output mark { background: var(--accent-soft); color: var(--accent); padding: 0 0.25rem; border-radius: 4px; }
.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.75rem; margin-top: 1rem; }
.score { padding: 0.75rem; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--border); }
.score span { display: block; font-size: 0.75rem; color: var(--text-muted); }
.score strong { font-size: 1.3rem; color: var(--heading); }

/* App canvas */
.app-canvas { display: grid; grid-template-columns: 1fr auto; gap: 1rem; align-items: start; }
@media (max-width: 640px) { .app-canvas { grid-template-columns: 1fr; } }
.phone {
  width: 220px;
  margin-inline: auto;
  border-radius: 32px;
  padding: 12px;
  background: #0a0c16;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: var(--shadow);
}
.phone-screen {
  border-radius: 22px;
  min-height: 400px;
  background: #fff;
  color: #111;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.phone-bar { padding: 0.9rem 1rem 0.7rem; color: #fff; background: var(--app-color, var(--accent)); font-weight: 700; font-size: 0.9rem; }
.phone-body { padding: 0.75rem; display: grid; gap: 0.5rem; flex: 1; align-content: start; }
.phone-block { border-radius: 10px; background: #f1f3f9; padding: 0.6rem; font-size: 0.72rem; animation: rise 0.3s ease both; }
.phone-block.hero-block { height: 70px; background: linear-gradient(135deg, var(--app-color, var(--accent)), #111); color: #fff; display: flex; align-items: flex-end; }
.phone-block.btn-block { text-align: center; background: var(--app-color, var(--accent)); color: #fff; font-weight: 700; }
.phone-tabs { display: flex; justify-content: space-around; padding: 0.6rem; border-top: 1px solid #e5e7ef; font-size: 1rem; }
.component-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.component-list li { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.6rem 0.8rem; border-radius: var(--radius-sm); border: 1px dashed var(--border); background: var(--surface); font-size: 0.88rem; }

/* Workflow */
.flow { display: grid; gap: 0; position: relative; }
.flow-node {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  animation: rise 0.35s ease both;
}
.flow-node .emoji { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); flex: none; }
.flow-node small { display: block; color: var(--text-muted); font-size: 0.78rem; }
.flow-node .badge { margin-left: auto; }
.flow-node.trigger { border-color: var(--accent); }
.flow-connector { width: 2px; height: 22px; margin-left: 2.1rem; background: linear-gradient(var(--accent), var(--accent-2)); }
.flow-node.is-running { box-shadow: 0 0 0 4px var(--accent-soft); border-color: var(--accent); }

/* Voice */
.waveform { display: flex; align-items: center; justify-content: center; gap: 3px; height: 120px; padding: 0 0.5rem; }
.waveform span {
  flex: 1;
  max-width: 6px;
  border-radius: 999px;
  background: var(--gradient);
  height: 20%;
  transition: height 0.2s;
}
.waveform.is-playing span { animation: wave 1s ease-in-out infinite; }
.voice-player { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; }
.voice-player .play-btn { width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--gradient); color: #fff; font-size: 1.2rem; cursor: pointer; flex: none; }
.voice-player .progress { flex: 1; }
.transcript { margin-top: 1rem; font-size: 0.92rem; color: var(--text-muted); }

/* Generic output item */
.output-meta { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }

/* 10. Footer --------------------------------------------------------------- */
.site-footer {
  margin-top: 4rem;
  padding: 3rem 0 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.92rem;
}
.footer-grid { display: grid; grid-template-columns: 1.5fr repeat(2, 1fr); gap: 2rem; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h2 { font-size: 0.95rem; margin-bottom: 0.75rem; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.4rem; }
.site-footer a { text-decoration: none; color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }
.footer-bottom { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }
.footer-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem 1rem; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 150%);
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  color: var(--heading);
  font-size: 0.9rem;
  z-index: 200;
  transition: transform 0.3s ease;
}
.toast.is-visible { transform: translate(-50%, 0); }

/* 11. Utilities & animations ---------------------------------------------- */
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.muted { color: var(--text-muted); }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

@keyframes float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(30px, -30px); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes blink { 0%, 80%, 100% { opacity: 0.3; } 40% { opacity: 1; } }
@keyframes wave { 0%, 100% { transform: scaleY(0.4); } 50% { transform: scaleY(1); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* Builder page layout helpers */
.builder-hero .hero-actions { justify-content: flex-start; }
.grid-mini { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.related-head { margin-bottom: 1.25rem; }
.related-head h2 { margin: 0; }
.code-head { margin-bottom: 0.75rem; }
