:root {
  --blue-950: #06283d;
  --blue-900: #0a3550;
  --blue-800: #0d4668;
  --blue-600: #1273a8;
  --teal-600: #0f9d8f;
  --teal-500: #14b8a6;
  --teal-400: #2dd4bf;
  --cyan-300: #67e8f9;
  --ink: #12283a;
  --ink-soft: #46657a;
  --bg: #f4f9fb;
  --bg-alt: #eaf4f6;
  --card: #ffffff;
  --line: #d7e7ec;
  --grad: linear-gradient(120deg, var(--blue-800), var(--teal-600));
  --shadow: 0 12px 32px rgba(6, 40, 61, 0.12);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--teal-600);
  text-decoration: none;
}

a:hover {
  color: var(--blue-800);
}

.container {
  width: min(1120px, 92%);
  margin-inline: auto;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--grad);
  color: #fff;
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(15, 157, 143, 0.35);
}

.brand-text {
  font-weight: 700;
  font-size: 18px;
  line-height: 1.1;
}

.brand-text small {
  display: block;
  font-size: 18px;
  font-weight: 400;
  color: var(--ink-soft);
  line-height: 1.25;
}

.main-nav {
  display: flex;
  gap: 28px;
}

.main-nav a {
  color: var(--ink);
  font-weight: 500;
  position: relative;
}

.main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--grad);
  transition: width 0.25s ease;
}

.main-nav a:hover::after {
  width: 100%;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: 0;
  padding: 8px;
  cursor: pointer;
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.nav-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 8px 20px rgba(13, 70, 104, 0.35);
}

.btn-primary:hover {
  color: #fff;
  box-shadow: 0 10px 26px rgba(13, 70, 104, 0.45);
}

.btn-accent {
  background: linear-gradient(120deg, var(--teal-500), var(--teal-600));
  color: #fff;
  box-shadow: 0 8px 20px rgba(15, 157, 143, 0.4);
}

.btn-accent:hover {
  color: #fff;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(4px);
}

.section-alt .btn-ghost,
.download-card .btn-ghost {
  background: #fff;
  color: var(--blue-800);
  border-color: var(--blue-600);
}

.btn-sm {
  padding: 8px 18px;
  font-size: 14px;
}

.btn-lg {
  padding: 15px 30px;
  font-size: 16px;
}

/* Hero */
.hero {
  position: relative;
  color: #fff;
  overflow: hidden;
  background: linear-gradient(135deg, var(--blue-950) 0%, var(--blue-800) 45%, var(--teal-600) 100%);
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(600px 320px at 85% 20%, rgba(45, 212, 191, 0.28), transparent 60%),
    radial-gradient(500px 300px at 10% 85%, rgba(103, 232, 249, 0.18), transparent 60%),
    radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, 0.5), transparent 50%);
  background-size: auto, auto, 40px 40px;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  padding: 110px 0 130px;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 14px;
  margin: 0 0 26px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--teal-400);
  animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.7); }
  50% { box-shadow: 0 0 0 6px rgba(45, 212, 191, 0); }
}

.hero h1 {
  margin: 0 0 18px;
  font-size: clamp(38px, 6vw, 60px);
  line-height: 1.15;
  letter-spacing: 0.5px;
}

.gradient-text {
  background: linear-gradient(90deg, var(--teal-400), var(--cyan-300));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub {
  max-width: 640px;
  margin: 0 auto 34px;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.9);
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.hero-meta {
  margin-top: 26px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.65);
}

/* Stats */
.stats {
  position: relative;
  z-index: 2;
  margin-top: -52px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 16px;
  text-align: center;
}

.stat strong {
  display: block;
  font-size: 26px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat span {
  font-size: 13px;
  color: var(--ink-soft);
}

/* Sections */
.section {
  padding: 84px 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-eyebrow {
  margin: 0 0 8px;
  color: var(--teal-600);
  font-weight: 600;
  letter-spacing: 2px;
  font-size: 13px;
  text-transform: uppercase;
}

.section-title {
  margin: 0 0 14px;
  font-size: clamp(26px, 3.4vw, 36px);
  line-height: 1.25;
  color: var(--blue-900);
}

.section-desc {
  margin: 0 0 40px;
  color: var(--ink-soft);
  max-width: 620px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.feature {
  padding: 28px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.feature:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(6, 40, 61, 0.16);
}

.feature-icon {
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(18, 115, 168, 0.12), rgba(20, 184, 166, 0.16));
  color: var(--teal-600);
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 16px;
}

.feature h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--blue-900);
}

.feature p {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink-soft);
}

/* Download card */
.download-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 34px;
  flex-wrap: wrap;
}

.download-info {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  max-width: 560px;
}

.app-icon {
  flex-shrink: 0;
  width: 74px;
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: var(--grad);
  color: #fff;
  font-family: Georgia, serif;
  font-size: 40px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(13, 70, 104, 0.35);
}

.download-info h3 {
  margin: 0 0 10px;
  font-size: 22px;
  color: var(--blue-900);
}

.dl-meta {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: var(--ink-soft);
}

.dl-meta li {
  padding: 2px 0;
}

.dl-meta li::before {
  content: "•";
  color: var(--teal-500);
  margin-right: 8px;
  font-weight: 700;
}

.dl-note {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.download-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}

.download-actions .btn {
  width: 100%;
}

.dl-tip {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-soft);
  text-align: center;
}

/* About */
.about-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 40px;
  align-items: start;
}

.about-text {
  color: var(--ink-soft);
  margin: 0 0 16px;
}

.about-contact a {
  font-weight: 600;
}

.about-card {
  padding: 28px;
}

.about-card h3 {
  margin: 0 0 18px;
  color: var(--blue-900);
}

.changelog {
  list-style: none;
  margin: 0;
  padding: 0;
}

.changelog li {
  position: relative;
  padding: 0 0 20px 22px;
  border-left: 2px solid var(--line);
}

.changelog li:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.changelog li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--teal-500);
}

.changelog time {
  display: block;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.changelog p {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--ink);
}

/* Footer */
.site-footer {
  background: var(--blue-950);
  color: rgba(255, 255, 255, 0.82);
  padding: 48px 0 26px;
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 28px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.footer-brand {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
}

.site-footer nav {
  display: flex;
  gap: 22px;
}

.site-footer nav a {
  color: rgba(255, 255, 255, 0.82);
}

.site-footer nav a:hover {
  color: var(--teal-400);
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 22px;
  font-size: 13px;
}

.icp-info {
  margin: 0;
  text-align: right;
}

.icp-info a {
  color: rgba(255, 255, 255, 0.82);
}

.icp-info a:hover {
  color: var(--teal-400);
}

.icp-sep {
  margin: 0 8px;
  opacity: 0.5;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: var(--blue-900);
  color: #fff;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 10px 26px rgba(6, 40, 61, 0.4);
  z-index: 100;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Responsive */
@media (max-width: 920px) {
  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .about-grid {
    grid-template-columns: 1fr;
  }

  .download-card {
    flex-direction: column;
    align-items: stretch;
  }

  .download-actions {
    min-width: 0;
  }
}

@media (max-width: 720px) {
  .main-nav {
    position: fixed;
    inset: 64px 0 auto 0;
    flex-direction: column;
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 18px 24px;
    gap: 16px;
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }

  .main-nav.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }

  .nav-toggle {
    display: flex;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .hero-inner {
    padding: 80px 0 110px;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }

  .icp-info {
    text-align: left;
  }
}

/* ===== Blog & projects (personal blog layout) ===== */

.main-nav a.active {
  color: var(--teal-600);
}

.section-more {
  margin: 34px 0 0;
  text-align: center;
}

.section-more .btn-ghost {
  background: #fff;
  color: var(--blue-800);
  border-color: var(--blue-600);
}

.post-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.post-card {
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(6, 40, 61, 0.16);
}

.post-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink-soft);
}

.post-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.4;
  color: var(--blue-900);
}

.post-card h3 a {
  color: inherit;
}

.post-card h3 a:hover {
  color: var(--teal-600);
}

.post-card p {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
  flex: 1;
}

.read-more {
  font-size: 14px;
  font-weight: 600;
}

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.12);
  color: var(--teal-600);
  font-size: 12px;
  font-weight: 600;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 20px;
}

.project-card {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.project-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 40px rgba(6, 40, 61, 0.16);
}

.project-head {
  display: flex;
  align-items: center;
  gap: 16px;
}

.project-head .app-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  font-size: 28px;
}

.project-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
  color: var(--blue-900);
  line-height: 1.3;
}

.project-platform {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.project-desc {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink-soft);
  flex: 1;
}

.project-tags {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin-left: auto;
  white-space: nowrap;
}

.badge-ok {
  background: rgba(20, 184, 166, 0.14);
  color: var(--teal-600);
}

.badge-wip {
  background: rgba(18, 115, 168, 0.12);
  color: var(--blue-600);
}

.project-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.dl-soon {
  font-size: 13px;
  color: var(--ink-soft);
}

/* Page head (blog index) */
.page-head {
  background: linear-gradient(135deg, var(--blue-950), var(--blue-800) 55%, var(--teal-600));
  color: #fff;
  padding: 84px 0 76px;
}

.page-head .section-eyebrow {
  color: var(--teal-400);
}

.page-title {
  margin: 0 0 10px;
  font-size: clamp(30px, 4vw, 42px);
  color: #fff;
}

.page-desc {
  margin: 0;
  color: rgba(255, 255, 255, 0.85);
}

.section-top {
  padding-top: 48px;
}

/* Article page */
.article {
  background: var(--bg);
  padding-bottom: 60px;
}

.article-inner {
  max-width: 760px;
}

.article-header {
  padding: 56px 0 30px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 34px;
}

.article-header h1 {
  margin: 8px 0 16px;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.3;
  color: var(--blue-900);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.article-body {
  font-size: 16px;
  color: var(--ink);
}

.article-body h2 {
  margin: 40px 0 14px;
  font-size: 24px;
  color: var(--blue-900);
}

.article-body h3 {
  margin: 32px 0 12px;
  font-size: 19px;
  color: var(--blue-900);
}

.article-body p {
  margin: 0 0 18px;
}

.article-body ul,
.article-body ol {
  margin: 0 0 18px;
  padding-left: 24px;
}

.article-body li {
  margin: 6px 0;
}

.article-body a {
  font-weight: 500;
}

.article-body code {
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(18, 115, 168, 0.1);
  color: var(--blue-800);
  font-size: 0.9em;
  font-family: Consolas, "Cascadia Code", monospace;
}

.article-body pre {
  margin: 0 0 22px;
  padding: 18px 20px;
  border-radius: 12px;
  background: var(--blue-950);
  color: #d8f3ee;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.6;
}

.article-body pre code {
  background: none;
  color: inherit;
  padding: 0;
}

.article-body blockquote {
  margin: 0 0 20px;
  padding: 4px 20px;
  border-left: 4px solid var(--teal-500);
  background: rgba(20, 184, 166, 0.08);
  border-radius: 0 10px 10px 0;
  color: var(--ink-soft);
}

.article-body table {
  width: 100%;
  margin: 0 0 22px;
  border-collapse: collapse;
  font-size: 14.5px;
}

.article-body th,
.article-body td {
  padding: 10px 14px;
  border: 1px solid var(--line);
  text-align: left;
}

.article-body th {
  background: rgba(20, 184, 166, 0.1);
  color: var(--blue-900);
  font-weight: 600;
}

.article-body img {
  max-width: 100%;
  border-radius: 12px;
}

.article-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 30px 0;
}

.article-footer {
  margin-top: 44px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.article-footer .btn-ghost {
  background: #fff;
  color: var(--blue-800);
  border-color: var(--blue-600);
}

@media (max-width: 920px) {
  .post-list,
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Formula libraries */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 6px 18px rgba(6, 40, 61, 0.06);
}

.lib-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 14px;
}

.lib-table th,
.lib-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.lib-table thead th {
  background: rgba(20, 184, 166, 0.09);
  color: var(--blue-900);
  font-weight: 600;
  white-space: nowrap;
}

.lib-table tbody tr:last-child td {
  border-bottom: 0;
}

.lib-table tbody tr:hover {
  background: rgba(20, 184, 166, 0.04);
}

.lib-table td strong {
  display: block;
  color: var(--blue-900);
  font-size: 14.5px;
}

.lib-table td small {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.5;
  font-weight: 400;
}

.lib-table td.num {
  text-align: right;
  font-weight: 600;
  color: var(--blue-900);
  white-space: nowrap;
}

.lib-table td.nowrap {
  white-space: nowrap;
}

.lib-table .dl-link {
  font-weight: 600;
  white-space: nowrap;
}

.lib-subtitle {
  margin: 38px 0 10px;
  font-size: 21px;
  color: var(--blue-900);
}

.lib-note {
  margin: 0 0 16px;
  font-size: 13.5px;
  color: var(--ink-soft);
  max-width: 860px;
}

@media (max-width: 720px) {
  .post-list,
  .projects-grid {
    grid-template-columns: 1fr;
  }

  .article-header {
    padding-top: 40px;
  }
}
