/* MAUZ O SKI - feuille de style (identité MAUZ, plein écran, mobile + ordi) */

:root {
  color-scheme: dark;
  --nuit: #070b07;
  --texte: #eafbea;
  --texte-doux: rgba(234, 251, 234, .65);
  --filet: rgba(234, 251, 234, .16);
  --voile: rgba(7, 11, 7, .72);
  --mau: hsl(125 70% 70%);
  --z: hsl(45 88% 62%);
  --rose: #FF5C8A;
  --rouge: #FF3B30;
  --violet: #A238FF;
  --cyan: #3ECFDA;
  --spotify: #1ED760;
  --police-titre: Anton, Impact, sans-serif;
  --police-texte: 'Space Grotesk', system-ui, sans-serif;
  --police-pixel: VT323, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--nuit);
  color: var(--texte);
  font-family: var(--police-texte);
  font-size: 15px;
  line-height: 1.45;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

button, input, select { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--z); outline-offset: 3px; }

.jeu { position: fixed; inset: 0; }
#canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: pointer; background: #9fd6f7; }

/* ---------- Tableau de bord ---------- */
.hud {
  position: absolute; left: 0; right: 0; top: 0;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 8px;
  padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
  pointer-events: none;
  font-family: var(--police-pixel);
  text-shadow: 0 2px 0 rgba(0, 0, 0, .55), 0 0 6px rgba(0, 0, 0, .35);
}
.hud-g { justify-self: start; }
.hud-c { justify-self: center; text-align: center; max-width: 46vw; }
.hud-d { justify-self: end; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.score { font-size: clamp(30px, 5vw, 44px); line-height: .9; color: #fff; }
.combo { margin-left: 8px; color: var(--z); font-size: .8em; }
.dist { font-size: clamp(17px, 2.4vw, 22px); color: rgba(255, 255, 255, .85); }
.station {
  font: 400 clamp(15px, 2.6vw, 22px) var(--police-titre); letter-spacing: .03em; color: #fff;
  background: rgba(7, 11, 7, .45); border: 1px solid rgba(255, 255, 255, .14); border-radius: 999px;
  padding: 3px 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw;
}
.station small { font: 18px var(--police-pixel); color: var(--z); margin-left: 6px; }
.progres { display: flex; gap: 3px; justify-content: center; margin-top: 6px; }
.progres i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, .25); box-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.progres i.ok { background: var(--mau); }
.progres i.ici { background: var(--z); transform: scale(1.35); }
.vies { font-size: 22px; letter-spacing: 2px; line-height: 1; }
.lettres { display: flex; gap: 3px; }
.lettres b {
  font: 400 17px var(--police-titre); width: 22px; height: 22px; display: grid; place-items: center;
  border-radius: 5px; background: rgba(7, 11, 7, .45); color: rgba(255, 255, 255, .3); text-shadow: none;
}
.lettres b.ok:nth-child(-n+3) { background: var(--mau); color: var(--nuit); }
.lettres b.ok:nth-child(4) { background: var(--z); color: var(--nuit); }
.boutons { display: flex; gap: 6px; pointer-events: auto; }
.boutons button {
  width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 17px;
  background: rgba(7, 11, 7, .5); border: 1px solid rgba(255, 255, 255, .2);
}
.boutons button:hover { border-color: var(--mau); }

/* ---------- Bandeau de messages ---------- */
.bandeau {
  position: absolute; left: 50%; top: 92px; transform: translateX(-50%);
  width: min(560px, calc(100% - 32px));
  display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none;
}
.toast {
  background: var(--voile); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border: 1px solid var(--filet); border-left: 4px solid var(--mau); border-radius: 12px;
  padding: 8px 14px; font-size: clamp(13px, 2.4vw, 16px); text-align: center; text-wrap: balance;
  animation: arrive .35s ease-out both;
}
.toast b { color: var(--z); }
.toast.station-toast { border-left-color: var(--z); }
.toast.station-toast strong { display: block; font: 400 clamp(22px, 5vw, 34px) var(--police-titre); letter-spacing: .03em; line-height: 1.1; color: #fff; }
.toast.diable { border-left-color: var(--rouge); }
.toast.sort { animation: part .4s ease-in both; }
@keyframes arrive { from { opacity: 0; transform: translateY(-12px) scale(.96); } }
@keyframes part { to { opacity: 0; transform: translateY(-10px); } }

.diable-alerte {
  position: absolute; left: max(14px, env(safe-area-inset-left)); top: 50%; transform: translateY(-50%);
  font: 24px var(--police-pixel); color: #fff; background: rgba(160, 20, 10, .75);
  border-radius: 0 999px 999px 0; padding: 4px 14px 4px 10px; pointer-events: none;
  animation: palpite .6s ease-in-out infinite alternate;
}
@keyframes palpite { to { transform: translateY(-50%) scale(1.08); } }

.indice {
  position: absolute; left: 50%; bottom: max(28px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--voile); border: 1px solid var(--filet); border-radius: 999px; padding: 8px 18px;
  font-weight: 700; font-size: clamp(14px, 2.6vw, 17px); white-space: nowrap; pointer-events: none;
  animation: arrive .3s ease-out both;
}
.indice kbd { font: 18px var(--police-pixel); border: 1px solid var(--filet); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; }

/* ---------- Écrans ---------- */
.ecran {
  position: absolute; inset: 0; display: grid; place-items: center; overflow-y: auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(7, 11, 7, .25), rgba(7, 11, 7, .7));
  -webkit-user-select: text; user-select: text;
}
.ecran:empty { display: none; }
.carte {
  width: min(560px, 100%); text-align: center;
  background: var(--voile); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--filet); border-radius: 22px; padding: 18px 18px 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .4);
  animation: arrive .35s ease-out both;
}
.carte.large { width: min(860px, 100%); }
.sur-titre { margin: 0; color: var(--z); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: clamp(11px, 2.4vw, 13px); }
.logo {
  margin: 2px 0 4px; font: 400 clamp(46px, 13vw, 92px) var(--police-titre); line-height: .95; letter-spacing: .01em;
  animation: tangue 3s ease-in-out infinite;
}
.logo .mau { color: var(--mau); } .logo .z { color: var(--z); } .logo .o { color: #fff; font-size: .55em; vertical-align: .35em; margin: 0 .12em; }
.logo .ski { color: #fff; }
@keyframes tangue { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }
.titre { margin: 4px 0 8px; font: 400 clamp(34px, 9vw, 60px) var(--police-titre); line-height: 1; color: var(--mau); }
.titre.z { color: var(--z); }
.titre.phrase { font-size: clamp(24px, 5.4vw, 38px); text-wrap: balance; }
.pitch { margin: 0 0 12px; font-size: clamp(14px, 2.8vw, 17px); text-wrap: balance; }
.regles { list-style: none; margin: 0 auto 14px; padding: 0; display: grid; gap: 6px; max-width: 420px; text-align: left; font-size: clamp(13px, 2.4vw, 15px); }
.regles li { display: flex; gap: 10px; align-items: center; background: rgba(255, 255, 255, .05); border-radius: 10px; padding: 6px 10px; }
.regles .ico { font-size: 22px; width: 28px; text-align: center; flex: none; }
.regles b { color: var(--z); }
.btn {
  font: 400 clamp(22px, 4.4vw, 30px) var(--police-titre); letter-spacing: .04em; text-transform: uppercase;
  color: var(--nuit); background: var(--mau); border: 0; border-radius: 999px; padding: 8px 40px; cursor: pointer;
  box-shadow: 0 0 24px hsl(125 70% 70% / .35); animation: appel 2.4s ease-in-out infinite;
}
.btn:hover { background: var(--z); }
@keyframes appel { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.btn-sec {
  font-weight: 700; font-size: 14px; background: rgba(255, 255, 255, .06); border: 1px solid var(--filet);
  border-radius: 999px; padding: 7px 14px; cursor: pointer; color: var(--texte);
}
.btn-sec:hover { border-color: var(--mau); color: var(--mau); }
.rangee { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.depart { margin-top: 12px; font-size: 14px; color: var(--texte-doux); }
.depart select { margin-left: 6px; background: rgba(255, 255, 255, .08); border: 1px solid var(--filet); border-radius: 8px; padding: 4px 8px; max-width: 70vw; }
.depart select option { background: #111; }
.petit { margin: 10px 0 0; color: var(--texte-doux); font-size: 13px; }
.petit strong { color: var(--z); }
.portrait-astuce { display: none; }
@media (orientation: portrait) and (pointer: coarse) { .portrait-astuce { display: block; } }

.saviez { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .05); font-size: 14px; text-align: left; text-wrap: pretty; }
.saviez b { color: var(--mau); display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px; }

/* Fin de partie */
.chiffres { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 6px 0 4px; }
.chiffres div { background: rgba(255, 255, 255, .06); border-radius: 12px; padding: 8px 4px; }
.chiffres b { display: block; font: 30px/1 var(--police-pixel); color: var(--z); }
.chiffres span { font-size: 12px; color: var(--texte-doux); }
.nouveau-record { color: var(--mau); font-weight: 700; margin: 6px 0 0; animation: appel 1s ease-in-out infinite; }
.envoi { display: flex; gap: 8px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.envoi input {
  width: 13em; background: rgba(255, 255, 255, .08); border: 1px solid var(--filet); border-radius: 999px; padding: 7px 14px;
}
.envoi button { font-weight: 700; background: var(--z); color: var(--nuit); border: 0; border-radius: 999px; padding: 7px 16px; cursor: pointer; }
.envoi button:disabled { opacity: .5; cursor: default; }
.msg-envoi { min-height: 1.4em; margin: 6px 0 0; font-size: 13px; color: var(--texte-doux); }

/* Classement */
.onglets { display: inline-flex; gap: 4px; padding: 3px; border-radius: 999px; background: rgba(255, 255, 255, .06); margin-bottom: 10px; }
.onglets button { border: 0; background: none; border-radius: 999px; padding: 5px 14px; cursor: pointer; font-weight: 700; font-size: 14px; }
.onglets button[aria-pressed="true"] { background: var(--mau); color: var(--nuit); }
.tableau { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; }
.tableau td, .tableau th { padding: 5px 6px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
.tableau th { color: var(--texte-doux); font-weight: 500; font-size: 12px; }
.tableau td:first-child { font-family: var(--police-pixel); font-size: 20px; color: var(--z); width: 2.2em; }
.tableau td.sc { font-family: var(--police-pixel); font-size: 20px; text-align: right; }
.tableau tr.moi td { background: hsl(125 70% 70% / .14); }
.tableau .st { color: var(--texte-doux); font-size: 12px; }
.defile { max-height: min(52vh, 460px); overflow-y: auto; }

/* Carnet de la Maurienne */
.carnet { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; text-align: left; max-height: min(60vh, 560px); overflow-y: auto; padding: 2px; }
.fiche { border-radius: 14px; padding: 10px 12px; background: rgba(255, 255, 255, .06); border: 1px solid var(--filet); font-size: 13px; }
.fiche .num { font: 18px var(--police-pixel); color: var(--z); }
.fiche h3 { margin: 0 0 2px; font: 400 19px var(--police-titre); letter-spacing: .02em; color: #fff; line-height: 1.15; }
.fiche .alt { color: var(--mau); font-weight: 700; font-size: 12px; }
.fiche p { margin: 6px 0 0; text-wrap: pretty; }
.fiche .rep { color: var(--texte-doux); font-size: 12px; margin-top: 4px; }
.fiche.verrou { opacity: .55; border-style: dashed; display: grid; place-items: center; text-align: center; min-height: 110px; }
.fiche.verrou h3 { color: var(--texte-doux); }

/* Pilules de liens (comme les autres jeux MAUZ) */
.pilules { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 14px; }
.pilule {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--filet); color: var(--texte); text-decoration: none; font-size: 12px; font-weight: 500;
}
.pilule .point { width: 7px; height: 7px; border-radius: 50%; background: var(--teinte); }
.pilule:hover { border-color: var(--teinte); }
.mention { margin: 10px 0 0; font-size: 11px; color: var(--texte-doux); }
.mention a { color: var(--mau); }

/* Niveaux façon médailles ESF : la couleur de piste en pastille */
.niveaux { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; max-width: 520px; margin: 0 auto 6px; }
.niv {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px;
  background: rgba(255, 255, 255, .05); border: 2px solid var(--filet); border-radius: 12px;
  padding: 6px 4px 5px; cursor: pointer; color: var(--texte); line-height: 1.1;
}
.niv::before { content: ''; position: absolute; top: 6px; left: 6px; width: 9px; height: 9px; border-radius: 50%; background: var(--piste); box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .55); }
.niv:hover { border-color: var(--texte-doux); }
.niv.choisi { border-color: var(--z); background: rgba(255, 216, 74, .12); }
.niv-ico { font-size: 22px; height: 26px; display: grid; place-items: center; color: var(--z); letter-spacing: -.08em; }
.niv-nom { font-weight: 700; font-size: 13px; }
.niv-piste { font-size: 11px; color: var(--texte-doux); }
.niv-medaille { position: absolute; top: 2px; right: 4px; font-size: 14px; }
.niv-desc { margin: 0 auto 12px; max-width: 460px; font-size: 13px; color: var(--texte-doux); min-height: 2.6em; text-wrap: balance; }
.insigne { display: inline-grid; place-items: center; min-width: 1.5em; height: 1.5em; padding: 0 .25em; margin-right: .35em; border-radius: 999px; background: var(--piste); box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .5); font-size: .8em; color: var(--z); letter-spacing: -.1em; vertical-align: .1em; }
@media (max-width: 420px) {
  .niveaux { grid-template-columns: repeat(2, 1fr); }
}

.noscript { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; }

@media (max-height: 460px) {
  .bandeau { top: auto; bottom: max(8px, env(safe-area-inset-bottom)); width: min(480px, calc(100% - 32px)); }
  .toast { font-size: 12px; padding: 5px 10px; }
  .toast.station-toast strong { font-size: 20px; }
  .indice { bottom: auto; top: 64px; }
  .carte { padding: 12px 14px; }
  .regles { grid-template-columns: 1fr 1fr; max-width: 560px; }
  .logo { font-size: clamp(40px, 10vw, 70px); }
}
@media (max-width: 560px) {
  .hud { grid-template-columns: 1fr auto; }
  .hud-c { grid-column: 1 / -1; grid-row: 2; max-width: 100%; }
  .station { max-width: 90vw; }
  .bandeau { top: 156px; }
  .chiffres b { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
