

* { box-sizing: border-box; }

body.page-cosmo-drift {
  margin: 0;
  background: radial-gradient(120% 80% at 50% 0%, #0d1b2a 0%, #080c18 55%, #05060d 100%);
  color: #e2e8f0;
  font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

.page-cosmo-drift #app {
  max-width: 800px;
  margin: 0 auto;
  padding: 28px 24px 40px;
}

.page-cosmo-drift h1 { font-size: 1.6rem; color: #5eead4; margin: 8px 0 12px; text-align: center; }
.page-cosmo-drift h2 { font-size: 1.1rem; color: #2dd4bf; margin: 18px 0 8px; }
.page-cosmo-drift #app a { color: #fcd34d; }
.page-cosmo-drift footer { text-align: center; font-size: 0.82rem; color: #94a3b8; margin-top: 30px; line-height: 1.7; }
.page-cosmo-drift #app footer a { color: #cbd5e1; }

.setup-intro {
  color: #cbd5e1;
  line-height: 1.6;
  font-size: 0.95rem;
  text-align: center;
  margin: 0 auto 18px;
  max-width: 62ch;
}
.message-partie { min-height: 1.2em; text-align: center; color: #fcd34d; font-size: 0.92rem; margin: 10px 0; }
.date-titre { text-align: center; color: #5eead4; margin: 0 0 16px; font-weight: 600; }
.liens-modes { text-align: center; margin: 22px 0 6px; line-height: 1.9; font-size: 0.93rem; }


.cd-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 12px 0 0; }
.cd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 20px;
  border: 0;
  border-radius: 12px;
  background: #0f766e;
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 1rem;
  text-decoration: none;
  cursor: pointer;
}
.page-cosmo-drift #app a.cd-btn, .cd-jeu a.cd-btn { color: #fff; }
.cd-btn.secondaire { background: rgba(255, 255, 255, 0.12); }
.cd-btn-grand { min-height: 56px; padding: 12px 34px; font-size: 1.15rem; }
.cd-btn:focus-visible { outline: 3px solid #fde68a; outline-offset: 2px; }
.cd-btn[hidden] { display: none; }
.cd-btn:disabled { opacity: 0.55; cursor: default; }


.cd-etat { text-align: center; font-size: 1rem; margin: 6px 0; line-height: 1.5; min-height: 1.5em; }
.cd-etat strong { color: #fde68a; }
.cd-info-ok { color: #86efac; text-align: center; font-size: 0.92rem; }

.cd-palmares {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  max-width: 520px; margin: 16px auto; padding: 0; list-style: none;
}
.cd-palmares li {
  padding: 12px 8px; border-radius: 14px; text-align: center;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.82rem; color: #94a3b8; line-height: 1.4;
}
.cd-palmares strong { display: block; font-size: 1.25rem; color: #fde68a; font-variant-numeric: tabular-nums; }

.cd-medailles { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 14px 0; padding: 0; list-style: none; }
.cd-medailles li {
  padding: 8px 14px; border-radius: 999px; font-size: 0.85rem; font-weight: 700;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.12); color: #94a3b8;
}
.cd-medailles li.acquise { color: #0b0d14; border-color: transparent; }
.cd-medailles li.acquise.m1 { background: #d6a06c; }
.cd-medailles li.acquise.m2 { background: #d1d5db; }
.cd-medailles li.acquise.m3 { background: #fbbf24; }

.cd-vitesses { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 14px 0; }
.cd-vitesse {
  display: flex; flex-direction: column; gap: 3px; align-items: center; text-align: center;
  min-height: 92px; padding: 14px 12px; border-radius: 14px;
  border: 2px solid #0f766e; background: #0c1a24; color: #e2e8f0; font: inherit; cursor: pointer;
}
.cd-vitesse strong { font-size: 1.5rem; color: #5eead4; }
.cd-vitesse span { font-size: 0.82rem; color: #cbd5e1; }
.cd-vitesse:hover, .cd-vitesse:focus-visible { background: #10283a; border-color: #5eead4; outline: none; }


.cd-salon { max-width: 480px; margin: 0 auto; padding: 18px; border-radius: 16px; background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); text-align: center; }
.cd-salon[hidden] { display: none; }
.cd-salon-statut { min-height: 1.5em; margin: 0 0 12px; line-height: 1.5; }
.cd-salon-statut.erreur { color: #fca5a5; }

.cd-salon-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.cd-salon-code { display: flex; gap: 8px; }
.cd-salon-code input {
  flex: 1 1 0; min-width: 0; width: 100%; text-align: center; text-transform: uppercase; letter-spacing: 0.2em;
  font: inherit; font-weight: 800; font-size: 1.05rem; padding: 10px; min-height: 48px; border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(0, 0, 0, 0.3); color: #fde68a;
}
.cd-salon-code .cd-btn { flex: 1 1 0; min-width: 0; background: #d97706; }
.cd-code { display: inline-block; font-size: 2rem; font-weight: 900; letter-spacing: 0.25em; color: #fde68a; background: rgba(251, 191, 36, 0.12); padding: 8px 18px 8px 24px; border-radius: 12px; }
.cd-lien-invitation { font-size: 0.85rem; color: #94a3b8; word-break: break-all; margin: 8px 0; }
.cd-liste-pilotes { list-style: none; padding: 0; margin: 14px 0; text-align: left; }
.cd-liste-pilotes li { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); margin-bottom: 6px; overflow: hidden; }
.cd-liste-pilotes .nom { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-liste-pilotes .moi .nom { color: #5eead4; font-weight: 700; }
.cd-etiquette { flex: none; font-size: 0.72rem; padding: 2px 8px; border-radius: 999px; background: rgba(251, 191, 36, 0.18); color: #fcd34d; }
.cd-pseudo-visiteur { text-align: center; color: #94a3b8; font-size: 0.85rem; margin: 0 0 12px; }


.defi-intro {
  margin: 18px 0; padding: 14px 18px; border-radius: 14px;
  background: rgba(20, 184, 166, 0.07); border: 1px solid rgba(255, 255, 255, 0.08);
  line-height: 1.55; font-size: 0.95rem;
}
.defi-intro h2 { margin-top: 0; }
.defi-intro ul { padding-left: 20px; margin: 8px 0 0; }
.defi-intro li { margin: 4px 0; }
.defi-compte { text-align: center; margin: 14px 0 20px; line-height: 1.5; }
.classement-section {
  max-width: 800px; margin: 24px auto 10px; padding: 16px 18px;
  background: rgba(148, 163, 184, 0.09); border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
.classement-section[hidden] { display: none; }
.classement-section h3 { margin: 0 0 10px; text-align: center; color: #5eead4; }
.classement-invite, .classement-lien { text-align: center; font-size: 0.9rem; margin: 10px 0 0; }


.deco-banner.roche-a, .deco-banner.roche-b { width: 26px; height: 14px; border-radius: 3px; background: #b45309; }
.deco-banner.roche-b { background: #92400e; }
.deco-banner.cristal { width: 14px; height: 14px; background: #fde047; transform: rotate(45deg); border-radius: 2px; }




.cd-jeu { display: none; }
body.cd-en-partie { overflow: hidden; }
body.cd-en-partie .cd-jeu {
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0;
  z-index: 2000;               
  background: #05060d;
  color: #e2e8f0;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.cd-hud {
  flex: none;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: max(4px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 4px max(10px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-weight: 700;
  font-size: 0.95rem;
}
.cd-bloc { flex: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cd-bloc strong { color: #fde68a; }
.cd-bloc-score strong { color: #5eead4; font-size: 1.15rem; }
.cd-bloc-record { margin-left: auto; }
.cd-bloc-record strong { color: #fbbf24; }
.cd-lib { color: #94a3b8; font-weight: 600; font-size: 0.82rem; }
.cd-losange { display: inline-block; width: 11px; height: 11px; background: #fde047; transform: rotate(45deg); margin-right: 5px; border-radius: 1px; }
.cd-lecteur { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cd-outils { display: flex; gap: 6px; flex: none; }
.cd-outils button {
  width: 48px; height: 48px; padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.3); border-radius: 12px;
  background: rgba(255, 255, 255, 0.06); color: #fff; font-size: 19px; line-height: 1; cursor: pointer;
}
.cd-outils button[hidden] { display: none; }
.cd-outils button:focus-visible { outline: 3px solid #fde68a; outline-offset: 2px; }


.cd-zone {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 6px 6px max(6px, env(safe-area-inset-bottom));
  touch-action: none;
}
.cd-zone canvas { display: block; border-radius: 10px; box-shadow: 0 0 0 1px rgba(94, 234, 212, 0.25); touch-action: none; }

.cd-frole, .cd-annonce {
  position: absolute; left: 50%; transform: translateX(-50%); z-index: 3;
  margin: 0; padding: 6px 14px; border-radius: 999px; font-weight: 800; white-space: nowrap; pointer-events: none;
}
.cd-frole { bottom: max(14px, env(safe-area-inset-bottom)); font-size: 0.85rem; background: rgba(251, 146, 60, 0.92); color: #1c0f02; }
.cd-annonce { top: 18px; font-size: 1rem; background: rgba(15, 23, 42, 0.92); color: #5eead4; border: 1px solid rgba(94, 234, 212, 0.5); }
.cd-annonce.medaille-1 { color: #d6a06c; border-color: #d6a06c; }
.cd-annonce.medaille-2 { color: #e5e7eb; border-color: #e5e7eb; }
.cd-annonce.medaille-3 { color: #fbbf24; border-color: #fbbf24; }
.cd-frole[hidden], .cd-annonce[hidden] { display: none; }


.cd-pilotes {
  position: absolute; top: 10px; right: 10px; z-index: 3; list-style: none; margin: 0; padding: 8px 10px;
  max-width: 190px; border-radius: 12px; background: rgba(15, 23, 42, 0.88); border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.8rem; pointer-events: none;
}
.cd-pilotes:empty { display: none; }
.cd-pilotes li { display: flex; gap: 8px; justify-content: space-between; padding: 2px 0; }
.cd-pilotes .nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.cd-pilotes .moi .nom { color: #5eead4; font-weight: 700; }
.cd-pilotes .fini { color: #94a3b8; }
.cd-pilotes .pts { flex: none; color: #fde68a; font-variant-numeric: tabular-nums; }

.cd-revoir {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 3;
  min-height: 48px; padding: 8px 18px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.4);
  background: rgba(15, 23, 42, 0.95); color: #fff; font: inherit; font-weight: 700; cursor: pointer;
}
.cd-revoir[hidden] { display: none; }


.cd-voile {
  position: absolute; inset: 0; z-index: 4;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12px; overflow-y: auto;
  background: rgba(5, 6, 13, 0.86);
  -webkit-user-select: text; user-select: text;
}
.cd-voile[hidden] { display: none; }
.cd-carte {
  position: relative;
  max-width: 460px; width: 100%; margin: auto;
  padding: 22px 22px 20px;
  border-radius: 18px;
  background: #0c1622;
  border: 1px solid rgba(94, 234, 212, 0.4);
  text-align: center;
}
.cd-carte h2 { margin: 0 0 8px; font-size: 1.45rem; color: #5eead4; }
.cd-carte p { margin: 6px 0; line-height: 1.5; }
.cd-carte a { color: #fcd34d; }
.cd-sous-titre { color: #cbd5e1; }
.cd-note { font-size: 0.86rem; color: #94a3b8; }
.cd-note:empty { display: none; }
.cd-commandes { list-style: none; padding: 0; margin: 10px 0; font-size: 0.9rem; color: #cbd5e1; line-height: 1.7; }
.cd-commandes kbd {
  display: inline-block; min-width: 1.6em; padding: 1px 6px; border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.08); font: inherit; font-size: 0.85em;
}
.cd-astuce { font-size: 0.86rem; color: #fdba74; }
.cd-erreur-debut { color: #fca5a5; font-size: 0.92rem; min-height: 0; }
.cd-erreur-debut:empty { display: none; }
.cd-jeu.mode-tactile .cd-clavier-seul { display: none; }
.cd-jeu:not(.mode-tactile) .cd-tactile-seul { display: none; }
.cd-fermer {
  position: absolute; top: 4px; right: 4px; width: 48px; height: 48px;
  border: 0; border-radius: 50%; background: none; color: #94a3b8; font-size: 26px; line-height: 1; cursor: pointer;
}
.cd-fermer:hover, .cd-fermer:focus-visible { color: #fff; background: rgba(255, 255, 255, 0.1); outline: none; }


.cd-decompte { background: rgba(5, 6, 13, 0.35); pointer-events: none; align-items: center; overflow: hidden; }
.cd-chiffre { font-size: 7rem; font-weight: 900; color: #fbbf24; line-height: 1; margin: 0; text-shadow: 0 4px 0 rgba(0, 0, 0, 0.5); }

.cd-fin-titre.bien { color: #86efac; }
.cd-fin-titre.perdu { color: #fca5a5; }
.cd-fin-score { font-size: 2.2rem; font-weight: 900; color: #fde68a; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.cd-fin-score small { font-size: 0.95rem; font-weight: 600; color: #cbd5e1; }
.cd-fin-detail { color: #cbd5e1; font-size: 0.92rem; }
.cd-fin-medaille { display: inline-block; margin: 6px 0; padding: 4px 14px; border-radius: 999px; font-weight: 800; font-size: 0.9rem; color: #0b0d14; }
.cd-fin-medaille.m1 { background: #d6a06c; }
.cd-fin-medaille.m2 { background: #d1d5db; }
.cd-fin-medaille.m3 { background: #fbbf24; }
.cd-fin-statut { min-height: 1.3em; font-size: 0.93rem; }
.cd-fin-statut.attente { color: #94a3b8; }
.cd-fin-statut.ok { color: #e2e8f0; }
.cd-fin-statut.erreur { color: #fca5a5; }
.cd-fin-statut strong { color: #fde68a; }
.cd-record { color: #86efac; font-weight: 800; }
.cd-lien-classement { font-weight: 700; }
.cd-invite-compte { display: block; margin: 10px 0 2px; padding: 10px 12px; border-radius: 12px; background: rgba(20, 184, 166, 0.12); border: 1px solid rgba(94, 234, 212, 0.35); }
.cd-carte .partage-score { margin-top: 12px; }

.cd-carte a.cta-ddj-btn { color: #1f1300; font-weight: 800; border-radius: 10px; }
.cd-carte #cta-defi-du-jour { margin: 12px 0 4px; padding: 12px; }

.cd-classement-course { list-style: none; padding: 0; margin: 10px 0; text-align: left; }
.cd-classement-course li { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.05); margin-bottom: 5px; }
.cd-classement-course .rang { flex: none; width: 2.2em; font-weight: 800; color: #fbbf24; }
.cd-classement-course .nom { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-classement-course .moi .nom { color: #5eead4; font-weight: 700; }
.cd-classement-course .pts { flex: none; color: #fde68a; font-variant-numeric: tabular-nums; font-weight: 700; }
.cd-classement-course .attente { color: #94a3b8; font-weight: 400; }

.cd-tourner { background: #05060d; z-index: 6; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.cd-tourner .icone { font-size: 56px; display: block; margin-bottom: 8px; }

@media (max-width: 560px) {
  .cd-hud { gap: 8px; font-size: 0.85rem; }
  .cd-lib { display: none; }
  .cd-bloc-score .cd-lib { display: inline; }
  .cd-bloc-record::before { content: '🏆 '; }
  .cd-palmares { grid-template-columns: 1fr; }
  .cd-pilotes { max-width: 140px; font-size: 0.72rem; }
}
@media (max-width: 380px) {
  .cd-hud { gap: 6px; }
  #btn-plein-ecran { display: none; }
}
@media (max-height: 460px) {
  .cd-carte { padding: 12px 16px; }
  .cd-carte h2 { font-size: 1.15rem; margin-bottom: 4px; }
  .cd-commandes, .cd-astuce { display: none; }
  .cd-chiffre { font-size: 4rem; }
}
