/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "微软雅黑", "宋体", "楷体", serif;
}
body {
    overflow-x: hidden;
    background: url("/static./images/back.jpg") no-repeat center center fixed;
    background-size: cover;
}
.container {
    width: 90%;
    max-width: 1200px;
    margin: 40px auto;
    text-align: center;
    background: rgba(255, 255, 255, 0.92);
    padding: 30px 20px;
    border-radius: 20px;
    box-shadow: 0 0 20px rgba(139, 69, 19, 0.2);
    border: 1px solid #e8d8c8;
}

/* 按钮居中容器 */
.btn-group {
    width: 100%;
    margin: 30px auto 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    position: relative;
    z-index: 99;
}
#restart-btn-group {
    margin: 40px auto 20px;
    padding: 10px 0;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

/* 标题样式 - 匹配新标题「大岭记忆·核舟记」 */
h1 {
    font-size: 48px;
    color: #8B4513;
    margin-bottom: 20px;
    font-weight: bold;
    letter-spacing: 2px;
}
h2 {
    font-size: 32px;
    color: #A0522D;
    margin: 15px 0;
    letter-spacing: 1px;
}
h3 {
    font-size: 24px;
    color: #CD853F;
    margin: 15px 0;
}

/* 通用提示文字 */
.tip-text {
    font-size: 20px;
    color: #D2691E;
    margin: 15px 0;
    line-height: 1.5;
}
.tip-correct {
    color: #228B22;
    font-weight: bold;
}
.tip-error {
    color: #DC143C;
    font-weight: bold;
}
/* 新增：雕刻提示文字样式（允许行内样式覆盖） */
#carve-tip {
    font-size: 20px;
    margin: 15px 0;
    line-height: 1.5;
    /* 关键：取消color的强制设置，让行内样式生效 */
}

/* 按钮通用样式 */
.btn {
    min-width: 180px;
    height: 70px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #CD853F, #8B4513);
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    padding: 0 15px;
    transition: all 0.3s;
    letter-spacing: 1px;
    box-shadow: 0 4px 8px rgba(139, 69, 19, 0.2);
    position: relative;
    z-index: 99;
}
.btn-sm {
    min-width: 120px;
    height: 50px;
    font-size: 16px;
}
.mode-btn {
    min-width: 220px;
    height: 80px;
    font-size: 20px;
}
.btn:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, #D2691E, #A0522D);
    box-shadow: 0 6px 12px rgba(139, 69, 19, 0.3);
}
.btn:disabled {
    background: #c9c9c9;
    color: #888;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 第一章：识核知源 样式（新增核雕介绍样式） */
.core-intro-box {
    width: 90%;
    margin: 20px auto;
    padding: 20px;
    background: #faf5f0;
    border-radius: 15px;
    border: 1px solid #CD853F;
    text-align: left;
}
.intro-title {
    font-size: 20px;
    color: #8B4513;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
}
.intro-content {
    font-size: 18px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
    text-align: center;
}
.core-info-box {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin: 30px 0;
}
.core-img {
    width: 45%;
    max-width: 600px;
    border-radius: 10px;
    border: 2px solid #CD853F;
}
.core-rule-box {
    margin: 20px auto;
    padding: 15px;
    background: #f0f9eb;
    border-radius: 10px;
    border: 1px solid #228B22;
    width: 90%;
    max-width: 800px;
    text-align: center;
}
.rule-title {
    font-size: 19px;
    color: #228B22;
    font-weight: bold;
    margin-bottom: 10px;
    text-align: center;
}
.core-rule-box p {
    font-size: 18px;
    color: #666;
    line-height: 1.5;
}

/* 第二章：选核定型 样式 - 核心修改：核形状差异化增强（尺寸/渐变/旋转/阴影） */
.core-box {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin: 30px 0;
}
.core-item {
    width: 200px;
    height: 280px;
    margin: 15px;
    padding: 15px;
    border-radius: 10px;
    border: 2px solid #e8d8c8;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
}
.core-item:hover {
    border-color: #CD853F;
    background: #faf5f0;
    transform: translateY(-5px);
}
.core-item.selected {
    border-color: #228B22;
    background: #f0f9eb;
    box-shadow: 0 0 10px rgba(34, 139, 34, 0.2);
}
/* 核形状基础样式 - 完全重构，差异化拉满 */
.core-shape {
    margin-bottom: 15px;
    border: 2px solid #b8860b;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    background: linear-gradient(135deg, #deb887, #cd853f);
}
/* 长形核 */
.core-shape.long {
    width: 70px;
    height: 180px;
    border-radius: 50%/65%;
    background: linear-gradient(180deg, #c9a67c 0%, #d2b48c 50%, #b89470 100%);
}
/* 椭圆核（核舟专用） */
.core-shape.oval {
    width: 90px;
    height: 120px;
    border-radius: 60%/50%;
    background: linear-gradient(180deg, #d6bc91 0%, #d2b48c 50%, #c0a078 100%);
}
/* 圆形核 */
.core-shape.circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(180deg, #e0c898 0%, #d2b48c 50%, #c8b084 100%);
}
/* 异形核 - 旋转+特殊圆角 */
.core-shape.special {
    width: 100px;
    height: 110px;
    border-radius: 30% 70% 50% 50% / 40% 60% 40% 60%;
    background: linear-gradient(180deg, #d1b38b 0%, #c7a97f 50%, #b99a72 100%);
    transform: rotate(15deg);
}
.core-item p {
    font-size: 18px;
    color: #8B4513;
    margin: 5px 0;
    text-align: center;
    width: 100%;
    position: relative;
    left: 0;
}
.core-tip-desc {
    font-size: 14px;
    color: #666 !important;
    text-align: center;
    width: 100%;
}
.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); } }
.animate-box {
    margin-top: 20px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 第三章：认识工具 - 核心修改：工具名称+下方框 纵坐标严格对齐 */
.match-game-box {
    width: 95%;
    max-width: 1000px;
    margin: 20px auto;
    padding: 20px;
    background: #faf5f0;
    border-radius: 15px;
    border: 2px solid #CD853F;
}
.match-tools {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 30px;
}
/* 工具项：固定尺寸+垂直居中，确保名称和框对齐 */
.match-tool-item {
    width: 130px;
    height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #fff;
    border-radius: 10px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
/* 6个工具图标样式（绑定图片）- 适配tool_shazhi.png尺寸差异 */
.tool-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 8px !important;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    border-radius: 6px;
    flex-shrink: 0;
}
.tool-pingdao { background-image: url("/static./images/tool_pingdao.png"); }
.tool-yuandao { background-image: url("/static./images/tool_yuandao.png"); }
.tool-xiedao { background-image: url("/static./images/tool_xiedao.png"); }
.tool-huabi { background-image: url("/static./images/tool_huabi.png"); }
.tool-shazhi { background-image: url("/static./images/tool_shazhi.png"); }
.tool-heyou { background-image: url("/static./images/tool_heyou.png"); }
/* 工具名称：固定高度，确保纵坐标对齐 */
.match-tool-item p {
    font-size: 18px;
    color: #8B4513;
    font-weight: 500;
    margin: 0 0 5px 0;
    height: 24px;
    line-height: 24px;
    text-align: center;
}
/* 配对目标位：适配四字标签+固定位置 */
.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;
    padding: 0 5px;
    text-align: center;
}
.match-tags {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
}
.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 ease;
    white-space: nowrap;
    min-width: 100px;
    text-align: center;
}
.match-tag-item:active {
    cursor: grabbing;
    transform: scale(0.95);
}
.match-correct {
    background: #228B22 !important;
    border: none !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); }
}
.match-tip {
    margin: 10px 0;
    font-size: 18px;
}

/* 第四章：体验雕刻新版样式 - 核心新增：换刀交互样式（提示器+动画+工具标签） */
.carve-stage {
    margin: 20px 0;
}
/* 换刀提示器：红色圆角+动画，显眼提示换刀 */
.tool-switch-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #DC143C;
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 20px;
    font-weight: bold;
    z-index: 100; /* 提高层级，确保不被遮挡 */
    display: none;
    animation: toolSwitch 0.8s ease-in-out;
}
@keyframes toolSwitch {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}
/* 当前工具标签：红色显眼展示 */
.carve-tool-label {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    color: #DC143C;
    margin: 10px 0;
}
.canvas-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border: 2px solid #CD853F;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    position: relative;
    z-index: 10; /* 确保Canvas在最上层 */
}
#canvas-line, #canvas-rough, #canvas-detail {
    display: block;
    width: 100%;
    height: auto;
    /* 关键：固定Canvas尺寸，避免缩放导致刀具位置偏移 */
    max-height: 400px;
}
#canvas-line {
    cursor: pointer;
}
.carve-progress {
    font-size: 18px;
    color: #8B4513;
    font-weight: 500;
    margin: 10px 0;
    text-align: center;
}

/* 第五章：打磨上光 样式 - 核心修改：红色蒙版+底层carve_2.png+遮罩刮开效果 */
.polish-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80%;
    margin: 20px auto;
    gap: 20px;
}
.sandpaper {
    width: 80px;
    height: 80px;
    background: url('/static./images/tool_shazhi.png') no-repeat center center;
    background-size: contain;
    cursor: grab;
    flex-shrink: 0;
}
.sandpaper:active {
    cursor: grabbing;
}
.polish-area {
    width: 90%;
    max-width: 800px;
    height: 500px;
    margin: 30px auto;
    border: 3px solid #8B4513;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    background: #faf5f0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}
/* 核心修改：蒙版改为红色，随进度降低透明度露出底层carve_2.png */
.polish-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 0, 0, 0.8);
    transition: background 0.3s ease;
    pointer-events: none;
    z-index: 5;
}
.polish-img-item {
    width: 80%;
    height: 80%;
    object-fit: contain;
}
.polish-progress-bar {
    width: 80%;
    height: 20px;
    border-radius: 10px;
    background: #e8d8c8;
    margin: 10px auto;
    overflow: hidden;
}
.progress-inner {
    height: 100%;
    background: linear-gradient(90deg, #228B22, #32cd32);
    width: 0%;
    transition: width 0.3s ease;
}
.polish-progress-text {
    margin: 5px 0;
}

/* 终章：成品展示 样式 - 核心修改：成品正常比例+移除红点+勋章适配+题记无前缀 */
.result-box {
    width: 90%;
    margin: 20px auto;
    padding: 20px;
    background: #faf5f0;
    border-radius: 15px;
    border: 2px solid #CD853F;
}
/* 成品图片：核心修改 - 正常比例（height:auto），移除固定高度避免过胖 */
.result-img {
    width: 70%;
    max-width: 600px;
    height: auto;
    object-fit: contain;
    margin: 20px auto;
    border: 4px solid #8B4513;
    border-radius: 10px;
    display: block;
}
/* 核雕大师勋章：按要求适配背景图，无额外修改 */
.badge {
    width: 200px;
    height: 200px;
    margin: 20px auto;
    border-radius: 50%;
    background: url("/static./images/badge_base.png") no-repeat center;
    background-size: cover;
    border: 5px solid #8B4513;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #8B4513;
    font-weight: bold;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}
.badge .badge-text1 { font-size: 24px; margin-bottom: 5px; }
.badge .badge-text2 { font-size: 18px; }
.finish-info {
    font-size: 18px;
    color: #666;
    line-height: 2;
    margin: 20px 0;
}
/* 用户题记：移除「专属题记：」前缀，仅保留文字 */
.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;
}
.input-note::placeholder { color: #c9c9c9; }

/* 速通版专属样式 */
.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;
}

/* 章节切换动画 */
.chapter { display: none; }
.chapter.active {
    display: block;
    animation: fadeIn 0.8s ease-in-out;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* 响应式适配（手机端）- 同步适配所有修改点 */
@media (max-width: 768px) {
    h1 { font-size: 32px; }
    h2 { font-size: 24px; }
    h3 { font-size: 20px; }
    .btn { min-width: 150px; height: 60px; font-size: 16px; }
    .btn-sm { min-width: 100px; height: 45px; font-size: 14px; }
    .mode-btn { min-width: 180px; height: 70px; }
    .btn-group { gap: 10px; }

    .core-intro-box { width: 95%; padding: 15px; }
    .intro-title { font-size: 18px; }
    .intro-content { font-size: 16px; }
    .core-img { width: 90%; }
    .core-rule-box { width: 95%; }

    /* 核形状响应式适配 */
    .core-item { width: 150px; height: 240px; }
    .core-shape.long { width: 60px; height: 150px; }
    .core-shape.oval { width: 70px; height: 110px; }
    .core-shape.circle { width: 100px; height: 100px; }
    .core-shape.special { width: 80px; height: 90px; transform: rotate(15deg); }

    .match-game-box { padding: 15px; max-width: 100%; }
    .match-tools { gap: 10px; }
    .match-tool-item { width: 110px; height: 160px; }
    .tool-icon { width: 65px; height: 65px; }
    .match-target { width: 90px; height: 40px; }
    .match-tag-item { font-size: 14px; padding: 8px 12px; min-width: 85px; }

    .canvas-container { max-width: 100%; }
    #canvas-line, #canvas-rough, #canvas-detail { height: auto; }
    /* 换刀提示器手机端适配 */
    .tool-switch-indicator { font-size: 16px; padding: 8px 15px; top: 10px; right: 10px; }

    /* 打磨区域手机端适配 */
    .polish-area { height: 300px; }
    .polish-wrap { width: 95%; gap: 10px; }
    .sandpaper { width: 60px; height: 60px; }

    /* 成品展示手机端适配 */
    .result-img { width: 90%; height: auto; }
    .badge { width: 150px; height: 150px; }
    .badge .badge-text1 { font-size: 20px; }
    .badge .badge-text2 { font-size: 16px; }

    .quick-mode-img { width: 90%; }
    .quick-mode-btn-group { flex-direction: column; gap: 10px; }
}