html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: 'Segoe UI', sans-serif;
  background: repeating-linear-gradient(45deg,rgba(255,255,255,0.15) 0px,rgba(255,255,255,0.15) 10px, transparent 10px, transparent 20px),
    linear-gradient(135deg, #f5f7fa, #c3cfe2);
  color: #333;
  display: flex;
  flex-direction: column;
}

#main-header {
  background-color: #4CAF50;
  color: white;
  text-align: center;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  flex-shrink: 0;
}

#main-header>div {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;

  &>a {
    position: absolute;
    right: 0;
  }
}

#main-header h1 {
  margin: 0.3rem 0;
}

#main-header p {
  font-size: 0.9rem;
  opacity: 0.9;
  margin-bottom: 0.5rem;
}

#main-header a {
  color: white;
  text-decoration: none;
}

#main-footer {
  background-color: #f5f5f5;
  color: #555;
  text-align: center;
  padding: 0.8rem;
  font-size: 0.85rem;
  border-top: 1px solid #ddd;
  flex-shrink: 0;

  a {
    color: #4CAF50;
    text-decoration: none;

    &:hover {
      text-decoration: underline;
    }
  }

  &>div {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    font-weight: bold;
  }
}
#app {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  padding: 1rem;
  text-align: center;
  overflow-y: auto;
}

#tiles-container {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 1.5rem;
}

.tile {
  background-color: white;
  font-size: 1.25rem;
  font-weight: bold;
  border-radius: 0.4rem;
  cursor: pointer;
  user-select: none;
  border: 2px solid transparent;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: transform 0.15s, background-color 0.2s;
  width: 2rem;
  height: 2rem;
  display: flex;
  justify-content: center;
  align-items: center;

  &:hover {
    transform: scale(1.05);
  }

  &.selected {
    border-color: #007BFF;
    background-color: #e6f0ff;
  }

  &.disabled {
    background-color: #f1f1f1;
    color: #aaa;
    cursor: not-allowed;
    transform: none !important;
    border-color: transparent;
  }

  &.correct {
    background-color: #caffca;
  }
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  animation: fadeIn 0.3s;
  z-index: 20;
}

.modal-content {
  background: white;
  padding: 1.5rem;
  border-radius: 0.5rem;
  text-align: center;
  max-width: 300px;
  width: 90%;
  position: relative;
}

.modal-content h2 {
  margin-bottom: 1rem;
}

.modal-content button {
  background-color: #4CAF50;
  color: white;
  border: none;
  padding: 0.6rem 1rem;
  border-radius: 0.3rem;
  cursor: pointer;
  font-size: 1rem;
}

.modal-content button:hover {
  background-color: #43a047;
}

.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.8rem;
  font-size: 1.3rem;
  cursor: pointer;
  border: none;
  background: none;
  color: #666;
}

.modal-close:hover {
  color: black;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

#stats-container {
  background: white;
  padding: 1rem;
  border-radius: 0.5rem;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

#stats-container h2 {
  margin-bottom: 1rem;
}

#stats-list {
  list-style: none;
  padding: 0;
}

#stats-list li {
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

#top-game-data {
  display: flex;
  flex-direction: column-reverse;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  margin-bottom: 0.8rem;
  font-size: 1rem;

  #category-ctn {
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 1.5rem;

    #category-label {
      display: none;
      margin-right: 0.5rem;
    }

    #category-btn {
      display: none;
      background: #225023;
      color: white;
      border: none;
      border-radius: 10px;
      font-size: .8rem;
      padding: .5rem 1rem;
      cursor: pointer;
      text-transform: uppercase;
    }

    #category-value {
      display: none;
      text-transform: capitalize;
    }
  }

}
.space-tile {
  background-color: transparent;
  border: none;
  cursor: default;
  box-shadow: none;
  flex-basis: 100%;
  height: 0 !important;
}

.space-tile::after {
  content: " ";
}

.solved-banner {
  display: none;
  margin-top: 1.5rem;
  padding: 1rem 1.2rem;
  background: linear-gradient(135deg, #d4edda, #e9f7ef);
  color: #155724;
  border-radius: 0.75rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  text-align: center;

  .solved-text {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;

    span {
      font-size: 1.5rem;
    }
  }
  
  #next-puzzle-timer {
    margin-top: 0.6rem;
    font-size: 0.95rem;
  }

  button {
    margin-top: 0.6rem;
    padding: 0.6rem;
    font-size: 0.9rem;
    border: none;
    border-radius: 0.75rem;
    background-color: #155724;
    color: white;
    cursor: pointer;
  }
}

#tutorial-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.95);
  color: white;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  overflow-y: auto;
  display: none;
  
  .tutorial-step {
    display: none;
    margin-bottom: 1rem;
    text-align: center;
    width: 100%;
    max-width: 400px;
    height: auto;
    min-height: 300px;

    &.active {
      display: block;
    }

    .tutorial-progress {
      display: flex;
      flex-direction: row;
      gap: 1rem;
      justify-content: center;

      .tutorial-step-progress {
        width: 0.75rem;
        height: 0.75rem;
        background-color: gray;
        border-radius: 50%;

        &.active {
          width: 2rem;
          background-color: #4CAF50;
          border-radius: 10px;
        }
      }
    }

    h2 {
      margin: 2rem auto;
    }

    p {
      margin: 2rem auto 1rem;
    }
  }

  .step-controls {
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    max-width: 400px;

    button {
      padding: 0.6rem 1rem;
      border: none;
      border-radius: 6px;
        background-color: #225023;
        color: white;
      font-weight: bold;
      cursor: pointer;

      &:disabled {
        opacity: 0.5;
        cursor: default;
      }

      &.is-last {
        background-color: #4CAF50;
      }
    }
  }

  
  #skip-tutorial {
    color: white;
    text-decoration: underline;
    cursor: pointer;
    font-size: .8rem;
  }
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 170px;
  height: 40px;
  background: #ddd;
  border-radius: 20px;
  position: relative;
  cursor: pointer;
  padding: 0 20px 0 30px;
  user-select: none;
  margin-top: .5rem;
  margin-bottom: 2rem;

  span {
    font-size: 20px;
    z-index: 1;
    color: black;
    &:first-of-type {
      color: white;
    }
  }
  
  .slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 50%;
    height: 34px;
    background: #4CAF50;
    border-radius: 17px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
  }

  &.active {
    span {
      color: white;
      &:first-of-type {
        color: black;
      }
    }
    .slider {
      transform: translateX(100%);
    }
  }
}


@media (min-width: 600px) {
  #main-header h1 {
    font-size: 2rem;
  }
  .tile, .space-tile {
    font-size: 1.8rem;
    width: 3rem;
    height: 3rem;
  }
}
