:root {
  --bg: #06130f;
  --panel: #0d1f1a;
  --card: rgba(255, 255, 255, .96);
  --text: #0f172a;
  --muted: #64748b;
  --green: #10b981;
  --green-dark: #047857;
  --line: #e5e7eb;
  --blue: #38bdf8;
  --soft: #f8fafc;
  --cyan: #22d3ee;
  --amber: #f59e0b;
  --glow: 0 0 0 1px rgba(45, 212, 191, .14), 0 24px 80px rgba(8, 47, 73, .28);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 18% 0%, rgba(34, 211, 238, .22), transparent 32%),
    radial-gradient(circle at 78% 8%, rgba(16, 185, 129, .25), transparent 30%),
    linear-gradient(135deg, #06130f 0%, #0f2c25 48%, #071a2d 100%);
  color: var(--text);
  min-height: 100vh;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 163, 184, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, .08) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, .9), transparent 78%);
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 24px;
  padding: 46px 6vw 28px;
  color: white;
  align-items: end;
  position: relative;
}
.eyebrow { display: inline-flex; align-items: center; gap: 9px; color: #bbf7d0; letter-spacing: .12em; font-size: 13px; margin: 0 0 10px; }
.eyebrow span { width: 8px; height: 8px; border-radius: 999px; background: var(--cyan); box-shadow: 0 0 18px var(--cyan); }
h1 { font-size: clamp(42px, 6vw, 78px); margin: 0; line-height: .95; letter-spacing: -.02em; text-shadow: 0 18px 60px rgba(34, 211, 238, .18); }
.subtitle { font-size: 22px; margin: 14px 0 8px; font-weight: 600; }
.desc { max-width: 820px; color: #d1fae5; line-height: 1.7; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.hero-tags span {
  border: 1px solid rgba(187, 247, 208, .28);
  background: rgba(6, 78, 59, .34);
  color: #d1fae5;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 13px;
  backdrop-filter: blur(10px);
}
.status-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .08));
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 18px;
  padding: 20px;
  backdrop-filter: blur(8px);
  line-height: 1.7;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .22);
}
.status-card strong { color: #ecfeff; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 5px 9px; background: rgba(16, 185, 129, .15); color: #bbf7d0; font-size: 12px; font-weight: 800; }
.status-pill::before { content: ""; width: 7px; height: 7px; border-radius: 999px; background: #34d399; box-shadow: 0 0 12px #34d399; }
.status-meta { color: #dbeafe; font-size: 13px; }
.status-meta span { display: block; color: #a7f3d0; font-size: 12px; margin-top: 8px; }
main { padding: 0 6vw 40px; position: relative; }
.tabs {
  position: sticky;
  top: 12px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0 18px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  background: rgba(2, 6, 23, .28);
  backdrop-filter: blur(14px);
}
.tab {
  border: 0;
  padding: 11px 17px;
  border-radius: 999px;
  background: transparent;
  color: white;
  cursor: pointer;
  font-weight: 700;
  transition: .18s ease;
}
.tab:hover { background: rgba(255, 255, 255, .12); }
.tab.active { background: white; color: var(--green-dark); box-shadow: 0 10px 30px rgba(6, 95, 70, .22); }
.panel { display: none; }
.panel.active { display: block; }
.grid.two {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 18px;
}
.card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--glow);
  backdrop-filter: blur(16px);
}
.form-card { position: relative; overflow: hidden; }
.form-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--green), var(--cyan), var(--amber));
}
.result-card {
  min-height: 560px;
  position: relative;
  overflow: hidden;
}
.result-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(34, 211, 238, .08), transparent 28%, rgba(16, 185, 129, .08));
}
h2 { margin: 0 0 18px; color: #052e16; }
label {
  display: block;
  font-weight: 700;
  margin: 14px 0;
  color: #334155;
}
input, select, textarea {
  width: 100%;
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 13px;
  font-size: 15px;
  font-family: inherit;
  outline: none;
  background: #fff;
}
textarea { min-height: 100px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(22, 163, 74, .12); }
button[type="submit"] {
  width: 100%;
  border: 0;
  background: linear-gradient(135deg, #10b981, #0891b2);
  color: white;
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 14px 30px rgba(8, 145, 178, .24);
}
button[type="submit"]:hover { filter: brightness(.96); }
button[type="submit"]:disabled { cursor: progress; opacity: .72; filter: saturate(.8); }
.checkbox { display: flex; gap: 10px; align-items: center; }
.checkbox input { width: auto; margin: 0; }
.result { line-height: 1.65; color: #1f2937; position: relative; z-index: 1; }
.result .metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 14px 0; }
.metric { background: var(--soft); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.metric strong { display:block; font-size: 24px; color: var(--green-dark); }
.badge { display: inline-block; padding: 5px 10px; border-radius: 999px; background: #dcfce7; color: var(--green-dark); font-weight: 800; margin-right: 6px; }
.warning { background: #fff7ed; border-left: 4px solid #f97316; padding: 10px 12px; border-radius: 10px; margin: 8px 0; }
.formula-panel {
  margin-top: 18px;
  border: 1px solid rgba(14, 165, 233, .18);
  border-radius: 14px;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(236, 253, 245, .9), rgba(240, 249, 255, .92));
}
.formula-panel h3 {
  margin: 0 0 10px;
  color: #075985;
  font-size: 15px;
}
.formula-panel p {
  margin: 10px 0 0;
  color: #475569;
  font-size: 13px;
  line-height: 1.6;
}
.formula {
  margin: 8px 0;
  padding: 10px 11px;
  border: 1px solid rgba(6, 182, 212, .16);
  border-radius: 10px;
  background: rgba(255, 255, 255, .78);
  color: #0f172a;
  font-size: 13px;
  line-height: 1.55;
  overflow-x: auto;
  box-shadow: inset 3px 0 0 rgba(20, 184, 166, .35);
}
.formula .katex-display {
  margin: 0;
}
.formula .katex {
  font-size: 1.04em;
}
.ai-step .katex {
  font-size: 1em;
}
.formula-result {
  margin: 16px 0;
}
.ai-loading {
  min-height: 320px;
  display: grid;
  place-items: center;
  padding: 26px;
  color: #0f172a;
}
.ai-loader-panel {
  width: min(520px, 100%);
  border: 1px solid rgba(20, 184, 166, .18);
  border-radius: 18px;
  padding: 24px;
  background: linear-gradient(180deg, rgba(240, 253, 250, .95), rgba(255, 255, 255, .92));
  box-shadow: 0 24px 70px rgba(15, 118, 110, .14);
}
.ai-core {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 24px;
  position: relative;
  background: radial-gradient(circle at 35% 30%, #ecfeff, #22d3ee 36%, #10b981 72%);
  box-shadow: 0 0 36px rgba(34, 211, 238, .46);
  animation: corePulse 1.6s ease-in-out infinite;
}
.ai-core::before,
.ai-core::after {
  content: "";
  position: absolute;
  inset: -10px;
  border: 1px solid rgba(8, 145, 178, .28);
  border-radius: 28px;
  animation: orbit 2.2s linear infinite;
}
.ai-core::after { inset: -18px; animation-duration: 3.4s; animation-direction: reverse; opacity: .65; }
.ai-loader-title { text-align: center; font-weight: 900; font-size: 18px; color: #064e3b; margin-bottom: 8px; }
.ai-loader-text { text-align: center; color: #475569; margin: 0 0 18px; }
.ai-steps { display: grid; gap: 9px; }
.ai-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, .04);
  color: #334155;
  font-size: 14px;
  overflow: hidden;
  position: relative;
}
.ai-step::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #14b8a6;
  box-shadow: 0 0 12px #14b8a6;
}
.ai-step::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(34, 211, 238, .18), transparent);
  transform: translateX(-100%);
  animation: scan 1.8s ease-in-out infinite;
}
.ai-step:nth-child(2)::after { animation-delay: .2s; }
.ai-step:nth-child(3)::after { animation-delay: .4s; }
.loading-skeleton {
  display: grid;
  gap: 12px;
  padding: 8px 0;
}
.skeleton-line {
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #e2e8f0, #f8fafc, #e2e8f0);
  background-size: 220% 100%;
  animation: shimmer 1.15s ease-in-out infinite;
}
.skeleton-line:nth-child(1) { width: 68%; height: 22px; }
.skeleton-line:nth-child(2) { width: 92%; }
.skeleton-line:nth-child(3) { width: 84%; }
.skeleton-line:nth-child(4) { width: 76%; }
pre { white-space: pre-wrap; word-break: break-word; background: #0f172a; color: #e2e8f0; border-radius: 14px; padding: 16px; }
.markdown { white-space: normal; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { color: #052e16; line-height: 1.3; margin: .9em 0 .4em; }
.markdown h1 { font-size: 28px; }
.markdown h2 { font-size: 23px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.markdown h3 { font-size: 18px; }
.markdown p { margin: .45em 0; }
.markdown ul, .markdown ol { padding-left: 1.35em; margin: .45em 0; }
.markdown li { margin: .15em 0; }
.markdown blockquote { margin: 14px 0; padding: 10px 12px; border-left: 4px solid #f97316; background: #fff7ed; border-radius: 10px; color: #7c2d12; }
.markdown code { background: #f1f5f9; color: #0f172a; border-radius: 6px; padding: 2px 5px; font-family: "SFMono-Regular", Consolas, monospace; font-size: .92em; }
.markdown pre code { background: transparent; color: inherit; padding: 0; }
.markdown table { width: 100%; border-collapse: collapse; margin: 14px 0; overflow: hidden; border-radius: 12px; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: 10px 12px; text-align: left; }
.markdown th { background: #f8fafc; color: #052e16; }
footer { color: #d1fae5; padding: 0 6vw 30px; line-height: 1.6; }
@keyframes corePulse {
  0%, 100% { transform: scale(1); filter: saturate(1); }
  50% { transform: scale(1.06); filter: saturate(1.22); }
}
@keyframes orbit {
  to { transform: rotate(360deg); }
}
@keyframes scan {
  0% { transform: translateX(-100%); }
  55%, 100% { transform: translateX(100%); }
}
@keyframes shimmer {
  to { background-position: -220% 0; }
}
@media (max-width: 900px) {
  .hero, .grid.two { grid-template-columns: 1fr; }
  .hero { padding-top: 28px; }
  .tabs { border-radius: 18px; position: static; }
  .tab { flex: 1 1 150px; }
  .result-card { min-height: auto; }
}
