/*=============== VARIABLES CSS ===============*/
:root {
  --header-height: 4.5rem;
  --footer-height: 3rem;

  /*========== Colors ==========*/

  --body-color: hsl(196, 100%, 97%);
  --header-bg: #003f50;
  --footer-bg: #003f50;
  --nav-text: #e6f2f3;
  --nav-hover: #4f9f9e;
  --bg-color: rgb(172, 176, 128);
  --dropdown-bg: rgb(88, 158, 158);
  --dropdown-hover: #3a8c8b;

  --accent-color: #f6700b;

  /* --logo-color: rgba(255, 40, 3, 1); */

  /*========== Font and typography ==========*/

  --body-font: "Mitr", sans-serif;
  --normal-font-size: 0.9rem;
  --text-color: #141f22;

  /*========== Font weight ==========*/
  --font-regular: 400;
  --font-semi-bold: 600;

  /*========== z index ==========*/
  --z-tooltip: 10;
  --z-fixed: 100;
}
select,
input,
button {
  font-family: var(--body-font);
}
body {
  display: block;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  background: linear-gradient(180deg, rgb(103, 152, 166), rgb(61, 156, 204));
  font-family: "Mitr", sans-serif;
}
.game-container {
  position: relative;
}
.game-title {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);

  color: white;
  font-size: 1.7rem;
  z-index: 10;

  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

#myCanvas {
  width: 100vw;
  height: 100dvh;
  display: block;
}

#controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.menu {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  width: min(90vw, 400px);
  padding: clamp(1.5rem, 4vw, 2rem) clamp(1rem, 3vw, 1.5rem);

  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);

  border-radius: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);

  text-align: center;
}
button {
  font-size: 16px;
  background: rgb(63, 145, 148);
  color: white;
  cursor: pointer;
  transition: 0.2s;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
}

button:hover {
  background: rgb(208, 115, 27);
}

button:active {
  transform: scale(0.97);
}

select {
  font-size: 16px;
  padding: 12px;
  min-height: 44px;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  outline: none;
}

.preview-btn {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);

  z-index: 50;

  width: 60px;
  height: 60px;

  border-radius: 50%;
  border: none;

  background: rgba(0, 0, 0, 0.7);
  color: white;
  font-size: 1rem;

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

  backdrop-filter: blur(6px);
}

.preview-btn:active {
  transform: translateX(-50%) scale(0.9);
}

.preview-btn:hover {
  background: rgba(0, 0, 0, 0.85);
}
.preview {
  position: fixed;
  bottom: 10px;
  right: 10px;

  background: rgba(0, 0, 0, 0.6);
  padding: 6px;
  border-radius: 10px;

  z-index: 30;
}

.preview img {
  height: clamp(80px, 12vh, 160px);
  width: auto;
  border-radius: 6px;
  z-index: 9999;
}

.hidden {
  display: none;
}
input {
  font-size: 16px;
  border-radius: 8px;
  width: 50%;
  text-align: center;
}
#animation {
  position: absolute;
  display: none;
  pointer-events: none;
  z-index: 5;
  object-fit: cover;
}
#puzzleMenu {
  margin-top: 10px;
  padding-top: 15px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.thumbs {
  display: flex;
  justify-content: center;
  gap: 25px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.thumb {
  cursor: pointer;
  transition: 0.2s;
  opacity: 0.7;
}

.thumb img {
  width: clamp(70px, 25vw, 120px);
  height: clamp(50px, 18vw, 90px);
  object-fit: cover;
  border-radius: 5px;
}

.thumb:hover {
  transform: scale(1.08);
  opacity: 1;
}
#toggleBtn {
  margin-top: 10px;
}
.difficulty-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  width: 100%;
}
.thumb.active {
  opacity: 1;
}
.thumb.active img {
  outline: 2px solid rgb(208, 115, 27);
  outline-offset: 3px;
}

canvas {
  touch-action: none;
  cursor: grab;
}
canvas:active {
  cursor: grabbing;
}
/* ===================================Mobil===================================*/
@media (max-width: 600px) {
  .game-title {
    font-size: 0.9rem;
    top: 10px;
  }
  select {
    font-size: 16px;
  }
  .menu {
    width: 92vw;
    padding: 1.2rem;
  }

  .thumbs {
    gap: 12px;
  }

  .thumb img {
    width: clamp(60px, 28vw, 100px);
    height: auto;
  }
  .preview {
    bottom: 80px; /* flytta upp från fingrar */
    right: 10px;
  }

  .preview img {
    height: 80px;
  }

  .preview-btn {
    width: 45px;
    height: 45px;
    font-size: 0.8rem;
    bottom: 15px;
  }
}
/* ===================================Buttonback===================================*/
button.buttonBack {
  position: relative;
  width: fit-content;
  cursor: pointer;
  padding: 3px 12px 3px 12px;
  background-color: rgb(86, 165, 164);
  background: linear-gradient(to bottom, #2e6b7f, #cbeefa);
  margin-left: 1%;
  margin-bottom: 3%;
  bottom: 35px;
  border-radius: 25px;
  border: 2px 4px 2px 2px solid rgb(69, 83, 97);
  border-left: solid rgba(249, 200, 191, 0.4);
  opacity: 0.9;
  color: #1f3847;
  font-size: clamp(14px, 2vw, 18px);
  font-family: var(--body-font);
  font-weight: 400;
  box-shadow: 5px 4px 8px rgba(0, 0, 0, 0.4);
  z-index: 1000 !important;
  transition:
    background-color 0.2s ease-in-out,
    box-shadow 0.2s ease-in-out,
    border 0.2s ease-in-out;
}

.buttonBack:active {
  background-color: rgba(255, 40, 3, 1);
  border: solid 1px #1f3847;
  background: linear-gradient(to bottom, #690202, #fc5252);
  box-shadow: none;
  transform: translateY(2px);
}

.buttonBack:active::before {
  content: "";
  position: absolute;
  height: 7px;
  width: 15px;
  height: 2px;
  margin-top: 0;
  margin-left: 10%;
  margin-right: 10%;
  border-radius: 30px;
  background-color: rgba(249, 200, 191, 0.4);
  transform-origin: 0 0;
  animation: scaleLine 0.3s forwards;
}

@keyframes scaleLine {
  0% {
    transform: scaleX(0);
  }
  100% {
    transform: scaleX(3);
  }
}

.puzzle-page .back {
  position: fixed; /* viktig! */
  bottom: 35px;
  left: 20px;
  z-index: 9999 !important;
}
@media (max-width: 600px) {
  .buttonBack {
    font-size: 14px;
    padding: 3px 8px;
  }

  .puzzle-page .back {
    bottom: 20px;
    left: 10px;
  }
}
