/* ===== LUMO — Le Voyage ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --gold: #ffd166;
  --glass: rgba(14, 9, 38, 0.55);
  --glass-border: rgba(255, 255, 255, 0.13);
  --text: #f4efff;
  --text-dim: rgba(244, 239, 255, 0.62);
}

html, body {
  height: 100%;
  overflow: hidden;
  background: #0a0618;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: 'Fredoka', system-ui, -apple-system, sans-serif;
  color: var(--text);
}

#game {
  position: fixed;
  inset: 0;
  display: block;
  touch-action: none;
}

#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background: radial-gradient(ellipse at 50% 45%, transparent 52%, rgba(2, 0, 12, 0.5) 100%);
}

/* ===== Écrans ===== */
.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
}
.screen.hidden { display: none; }
.veil { background: linear-gradient(180deg, rgba(6, 3, 20, 0.42), rgba(6, 3, 20, 0.6)); }

/* ===== Titre ===== */
#title-logo {
  font-size: clamp(72px, 17vw, 160px);
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
  background: linear-gradient(115deg, #9d7bff 5%, #ff8ad0 45%, #7ce8ff 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 26px rgba(160, 110, 255, 0.55));
  animation: logo-glow 3.2s ease-in-out infinite;
}
@keyframes logo-glow {
  0%, 100% { filter: drop-shadow(0 0 22px rgba(160, 110, 255, 0.45)); }
  50%      { filter: drop-shadow(0 0 44px rgba(255, 138, 208, 0.75)); }
}
.tagline {
  font-size: clamp(16px, 3.4vw, 22px);
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.story {
  margin-top: 10px;
  font-size: clamp(15px, 3vw, 19px);
  line-height: 1.65;
  color: var(--text-dim);
}
.cta {
  margin-top: 26px;
  font-size: clamp(18px, 4vw, 26px);
  font-weight: 600;
  animation: pulse 1.8s ease-in-out infinite;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.45);
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.55; transform: scale(0.975); }
}
.hint-controls {
  font-size: 13px;
  color: var(--text-dim);
}
.credit {
  position: absolute;
  bottom: max(14px, env(safe-area-inset-bottom));
  font-size: 12px;
  color: rgba(244, 239, 255, 0.35);
}

/* ===== Carte des mondes ===== */
.screen-title {
  font-size: clamp(26px, 5.5vw, 40px);
  font-weight: 600;
  text-shadow: 0 0 22px rgba(160, 110, 255, 0.5);
}
#worlds {
  display: flex;
  flex-direction: column;
  gap: 13px;
  width: min(94vw, 740px);
  max-height: 66vh;
  overflow-y: auto;
  touch-action: pan-y;
  padding: 4px;
  scrollbar-width: thin;
}
@media (min-width: 920px) and (min-height: 620px) {
  #worlds { display: grid; grid-template-columns: 1fr 1fr; max-height: 74vh; }
}
.world-card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 15px 18px 17px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 34px rgba(0, 0, 6, 0.4);
}
.world-card.locked { opacity: 0.45; filter: saturate(0.4); }
.world-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.world-name { font-size: clamp(17px, 3.6vw, 21px); font-weight: 600; }
.world-sub  { font-size: 12px; color: var(--text-dim); letter-spacing: 0.1em; text-transform: uppercase; }
.world-strip {
  height: 5px;
  border-radius: 3px;
  margin-bottom: 12px;
  opacity: 0.9;
}
.lvl-row { display: flex; gap: 10px; justify-content: center; }
.lvl-btn {
  flex: 1;
  max-width: 96px;
  min-width: 0;
  padding: 9px 4px 7px;
  border-radius: 15px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.065);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.lvl-btn:not(.locked):hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.13);
  box-shadow: 0 6px 20px rgba(150, 90, 255, 0.3);
}
.lvl-btn .n  { font-size: 21px; font-weight: 700; line-height: 1.1; }
.lvl-btn .nm { font-size: 10px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.lvl-btn .st { font-size: 11px; letter-spacing: 2px; color: var(--gold); }
.lvl-btn .st .off { color: rgba(255, 255, 255, 0.22); }
.lvl-btn.locked { cursor: default; opacity: 0.42; }
/* nœud BOSS : teinte danger + halo orageux */
.lvl-btn.boss {
  border-color: rgba(255, 95, 143, 0.55);
  background: linear-gradient(180deg, rgba(255, 95, 143, 0.16), rgba(120, 40, 80, 0.10));
  box-shadow: 0 0 14px rgba(255, 95, 143, 0.22) inset;
}
.lvl-btn.boss:not(.locked):hover {
  background: linear-gradient(180deg, rgba(255, 95, 143, 0.26), rgba(120, 40, 80, 0.16));
  box-shadow: 0 6px 20px rgba(255, 95, 143, 0.35);
}

/* ===== Pills / boutons ===== */
.pill {
  padding: 7px 15px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}
.pill.gold { color: var(--gold); }

.btn {
  padding: 13px 26px;
  border-radius: 999px;
  border: none;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  background: linear-gradient(135deg, #7c4dff, #ff5fa8);
  box-shadow: 0 7px 26px rgba(150, 80, 255, 0.4);
  transition: transform 0.15s ease, filter 0.15s ease;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.12); }
.btn:active { transform: translateY(0); }
.btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: none;
}
.btn-row { display: flex; gap: 11px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  color: var(--text);
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s ease;
}
.icon-btn:hover { transform: scale(1.08); }
#btn-mute {
  position: fixed;
  top: max(13px, env(safe-area-inset-top));
  right: max(13px, env(safe-area-inset-right));
  z-index: 40;
}
#btn-account {
  position: fixed;
  top: max(13px, env(safe-area-inset-top));
  left: max(13px, env(safe-area-inset-left));
  z-index: 40;
}
#btn-account.hidden { display: none; }
#btn-mute.hidden { display: none; }

/* ===== HUD ===== */
.hud {
  justify-content: flex-start;
  pointer-events: none;
  background: none;
  z-index: 8;
}
.hud-bar {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.hud-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
}
.hud-right {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-right: 52px; /* place pour le bouton mute */
}
.hud .icon-btn { pointer-events: auto; }
#gem-gauge {
  width: 150px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.13);
  overflow: hidden;
}
#gem-gauge.hidden { visibility: hidden; display: block; }
#gem-gauge-fill {
  height: 100%;
  width: 100%;
  border-radius: 3px;
  background: var(--gold);
  transition: width 0.1s linear;
}
#gem-gauge-fill.boost { background: linear-gradient(90deg, #ffb648, #ff7b3f); box-shadow: 0 0 10px rgba(255, 182, 72, 0.8); }
#gem-gauge-fill.slow  { background: linear-gradient(90deg, #7cc8ff, #9d8cff); box-shadow: 0 0 10px rgba(124, 200, 255, 0.8); }
#gem-gauge-fill.inv    { background: linear-gradient(90deg, #fff2b8, #ffd166, #ff9de2, #8ff7ff); box-shadow: 0 0 12px rgba(255, 240, 180, 0.9); }
#gem-gauge-fill.grow   { background: linear-gradient(90deg, #7dff9e, #2ecc71); box-shadow: 0 0 10px rgba(125, 255, 158, 0.8); }
#gem-gauge-fill.shrink { background: linear-gradient(90deg, #e2b8ff, #9d7bff); box-shadow: 0 0 10px rgba(226, 184, 255, 0.8); }
#gem-gauge-fill.magnet { background: linear-gradient(90deg, #ff9de0, #c94fd0); box-shadow: 0 0 10px rgba(255, 157, 224, 0.8); }
#gem-gauge-fill.rocket { background: linear-gradient(90deg, #ffd28a, #ff6a3f); box-shadow: 0 0 10px rgba(255, 170, 100, 0.8); }

/* ===== Panel (fin de stage / épilogue) ===== */
.panel {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 26px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 30px clamp(22px, 6vw, 48px) 30px;
  box-shadow: 0 18px 60px rgba(0, 0, 8, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 13px;
  max-width: min(92vw, 480px);
}
.panel h2 {
  font-size: clamp(24px, 5.6vw, 34px);
  font-weight: 600;
  text-shadow: 0 0 24px rgba(255, 209, 102, 0.55);
}
.panel-sub {
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
#stars-earned { display: flex; gap: 14px; margin: 4px 0 2px; }
#stars-earned .star {
  font-size: 52px;
  color: rgba(255, 255, 255, 0.16);
  transform: scale(0.5) rotate(-20deg);
  transition: all 0.5s cubic-bezier(0.2, 2.2, 0.4, 1);
}
#stars-earned .star.on {
  color: var(--gold);
  transform: scale(1) rotate(0deg);
  text-shadow: 0 0 26px rgba(255, 209, 102, 0.9), 0 0 60px rgba(255, 209, 102, 0.4);
}
#complete-stats p { font-size: 15px; color: var(--text-dim); line-height: 1.7; }
#complete-stats .ok { color: #9effc3; }

/* ===== Toast ===== */
#toast {
  position: fixed;
  top: 13%;
  left: 50%;
  transform: translate(-50%, -8px);
  z-index: 22;
  padding: 11px 26px;
  border-radius: 999px;
  background: rgba(10, 6, 30, 0.68);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  font-size: clamp(15px, 3.4vw, 19px);
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.hidden { display: block; }

/* ===== Aide « maintiens pour avancer » ===== */
#hold-hint {
  position: fixed;
  bottom: 14%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  padding: 10px 22px;
  border-radius: 999px;
  background: rgba(10, 6, 30, 0.6);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-size: clamp(13px, 3vw, 16px);
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  animation: pulse 1.6s ease-in-out infinite;
}
#hold-hint.hidden { display: none; }

/* ===== Invite de rotation (petits écrans en portrait) ===== */
#rotate-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(5, 2, 16, 0.92);
  align-items: center;
  justify-content: center;
  text-align: center;
}
.rotate-inner p {
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
}
.rotate-phone {
  font-size: 64px;
  margin-bottom: 14px;
  display: inline-block;
  animation: rotate-phone 1.8s ease-in-out infinite;
}
@keyframes rotate-phone {
  0%, 25%  { transform: rotate(0deg); }
  60%, 100% { transform: rotate(90deg); }
}
@media (pointer: coarse) and (orientation: portrait) and (max-width: 620px) {
  #rotate-overlay { display: flex; }
}

/* ===== Comptes / classement / pause ===== */
.title-actions { margin-top: 4px; }
.btn-sm { padding: 8px 16px; font-size: 14px; }
.btn-col { flex-direction: column; align-items: stretch; width: min(78vw, 260px); }
.map-top {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Menu pause : au-dessus du HUD */
#pause-screen { z-index: 30; }

/* Formulaires (login / signup) */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
  width: min(84vw, 320px);
}
.field { display: flex; flex-direction: column; gap: 5px; text-align: left; }
.field > span {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  padding-left: 4px;
}
.field input {
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  padding: 12px 15px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--glass-border);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-user-select: text;
  user-select: text;
}
.field input:focus {
  border-color: rgba(157, 123, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.22);
}
.form-error {
  min-height: 18px;
  font-size: 13px;
  color: #ff90ac;
  text-align: center;
}
.panel a { color: var(--gold); text-decoration: none; }
.panel a:hover { text-decoration: underline; }

/* Tableau du classement */
#leaderboard-body { width: min(88vw, 420px); max-height: 56vh; overflow-y: auto; }
.lb-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.lb-table th, .lb-table td { padding: 8px 10px; text-align: left; }
.lb-table th {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--glass-border);
}
.lb-table td { border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.lb-table td.num, .lb-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.lb-rank { color: var(--text-dim); width: 2.2em; }
.lb-table tr.me { color: var(--gold); font-weight: 600; }
.lb-table tr.me .lb-rank { color: var(--gold); }

/* ===== Écrans étroits ===== */
@media (max-width: 520px) {
  .pill { padding: 5px 10px; font-size: 13px; }
  .icon-btn { width: 36px; height: 36px; font-size: 15px; }
  .hud-right { margin-right: 44px; gap: 6px; }
  #gem-gauge { width: 110px; }
  .screen { padding-left: 12px; padding-right: 12px; }
}

/* ===== Pub : porte « Continuer » + lecteur plein écran ===== */
#continue-screen { z-index: 32; }
#continue-screen .panel-sub { text-transform: none; letter-spacing: 0.02em; font-size: 14px; }

#ad-screen {
  z-index: 34;
  background: #05030f;
  gap: 0;
  padding: 0;
}
#ad-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #05030f;
}
#ad-bar {
  position: fixed;
  right: max(13px, env(safe-area-inset-right));
  bottom: max(13px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 10px;
}
#ad-note {
  padding: 7px 15px;
  border-radius: 999px;
  background: rgba(10, 6, 30, 0.68);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
#ad-skip { padding: 9px 20px; font-size: 14px; }
#ad-skip.hidden { display: none; }

/* ===== Page légale autonome (confidentialite.html) =====
   Le jeu verrouille html/body en overflow:hidden + user-select:none ; une page
   de texte long doit au contraire défiler et être sélectionnable. */
html.legal, html.legal body.legal-page {
  height: auto;
  overflow: visible;   /* annule le overflow:hidden du jeu ; le document defile normalement.
                          NE PAS remettre overflow-y:auto ici : sur html ET body cela cree
                          deux conteneurs de defilement imbriques (scroll erratique, piege iOS). */
  user-select: text;
  -webkit-user-select: text;
}
.legal-wrap {
  max-width: min(92vw, 760px);
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 18px max(40px, env(safe-area-inset-bottom));
}
.legal-panel {
  max-width: none;
  align-items: stretch;
  text-align: left;
  gap: 0;
  padding: clamp(22px, 5vw, 40px);
}
.legal-panel h1 {
  font-size: clamp(24px, 5.2vw, 34px);
  font-weight: 600;
  text-shadow: 0 0 24px rgba(255, 209, 102, 0.45);
}
.legal-panel .panel-sub { text-align: left; margin-top: 6px; }
.legal-lead { margin-top: 18px; font-size: 15.5px; line-height: 1.75; color: var(--text); }
.legal-panel h2 {
  margin-top: 28px;
  font-size: clamp(17px, 3.4vw, 20px);
  font-weight: 600;
  color: var(--gold);
}
.legal-panel p, .legal-panel li {
  margin-top: 10px;
  font-size: 14.5px;
  line-height: 1.75;
  color: rgba(244, 239, 255, 0.85);
}
.legal-panel ul { margin: 4px 0 0 20px; }
.legal-panel li { margin-top: 7px; }
.legal-panel a { color: var(--gold); text-decoration: underline; word-break: break-word; }
.legal-panel code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: #cbb8ff;
}
.legal-panel .btn-row { margin-top: 32px; justify-content: flex-start; }
.legal-panel .btn { text-decoration: none; display: inline-block; }

/* Lien discret vers la page légale (écran titre + hub compte) */
.credit a, .legal-link a { color: inherit; text-decoration: underline; }
.credit a:hover, .legal-link a:hover { color: var(--gold); }
.legal-link { margin-top: 4px; font-size: 12px; color: rgba(244, 239, 255, 0.4); }
.legal-panel h3 {
  margin-top: 20px;
  font-size: clamp(15px, 3vw, 17px);
  font-weight: 600;
  color: var(--text);
}
.legal-panel li i { color: var(--text-dim); font-style: normal; font-size: 0.92em; }
