:root {
  --navy: #1d1e3c;
  --violet: #69408c;
  --v2: #8b5bb8;
  --pink: #eb94c2;
  --yellow: #ffcc52;
  --plum: #d9c9e5;
  --muted: #a99bbf;
  --text: #f0ecf8;
  --panel: rgba(29, 30, 60, 0.97);
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
body {
  font-family: "Nunito", sans-serif;
  color: var(--text);
  background: #0d0d1a;
}

/* ── ÉCRAN CHOIX ── */
#screen-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100dvh;
  background: radial-gradient(
    ellipse at 50% 30%,
    #2d1e45 0%,
    #1d1e3c 60%,
    #0d0d1a 100%
  );
  animation: fadeUp 0.5s ease;
  padding: 16px;
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
#screen-pick.hidden {
  display: none;
}

.ft-badge {
  background: var(--violet);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 2px;
  padding: 5px 20px;
  border-radius: 4px;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.game-title {
  font-family: "Syne", sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: #fff;
  text-align: center;
  line-height: 1.1;
  text-shadow: 0 0 50px rgba(105, 64, 140, 0.7);
  margin-bottom: 6px;
}
.game-title span {
  color: var(--yellow);
}
.game-sub {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 24px;
}
.cards-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}
.hero-card {
  width: 100%;
  max-width: 280px;
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid rgba(105, 64, 140, 0.3);
  background: rgba(105, 64, 140, 0.1);
  display: flex;
  flex-direction: column;
  transition:
    transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.25s,
    border-color 0.25s;
  user-select: none;
}
.hero-card:hover {
  transform: translateY(-6px) scale(1.03);
  border-color: var(--violet);
  box-shadow: 0 16px 40px rgba(105, 64, 140, 0.5);
}
.hero-card:active {
  transform: scale(0.97);
}
.hero-card:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
  border-color: var(--yellow);
}
.btn:focus-visible,
.pop-close:focus-visible,
.dlg-x:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}
#skip-btn button:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}
.card-photo {
  height: 180px;
  overflow: hidden;
  background: linear-gradient(
    180deg,
    rgba(105, 64, 140, 0.15) 0%,
    rgba(105, 64, 140, 0.4) 100%
  );
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.card-photo picture {
  display: flex;
  width: 100%;
  height: 100%;
}
.card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
  filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.55));
}
.hero-card:hover .card-photo img {
  transform: scale(1.07) translateY(-4px);
}
.card-info {
  padding: 12px 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.card-name {
  font-family: "Syne", sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 3px;
}
.card-role {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.card-tag {
  font-size: 12px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 20px;
  background: rgba(105, 64, 140, 0.22);
  border: 1px solid rgba(105, 64, 140, 0.4);
  color: var(--plum);
}
.pick-hint {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ── ÉCRAN JEU (intro) ── */
#screen-game {
  display: none;
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
}
#screen-game.visible {
  display: block;
}

/* Carte Leaflet */
#intro-map {
  position: absolute;
  inset: 0;
  z-index: 1;
}
.leaflet-tile-pane {
  filter: sepia(0.7) saturate(2.8) brightness(0.72) contrast(1.3)
    hue-rotate(15deg);
}
.leaflet-container {
  background: #4a7a30;
}

/* Overlay titre sur carte */
#map-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  background: linear-gradient(
    180deg,
    rgba(13, 13, 26, 0.75) 0%,
    transparent 100%
  );
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mo-title {
  font-family: "Syne", sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.mo-badge {
  background: var(--violet);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  padding: 3px 10px;
  border-radius: 4px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* Vignette carte */
#intro-map::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 50% 50%,
    transparent 40%,
    rgba(5, 5, 18, 0.55) 100%
  );
}

/* Vidéo plein écran */
#vid-wrap {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
  overflow: hidden;
}
#vid-wrap.show {
  opacity: 1;
  pointer-events: all;
}
#the-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Gradient bas vidéo */
#vid-wrap::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 55%;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.82) 0%,
    rgba(0, 0, 0, 0.3) 60%,
    transparent 100%
  );
  pointer-events: none;
  z-index: 1;
}
#skip-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}
#skip-btn.show {
  opacity: 1;
  pointer-events: all;
}
#skip-btn button {
  background: rgba(18, 14, 36, 0.85);
  border: 1px solid rgba(105, 64, 140, 0.5);
  color: #fff;
  font-family: "Nunito", sans-serif;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
}
#skip-btn button:hover {
  background: rgba(105, 64, 140, 0.7);
}

/* Dialogue incrusté */
#dlg {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 25;
  background: rgba(12, 9, 28, 0.92);
  backdrop-filter: blur(18px);
  border-top: 3px solid var(--violet);
  transform: translateY(100%);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
#dlg.open {
  transform: translateY(0);
  pointer-events: all;
}
#dlg.collapsed .dlg-body,
#dlg.collapsed .dlg-foot {
  display: none;
}
.dlg-head {
  background: rgba(22, 18, 44, 0.99);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(105, 64, 140, 0.3);
}
.dlg-portrait {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--violet);
  flex-shrink: 0;
}
.dlg-info {
  flex: 1;
  min-width: 0;
}
.dlg-nname {
  font-family: "Syne", sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: var(--plum);
}
.dlg-nrole {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}
.dlg-tag {
  background: rgba(105, 64, 140, 0.2);
  border: 1px solid rgba(105, 64, 140, 0.4);
  color: var(--plum);
  font-size: 12px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
.dlg-dots {
  display: flex;
  gap: 4px;
  margin-left: 6px;
}
.dd {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.3s;
}
.dd.on {
  background: var(--violet);
}
.dd.done {
  background: rgba(105, 64, 140, 0.45);
}
.dlg-x {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--muted);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  line-height: 1;
}
.dlg-x:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}
.dlg-body {
  padding: 12px 14px;
  min-height: 48px;
  max-height: 30vh;
  overflow-y: auto;
}
#dlg-txt {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
}
.dlg-foot {
  border-top: 1px solid rgba(105, 64, 140, 0.2);
  padding: 6px 14px;
}
.dlg-hint {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
  animation: blnk 1.2s ease-in-out infinite;
}
@keyframes blnk {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}
.dkey {
  background: rgba(105, 64, 140, 0.2);
  border: 1px solid rgba(105, 64, 140, 0.4);
  color: var(--plum);
  font-size: 12px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Popup héros */
#hero-popup {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(5, 5, 18, 0.88);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
  padding: 16px;
}
#hero-popup.show {
  opacity: 1;
  pointer-events: all;
}
.pop-card {
  background: var(--panel);
  border: 2px solid var(--violet);
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes popIn {
  from {
    transform: scale(0.82) translateY(20px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}
.pop-head {
  background: linear-gradient(135deg, var(--violet), var(--v2));
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}
.pop-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  border: none;
  color: #fff;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  line-height: 1;
}
.pop-close:hover {
  background: rgba(255, 255, 255, 0.35);
}
.pop-close:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 2px;
}
.pop-portrait {
  width: 56px;
  height: 70px;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
}
.pop-head h2 {
  font-family: "Syne", sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
}
.pop-head p {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 3px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.pop-body {
  padding: 16px 18px;
}
.pills {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.pill {
  padding: 4px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 800;
}
.pv {
  background: rgba(105, 64, 140, 0.2);
  border: 1px solid rgba(105, 64, 140, 0.4);
  color: var(--plum);
}
.py {
  background: rgba(255, 204, 82, 0.15);
  border: 1px solid rgba(255, 204, 82, 0.4);
  color: var(--yellow);
}
.pb {
  background: rgba(64, 107, 222, 0.15);
  border: 1px solid rgba(64, 107, 222, 0.4);
  color: #b0bff0;
}
.pop-bio {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  border-left: 3px solid var(--violet);
  padding-left: 12px;
  margin-bottom: 14px;
}
.pop-bio strong {
  color: var(--text);
}
.pop-xp-lbl {
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
}
.pop-xp-lbl span {
  color: var(--yellow);
}
.xp-track {
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 16px;
}
.xp-bar-inner {
  height: 100%;
  background: linear-gradient(90deg, var(--violet), var(--pink));
  width: 0%;
  border-radius: 5px;
  transition: width 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s;
}
.xp-bar-inner.go {
  width: 52%;
}
.pop-btns {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  font-family: "Nunito", sans-serif;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-v {
  background: linear-gradient(135deg, var(--violet), var(--v2));
  color: #fff;
  box-shadow: 0 4px 16px rgba(105, 64, 140, 0.4);
}
.btn-v:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(105, 64, 140, 0.6);
}
.btn-g {
  background: rgba(255, 255, 255, 0.06);
  color: #d0c8dd;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.btn-g:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

#flash {
  position: fixed;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 999;
  transition: opacity 0.15s;
}

@keyframes npcFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

/* ===== Mobile large / petite tablette (≥576px) ===== */
@media (min-width: 576px) {
  #screen-pick {
    padding: 24px;
  }
  .game-title {
    font-size: 40px;
  }
  .game-sub {
    font-size: 12px;
    margin-bottom: 28px;
  }
  .cards-row {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: stretch;
    gap: 20px;
  }
  .hero-card {
    max-width: 200px;
  }
  .card-photo {
    height: 190px;
  }
  .pick-hint {
    font-size: 12px;
  }

  #map-overlay {
    padding: 16px 20px;
  }
  .mo-title {
    font-size: 15px;
  }

  .pop-card {
    max-width: 560px;
  }
}

/* ===== Tablette (≥768px) ===== */
@media (min-width: 768px) {
  .game-title {
    font-size: 46px;
  }
  .game-sub {
    margin-bottom: 32px;
    letter-spacing: 4px;
  }
  .cards-row {
    gap: 24px;
  }
  .hero-card {
    max-width: 215px;
  }
  .card-photo {
    height: 215px;
  }
  .card-name {
    font-size: 22px;
  }
  .card-info {
    padding: 14px 16px 18px;
  }

  #map-overlay {
    padding: 18px 24px;
  }
  .mo-title {
    font-size: 16px;
  }
  .mo-badge {
    font-size: 12px;
  }

  #skip-btn {
    top: 14px;
    right: 14px;
  }
  #skip-btn button {
    font-size: 12px;
    padding: 7px 18px;
  }

  .dlg-head {
    padding: 10px 18px;
    gap: 11px;
  }
  .dlg-portrait {
    width: 46px;
    height: 46px;
  }
  .dlg-nname {
    font-size: 14px;
  }
  .dlg-nrole {
    font-size: 12px;
  }
  .dlg-tag {
    font-size: 12px;
    padding: 4px 11px;
  }
  .dlg-body {
    padding: 13px 18px;
    min-height: 52px;
  }
  #dlg-txt {
    font-size: 14px;
    line-height: 1.7;
  }
  .dlg-foot {
    padding: 7px 18px;
  }
  .dlg-hint {
    font-size: 12px;
  }
  .dkey {
    font-size: 12px;
  }

  #dlg {
    bottom: 60px;
    max-height: 50vh;
    overflow-y: auto;
  }
  #dlg-txt {
    font-size: 16px;
    line-height: 1.7;
  }
  #dlg .dlg-body {
    max-height: none;
  }

  .pop-head {
    padding: 18px 22px;
    gap: 16px;
  }
  .pop-portrait {
    width: 68px;
    height: 86px;
  }
  .pop-head h2 {
    font-size: 22px;
  }
  .pop-body {
    padding: 20px 22px;
  }
  .pop-bio {
    font-size: 13px;
    line-height: 1.7;
    padding-left: 14px;
    margin-bottom: 16px;
  }
  .xp-track {
    height: 10px;
  }
  .btn {
    padding: 10px 22px;
  }
}

@media (min-width: 768px) and (orientation: portrait) {
  #dlg {
    bottom: 80px;
    max-height: 45vh;
  }
}

@media (min-width: 768px) and (orientation: landscape) {
  #dlg {
    bottom: 20px;
    max-height: 60vh;
  }
}

/* ===== Desktop (≥1024px) ===== */
@media (min-width: 1024px) {
  #screen-pick {
    padding: 32px;
  }
  .game-title {
    font-size: 50px;
  }
  .ft-badge {
    margin-bottom: 22px;
  }
  .game-sub {
    margin-bottom: 42px;
  }
  .cards-row {
    gap: 28px;
    margin-bottom: 32px;
  }
  .hero-card:hover {
    transform: translateY(-10px) scale(1.04);
    box-shadow: 0 24px 60px rgba(105, 64, 140, 0.55);
  }

  .pop-card {
    max-width: 640px;
  }
}

/* ── Lien mentions légales ── */
.rgpd-link {
  display: inline-block;
  margin-top: 24px;
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid rgba(169, 155, 191, 0.3);
  transition: color 0.2s, border-color 0.2s;
}
.rgpd-link:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}
.rgpd-link:focus-visible {
  outline: 3px solid var(--yellow);
  outline-offset: 3px;
  border-radius: 2px;
}
