/* Grundlayout */
body {
  font-family: 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #f0f8ff, #e6e6fa);
  color: #333;
  margin: 0;
  text-align: center;
}

/* Titel */
h1 {
  margin: 20px 0;
  font-size: 2rem;
  color: #222;
}

/* Steuerung */
#controls {
  margin: 20px;
}

label {
  font-size: 1.1rem;
  margin-right: 8px;
}

select, button {
  font-size: 1.2rem;
  padding: 12px 24px;
  margin: 8px;
  border: none;
  border-radius: 8px;
  background: #4CAF50;
  color: white;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
}

select {
  background: #38bdf8;
  color: #fff;
}

button:hover {
  background: #45a049;
  transform: scale(1.05);
}

/* Spielfeld */
.board {
  display: grid;
  gap: 12px;
  justify-content: center;
  margin: 20px auto 100px; /* Platz für Info-Bar unten */
}

.board[data-size="4"] { grid-template-columns: repeat(4, 100px); }
.board[data-size="6"] { grid-template-columns: repeat(6, 90px); }
.board[data-size="8"] { grid-template-columns: repeat(8, 80px); }

/* Karten */
.card {
  width: 100%;
  aspect-ratio: 1 / 1; /* quadratisch */
  perspective: 1000px;
}

.card-inner {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.6s ease;
  border-radius: 12px;
}

.card.flipped .card-inner {
  transform: rotateY(180deg);
}

.face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  border-radius: 12px;
  font-size: 2rem;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.face.back {
  background: #38bdf8;
  color: #fff;
}

.face.front {
  background: #fff;
  color: #333;
  transform: rotateY(180deg);
  border: 2px solid #ccc;
}

.card.matched .face.front {
  background: #22c55e;
  color: #fff;
}

.card.match-effect .card-inner {
  animation: matchFlash 0.6s ease;
}

@keyframes matchFlash {
  0% { transform: rotateY(180deg) scale(1); }
  50% { transform: rotateY(180deg) scale(1.1); }
  100% { transform: rotateY(180deg) scale(1); }
}

/* Spielinfos unten fix */
#game-info {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #f8f8f8;
  border-top: 2px solid #ccc;
  padding: 12px;
  font-size: 1.1rem;
  display: flex;
  justify-content: center;
  gap: 40px;
  z-index: 100;
}

/* Gewinn-Dialog */
.dialog {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,0.5);
  z-index: 200;
}

.dialog[hidden] { display: none; }

.dialog-card {
  background: #fff;
  padding: 1.5rem;
  border-radius: 12px;
  max-width: 420px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

#win-text {
  margin-bottom: 12px;
  font-size: 1.1rem;
}

#player-name {
  font-size: 1.1rem;
  padding: 10px 12px;
  margin: 10px 0 16px;
  border: 1px solid #ccc;
  border-radius: 8px;
  width: 100%;
}

.dialog-actions {
  display: flex;
  justify-content: center;
}

#save-score {
  font-size: 1.2rem;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  background: #4CAF50;
  color: white;
  cursor: pointer;
}

#save-score:hover {
  background: #45a049;
}

/* Highscore-Liste */
#highscore-list {
  list-style: none;
  padding: 0;
  max-width: 360px;
  margin: 20px auto;
}

#highscore-list li {
  background: #fff;
  margin: 8px 0;
  padding: 12px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
/* Eingabefeld im Gewinn-Dialog */
#player-name {
  font-size: 1.2rem;
  padding: 12px 16px;
  margin: 12px 0 20px;
  border: 2px solid #38bdf8;
  border-radius: 10px;
  width: 90%;
  outline: none;
  transition: border-color 0.3s, box-shadow 0.3s;
}

#player-name:focus {
  border-color: #4CAF50;
  box-shadow: 0 0 6px rgba(76, 175, 80, 0.6);
}

/* Button im Dialog */
#save-score {
  font-size: 1.3rem;
  padding: 14px 28px;
  border: none;
  border-radius: 10px;
  background: #4CAF50;
  color: white;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
}

#save-score:hover {
  background: #45a049;
  transform: scale(1.05);
}
#game-info {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #f8f8f8;
  border-top: 2px solid #ccc;
  padding: 12px;
  font-size: 1.1rem;
  display: flex;
  justify-content: center;
  gap: 40px;
  z-index: 100;
}

#game-info button {
  font-size: 1.1rem;
  padding: 10px 20px;
  border-radius: 8px;
  background: #38bdf8;
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
}

#game-info button:hover {
  background: #1e90ff;
  transform: scale(1.05);
}
