@charset "UTF-8";
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  font-size: 10px;
}
@media screen and (max-width: 1280px) {
  :root {
    font-size: 8px;
  }
}
@media screen and (max-width: 768px) {
  :root {
    font-size: 7px;
  }
}
@media screen and (max-width: 425px) {
  :root {
    font-size: 6px;
  }
}

canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100dvw;
  height: 100dvh;
  z-index: 15;
  pointer-events: none;
}

.endgame-text {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  color: #fff;
  z-index: 100;
  font-family: "Roboto", Arial, Helvetica, sans-serif;
  font-size: 8rem;
  background: #000;
  border-radius: 4rem;
  padding: 2rem 8rem;
  opacity: 0;
  transition: bottom, opacity;
  transition-duration: 3s;
  transition-timing-function: cubic-bezier(0.2, 0, 0.15, 1);
  box-shadow: 0 0 4rem #000, 0 0 8rem #000;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.endgame-text .mydiv {
  font-size: 4rem;
}
.endgame-text.active {
  opacity: 1;
  bottom: calc(100% - 20rem);
}

body {
  background-color: #222;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  min-height: 100vh;
  padding: 20px;
}
body::before {
  content: "";
  opacity: 0;
  transition: opacity 0.5s cubic-bezier(0.2, 0, 0.15, 1);
}
body.win::before {
  content: "";
  top: 0;
  left: 0;
  position: fixed;
  width: 100dvw;
  height: 100dvh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 12;
  opacity: 1;
}

.menu-bar {
  top: 0;
  position: fixed;
  z-index: 20;
  color: #fff;
  background-color: rgba(0, 0, 0, 0.5);
  width: 100vw;
  min-height: 8rem;
  padding: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3.2rem;
  font-family: "Roboto", Arial, Helvetica, sans-serif;
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
}
@media screen and (max-width: 768px) {
  .menu-bar {
    gap: 4rem;
  }
}
.menu-bar .title {
  font-size: 2.5rem;
  line-height: 1.2;
  color: #fff;
  text-decoration: none;
}
@media screen and (max-width: 1280px) {
  .menu-bar .title {
    font-size: 3rem;
    text-decoration: underline;
  }
}
@media screen and (max-width: 768px) {
  .menu-bar .title {
    font-size: 4rem;
  }
}
@media screen and (max-width: 425px) {
  .menu-bar .title {
    font-size: 3rem;
  }
}

.controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
  margin-bottom: 1rem;
}
.controls .button {
  height: 4rem;
  font-size: 1.6rem;
  border: 3px solid #000;
  border-radius: 5px;
  padding: 0.8rem;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  cursor: pointer;
  flex-shrink: 0;
  color: #fff;
}
@media screen and (max-width: 1280px) {
  .controls .button {
    font-size: 1.8rem;
  }
}
@media screen and (max-width: 768px) {
  .controls .button {
    font-size: 3rem;
    min-width: 7rem;
    height: 7rem;
    text-align: center;
    line-height: 1;
  }
}
@media screen and (max-width: 425px) {
  .controls .button {
    font-size: 4rem;
    min-width: 4rem;
    height: 8rem;
    text-align: center;
  }
}

@media screen and (max-width: 1280px) {
  .hide-lg {
    display: none;
  }
}

@media screen and (max-width: 768px) {
  .hide-vm {
    display: none;
  }
}

.vm-only {
  display: none;
}
@media screen and (max-width: 768px) {
  .vm-only {
    display: inline;
  }
}

/* Plateau */
#board {
  position: relative;
  background: #5a1d1d;
  margin-top: 10rem;
}
@media screen and (max-width: 768px) {
  #board {
    margin-top: 12rem;
  }
}

/* Style de base des pièces */
.piece {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
  touch-action: none;
  transition: left 0.1s ease-in-out, top 0.1s ease-in-out, transform 0.1s ease-in-out;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  border: 4px solid #5a1d1d;
  border-collapse: collapse;
  z-index: 1;
  cursor: grab;
  /* Effet visuel quand une pièce est déplacée */
}
.piece.dragging {
  opacity: 0.8;
  z-index: 500;
  cursor: grabbing;
}
.piece.red {
  background: #E61C1C;
  background-size: 100%;
  background-position: center;
  background-repeat: no-repeat;
  color: #fff;
}
.piece.yellow {
  background: #f6c600;
  background-size: 100%;
  background-position: center;
  background-repeat: no-repeat;
}
.piece.ane {
  background-image: url(/src/img/ane.png);
}
.piece.aimant {
  background-image: url(/src/img/aimant.png);
  background-size: 90%;
}
.piece.crayon {
  background-image: url(/src/img/crayon.png);
}
.piece.gps {
  background-image: url(/src/img/gps.png);
}
.piece.lampe {
  background-image: url(/src/img/lampe.png);
  background-size: 90%;
}
.piece.pile {
  background-image: url(/src/img/pile.png);
}
.piece.pince {
  background-image: url(/src/img/pince.png);
  background-size: 75%;
}
.piece.pince-a-epiler {
  background-image: url(/src/img/pince-a-epiler.png);
  background-size: 90%;
}
.piece.tb {
  background-image: url(/src/img/tb.png);
}

.wall {
  position: absolute;
  background: #222;
  opacity: 1;
  border-radius: 0;
  pointer-events: none;
}

.finish {
  position: absolute;
  pointer-events: none;
  background-image: url(/src/img/damier.png);
  background-size: 25%;
}

#statusRow {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  margin-top: 2rem;
  font-weight: 700;
  font-size: 2rem;
  font-family: "Roboto", Arial, Helvetica, sans-serif;
  color: #fff;
}

.level-selection {
  color: #fff;
  display: block;
  margin-top: 2rem;
  font-family: "Roboto", Arial, Helvetica, sans-serif;
  font-size: 1.5rem;
}