效果图

如果匹配成功,卡片会保持翻开状态并加分;如果不匹配,卡片会在短暂停留后自动翻回。当所有卡片都匹配成功,胜利提示会弹出。整个过程中,JS 还会避免玩家连续点击、重复翻牌等误操作,让游戏体验更流畅。
<html lang="zh"><head><meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1.0" /><title>记忆游戏</title><linkhref="https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600&display=swap"rel="stylesheet"/><style>:root {--primary: #2d2d2d;--accent: #4caf50;--matched: #2196f3;--bg: #e0e0e0;--shadow-light: #ffffff;--shadow-dark: #bebebe;--font: "Fredoka", sans-serif;}* {margin: 0;padding: 0;box-sizing: border-box;}body {background: var(--bg);font-family: var(--font);display: flex;flex-direction: column;align-items: center;justify-content: center;min-height: 100vh;padding: 20px;}.container {max-width: 600px;width: 100%;background-color: var(--bg);border-radius: 30px;box-shadow: 10px 10px 30px var(--shadow-dark),

