:root {
  --bg: #f5f7fa;
  --ink: #111827;
  --muted: #64748b;
  --surface: #ffffff;
  --surface-soft: #eef3f7;
  --line: rgba(17, 24, 39, 0.12);
  --green: #047857;
  --teal: #0f766e;
  --blue: #1d4ed8;
  --cyan: #0369a1;
  --amber: #b45309;
  --red: #b91c1c;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.09);
  --radius: 8px;
  --max: 1240px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, #fcfdff 0%, var(--bg) 48%, #ffffff 100%);
  font-family: Inter, "Microsoft YaHei", Arial, sans-serif;
}

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

button,
input,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 72px;
  padding: 0 max(22px, calc((100vw - var(--max)) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(252, 253, 255, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  color: white;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--muted);
  font-size: 0.94rem;
  white-space: nowrap;
}

.nav a:hover {
  color: var(--green);
}

.lang-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.lang-btn {
  min-width: 48px;
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.lang-btn.is-active {
  color: #fff;
  background: var(--green);
}

.workspace-shell {
  width: min(var(--max), calc(100% - 44px));
  min-height: calc(100vh - 72px);
  margin: 0 auto;
  padding: 28px 0 54px;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.control-panel,
.metric-card,
.chart-panel,
.trade-plan,
.score-card-item,
.cycle-card,
.audit-section,
.code-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.control-panel {
  position: sticky;
  top: 92px;
  padding: 20px;
}

.panel-heading p {
  color: var(--muted);
  line-height: 1.65;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(2rem, 3.7vw, 3.15rem);
  line-height: 1.04;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.3rem, 2vw, 2.1rem);
  line-height: 1.14;
  letter-spacing: 0;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select {
  min-height: 44px;
  width: 100%;
  padding: 0 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.primary-action {
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  border: 0;
  border-radius: var(--radius);
  color: white;
  background: var(--green);
  font-weight: 800;
  cursor: pointer;
}

.primary-action:hover {
  background: #065f46;
}

.analysis-board {
  display: grid;
  gap: 18px;
}

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

.metric-card {
  min-height: 132px;
  padding: 18px;
  box-shadow: none;
}

.metric-card small {
  color: var(--muted);
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin: 10px 0 6px;
  font-size: clamp(1.28rem, 1.85vw, 1.92rem);
  overflow-wrap: anywhere;
}

.metric-card span {
  color: var(--muted);
  line-height: 1.45;
}

.score-card {
  background: #10231f;
  color: white;
}

.score-card small,
.score-card span {
  color: rgba(255, 255, 255, 0.74);
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 18px;
}

.chart-panel,
.trade-plan {
  padding: 20px;
}

.card-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.card-title span {
  padding: 7px 10px;
  border-radius: 999px;
  color: white;
  background: var(--blue);
  font-size: 0.82rem;
  font-weight: 800;
}

canvas {
  width: 100%;
  height: auto;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend b {
  font-weight: 500;
}

.legend i {
  width: 18px;
  height: 3px;
  border-radius: 999px;
}

.line-price {
  background: var(--blue);
}

.line-ma {
  background: var(--amber);
}

.line-zone {
  background: var(--green);
}

.line-risk {
  background: var(--red);
}

.plan-list {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
}

.plan-list div {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.plan-list dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.plan-list dd {
  margin: 8px 0;
  font-size: 1.06rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.plan-list p,
.muted,
.section-heading p,
.audit-log,
.disclaimer {
  color: var(--muted);
  line-height: 1.65;
}

.section {
  width: min(var(--max), calc(100% - 44px));
  margin: 0 auto;
  padding: 64px 0;
}

.section-heading {
  max-width: 780px;
  margin-bottom: 22px;
}

.score-grid,
.cycle-grid {
  display: grid;
  gap: 14px;
}

.score-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.cycle-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.score-card-item,
.cycle-card {
  padding: 18px;
  box-shadow: none;
}

.score-card-item header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.score-card-item h3 {
  margin: 0;
  font-size: 1.03rem;
}

.score-card-item strong {
  color: var(--green);
}

.score-card-item p,
.cycle-card p {
  margin: 14px 0 0;
  color: var(--muted);
  line-height: 1.62;
}

.score-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbe5ec;
}

.score-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--blue));
}

.cycle-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.1rem;
}

.cycle-card span {
  display: inline-flex;
  padding: 6px 9px;
  border-radius: 999px;
  color: white;
  background: var(--cyan);
  font-size: 0.8rem;
  font-weight: 800;
}

.deploy-section {
  display: grid;
  grid-template-columns: 0.82fr 1fr;
  gap: 30px;
  align-items: center;
}

.code-block {
  margin: 0;
  padding: 18px;
  overflow-x: auto;
  color: #dff7ee;
  background: #111c19;
  font-size: 0.9rem;
  line-height: 1.55;
}

.audit-section {
  margin-bottom: 64px;
  padding: 28px;
}

.audit-log {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.audit-item {
  padding: 13px 14px;
  border-left: 4px solid var(--green);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.audit-item strong {
  color: var(--ink);
}

.disclaimer {
  margin: 22px 0 0;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: #0f1f1b;
  color: rgba(255, 255, 255, 0.78);
}

.footer-inner {
  width: min(var(--max), calc(100% - 44px));
  min-height: 78px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  font-size: 0.9rem;
  line-height: 1.55;
}

.footer-inner strong {
  color: #fff;
  font-size: 1rem;
}

@media (max-width: 1120px) {
  .workspace-shell,
  .main-grid,
  .deploy-section {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }

  .summary-grid,
  .score-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .brand {
    min-width: 0;
  }

  .nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .lang-toggle {
    width: 100%;
  }

  .lang-btn {
    flex: 1;
  }

  .footer-inner {
    width: min(100% - 28px, var(--max));
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 18px 0;
  }

  .workspace-shell,
  .section {
    width: min(100% - 28px, var(--max));
  }

  .field-grid,
  .summary-grid,
  .score-grid,
  .cycle-grid {
    grid-template-columns: 1fr;
  }
}
