/* ============================================================
   OVERLAYS
   ============================================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1.5rem;
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
}

.overlay.hidden {
  display: none;
}

/* ============================================================
   CARD
   ============================================================ */
.card {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border-radius: 24px;
  box-shadow:
    0 24px 64px rgba(0,0,0,0.14),
    0 4px 16px rgba(0,0,0,0.08),
    inset 0 1px 0 rgba(255,255,255,0.9);
  padding: 2rem 1.6rem 1.6rem;
  width: 100%;
  max-width: 340px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.card h2 {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 1.9rem;
  line-height: 1.1;
  color: #1a1a1a;
}

.card.victory h2 { color: #1CA694; }
.card.defeat h2  { color: #F0544F; }
.card.complete h2 { color: #F7A43B; }

.card p {
  font-size: 0.95rem;
  color: #666;
  line-height: 1.45;
}

/* ============================================================
   BIG NUMBER
   ============================================================ */
.big-number {
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 900;
  font-size: clamp(2.2rem, 12vw, 3.2rem);
  color: #1CA694;
  line-height: 1;
}

.card.defeat .big-number  { color: #F0544F; }
.card.complete .big-number { color: #F7A43B; }

/* ============================================================
   LEVEL BADGE + STATS
   ============================================================ */
.level-badge {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  color: #F0544F;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.85;
}

.ov-stats {
  display: flex;
  justify-content: space-around;
  background: rgba(0,0,0,0.04);
  border-radius: 14px;
  padding: 0.75rem 0.5rem;
}

.ov-stats div {
  text-align: center;
}

.ov-stats .mono {
  font-size: 1rem;
  display: block;
  margin-top: 0.15rem;
}

.ov-hint {
  font-size: 0.82rem;
  color: #999;
  line-height: 1.5;
  padding: 0.6rem 0.75rem;
  background: rgba(0,0,0,0.03);
  border-radius: 12px;
}

/* Star rating */
.ov-stars {
  font-size: 1.5rem;
  letter-spacing: 0.04em;
  line-height: 1;
}

/* Bonus display */
.bonus-line {
  font-size: 0.85rem;
  color: #F7A43B;
  font-weight: 700;
  background: rgba(247,164,59,0.08);
  border-radius: 10px;
  padding: 0.4rem 0.6rem;
}

.bonus-line.hidden { display: none; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 1.1rem;
  padding: 0.8rem 1.6rem;
  background: linear-gradient(135deg, #F0544F 0%, #ff6b6b 100%);
  color: #fff;
  border: none;
  border-radius: 16px;
  box-shadow:
    0 4px 14px rgba(240,84,79,0.35),
    inset 0 1px 0 rgba(255,255,255,0.2);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn-primary:active {
  transform: scale(0.96);
  box-shadow: 0 2px 8px rgba(240,84,79,0.25);
}

.btn-secondary {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 0.88rem;
  color: #bbb;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.2rem;
  transition: color 0.15s;
}

.btn-secondary:active { color: #888; }

/* ============================================================
   ACHIEVEMENT TOAST
   ============================================================ */
.achievement-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(26,26,26,0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #fff;
  padding: 0.6rem 1.3rem;
  border-radius: 24px;
  font-size: 0.88rem;
  font-weight: 700;
  z-index: 300;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  animation: toast-in-out 3s ease forwards;
}

@keyframes toast-in-out {
  0%   { opacity: 0; transform: translateX(-50%) translateY(12px); }
  12%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  75%  { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-8px); }
}

/* ============================================================
   DEFEAT / GAMEOVER — semi-transparent so bombs on board stay visible
   ============================================================ */
#overlay-defeat,
#overlay-gameover {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: rgba(0,0,0,0.28);
  align-items: flex-end;
  padding-bottom: 2rem;
}

#overlay-defeat .card,
#overlay-gameover .card {
  background: rgba(12,18,28,0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  max-width: 420px;
  width: 100%;
}

#overlay-defeat .card h2,
#overlay-gameover .card h2 { color: #F0544F; }

#overlay-defeat .card p,
#overlay-gameover .card p { color: rgba(255,255,255,0.72); }

#overlay-defeat .card strong,
#overlay-gameover .card strong { color: #fff; }

#overlay-defeat .btn-secondary,
#overlay-gameover .btn-secondary { color: rgba(255,255,255,0.45); }

/* ============================================================
   XRAY SELECTION MODAL
   ============================================================ */
.xray-modal {
  position: fixed;
  inset: 0;
  background: rgba(26,26,26,0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 250;
  padding: 1rem;
}

.xray-modal .card {
  gap: 0.5rem;
}

.xray-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.xray-btn {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.5rem;
  border-radius: 10px;
  background: rgba(0,0,0,0.04);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  transition: transform 0.1s;
}

.xray-btn:active { transform: scale(0.94); }

/* ============================================================
   POWERUP CHOICE OVERLAY
   ============================================================ */
.powerup-choice-btns {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.btn-powerup-choice {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  padding: 0.85rem 1.2rem;
  border: none;
  border-radius: 16px;
  background: rgba(255,255,255,0.7);
  box-shadow:
    0 2px 10px rgba(0,0,0,0.07),
    inset 0 1px 0 rgba(255,255,255,0.9);
  text-align: left;
  transition: transform 0.12s ease;
  line-height: 1.35;
}

.btn-powerup-choice:active {
  transform: scale(0.97);
}

.btn-powerup-choice small {
  font-size: 0.72rem;
  font-weight: 500;
  color: #999;
  display: block;
}

.powerup-choice-subtitle {
  font-size: 0.82rem;
  color: #999;
  margin-top: -0.2rem;
}

/* ============================================================
   HOW TO PLAY OVERLAY
   ============================================================ */
.howto-card {
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  max-width: 400px;
  position: relative;
}

.howto-card h2 {
  margin-bottom: 1rem;
}

.btn-howto-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1rem;
  font-weight: 700;
  color: #aaa;
  background: rgba(0,0,0,0.06);
  border: none;
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.howto-section {
  display: flex;
  gap: 0.9rem;
  align-items: flex-start;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

.howto-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0.5rem;
}

.howto-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  width: 2.2rem;
  text-align: center;
  line-height: 1.5;
  font-weight: 900;
  color: #F7A43B;
}

.howto-section strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 0.2rem;
}

.howto-section p {
  font-size: 0.82rem;
  color: #555;
  line-height: 1.5;
}

.howto-powerup-list {
  list-style: none;
  margin-top: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.howto-powerup-list li {
  font-size: 0.8rem;
  color: #555;
}

/* ============================================================
   ADJACENCY DIAGRAM (mini board demo in how-to)
   ============================================================ */
.howto-adj-demo {
  display: grid;
  grid-template-columns: repeat(3, 30px);
  gap: 3px;
  margin: 0.55rem auto 0.3rem;
  width: fit-content;
}

.had-tile {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.had-tile.had-safe {
  background: radial-gradient(circle at 35% 28%,
    rgba(255,255,255,0.95) 0%,
    rgba(120,200,255,0.9) 36%,
    rgba(20,110,200,1) 100%
  );
}

.had-tile.had-spot {
  background: radial-gradient(circle at 35% 28%,
    rgba(255,255,255,0.9) 0%,
    rgba(255,140,130,0.92) 38%,
    rgba(185,35,32,1) 100%
  );
  font-size: 0.65rem;
}

.had-tile.had-center {
  background: radial-gradient(circle at 35% 28%,
    rgba(255,255,255,0.95) 0%,
    rgba(80,230,200,0.9) 38%,
    rgba(10,110,95,1) 100%
  );
  color: #fff;
  font-size: 0.85rem;
}

.had-caption {
  font-size: 0.72rem;
  color: #777;
  text-align: center;
  line-height: 1.4;
}
