:root {
  color-scheme: dark;
  --bg: #060911;
  --bg-2: #0a0f1c;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-solid: #0f1524;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef2f8;
  --text-2: #a7b0c2;
  --text-3: #6f7a90;
  --cyan: #22d3ee;
  --violet: #8b5cf6;
  --pink: #ec4899;
  --grad: linear-gradient(110deg, #22d3ee 0%, #8b5cf6 55%, #ec4899 100%);
  --series-1: #3987e5;
  --pos: #3987e5;
  --neg: #e66767;
  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.7);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
#bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.glow { position: fixed; z-index: 0; border-radius: 50%; filter: blur(110px); opacity: 0.35; pointer-events: none; }
.glow.a { width: 620px; height: 620px; background: #1e3a8a; top: -200px; left: -160px; }
.glow.b { width: 520px; height: 520px; background: #6d28d9; bottom: -220px; right: -140px; opacity: 0.28; }
.glow.c { width: 380px; height: 380px; background: #0e7490; top: 40%; left: 55%; opacity: 0.18; }
#app { position: relative; z-index: 1; min-height: 100vh; }

a { color: var(--cyan); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.2rem, 4.6vw, 3.8rem); line-height: 1.05; font-weight: 800; }
h2 { font-size: 1.6rem; font-weight: 750; }
h3 { font-size: 1.05rem; font-weight: 650; }
p { margin: 0; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.mono { font-family: var(--mono); }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- layout ---------- */
.container { max-width: 1240px; margin: 0 auto; padding: 0 28px; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(18px) saturate(140%);
  background: rgba(6, 9, 17, 0.72);
  border-bottom: 1px solid var(--border);
}
.topbar .container { display: flex; align-items: center; gap: 20px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.05rem; color: var(--text); letter-spacing: -0.01em; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 9px; background: var(--grad);
  display: grid; place-items: center; box-shadow: 0 0 24px rgba(139, 92, 246, 0.55);
}
.logo-mark svg { width: 18px; height: 18px; }
.spacer { flex: 1; }
.user-chip { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 0.9rem; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border-strong); display: grid; place-items: center; font-weight: 700; color: var(--text); font-size: 0.8rem; }
.page { padding: 36px 0 80px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}
.card.glow-border { position: relative; }
.card.glow-border::before {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px;
  background: linear-gradient(130deg, rgba(34, 211, 238, 0.6), rgba(139, 92, 246, 0.25) 40%, transparent 70%, rgba(236, 72, 153, 0.45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; pointer-events: none;
}
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.card-head .spacer { flex: 1; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 980px) {
  .g3, .g4, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .g2 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) { .g3, .g4, .g5 { grid-template-columns: 1fr; } .container { padding: 0 16px; } }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.mt { margin-top: 18px; } .mt-l { margin-top: 30px; } .mb { margin-bottom: 18px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 0.93rem;
  padding: 10px 18px; border-radius: 12px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  transition: transform 0.15s ease, background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.btn:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.28); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary {
  border: 0; color: #050812; background: var(--grad); background-size: 160% 100%;
  box-shadow: 0 8px 30px -8px rgba(139, 92, 246, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  animation: shimmer 6s ease-in-out infinite;
}
.btn.primary:hover { box-shadow: 0 10px 40px -6px rgba(34, 211, 238, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.4); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.danger:hover { border-color: var(--critical); color: #ffb4b4; }
.btn.lg { padding: 14px 24px; font-size: 1rem; border-radius: 14px; }
.btn.sm { padding: 6px 12px; font-size: 0.82rem; border-radius: 9px; }
@keyframes shimmer { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

label.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: var(--text-2); font-weight: 500; }
input, select, textarea {
  font: inherit; color: var(--text); background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-strong); border-radius: 11px; padding: 11px 13px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
input:focus, select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18); }
select option { background: #0f1524; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 650; letter-spacing: 0.02em; border: 1px solid var(--border-strong);
  color: var(--text-2); background: var(--surface-2); white-space: nowrap;
}
.badge.numeric { color: #9cc8ff; border-color: rgba(57, 135, 229, 0.45); background: rgba(57, 135, 229, 0.12); }
.badge.categorical, .badge.boolean { color: #d6c6ff; border-color: rgba(139, 92, 246, 0.45); background: rgba(139, 92, 246, 0.12); }
.badge.id, .badge.text, .badge.datetime { color: var(--text-3); }
.badge.required { color: #ffd59a; border-color: rgba(250, 178, 25, 0.5); background: rgba(250, 178, 25, 0.1); }
.badge.suggestion { color: #a5f3fc; border-color: rgba(34, 211, 238, 0.45); background: rgba(34, 211, 238, 0.1); }
.badge.ai { color: #f5d0fe; border-color: rgba(236, 72, 153, 0.45); background: rgba(236, 72, 153, 0.1); }

.seg { display: inline-flex; padding: 3px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border); border-radius: 11px; gap: 2px; }
.seg button {
  font: inherit; font-size: 0.8rem; font-weight: 600; padding: 6px 12px; border-radius: 8px; border: 0;
  background: transparent; color: var(--text-3); cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.seg button:hover:not(:disabled) { color: var(--text); }
.seg button.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.seg button.on.x { background: rgba(57, 135, 229, 0.22); box-shadow: inset 0 0 0 1px rgba(57, 135, 229, 0.6); color: #cfe3ff; }
.seg button.on.y { background: rgba(236, 72, 153, 0.2); box-shadow: inset 0 0 0 1px rgba(236, 72, 153, 0.6); color: #ffd1ea; }
.seg button:disabled { opacity: 0.3; cursor: not-allowed; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 0.86rem; padding: 9px 14px; border-radius: 11px; cursor: pointer;
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border-strong); color: var(--text-2); transition: all 0.15s;
}
.chip:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.3); }
.chip.on { color: var(--text); border-color: var(--cyan); background: rgba(34, 211, 238, 0.12); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.12); }
.chip .rec { font-size: 0.7rem; color: var(--cyan); margin-left: 6px; font-weight: 700; }

/* ---------- auth / hero ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 56px; align-items: center; max-width: 1240px; margin: 0 auto; padding: 40px 28px; }
@media (max-width: 960px) { .auth { grid-template-columns: 1fr; gap: 30px; } }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cyan); }
.eyebrow .pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.7); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.6); } 70% { box-shadow: 0 0 0 12px rgba(34, 211, 238, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0); } }
.hero-sub { font-size: 1.12rem; color: var(--text-2); max-width: 560px; margin-top: 18px; }
.hero-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 34px; max-width: 620px; }
.hero-step { padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.hero-step b { display: block; font-size: 0.76rem; color: var(--cyan); font-family: var(--mono); margin-bottom: 4px; }
.hero-step span { font-size: 0.86rem; color: var(--text-2); }
@media (max-width: 560px) { .hero-steps { grid-template-columns: repeat(2, 1fr); } }
.formula-ticker { margin-top: 26px; font-family: var(--mono); font-size: 0.86rem; color: var(--text-2); padding: 14px 16px; border-radius: 14px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border); max-width: 620px; overflow: hidden; white-space: nowrap; }
.formula-ticker .k { color: #ffd1ea; } .formula-ticker .n { color: #9cc8ff; } .formula-ticker .c { color: var(--text-3); }
.auth-card { max-width: 440px; width: 100%; justify-self: center; padding: 30px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: rgba(0, 0, 0, 0.35); border-radius: 12px; border: 1px solid var(--border); margin-bottom: 22px; }
.tabs button { flex: 1; font: inherit; font-weight: 600; padding: 9px; border: 0; border-radius: 9px; background: transparent; color: var(--text-3); cursor: pointer; }
.tabs button.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.err { color: #ffb4b4; font-size: 0.86rem; min-height: 1.2em; }

/* ---------- dashboard ---------- */
.dash-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 22px; align-items: stretch; }
@media (max-width: 900px) { .dash-hero { grid-template-columns: 1fr; } }
.dropzone {
  border: 1.5px dashed rgba(34, 211, 238, 0.4); border-radius: var(--radius); padding: 34px 24px; text-align: center; cursor: pointer;
  background: radial-gradient(ellipse at top, rgba(34, 211, 238, 0.08), transparent 70%), rgba(0, 0, 0, 0.25);
  transition: all 0.2s; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 230px;
}
.dropzone:hover, .dropzone.over { border-color: var(--cyan); background: radial-gradient(ellipse at top, rgba(34, 211, 238, 0.16), transparent 70%), rgba(0, 0, 0, 0.25); transform: translateY(-2px); }
.dropzone .icon { width: 58px; height: 58px; border-radius: 16px; display: grid; place-items: center; background: rgba(34, 211, 238, 0.12); border: 1px solid rgba(34, 211, 238, 0.35); }
.formats { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.formats span { font-family: var(--mono); font-size: 0.72rem; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.project-card { cursor: pointer; transition: transform 0.2s, border-color 0.2s; display: flex; flex-direction: column; gap: 12px; }
.project-card:hover { transform: translateY(-3px); border-color: rgba(34, 211, 238, 0.4); }
.project-card .meta, .demo-card .meta { display: flex; gap: 14px; font-size: 0.82rem; color: var(--text-3); font-family: var(--mono); }
.r2-pill { font-family: var(--mono); font-weight: 700; font-size: 0.85rem; }
.empty { text-align: center; padding: 50px 20px; color: var(--text-3); }

/* ---------- project ---------- */
.proj-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.stepper { display: flex; gap: 6px; padding: 5px; border-radius: 14px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--border); overflow-x: auto; }
.stepper button {
  display: flex; align-items: center; gap: 8px; font: inherit; font-size: 0.86rem; font-weight: 600; white-space: nowrap;
  padding: 8px 14px; border-radius: 10px; border: 0; background: transparent; color: var(--text-3); cursor: pointer;
}
.stepper button .num { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 0.72rem; border: 1px solid var(--border-strong); font-family: var(--mono); }
.stepper button.done { color: var(--text-2); }
.stepper button.done .num { background: rgba(34, 211, 238, 0.15); border-color: rgba(34, 211, 238, 0.5); color: var(--cyan); }
.stepper button.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border-strong); }
.stepper button.on .num { background: var(--grad); color: #050812; border: 0; }
.stepper button:disabled { opacity: 0.35; cursor: not-allowed; }

.kpi { padding: 18px 20px; }
.kpi .label { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); font-weight: 650; }
.kpi .value { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 0.82rem; color: var(--text-2); margin-top: 2px; }

.ai-banner {
  display: flex; gap: 16px; align-items: flex-start; padding: 18px 20px; border-radius: var(--radius);
  background: linear-gradient(120deg, rgba(34, 211, 238, 0.09), rgba(139, 92, 246, 0.09) 50%, rgba(236, 72, 153, 0.07));
  border: 1px solid rgba(139, 92, 246, 0.3);
}
.ai-orb { flex: none; width: 40px; height: 40px; border-radius: 12px; background: var(--grad); display: grid; place-items: center; box-shadow: 0 0 30px rgba(139, 92, 246, 0.6); animation: orb 4s ease-in-out infinite; }
@keyframes orb { 0%, 100% { transform: rotate(0deg) scale(1); } 50% { transform: rotate(8deg) scale(1.06); } }
.ai-banner .body { flex: 1; }
.ai-banner .body p { color: var(--text-2); margin-top: 4px; }

.col-card { display: flex; flex-direction: column; gap: 10px; padding: 18px; }
.col-card .name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-card .stats { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.78rem; color: var(--text-3); font-family: var(--mono); }
.col-card .stats b { color: var(--text-2); font-weight: 500; }
.note { font-size: 0.8rem; color: var(--text-2); padding: 7px 10px; border-radius: 9px; background: rgba(250, 178, 25, 0.07); border: 1px solid rgba(250, 178, 25, 0.22); }

.table-wrap { overflow: auto; border-radius: 12px; border: 1px solid var(--border); max-height: 460px; }
table { border-collapse: collapse; width: 100%; font-size: 0.84rem; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { position: sticky; top: 0; background: #0d1322; color: var(--text-2); font-weight: 600; font-size: 0.78rem; z-index: 1; }
td { color: var(--text-2); font-variant-numeric: tabular-nums; }
td.num { text-align: right; font-family: var(--mono); font-size: 0.8rem; }
tbody tr:hover td { background: rgba(255, 255, 255, 0.025); color: var(--text); }

.role-row td { white-space: normal; vertical-align: middle; }
.role-row .reason { font-size: 0.78rem; color: var(--text-3); margin-top: 2px; }

.q-card { padding: 22px; display: flex; flex-direction: column; gap: 12px; transition: border-color 0.2s; }
.q-card.missing { border-color: rgba(250, 178, 25, 0.6); }
.q-card .why { color: var(--text-2); font-size: 0.9rem; }

/* ---------- model ---------- */
.gauge { position: relative; width: 150px; height: 150px; flex: none; }
.gauge svg { transform: rotate(-90deg); }
.gauge .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.gauge .center .dim { font-size: .62rem !important; letter-spacing: .08em !important; }
.gauge .big { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.metric-hero { display: flex; gap: 26px; align-items: center; }
@media (max-width: 700px) { .metric-hero { flex-direction: column; align-items: flex-start; } }
.insight { font-size: 1rem; color: var(--text); line-height: 1.65; }
.warn { display: flex; gap: 10px; align-items: flex-start; font-size: 0.88rem; color: var(--text-2); padding: 10px 12px; border-radius: 10px; background: rgba(250, 178, 25, 0.07); border: 1px solid rgba(250, 178, 25, 0.25); }
.warn .ico { color: var(--warning); font-weight: 800; }

.price-out { font-size: 3.2rem; font-weight: 800; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1; }
.calc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 560px) { .calc-grid { grid-template-columns: 1fr; } }
.bd-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 90px; gap: 10px; align-items: center; font-size: 0.85rem; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.bd-row .v { text-align: right; font-family: var(--mono); color: var(--text); }

/* ---------- charts ---------- */
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) 56px; align-items: center; gap: 12px; padding: 5px 0; font-size: 0.85rem; }
.hbar .lbl { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 12px; border-radius: 0 4px 4px 0; position: relative; }
.hbar .fill { height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1); min-width: 2px; }
.hbar.dim .fill { opacity: 0.35; }
.hbar.dim .lbl { color: var(--text-3); }
.hbar .val { text-align: right; font-family: var(--mono); font-size: 0.8rem; color: var(--text); }
.div-bar { position: relative; height: 10px; }
.div-bar .mid { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--border-strong); }
.div-bar .fill { position: absolute; top: 0; height: 100%; }
.div-bar .fill.pos { left: 50%; background: var(--pos); border-radius: 0 4px 4px 0; }
.div-bar .fill.neg { right: 50%; background: var(--neg); border-radius: 4px 0 0 4px; }
.chart-svg text { fill: var(--text-3); font-size: 11px; font-family: var(--sans); }
.chart-svg .grid line { stroke: rgba(255, 255, 255, 0.06); }
.chart-svg .axis { stroke: rgba(255, 255, 255, 0.18); }
.legend { display: flex; gap: 16px; font-size: 0.8rem; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
#tip {
  position: fixed; z-index: 100; pointer-events: none; padding: 8px 11px; border-radius: 10px; font-size: 0.8rem;
  background: rgba(10, 15, 28, 0.96); border: 1px solid var(--border-strong); color: var(--text); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(4px); transition: opacity 0.12s, transform 0.12s; max-width: 280px; white-space: pre-line;
}
#tip.show { opacity: 1; transform: none; }

/* ---------- code ---------- */
.code-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.code {
  font-family: var(--mono); font-size: 0.8rem; line-height: 1.6; background: #050810; border: 1px solid var(--border);
  border-radius: 14px; padding: 18px 20px; overflow: auto; max-height: 620px; color: #c8d1e0; margin: 0; tab-size: 4;
}
.code .tk-c { color: #5f6b82; font-style: italic; } .code .tk-s { color: #a5e8b5; } .code .tk-n { color: #9cc8ff; } .code .tk-k { color: #e2b6ff; }

/* ---------- overlay ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(4, 6, 12, 0.78); backdrop-filter: blur(10px); animation: fade 0.25s; }
@keyframes fade { from { opacity: 0; } }
.build-card { width: min(520px, 92vw); padding: 34px; text-align: center; }
.build-steps { text-align: left; margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.build-step { display: flex; gap: 12px; align-items: center; color: var(--text-3); font-size: 0.92rem; transition: color 0.3s; }
.build-step .dot { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border-strong); flex: none; display: grid; place-items: center; font-size: 0.7rem; }
.build-step.active { color: var(--text); }
.build-step.active .dot { border-color: var(--cyan); border-top-color: transparent; animation: spin 0.8s linear infinite; }
.build-step.done { color: var(--text-2); }
.build-step.done .dot { background: var(--cyan); border-color: var(--cyan); color: #050812; }
@keyframes spin { to { transform: rotate(360deg); } }
.orbit { width: 90px; height: 90px; margin: 0 auto; position: relative; }
.orbit::before, .orbit::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--cyan); border-right-color: var(--violet); animation: spin 1.2s linear infinite; }
.orbit::after { inset: 14px; border-top-color: var(--pink); border-right-color: transparent; border-left-color: var(--violet); animation-duration: 1.8s; animation-direction: reverse; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 90; padding: 12px 18px; border-radius: 12px; background: #1a0f14; border: 1px solid rgba(208, 59, 59, 0.6); color: #ffd0d0; box-shadow: var(--shadow); animation: fade 0.2s; max-width: 90vw; }
.toast.ok { background: #0b1a14; border-color: rgba(12, 163, 12, 0.6); color: #c7f7c7; }

.reveal { animation: rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.loading { display: grid; place-items: center; min-height: 50vh; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border-strong); border-top-color: var(--cyan); animation: spin 0.8s linear infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* demo datasets */
.demo-card { text-align: left; font: inherit; color: inherit; cursor: pointer; display: flex; flex-direction: column; gap: 8px; transition: transform .15s, border-color .15s; }
.demo-card:hover { transform: translateY(-2px); border-color: rgba(34, 211, 238, 0.45); }
.demo-icon { font-size: 1.5rem; line-height: 1; }

/* waterfall / what-if / hero animations */
.wf-bar { transform-box: view-box; animation: wfGrow .55s cubic-bezier(.2,.8,.2,1) both; }
@keyframes wfGrow { from { transform: scaleX(0); opacity: .2; } to { transform: scaleX(1); opacity: 1; } }
.sweep-card .wf-bar { animation-name: wfRise; }
@keyframes wfRise { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.wf-val { fill: var(--text) !important; font-family: var(--mono); font-size: 11.5px; animation: fadeIn .4s both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s cubic-bezier(.4,0,.2,1) forwards; }
.draw.slow { animation-duration: 2.2s; animation-delay: .5s; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.pop { transform-box: fill-box; transform-origin: center; animation: pop .5s both; }
@keyframes pop { from { transform: scale(0); opacity: 0; } }
.pulse-dot { transform-box: fill-box; transform-origin: center; animation: pulseDot 1.8s ease-in-out infinite; }
@keyframes pulseDot { 50% { transform: scale(1.35); } }
.sweep-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 760px) { .sweep-grid { grid-template-columns: 1fr; } }
.sweep-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; padding: 12px 12px 4px; }
.sweep-card h4 { margin: 0 0 4px; font-size: .9rem; }
.hero-card { padding: 18px 18px 8px; }
.hero-legend { display: flex; gap: 18px; font-size: .8rem; color: var(--text-3); }
.hero-legend i { display: inline-block; width: 18px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
@media (prefers-reduced-motion: reduce) { .wf-bar, .draw, .pop, .pulse-dot, .wf-val { animation: none !important; stroke-dashoffset: 0; } }
.hero-legend span { white-space: nowrap; } .hero-card .card-head { flex-wrap: wrap; row-gap: 6px; }

/* ================= landing: outline cube centrepiece ================= */
.landing { min-height: 100vh; display: flex; flex-direction: column; }
.land-nav { display: flex; align-items: center; justify-content: space-between; max-width: 1240px; width: 100%; margin: 0 auto; padding: 22px 28px; }
.land-nav .row { gap: 10px; }
.land-hero { text-align: center; max-width: 860px; margin: 8px auto 0; padding: 0 24px; }
.land-hero h1 { font-size: clamp(1.9rem, 4vw, 3.1rem); line-height: 1.05; margin-top: 14px; }
.land-hero .hero-sub { margin: 14px auto 0; }
.land-cta { display: flex; gap: 12px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
.land-foot { max-width: 760px; margin: 0 auto 40px; padding: 0 24px; text-align: center; }
.land-foot .formula-ticker { margin: 16px auto 0; }

.cube-scene { --s: 290px; position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 40px;
  max-width: 1240px; width: 100%; margin: 4px auto 0; padding: 10px 28px 0; }
.cube-stage { position: relative; width: calc(var(--s) * 1.5); height: calc(var(--s) * 1.4); display: grid; place-items: center; perspective: 1100px; cursor: grab; touch-action: pan-y; user-select: none; }
.cube-stage.grab { cursor: grabbing; }
.cube { position: relative; width: var(--s); height: var(--s); transform-style: preserve-3d; transform: rotateX(-14deg) rotateY(-22deg); }
.cube-face { position: absolute; inset: 0; border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 10px;
  border: 2px solid rgba(34, 211, 238, 0.75); background: rgba(8, 12, 24, 0.28);
  box-shadow: 0 0 22px rgba(34, 211, 238, 0.35), inset 0 0 26px rgba(139, 92, 246, 0.22); transition: background .6s, border-color .6s, box-shadow .6s; }
.cube-face::after { content: ''; position: absolute; inset: -2px; border-radius: 18px; pointer-events: none; opacity: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.28) 48%, transparent 66%) no-repeat; background-size: 250% 100%; }
.cube-face.front { transform: translateZ(calc(var(--s) / 2)); }
.cube-face.right { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.cube-face.back { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.cube-face.left { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.cube-face.top { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
.cube-face.bottom { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }
.cube-face > * { opacity: 0; transition: opacity .35s; }
.cube-face.active { background: rgba(8, 12, 24, 0.86); border-color: #67e8f9; box-shadow: 0 0 40px rgba(34, 211, 238, 0.55), 0 0 90px rgba(139, 92, 246, 0.35), inset 0 0 30px rgba(139, 92, 246, 0.25); }
.cube-face.active > * { opacity: 1; transition-delay: .7s; }
.cube-face.active::after { animation: sheen 1.1s .75s ease-out both; }
@keyframes sheen { 0% { opacity: 1; background-position: 120% 0; } 100% { opacity: 0; background-position: -60% 0; } }
.cf-head { font-weight: 700; font-size: .98rem; display: flex; gap: 10px; align-items: baseline; }
.cf-head b { font-family: var(--mono); font-size: .78rem; color: var(--cyan); }
.cf-body { flex: 1; display: grid; place-items: center; min-height: 0; }
.cf-body svg { width: 100%; height: 100%; }

/* per-face animations (re-run whenever a face becomes active) */
.cube-face.active [style*="--d"] { animation: cfIn .5s calc(var(--d) + .7s) cubic-bezier(.2,.8,.2,1) both; }
@keyframes cfIn { from { opacity: 0; transform: translateY(10px) scale(.9); } }
.cf-file { display: flex; gap: 16px; align-items: center; width: 100%; }
.cf-doc { width: 70px; height: 88px; border-radius: 10px; border: 2px solid var(--cyan); display: grid; place-items: end center; padding-bottom: 10px; font-family: var(--mono); font-size: .8rem; color: var(--cyan); position: relative; flex: none; }
.cube-face.active .cf-doc { animation: docDrop .7s .7s cubic-bezier(.3,1.6,.5,1) both; }
@keyframes docDrop { from { transform: translateY(-60px) rotate(-12deg); opacity: 0; } }
.cf-rows { flex: 1; display: flex; flex-direction: column; gap: 9px; }
.cf-rows i { display: block; height: 9px; width: var(--w); border-radius: 5px; background: linear-gradient(90deg, var(--series-1), var(--violet)); }
.cube-face.active .cf-rows i { animation: rowIn .5s calc(var(--d) + .9s) both; transform-origin: left; }
@keyframes rowIn { from { transform: scaleX(0); opacity: 0; } }
.cf-cols { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.cf-cols span { font-family: var(--mono); font-size: .78rem; padding: 6px 9px; border-radius: 8px; border: 1px solid var(--border-strong); display: inline-flex; gap: 8px; }
.cf-cols span b { font-size: .7rem; }
.cf-cols .x { border-color: rgba(57, 135, 229, .7); background: rgba(57, 135, 229, .15); } .cf-cols .x b { color: #9cc8ff; }
.cf-cols .y { border-color: var(--pink); background: rgba(236, 72, 153, .18); box-shadow: 0 0 18px rgba(236, 72, 153, .45); } .cf-cols .y b { color: #ffd1ea; }
.cf-cols .off { opacity: .45; text-decoration: line-through; }
.cf-q { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.cf-orb { width: 40px; height: 40px; border-radius: 12px; background: var(--grad); display: grid; place-items: center; color: #fff; font-size: 1.1rem; box-shadow: 0 0 24px rgba(139, 92, 246, .6); }
.cf-type { font-weight: 600; font-size: .95rem; overflow: hidden; white-space: nowrap; border-right: 2px solid var(--cyan); width: 0; }
.cube-face.active .cf-type { animation: typing 1.1s .8s steps(34) forwards, caret .8s step-end infinite; white-space: normal; }
@keyframes typing { to { width: 100%; } }
@keyframes caret { 50% { border-color: transparent; } }
.cf-chips { display: flex; gap: 8px; }
.cf-chips span { font-family: var(--mono); font-size: .82rem; padding: 7px 12px; border-radius: 9px; border: 1px solid var(--border-strong); }
.cf-chips .on { border-color: var(--cyan); background: rgba(34, 211, 238, .15); box-shadow: 0 0 0 3px rgba(34, 211, 238, .15); }
.cube-face.active .cf-wf rect { animation: wfGrow .55s calc(var(--d) + .7s) cubic-bezier(.2,.8,.2,1) both; transform-box: view-box; }
.cf-curve .line { stroke-dasharray: 1; stroke-dashoffset: 1; }
.cube-face.active .cf-curve .line { animation: draw 1.2s .8s cubic-bezier(.4,0,.2,1) forwards; }
.cube-face.active .cf-curve .area { animation: fadeIn .8s 1.4s both; }
.cube-face.active .cf-curve .dot { animation: pop .5s 1.8s both, pulseDot 1.8s 2.3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.cf-code { margin: 0; font-family: var(--mono); font-size: .8rem; line-height: 1.9; color: var(--text-2); width: 100%; white-space: pre; }
.cf-code span { display: block; } .cf-code b { color: #ffd1ea; font-weight: 600; } .cf-code i { color: #9cc8ff; font-style: normal; } .cf-code s { color: var(--text-3); text-decoration: none; }

/* rings, shadow, sparks */
.cube-ring { position: absolute; width: calc(var(--s) * 1.55); height: calc(var(--s) * 1.55); border-radius: 50%; border: 1px solid rgba(34, 211, 238, .35);
  transform: rotateX(76deg); box-shadow: 0 0 30px rgba(34, 211, 238, .25); animation: ringSpin 14s linear infinite; pointer-events: none;
  background: conic-gradient(from 0deg, transparent 0 70%, rgba(34, 211, 238, .5) 85%, transparent 100%); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px)); }
.cube-ring.r2 { width: calc(var(--s) * 1.25); height: calc(var(--s) * 1.25); border-color: rgba(236, 72, 153, .3); animation-duration: 9s; animation-direction: reverse;
  background: conic-gradient(from 90deg, transparent 0 70%, rgba(236, 72, 153, .55) 85%, transparent 100%); }
@keyframes ringSpin { from { transform: rotateX(76deg) rotateZ(0); } to { transform: rotateX(76deg) rotateZ(360deg); } }
.cube-shadow { position: absolute; bottom: 4%; width: calc(var(--s) * 0.9); height: 40px; border-radius: 50%; background: radial-gradient(closest-side, rgba(139, 92, 246, .45), transparent); filter: blur(8px); animation: breathe 4.2s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.12); opacity: .7; } }
.cube { animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { translate: 0 -12px; } }
.cube-burst { position: absolute; left: 50%; top: 50%; width: 0; height: 0; pointer-events: none; }
.cube-burst i { position: absolute; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: #67e8f9; box-shadow: 0 0 12px #22d3ee, 0 0 24px #8b5cf6; animation: spark var(--t) ease-out forwards; }
.cube-burst i:nth-child(3n) { background: #f9a8d4; box-shadow: 0 0 12px #ec4899; }
@keyframes spark { from { transform: translate(0, 0) scale(1.4); opacity: 1; } to { transform: translate(var(--x), var(--y)) scale(.2); opacity: 0; } }

/* callouts that fly out of the cube */
.cube-call { position: relative; z-index: 2; padding: 22px; border-radius: 18px; background: rgba(10, 15, 28, .75); border: 1px solid var(--border-strong); backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .5s, transform .7s cubic-bezier(.2,.9,.2,1); box-shadow: var(--shadow); }
.cube-call.left { justify-self: end; max-width: 330px; transform: translateX(160px) scale(.6); }
.cube-call.right { justify-self: start; min-width: 220px; text-align: center; transform: translateX(-160px) scale(.6); }
.cube-call.in { opacity: 1; transform: none; }
.cube-call h3 { font-size: 1.3rem; margin: 6px 0 8px; }
.cube-call p { color: var(--text-2); font-size: .95rem; margin: 0; }
.cc-step { font-family: var(--mono); font-size: .78rem; color: var(--cyan); letter-spacing: .1em; }
.cc-stat { font-size: 2.4rem; font-weight: 800; line-height: 1.1; }
.cc-sub { color: var(--text-2); font-size: .9rem; margin-top: 4px; }
.cube-beams { position: absolute; inset: 0; pointer-events: none; }
.cube-beams i { position: absolute; top: 50%; height: 2px; width: 22%; background: linear-gradient(90deg, transparent, #22d3ee, #8b5cf6, transparent); opacity: 0; filter: drop-shadow(0 0 6px #22d3ee); }
.cube-beams .bl { right: 50%; transform-origin: right; } .cube-beams .br { left: 50%; transform-origin: left; }
.cube-scene.fire .cube-beams i { animation: beam 1.1s ease-out both; }
@keyframes beam { 0% { opacity: 0; transform: scaleX(0); } 30% { opacity: 1; } 100% { opacity: .35; transform: scaleX(1); } }
.cube-dots { grid-column: 1 / -1; display: flex; gap: 10px; justify-content: center; }
.cube-dots button { width: 10px; height: 10px; border-radius: 50%; border: 0; padding: 0; background: rgba(255, 255, 255, .2); cursor: pointer; transition: all .3s; }
.cube-dots button.on { width: 30px; border-radius: 6px; background: var(--grad); }

/* auth modal */
.auth-modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(3, 5, 10, .72); backdrop-filter: blur(6px); padding: 20px; animation: fadeIn .25s both; }
.auth-modal .auth-card { position: relative; animation: cfIn .35s both; }
.auth-modal .close { position: absolute; top: 12px; right: 12px; }

@media (max-width: 1020px) {
  .cube-scene { --s: 240px; grid-template-columns: 1fr; gap: 16px; justify-items: center; }
  .cube-stage { order: -1; }
  .cube-call.left, .cube-call.right { justify-self: center; max-width: 460px; text-align: center; transform: translateY(-60px) scale(.7); }
  .cube-call.in { transform: none; }
  .cube-beams { display: none; }
}
@media (max-width: 480px) { .cube-scene { --s: 200px; } }
@media (prefers-reduced-motion: reduce) { .cube, .cube-ring, .cube-shadow { animation: none !important; } .cube-face.active * { animation: none !important; } .cf-type { width: auto; } .cf-curve .line { stroke-dashoffset: 0; } }

@media (max-width: 560px) { .land-nav { padding: 16px; } .land-nav [data-open=login] { display: none; } .land-nav .btn { padding: 8px 12px; font-size: .85rem; } }
@media (max-width: 560px) { .landing { overflow-x: hidden; } .land-cta .btn { width: 100%; justify-content: center; white-space: normal; } .land-foot .formula-ticker { max-width: 100%; font-size: .74rem; } .cube-scene { padding: 0 16px; } }
.land-foot, .land-hero { width: 100%; box-sizing: border-box; }

/* drifting, colour-shifting glow blobs */
.glow.a { animation: drift1 26s ease-in-out infinite alternate; }
.glow.b { animation: drift2 32s ease-in-out infinite alternate; }
.glow.c { animation: drift3 22s ease-in-out infinite alternate; }
@keyframes drift1 { 50% { transform: translate(18vw, 12vh) scale(1.15); filter: blur(110px) hue-rotate(40deg); } 100% { transform: translate(6vw, 30vh) scale(.9); } }
@keyframes drift2 { 50% { transform: translate(-22vw, -18vh) scale(1.2); filter: blur(110px) hue-rotate(-50deg); } 100% { transform: translate(-8vw, -34vh); } }
@keyframes drift3 { 50% { transform: translate(-30vw, 10vh) scale(1.4); opacity: .3; } 100% { transform: translate(12vw, -20vh) scale(.8); } }
@media (prefers-reduced-motion: reduce) { .glow { animation: none !important; } }

/* landing: live price ticker + equation stream */
.marquee { position: relative; z-index: 1; margin-top: auto; border-top: 1px solid rgba(34, 211, 238, .25); background: linear-gradient(180deg, rgba(6, 9, 17, .4), rgba(6, 9, 17, .9));
  -webkit-mask: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.mq-row { overflow: hidden; padding: 12px 0; }
.mq-row + .mq-row { border-top: 1px solid rgba(255, 255, 255, .06); padding: 10px 0 16px; }
.mq-track { display: flex; width: max-content; gap: 14px; animation: mq 60s linear infinite; }
.mq-row.rev .mq-track { animation-duration: 45s; animation-direction: reverse; }
.marquee:hover .mq-track { animation-play-state: paused; }
@keyframes mq { to { transform: translateX(-50%); } }
.tk { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--border-strong); background: rgba(255, 255, 255, .04); white-space: nowrap; font-size: .92rem; transition: background .3s; }
.tk b { font-size: 1.1rem; font-weight: 400; }
.tk em { font-style: normal; font-family: var(--mono); font-weight: 700; color: var(--text); }
.tk i { font-style: normal; font-family: var(--mono); font-size: .8rem; padding: 2px 7px; border-radius: 6px; }
.tk i.up { color: #34d399; background: rgba(52, 211, 153, .12); } .tk i.down { color: #f87171; background: rgba(248, 113, 113, .12); }
.tk.flash-up { animation: flashUp 1s ease-out; } .tk.flash-down { animation: flashDown 1s ease-out; }
@keyframes flashUp { 0% { background: rgba(52, 211, 153, .35); border-color: #34d399; box-shadow: 0 0 20px rgba(52, 211, 153, .5); } }
@keyframes flashDown { 0% { background: rgba(248, 113, 113, .35); border-color: #f87171; box-shadow: 0 0 20px rgba(248, 113, 113, .5); } }
.eq { font-family: var(--mono); font-size: 1rem; font-weight: 600; white-space: nowrap; padding: 4px 6px; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 8px rgba(139, 92, 246, .45)); }
.eq::after { content: '✦'; margin-left: 14px; color: rgba(34, 211, 238, .5); -webkit-text-fill-color: rgba(34, 211, 238, .5); }
.eq sup { font-size: .7em; }
@media (prefers-reduced-motion: reduce) { .mq-track { animation: none; } }
