/* Match Three — board, HUD, boosters, theme pieces. */

.m3-hud {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px;
  background: var(--bg-2);
  border-radius: var(--radius);
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.m3-hud-block { display: flex; flex-direction: column; gap: 2px; min-width: 60px; }
.m3-hud-label { color: var(--fg-dim); font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.5px; }
.m3-hud-value { font-weight: 700; font-variant-numeric: tabular-nums; }
.m3-hud-goal {
  flex: 1;
  min-width: 200px;
  font-size: 0.88em;
  padding: 6px 10px;
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius);
  color: var(--fg);
}
.m3-hud-actions { display: flex; gap: 8px; }
.m3-hud .spacer { flex: 1; }

.m3-board-wrap {
  display: flex; justify-content: center; align-items: center;
  padding: 8px;
  background: var(--bg-2);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.m3-board {
  display: grid;
  grid-template-columns: repeat(var(--m3-cols, 7), 1fr);
  grid-template-rows: repeat(var(--m3-rows, 7), 1fr);
  gap: 4px;
  width: min(100%, 640px);
  aspect-ratio: 1 / 1;
  position: relative;
}
.m3-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.m3-cell.is-hole { background: transparent; cursor: default; }
.m3-cell.is-focused-cell { box-shadow: inset 0 0 0 3px var(--focus); }
.m3-cell.is-selected {
  box-shadow: 0 0 0 3px var(--focus), 0 0 12px rgba(245,197,66,0.5);
  transform: scale(1.05);
  z-index: 2;
}
.m3-cell.is-hint {
  animation: m3-hint 0.6s ease-in-out;
}
@keyframes m3-hint {
  0%, 100% { box-shadow: inset 0 0 0 3px transparent; }
  50% { box-shadow: inset 0 0 0 3px #f5c542, 0 0 12px rgba(245,197,66,0.8); }
}

.m3-piece {
  width: 84%; height: 84%;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.18s ease;
}
.m3-piece svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4)); }
.m3-piece.m3-special-line svg { filter: drop-shadow(0 0 6px rgba(245,197,66,0.8)); }
.m3-piece.m3-special-colour svg { filter: drop-shadow(0 0 8px rgba(255,255,255,0.9)); }
.m3-piece.m3-special-area svg { filter: drop-shadow(0 0 6px rgba(226,90,154,0.9)); }

.m3-overlay {
  position: absolute; inset: 0;
  border-radius: 8px;
  pointer-events: none;
}
.m3-overlay-jelly { background: rgba(200, 80, 200, 0.35); box-shadow: inset 0 0 0 2px rgba(200,80,200,0.6); }
.m3-overlay-ice { background: rgba(140, 200, 255, 0.30); box-shadow: inset 0 0 0 2px rgba(200,230,255,0.65); }
.m3-overlay-crate {
  background:
    linear-gradient(90deg, transparent 40%, rgba(140,90,40,0.5) 40%, rgba(140,90,40,0.5) 60%, transparent 60%),
    linear-gradient(0deg, transparent 40%, rgba(140,90,40,0.5) 40%, rgba(140,90,40,0.5) 60%, transparent 60%);
  box-shadow: inset 0 0 0 3px #6b4a28;
}
.m3-overlay-lock {
  box-shadow: inset 0 0 0 3px #c0c8d4;
  border-radius: 8px;
}
.m3-overlay-lock::before {
  content: "";
  position: absolute; top: 18%; left: 42%;
  width: 16%; height: 22%;
  border: 3px solid #c0c8d4;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
}

.m3-booster-bar {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 8px;
  background: var(--bg-2);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.m3-booster-btn {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.10);
  font-weight: 600;
}
.m3-booster-btn.is-used { opacity: 0.45; }
.m3-booster-btn:disabled { cursor: not-allowed; }

.m3-footer {
  text-align: center;
  padding: 8px;
  color: var(--fg-dim);
  font-size: 0.88em;
}
.m3-footer .tip { color: var(--fg-dim); }

@media (max-width: 700px) {
  .m3-board { width: 100%; }
  .m3-hud { padding: 6px 8px; gap: 8px; }
  .m3-board-wrap { padding: 4px; }
  .m3-cell { border-radius: 6px; }
}

/* Focus ring on cells via the suite's [data-focusable]?  The cells are not
   individual focusables (the board owns focus), so we draw our own ring. */
.m3-board:focus .m3-cell.is-focused-cell::after {
  content: "";
  position: absolute; inset: -2px;
  border: 3px solid var(--focus);
  border-radius: 10px;
  pointer-events: none;
}

/* FLUX-ART-2026-11-17: match-3 garden backdrop, dark tint keeps pieces readable */
.m3-board { background-image: linear-gradient(rgba(9,7,26,0.74), rgba(9,7,26,0.74)), url("../img/bg-match3-backdrop.jpg"); background-size: cover; background-position: center; }
