:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --border: #cbd5e1;
  --border-soft: #e2e8f0;
  --text: #0f172a;
  --text-muted: #475569;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --green: #059669;
  --green-soft: #ecfdf5;
  --green-border: #6ee7b7;
  --green-text: #064e3b;
  --blue-payout-bg: #f0f9ff;
  --blue-payout-border: #bae6fd;
  --blue-payout-text: #0c4a6e;
  --amber: #d97706;
  --rose: #dc2626;
  --rose-soft: #fef2f2;
  --rose-border: #fca5a5;
  --slate-bar: #64748b;
  --radius: 16px;
  --shadow: 0 10px 28px -12px rgba(15, 23, 42, 0.08);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Inter, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Header & Accessible Navigation */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  z-index: 40;
}

.nav-wrap {
  max-width: 1160px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand-badge {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #059669);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.nav-links {
  display: flex;
  gap: 14px;
  font-size: 0.88rem;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  padding: 6px 4px;
}

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

.lang-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.lang-select {
  min-height: 38px;
  padding: 6px 10px;
  font-size: 0.86rem;
  border-radius: 9px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.mobile-quick-nav {
  display: none;
  width: 100%;
  border-top: 1px solid var(--border-soft);
  padding-top: 8px;
  gap: 12px;
  justify-content: center;
  font-size: 0.82rem;
}

.mobile-quick-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 600;
  padding: 4px 6px;
}

@media (max-width: 760px) {
  .nav-links {
    display: none;
  }
  .mobile-quick-nav {
    display: flex;
    flex-wrap: wrap;
  }
}

/* Main Container */
main {
  max-width: 1160px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

.hero {
  text-align: center;
  max-width: 780px;
  margin: 0 auto 20px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.hero h1 {
  font-size: clamp(1.45rem, 3.2vw, 2.25rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.hero p {
  color: var(--text-muted);
  font-size: 0.96rem;
}

/* Shared Snapshot & Version Warning Banners */
.snapshot-banner, .version-warn-banner {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1e3a8a;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.version-warn-banner {
  background: #fffbeb;
  border-color: #fcd34d;
  color: #92400e;
  font-weight: 600;
}

.snapshot-banner.visible, .version-warn-banner.visible {
  display: flex;
}

.save-inline-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.save-inline-row input[type="text"] {
  flex: 1 1 180px;
  min-height: 40px;
  font-size: 0.86rem;
  font-weight: 500;
}

.save-inline-row .btn-action {
  flex: 0 0 auto;
}

/* Accessible Platform Tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 18px;
}

.tab-btn {
  min-height: 40px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.tab-btn:hover {
  border-color: #94a3b8;
  color: var(--text);
}

.tab-btn[aria-selected="true"] {
  background: var(--text);
  color: #ffffff;
  border-color: var(--text);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Top Region & FX Configuration Bar */
.config-bar {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.config-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.ctrl-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ctrl-inline label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0;
}

.compact-select, .compact-input {
  min-height: 38px;
  padding: 6px 10px;
  font-size: 0.86rem;
  font-weight: 600;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: var(--text);
}

.compact-input {
  width: 96px;
  background: #fff;
}

.btn-icon {
  min-height: 38px;
  min-width: 38px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
}

.btn-icon:hover {
  background: var(--primary-soft);
}

.fx-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-muted);
}

@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.2); }
  50% { box-shadow: 0 0 0 5px rgba(5, 150, 105, 0.35); }
}

.fx-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  animation: livePulse 2.2s infinite;
}

@media (prefers-reduced-motion: reduce) {
  .fx-dot { animation: none; }
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

/* Mobile Quick Summary Jump Bar */
.mobile-result-jump {
  display: none;
  background: var(--text);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  margin-bottom: 16px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.86rem;
}

.mobile-result-jump a {
  color: #93c5fd;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .mobile-result-jump {
    display: flex;
  }
}

/* Main 2-Column Calculator Grid */
.calc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  gap: 22px;
  align-items: start;
}

@media (max-width: 860px) {
  .calc-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  min-width: 0;
}

@media (max-width: 420px) {
  .card {
    padding: 16px;
  }
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 800;
}

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

.rate-tag {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--surface-muted);
  padding: 4px 9px;
  border-radius: 6px;
  overflow-wrap: anywhere;
}

.btn-reset {
  min-height: 30px;
  padding: 4px 9px;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  cursor: pointer;
}

.btn-reset:hover {
  background: var(--surface-muted);
  color: var(--text);
}

/* Inputs */
.field-group {
  margin-bottom: 16px;
  min-width: 0;
}

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

@media (max-width: 520px) {
  .field-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.field-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.86rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #1e293b;
}

.label-hint {
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.77rem;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.prefix, .suffix {
  position: absolute;
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.88rem;
  pointer-events: none;
}

.prefix { left: 11px; }
.suffix { right: 12px; }

input[type="number"], input[type="text"], select {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text);
  background: #fff;
}

.has-prefix input { padding-left: 44px; }
.has-suffix input { padding-right: 34px; }

input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.quick-amounts {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.chip {
  min-height: 36px;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  color: #334155;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 8px;
  cursor: pointer;
}

.chip:hover {
  background: #e2e8f0;
  color: var(--text);
}

.convert-values-btn {
  margin-top: 6px;
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 0;
}

/* Collapsible Advanced Costs & Custom Fee Panels */
details.fold-panel {
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: #fcfdff;
}

details.fold-panel summary {
  font-size: 0.88rem;
  font-weight: 700;
  color: #1e293b;
  cursor: pointer;
  padding: 4px 0;
  list-style: revert;
}

details.fold-panel[open] summary {
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--border-soft);
}

.toggle-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface-muted);
  border-radius: 10px;
  margin-bottom: 8px;
  cursor: pointer;
  gap: 10px;
}

.toggle-box span {
  font-size: 0.86rem;
  font-weight: 700;
  color: #1e293b;
  display: block;
}

.toggle-box small {
  display: block;
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.76rem;
}

.toggle-box input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.rule-source-note {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface-muted);
  border-radius: 10px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.rule-source-note a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  margin-right: 10px;
}

.rule-source-note a:hover {
  text-decoration: underline;
}

.warning-note {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  color: #92400e;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.8rem;
  margin-bottom: 12px;
  display: none;
}

.warning-note.visible {
  display: block;
}

/* 3-Tier Output Metrics */
.tier-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

@media (max-width: 480px) {
  .tier-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.tier-box {
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  background: var(--surface-muted);
  min-width: 0;
}

.tier-box.payout-tier {
  background: var(--blue-payout-bg);
  border-color: var(--blue-payout-border);
}

.tier-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.tier-box.payout-tier .tier-label {
  color: var(--blue-payout-text);
}

.tier-val {
  font-size: clamp(1.1rem, 2.4vw, 1.35rem);
  font-weight: 800;
  color: var(--text);
  overflow-wrap: anywhere;
}

.tier-box.payout-tier .tier-val {
  color: var(--blue-payout-text);
}

.tier-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Main Metric 3: Estimated Order Profit */
.net-box {
  background: var(--green-soft);
  border: 1.5px solid var(--green-border);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.net-box.negative {
  background: var(--rose-soft);
  border-color: var(--rose-border);
}

.net-main {
  min-width: 0;
  flex: 1 1 180px;
}

.net-label {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--green-text);
}

.net-box.negative .net-label {
  color: #991b1b;
}

.net-value {
  font-size: clamp(1.5rem, 4vw, 2.05rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--green-text);
  line-height: 1.2;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.net-box.negative .net-value {
  color: #b91c1c;
}

.net-secondary {
  font-size: 0.84rem;
  font-weight: 600;
  color: #047857;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.net-box.negative .net-secondary {
  color: #b91c1c;
}

.margin-pill {
  background: #ffffff;
  padding: 5px 11px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.84rem;
  color: var(--green-text);
  border: 1px solid var(--green-border);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.net-box.negative .margin-pill {
  color: #b91c1c;
  border-color: var(--rose-border);
}

/* Decision Quick Badges (Break-Even & Max Discount) */
.decision-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.d-chip {
  flex: 1 1 140px;
  background: var(--surface-muted);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 0.8rem;
}

.d-chip strong {
  display: block;
  font-size: 0.92rem;
  color: var(--text);
}

/* Stacked Bar & Loss Banner */
.bar-wrap {
  margin-bottom: 16px;
}

.bar-track {
  height: 12px;
  width: 100%;
  background: var(--surface-muted);
  border-radius: 999px;
  overflow: hidden;
  display: flex;
}

.bar-seg {
  height: 100%;
  transition: width 0.2s ease;
}

.bar-legend {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 7px;
  font-size: 0.77rem;
  color: var(--text-muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.loss-alert {
  display: none;
  background: var(--rose-soft);
  border: 1px solid var(--rose-border);
  color: #991b1b;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.loss-alert.visible {
  display: block;
}

/* Detailed Breakdown Rows */
.breakdown {
  border-top: 1px solid var(--border-soft);
  padding-top: 12px;
  margin-bottom: 16px;
}

.b-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  font-size: 0.87rem;
  gap: 10px;
}

.b-row span:last-child, .b-row strong:last-child {
  text-align: right;
  white-space: nowrap;
}

.b-row.muted {
  color: var(--text-muted);
  font-size: 0.83rem;
}

.b-row.subtotal-row {
  border-top: 1px dashed var(--border);
  margin-top: 5px;
  padding-top: 8px;
  font-weight: 700;
  color: var(--text);
}

.b-row.payout-row {
  background: var(--blue-payout-bg);
  color: var(--blue-payout-text);
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 8px;
  margin: 6px 0;
}

/* Reverse Target Solver */
.reverse-card {
  background: var(--primary-soft);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

.reverse-title {
  font-size: 0.84rem;
  font-weight: 800;
  color: #1e40af;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
}

.reverse-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

@media (max-width: 480px) {
  .reverse-controls {
    grid-template-columns: minmax(0, 1fr);
  }
}

.reverse-output {
  font-size: 0.88rem;
  color: #1e3a8a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.reverse-output strong {
  font-size: 1.08rem;
  color: var(--primary);
}

.btn-apply-reverse {
  min-height: 34px;
  padding: 5px 11px;
  border-radius: 8px;
  border: 1px solid #93c5fd;
  background: #fff;
  color: var(--primary);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-apply-reverse:hover {
  background: #dbeafe;
}

/* Action Buttons (Copy, Share Link, Save Scenario) */
.action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 520px) {
  .action-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.btn-action {
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-weight: 700;
  font-size: 0.84rem;
  cursor: pointer;
  color: var(--text);
  text-align: center;
}

.btn-action:hover {
  background: var(--surface-muted);
}

.btn-action.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-action.primary:hover {
  background: var(--primary-hover);
}

/* Manual Copy Fallback Box */
.copy-fallback {
  display: none;
  margin-top: 12px;
  padding: 10px;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 10px;
}

.copy-fallback.visible {
  display: block;
}

.copy-fallback textarea {
  width: 100%;
  height: 82px;
  margin-top: 6px;
  padding: 8px;
  font-size: 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* Saved Scenarios & Side-by-Side Comparison Section */
.saved-section {
  margin-top: 24px;
}

.table-scroll-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th, .data-table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border-soft);
}

.data-table th {
  color: var(--text-muted);
  font-weight: 700;
  white-space: nowrap;
}

/* Honest User-Entered FX Hypothetical Simulator (No fabricated provider promises) */
.fx-sim-card {
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.fx-sim-card h2 {
  font-size: 1.05rem;
  margin-bottom: 6px;
}

.fx-sim-desc {
  font-size: 0.84rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.fx-sim-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

@media (max-width: 720px) {
  .fx-sim-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.fx-sim-result {
  background: var(--surface-muted);
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 0.86rem;
}

/* SEO & Reference Section */
.seo-section {
  margin-top: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 22px;
}

@media (max-width: 820px) {
  .seo-section {
    grid-template-columns: minmax(0, 1fr);
  }
}

.seo-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 22px;
  min-width: 0;
}

.seo-card h2 {
  font-size: 1.12rem;
  margin-bottom: 12px;
}

.faq-item {
  margin-bottom: 14px;
}

.faq-item h3 {
  font-size: 0.92rem;
  margin-bottom: 4px;
}

.faq-item p {
  font-size: 0.84rem;
  color: var(--text-muted);
}

footer {
  border-top: 1px solid var(--border-soft);
  padding: 24px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  background: var(--surface);
}

footer a {
  color: var(--primary);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Phase 2: Static SEO Methodology, Worked Examples & Crawlable Calculator Hub */
.seo-article {
  margin-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.seo-prose-card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 24px;
}

.seo-prose-card h2 {
  font-size: 1.18rem;
  margin-bottom: 10px;
  color: var(--text);
}

.seo-prose-card h3 {
  font-size: 0.98rem;
  margin: 14px 0 6px;
  color: #1e293b;
}

.seo-prose-card p, .seo-prose-card li {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.65;
}

.seo-prose-card ul {
  padding-left: 20px;
  margin: 8px 0;
}

.formula-box {
  background: var(--surface-muted);
  border-left: 4px solid var(--primary);
  padding: 12px 16px;
  border-radius: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85rem;
  color: var(--text);
  margin: 10px 0;
  overflow-x: auto;
}

.calc-hub-section {
  margin-top: 28px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 22px;
}

.calc-hub-section h2 {
  font-size: 1.1rem;
  margin-bottom: 12px;
}

.calc-hub-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.hub-link-card {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: var(--bg);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}

.hub-link-card:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.hub-link-card strong {
  display: block;
  font-size: 0.9rem;
  color: var(--primary);
  margin-bottom: 3px;
}

.hub-link-card span {
  font-size: 0.78rem;
  color: var(--text-muted);
}
