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

:root {
  --c-accent:     #F15C27;
  --c-accent-dim: #f15c2718;
  --c-bg:         #FAFAF7;
  --c-card:       #FFFFFF;
  --c-card-2:     #F4F4EF;
  --c-text:       #0A0A0A;
  --c-muted:      #6b6b78;
  --c-border:     #e5e5e0;
  --c-good:       #0fa874;
  --c-good-dim:   #0fa87418;
  --c-bad:        #d93954;
  --c-bad-dim:    #d9395418;
  --c-bonus:      #d97706;
  --header-h:     80px;
  --btn-area-h:   168px;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--c-bg);
  font-family: 'Inter', system-ui, -apple-system, Arial, sans-serif;
  color: var(--c-text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* ─── FLASH OVERLAY ──────────────────────────────────────────────────────── */
#flash {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 200; opacity: 0;
}
#flash.flash-good  { background: var(--c-good); animation: flashPop 350ms ease-out forwards; }
#flash.flash-bad   { background: var(--c-bad);  animation: flashPop 450ms ease-out forwards; }
#flash.flash-black { background: #000;           animation: fadeToBlack 550ms ease-in forwards; }
#flash.flash-win   { background: var(--c-good);  animation: fadeToBlack 550ms ease-in forwards; }

@keyframes flashPop     { 0% { opacity: .7; } 100% { opacity: 0; } }
@keyframes fadeToBlack  { 0% { opacity: 0; } 100% { opacity: 1; } }

/* ─── SHAKE ──────────────────────────────────────────────────────────────── */
@keyframes shake {
  0%,100%     { transform: translateX(0);   }
  15%,55%,85% { transform: translateX(-9px); }
  35%,70%     { transform: translateX(9px);  }
}
.shake { animation: shake 420ms ease-in-out; }

/* ─── SCREENS ────────────────────────────────────────────────────────────── */
.screen { position: fixed; inset: 0; display: none; flex-direction: column; }
.screen.active { display: flex; }

/* ═══════════════════════════════════════════════════════════════════════════
   START SCREEN — full light Waadoo
   ═══════════════════════════════════════════════════════════════════════════ */
#screen-start {
  background: var(--c-bg);
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 32px 24px;
}
#screen-start::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse 90% 55% at 50% 105%, rgba(241,92,39,.12) 0%, transparent 70%);
  pointer-events: none;
}
.start-inner {
  position: relative;
  max-width: 380px; width: 100%;
}
.start-logo {
  font-size: 11px; font-weight: 800;
  letter-spacing: .38em; color: var(--c-accent);
  margin-bottom: 36px;
}
.start-title {
  font-family: 'Manrope', 'Inter', system-ui, sans-serif;
  font-size: clamp(32px, 9vw, 48px);
  font-weight: 800; line-height: 1.02;
  letter-spacing: -.035em; text-transform: uppercase;
  color: var(--c-text); margin-bottom: 16px;
}
.start-title span { color: var(--c-accent); }
.start-desc {
  font-size: 15px; color: var(--c-muted);
  line-height: 1.55; margin-bottom: 10px;
}
.start-meta {
  font-size: 12px; letter-spacing: .08em;
  color: var(--c-border); margin-bottom: 44px;
  color: #b0b0a8;
}
.start-privacy {
  font-size: 11px; color: var(--c-muted); opacity: .6;
  margin: 16px 0 0; letter-spacing: .03em;
}
.btn-play {
  width: 100%; max-width: 320px; padding: 20px;
  background: var(--c-accent); color: #fff;
  font-family: inherit; font-size: 18px; font-weight: 800;
  letter-spacing: .14em; border: none; border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(241,92,39,.35), 0 2px 8px rgba(241,92,39,.2);
  transition: transform .1s, box-shadow .1s;
}
.btn-play:active { transform: scale(.97); box-shadow: 0 2px 8px rgba(241,92,39,.2); }

/* ═══════════════════════════════════════════════════════════════════════════
   GAME HEADER — light card flottant sur le fond atmosphérique
   ═══════════════════════════════════════════════════════════════════════════ */
#game-header {
  min-height: var(--header-h);
  display: flex; flex-direction: column; align-items: stretch;
  background: rgba(250,250,247,.92);
  border-bottom: 1px solid var(--c-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0; z-index: 10; position: relative;
}
#header-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px 2px;
}
#lives { font-size: 20px; letter-spacing: 2px; min-width: 76px; }
#level-tag {
  font-size: 11px; font-weight: 700; letter-spacing: .18em;
  color: var(--c-muted); text-align: center;
}
#header-end { min-width: 76px; }
#progress { padding: 2px 12px 8px; }

/* ─── PATH MAP ───────────────────────────────────────────────────────────── */
.path-map {
  display: flex; align-items: center;
  width: 100%;
}
.pn {
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; line-height: 1;
  flex-shrink: 0; transition: transform .15s;
}
.pn-conn {
  flex: 1; height: 2px; min-width: 6px;
  background: repeating-linear-gradient(90deg, rgba(0,0,0,.2) 0, rgba(0,0,0,.2) 3px, transparent 3px, transparent 7px);
}
.pn-conn-done {
  background: repeating-linear-gradient(90deg, rgba(16,185,129,.55) 0, rgba(16,185,129,.55) 3px, transparent 3px, transparent 7px);
}
.pn-future {
  width: 20px; height: 20px;
  background: #fff;
  border: 2px solid #000;
  font-size: 0;
}
.pn-good { background: #10b981; color: #fff; }
.pn-bad  { background: #ef4444; color: #fff; }
.pn-current {
  background: #fff; color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(241,92,39,.35);
  animation: pn-pulse 1.1s ease-in-out infinite;
}
.pn-boss, .pn-bonus { font-size: 14px; background: transparent; width: 24px; height: 24px; }
.pn-boss.pn-future, .pn-bonus.pn-future { font-size: 13px; }
.pn-boss.pn-current, .pn-bonus.pn-current {
  background: #fff;
  box-shadow: 0 0 0 3px rgba(241,92,39,.35);
  animation: pn-ring-pulse 1.1s ease-in-out infinite;
}
.pn-boss.pn-good, .pn-bonus.pn-good { background: rgba(16,185,129,.18); }
.pn-boss.pn-bad,  .pn-bonus.pn-bad  { background: rgba(239,68,68,.18); }
@keyframes pn-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.22); }
}
@keyframes pn-ring-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(241,92,39,.3); }
  50%       { box-shadow: 0 0 0 4px rgba(241,92,39,.65); }
}

/* ─── GAME MAIN ──────────────────────────────────────────────────────────── */
#game-main { flex: 1; position: relative; overflow: hidden; }
#game-bg {
  position: absolute; inset: 0;
  background: #1a1008;
  transition: background .28s ease; z-index: 0;
}

/* Boss vignette dramatique */
#screen-game.boss-mode #game-main::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 20%, rgba(100,0,0,.7) 100%);
  z-index: 1; pointer-events: none;
}
#screen-game.boss-mode #game-header {
  background: rgba(80,0,0,.93);
  border-bottom-color: rgba(217,57,84,.25);
}
#screen-game.boss-mode #level-tag { color: #fca5a5; }
#screen-game.boss-mode .pn-future { background: rgba(255,255,255,.2); }
#screen-game.boss-mode .pn-conn { background: repeating-linear-gradient(90deg, rgba(255,255,255,.25) 0, rgba(255,255,255,.25) 3px, transparent 3px, transparent 7px); }
#screen-game.boss-mode .pn-current { background: #fff; color: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.5); }
#screen-game.boss-mode .pn-boss.pn-current, #screen-game.boss-mode .pn-bonus.pn-current {
  animation-name: pn-ring-pulse-red;
}
@keyframes pn-ring-pulse-red {
  0%, 100% { box-shadow: 0 0 0 2px rgba(220,38,38,.4); }
  50%       { box-shadow: 0 0 0 4px rgba(220,38,38,.8); }
}
#screen-game.boss-mode #lives { filter: drop-shadow(0 0 4px rgba(217,57,84,.6)); }

/* ─── SPRITE ─────────────────────────────────────────────────────────────── */
#sprite-wrap {
  position: absolute;
  right: 0;
  bottom: calc(var(--btn-area-h) + 10px); /* ancré juste au-dessus des boutons */
  width: 85%;
  display: flex; justify-content: center; align-items: flex-end;
  z-index: 3; pointer-events: none;
}
#sprite-inner.sprite-img {
  width: min(280px, 30vh);
  height: min(420px, 45vh);
}
#sprite-inner {
  /* Taille par défaut (emoji placeholder) */
  width: 148px; height: 192px;
  border-radius: 50% 50% 38% 38%;
  display: flex; align-items: center; justify-content: center;
  font-size: 88px; line-height: 1;
  background: rgba(255,255,255,.1);
  border: 2px solid rgba(255,255,255,.15);
  box-shadow: 0 24px 64px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.07);
  transition: filter .25s, transform .2s;
}

/* ─── DIALOG BOX — carte blanche ─────────────────────────────────────────── */
#dialog {
  position: absolute;
  left: 12px; right: 12px;
  bottom: calc(var(--btn-area-h) + 10px);
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 14px 16px 16px;
  z-index: 4;
  box-shadow: 0 4px 24px rgba(0,0,0,.18), 0 1px 4px rgba(0,0,0,.1);
}
#question-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .2em;
  text-transform: uppercase; margin-bottom: 6px; height: 16px;
}
#question-text {
  font-size: 16px; font-weight: 600; line-height: 1.45;
  color: var(--c-text);
}

/* ─── BUTTONS AREA ───────────────────────────────────────────────────────── */
#buttons-area {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: var(--btn-area-h);
  padding: 8px 12px 20px;
  z-index: 4; display: flex; flex-direction: column; gap: 7px;
}
#buttons-area.mode-two { flex-direction: row; }

/* Verdict stamp — 2 choix */
.btn-verdict {
  flex: 1;
  background: var(--c-card);
  color: var(--c-text);
  border: 2px solid var(--c-border);
  border-radius: 8px;
  font-family: inherit; font-size: 20px; font-weight: 800;
  letter-spacing: .06em; text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  transition: transform .08s, box-shadow .08s;
  animation: btnAppear .2s ease backwards;
}
.btn-verdict:nth-child(1) {
  transform: rotate(-2deg);
  border-color: #10b981; color: #10b981;
  animation-delay: 0s;
}
.btn-verdict:nth-child(2) {
  transform: rotate(2deg);
  border-color: #ef4444; color: #ef4444;
  animation-delay: .06s;
}
.btn-verdict:active { transform: rotate(0) scale(.94) !important; box-shadow: none; }

/* Bulle manga — 3 choix */
.btn-manga {
  flex: 1;
  background: var(--c-card);
  color: var(--c-text);
  border: 1.5px solid var(--c-border);
  border-radius: 10px;
  font-family: inherit; font-size: 15px; font-weight: 600;
  cursor: pointer; text-align: center; padding: 0 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  transition: transform .08s, box-shadow .08s;
  animation: btnAppear .2s ease backwards;
}
.btn-manga:nth-child(1) {
  border-color: #10b981; color: #10b981; font-weight: 700;
  animation-delay: 0s;
}
.btn-manga:nth-child(2) {
  border-color: #f59e0b; color: #f59e0b;
  animation-delay: .07s;
}
.btn-manga:nth-child(3) {
  border-color: #ef4444; color: #ef4444;
  animation-delay: .14s;
}
.btn-manga:active { transform: scale(.97); box-shadow: none; }

@keyframes btnAppear {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   END SCREENS
   ═══════════════════════════════════════════════════════════════════════════ */
#screen-elimination {
  background: linear-gradient(160deg, #1a0205 0%, #3b0010 60%, #1a0505 100%);
  justify-content: center; align-items: center;
  text-align: center; padding: 32px 24px;
  color: #f8fafc;
}
#screen-victory {
  background: var(--c-bg);
  justify-content: center; align-items: center;
  text-align: center; padding: 32px 24px;
}
.end-inner { max-width: 380px; width: 100%; }
.victory-inner { display: flex; flex-direction: column; align-items: center; }

.end-tag {
  display: inline-block; font-size: 10px; font-weight: 700;
  letter-spacing: .22em; padding: 5px 14px;
  border-radius: 20px; margin-bottom: 24px; text-transform: uppercase;
}
.elim-tag {
  background: rgba(217,57,84,.15); color: #fca5a5;
  border: 1px solid rgba(217,57,84,.3);
}
.victory-tag {
  font-family: 'Manrope', sans-serif;
  font-size: 22px; font-weight: 800; letter-spacing: .04em;
  background: var(--c-accent-dim); color: var(--c-accent);
  border: 1px solid rgba(241,92,39,.3);
  padding: 8px 22px;
}
.end-title {
  font-family: 'Manrope', 'Inter', sans-serif;
  font-size: clamp(20px, 6.5vw, 28px); font-weight: 800;
  line-height: 1.15; margin-bottom: 14px;
}
#screen-victory .end-title { color: var(--c-text); }
.end-sub {
  font-size: 14px; line-height: 1.6; margin-bottom: 28px; max-width: 300px;
}
#screen-elimination .end-sub { color: rgba(248,250,252,.6); }
#screen-victory .end-sub { color: var(--c-muted); }

.end-score {
  font-family: 'Manrope', sans-serif;
  font-size: 42px; font-weight: 800;
  color: var(--c-accent); letter-spacing: -.02em; margin-bottom: 36px;
}
.btn-action {
  width: 100%; padding: 18px;
  background: var(--c-accent); color: #fff;
  font-family: inherit; font-size: 15px; font-weight: 700;
  letter-spacing: .1em; border: none; border-radius: 8px; cursor: pointer;
  box-shadow: 0 4px 16px rgba(241,92,39,.35);
}
.btn-action:active { opacity: .85; }

/* ═══════════════════════════════════════════════════════════════════════════
   RESULT SCREEN — style calculateur Waadoo
   ═══════════════════════════════════════════════════════════════════════════ */
#screen-result {
  background: var(--c-bg);
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
.result-inner {
  max-width: 420px; margin: 0 auto;
  padding: 32px 20px 56px;
  display: flex; flex-direction: column; gap: 18px;
}
.result-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .18em;
  color: var(--c-accent); text-transform: uppercase;
}
.result-title {
  font-family: 'Manrope', 'Inter', sans-serif;
  font-size: clamp(22px, 6.5vw, 30px); font-weight: 800;
  line-height: 1.15; color: var(--c-text);
}
.result-failure {
  font-size: 14px; color: var(--c-muted);
  padding: 12px 16px;
  border-left: 3px solid var(--c-accent);
  background: var(--c-accent-dim);
  border-radius: 0 8px 8px 0;
  line-height: 1.6;
}
.share-box {
  background: var(--c-card);
  border: 1px solid var(--c-border);
  border-radius: 12px; padding: 18px;
  display: flex; flex-direction: column; gap: 12px;
}
.share-label {
  font-size: 10px; font-weight: 700;
  letter-spacing: .2em; color: var(--c-muted);
}
.share-preview {
  font-family: inherit; font-size: 13px;
  color: var(--c-muted); line-height: 1.65; white-space: pre-wrap;
  background: var(--c-card-2); border-radius: 6px;
  padding: 12px; border: 1px solid var(--c-border);
}
.btn-linkedin {
  padding: 14px; background: #0a66c2; color: #fff;
  font-family: inherit; font-size: 15px; font-weight: 700;
  border: none; border-radius: 8px; cursor: pointer;
}
.btn-linkedin:active { opacity: .85; }
.btn-linkedin:disabled { opacity: .6; cursor: default; }
.share-hint {
  font-size: 13px; color: var(--c-muted);
  display: none; margin: 0;
}
.btn-linkedin-open {
  display: block; padding: 14px; background: #0a66c2; color: #fff;
  font-family: inherit; font-size: 15px; font-weight: 700;
  border-radius: 8px; cursor: pointer; text-align: center;
  text-decoration: none;
}
.btn-linkedin-open:active { opacity: .85; }
.btn-cta {
  display: block; padding: 18px 16px;
  background: var(--c-accent); color: #fff;
  font-size: 14px; font-weight: 700;
  text-decoration: none; border-radius: 8px;
  text-align: center; line-height: 1.45;
  box-shadow: 0 4px 20px rgba(241,92,39,.3);
}
.btn-replay {
  background: none;
  border: 1.5px solid var(--c-border);
  color: var(--c-muted);
  padding: 14px; font-family: inherit; font-size: 15px;
  font-weight: 600; border-radius: 8px; cursor: pointer;
}
.btn-replay:active { opacity: .7; }

/* ─── SÉLECTION PERSONNAGE ───────────────────────────────────────────────── */
.char-select-inner {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100dvh;
  padding: 32px 24px; gap: 20px; text-align: center;
}
.char-select-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .12em;
  color: var(--c-orange); text-transform: uppercase; margin: 0;
}
.char-select-title {
  font-size: 22px; font-weight: 800; color: var(--c-text);
  margin: 0; line-height: 1.2;
}
.char-select-grid {
  display: flex; gap: 20px; justify-content: center;
  flex-wrap: wrap; width: 100%; max-width: 440px;
}
.char-card {
  display: flex; align-items: center; justify-content: center;
  padding: 6px; border-radius: 16px;
  border: 3px solid transparent; cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
  flex: 1; min-width: 100px; max-width: 130px;
}
.char-card:active { transform: scale(.95); }
.char-card.char-selected {
  border-color: var(--c-orange);
  box-shadow: 0 0 18px rgba(232,83,26,.35);
}
.char-avatar {
  width: 100%; aspect-ratio: 2/3; border-radius: 10px;
  border: 2px solid; display: flex; align-items: center;
  justify-content: center;
  background-size: contain; background-repeat: no-repeat;
  background-position: center bottom;
  position: relative; overflow: hidden;
}
.char-initial {
  font-size: 40px; font-weight: 900; line-height: 1;
  position: absolute;
}

/* ─── SLIDE TRANSITION ───────────────────────────────────────────────────── */
@keyframes slideInRight {
  from { transform: translateX(36px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.slide-in { animation: slideInRight .22s ease-out; }

/* ─── DESKTOP — colonne centrée ─────────────────────────────────────────── */
@media (min-width: 520px) {
  #dialog {
    left: max(12px, 50% - 300px);
    right: max(12px, 50% - 300px);
  }
  #buttons-area {
    left: max(0px, 50% - 320px);
    right: max(0px, 50% - 320px);
  }
}
