/* ---------- GLOBAL / LOCK SCREEN ---------- */
html, body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  touch-action: manipulation;
  overscroll-behavior: none;
}

* {
  box-sizing: border-box;
}

/* ---------- BODY ---------- */
body {
  background: radial-gradient(circle at top, #103c2c, #071f17);
  color: #ffffff;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  text-align: center;
}

/* ---------- HEADER ---------- */
header {
  padding: 12px 8px;
}

header h1 {
  margin: 0;
  font-size: 20px;
}

header p {
  margin: 4px 0 0;
  font-size: 13px;
  opacity: 0.8;
}

/* ---------- HUD ---------- */
.hud {
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  font-size: 14px;
  background: rgba(0, 0, 0, 0.25);
}

/* ---------- GAME WRAPPER ---------- */
.game-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 12px;
}

/* ---------- GRID ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(7, 56px);
  gap: 6px;
}

/* ---------- TILE (BASE) ---------- */
.tile {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  cursor: pointer;

  position: relative;
  overflow: visible;

  will-change: transform, box-shadow;
  transform: translateZ(0);

  box-shadow: none;
  outline: none;
}

/* ---------- SELECTED ---------- */
.tile.selected {
  box-shadow: 0 0 0 3px #ffd86b;
}

/* ---------- MATCHED (NORMAL FEEDBACK) ---------- */
.tile.matched {
  box-shadow: 0 0 16px 3px rgba(255, 216, 107, 0.8);
}

/* ---------- SUBTLE HINT GLOW (PRE-RESHUFFLE) ---------- */
.tile.hint {
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.25);
  animation: hintGlow 1.6s ease-in-out infinite;
}

@keyframes hintGlow {
  0%   { box-shadow: 0 0 6px rgba(255,255,255,0.18); }
  50%  { box-shadow: 0 0 14px rgba(255,255,255,0.35); }
  100% { box-shadow: 0 0 6px rgba(255,255,255,0.18); }
}

/* ---------- SWAP PULSE ---------- */
.tile.swapping {
  animation: swapPulse 0.15s ease-out;
}

@keyframes swapPulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(0.85); }
  100% { transform: scale(1); }
}

/* ---------- SYMBOLIC HELP PULSE (BOARD HELPS PLAYER) ---------- */
body.helped {
  animation: helpedPulse 0.9s ease-out;
}

@keyframes helpedPulse {
  0%   { background-color: rgba(255, 255, 255, 0); }
  50%  { background-color: rgba(255, 255, 255, 0.03); }
  100% { background-color: rgba(255, 255, 255, 0); }
}

/* ---------- FOOTER ---------- */
footer {
  margin-top: 14px;
  padding-bottom: 10px;
  font-size: 12px;
  opacity: 0.6;
  transition: opacity 0.4s ease;
}

/* ---------- FOOTER FADE DURING RESHUFFLE ---------- */
footer.fading {
  opacity: 0.25;
}

/* ---------- HOVER (DESKTOP ONLY) ---------- */
@media (hover: hover) {
  .tile:hover {
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.25);
  }
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 400px) {
  .grid {
    grid-template-columns: repeat(7, 48px);
    gap: 5px;
  }

  .tile {
    width: 48px;
    height: 48px;
  }
}
/* =====================================================
   🟢 OVERLAY — SINGLE SOURCE OF TRUTH
   ===================================================== */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 16px;
  z-index: 999;
}

.overlay.hidden {
  display: none;
}

.overlay-box {
  background: #0f3d2e;
  padding: 20px 24px;
  border-radius: 12px;

  width: 100%;
  max-width: 320px;

  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Title */
.overlay-box h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

/* CP line */
.overlay-box .cp-line {
  margin: 8px 0 14px;
  font-size: 14px;
  line-height: 1.45;
  color: #d7efe4;
}

/* Button */
.overlay-box button {
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 8px;
}

/* Small screens */
@media (max-height: 620px) {
  .overlay-box {
    padding: 16px 20px;
  }

  .overlay-box h2 {
    font-size: 16px;
  }

  .overlay-box .cp-line {
    font-size: 13px;
  }
}
