/* Interface du jeu : zoom, barre du haut, pastilles de stats, widget de statut serveur. */
/* Arena Zoom & Theater Mode */
:root { --arena-zoom: 1; }
#stage { position:relative; display:flex; justify-content:center; align-items:center; }
#game { display:block; width:calc(100% * var(--arena-zoom)); max-width:100%; aspect-ratio:5/3; border-radius:10px; background:#262b40; box-shadow:var(--shadow); transition:width 0.15s ease-out; }
.hudZoomWrap { display:inline-flex; align-items:center; }
.hudZoomWrap .hudBtn { border-radius:0; margin-left:-1px; padding:0 8px; }
.hudZoomWrap .hudBtn:first-child { border-top-left-radius:8px; border-bottom-left-radius:8px; margin-left:0; }
.hudZoomWrap .hudBtn:last-child { border-top-right-radius:8px; border-bottom-right-radius:8px; }
.hudZoomVal { font-size:11px; font-weight:700; font-variant-numeric:tabular-nums; min-width:32px; text-align:center; }
.hudBtn.btn-gold { border-color:rgba(255,207,107,.4); color:var(--gold); }
.hudBtn.btn-gold:hover { background:var(--goldBg); border-color:var(--gold); }
.btn-player-mode { border-color:rgba(95,214,168,.5) !important; color:#5fd6a8 !important; }
.btn-player-mode:hover { background:rgba(95,214,168,.12) !important; border-color:#5fd6a8 !important; }
.btn-new-player-mode { border-color:rgba(127,227,255,.5) !important; color:#7fe3ff !important; }
.btn-new-player-mode:hover { background:rgba(127,227,255,.12) !important; border-color:#7fe3ff !important; }

/* ========================================================
   TOP NAVIGATION BAR (Épurée & Minimaliste)
   ======================================================== */
#hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  height: 42px;
  padding: 0 12px;
  background: rgba(22, 25, 36, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
  box-sizing: border-box;
  user-select: none;
}

.nav-col {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-col-left { flex: 0 1 auto; min-width: 0; }
.nav-col-center { flex: 1 1 auto; justify-content: center; gap: 8px; }
.nav-col-right { flex: 0 0 auto; gap: 6px; }

.nav-sep {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 3px;
  flex-shrink: 0;
}

/* Brand Button */
.nav-brand-btn {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  transition: transform .15s ease;
}
.nav-brand-btn:hover { transform: scale(1.05); }
.nav-brand-btn:active { transform: scale(0.97); }
.nav-brand-tag {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 5px;
  font: 900 11px system-ui, sans-serif;
  letter-spacing: 0.05em;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(255, 90, 95, 0.35);
}

/* Level Info */
.nav-level-box {
  display: flex;
  align-items: center;
  min-width: 0;
}
.nav-level-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 260px;
}

/* Minimalist Stat Chips (Pièces, Morts, Chrono) */
.nav-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border-radius: 6px;
  background: rgba(14, 16, 23, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.nav-stat-chip:hover {
  background: rgba(14, 16, 23, 0.9);
  border-color: rgba(255, 255, 255, 0.15);
}
.stat-icon {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  flex-shrink: 0;
}
/* Compteurs : l'icone est un sticker qui deborde a gauche de la pastille, legerement incline */
.nav-stat-chip:has(.stat-sticker) { position: relative; height: 28px; padding-left: 25px; margin-left: 7px; }
.stat-sticker { position: absolute; left: -8px; top: 50%; width: 25px; height: 25px; transform: translateY(-50%) rotate(-8deg); transition: transform .15s; }
.nav-stat-chip:hover .stat-sticker { transform: translateY(-50%) rotate(-14deg) scale(1.08); }
.chip-coins .stat-icon, .chip-coins .stat-val { color: var(--gold); }
.chip-deaths .stat-icon, .chip-deaths .stat-val { color: #ff5a5f; }
.chip-chrono .stat-icon, .chip-chrono .stat-val { color: var(--mint); }
.chip-run[hidden] { display:none; }
.chip-run .stat-val { color:#b7abff; }
.stat-val {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.stat-chrono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
}

/* Right Tools & Actions */
.nav-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.hudBtn.icon-only {
  padding: 0;
  width: 28px;
  height: 28px;
  justify-content: center;
}
.hudBtn.btn-reset {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.16);
  color: var(--text);
  font-weight: 600;
}
.hudBtn.btn-reset:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.35);
}
.hudBtn.btn-menu-main {
  background: rgba(255, 90, 95, 0.12);
  border-color: rgba(255, 90, 95, 0.3);
  color: #fff;
  font-weight: 700;
  padding: 0 10px;
  height: 28px;
}
.hudBtn.btn-menu-main:hover {
  background: var(--accent);
  border-color: var(--accent);
}
.hudBtn.btn-editor {
  border-color: rgba(95, 214, 168, 0.35);
  color: var(--text);
}
.hudBtn.btn-editor:hover {
  border-color: var(--mint);
  color: var(--mint);
  background: rgba(95, 214, 168, 0.12);
}

@media (max-width: 960px) {
  #hud { height: auto; padding: 6px 10px; flex-wrap: wrap; }
  .nav-col-center { order: 3; width: 100%; justify-content: center; margin-top: 4px; }
}

body.arena-theater { overflow:hidden; }
body.arena-theater #app {
  position:fixed; inset:0; width:100vw; height:100vh; max-width:none; margin:0; padding:6px 14px 10px;
  background:var(--bg); z-index:1000; display:flex; flex-direction:column; align-items:center; justify-content:flex-start; gap:6px;
}
body.arena-theater #workspace { width:100%; flex:1; min-height:0; display:flex; justify-content:center; }
body.arena-theater #main { width:100%; height:100%; display:flex; flex-direction:column; align-items:center; min-height:0; }
/* le canvas prend toute la place restante : taille explicite (en `auto` il gardait sa taille de depart), HUD a la meme largeur */
body.arena-theater { --theater-w: min(calc(100vw - 28px), calc((100vh - 122px) * var(--theater-ar, 1.6667))); }
body.arena-theater #hud {
  width:100%; max-width:var(--theater-w);
  margin-bottom:2px; padding:4px 12px;
  flex-shrink:0;
}
body.arena-theater #stage { flex:1; width:100%; height:100%; min-height:0; display:flex; align-items:center; justify-content:center; position:relative; }
body.arena-theater #game {
  width:var(--theater-w); height:auto; max-width:none; max-height:none;
  aspect-ratio:var(--theater-ar, 1.6667); box-shadow:0 16px 50px rgba(0,0,0,0.8);
}
body.arena-theater #side {
  position:fixed; right:14px; top:52px; bottom:14px; width:310px; z-index:1010;
  background:rgba(21,23,31,0.96); backdrop-filter:blur(12px); border:1px solid var(--line2); border-radius:12px;
  padding:12px; box-shadow:-8px 0 30px rgba(0,0,0,0.7); display:none; overflow-y:auto;
}
body.arena-theater.show-side #side { display:flex; }
body.arena-theater #help, body.arena-theater #hint { display:none; }

/* Widget Statut Serveur & Ping (dans un coin) */
.serverStatusWidget {
  position: fixed;
  bottom: 14px;
  left: 14px;
  z-index: 1050;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 20px;
  background: rgba(24, 26, 36, 0.90);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line2);
  color: var(--text);
  font: 12px/1 system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 18px rgba(0,0,0,0.4);
  cursor: pointer;
  user-select: none;
  transition: transform .15s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.serverStatusWidget:hover {
  background: rgba(31, 34, 48, 0.98);
  border-color: rgba(255,255,255,0.25);
  transform: translateY(-1px);
  box-shadow: 0 6px 22px rgba(0,0,0,0.55);
}
.serverStatusWidget:active {
  transform: translateY(0);
}
.serverStatusDot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #ff5a5f;
  box-shadow: 0 0 6px rgba(255, 90, 95, 0.6);
  transition: background .3s, box-shadow .3s;
}
.serverStatusDot.online {
  background: #5fd6a8;
  box-shadow: 0 0 8px rgba(95, 214, 168, 0.85);
}
.serverStatusDot.slow {
  background: #ffcf6b;
  box-shadow: 0 0 8px rgba(255, 207, 107, 0.85);
}
.serverStatusDot.checking {
  background: #ffcf6b;
  box-shadow: 0 0 8px rgba(255, 207, 107, 0.85);
  animation: pulseDot 1s infinite alternate;
}
.serverStatusDot.offline {
  background: #ff5a5f;
  box-shadow: 0 0 8px rgba(255, 90, 95, 0.85);
  animation: pulseDot 1.5s infinite alternate;
}
@keyframes pulseDot {
  0% { opacity: 0.45; }
  100% { opacity: 1; }
}
.serverStatusText {
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
}
.serverStatusPing {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  transition: color .2s, background .2s;
}
.serverStatusPing.good {
  color: #5fd6a8;
  background: rgba(95, 214, 168, 0.14);
}
.serverStatusPing.medium {
  color: #ffcf6b;
  background: rgba(255, 207, 107, 0.14);
}
.serverStatusPing.bad {
  color: #ff5a5f;
  background: rgba(255, 90, 95, 0.14);
}
.hudPing {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
}
