:root {
  /* Palette swimming pool (charte) */
  --smoky-black: #121212;
  --white: #ffffff;
  --blue: #4361ee;        /* Ultramarine Blue — couleur secondaire */
  --coral: #fd686d;       /* Light Coral */
  --saffron: #ff9a42;     /* Deep Saffron */
  --sky: #4cc9f0;         /* Vivid Sky Blue */
  --green: #00a877;       /* Green Munsell */

  --bg: var(--smoky-black);
  --text: var(--white);
  --muted: rgba(255,255,255,.6);
  --card: rgba(255,255,255,.06);
  --card-2: rgba(67,97,238,.16);
  --line: rgba(255,255,255,.14);

  --radius: 16px;
  --touch: 72px;
  --pad: clamp(20px, 4vw, 56px);
  --font: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  user-select: none;
}

/* --- Signature swpl : lignes verticales fines --------------------------- */
.pool-lines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.pool-lines__v {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.5px;
  background: var(--line);
}
/* réparties par les centres dans le sens horizontal (1/3 et 2/3) */
.pool-lines__v:nth-child(1) { left: 33.33%; }
.pool-lines__v:nth-child(2) { left: 66.66%; }

/* --- Wordmark de marque -------------------------------------------------- */
.brand {
  position: fixed;
  top: clamp(18px, 3vh, 34px);
  left: clamp(20px, 4vw, 56px);
  z-index: 5;
  font-weight: 700;
  font-size: clamp(15px, 2vw, 19px);
  line-height: 1.02;
  letter-spacing: -.01em;
  color: var(--white);
}

.app {
  position: relative;
  z-index: 1;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* --- Progress bar --------------------------------------------------------- */
.progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: rgba(255,255,255,.10);
  z-index: 10;
}
.progress__bar {
  height: 100%;
  width: 0%;
  background: var(--blue);
  transition: width .35s ease;
}

/* --- Stage / screens ------------------------------------------------------ */
.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--pad);
}

.screen {
  width: 100%;
  max-width: 920px;
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 3vh, 34px);
  animation: fade .3s ease;
}
@keyframes fade {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.screen__head { text-align: center; }
.eyebrow {
  color: var(--blue);
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-size: clamp(11px, 1.3vw, 13px);
  margin: 0 0 12px;
}
h1 {
  font-size: clamp(30px, 5vw, 54px);
  line-height: 1.02;
  margin: 0;
  font-weight: 800;
  letter-spacing: -.02em;
}
.subtitle {
  color: var(--muted);
  font-size: clamp(15px, 2.2vw, 20px);
  font-weight: 400;
  margin: 14px 0 0;
}

/* --- Options grid --------------------------------------------------------- */
.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.grid--colors {
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
}

.opt {
  position: relative;
  min-height: var(--touch);
  border: 2px solid transparent;
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius);
  padding: 18px 14px;
  font-family: var(--font);
  font-size: clamp(15px, 2.1vw, 19px);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.opt:active { transform: scale(.96); }
.opt.is-selected {
  border-color: var(--blue);
  background: var(--card-2);
}
.opt__icon { font-size: clamp(28px, 5vw, 40px); line-height: 1; }
.opt__icon-img {
  width: clamp(44px, 8vw, 58px);
  height: clamp(44px, 8vw, 58px);
  object-fit: contain;
  display: block;
}

/* Color swatches */
.swatch { padding: 14px; gap: 12px; }
.swatch__dot {
  width: clamp(46px, 8vw, 62px);
  height: clamp(46px, 8vw, 62px);
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.22);
}
.swatch__label { font-size: clamp(13px, 1.8vw, 16px); color: var(--muted); font-weight: 500; }
.opt.is-selected .swatch__label { color: var(--white); }

/* Badge d'ordre (multi-couleurs) */
.swatch__badge {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 26px;
  height: 26px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mc-count { margin: -6px 0 2px; font-weight: 500; }

/* --- Text input ----------------------------------------------------------- */
.field {
  width: 100%;
  font-family: var(--font);
  font-size: clamp(20px, 3vw, 30px);
  font-weight: 600;
  padding: 22px 24px;
  border-radius: var(--radius);
  border: 2px solid var(--line);
  background: var(--card);
  color: var(--text);
  text-align: center;
  outline: none;
}
.field:focus { border-color: var(--blue); }
.field::placeholder { color: rgba(255,255,255,.35); font-weight: 400; }

/* --- Buttons -------------------------------------------------------------- */
.actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn {
  min-height: var(--touch);
  padding: 0 36px;
  border-radius: 999px;
  border: none;
  font-family: var(--font);
  font-size: clamp(16px, 2.3vw, 20px);
  font-weight: 700;
  cursor: pointer;
  transition: transform .12s ease, opacity .2s ease, background .2s ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .35; cursor: default; }
.btn--primary { background: var(--blue); color: #fff; }
.btn--primary:hover { background: #3450d8; }
.btn--ghost {
  background: transparent;
  color: var(--white);
  border: 2px solid var(--line);
}
.btn--big { padding: 0 56px; min-height: 84px; font-size: clamp(19px, 3vw, 26px); }

/* --- Intro & result ------------------------------------------------------- */
.hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}
.hero__badge { font-size: clamp(70px, 16vw, 120px); line-height: 1; }

.result__img {
  width: min(66vh, 440px);
  aspect-ratio: 1;
  object-fit: contain;
  margin: 0 auto;
  /* damier discret pour visualiser la transparence du PNG */
  background-color: rgba(255,255,255,.04);
  background-image:
    linear-gradient(45deg, rgba(255,255,255,.05) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.05) 75%),
    linear-gradient(45deg, rgba(255,255,255,.05) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.05) 75%);
  background-size: 28px 28px;
  background-position: 0 0, 14px 14px;
  border-radius: var(--radius);
}
.result__club {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 800;
  letter-spacing: -.02em;
  text-align: center;
  margin: 4px 0 0;
}

/* --- Loading -------------------------------------------------------------- */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  text-align: center;
}
.loader__ring {
  width: 90px; height: 90px;
  border-radius: 50%;
  border: 6px solid rgba(255,255,255,.12);
  border-top-color: var(--blue);
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader__msg { color: var(--muted); font-size: clamp(16px, 2.4vw, 22px); min-height: 1.4em; }

.error {
  background: rgba(253,104,109,.14);
  border: 1px solid rgba(253,104,109,.5);
  color: #ffd9db;
  padding: 16px 20px;
  border-radius: 14px;
  text-align: center;
  font-size: 16px;
}

.hint { text-align: center; color: var(--muted); font-size: 14px; font-weight: 400; }
