:root {
  --bg: #020617;
  --bg-2: #0a1128;
  --surface: #0f172a;
  --surface-2: #1a2642;
  --border: #253355;
  --text: #f1f5f9;
  --muted: #7b8bab;
  --accent: #38bdf8;
  --accent-2: #0ea5e9;
  --danger: #f87171;
  --warning: #fbbf24;
  --success: #4ade80;
  --gold: #fcd34d;
  --radius: 16px;
  --radius-sm: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}

body {
  background:
    radial-gradient(1400px 700px at 50% -15%, rgba(56, 189, 248, 0.15), transparent 60%),
    radial-gradient(800px 500px at 100% 100%, rgba(14, 165, 233, 0.08), transparent 60%),
    var(--bg);
}

.app {
  max-width: 580px;
  margin: 0 auto;
  padding: calc(20px + var(--safe-top)) 20px calc(32px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ---------- HEADER ---------- */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  color: #020617;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-radius: 12px;
  box-shadow: 0 10px 28px -10px rgba(56, 189, 248, 0.55);
}
h1 {
  font-size: 22px;
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.12em;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.subtitle { margin: 2px 0 0; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }

.rate-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 999px;
}
.rate-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  animation: pulse 2s ease-in-out infinite;
}
.rate-status.live .rate-dot { background: var(--success); }
.rate-status.error .rate-dot { background: var(--danger); }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---------- HERO ---------- */
.hero { display: flex; flex-direction: column; gap: 12px; }
.kicker {
  align-self: flex-start;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: var(--accent);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.hero h2 {
  font-size: 30px;
  line-height: 1.1;
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.accent { color: var(--accent); }
.lead { font-size: 14px; color: var(--muted); margin: 0; }
.lead strong { color: var(--text); font-weight: 600; }

/* ---------- CALCULATOR ---------- */
.calc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.row { display: flex; gap: 12px; }
.row.two > .field { flex: 1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.flex { flex: 1; }
label { display: block; }
.label-main { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }

.input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 16px;
  transition: border-color .15s ease;
}
.input-wrap:focus-within { border-color: var(--accent); }
.input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  padding: 14px 0;
  font-size: 26px;
  font-weight: 800;
  outline: none;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  min-width: 0;
  width: 100%;
}
.input-wrap.big input { font-size: 34px; padding: 18px 0; letter-spacing: -0.02em; }

.select {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 14px 14px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237b8bab' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  padding-right: 36px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s ease;
}
.select:focus { outline: none; border-color: var(--accent); }

.midmarket {
  text-align: center;
  padding: 14px 0 4px;
  border-top: 1px dashed var(--border);
}
.mm-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
}
.mm-value {
  font-size: 18px;
  font-weight: 700;
  margin-top: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--accent);
}
.mm-eq { color: var(--muted); margin: 0 6px; }
.mm-updated {
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* ---------- PROVIDERS ---------- */
.section-title {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
  margin-bottom: 12px;
}
.providers-list { display: flex; flex-direction: column; gap: 10px; }
.provider {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all .2s ease;
}
.provider.best {
  border-color: var(--success);
  background: linear-gradient(180deg, rgba(74, 222, 128, 0.08), rgba(74, 222, 128, 0.02));
}
.provider.worst {
  border-color: rgba(248, 113, 113, 0.4);
  background: linear-gradient(180deg, rgba(248, 113, 113, 0.06), transparent);
}
.provider-badge {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  line-height: 1;
  color: var(--muted);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.provider.best .provider-badge {
  background: var(--success);
  color: #052e16;
}
.provider-body { flex: 1; min-width: 0; }
.provider-name {
  font-size: 14px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.provider-tag {
  font-size: 9px;
  background: var(--success);
  color: #052e16;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.provider.worst .provider-tag { background: var(--danger); color: #3b0a0a; }
.provider-meta {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.provider-meta strong { color: var(--text); font-weight: 700; }
.provider-receive {
  font-size: 18px;
  font-weight: 800;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: -0.02em;
}
.provider.best .provider-receive { color: var(--success); }
.provider.worst .provider-receive { color: var(--danger); }

/* ---------- ANNUAL ---------- */
.annual-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.annual-field label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 10px;
}
.slider-wrap { display: flex; align-items: center; gap: 14px; }
.slider-wrap input[type=range] {
  flex: 1;
  -webkit-appearance: none;
  height: 6px;
  background: var(--surface-2);
  border-radius: 999px;
  outline: none;
}
.slider-wrap input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.5);
}
.slider-wrap input[type=range]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}
.slider-wrap output {
  min-width: 34px;
  text-align: right;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-weight: 800;
  font-size: 17px;
  color: var(--text);
}
.annual-result {
  padding-top: 14px;
  border-top: 1px dashed var(--border);
  text-align: center;
}
.ar-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  margin-bottom: 6px;
}
.ar-value {
  font-size: 40px;
  font-weight: 900;
  color: var(--danger);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.ar-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  font-style: italic;
}

/* ---------- LEAD CAPTURE ---------- */
.lead-capture {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(14, 165, 233, 0.04));
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: var(--radius);
  padding: 20px;
}
.lead-capture h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.lead-capture p {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
}
.lead-capture form { display: flex; gap: 8px; flex-wrap: wrap; }
.lead-capture input[type=email] {
  flex: 1;
  min-width: 180px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 14px 16px;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  font-family: inherit;
}
.lead-capture input[type=email]:focus { border-color: var(--accent); }
.lead-capture button { flex-shrink: 0; padding: 14px 18px; }

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #020617;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 800;
  border-radius: 10px;
  cursor: pointer;
  transition: transform .08s ease;
  box-shadow: 0 10px 28px -8px rgba(56, 189, 248, 0.6);
  letter-spacing: -0.01em;
}
.primary:active { transform: scale(0.97); }

.secondary {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: all .15s ease;
}
.secondary:hover { border-color: var(--accent); }
.secondary:active { transform: scale(0.97); }

.fineprint { margin: 8px 0 0; font-size: 11px; color: var(--muted); text-align: center; }

/* ---------- TOOLS ---------- */
.tools { display: flex; flex-direction: column; gap: 12px; }
.tools-title {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}
.big-cta {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  border: none;
  color: #020617;
  padding: 18px 20px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 700;
  transition: transform .08s ease;
  box-shadow: 0 14px 34px -12px rgba(56, 189, 248, 0.55);
}
.big-cta:active { transform: scale(0.98); }
.cta-left { flex: 1; }
.cta-name { font-size: 17px; font-weight: 800; }
.cta-desc { font-size: 12px; opacity: 0.8; margin-top: 2px; font-weight: 500; }
.cta-arrow { font-size: 24px; font-weight: 900; }

.tools-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.tool-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  text-decoration: none;
  color: var(--text);
  transition: all .15s ease;
}
.tool-card:hover { border-color: var(--accent); }
.tool-name { font-size: 13px; font-weight: 700; }
.tool-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }

.share-row { display: flex; gap: 10px; }
.share-row button { flex: 1; }

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  bottom: calc(24px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.7);
  opacity: 0;
  pointer-events: none;
  transition: all .3s cubic-bezier(.2,.8,.2,1);
  z-index: 100;
  max-width: calc(100% - 40px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 400px) {
  .hero h2 { font-size: 25px; }
  .input-wrap.big input { font-size: 28px; }
  .ar-value { font-size: 34px; }
  .tools-grid { grid-template-columns: 1fr; }
  .provider-receive { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
