/* 
粘土风格乘法游戏CSS - 优化版本V4
进一步缩小所有元素，确保答案栏始终一行显示
*/

/* ====== 模板整合调整 - 必须放在最顶部 ====== */
body {
    background-color: #f9f9f9 !important;
    justify-content: flex-start !important;
    align-items: flex-start !important;
    padding: 0 !important;
    min-height: 100vh;
    display: block !important;
    overflow-x: hidden;
}

/* 游戏容器在模板中的调整 */
.multiplication-game {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 1.5rem !important;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
}

/* 调整标题行 */
.title-row {
    margin-top: 0 !important;
}

/* 主题背景覆盖 */
.theme-2 .multiplication-game {
    background: linear-gradient(135deg, rgba(135, 206, 235, 0.1), rgba(255, 255, 255, 0.95)) !important;
}

.theme-3 .multiplication-game {
    background: linear-gradient(135deg, rgba(255, 217, 61, 0.1), rgba(255, 255, 255, 0.95)) !important;
}

.theme-4 .multiplication-game {
    background: linear-gradient(135deg, rgba(209, 209, 255, 0.1), rgba(255, 255, 255, 0.95)) !important;
}

.theme-5 .multiplication-game {
    background: linear-gradient(135deg, rgba(128, 222, 217, 0.1), rgba(255, 255, 255, 0.95)) !important;
}

.theme-6 .multiplication-game {
    background: linear-gradient(135deg, rgba(255, 182, 193, 0.1), rgba(255, 255, 255, 0.95)) !important;
}

.theme-7 .multiplication-game {
    background: linear-gradient(135deg, rgba(168, 224, 99, 0.1), rgba(255, 255, 255, 0.95)) !important;
}

.theme-8 .multiplication-game {
    background: linear-gradient(135deg, rgba(255, 203, 164, 0.1), rgba(255, 255, 255, 0.95)) !important;
}

.theme-9 .multiplication-game {
    background: linear-gradient(135deg, rgba(255, 224, 102, 0.1), rgba(255, 255, 255, 0.95)) !important;
}

:root {
    /* 基础背景色 */
    --clay-bg: #f0f4f8;
    
    /* 主题颜色 - 与首页完全一致 */
    --theme-2-color: #87CEEB;          /* 2的乘法 - 天空蓝 */
    --theme-3-color: #FFD93D;         /* 3的乘法 - 黄色 */
    --theme-4-color: #D1D1FF;         /* 4的乘法 - 淡蓝色 */
    --theme-5-color: #80DED9;         /* 5的乘法 - 青绿色 */
    --theme-6-color: #FFB6C1;         /* 6的乘法 - 粉红色 */
    --theme-7-color: #A8E063;         /* 7的乘法 - 浅绿色 */
    --theme-8-color: #FFCBA4;         /* 8的乘法 - 浅橙色 */
    --theme-9-color: #FFE066;         /* 9的乘法 - 淡黄色 */
    
    /* 拖拽高亮颜色变量 */
    --drag-highlight-bg: rgba(135, 206, 235, 0.2);
    --drag-highlight-border: rgba(135, 206, 235, 0.8);
    
    /* 通用颜色 */
    --clay-success: #10B981;           /* 成功色 */
    --clay-gray: #94A3B8;              /* 灰色 */
    --clay-dark: #0A1931;              /* 深色背景 */
    --clay-light: #F8FAFC;             /* 浅色背景 */

    /* 3D粘土效果 - 进一步减弱 */
    --clay-shadow: 
        5px 5px 10px rgba(0, 0, 0, 0.07),
        -3px -3px 7px rgba(255, 255, 255, 0.8),
        inset 2px 2px 5px rgba(255, 255, 255, 0.3),
        inset -2px -2px 5px rgba(0, 0, 0, 0.03);

    --clay-shadow-hover: 
        7px 7px 14px rgba(0, 0, 0, 0.09),
        -4px -4px 10px rgba(255, 255, 255, 0.9),
        inset 2px 2px 5px rgba(255, 255, 255, 0.4),
        inset -2px -2px 5px rgba(0, 0, 0, 0.03);

    --clay-shadow-active: 
        3px 3px 6px rgba(0, 0, 0, 0.07),
        -2px -2px 4px rgba(255, 255, 255, 0.8),
        inset 3px 3px 6px rgba(255, 255, 255, 0.2),
        inset -3px -3px 6px rgba(0, 0, 0, 0.04);

    /* 圆角定义 - 进一步缩小 */
    --clay-radius-lg: 22px;
    --clay-radius-md: 12px;
    --clay-radius-sm: 8px;
    --clay-radius-xs: 5px;
    --clay-radius-circle: 50%;

    /* 文本颜色 */
    --text-dark: #2D3748;
    --text-medium: #4A5568;
    --text-light: #718096;
    --text-white: #FFFFFF;
    
    /* 透明度背景 */
    --bg-white-90: rgba(255, 255, 255, 0.9);
    --bg-white-80: rgba(255, 255, 255, 0.8);
    --bg-white-70: rgba(255, 255, 255, 0.7);
    --bg-white-60: rgba(255, 255, 255, 0.6);
    
    /* 边框颜色 */
    --border-white: rgba(255, 255, 255, 0.5);
    
    /* 过渡动画 - 进一步加快 */
    --transition-fast: 0.1s ease;
    --transition-normal: 0.18s ease;
    --transition-slow: 0.25s ease;
}

/* ====== 基础重置 ====== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

html {
    /* 防止移动端双击缩放导致的页面跳动 */
    touch-action: manipulation;
    overflow-y: scroll; /* 增加这一行：强制显示垂直滚动条，防止内容变动时页面左右晃动 */
    overflow-x: hidden; /* 增加这一行：确保水平方向不溢出 */
}

body {
    background-color: var(--clay-bg);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 18px;
    color: var(--text-dark);
    /* 防止水平滚动导致的页面跳动 */
    overflow-x: hidden;
}

/* ====== 游戏容器 - 进一步缩小 ====== */
.multiplication-game {
    width: 100%;
    max-width: 680px;
    margin: 35px auto 18px;
    padding: 1.6rem;
    border-radius: var(--clay-radius-lg);
    box-shadow: var(--clay-shadow);
    border: 2px solid var(--border-white);
    backdrop-filter: blur(5px);
    background: var(--bg-white-80);
    transition: var(--transition-normal);
}

/* ====== 主题2-9的游戏容器背景 ====== */
.theme-2 .multiplication-game {
    background: linear-gradient(135deg, rgba(135, 206, 235, 0.1), rgba(255, 255, 255, 0.9));
}

.theme-3 .multiplication-game {
    background: linear-gradient(135deg, rgba(255, 217, 61, 0.1), rgba(255, 255, 255, 0.9));
}

.theme-4 .multiplication-game {
    background: linear-gradient(135deg, rgba(209, 209, 255, 0.1), rgba(255, 255, 255, 0.9));
}

.theme-5 .multiplication-game {
    background: linear-gradient(135deg, rgba(128, 222, 217, 0.1), rgba(255, 255, 255, 0.9));
}

.theme-6 .multiplication-game {
    background: linear-gradient(135deg, rgba(255, 182, 193, 0.1), rgba(255, 255, 255, 0.9));
}

.theme-7 .multiplication-game {
    background: linear-gradient(135deg, rgba(168, 224, 99, 0.1), rgba(255, 255, 255, 0.9));
}

.theme-8 .multiplication-game {
    background: linear-gradient(135deg, rgba(255, 203, 164, 0.1), rgba(255, 255, 255, 0.9));
}

.theme-9 .multiplication-game {
    background: linear-gradient(135deg, rgba(255, 224, 102, 0.1), rgba(255, 255, 255, 0.9));
}

/* ====== 标题行样式 ====== */
.title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 0.7rem;
}

/* 标题容器样式 */
.title-with-button {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    width: 100%;
}

.title-with-button h1 {
    margin: 0;
    flex: 1;
    text-align: center;
    color: var(--text-dark);
    font-size: 1.8rem;
    font-weight: 800;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.07);
    padding: 0.7rem;
    border-radius: var(--clay-radius-md);
    background: var(--bg-white-90);
    box-shadow: var(--clay-shadow);
}

/* ====== 小首页按钮 ====== */
.home-btn-small {
    width: 50px;
    height: 50px;
    border-radius: var(--clay-radius-circle);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--clay-shadow);
    border: 2px solid var(--border-white);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    flex-shrink: 0;
    font-size: 1.5rem;
}

.home-btn-small::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: 0.5s;
}

.home-btn-small:hover {
    transform: translateY(-2px) scale(1.06);
    box-shadow: var(--clay-shadow-hover);
}

.home-btn-small:hover::before {
    left: 100%;
}

.home-btn-small:active {
    transform: translateY(0) scale(1);
    box-shadow: var(--clay-shadow-active);
}

/* ====== 主题2-9的小首页按钮颜色 ====== */
.theme-2 .home-btn-small {
    background: linear-gradient(145deg, #87CEEB, #5DB8EB);
    color: white;
}

.theme-3 .home-btn-small {
    background: linear-gradient(145deg, #FFD93D, #FFC107);
    color: white;
}

.theme-4 .home-btn-small {
    background: linear-gradient(145deg, #D1D1FF, #A5A5FF);
    color: white;
}

.theme-5 .home-btn-small {
    background: linear-gradient(145deg, #80DED9, #5DC9C3);
    color: white;
}

.theme-6 .home-btn-small {
    background: linear-gradient(145deg, #FFB6C1, #FF8FA3);
    color: white;
}

.theme-7 .home-btn-small {
    background: linear-gradient(145deg, #A8E063, #8CC63F);
    color: white;
}

.theme-8 .home-btn-small {
    background: linear-gradient(145deg, #FFCBA4, #FFB07C);
    color: white;
}

.theme-9 .home-btn-small {
    background: linear-gradient(145deg, #FFE066, #FFD233);
    color: white;
}

/* ====== 完成计数器 ====== */
.completion-counter {
    text-align: center;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-medium);
    font-size: 0.95rem;
    padding: 0.5rem;
    border-radius: var(--clay-radius-sm);
    background: var(--bg-white-90);
    box-shadow: var(--clay-shadow);
    border: 1px solid var(--border-white);
}

/* ====== 答案容器 - 关键优化 ====== */
.answers-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.4rem; /* 进一步减少间隙 */
    margin-bottom: 1.3rem;
    padding: 0.9rem;
    border-radius: var(--clay-radius-md);
    box-shadow: var(--clay-shadow);
    border: 2px solid var(--border-white);
    background: var(--bg-white-90);
    overflow: hidden; /* 增加这一行：像一道围墙，把内部按钮点击时的微小震动关在里面 */
}

/* ====== 答案方块 - 进一步缩小 ====== */
.answer {
    width: 48px; /* PC端进一步缩小 */
    height: 48px;
    border-radius: var(--clay-radius-circle);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-white);
    font-size: 1.25rem; /* 进一步缩小字体 */
    font-weight: bold;
    cursor: grab;
    user-select: none;
    transition: all var(--transition-normal);
    box-shadow: var(--clay-shadow);
    border: 2px solid var(--border-white);
    position: relative;
    overflow: hidden;
    touch-action: none;
    -webkit-touch-callout: none;
    will-change: transform;
    flex-shrink: 0;
}

.answer::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: 0.5s;
}

.answer:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: var(--clay-shadow-hover);
}

.answer:hover::before {
    left: 100%;
}

.answer.dragging {
    opacity: 0.8;
    transform: scale(0.95);
    transition: none;
    animation: clay-pulse 1s infinite;
}

.answer.dragging-original {
    opacity: 0.3 !important;
    transform: scale(0.9);
}

.answer.used {
    opacity: 0.4;
    cursor: not-allowed;
    transform: scale(0.9);
}

/* ====== 主题2-9的答案按钮 ====== */
.theme-2 .answer {
    background: linear-gradient(145deg, #87CEEB, #5DB8EB);
}

.theme-3 .answer {
    background: linear-gradient(145deg, #FFD93D, #FFC107);
}

.theme-4 .answer {
    background: linear-gradient(145deg, #D1D1FF, #A5A5FF);
}

.theme-5 .answer {
    background: linear-gradient(145deg, #80DED9, #5DC9C3);
}

.theme-6 .answer {
    background: linear-gradient(145deg, #FFB6C1, #FF8FA3);
}

.theme-7 .answer {
    background: linear-gradient(145deg, #A8E063, #8CC63F);
}

.theme-8 .answer {
    background: linear-gradient(145deg, #FFCBA4, #FFB07C);
}

.theme-9 .answer {
    background: linear-gradient(145deg, #FFE066, #FFD233);
}

/* ====== 算式容器 - 固定为2列 ====== */
.equations-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.9rem;
    margin-bottom: 1.3rem;
}

/* ====== 算式框 - 进一步缩小 ====== */
.equation {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.3rem;
    font-weight: 700;
    padding: 0.9rem;
    border-radius: var(--clay-radius-md);
    box-shadow: var(--clay-shadow);
    border: 2px solid var(--border-white);
    background: var(--bg-white-90);
    transition: var(--transition-normal);
}

.equation:hover {
    transform: translateY(-2px);
    box-shadow: var(--clay-shadow-hover);
}

/* ====== 数字框 - 进一步缩小 ====== */
.equation-number {
    width: 52px;
    height: 52px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--clay-radius-circle);
    font-weight: bold;
    font-size: 1.3rem;
    box-shadow: var(--clay-shadow);
    border: 2px solid var(--border-white);
    touch-action: none;
}

/* ====== 主题2-9的算式数字框 ====== */
.theme-2 .equation-number {
    background: linear-gradient(145deg, rgba(135, 206, 235, 0.2), rgba(255, 255, 255, 0.9));
    color: #2E8B57;
}

.theme-3 .equation-number {
    background: linear-gradient(145deg, rgba(255, 217, 61, 0.2), rgba(255, 255, 255, 0.9));
    color: #D4A017;
}

.theme-4 .equation-number {
    background: linear-gradient(145deg, rgba(209, 209, 255, 0.2), rgba(255, 255, 255, 0.9));
    color: #6A5ACD;
}

.theme-5 .equation-number {
    background: linear-gradient(145deg, rgba(128, 222, 217, 0.2), rgba(255, 255, 255, 0.9));
    color: #20B2AA;
}

.theme-6 .equation-number {
    background: linear-gradient(145deg, rgba(255, 182, 193, 0.2), rgba(255, 255, 255, 0.9));
    color: #DB7093;
}

.theme-7 .equation-number {
    background: linear-gradient(145deg, rgba(168, 224, 99, 0.2), rgba(255, 255, 255, 0.9));
    color: #32CD32;
}

.theme-8 .equation-number {
    background: linear-gradient(145deg, rgba(255, 203, 164, 0.2), rgba(255, 255, 255, 0.9));
    color: #FF8C00;
}

.theme-9 .equation-number {
    background: linear-gradient(145deg, rgba(255, 224, 102, 0.2), rgba(255, 255, 255, 0.9));
    color: #FFA500;
}

/* ====== 算式结果框 - 填充后的样式 ====== */
.equation-result.filled {
    border: 2px solid transparent !important;
    color: var(--text-white) !important;
    box-shadow: var(--clay-shadow) !important;
    font-size: 1.3rem !important;
    font-weight: bold !important;
    position: relative !important;
    overflow: hidden !important;
}

.equation-result.filled::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: 0.5s;
}

.equation-result.filled:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: var(--clay-shadow-hover) !important;
}

.equation-result.filled:hover::before {
    left: 100%;
}

/* ====== 主题2-9的填充结果框 ====== */
.theme-2 .equation-result.filled {
    background: linear-gradient(145deg, #87CEEB, #5DB8EB) !important;
}

.theme-3 .equation-result.filled {
    background: linear-gradient(145deg, #FFD93D, #FFC107) !important;
}

.theme-4 .equation-result.filled {
    background: linear-gradient(145deg, #D1D1FF, #A5A5FF) !important;
}

.theme-5 .equation-result.filled {
    background: linear-gradient(145deg, #80DED9, #5DC9C3) !important;
}

.theme-6 .equation-result.filled {
    background: linear-gradient(145deg, #FFB6C1, #FF8FA3) !important;
}

.theme-7 .equation-result.filled {
    background: linear-gradient(145deg, #A8E063, #8CC63F) !important;
}

.theme-8 .equation-result.filled {
    background: linear-gradient(145deg, #FFCBA4, #FFB07C) !important;
}

.theme-9 .equation-result.filled {
    background: linear-gradient(145deg, #FFE066, #FFD233) !important;
}

/* ====== 结果框 - 进一步缩小 ====== */
.equation-result {
    width: 52px;
    height: 52px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: var(--clay-radius-circle);
    box-shadow: var(--clay-shadow);
    border: 2px dashed var(--border-white);
    background: var(--bg-white-80);
    transition: all var(--transition-normal);
    font-weight: bold;
    font-size: 1.2rem;
    touch-action: none;
    cursor: pointer;
}

.equation-result.drag-over {
    background: var(--bg-white-60);
    box-shadow: inset 2px 2px 5px rgba(255, 255, 255, 0.4);
    transform: scale(1.03);
}

/* ====== 主题2-9的拖拽高亮颜色 ====== */
.theme-2 {
    --drag-highlight-bg: rgba(135, 206, 235, 0.2);
    --drag-highlight-border: rgba(135, 206, 235, 0.8);
}

.theme-3 {
    --drag-highlight-bg: rgba(255, 217, 61, 0.2);
    --drag-highlight-border: rgba(255, 217, 61, 0.8);
}

.theme-4 {
    --drag-highlight-bg: rgba(209, 209, 255, 0.2);
    --drag-highlight-border: rgba(209, 209, 255, 0.8);
}

.theme-5 {
    --drag-highlight-bg: rgba(128, 222, 217, 0.2);
    --drag-highlight-border: rgba(128, 222, 217, 0.8);
}

.theme-6 {
    --drag-highlight-bg: rgba(255, 182, 193, 0.2);
    --drag-highlight-border: rgba(255, 182, 193, 0.8);
}

.theme-7 {
    --drag-highlight-bg: rgba(168, 224, 99, 0.2);
    --drag-highlight-border: rgba(168, 224, 99, 0.8);
}

.theme-8 {
    --drag-highlight-bg: rgba(255, 203, 164, 0.2);
    --drag-highlight-border: rgba(255, 203, 164, 0.8);
}

.theme-9 {
    --drag-highlight-bg: rgba(255, 224, 102, 0.2);
    --drag-highlight-border: rgba(255, 224, 102, 0.8);
}

/* 移动端拖放区域高亮 */
.equation-result.drag-over-highlight {
    background: var(--drag-highlight-bg, rgba(135, 206, 235, 0.2)) !important;
    border: 2px solid var(--drag-highlight-border, rgba(135, 206, 235, 0.8)) !important;
    transform: scale(1.05);
    transition: transform 0.1s ease;
}

/* ====== 空白框 ====== */
.empty-box {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.9rem;
    border-radius: var(--clay-radius-md);
    box-shadow: var(--clay-shadow);
    border: 2px dashed var(--border-white);
    background: var(--bg-white-60);
    opacity: 0.6;
}

/* ====== 按钮容器 ====== */
.buttons-container {
    display: flex;
    justify-content: center;
    gap: 0.9rem;
    margin-top: 0.9rem;
}

/* ====== 游戏按钮 - 进一步缩小 ====== */
.game-btn {
    padding: 0.8rem 1.6rem;
    font-size: 0.95rem;
    font-weight: 700;
    border: none;
    border-radius: var(--clay-radius-sm);
    cursor: pointer;
    transition: all var(--transition-normal);
    color: var(--text-white);
    box-shadow: var(--clay-shadow);
    border: 2px solid var(--border-white);
    position: relative;
    overflow: hidden;
    min-width: 130px;
    touch-action: manipulation;
    outline: none;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

.game-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: 0.5s;
}

.game-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--clay-shadow-hover);
}

.game-btn:hover:not(:disabled)::before {
    left: 100%;
}

.game-btn:active {
    transform: translateY(0);
    box-shadow: var(--clay-shadow-active);
}

.game-btn:focus, .answer:focus {
    outline: none !important;
    box-shadow: var(--clay-shadow) !important; /* 强制按钮获得焦点时保持普通阴影，不再向外扩张 */
}

/* ====== 主题2-9的练习按钮 ====== */
.theme-2 #restart-btn {
    background: linear-gradient(145deg, #87CEEB, #5DB8EB);
}

.theme-3 #restart-btn {
    background: linear-gradient(145deg, #FFD93D, #FFC107);
}

.theme-4 #restart-btn {
    background: linear-gradient(145deg, #D1D1FF, #A5A5FF);
}

.theme-5 #restart-btn {
    background: linear-gradient(145deg, #80DED9, #5DC9C3);
}

.theme-6 #restart-btn {
    background: linear-gradient(145deg, #FFB6C1, #FF8FA3);
}

.theme-7 #restart-btn {
    background: linear-gradient(145deg, #A8E063, #8CC63F);
}

.theme-8 #restart-btn {
    background: linear-gradient(145deg, #FFCBA4, #FFB07C);
}

.theme-9 #restart-btn {
    background: linear-gradient(145deg, #FFE066, #FFD233);
}

/* 下一关按钮 */
#next-btn {
    background: linear-gradient(145deg, #94A3B8, #6B7280);
    cursor: not-allowed;
}

/* 可点击状态的Next按钮 */
#next-btn.enabled {
    background: linear-gradient(145deg, #6B7280, #4B5563);
    cursor: pointer;
}

.game-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: var(--clay-shadow) !important;
}

/* ====== 拖拽克隆元素 ====== */
.drag-ghost {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    margin: 0 !important;
    pointer-events: none !important;
    z-index: 9999 !important;
    opacity: 0.9 !important;
    transition: none !important;
    transform-origin: center !important;
    will-change: transform;
    filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.12));
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.drag-ghost,
.drag-ghost * {
    -webkit-user-select: none !important;
    user-select: none !important;
}

/* ====== 响应式设计 - 移动端优化 ====== */
@media (max-width: 768px) {
    :root {
        --clay-radius-lg: 18px;
        --clay-radius-md: 11px;
        --clay-radius-sm: 7px;
    }
    
    body {
        padding: 8px;
    }
    
    .multiplication-game {
        padding: 1.1rem;
        margin: 8px auto;
    }
    
    .title-row {
        gap: 0.5rem;
        margin-bottom: 0.9rem;
    }
    
    .title-with-button {
        gap: 0.5rem;
    }
    
    .title-with-button h1 {
        font-size: 1.5rem;
        padding: 0.6rem;
    }
    
    .home-btn-small {
        width: 44px;
        height: 44px;
        font-size: 1.3rem;
    }
    
    /* 移动端答案按钮进一步缩小 */
    .answer {
        width: 40px; /* 移动端40px */
        height: 40px;
        font-size: 1.1rem;
    }
    
    .equation-number,
    .equation-result {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }
    
    .equation {
        font-size: 1.2rem;
        padding: 0.8rem;
        gap: 0.4rem;
    }
    
    .equation-result.filled {
        font-size: 1.1rem !important;
    }
    
    /* 算式容器 */
    .equations-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.7rem;
    }
    
    /* 答案容器 */
    .answers-container {
        padding: 0.7rem;
        gap: 0.35rem;
        margin-bottom: 1.1rem;
    }
    
    .completion-counter {
        font-size: 0.9rem;
        padding: 0.45rem;
        margin-bottom: 0.9rem;
    }
    
    /* 按钮容器 - 保持一行 */
    .buttons-container {
        flex-direction: row;
        align-items: center;
        gap: 0.7rem;
    }
    
    .game-btn {
        width: auto;
        max-width: 180px;
        padding: 0.7rem 1.1rem;
        font-size: 0.85rem;
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .multiplication-game {
        padding: 1rem;
        margin: 5px auto;
    }
    
    .title-with-button h1 {
        font-size: 1.3rem;
        padding: 0.5rem;
    }
    
    .home-btn-small {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .answer {
        width: 36px; /* 超小屏幕36px */
        height: 36px;
        font-size: 1rem;
    }
    
    .equation-number,
    .equation-result {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .equation-result.filled {
        font-size: 1rem !important;
    }
    
    .equation {
        font-size: 1.1rem;
        padding: 0.7rem;
        gap: 0.3rem;
    }
    
    /* 超小屏幕：算式改为1列 */
    .equations-container {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }
    
    .buttons-container {
        gap: 0.6rem;
    }
    
    .game-btn {
        max-width: 160px;
        padding: 0.65rem 0.9rem;
        font-size: 0.8rem;
        min-width: 110px;
    }
}

@media (min-width: 769px) {
    .multiplication-game {
        margin-top: 25px;
    }
}

/* ====== 动画效果 ====== */
@keyframes clay-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.clay-bounce {
    animation: clay-bounce 0.5s ease infinite;
}

@keyframes clay-pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.6; }
}

.answer.dragging {
    animation: clay-pulse 1s infinite;
}

@keyframes success-pop {
    0% { transform: scale(0.8); opacity: 0; }
    70% { transform: scale(1.03); }
    100% { transform: scale(1); opacity: 1; }
}

.equation-result.filled {
    animation: success-pop 0.2s ease;
}

@keyframes shake {
    0%, 100% { transform: translate3d(0, 0, 0); }
    10%, 30%, 50%, 70%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 40%, 60%, 80% { transform: translate3d(1px, 0, 0); }
}

/* ====== 性能优化 ====== */
.performance-optimized {
    contain: layout style paint;
    transform: translateZ(0);
}

/* ====== 首页样式 ====== */
.home-container {
    background: var(--bg-white-80);
    border-radius: var(--clay-radius-lg);
    box-shadow: var(--clay-shadow);
    border: 2px solid var(--border-white);
    padding: 1.6rem;
    max-width: 800px;
    margin: 0 auto;
    backdrop-filter: blur(5px);
}

.number-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.number-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
    border-radius: var(--clay-radius-md);
    text-decoration: none;
    color: var(--text-white);
    font-size: 1.8rem;
    font-weight: bold;
    transition: all var(--transition-normal);
    box-shadow: var(--clay-shadow);
    border: 2px solid var(--border-white);
    position: relative;
    overflow: hidden;
}

.number-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: 0.5s;
}

.number-card:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: var(--clay-shadow-hover);
}

.number-card:hover::before {
    left: 100%;
}

/* ====== 首页卡片颜色 ====== */
.number-card[href*="2"] {
    background: linear-gradient(145deg, #87CEEB, #5DB8EB);
}

.number-card[href*="3"] {
    background: linear-gradient(145deg, #FFD93D, #FFC107);
}

.number-card[href*="4"] {
    background: linear-gradient(145deg, #D1D1FF, #A5A5FF);
}

.number-card[href*="5"] {
    background: linear-gradient(145deg, #80DED9, #5DC9C3);
}

.number-card[href*="6"] {
    background: linear-gradient(145deg, #FFB6C1, #FF8FA3);
}

.number-card[href*="7"] {
    background: linear-gradient(145deg, #A8E063, #8CC63F);
}

.number-card[href*="8"] {
    background: linear-gradient(145deg, #FFCBA4, #FFB07C);
}

.number-card[href*="9"] {
    background: linear-gradient(145deg, #FFE066, #FFD233);
}

/* 未完成的卡片 */
.number-card:not([href*="2"]):not([href*="3"]):not([href*="4"]):not([href*="5"]):not([href*="6"]):not([href*="7"]):not([href*="8"]):not([href*="9"]) {
    background: linear-gradient(145deg, #94A3B8, #64748B);
    opacity: 0.7;
    cursor: not-allowed;
}

.number-card:not([href*="2"]):not([href*="3"]):not([href*="4"]):not([href*="5"]):not([href*="6"]):not([href*="7"]):not([href*="8"]):not([href*="9"]):hover {
    transform: none;
    box-shadow: var(--clay-shadow);
}

@media (max-width: 768px) {
    .number-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .number-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ====== 9的乘法游戏完成弹窗样式 ====== */

/* 遮罩层 - 匹配粘土风格 */
.completion-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    backdrop-filter: blur(3px);
    padding: 18px;
}

.completion-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 弹窗容器 - 完全匹配粘土风格 */
.completion-modal {
    width: 100%;
    max-width: 450px;
    background: var(--bg-white-90);
    border-radius: var(--clay-radius-lg);
    box-shadow: var(--clay-shadow);
    border: 2px solid var(--border-white);
    padding: 1.8rem;
    text-align: center;
    transform: translateY(30px) scale(0.95);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(5px);
}

.completion-overlay.active .completion-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* 弹窗标题 - 匹配9的乘法游戏颜色 */
.completion-title {
    color: #FFA500; /* 9的乘法游戏数字颜色 */
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 1.2rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.07);
    padding: 0.8rem;
    border-radius: var(--clay-radius-md);
    background: linear-gradient(145deg, rgba(255, 224, 102, 0.1), rgba(255, 255, 255, 0.9));
    box-shadow: var(--clay-shadow);
    border: 2px solid rgba(255, 224, 102, 0.2);
}

/* 完成消息 */
.completion-message {
    font-size: 1.2rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    color: var(--text-medium);
    padding: 0.8rem;
    border-radius: var(--clay-radius-sm);
    background: var(--bg-white-80);
    box-shadow: inset 2px 2px 5px rgba(255, 255, 255, 0.4);
}

/* 按钮容器 */
.completion-buttons {
    display: flex;
    gap: 0.9rem;
    justify-content: center;
    margin-top: 1.2rem;
}

/* 返回首页按钮 - 使用9的主题颜色 */
#return-home-btn {
    background: linear-gradient(145deg, #FFE066, #FFD233);
    color: white;
    border: none;
    padding: 0.8rem 1.6rem;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: var(--clay-radius-sm);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--clay-shadow);
    border: 2px solid var(--border-white);
    position: relative;
    overflow: hidden;
    min-width: 140px;
}

#return-home-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: 0.5s;
}

#return-home-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--clay-shadow-hover);
}

#return-home-btn:hover::before {
    left: 100%;
}

#return-home-btn:active {
    transform: translateY(0);
    box-shadow: var(--clay-shadow-active);
}

/* 再次练习按钮 - 使用灰色 */
#practice-again-btn {
    background: linear-gradient(145deg, #94A3B8, #6B7280);
    color: white;
    border: none;
    padding: 0.8rem 1.6rem;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: var(--clay-radius-sm);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--clay-shadow);
    border: 2px solid var(--border-white);
    position: relative;
    overflow: hidden;
    min-width: 140px;
}

#practice-again-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: 0.5s;
}

#practice-again-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--clay-shadow-hover);
}

#practice-again-btn:hover::before {
    left: 100%;
}

#practice-again-btn:active {
    transform: translateY(0);
    box-shadow: var(--clay-shadow-active);
}

/* 移动端响应式 */
@media (max-width: 768px) {
    .completion-modal {
        padding: 1.4rem;
        max-width: 380px;
    }
    
    .completion-title {
        font-size: 1.5rem;
        padding: 0.7rem;
    }
    
    .completion-message {
        font-size: 1.1rem;
        padding: 0.7rem;
    }
    
    .completion-buttons {
        flex-direction: column;
        align-items: center;
        gap: 0.7rem;
    }
    
    #return-home-btn,
    #practice-again-btn {
        width: 100%;
        max-width: 200px;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .completion-overlay {
        padding: 10px;
    }
    
    .completion-modal {
        padding: 1.2rem;
    }
    
    .completion-title {
        font-size: 1.3rem;
        padding: 0.6rem;
    }
    
    .completion-message {
        font-size: 1rem;
        padding: 0.6rem;
    }
}

/* ===================================================================
   SEO文章样式 - 所有数字页面通用
   =================================================================== */

/* SEO文章区域容器 */
.seo-articles-section {
    max-width: 1000px;
    margin: 3rem auto 0;
    padding: 2.5rem 1.8rem;
    font-family: 'Raleway', sans-serif;
    line-height: 1.7;
    color: #2c3e50;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

/* 文章分隔线 */
.seo-articles-section hr {
    margin: 2.5rem 0;
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, #e0e0e0, transparent);
}

/* 通用标题样式 */
.seo-articles-section h2 {
    color: #2c3e50;
    border-bottom: 3px solid;
    padding-bottom: 12px;
    margin: 2.2rem 0 1.5rem;
    font-size: 1.9rem;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.05);
}

.seo-articles-section h3 {
    color: #2c3e50;
    margin: 1.8rem 0 1rem;
    font-size: 1.5rem;
    font-weight: 600;
    padding-left: 0.5rem;
    border-left: 4px solid;
}

.seo-articles-section h4 {
    color: #34495e;
    margin: 1.2rem 0 0.8rem;
    font-size: 1.2rem;
    font-weight: 600;
}

/* 段落和列表 */
.seo-articles-section p {
    margin-bottom: 1.2rem;
    color: #3a506b;
    text-align: left;
}

.seo-articles-section ul, 
.seo-articles-section ol {
    padding-left: 1.8rem;
    margin: 1rem 0 1.5rem;
    color: #3a506b;
}

.seo-articles-section li {
    margin-bottom: 0.7rem;
    line-height: 1.6;
}

.seo-articles-section strong {
    color: #2c3e50;
    font-weight: 700;
}

.seo-articles-section em {
    color: #7f8c8d;
    font-style: italic;
}

/* 数字特定文章样式 */
.digit-specific-article .digit-logic h2 {
    border-bottom-color: #3498db;
}

.digit-specific-article h3 {
    border-left-color: #3498db;
}

/* 步骤框样式 */
.digit-specific-article .step-box {
    background: linear-gradient(135deg, rgba(135, 206, 235, 0.08), rgba(255, 255, 255, 0.9));
    border-left: 4px solid #3498db;
    padding: 1.2rem;
    margin: 1.5rem 0;
    border-radius: 0 10px 10px 0;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
    transition: transform 0.2s ease;
}

.digit-specific-article .step-box:hover {
    transform: translateX(5px);
}

/* 乘法表文章样式 */
.times-table-article h2 {
    border-bottom-color: #2ecc71;
}

.times-table-article h3 {
    border-left-color: #2ecc71;
}

/* 学习路径介绍框 */
.learning-path-intro {
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.08), rgba(255, 255, 255, 0.9));
    border-left: 4px solid #2ecc71;
    padding: 1.3rem;
    margin: 1.8rem 0 2rem;
    border-radius: 0 10px 10px 0;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
}

/* 示例框 */
.example-box {
    background: linear-gradient(135deg, rgba(155, 89, 182, 0.08), rgba(255, 255, 255, 0.9));
    border: 1px dashed rgba(155, 89, 182, 0.3);
    padding: 1.3rem;
    margin: 1.5rem 0;
    border-radius: 10px;
}

/* 下一步骤框 */
.next-steps {
    background: linear-gradient(135deg, rgba(230, 126, 34, 0.08), rgba(255, 255, 255, 0.9));
    border-left: 4px solid #e67e22;
    padding: 1.3rem;
    margin: 2.5rem 0 1rem;
    border-radius: 0 10px 10px 0;
    box-shadow: 0 3px 10px rgba(0,0,0,0.05);
}

/* FAQ部分样式 */
.faq-section h2 {
    border-bottom-color: #e74c3c;
}

.faq-section h3 {
    border-left-color: #e74c3c;
}

.faq-item {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #ecf0f1;
}

.faq-item:last-child {
    border-bottom: none;
    margin-bottom: 1rem;
}

.faq-item h3 {
    color: #e74c3c;
    margin: 0 0 0.8rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.faq-item p {
    color: #4a5568;
    margin-bottom: 0;
}

/* For Teachers部分样式 */
.for-teachers-section h2 {
    border-bottom-color: #9b59b6;
}

.for-teachers-section h3 {
    border-left-color: #9b59b6;
    margin-top: 1.5rem;
}

/* 链接样式 */
.seo-logic-link,
.user-action-link {
    color: #2980b9;
    text-decoration: none;
    border-bottom: 1px dotted #2980b9;
    transition: all 0.2s ease;
    font-weight: 500;
    padding: 0 1px;
}

.user-action-link {
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 1px solid #2c3e50;
}

.seo-logic-link:hover,
.user-action-link:hover {
    color: #e74c3c;
    border-bottom-style: solid;
    border-bottom-color: #e74c3c;
    text-decoration: none;
}

/* 主题颜色适配 - 确保每个数字页面的文章保持一致的风格 */
.theme-2 .digit-specific-article .digit-logic h2 { border-bottom-color: #87CEEB; }
.theme-2 .digit-specific-article h3 { border-left-color: #87CEEB; }
.theme-2 .digit-specific-article .step-box { border-left-color: #87CEEB; }

.theme-3 .digit-specific-article .digit-logic h2 { border-bottom-color: #FFD93D; }
.theme-3 .digit-specific-article h3 { border-left-color: #FFD93D; }
.theme-3 .digit-specific-article .step-box { border-left-color: #FFD93D; }

.theme-4 .digit-specific-article .digit-logic h2 { border-bottom-color: #D1D1FF; }
.theme-4 .digit-specific-article h3 { border-left-color: #D1D1FF; }
.theme-4 .digit-specific-article .step-box { border-left-color: #D1D1FF; }

.theme-5 .digit-specific-article .digit-logic h2 { border-bottom-color: #80DED9; }
.theme-5 .digit-specific-article h3 { border-left-color: #80DED9; }
.theme-5 .digit-specific-article .step-box { border-left-color: #80DED9; }

.theme-6 .digit-specific-article .digit-logic h2 { border-bottom-color: #FFB6C1; }
.theme-6 .digit-specific-article h3 { border-left-color: #FFB6C1; }
.theme-6 .digit-specific-article .step-box { border-left-color: #FFB6C1; }

.theme-7 .digit-specific-article .digit-logic h2 { border-bottom-color: #A8E063; }
.theme-7 .digit-specific-article h3 { border-left-color: #A8E063; }
.theme-7 .digit-specific-article .step-box { border-left-color: #A8E063; }

.theme-8 .digit-specific-article .digit-logic h2 { border-bottom-color: #FFCBA4; }
.theme-8 .digit-specific-article h3 { border-left-color: #FFCBA4; }
.theme-8 .digit-specific-article .step-box { border-left-color: #FFCBA4; }

.theme-9 .digit-specific-article .digit-logic h2 { border-bottom-color: #FFE066; }
.theme-9 .digit-specific-article h3 { border-left-color: #FFE066; }
.theme-9 .digit-specific-article .step-box { border-left-color: #FFE066; }

/* 响应式设计 */
@media (max-width: 768px) {
    .seo-articles-section {
        padding: 1.8rem 1.2rem;
        margin: 2rem auto 0;
        border-radius: 15px;
    }
    
    .seo-articles-section h2 {
        font-size: 1.6rem;
        margin: 1.8rem 0 1.2rem;
        padding-bottom: 10px;
    }
    
    .seo-articles-section h3 {
        font-size: 1.3rem;
        margin: 1.5rem 0 1rem;
    }
    
    .digit-specific-article .step-box,
    .learning-path-intro,
    .next-steps {
        padding: 1rem;
        margin: 1.2rem 0;
    }
    
    .faq-item {
        margin-bottom: 1.5rem;
        padding-bottom: 1.2rem;
    }
    
    .seo-articles-section hr {
        margin: 2rem 0;
    }
}

@media (max-width: 480px) {
    .seo-articles-section {
        padding: 1.5rem 1rem;
        margin: 1.5rem auto 0;
        border-radius: 12px;
    }
    
    .seo-articles-section h2 {
        font-size: 1.4rem;
        margin: 1.5rem 0 1rem;
    }
    
    .seo-articles-section h3 {
        font-size: 1.2rem;
        margin: 1.2rem 0 0.8rem;
        padding-left: 0.3rem;
        border-left-width: 3px;
    }
    
    .seo-articles-section p {
        font-size: 0.95rem;
        line-height: 1.6;
    }
    
    .seo-articles-section ul,
    .seo-articles-section ol {
        padding-left: 1.3rem;
    }
}