/* games/match3/style.css */

/* ── 棋盤 ── */
.match3-board {
  display: grid;
  gap: 3px;
  user-select: none;
  touch-action: none;
  border-radius: var(--border-radius);
  background: rgba(0, 0, 0, 0.08);
  padding: 4px;
}

[data-theme="dark"] .match3-board {
  background: rgba(255, 255, 255, 0.06);
}

/* ── 寶石格 ── */
.gem-cell {
  aspect-ratio: 1;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.2s ease, background 0.12s ease;
  position: relative;
  background: var(--color-bg-card);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
}

.gem-cell:hover {
  transform: scale(1.08);
}

.gem-cell.selected {
  transform: scale(1.12);
  outline: 3px solid var(--color-primary);
  outline-offset: -2px;
  z-index: 2;
  animation: gem-pulse 0.6s infinite alternate;
}

.gem-cell.hint {
  animation: gem-hint 0.5s ease infinite alternate;
}

.gem-cell.matched {
  animation: gem-pop 0.3s ease forwards;
}

.gem-cell.falling {
  animation: gem-fall 0.25s ease forwards;
}

.gem-cell.swapping {
  transition: transform 0.2s ease;
}

/* ── 動畫 ── */
@keyframes gem-pulse {
  from { box-shadow: 0 0 0 0 rgba(212, 56, 13, 0.35); }
  to   { box-shadow: 0 0 0 8px rgba(212, 56, 13, 0); }
}

@keyframes gem-hint {
  from { transform: scale(1); }
  to   { transform: scale(1.15); }
}

@keyframes gem-pop {
  0%   { transform: scale(1); opacity: 1; }
  50%  { transform: scale(1.3); opacity: 0.6; }
  100% { transform: scale(0); opacity: 0; }
}

@keyframes gem-fall {
  from { transform: translateY(-100%); opacity: 0.5; }
  to   { transform: translateY(0);     opacity: 1; }
}

/* ── 連擊提示 ── */
.combo-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  font-weight: 900;
  color: var(--color-primary);
  pointer-events: none;
  animation: combo-rise 0.8s ease forwards;
  z-index: 10;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

@keyframes combo-rise {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
  50%  { opacity: 1; transform: translate(-50%, -80%) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(0.8); }
}

/* ── 響應式 ── */
@media (max-width: 480px) {
  .gem-cell {
    font-size: 1.4rem;
    border-radius: 8px;
  }
  .match3-board {
    gap: 2px;
    padding: 3px;
  }
}

@media (max-width: 360px) {
  .gem-cell {
    font-size: 1.2rem;
  }
}
