:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #dbe5f0;
  --cyan: #0891b2;
  --cyan-dark: #0e7490;
  --indigo: #4f46e5;
  --violet: #7c3aed;
  --rose: #e11d48;
  --green: #059669;
  --amber: #f59e0b;
  --shadow: 0 22px 55px rgba(15, 23, 42, .10);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(8,145,178,.12), transparent 28%),
    linear-gradient(240deg, rgba(79,70,229,.13), transparent 32%),
    var(--bg);
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.home {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr);
  align-items: center;
  gap: 32px;
  padding: 48px clamp(24px, 6vw, 92px);
}
.home-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.grid-plane {
  position: absolute;
  inset: 44% -10% -22% -10%;
  background:
    linear-gradient(rgba(8,145,178,.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79,70,229,.18) 1px, transparent 1px);
  background-size: 46px 46px;
  transform: perspective(760px) rotateX(62deg);
  transform-origin: top;
  mask-image: linear-gradient(transparent, #000 22%, transparent 82%);
}
.formula-cloud span {
  position: absolute;
  padding: 10px 14px;
  border: 1px solid rgba(148,163,184,.38);
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 12px 34px rgba(15,23,42,.08);
  color: #334155;
  font-family: "Cambria Math", "Segoe UI Symbol", "Microsoft YaHei", sans-serif;
  font-weight: 900;
}
.formula-cloud span:nth-child(1) { top: 12%; left: 8%; }
.formula-cloud span:nth-child(2) { top: 18%; right: 12%; }
.formula-cloud span:nth-child(3) { bottom: 7%; right: 10%; }
.home-content { position: relative; z-index: 1; max-width: 790px; }
.home-kicker {
  width: fit-content;
  padding: 8px 12px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-weight: 950;
  letter-spacing: .02em;
}
.home h1 {
  margin: 22px 0 18px;
  font-size: clamp(54px, 7.2vw, 104px);
  line-height: .95;
  letter-spacing: 0;
}
.home h1 span {
  color: transparent;
  background: linear-gradient(110deg, var(--cyan), var(--indigo), var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
}
.home p {
  max-width: 680px;
  margin: 0;
  color: #475569;
  font-size: 21px;
  line-height: 1.75;
  font-weight: 650;
}
.home-actions { display: flex; gap: 14px; margin-top: 30px; flex-wrap: wrap; }
.launch-btn, .sample-btn {
  border: 0;
  border-radius: 16px;
  min-height: 58px;
  padding: 0 24px;
  font-weight: 950;
  font-size: 17px;
}
.launch-btn {
  color: white;
  background: linear-gradient(135deg, var(--cyan), var(--indigo));
  box-shadow: 0 20px 44px rgba(79,70,229,.26);
  min-width: 220px;
}
.sample-btn { color: #0f172a; background: white; border: 1px solid var(--line); }
.home-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 132px));
  gap: 12px;
  margin-top: 30px;
  position: relative;
  z-index: 3;
}
.home-metrics + * { clear: both; }
.home-metrics div {
  padding: 14px 16px;
  border: 1px solid rgba(219,229,240,.9);
  border-radius: 16px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 14px 34px rgba(15,23,42,.07);
}
.home-metrics b { display: block; font-size: 28px; color: var(--cyan-dark); }
.home-metrics span { color: var(--muted); font-weight: 850; font-size: 13px; }
.home-visual { position: relative; z-index: 1; display: grid; place-items: center; min-height: 540px; }
.orbital {
  position: relative;
  width: min(520px, 82vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(255,255,255,.96) 0 25%, rgba(224,242,254,.72) 26% 43%, rgba(255,255,255,.18) 44%),
    conic-gradient(from 180deg, rgba(8,145,178,.45), rgba(79,70,229,.38), rgba(124,58,237,.40), rgba(8,145,178,.45));
  box-shadow: 0 36px 90px rgba(15,23,42,.18);
}
.core {
  position: absolute;
  inset: 39%;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: #0f172a;
  color: white;
  font-size: 48px;
  font-weight: 950;
  box-shadow: 0 22px 50px rgba(15,23,42,.28);
}
.ring { position: absolute; inset: 14%; border: 2px solid rgba(255,255,255,.75); border-radius: 50%; }
.ring-2 { inset: 27%; border-style: dashed; border-color: rgba(8,145,178,.7); }
.chip {
  position: absolute;
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: white;
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 30px;
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(15,23,42,.10);
  line-height: 1;
  text-shadow: none;
  -webkit-font-smoothing: antialiased;
}
.chip-a { top: 9%; left: 43%; }
.chip-b { right: 8%; top: 47%; transform: translateY(-50%); font-weight: 800; }
.chip-b { font-size: 0; }
.chip-b svg { width: 44px; height: 44px; display: block; }
.chip-b text { font-family: Arial, sans-serif; font-size: 30px; font-weight: 900; fill: #0f172a; text-anchor: middle; }
.chip-c { left: 12%; bottom: 16%; }

.app {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  gap: 20px;
  max-width: 1720px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px;
}

.rail, .composer, .visual-card, .verdict {
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(219,229,240,.9);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.rail {
  position: sticky;
  top: 20px;
  height: calc(100vh - 40px);
  padding: 20px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 22px;
  overflow: hidden;
}
.rail::before {
  content: "";
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--indigo), var(--violet));
}
.brand h1 {
  margin: 14px 0 10px;
  font-size: 32px;
  line-height: 1.08;
  letter-spacing: 0;
}
.brand p, .rail-note span, #summary { color: var(--muted); line-height: 1.65; }
.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  color: var(--cyan-dark);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: none;
}
.rail-block { display: grid; align-content: start; gap: 11px; }
.rail-title { color: var(--muted); font-size: 13px; font-weight: 900; }
.example-list { display: grid; gap: 9px; }
.example {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 13px;
  background: linear-gradient(180deg, #fff, #f6f9fd);
  color: var(--ink);
  text-align: left;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.example:hover {
  transform: translateX(4px);
  border-color: rgba(8,145,178,.55);
  box-shadow: 0 10px 24px rgba(8,145,178,.12);
}
.rail-note {
  display: grid;
  gap: 8px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(135deg, #f8fbff, #eef7ff);
}

.stage { display: grid; gap: 18px; min-width: 0; }
.composer { padding: 20px; }
.composer-head, .card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
h2, h3 { margin: 4px 0 0; letter-spacing: 0; }
h2 { font-size: 25px; }
h3 { font-size: 20px; }
.engine-state, .soft-label {
  padding: 8px 11px;
  border-radius: 999px;
  color: #075985;
  background: #e0f2fe;
  font-size: 13px;
  font-weight: 800;
}

.formula-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr);
  align-items: end;
  gap: 14px;
  margin-top: 18px;
}
.formula-box, .control-row label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 13px;
  color: var(--ink);
  background: var(--surface);
  outline: none;
}
input:focus, select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(8,145,178,.13);
}
.formula-box input {
  min-height: 62px;
  font-size: 25px;
  font-weight: 900;
  font-family: "Cambria Math", "Segoe UI Symbol", "Microsoft YaHei", sans-serif;
}
.relation-pill {
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: white;
  background: linear-gradient(135deg, var(--cyan), var(--indigo));
  box-shadow: 0 16px 28px rgba(79,70,229,.22);
  font-size: 28px;
  font-weight: 950;
}
.control-row {
  display: grid;
  grid-template-columns: 150px 138px minmax(220px, 1fr) 120px 142px;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}
.primary, .ghost {
  border: 0;
  border-radius: 10px;
  min-height: 46px;
  padding: 0 16px;
  font-weight: 950;
  white-space: nowrap;
}
.primary {
  background: linear-gradient(135deg, var(--cyan), var(--cyan-dark));
  color: white;
  box-shadow: 0 12px 24px rgba(8,145,178,.22);
}
.primary:hover { filter: brightness(.96); }
.ghost {
  background: #eef4ff;
  color: #1e293b;
  border: 1px solid #d7e3f5;
}
.ghost:hover { background: #e4edff; }
.wide-btn { width: 100%; }
.compact-btn { padding: 0 12px; }

.dashboard {
  display: grid;
  grid-template-columns: 350px minmax(0, 1fr);
  gap: 18px;
}
.verdict {
  position: relative;
  overflow: hidden;
  padding: 22px;
}
.verdict::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: linear-gradient(180deg, var(--cyan), var(--indigo));
}
.verdict.ok::before { background: linear-gradient(180deg, var(--green), var(--cyan)); }
.verdict.bad::before { background: linear-gradient(180deg, var(--rose), var(--amber)); }
.verdict h2 { font-size: 31px; }
.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}
.metric-grid div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.metric-grid b {
  display: block;
  font-size: 18px;
  color: var(--cyan-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metric-grid span { color: var(--muted); font-size: 12px; font-weight: 900; }

.visual-card { padding: 18px; overflow: hidden; }
.tree-canvas {
  min-height: 300px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(180deg, #ffffff, #f7fbff),
    repeating-linear-gradient(90deg, rgba(8,145,178,.08) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(0deg, rgba(79,70,229,.08) 0 1px, transparent 1px 44px);
}
.tree-svg { width: 100%; height: 300px; display: block; }
.tree-edge { stroke: #9db1c7; stroke-width: 1.7; }
.tree-node { fill: #ffffff; stroke: #71b8cf; stroke-width: 1.7; }
.tree-node.op { fill: #ecfeff; stroke: var(--cyan); }
.tree-text {
  font-family: "Cambria Math", "Segoe UI Symbol", "Microsoft YaHei", sans-serif;
  font-weight: 950;
  font-size: 16px;
  text-anchor: middle;
  dominant-baseline: central;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
  gap: 18px;
}
.timeline { display: grid; gap: 10px; margin-top: 14px; }
.step {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.rule { color: var(--rose); font-weight: 950; }
.expr {
  font-family: "Cambria Math", "Segoe UI Symbol", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  font-weight: 900;
}
.truth-map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.truth-tile {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px;
  background: var(--surface-soft);
}
.truth-tile.ok { border-color: rgba(5,150,105,.38); background: #f0fdf4; }
.truth-tile.bad { border-color: rgba(225,29,72,.42); background: #fff1f2; }
.bits { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.bit { padding: 3px 8px; border-radius: 999px; background: #e2e8f0; color: var(--ink); font-size: 12px; font-weight: 900; }
.lr { display: flex; justify-content: space-between; font-family: "Cambria Math", "Microsoft YaHei", sans-serif; font-weight: 950; }

.table-wrap { margin-top: 14px; overflow: auto; }
table { width: 100%; min-width: 680px; border-collapse: collapse; background: white; }
th, td {
  border: 1px solid var(--line);
  padding: 11px 10px;
  text-align: center;
  font-family: "Cambria Math", "Segoe UI Symbol", "Microsoft YaHei", sans-serif;
}
th { background: #eff6ff; color: var(--ink); font-weight: 950; }
tbody tr:hover td { background: #f8fbff; }
tr.counter td { background: #fff1f2; color: var(--rose); font-weight: 950; }

.ai-card { margin-bottom: 24px; }
.markdown-body {
  margin-top: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f9fbff);
  line-height: 1.85;
  color: #243244;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4, .markdown-body h5, .markdown-body h6 { margin: 15px 0 8px; }
.markdown-body h1 { font-size: 24px; }
.markdown-body h2 { font-size: 21px; }
.markdown-body h3 { font-size: 18px; }
.markdown-body h4 { font-size: 17px; }
.markdown-body h5, .markdown-body h6 { font-size: 16px; }
.markdown-body p { margin: 9px 0; }
.markdown-body ul, .markdown-body ol { margin: 8px 0 8px 24px; padding: 0; }
.markdown-body li { margin: 5px 0; }
.markdown-body blockquote {
  margin: 12px 0;
  padding: 11px 14px;
  border-left: 4px solid var(--cyan);
  background: #ecfeff;
  color: #164e63;
  border-radius: 0 10px 10px 0;
}
.markdown-body hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
.markdown-body code {
  padding: 2px 5px;
  border-radius: 5px;
  background: #eef4ff;
  font-family: Consolas, monospace;
}
.math-inline {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  margin: 0 2px;
  border-radius: 6px;
  background: #eef9ff;
  color: #075985;
  font-family: "Cambria Math", "Segoe UI Symbol", "Microsoft YaHei", sans-serif;
  font-weight: 900;
}
.math-block {
  margin: 10px 0;
  padding: 12px 14px;
  border: 1px solid #bae6fd;
  border-radius: 12px;
  background: #f0f9ff;
  color: #075985;
  font-family: "Cambria Math", "Segoe UI Symbol", "Microsoft YaHei", sans-serif;
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}
.markdown-body pre {
  padding: 13px;
  border-radius: 12px;
  overflow: auto;
  background: #f8fbff;
  color: var(--ink);
  border: 1px solid var(--line);
  white-space: pre-wrap;
}
.md-table { min-width: 0; margin: 12px 0; }
.md-table th { background: #e0f2fe; }

@media (max-width: 1120px) {
  .home { grid-template-columns: 1fr; padding: 28px 18px; }
  .home-visual { min-height: 360px; }
  .app, .dashboard, .split, .formula-row, .control-row { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; }
  .relation-pill { width: 64px; }
}
