.board-wrap {
  position: relative;
  width: min(92vw, 480px);
  margin: 0 auto;
}

.mem-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
  aspect-ratio: 1;
  user-select: none;
  padding: 8px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 16px;
}

.mem-cell {
  background: linear-gradient(135deg, #2c3e50, #1e2b3a);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.08s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.mem-cell.disabled {
  cursor: not-allowed;
  pointer-events: none;
}

.mem-cell:not(.disabled):active {
  transform: scale(0.94);
}

.mem-cell.lit {
  background: linear-gradient(135deg, #6c8eff, #4a6cf7);
  border-color: #6c8eff;
  box-shadow: 0 0 28px rgba(108, 142, 255, 0.6), inset 0 0 10px rgba(255, 255, 255, 0.3);
}

.mem-cell.correct {
  background: linear-gradient(135deg, #2ed573, #26b562);
  border-color: #2ed573;
  box-shadow: 0 0 24px rgba(46, 213, 115, 0.5);
}

.mem-cell.wrong {
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
  border-color: #ff6b6b;
  box-shadow: 0 0 24px rgba(255, 107, 107, 0.5);
  animation: cellShake 0.4s ease;
}

@keyframes cellShake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-6px); }
  75%      { transform: translateX(6px); }
}

#status-label {
  transition: color 0.2s;
}

#status-label.watching { color: #6c8eff; }
#status-label.repeating { color: #2ed573; }
#status-label.failed { color: #ff6b6b; }

/* ===== 시작 오버레이 ===== */

.mem-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 41, 0.75);
  backdrop-filter: blur(8px);
  border-radius: 16px;
  z-index: 5;
  transition: opacity 0.2s;
}

.mem-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.overlay-content {
  text-align: center;
  padding: 20px;
}

.overlay-icon {
  font-size: 3.5rem;
  margin-bottom: 12px;
}

.overlay-content h2 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 6px;
}

.overlay-content p {
  color: var(--text-dim);
  margin-bottom: 18px;
}

.hint {
  text-align: center;
  margin-top: 20px;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ===== 결과 모달 ===== */

.result-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 41, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
  animation: fadeIn 0.25s ease;
}

.result-modal.hidden { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.result-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 32px 28px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow);
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-emoji { font-size: 4rem; margin-bottom: 8px; }
.result-card h2 { font-size: 1.5rem; margin-bottom: 8px; }
.result-msg { color: var(--text-dim); margin-bottom: 24px; }

.result-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.result-stats > div {
  background: rgba(255,255,255,0.05);
  padding: 14px;
  border-radius: 12px;
}

.result-stats span {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.result-stats strong {
  font-size: 1.6rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.result-rank {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 8px 0 4px;
  color: var(--accent);
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}

.result-actions .btn {
  padding: 12px 16px;
  text-align: center;
  font-size: 0.95rem;
}
