* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-blue: #4361ee;
    --secondary-blue: #3f37c9;
    --primary-pink: #f72585;
    --secondary-pink: #b5179e;
    --light-bg: #f8f9fa;
    --dark-text: #2b2d42;
    --gray-text: #6c757d;
    --shadow-sm: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 40px -10px rgba(0, 0, 0, 0.15);
    --shadow-hover: 0 30px 50px -15px rgba(67, 97, 238, 0.3);
    --gradient-blue: linear-gradient(135deg, #4361ee, #3a0ca3);
    --gradient-pink: linear-gradient(135deg, #f72585, #b5179e);
}

/* 修改 body 字体 */
body {
    background: linear-gradient(145deg, #f0f2f5 0%, #ffffff 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    color: var(--dark-text);
}

.main-container {
    max-width: 1300px;
    width: 100%;
}

/* 头部 */
.header {
    text-align: center;
    margin-bottom: 30px;
}

/* 修改标题样式 */
.header h1 {
    font-size: clamp(2rem, 8vw, 3.5rem);
    color: #4361ee; /* 基础颜色 */
    margin-bottom: 10px;
    line-height: 1.2;
    padding: 0 10px;
    font-weight: 700;
}

/* 支持渐变的浏览器才应用渐变 */
@supports (background-clip: text) or (-webkit-background-clip: text) {
    .header h1 {
        background: linear-gradient(135deg, #4361ee, #f72585);
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
        -webkit-text-fill-color: transparent;
    }
}

.header p {
    color: var(--gray-text);
    font-size: clamp(0.9rem, 4vw, 1.2rem); /* 副标题也响应式 */
    font-weight: 500;
    padding: 0 15px;
}

/* 游戏类型切换按钮 - 并排 */
.game-type-selector {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0 30px;
}

.type-btn {
    padding: clamp(10px, 2vw, 14px) clamp(20px, 5vw, 40px); /* 内边距也响应式 */
    font-size: clamp(0.9rem, 2.5vw, 1.1rem); /* 使用vw单位 */
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: clamp(5px, 1vw, 8px);
    white-space: nowrap;
}

.type-btn.vocab {
    background: var(--gradient-blue);
    color: white;
}

.type-btn.sentence {
    background: var(--gradient-pink);
    color: white;
}

.type-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.type-btn.active {
    transform: scale(1.02);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.8), var(--shadow-hover);
}

/* 书本选择器 - 桌面左右展示 */
.book-selector {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 40px;
    margin: 50px 0 40px;
    perspective: 2000px;
    justify-content: center;
}

/* 在文件末尾的媒体查询部分添加 */

/* 500px以下画面 - 上下排列 */
@media screen and (max-width: 500px) {
    .book-selector {
        flex-direction: column;  /* 改为上下排列 */
        gap: 30px;               /* 调整间距 */
        align-items: center;      /* 居中对齐 */
    }
    
    .book-3d {
        width: 200px;            /* 稍微缩小书本尺寸 */
        height: 260px;
    }
}

/* 400px以下进一步优化 */
@media screen and (max-width: 400px) {
    .book-selector {
        gap: 25px;
    }
    
    .book-3d {
        width: 180px;
        height: 240px;
    }
    
    .book-3d-icon {
        font-size: 2.5rem;
    }
    
    .book-3d-title {
        font-size: 1.5rem;
    }
    
    .book-3d-subtitle {
        font-size: 0.9rem;
        padding: 3px 10px;
    }
}

/* 3D 书本 */
.book-3d {
    width: 260px;
    height: 320px;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.6s;
    animation: floatBook 6s ease-in-out infinite;
}

.book-3d:nth-child(2) {
    animation-delay: -3s;
}

@keyframes floatBook {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.book-3d-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
}

.book-3d-cover {
    width: 100%;
    height: 100%;
    position: absolute;
    border-radius: 10px 20px 20px 10px;
    transform-origin: left center;
    transition: transform 0.6s;
    box-shadow: 0 25px 35px -10px rgba(0,0,0,0.4);
    overflow: hidden;
}

.book-3d-cover.up {
    background: linear-gradient(145deg, #4361ee, #2a3f9c);
}

.book-3d-cover.down {
    background: linear-gradient(145deg, #f72585, #b5179e);
}

.book-3d-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.1) 0px, rgba(255,255,255,0.1) 2px, transparent 2px, transparent 8px);
    opacity: 0.3;
}

.book-3d-spine {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(to right, rgba(0,0,0,0.4), rgba(0,0,0,0.2) 40%, transparent);
    border-radius: 10px 0 0 10px;
}

.book-3d-shine {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 50%, rgba(255,255,255,0.1) 80%);
    opacity: 0;
    transition: opacity 0.5s;
}

.book-3d:hover .book-3d-shine {
    opacity: 1;
    animation: shine 2s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.book-3d-pages {
    position: absolute;
    right: -8px;
    top: 5px;
    bottom: 5px;
    width: 15px;
    transform: rotateY(-10deg) translateZ(2px);
}

.page-layer {
    position: absolute;
    right: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #fff, #f0f0f0);
    border-radius: 0 3px 3px 0;
    box-shadow: -2px 0 5px rgba(0,0,0,0.1);
}

.page-layer:nth-child(1) { transform: translateZ(2px); opacity: 0.9; }
.page-layer:nth-child(2) { transform: translateZ(4px); opacity: 0.8; }
.page-layer:nth-child(3) { transform: translateZ(6px); opacity: 0.7; }
.page-layer:nth-child(4) { transform: translateZ(8px); opacity: 0.6; }
.page-layer:nth-child(5) { transform: translateZ(10px); opacity: 0.5; }

.book-3d-ribbon {
    position: absolute;
    top: 15px;
    right: 5px;
    width: 25px;
    height: 60px;
    background: linear-gradient(145deg, #ffd166, #ffb347);
    border-radius: 0 5px 5px 10px;
    transform: rotate(8deg) skewY(-3deg) translateZ(12px);
    box-shadow: 3px 5px 10px rgba(0,0,0,0.2);
    z-index: 10;
}

.book-3d-ribbon::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 5px;
    width: 15px;
    height: 15px;
    background: inherit;
    clip-path: polygon(0 0, 100% 0, 50% 100%);
}

.book-3d-corner {
    position: absolute;
    width: 30px;
    height: 30px;
    border: 2px solid rgba(255,215,0,0.4);
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s;
}

.book-3d:hover .book-3d-corner {
    opacity: 1;
}

.book-3d-corner.top-left {
    top: 5px;
    left: 5px;
    border-right: none;
    border-bottom: none;
    border-top: 2px solid gold;
    border-left: 2px solid gold;
}

.book-3d-corner.top-right {
    top: 5px;
    right: 5px;
    border-left: none;
    border-bottom: none;
    border-top: 2px solid gold;
    border-right: 2px solid gold;
}

.book-3d-corner.bottom-left {
    bottom: 5px;
    left: 5px;
    border-right: none;
    border-top: none;
    border-bottom: 2px solid gold;
    border-left: 2px solid gold;
}

.book-3d-corner.bottom-right {
    bottom: 5px;
    right: 5px;
    border-left: none;
    border-top: none;
    border-bottom: 2px solid gold;
    border-right: 2px solid gold;
}

.book-open-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 20;
}

.open-page-left, .open-page-right {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    background: rgba(255,255,255,0.95);
    transform: rotateY(90deg);
    transform-origin: left;
    transition: transform 0.6s;
    backface-visibility: hidden;
}

.open-page-right {
    left: 50%;
    transform-origin: right;
}

.book-3d.active .open-page-left,
.book-3d.active .open-page-right {
    transform: rotateY(0deg);
}

.book-3d.active .book-3d-inner {
    transform: translateX(15px) rotateY(-15deg);
}

.book-3d.active .book-3d-cover {
    transform: rotateY(-20deg);
    box-shadow: 30px 20px 35px -10px rgba(0,0,0,0.5);
}

.open-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 50%, rgba(255,255,255,0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.book-3d.active .open-glow {
    opacity: 1;
    animation: glowPulse 2s infinite;
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.6; }
}

.book-3d-shadow {
    position: absolute;
    bottom: -20px;
    left: 15%;
    width: 70%;
    height: 20px;
    background: radial-gradient(ellipse at 50% 0%, rgba(0,0,0,0.3) 0%, transparent 80%);
    filter: blur(8px);
    transition: all 0.4s;
    z-index: -1;
}

.book-3d:hover .book-3d-shadow {
    bottom: -25px;
    opacity: 0.5;
    filter: blur(10px);
}

.book-3d-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    z-index: 5;
}

.book-3d-icon {
    font-size: 3.5rem;
    margin-bottom: 15px;
    filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.3));
    animation: iconFloat 3s ease-in-out infinite;
}

@keyframes iconFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.book-3d-title {
    font-size: 2rem;
    font-weight: 800;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.4);
    margin-bottom: 8px;

}

.book-3d-subtitle {
    font-size: 1.1rem;
    background: rgba(255,255,255,0.2);
    padding: 5px 15px;
    border-radius: 30px;
    backdrop-filter: blur(2px);
}

/* 面包屑导航 */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: clamp(5px, 1.5vw, 10px); /* 响应式间距 */
    margin: clamp(15px, 3vw, 20px) 0;
    padding: clamp(8px, 2vw, 12px) clamp(12px, 3vw, 20px);
    background: white;
    border-radius: 50px;
    box-shadow: var(--shadow-sm);
    flex-wrap: nowrap; /* 禁止换行 */
    overflow-x: auto; /* 允许横向滚动 */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* 隐藏滚动条（Firefox） */
    -ms-overflow-style: none; /* 隐藏滚动条（IE/Edge） */
}

.breadcrumb::-webkit-scrollbar {
    display: none; /* 隐藏滚动条（Chrome/Safari） */
}

.breadcrumb-item {
    color: var(--gray-text);
    cursor: pointer;
    padding: clamp(4px, 1.2vw, 5px) clamp(8px, 2.5vw, 12px);
    border-radius: 30px;
    transition: all 0.3s;
    font-size: clamp(0.75rem, 2.2vw, 0.95rem); /* 响应式字体 */
    white-space: nowrap; /* 禁止换行 */
    flex-shrink: 0; /* 防止压缩 */
}

.breadcrumb-separator {
    color: #d0ddee;
    font-size: clamp(0.9rem, 2.5vw, 1.2rem); /* 响应式分隔符 */
    white-space: nowrap;
    flex-shrink: 0;
}

/* 面包屑导航悬停效果 */
.breadcrumb-item:hover {
    color: var(--primary-blue);
    background: rgba(67, 97, 238, 0.1);
}

.breadcrumb-item.active {
    color: var(--primary-blue);
    font-weight: 600;
    background: linear-gradient(135deg, rgba(67,97,238,0.1), rgba(247,37,133,0.1));
}

/* 小屏幕优化 */
@media screen and (max-width: 480px) {
    .breadcrumb {
        gap: 5px;
        padding: 8px 12px;
    }
    
    .breadcrumb-item {
        padding: 4px 8px;
        font-size: 0.8rem;
    }
    
    .breadcrumb-separator {
        font-size: 1rem;
    }
}

/* 单元网格 */
.unit-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 20px 0;
}

/* 小节网格 */
.section-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin: 20px 0;
}

.unit-card, .section-card {
    background: white;
    border-radius: 20px;
    padding: clamp(15px, 3vw, 20px) clamp(10px, 2vw, 15px);
    cursor: pointer;
    font-weight: 600;
    color: var(--dark-text);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(5px, 1.5vw, 10px);
    text-align: center;
    max-width: 100%;
}

.unit-card:hover, .section-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
}

.unit-icon, .section-icon {
    width: 60px;
    height: 60px;
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    margin-bottom: 5px;
}

.unit-icon.vocab {
    background: var(--gradient-blue);
}

.unit-icon.sentence {
    background: var(--gradient-pink);
}

.section-icon {
    background: linear-gradient(135deg, #ff9a9e, #fad0c4);
    font-size: 1.5rem;
}

.unit-preview {
    font-size: clamp(0.7rem, 2vw, 0.9rem); /* 使用vw单位 */
    color: var(--gray-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.section-desc {
    font-size: clamp(0.65rem, 1.8vw, 0.85rem); /* 使用vw单位 */
    color: #b0c0d5;
    white-space: nowrap;
}

/* 游戏区域 */
.game-container {
    background: white;
    border-radius: 30px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    margin-top: 20px;
    display: none;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* 游戏标题文字 - 使用相对单位 */
.game-title {
    font-size: clamp(1.2rem, 4vw, 1.8rem); /* 使用vw单位 */
    font-weight: 700;
    color: var(--primary-blue);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.game-subtitle {
    font-size: clamp(0.8rem, 2.5vw, 1rem); /* 使用vw单位 */
    color: var(--gray-text);
    margin-top: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.back-to-menu {
    padding: 8px 20px;
    background: linear-gradient(135deg, #ff9a9e, #fad0c4);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.back-to-menu:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.stats-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 400px;
    margin: 20px 0;
    padding: 10px 20px;
    background: #f8f9fa;
    border-radius: 50px;
}

.score-box, .timer-box {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    color: var(--dark-text);
}

.score-box span, .timer-box span {
    font-weight: 700;
    background: var(--gradient-blue);
    color: white;
    padding: 4px 12px;
    border-radius: 25px;
    min-width: 60px;
    text-align: center;
}

/* 词汇消消乐 */
#vocabGameBoard {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 12px;
    padding: 20px 0;
}

/* 句子拼拼乐 */
#sentenceGameArea {
    display: none;
}

#sentenceContainer {
    min-height: 100px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 20px 0;
    padding: 20px;
    background: #f0f7ff;
    border-radius: 15px;
    border: 2px dashed var(--primary-blue);
}

#wordContainer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin: 20px 0;
}

/* 词汇消消乐泡泡 - 保持正方形 */
.bubble {
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: white;
    font-weight: 600;
    font-size: min(4vw, 20px);  /* 调大这个数值：从3vw调到4vw，从18px调到20px */
    padding: 0 5px;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    text-align: center;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
    width: 100%;
    height: 100%;
}

/* 句子拼拼乐的单词卡片 - 胶囊形状 */
.word {
    width: auto;
    aspect-ratio: auto;
    padding: clamp(8px, 2vw, 12px) clamp(15px, 3vw, 25px);
    border-radius: 50px;
    font-size: clamp(14px, 2.5vw, 18px);
    white-space: nowrap;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: white;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    background: linear-gradient(145deg, #ff9a9e, #fad0c4); /* 默认颜色，会被nth-child覆盖 */
    margin: 5px;
}

/* 句子拼拼乐的单词颜色 - 保持与泡泡相同的颜色循环 */
.word:nth-child(4n+1) { background: linear-gradient(145deg, #ff9a9e, #fad0c4); }
.word:nth-child(4n+2) { background: linear-gradient(145deg, #a1c4fd, #c2e9fb); }
.word:nth-child(4n+3) { background: linear-gradient(145deg, #84fab0, #8fd3f4); }
.word:nth-child(4n+4) { background: linear-gradient(145deg, #ffc3a0, #ffafbd); }

/* 词汇消消乐泡泡颜色 */
.bubble:nth-child(4n+1) { background: linear-gradient(145deg, #ff9a9e, #fad0c4); }
.bubble:nth-child(4n+2) { background: linear-gradient(145deg, #a1c4fd, #c2e9fb); }
.bubble:nth-child(4n+3) { background: linear-gradient(145deg, #84fab0, #8fd3f4); }
.bubble:nth-child(4n+4) { background: linear-gradient(145deg, #ffc3a0, #ffafbd); }

/* 悬停效果 */
.bubble:hover, .word:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 15px rgba(0,0,0,0.15);
}

/* 选中效果 */
.selected {
    transform: scale(1.15);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.9), 0 8px 20px rgba(0,0,0,0.2);
    z-index: 10;
}

/* 错误动画 */
.wrong { animation: shake 0.5s; }

/* 正确动画 */
.correct { animation: pop 0.5s forwards; }

@keyframes shake {
    0%, 100% { transform: translateX(0) scale(1.1); }
    20%, 60% { transform: translateX(-5px) scale(1.1); }
    40%, 80% { transform: translateX(5px) scale(1.1); }
}

@keyframes pop {
    0% { transform: scale(1.1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(0); }
}

.hidden {
    visibility: hidden;
    opacity: 0;
    transform: scale(0);
}

/* 句子拼拼乐的已选单词区域 */
#sentenceContainer {
    min-height: 100px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 20px 0;
    padding: 20px;
    background: #f0f7ff;
    border-radius: 15px;
    border: 2px dashed var(--primary-blue);
}

/* 句子拼拼乐的单词容器 */
#wordContainer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin: 20px 0;
}

/* 已选中的单词样式 */
.sentence-word {
    padding: 8px 16px;
    background: #e0edff;
    border-radius: 50px;
    font-size: 1rem;
    color: var(--primary-blue);
    white-space: nowrap;
    display: inline-block;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* 桌面端大屏幕优化 */
@media screen and (min-width: 1200px) {
    .bubble {
        font-size: 18px;
    }
}

/* 中等屏幕 */
@media screen and (max-width: 992px) {
    .bubble {
        font-size: min(3.5vw, 16px);
    }
}

/* 平板 */
@media screen and (max-width: 768px) {
    .bubble {
        font-size: min(4vw, 15px);
        padding: 0 3px;
    }
    
    .word {
        font-size: clamp(13px, 2.2vw, 16px);
        padding: clamp(6px, 1.5vw, 10px) clamp(12px, 2.5vw, 20px);
    }
}

/* 手机 */
@media screen and (max-width: 576px) {
    .bubble {
        font-size: min(5vw, 14px);
    }
    
    .word {
        font-size: clamp(12px, 3vw, 15px);
        padding: clamp(5px, 1.2vw, 8px) clamp(10px, 2vw, 15px);
    }
}

/* 小屏手机 */
@media screen and (max-width: 400px) {
    .bubble {
        font-size: min(6vw, 13px);
        padding: 0 2px;
    }
    
    .word {
        font-size: clamp(11px, 3.5vw, 13px);
        padding: clamp(4px, 1vw, 6px) clamp(8px, 1.5vw, 12px);
    }
}

/* 超小屏 */
@media screen and (max-width: 320px) {
    .bubble {
        font-size: min(7vw, 12px);
    }
    
    .word {
        font-size: clamp(10px, 4vw, 12px);
        padding: 4px 8px;
    }
}

.hidden {
    visibility: hidden;
    opacity: 0;
    transform: scale(0);
}

.sentence-word {
    padding: 8px 16px;
    background: #e0edff;
    border-radius: 50px;
    font-size: 1rem;
    color: var(--primary-blue);
}

.hint-text {
    font-size: 1.1rem;
    color: var(--gray-text);
    margin-bottom: 20px;
    font-style: italic;
}

/* 胜利弹窗 */
.win-message {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.win-message-content {
    background: white;
    border-radius: 30px;
    padding: 40px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: slideInDown 0.5s;
}

.win-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.win-message h2 {
    font-size: 1.8rem;
    color: var(--primary-blue);
    margin-bottom: 25px;
}

.win-stats {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin-bottom: 25px;
}

.win-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.win-stat-label {
    font-size: 0.9rem;
    color: var(--gray-text);
}

.win-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-blue);
}

.win-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.win-btn {
    padding: 12px 30px;
    font-size: 1rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    min-width: 140px;
}

.win-btn.primary {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: white;
}

.win-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(79,172,254,0.6);
}

.win-btn.secondary {
    background: linear-gradient(135deg, #ffd166, #ffb347);
    color: white;
}

.win-btn.secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(255,209,102,0.6);
}

.save-toast {
    margin-top: 20px;
    padding: 8px;
    background: #4caf50;
    color: white;
    border-radius: 30px;
    opacity: 0;
    transition: opacity 0.3s;
}

.save-toast.show {
    opacity: 1;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 游戏按钮 */
.game-start-btn {
    padding: 14px 40px;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    margin: 20px auto 0;
    display: block;
    font-weight: 600;
    transition: all 0.3s;
}

.game-start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px -5px rgba(79,172,254,0.6);
}

.reset-btn {
    padding: 12px 35px;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #ff758c, #ff7eb3);
    color: white;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.reset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(255,117,140,0.6);
}

.sentence-message {
    font-size: 1.2rem;
    margin: 20px 0;
    color: var(--primary-blue);
    min-height: 30px;
}

/* 音效开关 */
.sound-toggle {
    padding: 8px 18px;
    font-size: 0.95rem;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    background: white;
    color: var(--dark-text);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
}

.sound-toggle.muted {
    opacity: 0.5;
    background: #f0f0f0;
}

/* 底部样式 */
footer {
    width: 100%;
    margin-top: 20px;
    padding: 10px 15px;  /* 增加左右内边距 */
    text-align: center;
    border-top: 1px solid rgba(67,97,238,0.1);
    color: var(--gray-text);
    font-size: 0.9rem;
    box-sizing: border-box;
}

#footer-text {
    font-size: clamp(0.7rem, 2.5vw, 0.9rem);
    white-space: normal;  /* 允许换行 */
    word-break: break-word;  /* 长单词断行 */
    max-width: 100%;
    line-height: 1.6;  /* 增加行高，提高可读性 */
    display: inline-block;
    padding: 0 10px;
}

#footer-text a {
    color: var(--primary-blue);
    text-decoration: none;
    margin-left: 5px;  /* 减小左边距 */
    padding: 4px 12px;
    border-radius: 30px;
    background: rgba(67,97,238,0.1);
    transition: all 0.3s;
    display: inline-block;  /* 保持为行内块元素 */
    white-space: nowrap;  /* 按钮本身不换行 */
}

#footer-text a:hover {
    background: var(--primary-blue);
    color: white;
}

/* 超小屏幕优化 */
@media screen and (max-width: 480px) {
    footer {
        margin-top: 30px;
        padding: 15px 10px;
    }
    
    #footer-text {
        font-size: 0.8rem;
        display: flex;
        flex-direction: column;  /* 改为垂直排列 */
        align-items: center;
        gap: 10px;
    }
    
    #footer-text a {
        margin-left: 0;
        padding: 6px 15px;
        font-size: 0.8rem;
        width: auto;
        min-width: 100px;
    }
}

@media screen and (max-width: 350px) {
    #footer-text {
        font-size: 0.75rem;
    }
    
    #footer-text a {
        padding: 5px 12px;
        font-size: 0.75rem;
    }
}

.history-btn-container {
    text-align: center;
    margin: 20px 0;
}

.history-btn {
    padding: 8px 22px;
    font-size: 0.95rem;
    background: white;
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
    border-radius: 50px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.history-btn:hover {
    background: var(--primary-blue);
    color: white;
}

/* ========== 响应式设计 ========== */
@media screen and (max-width: 1024px) {
    .unit-grid, .section-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media screen and (max-width: 768px) {
    .game-type-selector {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .book-3d {
        width: 220px;
        height: 280px;
    }
    
    #vocabGameBoard {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .game-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .header-buttons {
        width: 100%;
        justify-content: flex-start;
    }
}

@media screen and (max-width: 576px) {
    .book-3d {
        width: 200px;
        height: 260px;
    }
    
    .unit-grid {
        grid-template-columns: 1fr;
    }
    
    .section-grid {
        grid-template-columns: 1fr;
    }
    
    #vocabGameBoard {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .game-container {
        padding: 20px;
    }
    
    .stats-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .score-box, .timer-box {
        width: 100%;
        justify-content: space-between;
    }
    
    .win-message-content {
        padding: 25px;
    }
    
    .win-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .win-buttons {
        flex-direction: column;
    }
    
    .win-btn {
        width: 100%;
    }
}

@media screen and (max-width: 400px) {
    .book-3d {
        width: 180px;
        height: 240px;
    }
    
    #vocabGameBoard {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 友情链接导航栏 - 超紧凑版 */
.friend-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 3px;  /* 链接之间的间距3px */
    margin: 0px 0 0px;  /* 上边距5px，下边距2px，几乎贴着footer */
    padding: 3px;
}

.link-btn {
    padding: 3px 1px;  /* 按钮内边距更小 */
    font-size: clamp(0.65rem, 2vw, 0.85rem);
    white-space: nowrap;
    text-decoration: none;
    color: #4361ee;
}