:root {
  --bg-asphalt: #161618;
  --card-bg: #1f1f23;
  --card-border: #2c2c34;
  --yellow-bombing: #f5d90a;
  --cyan-spray: #00e5ff;
  --magenta-alert: #ff2a85;
  --white-chalk: #f2efe9;
  --text-dim: #84848e;
  --green-chrome: #30d158;
  --font-mono: 'Space Mono', monospace;
  --font-sans: 'Inter', sans-serif;
  --font-marker: 'Permanent Marker', cursive;
}

* {
  box-sizing: border-box;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: var(--font-sans);
  background-color: #09090b;
  color: var(--white-chalk);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  margin: 0;
  padding: 10px;
}

.hidden {
  display: none !important;
}

/* ==========================================
   CADRE MOBILE SMARTPHONE (TEXTURE CARNET MAT)
   ========================================== */
#game-container {
  width: 100%;
  max-width: 390px;
  height: min(94vh, 720px);
  background-color: var(--bg-asphalt);
  background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 0);
  background-size: 16px 16px;
  border: 1px solid #26262e;
  border-radius: 28px;
  padding: 14px 16px 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.9);
  position: relative;
  overflow: hidden;
}

/* ==========================================
   ÉCRAN ONBOARDING : STICKER HELLO MY NAME IS
   ========================================== */
#onboarding-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-asphalt);
  background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 0);
  background-size: 16px 16px;
  z-index: 600;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.onboarding-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sticker-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.hello-sticker {
  width: 100%;
  background: #f7f6f0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.75);
  border: 3px solid #e63926;
  transform: rotate(-1.5deg);
}

.sticker-header {
  background: #e63926;
  color: #ffffff;
  text-align: center;
  padding: 12px 10px 10px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sticker-hello {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 2.35rem;
  line-height: 0.95;
  letter-spacing: 3px;
}

.sticker-sub {
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 2.5px;
  margin-top: 4px;
}

.sticker-body {
  padding: 26px 14px;
  background: #f7f6f0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sticker-input {
  width: 100%;
  border: none;
  border-bottom: 2px dashed #bdbcb2;
  background: transparent;
  font-family: var(--font-marker);
  font-size: 2rem;
  color: #141416;
  text-align: center;
  text-transform: uppercase;
  outline: none;
  padding: 4px 2px;
  user-select: text;
  -webkit-user-select: text;
}

.sticker-input::placeholder {
  color: #b4b3a8;
  font-size: 1.45rem;
}

.sticker-footer {
  height: 16px;
  background: #e63926;
}

.blaze-error {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--magenta-alert);
  margin: 0;
  text-align: center;
}

.onboarding-bottom {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.onboarding-hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  text-align: center;
  margin: 0;
  line-height: 1.4;
}

/* ==========================================
   ÉCRAN D'ACCUEIL BLACK BOOK
   ========================================== */
#home-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-asphalt);
  background-image: radial-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 0);
  background-size: 16px 16px;
  z-index: 300;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.home-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.home-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dymo-icon-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--white-chalk);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.9rem;
  cursor: pointer;
}

.dymo-icon-btn:active {
  background: #2a2a32;
}

.tag-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--yellow-bombing);
  border: 1px solid var(--yellow-bombing);
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.game-title {
  font-family: var(--font-mono);
  font-size: 2.4rem;
  line-height: 0.9;
  margin: 0;
  letter-spacing: -1.5px;
  text-transform: uppercase;
}

.game-title .highlight {
  color: var(--yellow-bombing);
  text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.85);
}

.game-subtitle {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 8px;
}

.home-stats-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rank-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rank-icon {
  font-size: 2rem;
}

.rank-text-col {
  flex: 1;
  min-width: 0;
}

.rank-title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--white-chalk);
}

.rank-xp {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--cyan-spray);
}

/* RAIL PLAN DE MÉTRO PARISIEN (ACCUEIL) */
.metro-line-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--cyan-spray);
  border: 1.5px solid var(--cyan-spray);
  color: #111115;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.7rem;
  padding: 3px 7px;
  border-radius: 6px;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
}

.ratp-map-box {
  background: #141417;
  border: 1px solid #282832;
  border-radius: 10px;
  padding: 12px 10px 9px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ratp-rail-wrap {
  position: relative;
  padding-top: 4px;
}

.ratp-rail-base {
  position: absolute;
  top: 10px;
  left: 10%;
  right: 10%;
  height: 6px;
  background: #282832;
  border-radius: 3px;
}

.ratp-rail-active {
  position: absolute;
  top: 10px;
  left: 10%;
  max-width: 80%;
  height: 6px;
  background: var(--cyan-spray);
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.4);
}

.ratp-stations-row {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.ratp-stop {
  width: 20%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.ratp-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #141417;
  border: 3px solid #444450;
  box-sizing: border-box;
  transition: all 0.3s ease;
}

.ratp-stop.reached .ratp-dot {
  background: var(--cyan-spray);
  border-color: #141417;
  box-shadow: 0 0 0 2px var(--cyan-spray);
}

.ratp-stop.current .ratp-dot {
  width: 18px;
  height: 18px;
  margin-top: -2px;
  background: #141417;
  border: 4px solid var(--white-chalk);
  box-shadow: 0 0 0 2.5px var(--cyan-spray);
}

.ratp-stop-name {
  font-family: var(--font-mono);
  font-size: 0.48rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.1;
}

.ratp-stop.reached .ratp-stop-name {
  color: var(--white-chalk);
}

.ratp-stop.current .ratp-stop-name {
  background: var(--cyan-spray);
  color: #111115;
  padding: 2px 4px;
  border-radius: 3px;
}

.metro-next-hint {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  text-align: center;
}

.home-divider {
  height: 1px;
  background: var(--card-border);
}

.home-quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.quick-act-btn {
  background: #26262e;
  border: 1px solid var(--card-border);
  border-radius: 8px;
  padding: 10px 8px;
  color: var(--white-chalk);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  outline: none;
}

.quick-act-btn:active {
  background: #30303a;
  border-color: var(--cyan-spray);
}

.main-cta {
  padding: 16px;
  font-size: 0.85rem;
}

.full-width {
  width: 100%;
}

/* ==========================================
   HEADER MINIMALISTE REIGNS (GLYPHES + FLASH JAUNE / CYAN)
   ========================================== */
#stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 2px 2px 0 2px;
  flex-shrink: 0;
}

.stat-glyph-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
}

.impact-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  background: transparent;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.impact-dot.pos-small {
  background: var(--yellow-bombing);
  border-color: var(--yellow-bombing);
  transform: scale(0.85);
}

.impact-dot.pos-large {
  background: var(--yellow-bombing);
  border-color: var(--yellow-bombing);
  box-shadow: 0 0 8px rgba(245, 217, 10, 0.75);
  transform: scale(1.25);
}

.impact-dot.neg-small {
  background: transparent;
  border-color: var(--cyan-spray);
  transform: scale(0.95);
}

.impact-dot.neg-large {
  background: var(--cyan-spray);
  border-color: var(--cyan-spray);
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.7);
  transform: scale(1.25);
}

.glyph-meter {
  position: relative;
  width: 24px;
  height: 30px;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), filter 0.25s ease;
}

.glyph-bg,
.glyph-fg {
  width: 24px;
  height: 30px;
  display: block;
}

.glyph-bg path,
.glyph-bg rect {
  fill: #282830;
}

.glyph-fill-mask {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 50%;
  overflow: hidden;
  transition: height 0.38s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  align-items: flex-end;
}

.glyph-fg {
  flex-shrink: 0;
}

.glyph-fg path,
.glyph-fg rect {
  fill: var(--white-chalk);
  transition: fill 0.25s ease;
}

.stat-glyph-box.danger .glyph-fg path,
.stat-glyph-box.danger .glyph-fg rect {
  fill: var(--magenta-alert);
}

.stat-glyph-box.delta-pos .glyph-meter {
  transform: scale(1.16);
  filter: drop-shadow(0 0 6px rgba(245, 217, 10, 0.65));
}

.stat-glyph-box.delta-pos .glyph-fg path,
.stat-glyph-box.delta-pos .glyph-fg rect {
  fill: var(--yellow-bombing);
}

.stat-glyph-box.delta-neg .glyph-meter {
  transform: scale(0.92);
  filter: drop-shadow(0 0 6px rgba(0, 229, 255, 0.65));
}

.stat-glyph-box.delta-neg .glyph-fg path,
.stat-glyph-box.delta-neg .glyph-fg rect {
  fill: var(--cyan-spray);
}

.glyph-label {
  font-family: var(--font-mono);
  font-size: 0.46rem;
  letter-spacing: 0.3px;
  color: var(--text-dim);
  white-space: nowrap;
  transition: color 0.25s ease;
}

.stat-glyph-box.delta-pos .glyph-label {
  color: var(--yellow-bombing);
}

.stat-glyph-box.delta-neg .glyph-label {
  color: var(--cyan-spray);
}

/* ==========================================
   TEXTE DE SITUATION (STABILISÉ EN RUN)
   ========================================== */
#narrative-box {
  flex: 1 1 0;
  min-height: 82px;
  max-height: 112px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px 8px;
}

#card-text {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 400;
  line-height: 1.48;
  color: var(--white-chalk);
  margin: 0;
}

/* ==========================================
   CARTE STRICTEMENT CARRÉE 1:1 PLEINE LARGEUR
   ========================================== */
#card-wrapper {
  position: relative;
  width: 100%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  perspective: 1000px;
  margin-bottom: 4px;
}

#card {
  position: relative;
  width: 100%;
  max-width: 344px;
  aspect-ratio: 1 / 1;
  cursor: grab;
  z-index: 2;
  will-change: transform;
  touch-action: none;
  transform-style: preserve-3d;
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#card:active {
  cursor: grabbing;
}

.card-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 20px;
  backface-visibility: hidden;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.7);
  overflow: hidden;
}

.card-front {
  background: var(--card-bg);
  padding: 0;
  display: block;
  transform: rotateY(0deg);
}

.card-visual {
  width: 100%;
  height: 100%;
  display: block;
}

.card-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* BANDEAU DE CHOIX EN SURIMPRESSION */
#stencil-preview {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 16px);
  padding: 10px 14px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.3;
  white-space: normal;
  word-wrap: break-word;
  pointer-events: none;
  z-index: 30;
  background: rgba(18, 18, 22, 0.94);
  color: var(--white-chalk);
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.75);
  transition: opacity 0.08s linear;
}

#stencil-preview.left {
  border: 1.5px solid var(--cyan-spray);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.75), inset 4px 0 0 var(--cyan-spray);
}

#stencil-preview.right {
  border: 1.5px solid var(--yellow-bombing);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.75), inset -4px 0 0 var(--yellow-bombing);
}

/* LIGNE LÉGENDE + CHEVRONS DE SWIPE */
.speaker-row {
  width: 100%;
  max-width: 344px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px;
}

.swipe-chevron {
  background: none;
  border: none;
  padding: 4px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #52525e;
  transition: color 0.18s ease, transform 0.18s ease;
}

.swipe-chevron svg {
  width: 14px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.swipe-chevron.left {
  animation: nudgeLeft 2.8s ease-in-out infinite;
}

.swipe-chevron.right {
  animation: nudgeRight 2.8s ease-in-out infinite;
}

.swipe-chevron.left.active {
  color: var(--cyan-spray);
  transform: translateX(-3px) scale(1.15);
  animation: none;
}

.swipe-chevron.right.active {
  color: var(--yellow-bombing);
  transform: translateX(3px) scale(1.15);
  animation: none;
}

@keyframes nudgeLeft {
  0%, 100% { transform: translateX(0); opacity: 0.45; }
  50% { transform: translateX(-3px); opacity: 0.95; }
}

@keyframes nudgeRight {
  0%, 100% { transform: translateX(0); opacity: 0.45; }
  50% { transform: translateX(3px); opacity: 0.95; }
}

.card-speaker {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 400;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.1;
  min-height: 16px;
}

.card-speaker.has-character {
  color: var(--white-chalk);
}

/* ==========================================
   LIGNE DE STATUT BAS D'ÉCRAN & BANDEAU TICKER
   ========================================== */
#run-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 6px 4px 6px;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.day-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--white-chalk);
}

.best-run-label {
  font-size: 0.68rem;
  color: var(--text-dim);
}

#city-ticker {
  height: 36px;
  min-height: 36px;
  max-height: 36px;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 6px;
  background: #141417;
  border: 1px solid #26262e;
  border-radius: 6px;
  padding: 4px 8px;
  margin-top: 4px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--text-dim);
  white-space: normal;
  word-break: break-word;
}

#ticker-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
}

.ticker-dot {
  color: var(--cyan-spray);
  font-size: 0.55rem;
  flex-shrink: 0;
}

#city-ticker.alert {
  border-color: var(--magenta-alert);
  color: var(--magenta-alert);
}

#city-ticker.alert .ticker-dot {
  color: var(--magenta-alert);
}

/* ==========================================
   DICO CONTEXTUEL SUR LES CARTES
   ========================================== */
.dico-word {
  color: var(--cyan-spray);
  border-bottom: 1px dashed rgba(0, 229, 255, 0.55);
  cursor: pointer;
  padding: 0 2px;
}

.dico-tooltip {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 94%;
  background: #141418;
  border: 1.5px solid var(--cyan-spray);
  border-radius: 12px;
  padding: 10px 12px;
  z-index: 30;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.94);
  text-align: left;
}

.dico-tooltip-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

#dico-tooltip-term {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--cyan-spray);
  text-transform: uppercase;
}

.dico-close-mini {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--white-chalk);
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
}

#dico-tooltip-def {
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--white-chalk);
  margin: 0;
}

/* ==========================================
   VERSO DE CARTE & CARTES HORS-MICRO
   ========================================== */
.card-back {
  background: #141418;
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border: 1px solid rgba(0, 229, 255, 0.35);
  overflow: hidden;
  position: relative;
}

.back-pattern-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(rgba(0, 229, 255, 0.14) 15%, transparent 16%),
                    radial-gradient(rgba(255, 255, 255, 0.05) 15%, transparent 16%);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
  opacity: 0.8;
}

.back-logo-stencil {
  position: relative;
  z-index: 2;
  border: 2px solid var(--yellow-bombing);
  padding: 12px 20px;
  border-radius: 12px;
  background: rgba(18, 18, 22, 0.92);
  box-shadow: 0 0 20px rgba(245, 217, 10, 0.15);
  transform: rotate(-3deg);
}

.back-brand {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--yellow-bombing);
  letter-spacing: 2px;
}

#card.flipped {
  transform: rotateY(180deg) !important;
}

#card.philo-mode .card-front {
  background: #101013;
  border: 1.5px solid rgba(245, 217, 10, 0.65);
  box-shadow: 0 0 28px rgba(245, 217, 10, 0.14);
}

#card.philo-mode .card-visual img {
  filter: contrast(1.18) brightness(0.82) saturate(0.25);
}

#card.philo-mode .card-visual::after {
  content: "HORS MICRO // CARNET";
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 1.5px;
  color: var(--yellow-bombing);
  background: rgba(12, 12, 15, 0.88);
  border: 1px solid rgba(245, 217, 10, 0.5);
  padding: 3px 8px;
  border-radius: 4px;
  pointer-events: none;
}

#narrative-box.philo-narrative #card-text {
  color: var(--yellow-bombing);
  font-style: italic;
}

/* ==========================================
   BOUTONS MODALES & DOCK LOWER
   ========================================== */
.dymo-btn {
  padding: 12px 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  transition: transform 0.1s;
}

.dymo-btn:active {
  transform: scale(0.96);
}

.dymo-btn.left {
  background-color: rgba(255, 42, 133, 0.12);
  color: var(--magenta-alert);
  border: 1px solid rgba(255, 42, 133, 0.45);
}

.dymo-btn.right {
  background-color: rgba(48, 209, 88, 0.12);
  color: var(--green-chrome);
  border: 1px solid rgba(48, 209, 88, 0.4);
}

#dock {
  display: flex;
  justify-content: space-around;
  background: #141418;
  padding: 5px;
  border-radius: 12px;
  border: 1px solid #24242c;
  flex-shrink: 0;
}

.dock-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 700;
  cursor: pointer;
  padding: 5px 4px;
  border-radius: 8px;
  flex: 1;
}

.dock-btn.active {
  color: var(--yellow-bombing);
  background: #222229;
}

.dock-icon {
  font-size: 0.85rem;
}

/* ==========================================
   MODALES & BLACK BOOK (ARTISTES / CARNET / LEXIQUE)
   ========================================== */
.modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(16, 16, 20, 0.97);
  backdrop-filter: blur(10px);
  z-index: 400;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.modal.sub-modal {
  z-index: 500;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #26262e;
  padding-bottom: 12px;
  flex-shrink: 0;
}

.modal-header h2 {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--yellow-bombing);
  margin: 0;
}

.close-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--white-chalk);
  font-size: 1rem;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
}

.codex-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 10px;
}

.codex-mode-btn {
  background: #18181c;
  border: 1px solid var(--card-border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  padding: 8px 4px;
  border-radius: 8px;
  cursor: pointer;
}

.codex-mode-btn.active {
  background: rgba(0, 229, 255, 0.12);
  color: var(--cyan-spray);
  border-color: var(--cyan-spray);
}

.codex-subview {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 10px 0;
}

.filter-btn {
  background: #1a1a1f;
  border: 1px solid var(--card-border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  padding: 6px 2px;
  border-radius: 6px;
  cursor: pointer;
}

.filter-btn.active {
  background: #25252d;
  color: var(--cyan-spray);
  border-color: var(--cyan-spray);
}

#codex-modal .modal-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* GRILLE POKÉDEX #001–050 */
.grid-container {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-right: 2px;
  padding-bottom: 8px;
}

.artist-card {
  background: #18181c;
  border: 1px solid #282832;
  border-radius: 10px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  opacity: 0.45;
  cursor: not-allowed;
  min-width: 0;
}

.stencil-slot-num {
  font-family: var(--font-marker);
  font-size: 1.35rem;
  letter-spacing: 2px;
  color: rgba(0, 229, 255, 0.25);
  border: 1.5px dashed rgba(0, 229, 255, 0.2);
  padding: 4px 8px;
  border-radius: 4px;
  transform: rotate(-4deg);
  text-shadow: 1px 1px 0px #000000;
}

.artist-card.unlocked {
  opacity: 1;
  background: var(--card-bg);
  border-color: var(--cyan-spray);
  box-shadow: 0 4px 14px rgba(0, 229, 255, 0.14);
  cursor: pointer;
}

.artist-card.unlocked:active {
  transform: scale(0.95);
}

.artist-dex {
  font-family: var(--font-mono);
  font-size: 0.52rem;
  color: var(--text-dim);
  align-self: flex-start;
}

.artist-card.unlocked .artist-dex {
  color: var(--cyan-spray);
}

.artist-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  display: block;
}

.artist-avatar {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  color: #3f3f4a;
  background: #141418;
  border: 1px dashed #2a2a34;
  border-radius: 6px;
}

.artist-name {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  color: var(--text-dim);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}

.artist-card.unlocked .artist-name {
  color: var(--white-chalk);
}

/* PAGE ÉCRITE DU BLACK BOOK (ONGLET CARNET) */
.carnet-page-sheet {
  background-color: var(--white-chalk);
  background-image:
    linear-gradient(to right, rgba(255, 42, 133, 0.32) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(64, 96, 138, 0.14) 1px, transparent 1px);
  background-size: 100% 100%, 100% 22px;
  background-position: 24px 0, 0 0;
  color: #161618;
  border-radius: 8px;
  border: 2px solid #2b2b34;
  padding: 12px 12px 14px 32px;
  margin-top: 10px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.carnet-page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  color: #5c574e;
  border-bottom: 1.5px dashed rgba(24, 24, 29, 0.25);
  padding-bottom: 6px;
}

.carnet-page-head strong {
  color: #161618;
  background: var(--yellow-bombing);
  padding: 1px 6px;
  border-radius: 4px;
}

.carnet-entries-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.carnet-entry {
  border-bottom: 1px solid rgba(24, 24, 29, 0.14);
  padding-bottom: 9px;
}

.carnet-entry:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.carnet-entry.locked {
  opacity: 0.52;
}

.carnet-entry-title {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  color: #161618;
  letter-spacing: 0.4px;
  margin-bottom: 3px;
}

.carnet-entry-q {
  font-size: 0.72rem;
  line-height: 1.38;
  color: #3d3a34;
  font-style: italic;
  margin: 0 0 5px 0;
}

.carnet-entry-handwritten {
  font-family: var(--font-marker);
  font-size: 0.86rem;
  line-height: 1.25;
  color: #111116;
  transform: rotate(-0.6deg);
  display: inline-block;
  background: rgba(245, 217, 10, 0.55);
  padding: 2px 7px;
  border-radius: 3px;
}

/* LEXIQUE */
.glossary-search-input {
  width: 100%;
  background: #1a1a1f;
  border: 1px solid var(--card-border);
  color: var(--white-chalk);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  padding: 8px 10px;
  border-radius: 8px;
  margin: 10px 0;
  outline: none;
  user-select: text;
  -webkit-user-select: text;
}

.glossary-search-input:focus {
  border-color: var(--cyan-spray);
}

.glossary-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-right: 2px;
}

.glossary-item {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 10px 12px;
}

.glossary-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.glossary-term {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--cyan-spray);
}

.glossary-cat {
  font-family: var(--font-mono);
  font-size: 0.52rem;
  color: var(--text-dim);
  background: #26262e;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.glossary-def {
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--white-chalk);
  margin: 0;
}

/* FICHE ARTISTE : ŒUVRE EN GRAND FORMAT CARRÉ PLEINE LARGEUR */
#artist-detail-modal .modal-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-top: 12px;
}

.artist-detail-card {
  background: var(--card-bg);
  border: 1px solid var(--cyan-spray);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 30px rgba(0, 229, 255, 0.12);
}

.detail-icon {
  width: 100%;
  font-size: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.artist-detail-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  display: block;
}

.rarity-badge {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--cyan-spray);
  border: 1px solid var(--cyan-spray);
  background: rgba(0, 229, 255, 0.08);
  padding: 4px 10px;
  border-radius: 6px;
}

.detail-bio {
  font-size: 0.82rem;
  line-height: 1.42;
  color: var(--white-chalk);
  margin: 0;
  text-align: center;
}

.detail-footer {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-dim);
  border-top: 1px solid var(--card-border);
  padding-top: 8px;
  width: 100%;
  text-align: center;
}

/* ==========================================
   STATISTIQUES DE CARRIÈRE & FINS DÉBLOQUÉES
   ========================================== */
.stats-scroll-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding-right: 2px;
}

.career-stats-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 10px;
}

.c-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  font-size: 0.78rem;
}

.c-stat-row strong {
  font-family: var(--font-mono);
  color: var(--yellow-bombing);
  font-size: 0.82rem;
}

.progress-bar-track {
  width: 100%;
  height: 6px;
  background: var(--card-bg);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--card-border);
}

.progress-bar-fill {
  height: 100%;
  background: var(--cyan-spray);
  transition: width 0.35s ease;
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.35);
}

.endings-section {
  margin-top: 14px;
}

.endings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.endings-header strong {
  color: var(--yellow-bombing);
}

.endings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.ending-badge {
  background: #18181c;
  border: 1px solid #26262e;
  border-radius: 8px;
  padding: 7px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0.45;
}

.ending-badge.unlocked {
  opacity: 1;
  background: var(--card-bg);
  border-color: rgba(245, 217, 10, 0.45);
}

.ending-code {
  font-family: var(--font-mono);
  font-size: 0.52rem;
  color: var(--text-dim);
}

.ending-badge.unlocked .ending-code {
  color: var(--cyan-spray);
}

.ending-title {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-dim);
}

.ending-badge.unlocked .ending-title {
  color: var(--white-chalk);
}

/* ==========================================
   CLASSEMENTS HALL OF FAME (3 ONGLETS)
   ========================================== */
.lb-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 12px 0;
}

.lb-tab-btn {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.58rem;
  font-weight: 700;
  padding: 8px 4px;
  border-radius: 8px;
  cursor: pointer;
}

.lb-tab-btn.active {
  background: #25252d;
  color: var(--cyan-spray);
  border-color: var(--cyan-spray);
}

.leaderboard-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
}

.lb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  padding: 10px 12px;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border: 1px solid var(--card-border);
}

.lb-row.player {
  border-color: var(--yellow-bombing);
  background: #242318;
}

/* ==========================================
   PARAMÈTRES & CRÉDITS
   ========================================== */
.settings-scroll-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.settings-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
}

.setting-divider {
  height: 1px;
  background: var(--card-border);
  margin: 4px 0;
}

.credits-box {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.credits-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--yellow-bombing);
  margin: 0;
  letter-spacing: 1px;
}

.credits-line {
  font-size: 0.74rem;
  line-height: 1.42;
  color: var(--white-chalk);
  margin: 0;
}

.credits-note {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  color: var(--text-dim);
  margin: 2px 0 0 0;
}

.danger-btn {
  background: rgba(255, 42, 133, 0.14) !important;
  color: var(--magenta-alert) !important;
  border: 1px solid var(--magenta-alert) !important;
}

/* ==========================================
   FIN DE RUN & TRANSMISSION DU BLACK BOOK
   ========================================== */
.death-step {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.alias-badge {
  font-family: var(--font-mono);
  color: var(--yellow-bombing);
  font-weight: 700;
  font-size: 1rem;
  margin-top: 10px;
}

.death-text {
  font-size: 0.9rem;
  margin: 14px 0;
  line-height: 1.4;
}

.run-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.run-stat-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 10px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-num {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--yellow-bombing);
}

.stat-lbl {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--text-dim);
  margin-top: 2px;
}

.record-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--yellow-bombing);
  background: rgba(245, 217, 10, 0.12);
  border: 1px dashed var(--yellow-bombing);
  padding: 8px;
  border-radius: 8px;
  margin-bottom: 10px;
}

.xp-gain {
  font-family: var(--font-mono);
  color: var(--green-chrome);
  font-weight: 700;
  margin-bottom: 12px;
}

.death-metro-box {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.death-metro-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--cyan-spray);
}

.releve-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 24px;
  padding: 20px 0;
}

.black-book-cover {
  width: 100%;
  background: var(--card-bg);
  border: 2px solid var(--yellow-bombing);
  border-radius: 16px;
  padding: 30px 20px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(245, 217, 10, 0.15);
}

.bb-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
}

.releve-title {
  font-family: var(--font-mono);
  color: var(--white-chalk);
  font-size: 0.95rem;
  margin: 0;
  letter-spacing: 1px;
}

.releve-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin: 6px 0 20px 0;
}

.blaze-stamped {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--yellow-bombing);
  border: 2px dashed var(--yellow-bombing);
  padding: 8px 16px;
  border-radius: 8px;
  display: inline-block;
  background: rgba(245, 217, 10, 0.08);
  transform: rotate(-2deg);
}

/* ==========================================
   PLEIN ÉCRAN NATIF SMARTPHONE & SAFE AREAS
   ========================================== */
@media (max-width: 480px) {
  body {
    padding: 0;
    min-height: 100dvh;
    background-color: var(--bg-asphalt);
  }

  #game-container {
    max-width: 100%;
    height: 100dvh;
    border: none;
    border-radius: 0;
    padding-top: max(14px, env(safe-area-inset-top));
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    box-shadow: none;
  }

  #onboarding-screen,
  #home-screen,
  .modal {
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}