/* Notification de fin de niveau (style borne d'arcade). */
/* ============================================================
   NOTIFICATION VICTOIRE ARCADE (TOASTER DE FIN DE NIVEAU)
   ============================================================ */
#winToasts {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
  z-index: 30;
  transition: opacity .25s cubic-bezier(.16, 1, .3, 1), transform .25s cubic-bezier(.16, 1, .3, 1);
}
#winToasts.ghosted {
  opacity: 0.16;
}
#winToasts.ghosted:hover {
  opacity: 0.95;
}
.winToast {
  --win-accent: #5fd6a8;
  --win-glow: rgba(95, 214, 168, 0.4);
  --win-bg: rgba(14, 17, 26, 0.96);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 275px;
  max-width: 375px;
  padding: 12px 16px 14px 14px;
  background: var(--win-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 2px solid var(--win-accent);
  border-radius: 16px 6px 16px 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 24px var(--win-glow), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  color: var(--text);
  font-family: inherit;
  pointer-events: auto;
  cursor: pointer;
  user-select: none;
  animation: winArcadePop .38s cubic-bezier(.16, 1.25, .3, 1) forwards;
  transition: transform .18s ease, box-shadow .18s ease;
}
.winToast:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.8), 0 0 32px var(--win-glow), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
/* Niveau fini sans medaille : meme carte, mais eteinte (gris, pointilles, aucune lueur ni animation de fete) */
.winToast.no-medal {
  --win-accent: #6f778c;
  --win-glow: rgba(0, 0, 0, 0);
  border-style: dashed;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: winDullPop .55s ease-out forwards;
}
.winToast.no-medal::before { display: none; }
.winToast.no-medal .winCrestSvg { filter: none; opacity: .85; }
.winToast.no-medal .crestRing { animation: none; stroke-opacity: .55; fill-opacity: .12; }
.winToast.no-medal .winTimeBig { color: #b6bccd; text-shadow: none; }
.winToast.no-medal .winSplitChip.pb-gain { background: rgba(141, 150, 173, 0.12); border-color: rgba(141, 150, 173, 0.3); color: #aab2c7; text-shadow: none; }
@keyframes winDullPop {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to { opacity: 1; transform: none; }
}
.winToast.dismissing {
  animation: winArcadeExit .22s cubic-bezier(.4, 0, 1, 1) forwards !important;
}
/* Éclat lumineux diagonal qui balaye le badge à l'apparition */
.winToast::before {
  content: '';
  position: absolute;
  top: -60%;
  left: -60%;
  width: 220%;
  height: 220%;
  background: linear-gradient(70deg, transparent 40%, rgba(255, 255, 255, 0.16) 48%, rgba(255, 255, 255, 0.3) 50%, rgba(255, 255, 255, 0.16) 52%, transparent 60%);
  transform: translateX(-100%);
  animation: winSheen 0.85s cubic-bezier(.2, .8, .2, 1) 0.12s forwards;
  pointer-events: none;
  z-index: 2;
}
@keyframes winSheen {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}
@keyframes winArcadePop {
  0% { transform: translateY(32px) scale(0.86); opacity: 0; }
  70% { transform: translateY(-4px) scale(1.03); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes winArcadeExit {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(18px) scale(0.9); opacity: 0; }
}
/* Sceau / Emblème Arcade à gauche */
.winCrest {
  position: relative;
  flex: none;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.winCrestSvg {
  width: 50px;
  height: 50px;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 2px 8px var(--win-glow));
}
.crestRing {
  animation: crestPulse 2s ease-in-out infinite alternate;
}
@keyframes crestPulse {
  0% { stroke-opacity: 0.55; fill-opacity: 0.10; }
  100% { stroke-opacity: 1; fill-opacity: 0.28; filter: drop-shadow(0 0 5px var(--win-accent)); }
}
/* Corps de la notification */
.winBody {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* Ligne supérieure : Pillule Niveau + Badge Record */
.winTopRow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.winPillWrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.winLvlPill {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  color: var(--muted);
  text-transform: uppercase;
  flex: none;
}
.winLvlName {
  font-size: 11px;
  font-weight: 700;
  color: #c9cedd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Badge Record style borne d'arcade */
.winRecordBadge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 4px;
  background: linear-gradient(135deg, #ffcf6b, #ff9e1f);
  color: #12141c;
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  box-shadow: 0 0 12px rgba(255, 207, 107, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  animation: recordGlow 1.2s ease-in-out infinite alternate;
  flex: none;
}
@keyframes recordGlow {
  0% { transform: scale(0.96); box-shadow: 0 0 6px rgba(255, 207, 107, 0.4); }
  100% { transform: scale(1.04); box-shadow: 0 0 16px rgba(255, 207, 107, 0.85); }
}
/* Ligne centrale : Chrono géant & Label Médaille */
.winMainRow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.winTimeBig {
  font-size: 22px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
  color: #ffffff;
  text-shadow: 0 0 14px var(--win-accent), 0 2px 4px rgba(0, 0, 0, 0.5);
  line-height: 1.1;
}
.winTimeBig small {
  font-size: 13.5px;
  font-weight: 700;
  margin-left: 2px;
  opacity: 0.85;
}
.winMedalLabel {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--win-accent);
  text-shadow: 0 0 8px var(--win-glow);
}
/* Ligne inférieure : Chips Speedrun Split, Objectif, XP */
.winSplitsRow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 3px;
}
.winSplitChip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 5px;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.2;
}
.winSplitChip.pb-gain {
  background: rgba(95, 214, 168, 0.16);
  border: 1px solid rgba(95, 214, 168, 0.42);
  color: #5fd6a8;
  text-shadow: 0 0 6px rgba(95, 214, 168, 0.4);
}
.winSplitChip.pb-same {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #aab0c6;
}
.winSplitChip.next-tier {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
}
.winSplitChip.xp-chip {
  background: rgba(255, 207, 107, 0.14);
  border: 1px solid rgba(255, 207, 107, 0.32);
  color: #ffcf6b;
  font-weight: 900;
}
/* Barre d'énergie à rebours */
.winEnergyBar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 4px;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 99px;
  overflow: hidden;
}
.winEnergyFill {
  height: 100%;
  width: 100%;
  background: var(--win-accent);
  box-shadow: 0 0 6px var(--win-accent);
  transform-origin: left;
  animation: winEnergyDrain linear forwards;
  border-radius: 99px;
}
@keyframes winEnergyDrain {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}
/* Onglet Succes : badges facon Steam, series a paliers */
.achGrid { display:block; }
.achHead { display:flex; align-items:center; gap:14px; margin:2px 0 16px; }
.achSum { flex:none; font-size:13px; color:var(--muted); }
.achSum b { font-size:20px; color:var(--text); font-weight:900; }
.achBar { position:relative; height:6px; border-radius:99px; background:#262a3d; overflow:hidden; flex:1; }
.achBar.big { height:8px; }
.achBar i { position:absolute; inset:0 auto 0 0; border-radius:99px; background:linear-gradient(90deg, #ffcf6b, #ffb020); }
.achSec { margin:18px 0 10px; font-size:11px; font-weight:800; letter-spacing:.12em; text-transform:uppercase; color:var(--muted); }
.achSeries { display:flex; flex-direction:column; gap:8px; }
.achRow { display:flex; align-items:center; gap:16px; padding:10px 14px; border:1px solid var(--line); border-radius:12px; background:var(--panel2); }
.achRow.full { border-color:rgba(127,227,255,.4); }
.achRowInfo { flex:1; min-width:0; }
.achRowHead { display:flex; flex-direction:column; gap:1px; margin-bottom:7px; }
.achRowHead b { font-size:13.5px; }
.achRowHead span { font-size:11.5px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.achRow .achBar { height:5px; }
.achRow.full .achBar i { background:linear-gradient(90deg, #7fe3ff, #3fb8e0); }
.achTiers { flex:none; display:flex; gap:6px; }
.achT { display:flex; flex-direction:column; align-items:center; gap:2px; width:44px; cursor:help; }
.achT .achIcoWrap { width:40px; height:40px; }
.achT span { font-size:10.5px; font-weight:700; color:var(--muted); font-variant-numeric:tabular-nums; }
.achT.on span { color:var(--text); }
.achT .achIcoWrap.off::after { width:14px; height:14px; background-size:9px; }
@media (max-width:560px) { .achRow { flex-direction:column; align-items:stretch; } .achTiers { justify-content:space-between; } }
.achIcoWrap { display:block; width:60px; height:60px; position:relative; }
.achIcoWrap svg { display:block; width:100%; height:100%; }
.achIcoWrap.off svg { filter:grayscale(1) brightness(.42); }
.achIcoWrap.off::after { content:''; position:absolute; right:-2px; bottom:-2px; width:18px; height:18px; border-radius:50%; background:#0b0c11 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3' stroke='%23c9cedd' stroke-width='2.4' fill='none'/%3E%3Crect x='6' y='11' width='12' height='9' rx='2' fill='%23c9cedd'/%3E%3C/svg%3E") center / 12px no-repeat; }
.achCards { display:grid; grid-template-columns:repeat(auto-fill, minmax(230px, 1fr)); gap:10px; }
.achCard { display:flex; align-items:center; gap:12px; padding:10px 12px; border:1px solid var(--line); border-radius:12px; background:var(--panel2); }
.achCard.on { border-color:rgba(255,207,107,.35); }
.achCard .achIcoWrap { flex:none; width:52px; height:52px; }
.achTxt { min-width:0; }
.achTxt b { display:block; font-size:13px; }
.achTxt span { display:block; font-size:12px; color:var(--muted); line-height:1.35; }
.achTxt small { display:block; margin-top:2px; font-size:11px; color:#6c7391; }
.achCard:not(.on) .achTxt b { color:#8a90ab; }
/* Notification de succes avec son icone */
.toast.withIcon { display:flex; align-items:center; gap:10px; }
.toast .toastIco { flex:none; width:44px; height:44px; display:block; }
.toast .toastIco svg { width:100%; height:100%; display:block; }
.hudBtn, #menuBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line2);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: color .15s, border-color .15s, background .15s, transform .1s, box-shadow .15s;
  user-select: none;
  box-sizing: border-box;
}
.hudBtn[hidden], #menuBtn[hidden] {
  display: none !important;
}
.hudBtn:hover, #menuBtn:hover {
  color: var(--text);
  border-color: rgba(255,255,255,.3);
  background: var(--panel2);
}
.hudBtn:active, #menuBtn:active {
  transform: translateY(1px);
}
.hudIcon {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  transition: transform .15s ease;
}
.hudBtn:hover .hudIcon {
  transform: scale(1.1);
}

#home { position:fixed; inset:0; z-index:1500; overflow:auto; background:var(--bg); }
#home[hidden] { display:none; }

/* Diamant : l'etoile et les eclats scintillent chacun a son tour, un reflet balaie la gemme */
.diaStar { transform-box: fill-box; transform-origin: center; animation: diaTwinkle 1.8s ease-in-out infinite; }
.diaStar.s2 { animation-delay: .45s; } .diaStar.s3 { animation-delay: .9s; } .diaStar.s4 { animation-delay: 1.3s; }
@keyframes diaTwinkle { 0%, 100% { opacity: .15; transform: scale(.3) rotate(0deg); } 50% { opacity: 1; transform: scale(1.3) rotate(45deg); } }
.diaSweep { animation: diaSweep 2.6s ease-in-out infinite; }
@keyframes diaSweep { 0%, 50% { transform: translateX(0); } 100% { transform: translateX(62px); } }
@media (prefers-reduced-motion: reduce) { .diaStar, .diaSweep { animation: none; } }

/* Palier diamant obtenu : halo qui pulse, reflet qui balaie, etincelles */
.achIcoWrap.dia { isolation:isolate; }
.achIcoWrap.dia svg { animation:achGlow 2.4s ease-in-out infinite; border-radius:12px; }
@keyframes achGlow { 0%, 100% { filter:drop-shadow(0 0 2px rgba(127,227,255,.35)); } 50% { filter:drop-shadow(0 0 9px rgba(127,227,255,.85)); } }
.achSweep { position:absolute; inset:5%; border-radius:10px; overflow:hidden; pointer-events:none; }
.achSweep::before { content:''; position:absolute; top:-20%; bottom:-20%; width:35%; left:-60%; transform:skewX(-20deg);
  background:linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent); animation:achSweep 3.2s ease-in-out infinite; }
@keyframes achSweep { 0%, 55% { left:-60%; } 85%, 100% { left:130%; } }
.achSpk { position:absolute; width:9px; height:9px; pointer-events:none; background:#e9fcff; z-index:2;
  clip-path:polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); filter:drop-shadow(0 0 3px #7fe3ff);
  animation:achTwinkle 1.8s ease-in-out infinite; opacity:0; }
.achSpk.s0 { top:-4px; right:-3px; animation-delay:0s; }
.achSpk.s1 { bottom:6px; left:-5px; width:7px; height:7px; animation-delay:.6s; }
.achSpk.s2 { top:30%; right:-7px; width:6px; height:6px; animation-delay:1.2s; }
@keyframes achTwinkle { 0%, 100% { opacity:0; transform:scale(.3) rotate(0deg); } 40% { opacity:1; transform:scale(1) rotate(45deg); } 70% { opacity:0; transform:scale(.4) rotate(90deg); } }
.toast .toastIco.achIcoWrap { position:relative; }
@media (prefers-reduced-motion:reduce) { .achIcoWrap.dia svg, .achSweep::before, .achSpk { animation:none; } .achSpk { opacity:.8; } }
