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

:root {
  --bg: #060a12;
  --surface: #0d1525;
  --surface2: #111d30;
  --border: rgba(99, 179, 237, 0.08);
  --border2: rgba(99, 179, 237, 0.15);
  --accent: #3b82f6;
  --accent2: #60a5fa;
  --cyan: #06b6d4;
  --text: #f0f4ff;
  --muted: #4a5a7a;
  --muted2: #8895b3;
  --green: #10b981;
  --radius: 20px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 400;
  min-height: 100vh;
  overflow-x: hidden;
}

#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

header {
  position: relative; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 48px;
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  background: rgba(6, 10, 18, 0.6);
}

.logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.05em;
  color: var(--text);
}
.logo span { color: var(--accent); }

.header-right { display: flex; align-items: center; gap: 16px; }

.badge-live {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--green);
  padding: 4px 10px;
  border: 1px solid rgba(16,185,129,0.3);
  border-radius: 20px;
  background: rgba(16,185,129,0.08);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.header-sub {
  font-size: 12px;
  color: var(--muted2);
}

main {
  position: relative; z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 72px 24px 100px;
}

/* HERO */
.hero { margin-bottom: 64px; }

.hero-tag {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 24px;
  display: flex; align-items: center; gap: 8px;
}
.hero-tag::before {
  content: '';
  display: inline-block;
  width: 24px; height: 1px;
  background: var(--accent);
}

h1 {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: clamp(44px, 6vw, 76px);
  line-height: 1.05;
  margin-bottom: 48px;
}

.line { display: block; opacity: 0; transform: translateY(24px);
  animation: slideUp 0.6s forwards; }
.line:nth-child(1) { animation-delay: 0.1s; }
.line:nth-child(2) { animation-delay: 0.2s; }
.line:nth-child(3) { animation-delay: 0.3s; }

@keyframes slideUp {
  to { opacity: 1; transform: translateY(0); }
}

.accent {
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-stats {
  display: flex; align-items: center; gap: 32px;
  opacity: 0; animation: slideUp 0.6s 0.4s forwards;
}

.stat { display: flex; flex-direction: column; gap: 4px; }

.stat-n {
  font-family: 'Syne', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.stat-l {
  font-size: 11px;
  color: var(--muted2);
  letter-spacing: 0.05em;
}

.stat-div {
  width: 1px; height: 40px;
  background: var(--border2);
}

/* FORM */
.form-card {
  background: rgba(13, 21, 37, 0.8);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 40px;
  backdrop-filter: blur(20px);
  box-shadow: 0 0 80px rgba(59, 130, 246, 0.05);
  opacity: 0; animation: slideUp 0.6s 0.5s forwards;
}

.type-selector {
  display: flex; gap: 12px;
  margin-bottom: 32px;
}

.type-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 14px 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted2);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.type-btn:hover { border-color: var(--border2); color: var(--text); }

.type-btn.active {
  background: rgba(59, 130, 246, 0.12);
  border-color: var(--accent);
  color: var(--accent2);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 32px;
}

.field { display: flex; flex-direction: column; gap: 8px; }

label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted2);
}

.input-wrap {
  display: flex; align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.input-wrap input {
  flex: 1; padding: 12px 16px;
  background: transparent; border: none; outline: none;
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px;
}

.unit {
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  border-left: 1px solid var(--border);
}

.stepper {
  display: flex; align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  height: 46px;
}

.step-btn {
  width: 44px; height: 100%;
  background: transparent; border: none; outline: none;
  color: var(--accent2);
  font-size: 20px;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.step-btn:hover { background: rgba(59,130,246,0.1); }

.stepper span {
  flex: 1; text-align: center;
  font-size: 16px; font-weight: 600;
  color: var(--text);
}

.select-wrap {
  position: relative;
}

.select-wrap select {
  width: 100%; padding: 12px 40px 12px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 500;
  outline: none; cursor: pointer;
  appearance: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.select-wrap select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.select-wrap select option { background: #0d1525; }

.select-wrap::after {
  content: '';
  position: absolute; right: 14px; top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--muted2);
  pointer-events: none;
}

/* CTA */
.cta {
  width: 100%; padding: 16px 32px;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  border: none; border-radius: 12px;
  color: #fff;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 15px; font-weight: 600;
  letter-spacing: 0.03em;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  transition: all 0.25s;
  position: relative; overflow: hidden;
}
.cta::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, #60a5fa, var(--accent));
  opacity: 0; transition: opacity 0.25s;
}
.cta:hover::before { opacity: 1; }
.cta:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(59,130,246,0.35); }
.cta:active { transform: translateY(0); }
.cta:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.cta span, .cta svg { position: relative; z-index: 1; }

.cta-loader {
  display: none;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  position: relative; z-index: 1;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* RESULT */
.result {
  margin-top: 24px;
  background: rgba(13, 21, 37, 0.8);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius);
  padding: 40px;
  backdrop-filter: blur(20px);
  display: none;
  animation: fadeUp 0.5s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-top { text-align: center; margin-bottom: 36px; }

.result-label {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.2em;
  color: var(--muted2);
  margin-bottom: 12px;
}

.result-price {
  font-family: 'Syne', sans-serif;
  font-size: clamp(48px, 8vw, 80px);
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent2), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.result-sub {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted2);
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}

.res-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 16px;
  text-align: center;
  transition: border-color 0.2s;
}
.res-card:hover { border-color: var(--border2); }

.res-card-mid {
  border-color: rgba(59,130,246,0.25);
  background: rgba(59,130,246,0.06);
}

.res-card-label {
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted2);
  margin-bottom: 8px;
}

.res-card-val {
  font-family: 'Syne', sans-serif;
  font-size: 20px; font-weight: 700;
  color: var(--text);
}

.precision-block { padding-top: 24px; border-top: 1px solid var(--border); }

.precision-top {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
  font-size: 12px; font-weight: 500;
  color: var(--muted2);
}

.precision-pct {
  font-family: 'Syne', sans-serif;
  font-size: 18px; font-weight: 700;
  color: var(--accent2);
}

.bar-track {
  height: 6px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--cyan), var(--green));
  border-radius: 3px;
  width: 0;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.segment-row {
  display: flex; align-items: center; justify-content: space-between;
}

.segment-badge {
  padding: 5px 14px;
  background: rgba(59,130,246,0.1);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: 20px;
  font-size: 12px; font-weight: 600;
  color: var(--accent2);
  text-transform: capitalize;
}

.disclaimer {
  font-size: 11px;
  color: var(--muted);
}

@media (max-width: 600px) {
  header { padding: 16px 20px; }
  main { padding: 48px 16px 80px; }
  .form-card, .result { padding: 24px; }
  .form-grid { grid-template-columns: 1fr; }
  .result-grid { grid-template-columns: 1fr; }
  .segment-row { flex-direction: column; gap: 8px; align-items: flex-start; }
}