:root {
  color-scheme: dark;
  --bg: #101216;
  --panel: rgba(18, 24, 30, 0.82);
  --panel-solid: #151a20;
  --line: rgba(255, 255, 255, 0.13);
  --text: #f6f8fb;
  --muted: #aeb8c6;
  --soft: #d9e4ef;
  --cyan: #5eead4;
  --aqua: #38bdf8;
  --amber: #f5c95f;
  --coral: #ff7a6b;
  --magenta: #e879f9;
  --green: #7ddc93;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  --radius: 8px;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(16, 18, 22, 0.94) 0%, rgba(16, 18, 22, 1) 46%),
    var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  width: 100%;
  min-height: 64px;
  padding: 12px clamp(18px, 4vw, 54px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 12, 15, 0.8);
  backdrop-filter: blur(18px);
}

.brand,
.header-action,
.primary-button,
.secondary-button,
.mode-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.brand {
  min-width: 0;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(94, 234, 212, 0.5);
  border-radius: var(--radius);
  color: #051210;
  background: linear-gradient(135deg, var(--cyan), var(--amber));
  box-shadow: 0 0 30px rgba(94, 234, 212, 0.2);
}

.nav-links {
  display: flex;
  justify-content: center;
  gap: clamp(12px, 3vw, 30px);
  color: var(--muted);
  font-size: 14px;
}

.nav-links a,
.header-action {
  transition:
    color 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.nav-links a:hover,
.header-action:hover {
  color: var(--text);
}

.header-action {
  border: 0;
  cursor: pointer;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--soft);
  background: rgba(255, 255, 255, 0.05);
}

.wallet-action {
  color: #061110;
  background: linear-gradient(135deg, var(--cyan), var(--amber));
}

.header-action svg,
.primary-button svg,
.secondary-button svg,
.mode-button svg,
.flow-card svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.hero-section {
  position: relative;
  min-height: 86svh;
  overflow: hidden;
  isolation: isolate;
  background-image: url("assets/hero-butterfly-ai.png");
  background-position: center;
  background-size: cover;
}

.hero-section::after {
  position: absolute;
  inset: auto 0 0;
  height: 34%;
  content: "";
  background: linear-gradient(180deg, rgba(16, 18, 22, 0), rgba(16, 18, 22, 1));
  z-index: -1;
}

.hero-shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(7, 9, 12, 0.92) 0%, rgba(9, 12, 15, 0.76) 46%, rgba(9, 12, 15, 0.42) 100%),
    linear-gradient(180deg, rgba(10, 12, 15, 0.14) 0%, rgba(10, 12, 15, 0.72) 100%);
}

.hero-content {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, 500px);
  align-items: center;
  gap: clamp(28px, 5vw, 76px);
  width: min(1180px, calc(100% - 36px));
  min-height: calc(86svh - 64px);
  margin: 0 auto;
  padding: clamp(34px, 6vw, 86px) 0 48px;
}

.hero-copy {
  max-width: 720px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 14px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 20px;
  font-size: clamp(46px, 8vw, 92px);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-lead {
  max-width: 650px;
  margin-bottom: 28px;
  color: var(--soft);
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.72;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 34px;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  padding: 0 18px;
  border-radius: var(--radius);
  font-weight: 800;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
}

.primary-button {
  color: #061110;
  background: linear-gradient(135deg, var(--cyan), var(--amber));
  box-shadow: 0 14px 34px rgba(94, 234, 212, 0.18);
}

.secondary-button {
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.hero-metrics div {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: var(--radius);
  background: rgba(12, 17, 21, 0.54);
}

.hero-metrics dt {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.hero-metrics dd {
  margin: 0;
  color: var(--text);
  font-size: clamp(15px, 1.7vw, 18px);
  font-weight: 800;
}

.calculator-panel {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  padding: clamp(18px, 3vw, 26px);
  background:
    linear-gradient(180deg, rgba(22, 29, 36, 0.88), rgba(13, 17, 21, 0.86)),
    rgba(18, 24, 30, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.panel-heading,
.output-main,
.section-heading,
.site-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.live-chip {
  flex: 0 0 auto;
  padding: 6px 9px;
  border: 1px solid rgba(125, 220, 147, 0.36);
  border-radius: 999px;
  color: #bdf8c8;
  background: rgba(125, 220, 147, 0.1);
  font-size: 12px;
  font-weight: 800;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 24px 0 18px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.mode-button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.mode-button.is-active {
  color: #061110;
  background: var(--cyan);
}

.quota-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.field input,
.field select {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--text);
  background: rgba(4, 7, 10, 0.44);
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: rgba(94, 234, 212, 0.75);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.12);
}

.field select {
  appearance: none;
  cursor: pointer;
}

.is-hidden {
  display: none;
}

.quota-output {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(94, 234, 212, 0.2);
  border-radius: var(--radius);
  background: rgba(94, 234, 212, 0.08);
}

.output-main {
  align-items: baseline;
  margin-bottom: 15px;
}

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

.output-main strong {
  color: var(--cyan);
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1;
}

.output-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.output-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.output-grid span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.output-grid strong {
  color: var(--text);
  font-size: 17px;
}

.quota-bar {
  height: 10px;
  margin: 16px 0 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.quota-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--amber), var(--coral));
  transition: width 220ms ease;
}

.formula-line {
  margin: 0;
  color: var(--soft);
  font-size: 13px;
  line-height: 1.55;
}

.ticker-band {
  display: flex;
  justify-content: center;
  gap: clamp(14px, 4vw, 42px);
  padding: 18px;
  border-block: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--soft);
  background: #11161b;
  font-size: 14px;
  font-weight: 700;
  overflow-x: auto;
}

.ticker-band span {
  flex: 0 0 auto;
}

.section {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: clamp(62px, 9vw, 110px) 0;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: clamp(28px, 6vw, 70px);
  align-items: center;
}

.section-copy h2,
.section-heading h2 {
  margin-bottom: 18px;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.08;
  letter-spacing: 0;
}

.section-copy p,
.flow-card p,
.formula-card p,
.faq-list p {
  color: var(--muted);
  line-height: 1.85;
}

.loop-board {
  display: grid;
  gap: 12px;
}

.formula-card,
.flow-card,
.faq-list details {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: var(--panel-solid);
}

.formula-card {
  padding: clamp(18px, 3vw, 26px);
}

.formula-card span {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 13px;
}

.formula-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.15;
}

.formula-card.accent {
  border-color: rgba(245, 201, 95, 0.32);
  background: linear-gradient(135deg, rgba(245, 201, 95, 0.12), rgba(255, 122, 107, 0.1)), var(--panel-solid);
}

.vault-section {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.section-heading {
  align-items: end;
  margin-bottom: 28px;
}

.section-heading .eyebrow {
  margin-bottom: 10px;
}

.flow-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.flow-card {
  padding: 22px;
}

.flow-card svg {
  width: 24px;
  height: 24px;
  margin-bottom: 18px;
  color: var(--cyan);
}

.flow-card h3 {
  margin-bottom: 10px;
  font-size: 19px;
}

.flow-card p,
.formula-card p,
.faq-list p {
  margin-bottom: 0;
}

.console-section {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.status-pill {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  color: var(--soft);
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
  font-weight: 800;
}

.status-pill[data-tone="ok"] {
  border-color: rgba(125, 220, 147, 0.36);
  color: #bdf8c8;
  background: rgba(125, 220, 147, 0.1);
}

.status-pill[data-tone="warn"] {
  border-color: rgba(245, 201, 95, 0.38);
  color: #ffe2a1;
  background: rgba(245, 201, 95, 0.1);
}

.status-pill[data-tone="bad"] {
  border-color: rgba(255, 122, 107, 0.45);
  color: #ffc4bd;
  background: rgba(255, 122, 107, 0.1);
}

.console-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.account-card {
  grid-column: span 2;
}

.console-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: var(--panel-solid);
}

.console-card-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.console-card-heading svg {
  width: 21px;
  height: 21px;
  color: var(--cyan);
}

.console-card-heading h3 {
  margin: 0;
  font-size: 18px;
}

.console-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.console-actions .primary-button,
.console-actions .secondary-button,
.full-button,
.form-submit {
  width: 100%;
  min-height: 44px;
  border: 0;
  cursor: pointer;
}

.console-actions .secondary-button,
.full-button.secondary-button {
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.real-form {
  display: grid;
  gap: 12px;
}

.sync-panel {
  display: grid;
  gap: 14px;
}

.sync-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.sync-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.05);
}

.sync-grid span {
  color: var(--muted);
  font-size: 12px;
}

.sync-grid strong {
  color: var(--text);
  font-size: 13px;
}

.manual-details {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.manual-details summary {
  cursor: pointer;
  color: var(--soft);
  font-size: 13px;
  font-weight: 800;
}

.manual-details .real-form {
  margin-top: 12px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.summary-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.summary-grid span,
.secret-box span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.summary-grid strong {
  color: var(--text);
  font-size: 17px;
}

.account-info-panel {
  display: grid;
  gap: 16px;
  padding: 16px;
  border: 1px solid rgba(94, 234, 212, 0.18);
  border-radius: var(--radius);
  background: rgba(94, 234, 212, 0.06);
}

.account-info-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--soft);
  font-size: 13px;
  font-weight: 800;
}

.account-info-heading strong {
  overflow-wrap: anywhere;
  color: var(--cyan);
  font-size: 12px;
}

.account-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.account-info-grid div {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
}

.account-info-grid span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.account-info-grid strong {
  color: var(--text);
  font-size: 18px;
}

.console-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.secret-box {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(94, 234, 212, 0.2);
  border-radius: var(--radius);
  background: rgba(94, 234, 212, 0.07);
}

.secret-box code {
  display: block;
  overflow-wrap: anywhere;
  color: var(--cyan);
  font-size: 13px;
  line-height: 1.45;
}

.code-sample {
  min-height: 126px;
  max-height: 260px;
  margin: 0;
  overflow: auto;
  padding: 13px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  color: #d7f9ef;
  background: rgba(0, 0, 0, 0.26);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.result-sample {
  color: var(--soft);
}

.live-ledger {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  background: var(--panel-solid);
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--coral);
}

.ledger-row {
  display: grid;
  grid-template-columns: 1.25fr 1fr 0.8fr 0.95fr;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--soft);
  font-size: 14px;
}

.ledger-row:last-child {
  border-bottom: 0;
}

.faq-section {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.faq-list {
  display: grid;
  gap: 10px;
}

.faq-list details {
  padding: 18px 20px;
}

.faq-list summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
}

.faq-list p {
  margin-top: 12px;
}

.site-footer {
  align-items: center;
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 30px 0 42px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
}

.site-footer div {
  display: grid;
  gap: 6px;
}

.site-footer strong {
  color: var(--text);
}

.site-footer p {
  max-width: 520px;
  margin: 0;
  text-align: right;
  font-size: 13px;
}

@media (max-width: 980px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .nav-links {
    display: none;
  }

  .hero-content,
  .two-column {
    grid-template-columns: 1fr;
  }

  .hero-content {
    align-items: start;
    padding-top: 42px;
  }

  .calculator-panel {
    width: min(100%, 620px);
  }

  .hero-metrics,
  .flow-grid,
  .console-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 660px) {
  .site-header {
    gap: 12px;
    min-height: 58px;
    padding-inline: 14px;
  }

  .brand span:last-child,
  .header-action span {
    display: none;
  }

  .hero-section {
    min-height: auto;
  }

  .hero-content {
    width: min(100% - 28px, 620px);
    min-height: auto;
    padding: 34px 0 34px;
  }

  h1 {
    font-size: clamp(42px, 15vw, 64px);
  }

  .hero-actions,
  .panel-heading,
  .site-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }

  .hero-metrics,
  .quota-form,
  .output-grid,
  .flow-grid,
  .console-grid,
  .summary-grid,
  .account-info-grid,
  .console-actions {
    grid-template-columns: 1fr;
  }

  .section {
    width: min(100% - 28px, 620px);
    padding-block: 58px;
  }

  .section-heading {
    display: block;
  }

  .live-ledger {
    overflow-x: auto;
  }

  .ledger-row {
    min-width: 620px;
  }

  .site-footer p {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
