/* ===== 页面路由 ===== */
.page { display: none; }
.page.active { display: block; }

/* ===== 首页模式选择卡片 ===== */
.index-deco {
    display: flex; align-items: center; justify-content: center;
    gap: 12px; margin: 10px 0 20px;
    color: #b5813a; font-size: 15px; letter-spacing: 3px;
}
.index-deco::before, .index-deco::after {
    content: ''; display: block; width: 60px; height: 1px;
    background: linear-gradient(90deg, transparent, #CD853F, transparent);
}
.mode-cards {
    display: flex; justify-content: center; gap: 28px;
    flex-wrap: wrap; margin: 30px 0;
}
.mode-card {
    width: 220px; padding: 28px 20px 22px;
    border-radius: 16px; border: 2px solid #e0c99a;
    background: linear-gradient(160deg, #fffdf8 60%, #fdf0de);
    cursor: pointer; transition: all 0.3s cubic-bezier(.25,.8,.25,1);
    box-shadow: 0 2px 12px rgba(139,69,19,0.08);
    position: relative; overflow: hidden;
}
.mode-card::before {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(205,133,63,0.10), transparent);
    opacity: 0; transition: opacity 0.3s;
}
.mode-card:hover { border-color: #CD853F; transform: translateY(-6px); box-shadow: 0 10px 28px rgba(139,69,19,0.16); }
.mode-card:hover::before { opacity: 1; }
.mode-card .card-icon { font-size: 40px; margin-bottom: 12px; }
.mode-card .card-title { font-size: 22px; font-weight: bold; color: #8B4513; margin-bottom: 6px; }
.mode-card .card-sub { font-size: 15px; color: #b5813a; margin-bottom: 10px; }
.mode-card .card-desc { font-size: 14px; color: #888; line-height: 1.7; }
.mode-card .card-badge {
    display: inline-block; margin-top: 14px; padding: 4px 14px;
    border-radius: 20px; font-size: 13px; font-weight: bold;
    color: #fff; background: linear-gradient(90deg, #CD853F, #8B4513);
}

/* ===== 进度步骤条 ===== */
.progress-steps {
    display: flex; justify-content: center; align-items: center;
    gap: 0; margin: 18px 0 10px; flex-wrap: wrap;
}
.step-item { display: flex; align-items: center; gap: 0; }
.step-wrap { display: flex; flex-direction: column; align-items: center; }
.step-dot {
    width: 28px; height: 28px; border-radius: 50%;
    border: 2px solid #d4b896; background: #faf5f0;
    color: #b5813a; font-size: 13px; font-weight: bold;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.3s; position: relative; z-index: 1;
}
.step-dot.active {
    background: linear-gradient(135deg, #CD853F, #8B4513);
    border-color: #8B4513; color: #fff;
    box-shadow: 0 2px 8px rgba(139,69,19,0.25);
}
.step-dot.done { background: #8B4513; border-color: #8B4513; color: #fff; }
.step-line { width: 32px; height: 2px; background: #e0c99a; transition: background 0.3s; }
.step-line.done { background: #8B4513; }
.step-label { font-size: 11px; color: #b5813a; text-align: center; margin-top: 4px; white-space: nowrap; }

/* ===== 游戏章节 ===== */
.chapter { display: none; }
.chapter.active { display: block; animation: fadeIn 0.5s ease; }

/* ===== 地图 ===== */
.origin-map-section { margin: 30px 0; padding: 20px; background: #faf5f0; border-radius: 15px; text-align: center; }
.map-container { position: relative; width: 80%; max-width: 800px; margin: 20px auto; }
.china-map { width: 100%; border-radius: 10px; border: 3px solid #8B4513; }
.origin-option {
    position: absolute; width: 15px; height: 15px;
    background: rgba(255,69,0,0.8); border-radius: 50%;
    color: white; font-weight: bold; font-size: 10px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.3s; z-index: 10;
}
.origin-option:hover { background: rgba(255,69,0,1); transform: scale(1.2); }
.tip-message { margin: 15px 0; padding: 10px; border-radius: 8px; font-size: 18px; font-weight: bold; display: none; }
.error-tip { background: #ffeeee; color: #dc3545; }
.success-tip { background: #e8f5e9; color: #28a745; }
.guangzhou-origin { margin: 20px 0; padding: 20px; background: #fff8e1; border-radius: 10px; display: none; text-align: left; line-height: 1.8; }
.guangzhou-origin h4 { color: #8B4513; margin-bottom: 10px; font-size: 20px; }
.core-content-locked { display: none; }

/* ===== 知识章 ===== */
.intro-chapter { padding: 20px; background: #faf5f0; border-radius: 15px; margin: 20px 0; text-align: center; }
.intro-title { font-size: 22px; color: #8B4513; margin: 15px 0 10px; font-weight: bold; }
.intro-content { line-height: 1.8; margin: 8px 0; }
.core-rule-box { margin: 20px auto; padding: 15px; background: #fff; border-radius: 10px; border: 1px solid #8B4513; max-width: 800px; text-align: center; }
.rule-title { font-size: 20px; color: #8B4513; margin-bottom: 10px; }
.core-info-box { margin: 20px 0; text-align: center; }
.core-img { width: 45%; margin: 0 2%; border: 2px solid #8B4513; border-radius: 8px; }

/* ===== 选核章 ===== */
.core-box { display: flex; justify-content: center; gap: 30px; flex-wrap: wrap; margin: 20px 0; }
.core-item { text-align: center; cursor: pointer; padding: 10px; border-radius: 8px; transition: background 0.3s; border: 2px solid transparent; }
.core-item:hover { border-color: #CD853F; background: #faf5f0; }
.core-item.selected { background: #faf5f0; border: 2px solid #8B4513; }
.core-shape { margin: 0 auto 10px; position: relative; }
.core-shape.long { width: 60px; height: 180px; border-radius: 40%/50%; background: linear-gradient(90deg,#c19a6b,#d2b48c); border: 2px solid #b8860b; }
.core-shape.oval { width: 90px; height: 120px; border-radius: 60%/50%; background: linear-gradient(90deg,#b98f5e,#d2b48c); border: 2px solid #b8860b; }
.core-shape.circle { width: 120px; height: 120px; border-radius: 50%; background: linear-gradient(90deg,#a67c52,#d2b48c); border: 2px solid #b8860b; }
.core-shape.special { width: 100px; height: 110px; border-radius: 30% 70% 50% 50%/40% 60% 40% 60%; background: linear-gradient(90deg,#936b40,#d2b48c); transform: rotate(15deg); border: 2px solid #b8860b; }
.core-item p { font-size: 18px; color: #8B4513; margin: 5px 0; }
.core-tip-desc { font-size: 14px; color: #666 !important; }
.core-check-text { text-align: center; font-size: 18px; color: #8B4513; font-weight: bold; margin: 15px auto; display: block; }
.animate-box { margin-top: 20px; min-height: 80px; display: flex; align-items: center; justify-content: center; }
.loading { width: 50px; height: 50px; border: 5px solid #e8d8c8; border-top: 5px solid #CD853F; border-radius: 50%; animation: spin 1s linear infinite; margin: 20px auto; }
@keyframes spin { 0%{transform:rotate(0deg)} 100%{transform:rotate(360deg)} }

/* ===== 工具配对章 ===== */
.match-game-box { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.match-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 30px; }
.match-tool-item { display: flex; flex-direction: column; align-items: center; width: 130px; height: 180px; background: #fff; border-radius: 10px; padding: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); justify-content: center; }
.tool-icon { width: 80px; height: 80px; margin-bottom: 8px; background-repeat: no-repeat; background-position: center; background-size: contain; }
.match-target { width: 110px; height: 45px; border: 2px dashed #CD853F; border-radius: 8px; margin-top: 10px; display: flex; align-items: center; justify-content: center; background: #fff; }
.match-tool-item p { font-size: 18px; color: #8B4513; font-weight: 500; margin: 0 0 5px 0; height: 24px; line-height: 24px; }
.match-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; width: 100%; }
.match-tag-item { padding: 10px 15px; background: #8B4513; color: #fff; border-radius: 10px; font-size: 16px; cursor: grab; user-select: none; transition: all 0.2s; white-space: nowrap; min-width: 100px; text-align: center; }
.match-tag-item:active { cursor: grabbing; transform: scale(0.95); }
.match-correct { background: #228B22 !important; cursor: default; padding: 10px 15px; border-radius: 8px; }
.match-correct::after { content: " ✅"; }
.match-error { background: #DC143C !important; animation: shake 0.3s ease; }
@keyframes shake { 0%{transform:translateX(0)} 25%{transform:translateX(-5px)} 50%{transform:translateX(5px)} 75%{transform:translateX(-5px)} 100%{transform:translateX(0)} }

/* ===== 雕刻章 ===== */
.carve-tool-display { text-align: center; margin: 15px 0; font-size: 20px; color: #8B4513; font-weight: bold; }
.tool-img { width: 80px; height: 80px; margin: 0 auto 10px; display: none; }
.tool-img.active { display: block; }
.carve-stage { margin: 20px 0; }
.canvas-container { width: 100%; max-width: 600px; margin: 0 auto; border: 2px solid #CD853F; border-radius: 10px; overflow: hidden; background: #fff; }
#canvas-line, #canvas-rough, #canvas-detail { display: block; width: 100%; height: auto; }
.carve-progress { font-size: 18px; color: #8B4513; font-weight: 500; margin: 10px 0; text-align: center; }
.quick-mode-img { width: 80%; max-width: 600px; margin: 20px auto; border: 3px solid #8B4513; border-radius: 10px; display: block; }
.quick-mode-btn-group { display: flex; justify-content: center; gap: 20px; margin: 30px 0; }
.quick-carve-step { text-align: center; margin: 15px 0; font-size: 18px; color: #8B4513; font-weight: bold; }

/* ===== 打磨章 ===== */
.polish-wrap { display: flex; align-items: center; justify-content: center; width: 80%; margin: 20px auto; gap: 20px; }
.sandpaper { width: 80px; height: 80px; background: url('./images/tool_shazhi.png') no-repeat center; background-size: contain; cursor: grab; flex-shrink: 0; }
.sandpaper:active { cursor: grabbing; }
.polish-area { position: relative; width: 600px; height: 400px; border: 3px solid #8B4513; border-radius: 10px; overflow: hidden; }
.polish-img-item { width: 100%; height: 100%; object-fit: contain; }
.polish-mask { display: none; }
#polishCanvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; cursor: crosshair; user-select: none; z-index: 5; }
.polish-progress-bar { width: 80%; height: 20px; background: #eee; border-radius: 10px; margin: 20px auto; overflow: hidden; }
.progress-inner { width: 0%; height: 100%; background: linear-gradient(90deg,#228B22,#32cd32); transition: width 0.2s ease; }

/* ===== 视频弹窗 ===== */
.video-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); z-index: 9999; display: none; align-items: center; justify-content: center; padding: 20px; }
.video-container { width: 90%; max-width: 800px; position: relative; }
.video-player { width: 100%; height: auto; border-radius: 10px; border: 3px solid #8B4513; }
.video-close { position: absolute; top: -40px; right: 0; width: 40px; height: 40px; background: #DC143C; color: white; border: none; border-radius: 50%; font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.video-tip { color: white; text-align: center; margin-top: 15px; font-size: 18px; }

/* ===== 结果页 ===== */
.result-box { width: 90%; margin: 20px auto; padding: 20px; background: #faf5f0; border-radius: 15px; border: 2px solid #CD853F; }
.result-img { width: 80%; max-width: 600px; margin: 20px auto; border: 3px solid #8B4513; border-radius: 10px; display: block; }
.badge { width: 150px; height: 150px; margin: 20px auto; border-radius: 50%; background: url("./images/badge_base.png") no-repeat center; background-size: cover; border: 4px solid #8B4513; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: bold; color: #8B4513; }
.badge-text1 { font-size: 18px; margin-bottom: 5px; }
.badge-text2 { font-size: 22px; }
.finish-info { max-width: 800px; margin: 20px auto; padding: 15px; background: #faf5f0; border-radius: 10px; border: 1px solid #8B4513; text-align: center; line-height: 1.8; font-size: 18px; color: #666; }
.user-note { color: #8B4513; font-weight: bold; margin-top: 10px; font-size: 18px; }
.input-note { width: 90%; max-width: 600px; height: 120px; padding: 15px; font-size: 18px; border: 2px solid #CD853F; border-radius: 10px; margin: 20px 0; resize: none; background: #faf5f0; color: #8B4513; display: block; margin-left: auto; margin-right: auto; }
.input-note::placeholder { color: #c9c9c9; }
#share-card-container { position: fixed; top: -9999px; left: -9999px; width: 500px; height: 600px; background: url("./images/card.png") no-repeat center; background-size: cover; padding: 30px; border-radius: 20px; border: 4px solid #8B4513; text-align: center; color: #8B4513; }
#share-card-img { width: 80%; height: auto; max-height: 250px; object-fit: contain; margin: 20px auto; border: 3px solid #8B4513; border-radius: 10px; display: block; }
#share-card-badge { width: 150px; height: 150px; margin: 10px auto; border-radius: 50%; background: url("./images/badge_base.png") no-repeat center; background-size: cover; border: 4px solid #8B4513; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: bold; }
#share-card-note { font-size: 20px; margin-top: 20px; padding: 10px; background: rgba(255,255,255,0.8); border-radius: 10px; font-weight: bold; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .mode-cards { gap: 16px; }
    .mode-card { width: 160px; padding: 20px 14px; }
    .progress-steps { gap: 2px; }
    .step-line { width: 18px; }
    .core-item { width: 140px; }
    .match-tool-item { width: 100px; height: 160px; }
    .polish-area { width: 100%; height: 280px; }
    .polish-wrap { width: 95%; }
    .sandpaper { width: 60px; height: 60px; }
    #share-card-container { width: 300px; height: 450px; padding: 20px; }
}
