* { box-sizing: border-box; }

:root {
  --bg: #050a14;
  --bg2: #081120;
  --panel: rgba(10, 20, 38, 0.72);
  --panel-border: rgba(56, 226, 255, 0.28);
  --cyan: #2de3ff;
  --cyan-soft: rgba(45, 227, 255, 0.5);
  --magenta: #ff2e88;
  --gold: #ffd166;
  --text: #eaf6ff;
  --muted: #6f8ba8;
  --danger: #ff2e88;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Rajdhani', system-ui, sans-serif;
  height: 100%;
  overflow: hidden;
}

body {
  background:
    radial-gradient(ellipse at 20% 10%, rgba(45,227,255,0.10), transparent 55%),
    radial-gradient(ellipse at 85% 90%, rgba(255,46,136,0.08), transparent 55%),
    var(--bg);
}

h1, h2 { font-family: 'Orbitron', sans-serif; letter-spacing: 1px; }

.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,0.015) 0px,
    rgba(255,255,255,0.015) 1px,
    transparent 2px,
    transparent 3px
  );
  mix-blend-mode: overlay;
}

.screen {
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hidden { display: none !important; }

.panel {
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 34px 38px;
  width: min(440px, 90vw);
  text-align: center;
  box-shadow: 0 0 0 1px rgba(45,227,255,0.06), 0 0 40px rgba(45,227,255,0.12), 0 20px 60px rgba(0,0,0,0.55);
  position: relative;
}
.panel.wide { width: min(560px, 92vw); }

.panel::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px; right: -1px; bottom: -1px;
  border-radius: 4px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(45,227,255,0.5), transparent 30%, transparent 70%, rgba(255,46,136,0.35));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.panel h1 {
  margin: 0 0 6px;
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
  text-shadow: 0 0 18px rgba(45,227,255,0.55);
}
.panel h1 span { color: var(--cyan); }
.panel h2 { margin: 0 0 10px; font-size: 22px; text-shadow: 0 0 14px rgba(45,227,255,0.4); }
.sub { color: var(--muted); font-size: 14px; margin-bottom: 20px; line-height: 1.5; }
.hint { color: var(--muted); font-size: 12px; margin-top: 12px; }

label {
  display: block;
  text-align: left;
  font-size: 12px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 5px;
}

input {
  width: 100%;
  padding: 11px 13px;
  border-radius: 3px;
  border: 1px solid rgba(111,139,168,0.35);
  background: rgba(3, 8, 16, 0.7);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan), 0 0 16px rgba(45,227,255,0.35);
}

.row { display: flex; gap: 10px; }
.row input { margin-bottom: 0; flex: 1; min-width: 0; }
.row.code-row input { text-align: center; letter-spacing: 3px; min-width: 92px; }
.row.code-row button { flex: 0 0 auto; }
@media (max-width: 480px) {
  .row.code-row { flex-wrap: wrap; }
  .row.code-row #createBtn { flex: 1 0 100%; }
}
.row.secondary-row { margin-top: 14px; }

button {
  padding: 11px 18px;
  border-radius: 3px;
  border: 1px solid rgba(111,139,168,0.35);
  background: rgba(20, 32, 52, 0.7);
  color: var(--text);
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.5px;
  white-space: nowrap;
  transition: all 0.15s;
}
button:hover { border-color: var(--cyan); box-shadow: 0 0 14px rgba(45,227,255,0.25); }
button.primary {
  background: linear-gradient(135deg, rgba(45,227,255,0.22), rgba(45,227,255,0.08));
  color: var(--cyan);
  border-color: var(--cyan);
  font-weight: 700;
  width: 100%;
  text-shadow: 0 0 10px rgba(45,227,255,0.6);
}
button.primary:hover { box-shadow: 0 0 20px rgba(45,227,255,0.45); }
button.primary:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
button.ghost {
  flex: 1;
  background: transparent;
  border-color: rgba(111,139,168,0.3);
  color: var(--muted);
  font-size: 13px;
}
button.ghost:hover { color: var(--cyan); }

.tabs { display: flex; gap: 6px; margin-bottom: 20px; border: 1px solid rgba(111,139,168,0.25); border-radius: 3px; padding: 3px; }
.tab { flex: 1; background: transparent; border: none; color: var(--muted); font-size: 13px; letter-spacing: 1px; text-transform: uppercase; }
.tab.active { background: rgba(45,227,255,0.14); color: var(--cyan); text-shadow: 0 0 10px rgba(45,227,255,0.5); }
.tab:hover { box-shadow: none; }

.or { color: var(--muted); font-size: 12px; margin: 16px 0; letter-spacing: 1px; text-transform: uppercase; }

.error { color: var(--magenta); font-size: 13px; min-height: 18px; margin-top: 10px; text-shadow: 0 0 8px rgba(255,46,136,0.5); }

.roomcode {
  font-family: 'Orbitron', sans-serif;
  font-size: 42px;
  letter-spacing: 10px;
  font-weight: 800;
  color: var(--cyan);
  text-shadow: 0 0 24px rgba(45,227,255,0.6);
  margin: 14px 0;
}

.profile-card {
  border: 1px solid rgba(111,139,168,0.25);
  border-radius: 3px;
  padding: 14px;
  margin-bottom: 20px;
  background: rgba(3,8,16,0.4);
}
.profile-name { font-family: 'Orbitron', sans-serif; font-size: 16px; color: var(--text); margin-bottom: 4px; }
.profile-rank { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.rank-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; box-shadow: 0 0 8px currentColor; }
.profile-stats { font-size: 12px; color: var(--muted); }
.profile-row2 { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.profile-coins { font-size: 13px; color: var(--gold); font-weight: 700; text-shadow: 0 0 8px rgba(255,209,102,0.4); }
.profile-class { font-size: 12px; color: var(--cyan); text-transform: uppercase; letter-spacing: 1px; }

.row button.primary { width: auto; flex: 1; }
button.ghost.small { flex: 0; padding: 6px 12px; font-size: 12px; }

.oauth-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; margin: 18px 0 12px; }
.oauth-sep::before, .oauth-sep::after { content: ''; flex: 1; height: 1px; background: rgba(111,139,168,0.25); }
.oauth-row { display: flex; flex-direction: column; gap: 8px; }
.oauth-btn {
  display: block; text-align: center; padding: 10px; border-radius: 3px;
  border: 1px solid rgba(111,139,168,0.35); color: var(--text); text-decoration: none;
  font-weight: 600; font-size: 14px; transition: all 0.15s;
}
.oauth-btn.google:hover { border-color: #fff; box-shadow: 0 0 14px rgba(255,255,255,0.2); }
.oauth-btn.apple:hover { border-color: #fff; box-shadow: 0 0 14px rgba(255,255,255,0.2); }

.queue-status {
  display: flex; align-items: center; justify-content: space-between;
  border: 1px solid rgba(45,227,255,0.35); border-radius: 3px; padding: 10px 14px;
  margin-bottom: 14px; background: rgba(45,227,255,0.06);
}
#queueTimer { font-size: 13px; color: var(--cyan); }

.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin: 16px 0 20px;
}
.class-card {
  border: 1px solid rgba(111,139,168,0.3);
  border-radius: 3px;
  padding: 14px;
  background: rgba(3,8,16,0.4);
  text-align: left;
}
.class-card.selected { border-color: var(--cyan); box-shadow: 0 0 14px rgba(45,227,255,0.25); }
.class-card h3 { margin: 0 0 4px; font-size: 15px; font-family: 'Orbitron', sans-serif; }
.class-card .stats { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.class-card .ult { font-size: 12px; color: var(--gold); margin-bottom: 10px; min-height: 48px; }
.class-card .ult b { color: var(--text); }
.class-card button { width: 100%; font-size: 12px; padding: 8px; }
.class-card button.owned { border-color: var(--cyan); color: var(--cyan); cursor: default; }
.class-card button.equipped { background: rgba(45,227,255,0.18); color: var(--cyan); border-color: var(--cyan); cursor: default; }
.class-card button:disabled { opacity: 0.45; cursor: default; }

.shop-coins { color: var(--gold); font-weight: 700; }
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin: 16px 0 20px;
}
.skin-card {
  border: 1px solid rgba(111,139,168,0.3);
  border-radius: 3px;
  padding: 12px 10px;
  background: rgba(3,8,16,0.4);
  text-align: center;
}
.skin-swatch {
  width: 34px; height: 34px; border-radius: 50%;
  margin: 0 auto 10px;
  box-shadow: 0 0 16px currentColor;
}
.skin-name { font-size: 12px; margin-bottom: 8px; min-height: 30px; }
.skin-card button { width: 100%; font-size: 12px; padding: 8px; }
.skin-card button.owned { border-color: var(--cyan); color: var(--cyan); cursor: default; }
.skin-card button.equipped { background: rgba(45,227,255,0.18); color: var(--cyan); border-color: var(--cyan); cursor: default; }
.skin-card button:disabled { opacity: 0.45; cursor: default; }

.lb-table { width: 100%; border-collapse: collapse; margin: 10px 0 20px; font-size: 14px; }
.lb-table th {
  text-align: left; font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--muted); padding: 6px 8px; border-bottom: 1px solid rgba(111,139,168,0.25);
}
.lb-table td { padding: 7px 8px; border-bottom: 1px solid rgba(111,139,168,0.12); }
.lb-table tr:first-child td { color: var(--gold); }

.elo-result { font-size: 15px; margin: 6px 0 18px; font-weight: 700; }
.elo-result.up { color: var(--cyan); text-shadow: 0 0 10px rgba(45,227,255,0.5); }
.elo-result.down { color: var(--magenta); text-shadow: 0 0 10px rgba(255,46,136,0.5); }

.coins-result { font-size: 14px; color: var(--gold); font-weight: 700; margin-bottom: 18px; }
.quest-result { font-size: 13px; color: var(--gold); font-weight: 700; margin: -10px 0 18px; text-shadow: 0 0 8px rgba(255,209,102,0.5); }

.quest-card {
  border: 1px solid rgba(255,209,102,0.3);
  border-radius: 3px;
  padding: 10px 12px;
  margin-bottom: 16px;
  background: rgba(255,209,102,0.05);
}
.quest-text { font-size: 12px; color: var(--text); margin-bottom: 6px; }
.quest-bar {
  height: 6px; border-radius: 2px; background: rgba(3,8,16,0.6);
  overflow: hidden; border: 1px solid rgba(255,209,102,0.3); margin-bottom: 4px;
}
.quest-fill {
  height: 100%; width: 0%; background: linear-gradient(90deg, rgba(255,209,102,0.6), var(--gold));
  box-shadow: 0 0 8px rgba(255,209,102,0.6); transition: width 0.3s ease;
}
.quest-fill.done { background: linear-gradient(90deg, var(--cyan), #fff); }
.quest-progress { font-size: 11px; color: var(--muted); text-align: right; }

.match-found-title {
  color: var(--cyan);
  text-shadow: 0 0 24px rgba(45,227,255,0.7);
  animation: matchFoundPulse 0.5s ease-in-out infinite alternate;
}
@keyframes matchFoundPulse { from { transform: scale(1); } to { transform: scale(1.06); } }

.streak-banner {
  font-family: 'Orbitron', sans-serif;
  font-size: 22px;
  font-weight: 800;
  margin: -4px 0 10px;
  color: var(--gold);
  text-shadow: 0 0 18px rgba(255,209,102,0.7);
  letter-spacing: 1px;
  animation: streakPop 0.4s ease-out;
}
@keyframes streakPop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.toast-layer {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
.toast {
  font-family: 'Rajdhani', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text);
  background: rgba(6,12,22,0.85);
  border: 1px solid rgba(45,227,255,0.35);
  border-radius: 3px;
  padding: 7px 16px;
  box-shadow: 0 0 14px rgba(45,227,255,0.2);
  animation: toastIn 0.25s ease-out, toastOut 0.4s ease-in 2.1s forwards;
}
.toast.warn { border-color: rgba(255,46,136,0.5); color: var(--magenta); box-shadow: 0 0 14px rgba(255,46,136,0.25); }
.toast.gold { border-color: rgba(255,209,102,0.5); color: var(--gold); box-shadow: 0 0 14px rgba(255,209,102,0.25); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; transform: translateY(-6px); } }

#game {
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}

#hud {
  width: min(1600px, 96vw, 133vh);
  display: flex;
  align-items: center;
  gap: 16px;
}

.hpwrap { flex: 1; }
.hpwrap.right { text-align: right; }
.hpwrap .label { font-family: 'Orbitron', sans-serif; font-size: 12px; color: var(--muted); margin-bottom: 5px; letter-spacing: 1px; }
.hpbar {
  height: 10px;
  border-radius: 2px;
  background: rgba(3,8,16,0.6);
  overflow: hidden;
  border: 1px solid rgba(111,139,168,0.3);
  position: relative;
}
.hpfill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, rgba(45,227,255,0.7), var(--cyan));
  box-shadow: 0 0 10px rgba(45,227,255,0.7);
  transition: width 0.15s linear;
}
.hpfill.opp {
  background: linear-gradient(90deg, var(--magenta), rgba(255,46,136,0.7));
  box-shadow: 0 0 10px rgba(255,46,136,0.7);
  margin-left: auto;
}

.weapon-info { margin-top: 5px; font-size: 12px; color: var(--muted); letter-spacing: 0.5px; }
.weapon-info.right { color: var(--muted); }

.ultwrap { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.ultbar {
  flex: 1; height: 7px; border-radius: 2px; background: rgba(3,8,16,0.6);
  overflow: hidden; border: 1px solid rgba(255,209,102,0.3);
}
.ultfill {
  height: 100%; width: 0%; background: linear-gradient(90deg, rgba(255,209,102,0.6), var(--gold));
  box-shadow: 0 0 8px rgba(255,209,102,0.6); transition: width 0.15s linear;
}
.ultfill.ready { animation: ultpulse 1s ease-in-out infinite; }
.ultfill.active { background: linear-gradient(90deg, var(--cyan), #fff); box-shadow: 0 0 10px rgba(45,227,255,0.8); }
@keyframes ultpulse { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.6); } }
.ult-label { font-size: 11px; color: var(--gold); white-space: nowrap; min-width: 70px; }

.center-hud {
  min-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}


.mode-label {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
  border: 1px solid rgba(111,139,168,0.3);
  border-radius: 2px;
  padding: 3px 10px;
}
.mode-label.tunnel { color: var(--magenta); border-color: rgba(255,46,136,0.4); text-shadow: 0 0 8px rgba(255,46,136,0.4); }
.mode-label.open { color: var(--cyan); border-color: rgba(45,227,255,0.4); text-shadow: 0 0 8px rgba(45,227,255,0.4); }

/* Conteneur du plateau : sert de repere de positionnement au compte a rebours,
   qui se superpose au canvas sans modifier le flux de la page. */
.stage {
  position: relative;
  line-height: 0;
}

canvas {
  background: #030710;
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  box-shadow: 0 0 40px rgba(45,227,255,0.08);
  width: min(1600px, 96vw, 133vh);
  height: auto;
  cursor: crosshair;
}

canvas.hitflash {
  box-shadow: 0 0 0 4px rgba(255,46,136,0.65) inset, 0 0 40px rgba(255,46,136,0.3);
}

.controls-hint {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.5px;
}
