* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background-color: #ffb3c7;
  font-family: system-ui, -apple-system, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 100dvh; 
  padding: 10px 0 20px 0;
  overflow: hidden;
  touch-action: none;
}

/* NÉMÍTÓ GOMB */
.icon-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.25);
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
  transition: transform 0.1s ease, background 0.2s ease;
  z-index: 100;
}

.icon-btn:active {
  transform: scale(0.9);
}

.icon-btn.muted {
  opacity: 0.6;
}

/* FELSŐ FEJLÉC ZÓNA */
.header-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 420px;
  margin: 0 auto 10px auto;
  position: relative;
  padding: 10px 15px;
  box-sizing: border-box;
}

.high-score-container {
  position: absolute;
  top: 8px;
  left: 15px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffd700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  z-index: 2;
}

#high-score {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffd700;
}

.score-container {
  margin-top: 24px;
  text-align: center;
  z-index: 1;
}

#score {
  font-size: 3.2rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 1px;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  line-height: 1;
}

/* PÁLYA KERETTEL */
.board-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

#kitty-mascot {
  position: absolute;
  top: -55px;
  right: 4px;
  width: 95px;
  height: auto;
  z-index: 10;
  pointer-events: none;
  transition: transform 0.15s ease;
}

#kitty-mascot.happy {
  transform: scale(1.15) rotate(5deg);
}

#gameCanvas {
  background-color: #774046;
  border: 3px solid #89656a;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.pieces-container {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  max-width: 400px;
  height: 110px;
  padding: 0 10px;
  margin-bottom: 10px;
}

.piece-canvas {
  width: 30%;
  height: 100%;
}

#dragCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

/* ========================================================= */
/* TELJES KÉPERNYŐS FELÜLETEK (MODALS) */
/* ========================================================= */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #774046;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.modal-content {
  background: none;
  border: none;
  box-shadow: none;
  padding: 20px;
  width: 100%;
  max-width: 450px;
  height: 85vh;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  align-items: center;
  text-align: center;
  color: #fff5f7;
}

/* CÍM ÉS VERZIÓSZÁM BLOKK */
.title-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.welcome-text {
  font-size: 1.8rem;
  font-weight: 600;
  opacity: 0.9;
  margin: 0;
}

.modal-content h2 {
  font-size: 3.2rem;
  font-weight: 900;
  margin: 0;
  letter-spacing: 1px;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  transition: color 0.3s ease;
}

.version-tag {
  font-size: 0.85rem;
  font-weight: 500;
  color: #c4aeb2;
  margin-top: 4px;
  letter-spacing: 1px;
  opacity: 0.8;
}

/* GAME OVER PONTSZÁM & SZÖVEG */
#final-score {
  font-size: 5.5rem;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
  transition: color 0.3s ease;
}

#gameover-text {
  font-size: 1.4rem;
  font-style: italic;
  color: #fff5f7;
  margin: 0;
  padding: 0 10px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.modal-content.is-highscore h2,
.modal-content.is-highscore #final-score {
  color: #ffd700;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

/* GOMBOK STÍLUSA */
#start-btn, 
#restart-btn {
  padding: 18px 48px;
  font-size: 1.35rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #774046;
  background-color: #fff5f7;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 6px 0 #d9c5c9, 0 10px 20px rgba(0, 0, 0, 0.3);
  transform: scale(1);
  opacity: 1;
  transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.8s ease;
}

#start-btn:active, 
#restart-btn:active {
  transform: scale(0.95) translateY(4px);
}

.btn-hidden {
  opacity: 0 !important;
  transform: scale(0) !important;
  pointer-events: none !important;
  transition: none !important;
}

/* GAME OVER GOMBCSOPORT 20PX TÁVOLSÁGGAL */
.btn-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

/* ========================================================= */
/* NÉVBEKÉRŐ ÉS RANGLISTA (SUPABASE UI) STÍLUSOK */
/* ========================================================= */

#name-modal {
  z-index: 20000 !important;
  background-color: #774046 !important;
}

#name-modal h2 {
  font-size: 2.8rem;
  font-weight: 900;
  color: #fff5f7;
  text-align: center;
  margin-bottom: 20px;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}

#player-name-input {
  width: 85%;
  max-width: 320px;
  padding: 16px 20px;
  font-size: 1.3rem;
  font-weight: 800;
  color: #774046;
  background-color: #fff5f7;
  border: 3px solid #89656a;
  border-radius: 16px;
  text-align: center;
  outline: none;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  margin-bottom: 25px;
}

#player-name-input::placeholder {
  color: #bfa8ac;
  font-weight: 600;
}

#save-name-btn {
  padding: 16px 40px;
  font-size: 1.2rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #774046;
  background-color: #fff5f7;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 6px 0 #d9c5c9, 0 10px 20px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s ease;
}

#save-name-btn:active {
  transform: scale(0.95) translateY(4px);
}

.secondary-btn {
  padding: 12px 28px;
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fff5f7;
  background: transparent;
  border: 2px solid #fff5f7;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
  margin-top: 10px;
}

.secondary-btn:active {
  transform: scale(0.95);
  background: rgba(255, 245, 247, 0.15);
}

#leaderboard-list {
  width: 100%;
  max-width: 360px;
  max-height: 280px;
  overflow-y: auto;
  margin: 15px 0;
  padding-right: 5px;
}

.leaderboard-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff5f7;
}

.leaderboard-item.top-3 {
  color: #ffd700;
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.3);
  font-weight: 800;
}

/* Saját játékos kiemelése a ranglistán */
.leaderboard-item.is-you {
  background: rgba(255, 179, 199, 0.25) !important;
  border: 2px solid #ffb3c7 !important;
  font-weight: 800;
}