*{
  margin:0;
  padding:0;
  box-sizing:border-box;
}

html,
body{
  width:100%;
  height:100%;
  overflow:hidden;
}

body{
  font-family:'Orbitron', sans-serif;
  background:#050816;
  color:white;
}

.home-screen{
  width:100dvw;
  height:100dvh;
  min-height:100svh;

  display:flex;
  justify-content:center;
  align-items:center;

  position:relative;
  overflow:hidden;

  padding:24px;

  background:
    radial-gradient(circle at top, #11336b 0%, #050816 60%);
}

.background-glow{
  position:absolute;

  width:min(90vw, 600px);
  height:min(90vw, 600px);

  background:#0057ff;
  border-radius:50%;
  filter:blur(140px);
  opacity:0.25;
}

.hero{
  position:relative;
  z-index:2;

  width:100%;
  max-width:720px;

  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;

  text-align:center;
}

.logo{
  width:clamp(130px, 28vw, 240px);
  max-height:32dvh;
  object-fit:contain;

  margin-bottom:clamp(14px, 3vh, 24px);

  filter:drop-shadow(0 0 20px rgba(0,87,255,0.7));
}

h1{
  font-size:clamp(2rem, 8vw, 4.8rem);
  font-weight:900;

  letter-spacing:clamp(2px, 1vw, 7px);

  margin-bottom:clamp(8px, 2vh, 14px);

  text-shadow:
    0 0 10px rgba(255,255,255,0.2),
    0 0 20px rgba(0,87,255,0.5);
}

.subtitle{
  max-width:90vw;

  font-size:clamp(0.75rem, 2.5vw, 1rem);
  opacity:0.7;
  letter-spacing:clamp(1px, 0.5vw, 2px);
}

/* Petits écrans en hauteur */
@media (max-height: 560px){
  .logo{
    width:120px;
    max-height:26dvh;
    margin-bottom:10px;
  }

  h1{
    font-size:2rem;
    margin-bottom:6px;
  }

  .subtitle{
    font-size:0.7rem;
  }
}

/* Très petits mobiles */
@media (max-width: 360px){
  .home-screen{
    padding:16px;
  }

  .logo{
    width:120px;
  }

  h1{
    font-size:1.8rem;
  }
}

@keyframes floatLogo{
  0%{
    transform:translateY(0px);
  }

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

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

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

  50%{
    transform:scale(1.08);
    opacity:0.35;
  }

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

.logo{
  animation:floatLogo 4s ease-in-out infinite;
}

.background-glow{
  animation:pulseGlow 6s ease-in-out infinite;
}
.inspiration-card{
  margin-top:clamp(18px, 4vh, 32px);
  width:min(92vw, 420px);

  padding:10px;

  border:1px solid rgba(255,255,255,0.12);
  border-radius:18px;

  background:rgba(255,255,255,0.06);
  backdrop-filter:blur(14px);

  box-shadow:0 20px 60px rgba(0,0,0,0.35);
}

.inspiration-label{
  display:block;

  margin-bottom:8px;

  font-size:0.62rem;
  letter-spacing:2px;
  text-transform:uppercase;

  color:rgba(255,255,255,0.65);
}

.comment-shot{
  display:block;

  width:100%;
  max-height:24dvh;

  object-fit:contain;

  border-radius:12px;
}

.airy-signature{
  position:fixed;
  right:clamp(14px, 3vw, 28px);
  bottom:clamp(14px, 3vw, 28px);

  width:clamp(58px, 10vw, 92px);
  opacity:0.72;

  z-index:5;

  filter:drop-shadow(0 0 12px rgba(255,255,255,0.15));
}

.start-button{
  margin-top:clamp(20px, 4vh, 34px);

  border:none;
  outline:none;

  padding:16px 34px;

  border-radius:999px;

  background:linear-gradient(
    135deg,
    #0057ff,
    #00a3ff
  );

  color:white;

  font-family:'Orbitron', sans-serif;
  font-size:0.95rem;
  font-weight:700;
  letter-spacing:3px;

  cursor:pointer;

  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.2s ease;

  box-shadow:
    0 0 20px rgba(0,87,255,0.45),
    0 12px 40px rgba(0,87,255,0.35);
}

.start-button:hover{
  transform:translateY(-3px) scale(1.03);

  box-shadow:
    0 0 30px rgba(0,87,255,0.7),
    0 20px 60px rgba(0,87,255,0.45);
}

.start-button:active{
  transform:scale(0.98);
}

@media (max-width:768px){
  .start-button{
    width:100%;
    max-width:320px;

    padding:18px 24px;
  }
}

.loading-screen{
  position:fixed;
  inset:0;

  background:#050816;

  display:flex;
  justify-content:center;
  align-items:center;

  z-index:999;

  opacity:1;
  visibility:visible;

  transition:
    opacity 0.6s ease,
    visibility 0.6s ease;
}

.loading-screen.hidden{
  opacity:0;
  visibility:hidden;
}

.loading-content{
  display:flex;
  flex-direction:column;
  align-items:center;
}

.loading-logo{
  width:120px;

  margin-bottom:20px;

  animation:floatLogo 3s ease-in-out infinite;
}

.loading-text{
  font-size:0.8rem;
  letter-spacing:3px;

  opacity:0.7;
}

.gold{
  border:1px solid rgba(255,215,0,0.35);

  background:
    linear-gradient(
      90deg,
      rgba(255,215,0,0.10),
      rgba(255,255,255,0.04)
    );
}

.silver{
  border:1px solid rgba(192,192,192,0.35);

  background:
    linear-gradient(
      90deg,
      rgba(192,192,192,0.10),
      rgba(255,255,255,0.04)
    );
}

.bronze{
  border:1px solid rgba(205,127,50,0.35);

  background:
    linear-gradient(
      90deg,
      rgba(205,127,50,0.10),
      rgba(255,255,255,0.04)
    );
}

.leaderboard-title{
  margin-top:28px;
  margin-bottom:14px;

  font-size:0.72rem;
  letter-spacing:2px;
  text-transform:uppercase;

  color:rgba(255,255,255,0.72);

  text-align:center;
}

.loading-progress{
  width:min(90vw, 320px);
  height:8px;

  margin-top:18px;
  margin-bottom:8px;

  border-radius:999px;
  background:rgba(255,255,255,0.08);
  overflow:hidden;
}

.loading-progress-bar{
  height:100%;
  width:35%;

  border-radius:999px;

  background:linear-gradient(
    90deg,
    transparent,
    #00a3ff,
    #ffd700,
    transparent
  );

  animation:loadingMove 1.1s ease-in-out infinite;
}

@keyframes loadingMove{
  0%{
    transform:translateX(-110%);
  }

  100%{
    transform:translateX(310%);
  }
}

.loading-leaderboard{
  margin-top:8px;

  width:min(90vw, 340px);

  display:flex;
  flex-direction:column;
  gap:10px;
}

.loading-player{
  display:flex;
  align-items:center;
  justify-content:space-between;

  gap:12px;

  padding:14px 16px;

  border-radius:16px;

  background:rgba(255,255,255,0.05);

  border:1px solid rgba(255,255,255,0.08);

  backdrop-filter:blur(10px);

  transition:
    transform 0.2s ease,
    border 0.2s ease;
}

.loading-player:hover{
  transform:translateY(-2px);
}

.loading-player span{
  font-size:0.95rem;
}

.loading-player strong{
  flex:1;

  font-size:0.9rem;
  font-weight:700;
}

.loading-player em{
  font-style:normal;

  font-size:0.78rem;

  color:#00a3ff;
}

/* TOP 1 */

.gold{
  border:1px solid rgba(255,215,0,0.4);

  background:
    linear-gradient(
      90deg,
      rgba(255,215,0,0.12),
      rgba(255,255,255,0.04)
    );

  box-shadow:
    0 0 20px rgba(255,215,0,0.12);
}

/* TOP 2 */

.silver{
  border:1px solid rgba(192,192,192,0.35);

  background:
    linear-gradient(
      90deg,
      rgba(192,192,192,0.10),
      rgba(255,255,255,0.04)
    );
}

/* TOP 3 */

.bronze{
  border:1px solid rgba(205,127,50,0.35);

  background:
    linear-gradient(
      90deg,
      rgba(205,127,50,0.10),
      rgba(255,255,255,0.04)
    );
}

/* TOP 4 */

.rank-4{
  border:1px solid rgba(0,163,255,0.25);

  background:
    linear-gradient(
      90deg,
      rgba(0,163,255,0.08),
      rgba(255,255,255,0.04)
    );
}

/* TOP 5 */

.rank-5{
  border:1px solid rgba(255,255,255,0.16);

  background:
    linear-gradient(
      90deg,
      rgba(255,255,255,0.07),
      rgba(255,255,255,0.03)
    );
}

.empty-leaderboard{
  padding:18px;

  border-radius:16px;

  background:rgba(255,255,255,0.05);
  border:1px solid rgba(255,255,255,0.08);

  text-align:center;

  font-size:0.8rem;
  letter-spacing:1px;

  color:rgba(255,255,255,0.72);
}

.player-modal{
  position:fixed;
  inset:0;
  z-index:800;

  display:flex;
  justify-content:center;
  align-items:center;

  padding:24px;

  background:rgba(5,8,22,0.82);
  backdrop-filter:blur(18px);
}

.player-modal.hidden{
  display:none;
}

.player-modal-card{
  width:min(92vw, 420px);

  padding:28px;

  border-radius:24px;

  background:rgba(255,255,255,0.08);
  border:1px solid rgba(255,255,255,0.12);

  text-align:center;

  box-shadow:0 24px 80px rgba(0,0,0,0.45);
}

.player-modal-card h2{
  margin-bottom:12px;

  font-size:1.4rem;
}

.player-modal-card p{
  margin-bottom:22px;

  font-size:0.85rem;
  opacity:0.75;
  line-height:1.5;
}

#playerNameInput{
  width:100%;

  padding:16px 18px;
  margin-bottom:18px;

  border:none;
  outline:none;

  border-radius:16px;

  background:rgba(255,255,255,0.1);
  color:white;

  font-family:'Orbitron', sans-serif;
  font-size:0.9rem;

  text-align:center;
}

#playerNameInput::placeholder{
  color:rgba(255,255,255,0.4);
}

#savePlayerButton{
  width:100%;

  padding:16px 20px;

  border:none;
  border-radius:999px;

  background:linear-gradient(135deg, #0057ff, #00a3ff);

  color:white;

  font-family:'Orbitron', sans-serif;
  font-weight:700;
  letter-spacing:2px;

  cursor:pointer;
}

.game-screen{
  position:fixed;
  inset:0;
  z-index:20;

  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;

  padding:16px;
  background:#050816;
}

.hidden-game{
  display:none;
}

.game-layout{
  width:100%;
  height:80dvh;

  display:flex;
  justify-content:center;
  align-items:center;
  gap:24px;
}

.game-board{
  height:80dvh;
  aspect-ratio:10/20;

  padding:8px;

  border-radius:24px;
  background:rgba(255,255,255,0.05);
  border:1px solid rgba(255,255,255,0.12);

  box-shadow:
    0 0 40px rgba(0,87,255,0.25),
    inset 0 0 30px rgba(255,255,255,0.04);
}

#tetrisCanvas{
  width:100%;
  height:100%;
  display:block;

  border-radius:18px;
  background:#02040d;
}

.game-sidebar{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.score-card{
  min-width:160px;
  padding:18px;

  border-radius:18px;
  background:rgba(255,255,255,0.05);
  border:1px solid rgba(255,255,255,0.08);
}

.score-card span{
  display:block;
  font-size:0.65rem;
  opacity:0.6;
  letter-spacing:2px;
  margin-bottom:8px;
}

.score-card strong{
  font-size:1rem;
}

.mobile-controls{
  display:none;
}

.game-screen{
  position:fixed;
  inset:0;
  z-index:20;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  padding:16px;
  background:#050816;
}

.hidden-game{ display:none; }

.game-layout{
  width:100%;
  height:80dvh;
  display:flex;
  justify-content:center;
  align-items:center;
  gap:24px;
}

.game-board{
  height:80dvh;
  aspect-ratio:10/20;
  padding:8px;
  border-radius:24px;
  background:rgba(255,255,255,0.05);
  border:1px solid rgba(255,255,255,0.12);
  box-shadow:0 0 40px rgba(0,87,255,0.25), inset 0 0 30px rgba(255,255,255,0.04);
}

#tetrisCanvas{
  width:100%;
  height:100%;
  display:block;
  border-radius:18px;
  background:#02040d;
}

.game-sidebar{
  display:flex;
  flex-direction:column;
  gap:14px;
}

.score-card,
.next-piece-card{
  min-width:160px;
  padding:16px;
  border-radius:18px;
  background:rgba(255,255,255,0.05);
  border:1px solid rgba(255,255,255,0.08);
}

.score-card span,
.next-piece-card span{
  display:block;
  font-size:0.65rem;
  opacity:0.6;
  letter-spacing:2px;
  margin-bottom:8px;
}

.score-card strong{
  font-size:1rem;
}

#nextPieceCanvas{
  width:110px;
  height:110px;
  display:block;
  margin:auto;
  border-radius:14px;
  background:#02040d;
}

.mobile-controls{
  display:none;
}

@media(max-width:900px){
  .game-screen{
    padding:10px;
    justify-content:flex-start;
    padding-top:58px;
  }

  .game-layout{
    height:auto;
    flex-direction:column;
    gap:10px;
  }

  .game-board{
    height:54dvh;
    max-height:560px;
  }

  .game-sidebar{
    width:100%;
    max-width:430px;
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
  }

  .score-card,
  .next-piece-card,
  .pause-button{
    width:100%;
    min-width:0;
    padding:10px;
    border-radius:14px;
  }

  .score-card span,
  .next-piece-card span{
    font-size:0.52rem;
    letter-spacing:1px;
    margin-bottom:6px;
  }

  .score-card strong{
    font-size:0.82rem;
  }

  .pause-button{
    font-size:0.7rem;
    letter-spacing:1px;
    padding:12px 8px;
  }

  #nextPieceCanvas{
    width:70px;
    height:70px;
  }

  .mobile-controls{
    width:100%;
    max-width:430px;
    display:grid;
    grid-template-columns:repeat(4, 1fr);
    gap:8px;
    margin-top:10px;
  }

  .mobile-controls button{
    padding:15px 0;
    border:none;
    border-radius:14px;
    background:rgba(255,255,255,0.08);
    color:white;
    font-size:1.35rem;
    font-weight:700;
    backdrop-filter:blur(10px);
  }
}

.pause-button{
  padding:14px 18px;

  border:none;
  border-radius:16px;

  background:rgba(255,255,255,0.08);
  color:white;

  font-family:'Orbitron', sans-serif;
  font-weight:700;
  letter-spacing:2px;

  cursor:pointer;

  transition:0.2s ease;
}

.pause-button:hover{
  background:rgba(255,255,255,0.14);
}

.game-over-screen{
  position:fixed;
  inset:0;
  z-index:999;

  display:flex;
  justify-content:center;
  align-items:center;

  padding:24px;

  background:rgba(5,8,22,0.86);
  backdrop-filter:blur(18px);
}

.game-over-screen.hidden{
  display:none;
}

.game-over-card{
  width:min(92vw, 420px);

  padding:34px 28px;

  border-radius:28px;

  text-align:center;

  background:rgba(255,255,255,0.08);
  border:1px solid rgba(255,255,255,0.12);

  box-shadow:0 24px 80px rgba(0,0,0,0.45);
}

.game-over-card h2{
  margin-bottom:18px;

  font-size:2rem;
}

.game-over-score{
  font-size:0.8rem;
  letter-spacing:2px;

  opacity:0.65;

  margin-bottom:10px;
}

#finalScore{
  display:block;

  margin-bottom:28px;

  font-size:2rem;

  color:#ffd700;
}

.restart-button{
  width:100%;

  padding:16px 20px;

  border:none;
  border-radius:999px;

  background:linear-gradient(
    135deg,
    #0057ff,
    #00a3ff
  );

  color:white;

  font-family:'Orbitron', sans-serif;
  font-weight:700;
  letter-spacing:2px;

  cursor:pointer;
}

.next-piece-card{
  padding:18px;

  border-radius:18px;

  background:rgba(255,255,255,0.05);
  border:1px solid rgba(255,255,255,0.08);

  text-align:center;
}

.next-piece-card span{
  display:block;

  margin-bottom:14px;

  font-size:0.65rem;
  letter-spacing:2px;

  opacity:0.6;
}

#nextPieceCanvas{
  width:120px;
  height:120px;

  display:block;
  margin:auto;

  border-radius:14px;

  background:#02040d;
}

.tutorial-screen{
  position:fixed;
  inset:0;
  z-index:850;

  display:flex;
  justify-content:center;
  align-items:center;

  padding:24px;
  background:rgba(5,8,22,0.86);
  backdrop-filter:blur(18px);
}

.tutorial-screen.hidden{
  display:none;
}

.tutorial-card{
  width:min(92vw, 460px);
  padding:30px;
  border-radius:26px;
  text-align:center;

  background:rgba(255,255,255,0.08);
  border:1px solid rgba(255,255,255,0.12);
}

.tutorial-card h2{
  margin-bottom:22px;
}

.tutorial-card p{
  margin-bottom:10px;
  font-size:0.85rem;
  opacity:0.82;
}

.tutorial-mobile{
  display:none;
}

#startAfterTutorialButton{
  margin-top:24px;
  width:100%;
  padding:16px;
  border:none;
  border-radius:999px;

  background:linear-gradient(135deg, #0057ff, #00a3ff);
  color:white;

  font-family:'Orbitron', sans-serif;
  font-weight:700;
  letter-spacing:2px;
}

@media(max-width:900px){
  .tutorial-desktop{
    display:none;
  }

  .tutorial-mobile{
    display:block;
  }
}

.game-logo{
  position:fixed;
  top:18px;
  left:18px;

  width:54px;
  opacity:0.85;

  z-index:30;
}

.game-airy-logo{
  position:fixed;
  top:18px;
  right:18px;

  width:70px;
  opacity:0.65;

  z-index:30;
}

@media(max-width:900px){
  .game-logo{
    width:42px;
    top:12px;
    left:12px;
  }

  .game-airy-logo{
    width:56px;
    top:12px;
    right:12px;
  }
}

#savePlayerButton{
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button{
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}