﻿/*
 * puzzle.css – Layout und Darstellung des Schiebepuzzles.
 * Jede Kachel ist 99 x 99 Pixel groß; die Positionen liegen im Abstand
 * von 100 Pixeln, sodass zwischen den Kacheln ein schmaler Spalt entsteht.
 */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: #222;
}

#container {
  width: min(500px, calc(100% - 32px));
  margin: 32px auto;
}

h1 {
  width: 100%;
  margin: 0 0 20px;
  font-size: 24px;
  text-align: center;
}

#game {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 3;
  border-radius: 5px;
  background: #ffe171;
  box-shadow: 0 0 10px #ffe171;
}

.tile,
.blocked {
  position: absolute;
  width: calc(20% - 1px);
  height: calc(33.333333% - 1px);
  border: 0;
  border-radius: 0;
  box-shadow: 1px 1px 2px #777;
  text-align: center;
  font-size: clamp(32px, 14vw, 72px);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tile {
  z-index: 2;
  padding: 0;
  background: #0000cd;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: left 0.25s ease, top 0.25s ease, color 0.15s ease;
}

.tile:hover,
.tile:focus-visible {
  color: #ffe171;
  outline: 3px solid #20a6fa;
}

.blocked {
  z-index: 1;
  background: #ee0000;
  color: #fff;
}

.blocked[data-position="4"] {
  left: 80%;
  top: 0;
}

.blocked[data-position="9"] {
  left: 80%;
  top: 33.333333%;
}

#control {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

#timer {
  min-width: 180px;
  margin: 0;
}

#reset {
  padding: 6px 12px;
  border: 0;
  border-radius: 5px;
  background: #20a6fa;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 2px 2px 5px #4c98f5;
}

#reset:hover,
#reset:focus-visible {
  background: #168bd4;
  outline: 3px solid #ffe171;
}

@media (max-width: 420px) {
  #container {
    width: calc(100% - 20px);
    margin-top: 20px;
  }

  h1 {
    font-size: 21px;
  }

  #control {
    flex-wrap: wrap;
  }

  #timer {
    width: 100%;
    min-width: 0;
  }
}
