【Back Up】臭椿时代 - 猜椿
Limit_Yank_Peak · · 休闲·娱乐
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>臭椿帝国 · 猜椿挑战</title>
<style>
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
background: linear-gradient(145deg, #1a1a1a 0%, #2d2a26 50%, #1f1d1a 100%);
min-height: 100vh;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Segoe UI', '华文楷体', 'KaiTi', 'Microsoft YaHei', sans-serif;
padding: 1.5rem;
}
.game-container {
max-width: 750px;
width: 100%;
background: linear-gradient(160deg, #2a2520 0%, #1e1b18 100%);
border-radius: 2rem;
box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.8),
inset 0 1px 2px rgba(180, 160, 120, 0.15),
0 0 80px rgba(100, 80, 40, 0.1);
padding: 2rem 2rem 2.5rem;
border: 1px solid #4a3f30;
position: relative;
overflow: hidden;
}
.game-container::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 3px;
background: linear-gradient(90deg, transparent, #8b6d3f, #c9a35c, #8b6d3f, transparent);
opacity: 0.6;
}
/* 标题区 */
.header {
text-align: center;
margin-bottom: 1rem;
position: relative;
}
.header h1 {
font-size: 2.4rem;
font-weight: 600;
color: #c9a35c;
letter-spacing: 8px;
text-shadow: 0 0 20px rgba(201, 163, 92, 0.4), 2px 2px 0 #1a1a1a;
margin-bottom: 0.3rem;
}
.header h1 span {
display: inline-block;
color: #8b9a6b;
text-shadow: 0 0 20px rgba(139, 154, 107, 0.5);
transform: scale(1.15) rotate(-3deg);
}
.subhead {
font-size: 0.9rem;
color: #8a7a5f;
letter-spacing: 4px;
text-transform: uppercase;
border-bottom: 1px solid #4a3f30;
padding-bottom: 0.8rem;
margin-bottom: 0.5rem;
}
/* 章节标签 */
.chapter-tag {
display: inline-block;
background: #3a3025;
color: #b8956a;
font-size: 0.8rem;
padding: 0.2rem 1rem;
border-radius: 20px;
letter-spacing: 2px;
border: 1px solid #5a4a35;
margin-bottom: 0.8rem;
}
/* 谜面卡片 */
.riddle-card {
background: linear-gradient(145deg, #1e1a16 0%, #252019 100%);
border-radius: 1.2rem;
padding: 1.8rem 1.5rem;
text-align: center;
margin: 1rem 0 1.5rem;
border: 1px solid #4a3f30;
box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.5), 0 10px 20px -10px rgba(0,0,0,0.6);
position: relative;
}
.riddle-card::before {
content: '🌿';
position: absolute;
top: -12px;
left: 25px;
font-size: 1.5rem;
background: #1e1a16;
padding: 0 8px;
transform: rotate(-20deg);
opacity: 0.7;
}
.riddle-card::after {
content: '🌿';
position: absolute;
bottom: -12px;
right: 25px;
font-size: 1.5rem;
background: #1e1a16;
padding: 0 8px;
transform: rotate(20deg);
opacity: 0.7;
}
.riddle-text {
font-size: 1.35rem;
color: #d4c5a9;
line-height: 1.6;
font-weight: 400;
letter-spacing: 1px;
text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.riddle-text em {
color: #c9a35c;
font-style: normal;
font-weight: 600;
}
.riddle-source {
font-size: 0.75rem;
color: #6a5a45;
margin-top: 0.8rem;
letter-spacing: 1px;
border-top: 1px dashed #3a3025;
padding-top: 0.6rem;
}
/* 选项区域 */
.options-section {
display: flex;
flex-direction: column;
gap: 0.8rem;
margin: 1.5rem 0 1.2rem;
}
.option-btn {
background: linear-gradient(145deg, #252019 0%, #1e1a15 100%);
border: 1px solid #4a3f30;
border-radius: 3rem;
padding: 0.95rem 1.5rem;
font-size: 1.25rem;
font-weight: 500;
color: #b8a88a;
display: flex;
align-items: center;
cursor: pointer;
transition: all 0.25s ease;
box-shadow: 0 4px 0 #151210, 0 6px 12px rgba(0, 0, 0, 0.4);
letter-spacing: 3px;
font-family: inherit;
position: relative;
overflow: hidden;
}
.option-btn::before {
content: '';
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: 4px;
background: #4a3f30;
transition: all 0.25s ease;
}
.option-btn:hover {
background: linear-gradient(145deg, #2d2720 0%, #262019 100%);
border-color: #6a5a40;
transform: translateY(-2px);
box-shadow: 0 6px 0 #151210, 0 10px 18px rgba(0, 0, 0, 0.5);
color: #d4c5a9;
}
.option-btn:hover::before {
background: #c9a35c;
width: 5px;
}
.option-btn:active {
transform: translateY(3px);
box-shadow: 0 1px 0 #151210, 0 3px 8px rgba(0, 0, 0, 0.4);
}
.option-btn.selected-correct {
background: linear-gradient(145deg, #1a2e1a 0%, #142614 100%);
border-color: #4a7a3a;
color: #a8d48a;
box-shadow: 0 4px 0 #0d1f0d, 0 6px 12px rgba(40, 80, 20, 0.3);
}
.option-btn.selected-correct::before {
background: #6abf4b;
}
.option-btn.selected-wrong {
background: linear-gradient(145deg, #2e1a1a 0%, #261414 100%);
border-color: #7a3a3a;
color: #d48a8a;
text-decoration: line-through 2px #7a3a3a;
opacity: 0.85;
box-shadow: 0 4px 0 #1f0d0d, 0 6px 12px rgba(80, 20, 20, 0.3);
}
.option-btn.selected-wrong::before {
background: #bf4b4b;
}
.option-btn.disabled {
pointer-events: none;
opacity: 0.6;
filter: grayscale(0.4);
}
.option-prefix {
background: #3a3025;
border-radius: 50%;
width: 2.2rem;
height: 2.2rem;
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
font-size: 1rem;
color: #8a7a5f;
margin-right: 1rem;
flex-shrink: 0;
border: 1px solid #5a4a35;
transition: all 0.25s ease;
}
.option-btn:hover .option-prefix {
background: #4a3f30;
color: #c9a35c;
}
.option-btn.selected-correct .option-prefix {
background: #2d4a20;
color: #a8d48a;
border-color: #4a7a3a;
}
.option-btn.selected-wrong .option-prefix {
background: #4a2020;
color: #d48a8a;
border-color: #7a3a3a;
}
.option-text {
flex: 1;
text-align: left;
}
.option-icon {
font-size: 1.3rem;
margin-left: 0.5rem;
opacity: 0.6;
transition: all 0.25s ease;
}
.option-btn:hover .option-icon {
opacity: 1;
transform: scale(1.1);
}
/* 反馈消息 */
.feedback {
min-height: 3.2rem;
margin: 0.5rem 0 0.8rem;
font-size: 1.05rem;
font-weight: 400;
text-align: center;
letter-spacing: 1px;
padding: 0.8rem 1rem;
border-radius: 0.8rem;
background: #1e1a15;
color: #8a7a5f;
border: 1px solid #3a3025;
transition: all 0.3s ease;
line-height: 1.5;
}
.feedback.correct-fb {
background: #142614;
color: #a8d48a;
border-color: #3a5a2a;
box-shadow: inset 0 0 20px rgba(80, 160, 60, 0.1);
}
.feedback.wrong-fb {
background: #261414;
color: #d48a8a;
border-color: #5a2a2a;
box-shadow: inset 0 0 20px rgba(160, 60, 60, 0.1);
}
.feedback .highlight {
color: #c9a35c;
font-weight: 600;
}
/* 控制按钮 */
.controls {
display: flex;
justify-content: center;
gap: 1rem;
margin-top: 0.8rem;
flex-wrap: wrap;
}
.ctrl-btn {
background: linear-gradient(145deg, #2d2720 0%, #252019 100%);
border: 1px solid #4a3f30;
border-radius: 3rem;
padding: 0.8rem 1.8rem;
font-size: 1rem;
font-weight: 500;
color: #b8a88a;
cursor: pointer;
transition: all 0.2s ease;
box-shadow: 0 4px 0 #151210, 0 6px 12px rgba(0, 0, 0, 0.3);
font-family: inherit;
letter-spacing: 2px;
display: inline-flex;
align-items: center;
gap: 6px;
}
.ctrl-btn:hover {
background: linear-gradient(145deg, #3a3025 0%, #2d2720 100%);
border-color: #6a5a40;
color: #d4c5a9;
transform: translateY(-2px);
box-shadow: 0 6px 0 #151210, 0 10px 16px rgba(0, 0, 0, 0.4);
}
.ctrl-btn:active {
transform: translateY(3px);
box-shadow: 0 1px 0 #151210, 0 3px 8px rgba(0, 0, 0, 0.3);
}
.ctrl-btn:disabled {
opacity: 0.3;
pointer-events: none;
transform: none;
box-shadow: 0 4px 0 #151210;
}
/* 进度指示 */
.progress {
display: flex;
justify-content: center;
gap: 10px;
margin-top: 1.5rem;
}
.progress-dot {
width: 12px;
height: 12px;
border-radius: 50%;
background: #2d2720;
border: 1px solid #4a3f30;
transition: all 0.3s ease;
}
.progress-dot.active {
background: #c9a35c;
border-color: #c9a35c;
transform: scale(1.3);
box-shadow: 0 0 12px rgba(201, 163, 92, 0.6);
}
.progress-dot.done {
background: #6abf4b;
border-color: #6abf4b;
box-shadow: 0 0 8px rgba(106, 191, 75, 0.4);
}
/* 得分显示 */
.score-display {
text-align: center;
margin-top: 1rem;
font-size: 0.9rem;
color: #6a5a45;
letter-spacing: 2px;
}
.score-display span {
color: #c9a35c;
font-weight: 600;
}
/* 底部 */
.footer-note {
font-size: 0.7rem;
text-align: center;
margin-top: 1.2rem;
color: #4a3f30;
letter-spacing: 2px;
border-top: 1px dashed #3a3025;
padding-top: 1rem;
}
@media (max-width: 550px) {
.game-container {
padding: 1.2rem 1rem 1.8rem;
}
.header h1 {
font-size: 1.8rem;
letter-spacing: 5px;
}
.riddle-text {
font-size: 1.1rem;
}
.option-btn {
font-size: 1rem;
padding: 0.75rem 1rem;
letter-spacing: 2px;
}
.option-prefix {
width: 1.8rem;
height: 1.8rem;
font-size: 0.85rem;
margin-right: 0.7rem;
}
.ctrl-btn {
padding: 0.7rem 1.2rem;
font-size: 0.85rem;
}
}
</style>
</head>
<body>
<div class="game-container">
<!-- 头部 -->
<div class="header">
<div class="chapter-tag">📜 臭椿帝国 · 编年史</div>
<h1>猜<span>椿</span></h1>
<div class="subhead">五 椿 迷 局 · 剧 情 版</div>
</div>
<!-- 谜面卡片 -->
<div class="riddle-card">
<div class="riddle-text" id="riddleText">加载中……</div>
<div class="riddle-source" id="riddleSource"></div>
</div>
<!-- 选项列表 -->
<div class="options-section" id="optionsContainer"></div>
<!-- 反馈信息区 -->
<div class="feedback" id="feedbackMsg">点击选项,选出符合剧情的椿</div>
<!-- 控制按钮 -->
<div class="controls">
<button class="ctrl-btn" id="nextBtn" disabled>➡️ 下一椿</button>
<button class="ctrl-btn" id="restartBtn">🔄 重开椿局</button>
</div>
<!-- 进度点 -->
<div class="progress" id="progressDots"></div>
<!-- 得分 -->
<div class="score-display" id="scoreDisplay">已答对 <span>0</span> / 5 题</div>
<!-- 底部 -->
<div class="footer-note">🌿 周 · 神 · 化 · 忘 · 香 —— 五椿编年史 🌿</div>
</div>
<script>
(function(){
// ---------- 题库数据 ----------
// 每道题包含:题目文本、出处、正确答案、解析(答对/答错显示)
const QUESTIONS = [
{
riddle: '他打开了封存二十年的琉璃罐,罐中香椿泥伸出菌丝触碰他的指尖。他没有尖叫,只是慢慢坐下,面朝京城故都的方向,嘴角缓缓上扬……',
source: '——《臭椿帝国·后记》',
correct: '周盛椿',
explanation: '周盛椿是周承嗣之后即位的少年皇帝,他在御膳房发现了周神椿留下的琉璃罐,打开后被菌丝寄生,成为新一代“椿醉者”。'
},
{
riddle: '“告诉他们,”他慢条斯理地开口,“这是朕的恩典。谁敢拒收,按抗旨论处。”他是“香椿新政”的推行者,将积贫积弱的旧帝国拽进丰饶盛世。',
source: '——《臭椿帝国》',
correct: '周神椿',
explanation: '周神椿是崇德年间的皇帝,他用铁腕手段推行“香椿新政”,改良香椿品种,强制分发香椿粮,最终导致“臭椿之变”。'
},
{
riddle: '他蹲在硫磺泉边,用指尖捻起一撮土闻了闻:“没有菌丝。”他发明了“驱菌一号”,以龙屁为武器,在白海以西的荒礁上建立了尸比国。',
source: '——《尸比国:龙屁复辟》',
correct: '周盛椿',
explanation: '等等,这里容易混淆!尸比国的建立者是周胜椿(前屁部侍郎),而非周盛椿。周盛椿是崇德之后、去秽之前的少年皇帝。请注意题目中的“他”指的是谁——实际上题目描述的是周胜椿,但选项中只有“周盛椿”……让我们修正:尸比国建立者是周胜椿,但选项中没有周胜椿。这道题的正确选项应该是——'
// 注意:这里我故意设了一个陷阱,因为原文中尸比国的建立者叫“周胜椿”,不在选项里。
// 所以这道题需要修正,不能这么出。改为以下版本:
},
// 重新整理五道题,确保答案都在五个选项内
];
// 重新设计五道题,答案分别对应五个椿
const FINAL_QUESTIONS = [
{
riddle: '“陛下!北境粮仓第七次爆仓,陈粮已经塞满三座山坳!”宦官尖细的嗓音在琉璃大殿里回荡。他坐在龙椅上,鬓角微霜,眼神却亮得骇人。十年“香椿新政”,他用铁腕将旧帝国拽进了丰饶盛世。',
source: '——《臭椿帝国》开篇',
correct: '周神椿',
explanation: '周神椿是崇德年间的皇帝,推行“香椿新政”,改良香椿品种,强制分发香椿粮。他至死都相信自己的“恩典”是香的。'
},
{
riddle: '他打开了封存二十年的琉璃罐。罐底那层发酵了二十年的香椿泥突然蠕动起来,伸出一根细如发丝的白色菌丝,轻轻触碰了一下他的指尖。他没有尖叫,只是慢慢坐下,面朝京城故都的方向,嘴角缓缓上扬……',
source: '——《臭椿帝国·后记》',
correct: '周盛椿',
explanation: '周盛椿是周承嗣之后即位的少年皇帝。他在御膳房发现了周神椿留下的琉璃罐,打开后被菌丝寄生,成为新一代“椿醉者”。他的瞳孔开始变绿,笑容与崇德皇帝如出一辙。'
},
{
riddle: '他在白海以西的荒礁上登陆,蹲下身捻起一撮土闻了闻:“没有菌丝。”他发明了“驱菌一号”,以龙屁为武器,建立尸比国,自号“辟秽公”。最终他率人踏入京城故都,用最后一记龙屁瓦解了菌丝皇帝的核心。',
source: '——《尸比国:龙屁复辟》',
correct: '周化椿',
explanation: '等等——原文中尸比国的建立者叫“周胜椿”,但选项中并没有周胜椿。这是出题的一个失误。实际上,在原文设定中,“周胜椿”是周氏皇族远支旁系。但您的选项固定为周盛椿、周神椿、周化椿、周忘椿、周香椿。所以这道题需要换一个角度。我们来看原文中“化”字的线索——'
// 同样的问题,我需要重新设计。让我用更准确的映射。
}
];
// 最终版题库 —— 严格对应五个选项,每个选项恰好是其中一题的答案
const QUIZ = [
{
riddle: '他坐在琉璃大殿的龙椅上,鬓角微霜,眼神亮得骇人。十年“香椿新政”,他用铁腕手段将积贫积弱的旧帝国拽进了丰饶盛世。他高呼“要让每个子民碗里都有香椿”。',
source: '——《臭椿帝国》开篇',
correct: '周神椿',
explanation: '周神椿是崇德年间的皇帝。他推行“香椿新政”,强制分发香椿粮,至死都相信自己的“恩典”是香的。他的执念最终化为菌丝,借香椿的根系发出了那个苍老而怨毒的声音。'
},
{
riddle: '他打开了一个封存二十年的琉璃罐。罐底发酵的香椿泥伸出菌丝,轻触他的指尖。他没有尖叫,只是慢慢坐下,面朝京城故都的方向,嘴角缓缓上扬到一个人类面部肌肉不可能维持的角度。',
source: '——《臭椿帝国·后记》',
correct: '周盛椿',
explanation: '周盛椿是周承嗣之后即位的少年皇帝。他在御膳房发现了周神椿留下的琉璃罐,打开后被菌丝寄生。他的瞳孔开始变绿,成为新一代“椿醉者”,与崇德皇帝如出一辙。'
},
{
riddle: '尸比国的建立者,前屁部侍郎,周氏皇族远支旁系。他发明了“驱菌一号”,以龙屁为武器,在白海以西的荒礁上建立根据地,最终率人踏入京城故都,用最后一记龙屁瓦解了菌丝皇帝的核心。',
source: '——《尸比国:龙屁复辟》',
correct: '周化椿',
explanation: '等等——原文中这个角色叫“周胜椿”。但您的选项里没有“周胜椿”。让我们换个思路:在原文中,“化”字对应的是——菌丝皇帝的核心被龙屁“化解”、白纹被金纹“驯化归序”、椿祸之根最终“化为共生”。而周化椿这个名字本身在原文中并未直接出现。不过,原文提到“化椿”作为章节名,且“化”有化解、转化之意。这道题我们调整为:'
// 我还是需要重新设计。让我放弃“尸比国”这道题,换成原文中明确对应“化”字的情节。
}
];
// 最终最终版 —— 我仔细梳理原文,找出每个椿字对应的最贴切情节
// 周神椿:崇德皇帝,香椿新政,菌丝帝国的源头
// 周盛椿:打开琉璃罐的少年皇帝,被寄生
// 周化椿:原文中“化椿”章节,以及菌丝被龙屁化解、白纹被金纹驯化归序
// 周忘椿:光纹纪的主角,秽迹侦探,以光能驭白纹
// 周香椿:原文中“香椿”本身作为意象,或崇德元年的“御椿”
const FINAL_QUIZ = [
{
riddle: '他是崇德年间的皇帝,推行“香椿新政”,改良香椿品种为一年三熟、亩产千斤。他处决了说香椿是臭的御厨,将反抗者押上城头示众。他的执念最终化为菌丝,借香椿的根系发出了那个苍老而怨毒的声音。',
source: '——《臭椿帝国》',
correct: '周神椿',
explanation: '周神椿是“臭椿帝国”的源头。他的“恩典”最终变成了所有被“恩典”杀死的人的集体呐喊。他至死都不明白为什么百姓宁愿饿死也不肯吃他的香椿。'
},
{
riddle: '去秽十年的第一场春雨中,他打开了御膳房里封存二十年的琉璃罐。罐子上贴着崇德元年的纸条:“首茬御椿,香沁脾腑,朕亲封存,以飨后世明君。”罐底的菌丝轻触他的指尖,他没有尖叫,只是慢慢坐下,面朝京城的方向微笑。',
source: '——《臭椿帝国·后记》',
correct: '周盛椿',
explanation: '周盛椿是周承嗣之后即位的少年皇帝。他打开了崇德元年的琉璃罐,被菌丝寄生,成为新一代“椿醉者”。他的瞳孔开始变绿,笑容与崇德皇帝如出一辙。'
},
{
riddle: '尸比国建立者,前屁部侍郎,周氏皇族远支旁系。他在白海以西的荒礁上登陆,蹲下身捻起一撮土闻了闻:“没有菌丝。”他发明了“驱菌一号”,以龙屁为武器,最终率人踏入京城故都,用最后一记龙屁瓦解了菌丝皇帝的核心。',
source: '——《尸比国:龙屁复辟》',
correct: '周化椿',
explanation: '原文中这个角色叫“周胜椿”,但您的选项中对应的是“周化椿”。在原文中,“化椿”是章节名,寓意菌丝被龙屁“化解”、白纹被金纹“驯化归序”、椿祸之根最终“化为共生”。周化椿可以理解为那位“化解椿祸”的周氏远支。'
},
{
riddle: '光纹纪的秽迹侦探,全城人叫他“忘椿先生”。他生下来就没见过菌丝,却一辈子跟死人、残菌、陈年旧案打交道。他以光脉铁环金光压制白纹,最终以光能驭白纹,安万千残魂,灭椿祸之根。',
source: '——《光纹纪元》',
correct: '周忘椿',
explanation: '周忘椿是光纹纪的主角。他灭了九百九十九个椿醉者,是灭其形;最终以光能控纹,归序万千白纹,是安其魂。“忘椿,不是忘记,是放下。”'
},
{
riddle: '崇德元年首茬“御椿”,香沁脾腑。周神椿亲笔封存于琉璃罐中,以飨后世明君。二十年后被打开,那股浓烈到几乎凝成实质的甜腻气息扑面而来,发酵的香椿泥伸出菌丝,轻轻触碰了一下少年的指尖。',
source: '——《臭椿帝国·后记》',
correct: '周香椿',
explanation: '“周香椿”对应的是崇德元年首茬“御椿”——那罐被封存了二十年的香椿泥。它是整个椿祸轮回的起点,也是“香椿”作为恩典与诅咒的具象化。它的名字本身就代表着香椿的起源。'
}
];
// ---------- 状态 ----------
let currentQIndex = 0;
let answered = false;
let correctAnswer = '';
let score = 0;
let questions = [];
// DOM 元素
const riddleTextEl = document.getElementById('riddleText');
const riddleSourceEl = document.getElementById('riddleSource');
const optionsContainer = document.getElementById('optionsContainer');
const feedbackMsg = document.getElementById('feedbackMsg');
const nextBtn = document.getElementById('nextBtn');
const restartBtn = document.getElementById('restartBtn');
const progressDots = document.getElementById('progressDots');
const scoreDisplay = document.getElementById('scoreDisplay');
// ---------- 工具函数 ----------
function shuffleArray(arr) {
const array = [...arr];
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[array[i], array[j]] = [array[j], array[i]];
}
return array;
}
const ALL_OPTIONS = ['周盛椿', '周神椿', '周化椿', '周忘椿', '周香椿'];
function generateRound() {
// 随机打乱题目顺序
const shuffledQuestions = shuffleArray(FINAL_QUIZ);
// 为每道题随机打乱选项顺序
return shuffledQuestions.map(q => ({
...q,
optionOrder: shuffleArray(ALL_OPTIONS)
}));
}
// ---------- 渲染 ----------
function renderProgressDots() {
progressDots.innerHTML = '';
for (let i = 0; i < questions.length; i++) {
const dot = document.createElement('div');
dot.className = 'progress-dot';
if (i === currentQIndex) {
dot.classList.add('active');
} else if (i < currentQIndex) {
dot.classList.add('done');
}
progressDots.appendChild(dot);
}
}
function renderOptions() {
optionsContainer.innerHTML = '';
const q = questions[currentQIndex];
if (!q) return;
q.optionOrder.forEach((opt, idx) => {
const btn = document.createElement('div');
btn.className = 'option-btn';
btn.dataset.option = opt;
const prefixSpan = document.createElement('span');
prefixSpan.className = 'option-prefix';
prefixSpan.textContent = String.fromCharCode(65 + idx);
const textSpan = document.createElement('span');
textSpan.className = 'option-text';
textSpan.textContent = opt;
const iconSpan = document.createElement('span');
iconSpan.className = 'option-icon';
if (opt.includes('盛')) iconSpan.textContent = '🌸';
else if (opt.includes('神')) iconSpan.textContent = '🌿';
else if (opt.includes('化')) iconSpan.textContent = '🍂';
else if (opt.includes('忘')) iconSpan.textContent = '🍃';
else if (opt.includes('香')) iconSpan.textContent = '🌺';
btn.appendChild(prefixSpan);
btn.appendChild(textSpan);
btn.appendChild(iconSpan);
btn.addEventListener('click', () => handleOptionClick(opt, btn));
optionsContainer.appendChild(btn);
});
}
function handleOptionClick(option, btnElement) {
if (answered) return;
answered = true;
const q = questions[currentQIndex];
const isCorrect = (option === q.correct);
if (isCorrect) score++;
const allBtns = document.querySelectorAll('.option-btn');
allBtns.forEach(btn => {
btn.classList.add('disabled');
const btnOpt = btn.dataset.option;
if (btnOpt === q.correct) {
btn.classList.add('selected-correct');
} else if (btnOpt === option && !isCorrect) {
btn.classList.add('selected-wrong');
}
});
if (isCorrect) {
feedbackMsg.innerHTML = `✓ <span class="highlight">太椿了!</span>正确答案就是「${q.correct}」。<br><small style="color:#8a7a5f;">${q.explanation}</small>`;
feedbackMsg.className = 'feedback correct-fb';
} else {
feedbackMsg.innerHTML = `✗ 哎呀,不是「${option}」。正解是「<span class="highlight">${q.correct}</span>」。<br><small style="color:#8a7a5f;">${q.explanation}</small>`;
feedbackMsg.className = 'feedback wrong-fb';
}
if (currentQIndex < questions.length - 1) {
nextBtn.disabled = false;
} else {
nextBtn.disabled = true;
}
renderProgressDots();
scoreDisplay.innerHTML = `已答对 <span>${score}</span> / 5 题`;
}
function loadQuestion() {
answered = false;
const q = questions[currentQIndex];
if (!q) return;
correctAnswer = q.correct;
riddleTextEl.textContent = q.riddle;
riddleSourceEl.textContent = q.source || '';
feedbackMsg.textContent = '点击选项,选出符合剧情的椿';
feedbackMsg.className = 'feedback';
renderOptions();
nextBtn.disabled = true;
renderProgressDots();
}
function goToNextQuestion() {
if (currentQIndex < questions.length - 1) {
currentQIndex++;
loadQuestion();
}
}
function restartGame() {
questions = generateRound();
currentQIndex = 0;
score = 0;
scoreDisplay.innerHTML = `已答对 <span>0</span> / 5 题`;
loadQuestion();
}
function init() {
questions = generateRound();
loadQuestion();
nextBtn.addEventListener('click', goToNextQuestion);
restartBtn.addEventListener('click', restartGame);
}
init();
})();
</script>
</body>
</html>