@import url('https://api.fontshare.com/v2/css?f[]=satoshi@400,500,700,900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Fragment+Mono&display=swap');

:root {
  --bg: #000000;
  --bg-card: #0a0a0a;
  --bg-card-hover: #121212;
  --blue: #3F86FA;
  --blue-dim: rgba(63, 134, 250, 0.15);
  --green: #05FF8E;
  --green-dim: rgba(5, 255, 142, 0.15);
  --red: #E74C3C;
  --red-dim: rgba(231, 76, 60, 0.15);
  --orange: #F39C12;
  --orange-dim: rgba(243, 156, 18, 0.15);
  --text: #FBFAFC;
  --text-dim: rgba(251, 250, 252, 0.5);
  --text-muted: rgba(251, 250, 252, 0.3);
  --border: rgba(255, 255, 255, 0.06);
  --font-display: 'Satoshi', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'Fragment Mono', monospace;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ─── SCREEN TRANSITIONS ─── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; flex-direction: column; }

/* ─── HEADER ─── */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(12px);
}
.header-logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.header-logo-img { width: 28px; height: 28px; border-radius: 6px; }
.header-logo span { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.header-right { display: flex; align-items: center; gap: 16px; }
.header-link {
  color: var(--text-dim); text-decoration: none; font-size: 14px;
  transition: color 0.2s; background: none; border: none; cursor: pointer;
  font-family: var(--font-body);
}
.header-link:hover { color: var(--blue); }

/* ─── SCREEN 1: HERO ─── */
.hero {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 60px 20px 40px;
  position: relative;
}
.hero::before { display: none; }
.hero-pirate { font-size: 64px; margin-bottom: 16px; }
.hero h1 {
  font-family: var(--font-display); font-weight: 900; font-size: clamp(28px, 5vw, 56px);
  line-height: 1.1; letter-spacing: -0.03em; max-width: 700px;
  background: linear-gradient(135deg, #ffffff 0%, #3F86FA 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub {
  margin-top: 16px; font-size: 16px; color: var(--text-dim);
  max-width: 520px; line-height: 1.5;
}

/* ─── SCAN INPUT ─── */
.scan-form {
  margin-top: 40px; display: flex; gap: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; overflow: hidden; max-width: 560px; width: 100%;
}
.scan-input {
  flex: 1; padding: 18px 24px; background: transparent; border: none;
  color: var(--text); font-family: var(--font-mono); font-size: 16px;
  outline: none; min-width: 0;
}
.scan-input::placeholder { color: var(--text-muted); }
.scan-btn {
  padding: 18px 32px; background: var(--blue); color: white;
  border: none; font-family: var(--font-display); font-weight: 700;
  font-size: 15px; cursor: pointer; transition: background 0.2s;
  white-space: nowrap;
}
.scan-btn:hover { background: #2a6fe0; }
.scan-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── STATS BAR ─── */
.stats-bar {
  margin-top: 32px; display: flex; gap: 24px; flex-wrap: wrap; justify-content: center;
  font-size: 13px; color: var(--text-muted); font-family: var(--font-mono);
}

/* ─── TICKER ─── */
.ticker-wrap {
  width: 100%; overflow: hidden; padding: 16px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  margin-top: 40px;
}
.ticker-label { color: var(--text-muted); font-size: 12px; font-family: var(--font-mono); padding: 0 20px; margin-bottom: 8px; }
.ticker-track {
  display: flex; gap: 12px; animation: ticker 40s linear infinite; width: max-content;
}
.ticker-item {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px; cursor: pointer; white-space: nowrap;
  transition: border-color 0.2s;
}
.ticker-item:hover { border-color: var(--blue); }
.ticker-emoji { font-size: 14px; }
.ticker-name-label { color: var(--text); font-weight: 600; font-family: var(--font-display); font-size: 13px; }
.ticker-item .score { font-weight: 700; font-family: var(--font-mono); font-size: 12px; }
.ticker-item .score.coule { color: var(--red); }
.ticker-item .score.cale { color: var(--orange); }
.ticker-item .score.flot { color: var(--green); }
.ticker-item .score.forteresse { color: var(--blue); }
@keyframes ticker { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* ─── SCREEN 2: LOADING ─── */
.loading-screen {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 60px 20px;
  position: relative;
}
.loading-back {
  position: absolute; top: 20px; left: 20px;
  background: none; border: 1px solid var(--border); border-radius: 8px;
  color: var(--text-dim); font-size: 14px; padding: 8px 16px;
  cursor: pointer; font-family: var(--font-body);
  transition: all 0.2s;
}
.loading-back:hover { border-color: var(--blue); color: var(--text); }
.loading-title {
  font-family: var(--font-display); font-weight: 700; font-size: 24px;
  margin-bottom: 8px;
}
.loading-domain { color: var(--blue); font-family: var(--font-mono); font-size: 16px; margin-bottom: 40px; }
.pipeline {
  width: 100%; max-width: 500px; display: flex; flex-direction: column; gap: 12px;
}
.pipeline-step {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 20px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; font-family: var(--font-mono); font-size: 14px;
  transition: all 0.3s;
}
.pipeline-step.running { border-color: var(--blue); background: var(--blue-dim); }
.pipeline-step.done { border-color: var(--green); }
.pipeline-step.error { border-color: var(--red); }
.step-icon { font-size: 18px; width: 24px; text-align: center; }
.step-label { flex: 1; color: var(--text-dim); }
.pipeline-step.running .step-label,
.pipeline-step.done .step-label { color: var(--text); }
.loading-flavor {
  margin-top: 32px; font-style: italic; color: var(--text-muted);
  font-size: 14px; text-align: center; min-height: 20px;
}

/* ═══════════════════════════════════════════════
   SCREEN 3: RESULTS — mobile-first scrollable
   ═══════════════════════════════════════════════ */

.results-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px 80px;
  width: 100%;
}

.results-header {
  text-align: center; padding: 32px 0 16px;
}
.results-header h2 {
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(24px, 4vw, 36px); margin-bottom: 8px;
}
.results-meta {
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
}
.results-domain { color: var(--blue); font-family: var(--font-mono); font-size: 14px; }
.results-sector {
  font-size: 12px; color: var(--text-muted);
  padding: 4px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-family: var(--font-mono);
}

/* Score Summary — 3 cards at top */
.score-summary {
  display: flex; gap: 10px; justify-content: center;
  margin: 16px 0 8px; flex-wrap: wrap;
}
.summary-card {
  flex: 1; min-width: 140px; max-width: 200px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 12px; text-align: center;
}
.summary-icon { font-size: 20px; margin-bottom: 4px; }
.summary-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; font-family: var(--font-mono); }
.summary-value { font-family: var(--font-display); font-weight: 900; font-size: 22px; margin: 4px 0 2px; }
.summary-tier { font-size: 11px; color: var(--text-dim); }
.summary-coule .summary-value { color: var(--red); }
.summary-eau_dans_la_cale .summary-value { color: var(--orange); }
.summary-a_flot .summary-value { color: var(--green); }
.summary-forteresse .summary-value { color: var(--blue); }
.summary-compression .summary-value { color: var(--orange); }
.summary-potential .summary-value { color: var(--green); }

/* Verdict */
.verdict-block { text-align: center; padding: 20px 0; }
.verdict-text {
  font-family: var(--font-display); font-weight: 500; font-size: 16px;
  color: var(--text-dim); font-style: italic; line-height: 1.5;
  margin-bottom: 16px;
}

/* ─── RESULT SECTIONS ─── */
.result-section {
  margin: 16px 0; padding: 24px 0;
  border-top: 1px solid var(--border);
}

.section-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
}
.section-icon { font-size: 24px; }
.section-header h3 {
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
}

.section-callout {
  font-size: 13px; color: var(--text-dim); font-style: italic;
  margin: -12px 0 20px 36px; line-height: 1.4;
}

.section-score-row {
  display: flex; align-items: center; gap: 24px;
  margin-bottom: 16px;
}

.section-score-info { flex: 1; }

.survival-text {
  font-family: var(--font-mono); font-size: 14px; color: var(--text-dim);
  margin-top: 8px;
}

.section-explanation {
  font-size: 15px; line-height: 1.6; color: var(--text-dim);
  margin-bottom: 20px;
}

/* Tier badge inline */
.tier-badge {
  display: inline-block; padding: 6px 14px; border-radius: 8px;
  font-family: var(--font-display); font-weight: 700; font-size: 13px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
}
.tier-COULE { color: var(--red); }
.tier-EAU_DANS_LA_CALE { color: var(--orange); }
.tier-A_FLOT { color: var(--green); }
.tier-FORTERESSE { color: var(--blue); }

/* Circular gauge */
.gauge { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.gauge svg { transform: rotate(-90deg); }
.gauge-bg { fill: none; stroke: var(--border); stroke-width: 8; }
.gauge-fill { fill: none; stroke-width: 8; stroke-linecap: round; transition: stroke-dashoffset 1.5s ease; }
.gauge-value {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-family: var(--font-display); font-weight: 900; font-size: 32px;
}

/* Vuln bars with reasons */
.vuln-bar-item { margin-bottom: 16px; }
.vuln-bar {
  display: flex; align-items: center; gap: 12px;
}
.vuln-label {
  width: 160px; font-size: 13px; color: var(--text-dim);
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.vuln-track {
  flex: 1; height: 8px; background: var(--bg-card-hover);
  border-radius: 4px; overflow: hidden;
}
.vuln-fill {
  height: 100%; border-radius: 4px;
  transition: width 1.5s ease;
}
.vuln-value { width: 36px; text-align: right; font-family: var(--font-mono); font-size: 13px; font-weight: 600; flex-shrink: 0; }
.vuln-desc {
  font-size: 11px; color: var(--text-muted); font-style: italic;
  margin-top: 2px; padding-left: 172px; opacity: 0.7;
}
.vuln-reason {
  font-size: 12px; color: var(--text-dim); line-height: 1.4;
  margin-top: 4px; padding-left: 172px;
}
.bars-intro {
  font-size: 12px; color: var(--text-muted); margin-bottom: 16px;
  padding: 6px 10px;
}

/* Compression bar */
.compression-bar-wrap { margin: 16px 0; }
.compression-bar {
  display: flex; height: 24px; border-radius: 6px; overflow: hidden;
  background: var(--bg-card-hover);
}
.compression-soft {
  background: var(--blue); transition: width 1s ease;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.compression-ai {
  background: var(--orange); transition: width 1s ease;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.compression-legend {
  display: flex; justify-content: space-between; margin-top: 8px;
  font-size: 13px; color: var(--text-dim);
}
.compression-label {
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  color: var(--orange);
}

/* Compression drivers */
.compression-drivers { margin-top: 16px; }
.drivers-title {
  font-family: var(--font-display); font-weight: 600; font-size: 14px;
  color: var(--text-dim); margin-bottom: 8px;
}
.drivers-list {
  padding: 0;
}
.driver-item {
  font-size: 13px; color: var(--text-dim); line-height: 1.5;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.driver-item:last-child { border-bottom: none; }
.reduction-projection {
  margin-top: 12px; padding: 10px 14px;
  background: rgba(255,255,255,0.02); border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; color: var(--text-dim);
}
.reduction-projection strong { color: var(--text); }

/* CA Projection */
.ca-projection {
  margin: 12px 0 16px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px;
}
.ca-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; font-size: 14px;
}
.ca-label { color: var(--text-dim); }
.ca-value { font-family: var(--font-display); font-weight: 700; }
.ca-negative .ca-value { color: var(--red); }
.ca-potential-big { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--border); }
.ca-potential-big .ca-label { color: var(--green); font-weight: 600; }
.ca-value-big {
  font-family: var(--font-display); font-weight: 900; font-size: 24px;
  color: var(--green);
}

/* Potential headline */
.tresor-headline { text-align: center; margin-bottom: 16px; }
.potential-value {
  font-family: var(--font-display); font-weight: 900; font-size: 36px;
  color: var(--green);
}
.potential-sub { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.potential-multiple { font-size: 14px; color: var(--green); margin-top: 6px; font-weight: 600; }

/* Method blocks — clean, minimal style */
.ca-method,
.section-method {
  font-size: 12px; color: var(--text-muted); margin-top: 14px; line-height: 1.6;
  padding: 12px 16px; background: rgba(255,255,255,0.02); border-radius: 8px;
  border: 1px solid var(--border);
}
.section-method strong,
.ca-method strong { color: var(--text-dim); font-weight: 600; }
.features-methodology {
  font-size: 12px; color: var(--text-muted);
  font-family: var(--font-mono); margin-bottom: 12px;
}

/* Feature cards */
.features-title {
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  margin: 24px 0 4px;
}
.feature-cards {
  display: grid; grid-template-columns: 1fr; gap: 12px;
}
.feature-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 16px;
  transition: border-color 0.2s;
}
.feature-card:hover { border-color: var(--blue); }
.feature-card-icon { font-size: 24px; margin-bottom: 8px; }
.feature-card-name {
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  margin-bottom: 2px;
}
.feature-card-real { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.feature-card-desc { font-size: 13px; color: var(--text-dim); line-height: 1.4; margin-bottom: 8px; }
.feature-card-revenue { font-family: var(--font-display); font-weight: 700; font-size: 14px; }
.feature-card-revenue.level-high { color: var(--green); }
.feature-card-revenue.level-medium { color: var(--blue); }
.feature-card-revenue.level-low { color: var(--text-dim); }

/* Piraterie Story */
.piraterie-story {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px;
}
.piraterie-act {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.piraterie-act:last-of-type { border-bottom: none; }
.piraterie-year {
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  margin-bottom: 8px;
}
.piraterie-death .piraterie-year { color: var(--red); }
.piraterie-hope .piraterie-year { color: var(--orange); }
.piraterie-act p { font-size: 14px; line-height: 1.6; color: var(--text-dim); }
.piraterie-weapon {
  display: inline-block; margin-top: 8px; padding: 4px 12px;
  background: rgba(255,255,255,0.04); border: 1px solid var(--border);
  border-radius: 6px; font-family: var(--font-display); font-weight: 600;
  font-size: 14px; color: var(--text-dim);
}
.piraterie-twist {
  padding: 16px 0 12px;
}
.piraterie-twist p {
  font-style: italic; color: var(--text-muted); font-size: 14px;
}
.piraterie-cta {
  display: block; margin-top: 16px;
  color: var(--blue); text-decoration: none;
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  transition: color 0.2s;
}
.piraterie-cta:hover { color: var(--text); }

/* AI says */
.ai-says {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px; margin: 24px 0;
  display: none;
}
.ai-says-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.ai-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--blue); display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.ai-says p { font-size: 14px; line-height: 1.6; color: var(--text-dim); font-style: italic; }

/* ─── CTA INLINE (between sections) ─── */
.cta-inline {
  margin: 12px 0;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.cta-inline-text {
  font-size: 14px; color: var(--text-dim);
}
.cta-inline-text strong {
  color: var(--text); font-family: var(--font-display);
}
.cta-inline-link {
  flex-shrink: 0;
  padding: 10px 24px;
  background: var(--blue);
  color: #fff;
  border-radius: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transition: opacity 0.2s;
}
.cta-inline-link:hover { opacity: 0.85; }

/* ─── LEAD GATE ─── */
.cta-lead {
  margin: 32px 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 24px; text-align: center;
}
.cta-lead h3 {
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  margin-bottom: 8px;
}
.cta-lead p { color: var(--text-dim); font-size: 14px; margin-bottom: 16px; }
.cta-lead-link {
  display: inline-block; padding: 14px 28px;
  background: var(--teal); color: #fff; border-radius: 10px;
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  text-decoration: none; transition: opacity 0.2s;
}
.cta-lead-link:hover { opacity: 0.9; }

/* ─── FOOTER CTA ─── */
.footer-cta {
  text-align: center; margin-top: 40px; padding: 0 16px;
}
.footer-cta-btn {
  display: inline-block; padding: 14px 32px;
  background: var(--blue); color: #fff; border-radius: 10px;
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  text-decoration: none; transition: opacity 0.2s;
}
.footer-cta-btn:hover { opacity: 0.85; }

/* ─── FOOTER ─── */
.footer {
  padding: 24px 0; text-align: center; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-muted); margin-top: 24px;
}
.footer a { color: var(--blue); text-decoration: none; }

/* ─── ERROR ─── */
.error-msg {
  max-width: 500px; margin: 20px auto; padding: 16px 20px;
  background: var(--red-dim); border: 1px solid var(--red);
  border-radius: 12px; text-align: center; color: var(--red);
  font-size: 14px; display: none;
}
.error-msg.visible { display: block; }

/* ─── RESPONSIVE ─── */
@media (max-width: 600px) {
  .header { padding: 12px 16px; }
  .hero { padding: 40px 16px 20px; }
  .scan-form { flex-direction: column; border-radius: 12px; }
  .scan-btn { border-radius: 0 0 12px 12px; }
  .stats-bar { flex-direction: column; gap: 8px; align-items: center; }
  .cta-banner { flex-direction: column; text-align: center; padding: 16px; }
  .vuln-label { width: 120px; font-size: 12px; }
  .vuln-desc { padding-left: 132px; }
  .vuln-reason { padding-left: 132px; }
  .section-score-row { flex-direction: column; align-items: center; text-align: center; }
  .results-container { padding: 0 12px 60px; }
  .potential-value { font-size: 28px; }
}

@media (min-width: 601px) {
  .feature-cards { grid-template-columns: repeat(2, 1fr); }
}

/* CTA Summary (below 3 scores) */
.cta-summary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 20px;
  margin: 8px auto 16px;
  max-width: 600px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}
.cta-summary-text { color: var(--text-dim); }
.cta-summary-text strong { color: var(--blue); }
.cta-summary-link {
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}
.cta-summary-link:hover { text-decoration: underline; }

/* Reduction indicator (compression) */
.reduction-projection {
  margin-top: 12px;
  padding: 10px 16px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.reduction-arrow {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}
.reduction-number {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}
.reduction-caption {
  font-size: 13px;
  color: var(--text-dim);
  margin-left: 4px;
}
