/* ==========================================================================
   AI App Builder — theme
   ========================================================================== */

:root{
  --bg-0:#08070f;
  --bg-1:#0d0c1a;
  --bg-2:#131226;
  --surface:#151329cc;
  --surface-solid:#15132a;
  --border:#2b2650;
  --border-soft:#221f42;

  --violet:#8b5cf6;
  --violet-2:#a78bfa;
  --cyan:#22d3ee;
  --magenta:#ec4899;
  --blue:#3b82f6;

  --text-0:#f4f2ff;
  --text-1:#c9c5e6;
  --text-2:#8d88b3;
  --text-3:#635f8a;

  --ok:#34d399;
  --warn:#fbbf24;
  --err:#fb7185;

  --grad-brand: linear-gradient(120deg, var(--violet) 0%, var(--magenta) 55%, var(--cyan) 100%);
  --grad-brand-soft: linear-gradient(120deg, rgba(139,92,246,.18), rgba(236,72,153,.14) 55%, rgba(34,211,238,.16) 100%);

  --radius-sm:10px;
  --radius-md:16px;
  --radius-lg:24px;

  --shadow-soft: 0 20px 60px -20px rgba(0,0,0,.6);
  --shadow-glow: 0 0 0 1px rgba(139,92,246,.25), 0 20px 60px -20px rgba(139,92,246,.45);

  --font-display:'Sora', 'Space Grotesk', system-ui, sans-serif;
  --font-body:'Space Grotesk', system-ui, sans-serif;
  --font-mono:'JetBrains Mono', ui-monospace, Menlo, monospace;
}

*,*::before,*::after{ box-sizing:border-box; }

html{
  scroll-behavior:smooth;
  scroll-padding-top: calc(76px + env(safe-area-inset-top,0px));
}

body{
  margin:0;
  min-height:100vh;
  background:var(--bg-0);
  color:var(--text-0);
  font-family:var(--font-body);
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
  padding-top: env(safe-area-inset-top,0px);
  padding-bottom: env(safe-area-inset-bottom,0px);
  overflow-x:hidden;
}

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

::selection{ background:rgba(139,92,246,.4); color:#fff; }

::-webkit-scrollbar{ width:10px; height:10px; }
::-webkit-scrollbar-track{ background:var(--bg-1); }
::-webkit-scrollbar-thumb{ background:#332e5e; border-radius:8px; }
::-webkit-scrollbar-thumb:hover{ background:#463f80; }

a{ color:inherit; }

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

.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;
}
.hidden{ display:none !important; }

/* ---------------- background fx ---------------- */
#bg-fx{ position:fixed; inset:0; z-index:-1; overflow:hidden; background:
  radial-gradient(1200px 700px at 15% -10%, #1c1440 0%, transparent 55%),
  radial-gradient(1000px 700px at 110% 10%, #0e2a3a 0%, transparent 55%),
  var(--bg-0);
}
.orb{ position:absolute; border-radius:50%; filter:blur(90px); opacity:.35; }
.orb-a{ width:520px; height:520px; background:var(--violet); top:-150px; left:-120px; animation:float1 22s ease-in-out infinite; }
.orb-b{ width:460px; height:460px; background:var(--cyan); bottom:-160px; right:-100px; animation:float2 26s ease-in-out infinite; }
.orb-c{ width:380px; height:380px; background:var(--magenta); top:35%; left:60%; animation:float1 30s ease-in-out infinite reverse; opacity:.22; }
.grid-overlay{
  position:absolute; inset:0;
  background-image:
    linear-gradient(rgba(255,255,255,.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.02) 1px, transparent 1px);
  background-size:44px 44px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 90%);
}
@keyframes float1{ 0%,100%{ transform:translate(0,0);} 50%{ transform:translate(40px,60px);} }
@keyframes float2{ 0%,100%{ transform:translate(0,0);} 50%{ transform:translate(-50px,-30px);} }
@media (prefers-reduced-motion: reduce){ .orb{ animation:none; } }

/* ---------------- topbar ---------------- */
.topbar{
  position:sticky; top:0; z-index:40;
  padding-top: env(safe-area-inset-top,0px);
  background:rgba(8,7,15,.72);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom:1px solid var(--border-soft);
}
.topbar-inner{
  max-width:1280px; margin:0 auto; padding:12px 24px;
  display:flex; align-items:center; gap:20px;
}
.brand{
  display:flex; align-items:center; gap:10px;
  background:none; border:0; cursor:pointer;
  font-family:var(--font-display); font-weight:700; font-size:1.05rem;
  color:var(--text-0); padding:6px 4px;
}
.brand-mark{
  width:34px; height:34px; border-radius:10px;
  display:grid; place-items:center;
  background:var(--grad-brand); color:#0a0714; font-size:1.05rem;
  box-shadow: 0 6px 20px -6px rgba(139,92,246,.7);
}
.main-nav{ display:flex; gap:4px; margin-left:8px; flex:1; }
.nav-link{
  background:none; border:0; color:var(--text-2);
  font-family:var(--font-body); font-size:.92rem; font-weight:500;
  padding:9px 14px; border-radius:10px; cursor:pointer;
  transition:.2s color, .2s background;
}
.nav-link:hover{ color:var(--text-0); background:rgba(255,255,255,.05); }
.nav-link.active{ color:var(--text-0); background:rgba(139,92,246,.16); }
.topbar-actions{ display:flex; align-items:center; gap:12px; margin-left:auto; }

.provider-badge{
  display:flex; align-items:center; gap:7px;
  font-size:.78rem; color:var(--text-2);
  border:1px solid var(--border-soft); padding:6px 10px; border-radius:999px;
}
.provider-badge .dot{ width:8px; height:8px; border-radius:50%; background:var(--err); box-shadow:0 0 8px currentColor; }
.provider-badge.connected .dot{ background:var(--ok); }
.provider-badge.connected{ color:var(--text-1); }

.hamburger{ display:none; flex-direction:column; gap:4px; background:none; border:0; cursor:pointer; padding:8px; margin-left:auto; }
.hamburger span{ width:22px; height:2px; background:var(--text-0); border-radius:2px; }
.mobile-nav{ display:none; flex-direction:column; padding:8px 20px 16px; gap:4px; border-top:1px solid var(--border-soft); }
.mobile-nav.open{ display:flex; }
.mobile-nav .nav-link{ text-align:left; }

@media (max-width:860px){
  .main-nav, .topbar-actions{ display:none; }
  .hamburger{ display:flex; }
}

/* ---------------- buttons ---------------- */
.btn{
  font-family:var(--font-body); font-weight:600; font-size:.92rem;
  border-radius:12px; border:1px solid transparent; cursor:pointer;
  padding:11px 18px; display:inline-flex; align-items:center; gap:8px;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, border-color .2s ease;
  white-space:nowrap;
}
.btn:active{ transform:translateY(1px) scale(.99); }
.btn-primary{
  background:var(--grad-brand); color:#0a0714;
  box-shadow:0 10px 30px -10px rgba(139,92,246,.65);
}
.btn-primary:hover{ box-shadow:0 14px 34px -8px rgba(236,72,153,.6); transform:translateY(-1px); }
.btn-secondary{
  background:rgba(255,255,255,.06); color:var(--text-0);
  border-color:var(--border);
}
.btn-secondary:hover{ background:rgba(255,255,255,.1); border-color:var(--violet-2); }
.btn-ghost{ background:transparent; color:var(--text-1); border-color:var(--border-soft); }
.btn-ghost:hover{ color:var(--text-0); border-color:var(--violet-2); background:rgba(139,92,246,.08); }
.btn-lg{ padding:15px 26px; font-size:1rem; border-radius:14px; }
.btn-xl{ padding:17px 34px; font-size:1.05rem; border-radius:16px; }
.btn-sm{ padding:7px 12px; font-size:.82rem; border-radius:9px; }
.btn:disabled{ opacity:.45; cursor:not-allowed; transform:none !important; box-shadow:none !important; }

.chip{
  background:rgba(255,255,255,.05); border:1px solid var(--border-soft);
  color:var(--text-1); border-radius:999px; padding:7px 13px;
  font-size:.8rem; cursor:pointer; transition:.2s;
}
.chip:hover{ border-color:var(--cyan); color:var(--text-0); background:rgba(34,211,238,.08); }

/* ---------------- layout shells ---------------- */
.view{ display:none; }
.view.active{ display:block; animation:viewIn .35s ease; }
@keyframes viewIn{ from{ opacity:0; transform:translateY(8px);} to{ opacity:1; transform:none; } }

.page-shell{ max-width:1080px; margin:0 auto; padding:56px 24px 90px; }
.builder-shell{ max-width:1180px; margin:0 auto; padding:40px 20px 90px; }

.page-title{ font-family:var(--font-display); font-size:clamp(1.9rem,3.4vw,2.6rem); margin:0 0 8px; }
.page-sub{ color:var(--text-2); max-width:640px; margin:0 0 32px; font-size:1rem; }

/* ---------------- hero ---------------- */
.hero{ padding:70px 24px 40px; text-align:center; }
.hero-inner{ max-width:820px; margin:0 auto; }
.eyebrow-badge{
  display:inline-flex; align-items:center; gap:8px;
  border:1px solid var(--border); border-radius:999px;
  padding:7px 16px; font-size:.8rem; color:var(--text-1);
  background:var(--grad-brand-soft);
  margin:0 0 22px;
}
.hero-title{
  font-family:var(--font-display); font-weight:800;
  font-size:clamp(2.6rem,7vw,4.6rem); line-height:1.03; margin:0 0 14px;
  background:var(--grad-brand); -webkit-background-clip:text; background-clip:text; color:transparent;
  letter-spacing:-.02em;
}
.hero-tagline{ font-size:clamp(1.1rem,2.4vw,1.5rem); color:var(--text-0); font-weight:600; margin:0 0 18px; }
.hero-sub{ color:var(--text-2); font-size:1.05rem; max-width:600px; margin:0 auto 34px; }
.hero-ctas{ display:flex; gap:14px; justify-content:center; flex-wrap:wrap; margin-bottom:56px; }

.flow-strip{ display:flex; align-items:center; justify-content:center; gap:14px; flex-wrap:wrap; }
.flow-node{
  display:flex; flex-direction:column; align-items:center; gap:6px;
  background:var(--surface); border:1px solid var(--border-soft); border-radius:16px;
  padding:16px 22px; min-width:96px; font-weight:600; font-size:.82rem; color:var(--text-1);
  backdrop-filter:blur(10px);
}
.flow-node-ai{ border-color:var(--violet-2); box-shadow:var(--shadow-glow); animation:pulseGlow 2.6s ease-in-out infinite; }
@keyframes pulseGlow{ 0%,100%{ box-shadow:0 0 0 1px rgba(139,92,246,.25),0 0 24px -6px rgba(139,92,246,.5);} 50%{ box-shadow:0 0 0 1px rgba(236,72,153,.35),0 0 34px -4px rgba(236,72,153,.65);} }
.flow-icon{ font-size:1.5rem; }
.flow-arrow{ color:var(--text-3); font-size:1.3rem; }

/* ---------------- home sections ---------------- */
.section-title{ text-align:center; font-family:var(--font-display); font-size:1.7rem; margin:0 0 30px; }
.home-features{ max-width:1180px; margin:0 auto; padding:20px 24px 70px; }
.feature-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:18px; }
.feature-card{
  background:var(--surface); border:1px solid var(--border-soft); border-radius:var(--radius-md);
  padding:26px 22px; backdrop-filter:blur(10px);
  transition:transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.feature-card:hover{ transform:translateY(-4px); border-color:var(--violet-2); box-shadow:var(--shadow-soft); }
.feature-card .fc-icon{ font-size:1.7rem; }
.feature-card h3{ font-family:var(--font-display); margin:12px 0 6px; font-size:1.05rem; }
.feature-card p{ color:var(--text-2); font-size:.9rem; margin:0; }

.home-cta-band{
  max-width:1180px; margin:0 auto 80px; padding:34px 30px;
  background:var(--grad-brand-soft); border:1px solid var(--border-soft); border-radius:var(--radius-lg);
  display:flex; align-items:center; justify-content:space-between; gap:20px; flex-wrap:wrap;
}
.home-cta-band h2{ font-family:var(--font-display); margin:0 0 6px; font-size:1.4rem; }
.home-cta-band p{ margin:0; color:var(--text-2); }

/* ---------------- builder ---------------- */
.builder-head{ display:flex; justify-content:space-between; align-items:flex-end; gap:16px; margin-bottom:26px; flex-wrap:wrap; }

.input-tabs{ display:flex; gap:6px; flex-wrap:wrap; margin-bottom:0; }
.input-tab{
  background:var(--surface); border:1px solid var(--border-soft); border-bottom:none;
  color:var(--text-2); font-weight:600; font-size:.88rem;
  padding:11px 18px; border-radius:12px 12px 0 0; cursor:pointer;
}
.input-tab.active{ color:var(--text-0); background:var(--surface-solid); border-color:var(--violet-2); }

.card-surface{
  background:var(--surface-solid); border:1px solid var(--border-soft); border-radius:0 var(--radius-md) var(--radius-md) var(--radius-md);
  padding:26px; backdrop-filter:blur(10px);
}

.input-panel{ display:none; }
.input-panel.active{ display:block; animation:viewIn .25s ease; }

.field-label{ display:block; font-weight:600; font-size:.9rem; margin:0 0 10px; color:var(--text-1); }
.field-optional{ color:var(--text-3); font-weight:400; }

.prompt-textarea{
  width:100%; min-height:160px; resize:vertical;
  background:var(--bg-1); border:1px solid var(--border-soft); border-radius:var(--radius-sm);
  color:var(--text-0); font-family:var(--font-body); font-size:.96rem; padding:16px;
  line-height:1.55;
}
.prompt-textarea:focus{ border-color:var(--violet-2); }
.prompt-toolbar{ display:flex; justify-content:space-between; align-items:center; margin-top:10px; }
.char-counter{ font-size:.8rem; color:var(--text-3); }

.voice-box{ text-align:center; padding:30px 10px; }
.mic-btn{
  width:84px; height:84px; border-radius:50%; border:none; cursor:pointer;
  background:var(--grad-brand); font-size:2rem; color:#0a0714;
  box-shadow:0 0 0 6px rgba(139,92,246,.14);
  transition:transform .2s ease, box-shadow .2s ease;
}
.mic-btn:hover{ transform:scale(1.05); }
.mic-btn.listening{ animation:micPulse 1.2s ease-in-out infinite; background:linear-gradient(120deg,var(--err),var(--magenta)); }
@keyframes micPulse{ 0%,100%{ box-shadow:0 0 0 6px rgba(236,72,153,.18);} 50%{ box-shadow:0 0 0 16px rgba(236,72,153,.05);} }
.voice-status{ margin-top:16px; color:var(--text-2); font-size:.92rem; }

.dropzone{
  display:flex; flex-direction:column; align-items:center; gap:6px;
  border:1.5px dashed var(--border); border-radius:var(--radius-md);
  padding:36px 20px; cursor:pointer; text-align:center; color:var(--text-1);
  transition:.2s border-color, .2s background;
}
.dropzone:hover, .dropzone.dragover{ border-color:var(--cyan); background:rgba(34,211,238,.06); }
.dz-icon{ font-size:1.9rem; }
.dz-sub{ color:var(--text-3); font-size:.78rem; }

.screenshot-preview-wrap{ margin-top:18px; }
.screenshot-preview-wrap img{ max-height:280px; border-radius:var(--radius-sm); border:1px solid var(--border-soft); margin-bottom:14px; }
.screenshot-actions, .export-actions{ display:flex; gap:10px; flex-wrap:wrap; }

.analysis-box{
  margin-top:18px; background:var(--bg-1); border:1px solid var(--border-soft);
  border-radius:var(--radius-sm); padding:16px 18px; font-size:.88rem; color:var(--text-1);
  white-space:pre-wrap; line-height:1.6;
}
.requirements-file-info{ margin-top:14px; font-size:.88rem; color:var(--text-1); background:var(--bg-1); border:1px solid var(--border-soft); border-radius:var(--radius-sm); padding:12px 16px; }

#panel-screenshot .btn, #panel-requirements > .btn{ margin-top:16px; }

.template-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(210px,1fr)); gap:14px; }
.template-card{
  background:var(--bg-1); border:1px solid var(--border-soft); border-radius:var(--radius-md);
  padding:18px; display:flex; flex-direction:column; gap:8px;
  transition:transform .2s ease, border-color .2s ease;
}
.template-card:hover{ transform:translateY(-3px); border-color:var(--violet-2); }
.template-card .tc-icon{ font-size:1.6rem; }
.template-card h4{ margin:0; font-size:.98rem; font-family:var(--font-display); }
.template-card p{ margin:0; color:var(--text-2); font-size:.82rem; flex:1; }
.template-card .btn{ align-self:flex-start; margin-top:4px; }

.generate-bar{ text-align:center; margin:34px 0; }
.generate-hint{ margin-top:10px; font-size:.82rem; color:var(--text-3); }

.panel-block{ margin-top:44px; }
.block-title{ font-family:var(--font-display); font-size:1.3rem; margin:0 0 18px; }

.blueprint-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(240px,1fr)); gap:16px; }
.blueprint-card{
  background:var(--surface); border:1px solid var(--border-soft); border-radius:var(--radius-md);
  padding:18px 20px;
}
.blueprint-card h4{ margin:0 0 10px; font-size:.82rem; text-transform:uppercase; letter-spacing:.06em; color:var(--violet-2); }
.blueprint-card ul{ margin:0; padding-left:18px; color:var(--text-1); font-size:.9rem; line-height:1.7; }
.blueprint-card p{ margin:0; color:var(--text-1); font-size:.9rem; }
.blueprint-card.assumptions{ border-color:rgba(251,191,36,.35); }
.blueprint-card.missing{ border-color:rgba(251,113,133,.35); }

.pipeline{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:10px; }
.pipeline-step{
  display:flex; align-items:center; gap:14px; background:var(--surface);
  border:1px solid var(--border-soft); border-radius:var(--radius-sm); padding:14px 18px;
  opacity:.5; transition:.3s;
}
.pipeline-step.active{ opacity:1; border-color:var(--violet-2); box-shadow:0 0 0 1px rgba(139,92,246,.2); }
.pipeline-step.done{ opacity:1; border-color:rgba(52,211,153,.4); }
.ps-num{ font-family:var(--font-mono); color:var(--text-3); font-size:.85rem; }
.ps-label{ flex:1; font-weight:600; }
.ps-state{ font-size:.85rem; color:var(--text-2); }
.pipeline-step.active .ps-state::after{ content:'running…'; color:var(--cyan); }
.pipeline-step.done .ps-state::after{ content:'✓ done'; color:var(--ok); }
.pipeline-status{ margin-top:14px; color:var(--text-2); font-size:.88rem; text-align:center; }

.result-toolbar{ display:flex; justify-content:space-between; align-items:center; margin-bottom:18px; flex-wrap:wrap; gap:10px; }
.badge-soft{ background:rgba(139,92,246,.14); border:1px solid rgba(139,92,246,.3); color:var(--violet-2); padding:6px 14px; border-radius:999px; font-size:.82rem; font-weight:600; }

.workspace-card{
  background:var(--surface-solid); border:1px solid var(--border-soft); border-radius:var(--radius-md);
  padding:22px; margin-bottom:20px;
}
.workspace-card-head{ display:flex; justify-content:space-between; align-items:center; margin-bottom:16px; flex-wrap:wrap; gap:10px; }
.workspace-card-head h3{ margin:0; font-family:var(--font-display); font-size:1.05rem; }

.viewport-switch{ display:flex; gap:6px; background:var(--bg-1); padding:4px; border-radius:11px; }
.vp-btn{ background:none; border:0; color:var(--text-2); padding:7px 12px; border-radius:8px; cursor:pointer; font-size:.82rem; font-weight:600; }
.vp-btn.active{ background:var(--grad-brand); color:#0a0714; }

.preview-frame-wrap{
  background:var(--bg-1); border:1px solid var(--border-soft); border-radius:var(--radius-md);
  padding:18px; display:flex; justify-content:center; overflow:auto;
}
#preview-frame{ width:100%; height:560px; border:0; border-radius:12px; background:#fff; transition:width .3s ease; }
.preview-frame-wrap[data-viewport="tablet"] #preview-frame{ width:768px; max-width:100%; }
.preview-frame-wrap[data-viewport="mobile"] #preview-frame{ width:375px; max-width:100%; }

.modify-box{ display:flex; gap:10px; flex-wrap:wrap; }
.modify-input{
  flex:1; min-width:220px; background:var(--bg-1); border:1px solid var(--border-soft);
  border-radius:var(--radius-sm); color:var(--text-0); padding:12px 14px; font-family:var(--font-body);
}
.modify-examples{ display:flex; gap:8px; flex-wrap:wrap; margin-top:14px; }
.modify-log{ margin-top:16px; display:flex; flex-direction:column; gap:10px; }
.modify-log-item{ background:var(--bg-1); border:1px solid var(--border-soft); border-radius:var(--radius-sm); padding:14px 16px; font-size:.88rem; }
.modify-log-item .ml-label{ font-size:.72rem; text-transform:uppercase; letter-spacing:.05em; color:var(--text-3); display:block; margin-bottom:4px; }
.modify-log-item.request{ border-left:3px solid var(--cyan); }
.modify-log-item.update{ border-left:3px solid var(--violet-2); }
.modify-log-item.error{ border-left:3px solid var(--err); }

.code-file-tabs{ display:flex; gap:6px; }
.code-tab{ background:var(--bg-1); border:1px solid var(--border-soft); color:var(--text-2); font-family:var(--font-mono); font-size:.8rem; padding:7px 13px; border-radius:8px; cursor:pointer; }
.code-tab.active{ color:var(--text-0); border-color:var(--violet-2); background:rgba(139,92,246,.14); }
.code-toolbar{ display:flex; gap:8px; margin-bottom:10px; }
.code-view{
  margin:0; max-height:420px; overflow:auto; background:#0d0c1a !important;
  border:1px solid var(--border-soft); border-radius:var(--radius-sm); padding:18px;
  font-family:var(--font-mono); font-size:.82rem;
}
.code-view code{ font-family:var(--font-mono) !important; }

.test-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:8px; }
.test-item{ display:flex; align-items:flex-start; gap:12px; background:var(--bg-1); border:1px solid var(--border-soft); border-radius:var(--radius-sm); padding:12px 16px; font-size:.88rem; }
.test-icon{ font-size:1rem; margin-top:1px; }
.test-item.pass{ border-left:3px solid var(--ok); }
.test-item.warning{ border-left:3px solid var(--warn); }
.test-item.error{ border-left:3px solid var(--err); }
.test-item .test-label{ font-weight:600; display:block; }
.test-item .test-detail{ color:var(--text-2); font-size:.82rem; }

.debugger-list{ display:flex; flex-direction:column; gap:14px; }
.debug-card{ background:var(--bg-1); border:1px solid var(--border-soft); border-radius:var(--radius-md); padding:18px 20px; }
.debug-card .dc-row{ display:flex; gap:8px; font-size:.86rem; margin-bottom:6px; }
.debug-card .dc-key{ color:var(--text-3); min-width:90px; font-weight:600; }
.debug-card .dc-actions{ margin-top:12px; display:flex; gap:8px; flex-wrap:wrap; }
.debug-card.sev-error{ border-color:rgba(251,113,133,.4); }
.debug-card.sev-warning{ border-color:rgba(251,191,36,.35); }

.export-note{ color:var(--text-2); font-size:.88rem; margin:0 0 16px; }
.export-note code{ font-family:var(--font-mono); color:var(--violet-2); }

.history-list{ display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:14px; margin-bottom:14px; }
.history-card{ background:var(--surface); border:1px solid var(--border-soft); border-radius:var(--radius-md); padding:16px 18px; }
.history-card h4{ margin:0 0 4px; font-size:.95rem; font-family:var(--font-display); }
.history-card p{ margin:0 0 12px; color:var(--text-3); font-size:.78rem; }
.history-card .hc-actions{ display:flex; gap:8px; }
.empty-note{ color:var(--text-3); font-size:.85rem; }

/* ---------------- architecture ---------------- */
.arch-flow{ display:grid; grid-template-columns:repeat(auto-fit,minmax(230px,1fr)); gap:16px; margin:30px 0 40px; }
.arch-node{ background:var(--surface); border:1px solid var(--border-soft); border-radius:var(--radius-md); padding:20px; position:relative; }
.arch-num{
  display:inline-grid; place-items:center; width:30px; height:30px; border-radius:50%;
  background:var(--grad-brand); color:#0a0714; font-weight:700; font-size:.85rem; margin-bottom:10px;
}
.arch-node h3{ margin:0 0 6px; font-size:1rem; font-family:var(--font-display); }
.arch-node p{ margin:0; color:var(--text-2); font-size:.86rem; }

.honesty-card{ background:var(--grad-brand-soft); border:1px solid var(--border-soft); border-radius:var(--radius-lg); padding:26px 28px; }
.honesty-card h3{ margin:0 0 12px; font-family:var(--font-display); }
.honesty-card ul{ margin:0; padding-left:20px; color:var(--text-1); font-size:.92rem; line-height:1.8; }

/* ---------------- about ---------------- */
.about-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:16px; margin-bottom:26px; }
.about-card{ background:var(--surface); border:1px solid var(--border-soft); border-radius:var(--radius-md); padding:20px; }
.about-card h3{ margin:0 0 8px; font-size:.85rem; text-transform:uppercase; letter-spacing:.05em; color:var(--violet-2); }
.about-card p{ margin:0; color:var(--text-1); font-size:.92rem; }
.about-note{ background:var(--bg-2); border:1px solid var(--border-soft); border-radius:var(--radius-md); padding:20px 22px; margin-bottom:16px; }
.about-note h3{ margin:0 0 8px; font-size:1rem; }
.about-note p{ margin:0; color:var(--text-1); font-size:.9rem; line-height:1.65; }

/* ---------------- modal ---------------- */
.modal-backdrop{
  position:fixed; inset:0; background:rgba(4,3,10,.72); backdrop-filter:blur(4px);
  display:flex; align-items:center; justify-content:center; z-index:100; padding:20px;
}
.modal{
  background:var(--surface-solid); border:1px solid var(--border); border-radius:var(--radius-lg);
  width:100%; max-width:460px; box-shadow:var(--shadow-glow); max-height:90vh; overflow:auto;
}
.modal-head{ display:flex; justify-content:space-between; align-items:center; padding:20px 22px; border-bottom:1px solid var(--border-soft); }
.modal-head h2{ margin:0; font-size:1.1rem; font-family:var(--font-display); }
.modal-close{ background:none; border:0; color:var(--text-2); font-size:1.1rem; cursor:pointer; }
.modal-body{ padding:22px; display:flex; flex-direction:column; gap:4px; }
.select-input, .text-input{
  width:100%; background:var(--bg-1); border:1px solid var(--border-soft); border-radius:var(--radius-sm);
  color:var(--text-0); padding:11px 14px; font-family:var(--font-body); margin-bottom:16px; font-size:.92rem;
}
.select-input:focus, .text-input:focus{ border-color:var(--violet-2); }
.warning-box{
  background:rgba(251,191,36,.1); border:1px solid rgba(251,191,36,.3); color:#fcd97a;
  border-radius:var(--radius-sm); padding:12px 14px; font-size:.82rem; line-height:1.55; margin-bottom:18px;
}
.modal-actions{ display:flex; justify-content:flex-end; gap:10px; }

/* ---------------- toasts ---------------- */
#toast-stack{
  position:fixed; top: calc(16px + env(safe-area-inset-top,0px)); right:16px; z-index:200;
  display:flex; flex-direction:column; gap:10px; max-width:340px;
}
.toast{
  background:var(--surface-solid); border:1px solid var(--border); border-left:4px solid var(--violet-2);
  border-radius:12px; padding:14px 16px; font-size:.86rem; box-shadow:var(--shadow-soft);
  animation:toastIn .25s ease;
}
.toast.success{ border-left-color:var(--ok); }
.toast.error{ border-left-color:var(--err); }
.toast.warning{ border-left-color:var(--warn); }
.toast strong{ display:block; margin-bottom:2px; }
@keyframes toastIn{ from{ opacity:0; transform:translateX(30px);} to{ opacity:1; transform:none; } }

/* ---------------- gesture widget ---------------- */
.gesture-widget{ position:fixed; bottom: calc(16px + env(safe-area-inset-bottom,0px)); left:16px; z-index:60; }
.gesture-toggle{
  background:var(--surface-solid); border:1px solid var(--border); color:var(--text-1);
  padding:10px 16px; border-radius:999px; font-size:.8rem; cursor:pointer; box-shadow:var(--shadow-soft);
}
.gesture-toggle[aria-pressed="true"]{ border-color:var(--cyan); color:var(--text-0); }
.gesture-panel{
  margin-top:10px; background:var(--surface-solid); border:1px solid var(--border-soft); border-radius:var(--radius-md);
  padding:10px; width:180px;
}
#gesture-canvas{ width:100%; border-radius:8px; background:#000; }
.gesture-status{ margin:8px 0 0; font-size:.74rem; color:var(--text-2); text-align:center; }

/* ---------------- footer ---------------- */
.site-footer{ text-align:center; padding:26px 20px 50px; color:var(--text-3); font-size:.8rem; }

/* ---------------- responsive ---------------- */
@media (max-width:640px){
  .builder-head{ flex-direction:column; align-items:flex-start; }
  .hero{ padding:50px 18px 24px; }
  .modify-box{ flex-direction:column; }
  .modify-box .btn{ width:100%; justify-content:center; }
  .gesture-widget{ display:none; }
}
