/* ==========================================================================================
   FULL ICE — styles du client (Emir ICE, 2026-11-04). Noir profond, or, éclats de diamant.
   Téléphone d'abord ; aucune police externe (polices du système).
   ========================================================================================== */
:root {
  --noir: #0a0a0d;
  --noir-2: #121217;
  --noir-3: #1b1b22;
  --or: #d8a934;
  --or-clair: #f0cf72;
  --or-pale: #fff3c4;
  --champagne: #e7d7b1;
  --texte: #f4ecd8;
  --texte-doux: #b9ad94;
  --glace: #cfe8ff;
  --rouge: #ff6b5e;
  --vert: #7fe0a8;
  --rayon: 16px;
  --police: "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  --police-titre: Impact, "HelveticaNeue-CondensedBlack", "Arial Narrow Bold", "Roboto Condensed", "Arial Black", sans-serif;
  --degrade-or: linear-gradient(180deg, #fff6cf 0%, #f6d77c 24%, #e0b23f 52%, #a8761c 78%, #f0cf72 100%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--noir);
  color: var(--texte);
  font-family: var(--police);
  font-size: 16px;
  line-height: 1.45;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

#scene {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
#surete { position: fixed; top: 0; left: 0; width: 0; height: 0; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); pointer-events: none; visibility: hidden; }
.cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- focus visibles ---------- */
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--or-clair); outline-offset: 3px; border-radius: 10px; }

/* ---------- boutons ---------- */
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
.bouton-or {
  min-height: 48px; padding: 12px 26px;
  border: 0; border-radius: 999px;
  background: var(--degrade-or);
  color: #1a1204; font-weight: 800; letter-spacing: .06em;
  box-shadow: 0 0 0 1px rgba(255, 243, 196, .55) inset, 0 8px 28px rgba(216, 169, 52, .35), 0 2px 0 #6e4a0c;
  text-shadow: 0 1px 0 rgba(255, 246, 214, .7);
  position: relative; overflow: hidden;
  transition: transform .12s ease, box-shadow .2s ease;
}
.bouton-or::after {
  content: ""; position: absolute; top: -20%; bottom: -20%; width: 40%; left: -60%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .75), transparent);
  transform: skewX(-18deg);
  animation: reflet 3.4s ease-in-out infinite;
}
.bouton-or:active { transform: translateY(1px) scale(.985); }
.bouton-or.grand { min-height: 60px; font-size: 1.3rem; letter-spacing: .14em; width: 100%; }
.bouton-or[disabled] { filter: grayscale(.6) brightness(.7); cursor: progress; }
@keyframes reflet { 0%, 55% { left: -60%; } 85%, 100% { left: 130%; } }

.bouton-ligne {
  min-height: 48px; padding: 10px 20px;
  border-radius: 999px; border: 1.5px solid rgba(240, 207, 114, .6);
  background: rgba(18, 18, 23, .75); color: var(--or-pale); font-weight: 700; letter-spacing: .03em;
}
.bouton-ligne:active { background: rgba(240, 207, 114, .14); }
.bouton-ligne.petit { min-height: 44px; padding: 8px 16px; font-size: .92rem; }
.bouton-texte { min-height: 44px; padding: 8px 14px; background: none; border: 0; color: var(--champagne); text-decoration: underline; text-underline-offset: 4px; }

.bouton-rond {
  position: fixed; z-index: 30;
  top: calc(env(safe-area-inset-top, 0px) + 10px); right: 12px;
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(10, 10, 13, .82); border: 1px solid rgba(240, 207, 114, .45); color: var(--or-clair);
}
.bouton-rond .son-off { display: none; }
.bouton-rond[aria-pressed="true"] .son-on { display: none; }
.bouton-rond[aria-pressed="true"] .son-off { display: inline; }

/* ---------- écrans superposés ---------- */
.ecran {
  position: fixed; inset: 0; z-index: 10;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(216, 169, 52, .10), transparent 60%),
    linear-gradient(180deg, rgba(6, 6, 9, .55) 0%, rgba(6, 6, 9, .78) 34%, rgba(6, 6, 9, .94) 70%);
  padding: calc(env(safe-area-inset-top, 0px) + 18px) 16px calc(env(safe-area-inset-bottom, 0px) + 28px);
}
.ecran[hidden], .voile-pause[hidden], .toast[hidden] { display: none; }
.colonne { width: 100%; max-width: 460px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }

/* ---------- accueil ---------- */
.marque { margin: 6px 0 0; text-align: center; font-size: .78rem; letter-spacing: .42em; color: var(--champagne); font-weight: 700; }
.marque span { letter-spacing: .12em; font-weight: 400; color: var(--texte-doux); text-transform: lowercase; }
.titre {
  margin: -6px 0 0; text-align: center; line-height: .9;
  font-family: var(--police-titre); font-weight: 900;
  font-size: clamp(3.6rem, 20vw, 6.8rem); letter-spacing: .02em;
  display: flex; justify-content: center; gap: .18em; flex-wrap: wrap;
}
.titre-mot { display: inline-flex; }
.titre-mot span {
  display: inline-block;
  background: linear-gradient(180deg, #fff8dc 0%, #f6d77c 22%, #e0b23f 48%, #8f5f12 72%, #f6d77c 90%, #fff3c4 100%);
  background-size: 100% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #5a3a08) drop-shadow(0 6px 14px rgba(216, 169, 52, .35));
  animation: lettre-flotte 3.6s ease-in-out infinite;
}
.titre-mot.glace span {
  background: linear-gradient(180deg, #ffffff 0%, #e8f5ff 26%, #9ec8ea 50%, #4c6f8f 72%, #dff1ff 92%, #ffffff 100%);
  -webkit-background-clip: text; background-clip: text;
  filter: drop-shadow(0 2px 0 #1d3247) drop-shadow(0 6px 16px rgba(160, 210, 255, .45));
}
.titre-mot span:nth-child(2) { animation-delay: .15s; }
.titre-mot span:nth-child(3) { animation-delay: .3s; }
.titre-mot span:nth-child(4) { animation-delay: .45s; }
.titre-mot.glace span:nth-child(1) { animation-delay: .6s; }
.titre-mot.glace span:nth-child(2) { animation-delay: .75s; }
.titre-mot.glace span:nth-child(3) { animation-delay: .9s; }
@keyframes lettre-flotte { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.accroche { margin: -4px 0 0; text-align: center; color: var(--champagne); font-size: 1.02rem; }
.accroche strong { color: var(--or-pale); }

.bandeau-defi {
  text-align: center; padding: 12px 16px; border-radius: var(--rayon);
  background: linear-gradient(135deg, rgba(58, 44, 14, .94), rgba(16, 24, 36, .94));
  border: 1px solid rgba(240, 207, 114, .55);
  box-shadow: 0 0 30px rgba(216, 169, 52, .18);
}
.bandeau-defi p { margin: 0; }
.defi-titre { font-weight: 800; font-size: 1.05rem; color: var(--or-pale); }
.defi-score { font-family: var(--police-titre); font-size: 2.3rem; line-height: 1.05; color: #fff; letter-spacing: .02em; }
.defi-score small { font-family: var(--police); font-size: .9rem; color: var(--champagne); letter-spacing: .12em; text-transform: uppercase; }
.defi-texte { font-size: .9rem; color: var(--texte-doux); }

.record-direct {
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: "label valeur" "qui valeur"; align-items: center; column-gap: 14px;
  padding: 10px 16px; border-radius: var(--rayon);
  background: rgba(14, 14, 18, .9); border: 1px solid rgba(240, 207, 114, .3);
}
.record-label { grid-area: label; font-size: .7rem; letter-spacing: .24em; text-transform: uppercase; color: var(--texte-doux); }
.record-valeur { grid-area: valeur; justify-self: end; font-family: var(--police-titre); font-size: 2.1rem; line-height: 1.05; color: var(--or-clair); letter-spacing: .02em; white-space: nowrap; }
.record-qui { grid-area: qui; font-size: .9rem; color: var(--champagne); min-height: 1.3em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-valeur.change { animation: record-pop .6s ease; }
@keyframes record-pop { 0% { transform: scale(1); } 40% { transform: scale(1.12); color: #fff; } 100% { transform: scale(1); } }

.carte-lot { text-align: center; padding: 12px 14px; border-radius: var(--rayon); background: rgba(30, 24, 10, .9); border: 1px dashed rgba(240, 207, 114, .5); }
.carte-lot p { margin: 0; }
.lot-label { font-size: .72rem; letter-spacing: .28em; text-transform: uppercase; color: var(--or-clair); }
.lot-texte { font-weight: 800; font-size: 1.1rem; color: #fff; margin-top: 2px !important; }
.lot-fin { font-size: .86rem; color: var(--texte-doux); }

.formulaire { display: flex; flex-direction: column; gap: 10px; }
.champ { display: flex; flex-direction: column; gap: 6px; }
.champ label, .form-pseudo label { font-weight: 700; color: var(--or-pale); font-size: .95rem; }
.champ label small { font-weight: 400; color: var(--texte-doux); }
input[type="text"] {
  width: 100%; min-height: 50px; padding: 10px 16px;
  border-radius: 14px; border: 1.5px solid rgba(231, 215, 177, .35);
  background: rgba(10, 10, 13, .85); color: #fff;
  font-size: 1.12rem; /* 16 px minimum : pas de zoom sur iPhone */
  letter-spacing: .04em;
}
#champ-nom { text-transform: uppercase; font-weight: 800; letter-spacing: .12em; }
input[type="text"]::placeholder { color: rgba(231, 215, 177, .35); }
input[type="text"]:focus-visible { outline: 3px solid var(--or-clair); outline-offset: 1px; border-color: transparent; }
input[aria-invalid="true"] { border-color: var(--rouge); }
.aide { margin: 0; font-size: .84rem; color: var(--texte-doux); }
.aide.erreur { color: var(--rouge); font-weight: 700; }

.regles { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.regles li { display: flex; align-items: center; gap: 12px; font-size: .93rem; color: var(--champagne); padding: 8px 12px; border-radius: 12px; background: rgba(14, 14, 18, .88); }
.pastille { flex: 0 0 22px; height: 22px; border-radius: 50%; position: relative; }
.pastille-serti { background: radial-gradient(circle at 50% 50%, #050505 0 42%, transparent 44%), conic-gradient(from 20deg, #fff3c4, #d8a934, #8a5a12, #f0cf72, #fff3c4); box-shadow: 0 0 12px rgba(240, 207, 114, .7); }
.pastille-noir { background: radial-gradient(circle at 35% 30%, #5b5670, #0b0b10 62%); box-shadow: 0 0 0 2px rgba(255, 107, 94, .65); }
.pastille-arc { background: conic-gradient(#ff5e7e, #ffb84d, #f6f36b, #6bf0a4, #59c6ff, #a77bff, #ff5e7e); box-shadow: 0 0 12px rgba(167, 123, 255, .6); }

.classement h2 { margin: 6px 0 10px; font-size: .8rem; letter-spacing: .34em; text-transform: uppercase; color: var(--or-clair); text-align: center; }
.onglets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px; border-radius: 999px; background: rgba(18, 18, 23, .85); border: 1px solid rgba(240, 207, 114, .2); }
.onglets button { min-height: 44px; border: 0; border-radius: 999px; background: none; color: var(--texte-doux); font-weight: 700; }
.onglets button[aria-selected="true"] { background: var(--degrade-or); color: #1a1204; }
.liste-classement { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; counter-reset: rang; }
.liste-classement li {
  counter-increment: rang;
  display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 12px; background: rgba(14, 14, 18, .9);
}
.liste-classement li::before { content: counter(rang); font-weight: 800; color: var(--texte-doux); text-align: center; }
.liste-classement li:nth-child(1) { background: linear-gradient(90deg, rgba(216, 169, 52, .28), rgba(18, 18, 23, .7)); }
.liste-classement li:nth-child(1)::before { content: "1"; color: #1a1204; background: var(--degrade-or); border-radius: 50%; width: 28px; height: 28px; display: grid; place-items: center; }
.liste-classement li:nth-child(2)::before { color: #e3e9ef; }
.liste-classement li:nth-child(3)::before { color: #f2b49b; }
.liste-classement .qui { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.liste-classement .qui b { color: #fff; }
.liste-classement .qui small { color: var(--texte-doux); margin-left: 6px; letter-spacing: .06em; }
.liste-classement .pts { font-family: var(--police-titre); color: var(--or-clair); font-size: 1.15rem; letter-spacing: .02em; }
.classement-etat { margin: 10px 0 0; text-align: center; font-size: .9rem; color: var(--texte-doux); }
.classement-etat:empty { display: none; }

.pied { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin: 4px 0 0; font-size: .88rem; }
.pied a { color: var(--champagne); min-height: 44px; display: inline-flex; align-items: center; text-underline-offset: 4px; }
.pied a[hidden] { display: none; }

/* ---------- pause ---------- */
.voile-pause { position: fixed; inset: 0; z-index: 20; display: grid; place-content: center; gap: 16px; text-align: center; background: rgba(6, 6, 9, .78); }
.voile-pause p { margin: 0; font-family: var(--police-titre); font-size: 3rem; color: var(--or-clair); letter-spacing: .1em; }

/* ---------- fin ---------- */
.ecran-fin { background: radial-gradient(120% 50% at 50% 12%, rgba(216, 169, 52, .14), transparent 60%), rgba(6, 6, 9, .95); }
.ecran-fin .colonne { gap: 14px; align-items: stretch; }
.fin-pendentif { width: 100%; height: auto; aspect-ratio: 2 / 1; display: block; margin-top: 30px; }
.fin-titre { margin: -10px 0 0; text-align: center; font-family: var(--police-titre); font-weight: 900; line-height: 1; font-size: clamp(2.4rem, 13vw, 3.6rem); letter-spacing: .06em; filter: drop-shadow(0 0 18px rgba(160, 210, 255, .35)); }
.fin-titre #fin-nom { color: var(--or-pale); }
.fin-full { background: linear-gradient(180deg, #ffffff, #bfe3ff 45%, #6c93b5 70%, #eaf6ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.fin-score { text-align: center; display: flex; flex-direction: column; align-items: center; }
.fin-score-valeur {
  font-family: var(--police-titre); font-size: clamp(4rem, 22vw, 6.2rem); line-height: 1; letter-spacing: .02em;
  background: var(--degrade-or); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #5a3a08) drop-shadow(0 0 22px rgba(240, 207, 114, .35));
}
.fin-score-unite { font-size: .8rem; letter-spacing: .42em; text-transform: uppercase; color: var(--champagne); margin-top: 2px; }
.fin-record { margin: 0; text-align: center; font-weight: 700; color: var(--champagne); }
.fin-record.nouveau { color: #fff; font-size: 1.1rem; text-shadow: 0 0 16px rgba(240, 207, 114, .8); animation: record-pop 1s ease 2; }
.fin-stats { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.fin-stats li { padding: 6px 12px; border-radius: 999px; background: rgba(18, 18, 23, .8); border: 1px solid rgba(231, 215, 177, .18); font-size: .86rem; color: var(--champagne); }
.fin-stats li b { color: #fff; }
.fin-rangs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fin-rangs[hidden] { display: none; }
.fin-rangs div { text-align: center; padding: 10px 6px; border-radius: 14px; background: rgba(18, 18, 23, .8); border: 1px solid rgba(240, 207, 114, .3); display: flex; flex-direction: column; }
.fin-rangs span { font-family: var(--police-titre); font-size: 1.9rem; color: var(--or-clair); line-height: 1.1; }
.fin-rangs small { font-size: .78rem; color: var(--texte-doux); }
.fin-statut { margin: 0; text-align: center; font-size: .92rem; color: var(--texte-doux); }
.fin-statut:empty { display: none; }
.fin-statut.ok { color: var(--vert); }
.fin-statut.erreur { color: var(--rouge); font-weight: 700; }
.form-pseudo { display: flex; flex-direction: column; gap: 6px; }
.form-pseudo[hidden] { display: none; }
.form-pseudo .ligne { display: flex; gap: 8px; }
.form-pseudo input { flex: 1; min-width: 0; }
.fin-code { text-align: center; padding: 14px; border-radius: var(--rayon); border: 1.5px solid var(--or-clair); background: linear-gradient(135deg, rgba(216, 169, 52, .2), rgba(18, 18, 23, .9)); }
.fin-code[hidden] { display: none; }
.fin-code p { margin: 0; }
.code-label { font-size: .74rem; letter-spacing: .3em; text-transform: uppercase; color: var(--or-clair); }
.code-valeur { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 2rem; font-weight: 800; letter-spacing: .14em; color: #fff; margin: 4px 0 !important; user-select: all; -webkit-user-select: all; }
.code-aide { font-size: .84rem; color: var(--champagne); margin-bottom: 10px !important; }
/* codes de gagnant gardés (accueil et fin) */
.mes-codes { padding: 12px 14px; border-radius: var(--rayon); border: 1px solid rgba(240, 207, 114, .35); background: rgba(14, 14, 18, .9); display: grid; gap: 8px; }
.mes-codes[hidden] { display: none; }
.mes-codes h2 { margin: 0; font-size: .74rem; letter-spacing: .3em; text-transform: uppercase; color: var(--or-clair); text-align: center; }
.liste-codes { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.liste-codes li { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.liste-codes b { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 1.05rem; letter-spacing: .1em; color: #fff; user-select: all; -webkit-user-select: all; }
.liste-codes small { font-size: .8rem; color: var(--texte-doux); }
.fin-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 4px; }
.fin-actions .grand { grid-column: 1 / -1; }
.apercu-story { width: 46%; max-width: 200px; aspect-ratio: 9 / 16; height: auto; margin: 2px auto 0; border-radius: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, .6), 0 0 0 1px rgba(240, 207, 114, .35); display: block; }
.lien-pendentif {
  display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none;
  padding: 14px 16px; border-radius: var(--rayon); min-height: 44px;
  background: linear-gradient(135deg, #17140c, #2a2110); border: 1px solid rgba(240, 207, 114, .55); color: var(--champagne);
}
.lien-pendentif strong { color: var(--or-clair); font-size: 1.12rem; letter-spacing: .04em; }
.lien-pendentif strong::after { content: " →"; }
#bouton-accueil { align-self: center; }

/* ---------- toast ---------- */
.toast {
  position: fixed; z-index: 40; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 22px); transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 14px;
  background: #f6e4b0; color: #1a1204; font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  animation: toast-entre .25s ease;
  pointer-events: none; /* un message en pleine partie ne doit pas avaler un tap */
}
@keyframes toast-entre { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- ordinateur ---------- */
@media (min-width: 900px) {
  .colonne { max-width: 520px; }
  .ecran { padding-top: 34px; }
  #accueil { background: radial-gradient(60% 70% at 50% 45%, rgba(6, 6, 9, .55), rgba(6, 6, 9, .2) 70%); }
  #accueil .colonne {
    padding: 22px 26px 26px; border-radius: 28px;
    background: linear-gradient(180deg, rgba(12, 11, 15, .93), rgba(8, 8, 11, .96));
    border: 1px solid rgba(240, 207, 114, .22); box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  }
}

/* ---------- mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
