:root {
    --bg-color: #0a0a12;
    --primary-neon: #ff00ff;
    --secondary-neon: #00ffff;
    --accent-neon: #cc00cc;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-main: 'Outfit', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-color);
    color: white;
    font-family: var(--font-main);
    overflow: hidden;
    height: 100dvh;
    width: 100vw;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-container {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at center, #1a1a2e 0%, #000000 100%);
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    z-index: 10;
}

.screen.active {
    opacity: 1;
    pointer-events: all;
}

/* Typography & Neon Effects */
.neon-text {
    font-size: 4rem;
    font-weight: 900;
    text-transform: uppercase;
    color: white;
    text-shadow:
        0 0 5px var(--primary-neon),
        0 0 10px var(--primary-neon),
        0 0 20px var(--primary-neon),
        0 0 40px var(--accent-neon);
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.2rem;
    letter-spacing: 4px;
    color: var(--secondary-neon);
    opacity: 0.8;
    margin-bottom: 2rem;
}

/* Start Screen */
.mascot-preview {
    position: relative;
    margin: 1rem 0;
    filter: drop-shadow(0 0 15px var(--secondary-neon));
	/*---------------------------------AJOUTER PAR LA SUITE---------------------------------*/
	display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.rules-image {
    max-width: 90%;
    max-height: 33vh;
    /* 1/3 of window height */
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
    display: block;
}

.close-rules-btn {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 30px;
    height: 30px;
    background: var(--secondary-neon);
    color: black;
    border: none;
    border-radius: 50%;
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 0 10px var(--secondary-neon);
    z-index: 10;
}

.close-rules-btn:hover {
    transform: scale(1.1);
    background: white;
}

.floating-mascot {
    width: 150px;
    animation: float 3s ease-in-out infinite;
}

.rules-container {
    display: flex;
    gap: 2rem;
    margin-bottom: 3rem;
}

.timer-bar {
    width: 200px;
    height: 10px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 5px;
    overflow: hidden;
}

#timer-fill {
    width: 100%;
    height: 100%;
    background-color: var(--secondary-neon);
    transition: width 0.1s linear, background-color 0.3s ease;
}

.rule-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--glass-bg);
    padding: 1rem;
    border-radius: 15px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(5px);
}

.rule-item .icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.rule-item p {
    font-size: 0.8rem;
    font-weight: 700;
    color: #ddd;
}

/* Buttons */
.neon-button {
    background: transparent;
    border: 2px solid var(--secondary-neon);
    color: var(--secondary-neon);
    padding: 1rem 3rem;
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: 50px;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow: 0 0 10px var(--secondary-neon);
    transition: all 0.3s ease;
    font-family: var(--font-main);
}

.neon-button:active {
    transform: scale(0.95);
    background: var(--secondary-neon);
    color: black;
    box-shadow: 0 0 20px var(--secondary-neon);
}

/* Game Screen */
#game-screen {
    justify-content: flex-start;
}

.hud {
    width: 100%;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    z-index: 20;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
    pointer-events: none;
}

.stats-container {
    display: flex;
    gap: 2rem;
    width: 100%;
    justify-content: space-between;
    padding: 0 1rem;
}

.stat-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-box .label {
    font-size: 0.8rem;
    color: #aaa;
    letter-spacing: 2px;
}

.stat-box .value {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 0 5px var(--secondary-neon);
}

.timer-bar {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    overflow: hidden;
}

.score-board {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 0 5px var(--secondary-neon);
}

#game-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Mascots */
.mascot {
    position: absolute;
    width: 80px;
    /* Base size, will be adjusted in JS */
    height: 80px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    cursor: pointer;
    transition: transform 0.1s;
    /* filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5)); */
}

.mascot.real {
    filter: drop_shadow(0 0 5px var(--primary-neon));
}

.mascot.decoy {
    /* Decoys will have filters applied inline or via specific classes */
    opacity: 0.8;
}

/* Animations */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.shake {
    animation: shake 0.3s ease-in-out;
}

.vanish {
    transition: transform 0.3s, opacity 0.3s;
    transform: scale(0);
    opacity: 0;
}

/* Countdown Overlay */
#countdown-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.7);
    z-index: 50;
    backdrop-filter: blur(2px);
}

#countdown-overlay.hidden {
    display: none;
}

#countdown-number {
    font-size: 8rem;
    font-weight: 900;
    color: var(--primary-neon);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Game Over */
.final-score {
    margin: 2rem 0;
    display: flex;
    gap: 3rem;
    text-align: center;
}

.score-row {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-row p {
    font-size: 1rem;
    color: #aaa;
    margin-bottom: 0.5rem;
    letter-spacing: 2px;
}

.score-row span {
    font-size: 3rem;
    font-weight: 700;
    color: var(--secondary-neon);
    text-shadow: 0 0 10px var(--secondary-neon);
}
/*---------------------------------AJOUTER PAR LA SUITE---------------------------------*/
.logo-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center; 
    justify-content: center;
    text-align: center;
}

.button-row {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.neon-button img {
    height: 50px; /* Ajustable, selon ta taille d’icône */
    width: auto;
    display: block;
}

/* Save score overlay (Game Over) */
.save-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(4px);
    z-index: 9999;
}

.save-overlay.hidden {
    display: none;
}

.save-card {
    width: min(90vw, 520px);
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 24px;
    padding: 22px 18px;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.12);
}

.save-title {
    text-align: center;
    font-size: 2.2rem;
    margin-bottom: 14px;
    filter: drop-shadow(0 0 12px var(--secondary-neon));
}

.save-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.save-field {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(0,255,255,0.22);
    border-radius: 18px;
    padding: 12px 14px;
    box-shadow: 0 0 12px rgba(0,255,255,0.10);
}

.save-emoji {
    font-size: 1.4rem;
    width: 34px;
    text-align: center;
}

.save-field input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: white;
    font-family: var(--font-main);
    font-size: 1.05rem;
    letter-spacing: 0.5px;
    user-select: text;
}

.save-field input::placeholder {
    color: rgba(255,255,255,0.55);
}

.save-msg {
    min-height: 20px;
    text-align: center;
    font-size: 0.95rem;
    color: rgba(255,255,255,0.75);
    margin-bottom: 10px;
}

.neon-button.small {
    padding: 0.8rem 1.6rem;
    font-size: 1.2rem;
}

.neon-button.ghost {
    border-color: rgba(0,255,255,0.35);
    color: rgba(0,255,255,0.9);
    box-shadow: 0 0 8px rgba(0,255,255,0.18);
}

.toast {
    position: absolute;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(0, 255, 255, 0.35);
    box-shadow: 0 0 18px rgba(0, 255, 255, 0.18);
    color: white;
    font-weight: 700;
    letter-spacing: 1px;
    z-index: 9999;
    max-width: min(92vw, 520px);
    text-align: center;
}

.hidden {
    display: none;
}

/* micro-UX: éviter sélection globale dans popup */
.save-card, .save-card * {
    -webkit-user-select: none;
    user-select: none;
}
.save-field input {
    -webkit-user-select: text;
    user-select: text;
}


/* ============================
   Leaderboard page
   ============================ */

.leaderboard-page {
  overflow: hidden;
}

.leaderboard-wrap {
  width: 100%;
  height: 100%;
  padding: 22px 16px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}

.leaderboard-card {
  width: min(92vw, 720px);
  margin: 0 auto;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 24px;
  padding: 18px 16px;
  box-shadow: 0 0 30px rgba(0, 255, 255, 0.10);
}

.leaderboard-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.leaderboard-cta-title {
  font-size: 1.4rem;
  font-weight: 900;
  text-shadow: 0 0 8px var(--primary-neon);
  margin-bottom: 6px;
}

.leaderboard-cta-desc {
  opacity: 0.85;
  line-height: 1.35;
}

.leaderboard-qr {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-radius: 18px;
  border: 1px solid rgba(0,255,255,0.22);
  background: rgba(0,0,0,0.25);
  box-shadow: 0 0 12px rgba(0,255,255,0.10);
}

.leaderboard-qr-img {
  width: clamp(140px, 18vw, 200px);
  height: clamp(140px, 18vw, 200px);
  object-fit: contain;
  border-radius: 0; /* important */
}

.leaderboard-table-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.leaderboard-table-title {
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 1px;
  text-shadow: 0 0 8px var(--secondary-neon);
}

.leaderboard-table-note {
  font-size: 0.95rem;
  opacity: 0.75;
}

.leaderboard-table-wrap {
  width: 100%;
  overflow: auto;
  border-radius: 18px;
  border: 1px solid rgba(0,255,255,0.18);
  background: rgba(0,0,0,0.22);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 12px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.leaderboard-table th {
  font-size: 0.9rem;
  opacity: 0.85;
  letter-spacing: 1px;
}

.lb-rank { width: 90px; font-weight: 900; }
.lb-name { font-weight: 700; }
.lb-score { font-weight: 900; color: var(--secondary-neon); text-shadow: 0 0 8px rgba(0,255,255,0.35); }

@media (max-width: 520px) {
  .leaderboard-cta { flex-direction: column; align-items: stretch; }
  .leaderboard-qr { align-self: center; }
  .leaderboard-qr-img { width: 160px; height: 160px; }
}