:root {
  --bg1: #020617;
  --bg2: #0f172a;
  --card: rgba(15, 23, 42, 0.9);
  --card2: rgba(30, 41, 59, 0.5);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #22c55e;
  --accent2: #16a34a;
  --danger: #ef4444;
  --warn: #f59e0b;
  --border: rgba(255, 255, 255, 0.07);
}

/* ─── BASE ─── */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  font-family: system-ui, -apple-system, sans-serif;
  background: radial-gradient(ellipse at top, #0f1f3d, var(--bg1));
  color: var(--text);
  overflow-x: hidden;
}

body::-webkit-scrollbar {
  width: 5px;
}

body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 99px;
}

/* ─── BILLETS BG ─── */
#money-bg {
  position: fixed;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.bill {
  position: absolute;
  opacity: 0;
  animation: fall linear infinite;
  user-select: none;
}

@keyframes fall {
  0% {
    transform: translateY(-12vh) rotate(0deg);
    opacity: 0;
  }

  5% {
    opacity: 0.10;
  }

  95% {
    opacity: 0.10;
  }

  100% {
    transform: translateY(105vh) rotate(360deg);
    opacity: 0;
  }
}

/* ─── LAYOUT ─── */
.wrapper {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 30px 16px;
}

.container {
  width: 100%;
  max-width: 560px;
  background: var(--card);
  backdrop-filter: blur(16px);
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ─── HEADER ─── */
.header {
  text-align: center;
}

h1 {
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 900;
  color: #22c55e;
  text-shadow:
    0 0 10px rgba(34, 197, 94, 0.5),
    0 0 30px rgba(34, 197, 94, 0.3),
    0 0 60px rgba(34, 197, 94, 0.2),
    0 0 100px rgba(34, 197, 94, 0.1);
  animation: pulse 3s infinite ease-in-out;
}

@keyframes pulse {

  0%,
  100% {
    text-shadow:
      0 0 10px rgba(34, 197, 94, 0.5),
      0 0 30px rgba(34, 197, 94, 0.3),
      0 0 60px rgba(34, 197, 94, 0.2);
  }

  50% {
    text-shadow:
      0 0 20px rgba(34, 197, 94, 0.7),
      0 0 50px rgba(34, 197, 94, 0.5),
      0 0 80px rgba(34, 197, 94, 0.3);
  }
}

.subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}

/* ─── CONCEPT BAR ─── */
.concept-bar {
  display: flex;
  gap: 10px;
}

.concept-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
  position: relative;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  overflow: visible;
  /* ← important */
  z-index: 1;
}

.concept-item:hover {
  transform: scale(1.06);
  background: rgba(34, 197, 94, 0.1);
  box-shadow: 0 0 24px rgba(34, 197, 94, 0.25);
  z-index: 100;
  /* ← passe au-dessus */
}

.concept-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.concept-icon {
  font-size: 20px;
  flex-shrink: 0;
}

.concept-item strong {
  display: block;
  font-size: 11px;
  color: var(--text);
}

.concept-item small {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.4;
}

@keyframes glow-hint {
  0% {
    box-shadow: 0 0 0px rgba(34, 197, 94, 0);
  }

  40% {
    box-shadow: 0 0 5px 1px rgba(34, 197, 94, 0.45);
  }

  100% {
    box-shadow: 0 0 0px rgba(34, 197, 94, 0);
  }
}

.concept-item.glow-once {
  animation: glow-hint 1s ease forwards;
}

/* ── EXPAND FLOTTANT ── */
.concept-expand {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  /* ← centré par rapport à la carte */
  width: 260px;
  /* ← largeur fixe plus grande */
  background: #1e293b;
  border: 1px solid rgba(34, 197, 94, 0.25);
  border-radius: 12px;
  padding: 0 12px;
  font-size: 0.78rem;
  color: #94a3b8;
  line-height: 1.5;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);

  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.35s ease, opacity 0.25s ease, padding 0.3s ease;
  pointer-events: none;
}

.concept-item:hover .concept-expand {
  max-height: 400px;
  opacity: 1;
  padding: 12px;
  pointer-events: auto;
}

.concept-expand p {
  margin: 0 0 8px 0;
}

.concept-expand p:last-child {
  margin-bottom: 0;
}

.concept-expand strong {
  color: var(--text);
}


/* ─── INPUTS GRID ─── */
.inputs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-wrap {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color .2s;
}

.input-wrap:focus-within {
  border-color: rgba(34, 197, 94, 0.4);
}

.input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 10px 12px;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  width: 100%;
}

.input-wrap span {
  padding: 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  border-left: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

/* ─── SLIDERS ─── */
.sliders-row {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.slider-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.slider-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
  transition: transform .15s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* ─── RESULT BANNER ─── */
.result-banner {
  text-align: center;
  padding: 14px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  background: var(--card2);
  border: 1px solid var(--border);
  transition: all .4s;
}

.result-banner.success {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--accent);
}

.result-banner.fail {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

/* ─── STATS ─── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.stat-card {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
}

.stat-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 5px;
}

.stat-value {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.stat-value.accent {
  color: var(--accent);
}

/* ─── PROGRESS BAR ─── */
.progress-wrap {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent2), var(--accent));
  border-radius: 99px;
  transition: width .6s ease;
  width: 0%;
}

/* ─── GRAPH ─── */
.chart-wrap {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border);
}

canvas {
  display: block;
  width: 100%;
  height: 220px;
  cursor: crosshair;
}

.chart-tooltip {
  position: absolute;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s;
  white-space: nowrap;
  z-index: 10;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.chart-tooltip.visible {
  opacity: 1;
}

/* ─── ACTIONS ─── */
.actions-row {
  display: flex;
  gap: 10px;
}

.btn {
  flex: 1;
  padding: 12px;
  border: none;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--muted);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.btn-share {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
}

.btn-share:hover {
  background: rgba(59, 130, 246, 0.25);
}

.btn-pdf {
  background: rgba(249, 115, 22, 0.15);
  border: 1px solid rgba(249, 115, 22, 0.3);
  color: #fb923c;
}

.btn-pdf:hover {
  background: rgba(249, 115, 22, 0.25);
}

.btn-accent {
  background: var(--accent);
  color: #000;
  font-weight: 800;
  padding: 12px 32px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  transition: all .2s;
}

.btn-accent:hover {
  background: var(--accent2);
  transform: scale(1.03);
}

/* ─── TOOLTIP ─── */
.tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.tooltip-icon {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: rgba(148, 163, 184, 0.15);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  font-style: italic;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: background .2s, border-color .2s;
  user-select: none;
}

.tooltip-icon:hover {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.4);
  color: var(--accent);
}

.tooltip-box {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 10px 12px;
  width: 220px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  z-index: 99;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.tooltip-box strong {
  display: block;
  color: var(--text);
  font-size: 12px;
  margin-bottom: 4px;
}

.tooltip-box::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(255, 255, 255, 0.1);
}

.tooltip-wrap:hover .tooltip-box {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── TOAST ─── */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  opacity: 0;
  transition: all .35s cubic-bezier(.34, 1.56, .64, 1);
  z-index: 999;
  pointer-events: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ─── MILESTONE OVERLAY ─── */
.milestone-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s;
}

.milestone-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.milestone-box {
  background: #0f172a;
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 24px;
  padding: 40px 48px;
  text-align: center;
  box-shadow: 0 0 60px rgba(34, 197, 94, 0.2);
  transform: scale(0.8);
  transition: transform .4s cubic-bezier(.34, 1.56, .64, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.milestone-overlay.active .milestone-box {
  transform: scale(1);
}

.milestone-emoji {
  font-size: 56px;
  animation: bounce 1s infinite alternate;
}

@keyframes bounce {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-10px);
  }
}

.milestone-title {
  font-size: 28px;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 1px;
}

.milestone-sub {
  font-size: 15px;
  color: var(--muted);
  max-width: 280px;
  line-height: 1.6;
}

/* ─── DISCLAIMER ─── */
.disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.18);
  border-radius: 12px;
  padding: 12px 14px;
}

.disclaimer-icon {
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 1px;
}

.disclaimer p {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.65;
  margin: 0;
}

.disclaimer p strong {
  color: rgba(245, 158, 11, 0.85);
  font-weight: 600;
}

/* ─── RESPONSIVE ─── */
@media (max-width: 480px) {
  .container {
    padding: 22px 16px;
  }

  .inputs-grid {
    grid-template-columns: 1fr;
  }

  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .concept-bar {
    flex-direction: column;
  }

  h1 {
    font-size: 22px;
  }
}