.savate-600 {
  font-family: "Savate", sans-serif;
  font-optical-sizing: auto;
  font-weight: 600;
  font-style: normal;
}

* {
  padding: 0;
  margin: 0;
  box-sizing: border-box;
  font-family: "Savate", sans-serif;
}

/* Mobile-first styles */
body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Arial, sans-serif;
  background: #222;
  color: #fff;
}

.memory-game > div  {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 8px;
  max-width: 420px;
  margin: 0 auto;
}
#title{
  grid-template-columns: repeat(1, 1fr) !important;
  text-align: center;
  color:lightpink;
  padding: 8px;
  font-size: 3em;
}
#click-counter{
  grid-template-columns: repeat(3, 1fr) !important;
  font-weight: bold;
}
#clicks{color:slateblue;}
#matches{color:lightseagreen;}
#score{color:lawngreen;}

.memory-card {
  width: 100%;
  aspect-ratio: 1/1;
  position: relative;
  perspective: 800px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  background: #333;
  cursor: pointer;
  transition: transform 0.2s;
  overflow: hidden; 
}

.memory-card:active {
  transform: scale(0.97);
}

.memory-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
  backface-visibility: hidden;
  display: block;
}

.front-face {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 2;
  transform: rotateY(0deg);
  transition: transform 0.4s;
}

.back-face {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 1;
  transform: rotateY(180deg);
  transition: transform 0.4s;
}

/* Flip effect (add .flip class with JS) */
.memory-card.flip .front-face {
  transform: rotateY(180deg);
}
.memory-card.flip .back-face {
  transform: rotateY(0deg);
}

/* Responsive for 321px and up */
@media (min-width: 321px) {
    .memory-game > div {
        grid-template-columns: repeat(4, 1fr);
        /* gap: 12px;
        padding: 16px; */
        max-width: 420px;
        margin: 0 auto;
    }
}

/* Responsive for tablets and up */
@media (min-width: 600px) {
  .memory-game > div {
    grid-template-columns: repeat(4, 1fr);
    max-width: 600px;
    /* gap: 16px;
    padding: 24px; */
  }
}

/* Responsive for desktop */
@media (min-width: 900px) {
  .memory-game > div {
    grid-template-columns: repeat(8, 1fr);
    max-width: 900px;
    /* gap: 20px;
    padding: 32px; */
  }
}
#replay{
  display: flex;
  justify-content: center;
  align-items: center;
}
#replay-btn {
  display: inline-block;
  padding: 12px 32px;
  background: linear-gradient(90deg, #ffb347 0%, #ffcc33 100%);
  color: #222;
  font-size: 1.2rem;
  font-family: 'Savate', sans-serif;
  font-weight: 700;
  border: none;
  border-radius: 30px;
  box-shadow: 0 4px 16px rgba(255, 204, 51, 0.3);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.3s;
  outline: none;
  letter-spacing: 1px;
}


.modal {
  position: fixed;
  z-index: 9999;
  left: 0; top: 0;
  width: 100vw; 
  /* height: 100vh; */
  height: 80vh;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 25px;;
}
.modal-content {
  background: #222;
  color: #fff;
  padding: 32px 40px;
  border-radius: 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  text-align: center;
  min-width: 280px;
}
.modal-content h2 {
  color: #ffcc33;
  margin-bottom: 18px;
  font-size: 2.2em;
  letter-spacing: 1px;
}
#modal-replay-btn, .yellow-btn {
  margin-top: 24px;
  padding: 12px 32px;
  background: linear-gradient(90deg, #ffb347 0%, #ffcc33 100%);
  color: #222;
  font-size: 1.1rem;
  font-family: 'Savate', sans-serif;
  font-weight: 700;
  border: none;
  border-radius: 30px;
  box-shadow: 0 4px 16px rgba(255, 204, 51, 0.3);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.3s;
  outline: none;
  letter-spacing: 1px;
}
#modal-replay-btn:hover, #modal-replay-btn:focus, .yellow-btn:hover, .yellow-btn:focus {
  background: linear-gradient(90deg, #ffe259 0%, #ffa751 100%);
  transform: scale(1.07);
  box-shadow: 0 6px 24px rgba(255, 204, 51, 0.5);
}

/* HUD and betting panel */
#hud{
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(20,20,20,0.9);
  border-radius: 12px;
  padding: 10px 14px;
  display:flex;
  align-items:center;
  gap: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}
#points-display{ font-weight:700; color:#ffd966; font-size:1rem; }

/* Countdown timer in HUD */
.timer{
  font-weight:800;
  font-size:1rem;
  padding:6px 10px;
  border-radius:8px;
  background: rgba(255,255,255,0.02);
  color: #ffd966; /* yellow by default */
}
.timer.red{ color: #ff4d4d; }

#bet-panel{ display:flex; flex-direction:column; gap:8px; align-items:center; }
.bet-row{ display:flex; gap:12px; align-items:center; }
.bet-row input[type=range]{ width:200px; }
.bet-value{ color:#ffb347; font-weight:700; }
.bet-actions{ display:flex; gap:8px; }
#placeBetBtn, #cancelBetBtn{
  padding:6px 12px; border-radius:8px; border:none; cursor:pointer; font-weight:700;
  background: linear-gradient(90deg, #ffb347 0%, #ffcc33 100%);
  color:#222;
}
#cancelBetBtn{ background: transparent; border:1px solid rgba(255,255,255,0.06); color: #DDD; }

/* small screens adjust */
@media (max-width:420px){
  .bet-row input[type=range]{ width:120px; }
  #hud{ gap: 8px; padding: 8px 10px; }
}

/* Debug panel */
#debug-panel{
  position: fixed;
  top: 64px;
  right: 8px;
  z-index: 1200;
  display:flex;
  gap:6px;
  align-items:center;
  padding:8px;
  background: rgba(30,30,30,0.95);
  border-radius:10px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.6);
}
#debug-panel input{ width:80px; padding:6px; border-radius:6px; border:1px solid rgba(255,255,255,0.06); background:#111; color:#fff; }
#debug-panel button{ padding:6px 8px; border-radius:6px; border: none; cursor:pointer; font-weight:700; background:#ffb347; color:#222; }
#debug-panel button:nth-child(4){ background: transparent; border:1px solid rgba(255,255,255,0.06); color:#ddd; }

/* Bet overlay - blocks the game content until bet is placed/cancelled */
#bet-overlay{
  position: fixed;
  inset: 0; /* top:0; left:0; right:0; bottom:0; */
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(3px);
  z-index: 1050; /* sits below HUD/bet panel (1000) but above game elements */
  /* display: none; */
  align-items: center;
  justify-content: center;
}

/* When overlay is active we want the pointer-events to block everything below */
#bet-overlay.active { display: flex; pointer-events: auto; }

/* ensure HUD remains on top of overlay */
#hud { z-index: 1000; position: relative; }