:root{
  /* Klein Blue palette */
  --kb: #002FA7;
  --kb-2: #1a4fff;
  --bg: #06070b;
  --surface: rgba(0,47,167,.10);
  --surface-2: rgba(0,47,167,.16);
  --text: rgba(214,228,255,.92);
  --muted: rgba(214,228,255,.72);
  --border: rgba(0,47,167,.28);
  --shadow: 0 18px 70px rgba(0,0,0,.55);
  --primary: var(--kb);
  --primary-2: var(--kb-2);
  --ring: 0 0 0 4px rgba(0,47,167,.22);
  --radius: 18px;
  --radius-sm: 12px;
  --container: 1560px;
  --header-h: 76px;
  --grad: linear-gradient(90deg, rgba(0,47,167,.98), rgba(26,79,255,.92));
  --glow-blue-soft: 0 16px 60px rgba(0,0,0,.36), 0 0 56px rgba(0,47,167,.18);
}

@media (prefers-color-scheme: light){
  :root{
    /* Light mode but still Klein-blue dominated */
    --bg: #050610;
    --surface: rgba(0,47,167,.11);
    --surface-2: rgba(0,47,167,.17);
    --text: rgba(214,228,255,.92);
    --muted: rgba(214,228,255,.72);
    --border: rgba(0,47,167,.28);
    --shadow: 0 18px 70px rgba(0,0,0,.55);
    --ring: 0 0 0 4px rgba(0,47,167,.20);
  }
}

html[data-theme="dark"]{ color-scheme: dark; }
html[data-theme="light"]{ color-scheme: light; }

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

/* Grok-like subtle dynamic background */
body::before{
  content:"";
  position: fixed;
  inset: -20vh -20vw;
  z-index: -2;
  background:
    radial-gradient(900px 520px at 20% 18%, rgba(0,47,167,.22), transparent 60%),
    radial-gradient(900px 520px at 80% 28%, rgba(0,47,167,.14), transparent 58%),
    radial-gradient(900px 520px at 60% 78%, rgba(26,79,255,.16), transparent 60%);
  filter: blur(12px);
  opacity: .95;
  animation: drift 18s ease-in-out infinite alternate;
}
body::after{
  content:"";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(transparent, rgba(0,47,167,.05)),
    repeating-linear-gradient(90deg, rgba(0,47,167,.10) 0 1px, transparent 1px 120px),
    repeating-linear-gradient(0deg, rgba(0,47,167,.08) 0 1px, transparent 1px 120px);
  opacity: .12;
  mask-image: radial-gradient(circle at 50% 10%, rgba(0,47,167,.55), transparent 70%);
}
@keyframes drift{
  from{ transform: translate3d(-1.5%, -1%, 0) scale(1.02); }
  to{ transform: translate3d(1.5%, 1%, 0) scale(1.04); }
}
a{ color: inherit; text-decoration: none; }
button{ font: inherit; color: inherit; }

.container{ width: min(var(--container), calc(100% - 88px)); margin: 0 auto; }
.container-fluid{ width: calc(100% - 48px); margin: 0 auto; max-width: none; }
.sr-only{ position:absolute; width:1px;height:1px; padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0; }
.muted{ color: var(--muted); }

.skip-link{
  position: absolute; left: 16px; top: 8px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transform: translateY(-140%);
  transition: transform .2s ease;
  z-index: 9999;
}
.skip-link:focus{ transform: translateY(0); outline: none; box-shadow: var(--ring); }

/* Header */
.site-header{
  position: sticky; top: 0; z-index: 1000;
  backdrop-filter: blur(16px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.site-header.is-elevated{ border-bottom-color: var(--border); box-shadow: 0 6px 28px rgba(0,0,0,.20); }
.header-inner{ height: var(--header-h); display:flex; align-items:center; justify-content:space-between; gap: 16px; }
.brand{ display:flex; align-items:center; gap: 10px; font-weight: 750; letter-spacing: .2px; }
.brand-mark{
  width: 34px; height: 34px; border-radius: 12px;
  display:grid; place-items:center;
  background: linear-gradient(180deg, rgba(26,79,255,.95), rgba(0,47,167,.92));
  color: rgba(214,228,255,.95);
  box-shadow: 0 16px 46px rgba(0,0,0,.35), 0 0 56px rgba(0,47,167,.22);
}
.brand-text{ font-size: 16px; }

.nav{ display:flex; align-items:center; }
.nav-menu{
  display:flex; align-items:center; gap: 8px;
  padding: 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.nav-link{
  padding: 10px 12px;
  border-radius: 999px;
  color: var(--muted);
  transition: background .2s ease, color .2s ease;
}
.nav-link:hover{ background: var(--surface-2); color: var(--text); }
.nav-link.is-active{ background: rgba(0,47,167,.20); color: var(--text); }
.nav-toggle{
  display:none;
  align-items:center; justify-content:center;
  width: 44px; height: 44px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
}
.nav-toggle:focus{ outline:none; box-shadow: var(--ring); }
.nav-toggle-icon{
  width: 18px; height: 2px; background: var(--text);
  position: relative; border-radius: 999px;
}
.nav-toggle-icon::before,.nav-toggle-icon::after{
  content:""; position:absolute; left:0;
  width: 18px; height: 2px; background: var(--text);
  border-radius: 999px;
}
.nav-toggle-icon::before{ top:-6px; }
.nav-toggle-icon::after{ top:6px; }

.header-actions{ display:flex; align-items:center; gap: 10px; }
.icon-btn{
  width: 44px; height: 44px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  display:grid; place-items:center;
  cursor:pointer;
}
.icon-btn:focus{ outline:none; box-shadow: var(--ring); }
.icon-sun{
  width: 18px; height: 18px; display:block;
  background: radial-gradient(circle at 30% 30%, rgba(26,79,255,.95), rgba(0,47,167,.55));
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(0,47,167,.22) inset;
}

/* Buttons */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap: 8px;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor:pointer;
  transition: transform .15s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.btn:hover{ background: var(--surface-2); transform: translateY(-0.5px); }
.btn:active{ transform: translateY(0); }
.btn:focus{ outline:none; box-shadow: var(--ring); }
.btn-primary{
  border-color: rgba(26,79,255,.45);
  background: linear-gradient(180deg, rgba(26,79,255,.95), rgba(0,47,167,.92));
  color: var(--text);
  box-shadow: 0 18px 50px rgba(0,0,0,.38), 0 0 52px rgba(0,47,167,.22);
}
.btn-primary:hover{
  filter: brightness(1.03);
  box-shadow: 0 18px 52px rgba(0,0,0,.38), 0 0 66px rgba(0,47,167,.28);
}
.btn-secondary{
  border-color: rgba(0,47,167,.28);
  background: color-mix(in srgb, var(--surface) 72%, rgba(0,47,167,.10));
}
.btn-ghost{ background: transparent; }
.btn-danger{
  border-color: rgba(239,68,68,.35);
  background: linear-gradient(180deg, rgba(239,68,68,.15), rgba(239,68,68,.08));
}

/* Layout cards/panels */
.section{ padding: 72px 0; }
.section-alt{ background: linear-gradient(180deg, transparent, rgba(0,47,167,.06), transparent); }
.section-head{ margin-bottom: 18px; display:flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section h2{ margin: 0; font-size: 28px; letter-spacing: -0.3px; }

.panel{
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(0,47,167,.14), rgba(0,47,167,.08));
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--glow-blue-soft);
}
.cards{ display:grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card{
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(0,47,167,.12), rgba(0,47,167,.07));
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 16px 60px rgba(0,0,0,.22), 0 0 44px rgba(0,47,167,.16);
  transition: transform .18s ease, border-color .2s ease, background .2s ease;
}
.card:hover{
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--border) 55%, rgba(0,47,167,.45));
  background: linear-gradient(180deg, rgba(0,47,167,.14), rgba(0,47,167,.08));
}
.card-icon{
  width: 42px; height: 42px; border-radius: 14px;
  display:grid; place-items:center;
  background: linear-gradient(180deg, rgba(0,47,167,.16), rgba(0,47,167,.08));
  border: 1px solid var(--border);
  margin-bottom: 12px;
}
.card h3{ margin: 0 0 8px; font-size: 18px; }
.card p{ margin: 0 0 12px; }
.card-link{ display:inline-flex; align-items:center; gap: 6px; font-weight: 650; color: color-mix(in srgb, var(--text) 78%, var(--primary)); }
.card-link:hover{ text-decoration: underline; }

.grid-2{ display:grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row{ display:flex; flex-wrap:wrap; gap: 12px; align-items:center; }

/* Pages */
.page-hero{ padding: 48px 0 22px; }
.page-hero h1{ margin: 0 0 10px; font-size: 34px; }
.breadcrumbs{ color: var(--muted); display:flex; gap: 8px; align-items:center; flex-wrap:wrap; }
.breadcrumbs a{ color: color-mix(in srgb, var(--muted) 70%, var(--primary)); }

/* Forms */
.form{ display:grid; gap: 12px; }
.field label{ display:block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.field input,.field textarea,.field select{
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 86%, rgba(0,47,167,.12));
  color: var(--text);
}
.field textarea{ min-height: 120px; resize: vertical; }
.field input:focus,.field textarea:focus,.field select:focus{ outline:none; box-shadow: var(--ring); }
.hint{ font-size: 12px; color: var(--muted); }
.field label:has(input[type="checkbox"]){
  display:flex; align-items:center; gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 82%, rgba(0,47,167,.08));
  cursor: pointer;
  margin-bottom: 0;
  user-select: none;
}
.field label:has(input[type="checkbox"]):hover{ background: color-mix(in srgb, var(--surface) 72%, rgba(0,47,167,.16)); }
.field input[type="checkbox"]{ width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }

/* Reveal */
.reveal{ opacity: 0; transform: translateY(10px); transition: opacity .5s ease, transform .5s ease; }
.reveal.is-visible{ opacity: 1; transform: translateY(0); }

/* Hero (marketing) */
.hero{ padding: calc(64px + 18px) 0 44px; }
.hero-grid{ display:grid; grid-template-columns: 1.15fr .85fr; gap: 32px; align-items:center; }
.eyebrow{
  display:inline-flex; padding: 8px 12px;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted);
  margin: 0 0 14px;
}
.hero-title{ font-size: clamp(34px, 3.6vw, 54px); line-height: 1.06; margin: 0 0 12px; letter-spacing: -0.6px; }
.gradient-text{ background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-subtitle{ margin: 0 0 20px; color: var(--muted); font-size: 16px; }
.hero-cta{ display:flex; flex-wrap: wrap; gap: 12px; margin: 0 0 18px; }
.stats{ margin: 18px 0 0; padding: 0; display:grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat{ border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-sm); padding: 12px 12px; }
.stat dt{ color: var(--muted); font-size: 12px; }
.stat dd{ margin: 6px 0 0; font-weight: 800; font-size: 22px; letter-spacing: .2px; }
.unit{ opacity: .9; margin-left: 2px; }

/* Hero art + feature list */
.hero-art{
  position: relative;
  border-radius: 26px;
  border: 1px solid rgba(0,47,167,.30);
  background: linear-gradient(180deg, rgba(0,47,167,.16), rgba(0,47,167,.08));
  box-shadow: var(--shadow);
  overflow:hidden;
  padding: 16px;
  min-height: 360px;
}
.orb{
  position:absolute;
  border-radius: 999px;
  filter: blur(12px);
  opacity: .9;
}
.orb.a{
  width: 240px; height: 240px;
  left: -40px; top: -40px;
  background: radial-gradient(circle at 30% 30%, rgba(143,179,255,.22), rgba(143,179,255,0));
}
.orb.b{
  width: 260px; height: 260px;
  right: -60px; bottom: -50px;
  background: radial-gradient(circle at 30% 30%, rgba(26,79,255,.16), rgba(26,79,255,0));
}
.hero-art-inner{ position: relative; z-index: 1; display:grid; gap: 12px; }
.pill{
  display:inline-flex;
  align-items:center;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,47,167,.28);
  background: rgba(0,47,167,.16);
  color: var(--muted);
  font-size: 12px;
  width: fit-content;
}
.feature-list{ margin: 6px 0 0; padding: 0; list-style: none; display:grid; gap: 10px; }
.feature{
  display:flex;
  gap: 10px;
  align-items:flex-start;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 82%, rgba(143,179,255,.05));
}
.feature-bullet{
  width: 34px; height: 34px;
  border-radius: 14px;
  display:grid;
  place-items:center;
  background: rgba(0,47,167,.14);
  border: 1px solid var(--border);
  flex: 0 0 auto;
}
.feature h3{ margin: 0; font-size: 15px; }
.feature p{ margin: 4px 0 0; color: var(--muted); font-size: 13px; }

/* Why choose (steps) */
.steps{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.step{
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.step-no{
  font-weight: 900;
  letter-spacing: .6px;
  color: color-mix(in srgb, var(--muted) 70%, var(--primary));
}
.step h3{ margin: 10px 0 6px; }
.step p{ margin: 0; color: var(--muted); }

/* Floating CTA */
.float-cta{
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  display:flex;
  flex-direction: column;
  gap: 10px;
}
.float-cta .btn{
  box-shadow: 0 16px 40px rgba(0,0,0,.28), 0 0 56px rgba(0,47,167,.18);
}
.float-cta-note{
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 86%, rgba(0,47,167,.12));
  color: var(--muted);
  max-width: 280px;
  font-size: 12px;
}

/* Footer */
.footer{
  padding: 26px 0 42px;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, rgba(0,47,167,.05));
}
.footer-inner{ display:grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 18px; align-items:start; }
.footer-links{ display:flex; flex-wrap:wrap; gap: 10px 14px; align-content:flex-start; }
.footer-links a{ color: var(--muted); }
.footer-links a:hover{ color: var(--text); text-decoration: underline; }
.footer-meta{ text-align:right; }

/* App / Dashboard */
.badge{
  display:inline-flex; align-items:center; gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
}
.badge strong{ color: var(--text); font-weight: 800; }
.kpi{ display:flex; flex-wrap:wrap; gap: 10px; margin-top: 10px; }
.kpi .badge{ background: color-mix(in srgb, var(--surface) 80%, rgba(0,47,167,.10)); }
.divider{ height:1px; background: var(--border); margin: 14px 0; }

/* Tabs (AI + settings) */
.tabs{ display:flex; flex-wrap:wrap; gap: 8px; }
.tab{
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor:pointer;
  transition: background .2s ease, transform .15s ease, color .2s ease, border-color .2s ease;
}
.tab:hover{ background: var(--surface-2); transform: translateY(-0.5px); color: var(--text); }
.tab.is-active{
  background: rgba(0,47,167,.20);
  border-color: color-mix(in srgb, var(--border) 55%, rgba(0,47,167,.65));
  color: var(--text);
}
.tab-panels{ display:grid; gap: 14px; margin-top: 14px; }
.tab-panel{ display:none; }
.tab-panel.is-active{ display:block; }

/* Chat */
.chat{
  border: 1px solid var(--border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 90%, rgba(0,47,167,.10));
  overflow:hidden;
}
.chat-log{
  height: 360px;
  overflow:auto;
  padding: 14px;
  display:flex;
  flex-direction: column;
  gap: 10px;
}
.chat-row{ display:flex; }
.chat-row.is-user{ justify-content: flex-end; }
.chat-bubble{
  max-width: min(720px, 92%);
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.chat-row.is-user .chat-bubble{
  background: rgba(0,47,167,.20);
  border-color: color-mix(in srgb, var(--border) 55%, rgba(0,47,167,.55));
}
.chat-row.is-ai .chat-bubble{
  background: color-mix(in srgb, var(--surface) 78%, rgba(0,47,167,.10));
}
.chat-input{
  display:flex;
  gap: 10px;
  padding: 12px;
  border-top: 1px solid var(--border);
  background: rgba(0,47,167,.10);
}
.chat-input input{
  flex: 1;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, rgba(0,47,167,.10));
  color: var(--text);
}
.chat-input input:focus{ outline:none; box-shadow: var(--ring); }

/* Canvas */
.ai-canvas{
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 0;
  border: none;
  background: transparent;
  display:block;
}
.t2i-canvas{ aspect-ratio: 1 / 1; }
.i2i-canvas{ aspect-ratio: 3 / 2; }
.ecom-canvas{ aspect-ratio: 1 / 1; }
.preview{
  border-radius: 18px;
  border: none;
  background: transparent;
  padding: 0;
  overflow:hidden;
}
.preview svg,
.preview img,
.preview canvas{ width: 100%; height: auto; display:block; }

/* Responsive */
@media (max-width: 980px){
  .hero-grid{ grid-template-columns: 1fr; }
  .stats{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards{ grid-template-columns: 1fr; }
  .grid-2{ grid-template-columns: 1fr; }
  .footer-inner{ grid-template-columns: 1fr; }
  .footer-meta{ text-align:left; }
  .steps{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section{ padding: 56px 0; }
}

@media (min-width: 1200px){
  .cards{ grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 760px){
  :root{ --header-h: 70px; }
  .nav-toggle{ display:inline-flex; }
  .nav-menu{
    position: fixed;
    top: calc(var(--header-h) + 12px);
    right: 24px; left: 24px;
    display:none;
    flex-direction: column;
    align-items: stretch;
    border-radius: 18px;
    padding: 12px;
    gap: 6px;
    box-shadow: var(--shadow);
  }
  .nav-menu.is-open{ display:flex; }
  .nav-link{ border-radius: 14px; }
  .header-actions .btn{ display:none; }
  .float-cta{ right: 12px; left: 12px; bottom: 12px; }
  .float-cta .btn{ width: 100%; }
  .float-cta-note{ display:none; }
}
