:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-muted: #475569;
  --text-light: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --emerald: #059669;
  --emerald-soft: #ecfdf5;
  --danger: #dc2626;
  --amber: #d97706;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.04);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #059669);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.95rem;
}
.site-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 0.92rem;
  font-weight: 600;
}
.site-nav a { color: var(--text-muted); }
.site-nav a:hover { color: var(--primary); text-decoration: none; }
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary);
}
.badge-pill.emerald {
  background: var(--emerald-soft);
  color: var(--emerald);
}

/* Hero */
.hero {
  padding: 42px 0 28px;
}
.hero h1 {
  margin: 12px 0 10px;
  font-size: clamp(1.75rem, 3.6vw, 2.55rem);
  line-height: 1.16;
  letter-spacing: -0.03em;
}
.hero p.lead {
  margin: 0;
  max-width: 740px;
  font-size: 1.05rem;
  color: var(--text-muted);
}
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.84rem;
  color: var(--text-light);
  margin-bottom: 8px;
}
.breadcrumbs a { color: var(--text-muted); }

/* Cards & Grids */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.calc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 22px;
  align-items: start;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

/* Mode tabs */
.mode-tabs {
  display: inline-flex;
  background: var(--surface-alt);
  padding: 4px;
  border-radius: 10px;
  gap: 4px;
  margin-bottom: 18px;
}
.mode-tab {
  border: 0;
  background: transparent;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.mode-tab.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

/* Inputs */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field.full { grid-column: 1 / -1; }
.field label {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text-muted);
}
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-prefix, .input-suffix {
  position: absolute;
  color: var(--text-light);
  font-weight: 700;
  font-size: 0.92rem;
  pointer-events: none;
}
.input-prefix { left: 12px; }
.input-suffix { right: 12px; }

input[type="number"], select {
  width: 100%;
  height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text);
  background: #fff;
  font-variant-numeric: tabular-nums;
}
input.has-prefix { padding-left: 28px; }
input.has-suffix { padding-right: 30px; }
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-alt);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.checkbox-row input { width: 18px; height: 18px; margin: 0; accent-color: var(--primary); }

/* Output KPIs */
.reverse-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--primary-soft);
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.95rem;
}
.reverse-price { font-size: 1.35rem; font-variant-numeric: tabular-nums; }

.kpi-hero {
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
}
.kpi-label { font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-light); }
.kpi-value { font-size: 2.15rem; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.is-positive { color: var(--emerald); }
.is-negative { color: var(--danger); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.kpi-mini {
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 12px 14px;
}
.kpi-mini strong {
  display: block;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.kpi-mini small { color: var(--text-light); font-size: 0.78rem; }

/* Stacked Bar */
.stacked-bar {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
  margin: 12px 0 8px;
}
.bar-seg-profit { background: var(--emerald); transition: width 0.2s ease; }
.bar-seg-fees { background: var(--amber); transition: width 0.2s ease; }
.bar-seg-costs { background: #64748b; transition: width 0.2s ease; }
.bar-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }

.breakdown-list {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.breakdown-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.breakdown-row.is-muted { color: var(--text-muted); border-top: 1px dashed var(--border); margin-top: 4px; padding-top: 10px; }
.breakdown-row.is-total { border-top: 2px solid var(--border); margin-top: 6px; padding-top: 10px; font-weight: 800; font-size: 0.98rem; }

.extra-note {
  margin-top: 12px;
  padding: 10px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: 10px;
  font-size: 0.84rem;
}

.action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 10px;
  padding: 9px 15px;
  font-size: 0.88rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
}
.btn:hover { background: var(--surface-alt); text-decoration: none; }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; }

/* Hub Table */
.table-wrap { overflow-x: auto; margin-top: 16px; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table.data-table th {
  text-align: left;
  padding: 11px 12px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
}
table.data-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.data-table th.num, table.data-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data-table td.strong { font-weight: 800; font-size: 1rem; }
.table-link { font-weight: 800; color: var(--text); }
.table-link:hover { color: var(--primary); }
.table-sub { font-size: 0.78rem; color: var(--text-light); margin-top: 2px; }
.best-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  background: var(--emerald-soft);
  color: var(--emerald);
}
.mini-cta { font-size: 0.84rem; font-weight: 700; white-space: nowrap; }

/* Affiliate & AdSense Monetization Cards */
.section { padding: 28px 0; }
.section-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
}
.aff-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}
.aff-card h3 { margin: 6px 0 4px; font-size: 1.02rem; line-height: 1.3; }
.aff-card p { margin: 0; font-size: 0.87rem; color: var(--text-muted); }
.aff-meta { font-size: 0.74rem; color: var(--text-light); }

.ad-slot {
  margin: 22px 0;
  min-height: 96px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 0.8rem;
  background: #f8fafc;
}

/* Platform & Comparison Link Cards */
.dir-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  color: var(--text);
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.dir-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  text-decoration: none;
}
.dir-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.dir-card h3 { margin: 0; font-size: 1rem; }
.dir-card p { margin: 0; font-size: 0.84rem; color: var(--text-muted); }

/* FAQ & Prose */
.prose ul { padding-left: 20px; margin: 10px 0; }
.prose li { margin-bottom: 8px; color: var(--text-muted); }
.faq-item {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 10px;
}
.faq-item h3 { margin: 0 0 6px; font-size: 1rem; }
.faq-item p { margin: 0; color: var(--text-muted); font-size: 0.92rem; }

.winner-banner {
  background: var(--emerald-soft);
  border: 1px solid #a7f3d0;
  color: #065f46;
  padding: 14px 18px;
  border-radius: 12px;
  margin: 16px 0;
  font-size: 1rem;
}

/* Footer */
.site-footer {
  margin-top: 48px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 32px 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}
.footer-grid {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

@media (max-width: 860px) {
  .calc-layout, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .site-nav { gap: 12px; font-size: 0.84rem; }
  .header-inner { height: auto; padding: 12px 0; flex-wrap: wrap; }
}
