:root {
    --primary-color: #FF9F1C; /* 活力的橙色 */
    --secondary-color: #2EC4B6; /* 清新的蓝绿色 */
    --accent-color: #E71D36; /* 醒目的红色 */
    --bg-color: #FDFFFC; /* 柔和的白色背景 */
    --text-color: #011627; /* 深色文字 */
    --card-bg: #FFFFFF;
    --border-radius: 16px;
    --shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    --font-family: 'Comic Sans MS', 'Chalkboard SE', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; /* 活泼的字体 */
}

body {
    font-family: var(--font-family);
    background-color: #f0f4f8;
    color: var(--text-color);
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.app-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color), #ffbd61);
    border-radius: var(--border-radius);
    color: white;
    box-shadow: var(--shadow);
}

h1 {
    margin: 0;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.subtitle {
    margin-top: 10px;
    font-size: 1.1rem;
    opacity: 0.9;
}

/* 导航栏 */
.main-nav {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.nav-btn {
    padding: 12px 24px;
    border: none;
    background-color: white;
    color: var(--text-color);
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
    font-family: inherit;
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
    background-color: #f8f9fa;
}

.nav-btn.active {
    background-color: var(--secondary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(46, 196, 182, 0.3);
}

/* 内容区域 */
.tab-content {
    display: none;
    animation: fadeIn 0.5s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 控制面板 */
.control-panel {
    background: var(--card-bg);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

input[type="text"] {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 30px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
    font-family: inherit;
}

input[type="text"]:focus {
    border-color: var(--secondary-color);
}

button {
    font-family: inherit;
}

.search-box button {
    padding: 12px 30px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s;
}

.search-box button:hover {
    background-color: #e68a00;
}

.filter-box {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-btn {
    padding: 8px 16px;
    background-color: #f0f0f0;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s;
    color: #666;
}

.filter-btn.active {
    background-color: var(--secondary-color);
    color: white;
}

/* 单词列表 */
.word-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.word-card {
    background: var(--card-bg);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    text-align: center;
    border-bottom: 5px solid var(--secondary-color);
    position: relative;
    overflow: hidden;
}

.word-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

.word-card h3 {
    margin: 15px 0 10px 0;
    font-size: 1.8rem;
    color: var(--text-color);
}

.word-card .phonetic {
    color: #888;
    font-family: 'Arial', sans-serif;
    margin-bottom: 10px;
    display: block;
}

.word-card .meaning {
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: bold;
}

.word-card .grade-tag {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #f0f0f0;
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    color: #666;
}

.word-card .version-tag {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #e3f2fd;
    color: #1976d2;
    padding: 4px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 500px;
    padding: 40px;
    border-radius: 24px;
    position: relative;
    text-align: center;
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 2rem;
    cursor: pointer;
    color: #aaa;
    line-height: 1;
}

.close-btn:hover {
    color: #333;
}

.detail-word {
    font-size: 3rem;
    color: var(--text-color);
    margin-bottom: 10px;
}

.detail-phonetic {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 20px;
}

.detail-meaning {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    font-weight: bold;
}

.detail-info {
    margin-bottom: 20px;
}

.detail-info .tag {
    display: inline-block;
    background-color: #eee;
    padding: 4px 10px;
    border-radius: 12px;
    margin: 0 5px;
    font-size: 0.9rem;
    color: #555;
}

.detail-example {
    background-color: #f9f9f9;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    font-style: italic;
    color: #555;
}

.action-btn {
    padding: 12px 30px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1.1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.3s;
}

.action-btn:hover {
    background-color: #25a296;
}

/* 游戏通用样式 */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: white;
    padding: 15px 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    gap: 15px;
}

.game-header h2 {
    margin: 0;
    color: var(--primary-color);
}

.game-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.game-controls select {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-family: inherit;
    font-size: 1rem;
}

.start-btn {
    padding: 8px 20px;
    background-color: var(--accent-color);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
}

.start-btn:hover {
    background-color: #c71026;
}

.game-stats span {
    margin-left: 15px;
    font-weight: bold;
    font-size: 1.1rem;
}

/* 翻牌游戏 */
.game-board {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    min-height: 400px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    align-content: start;
}

@keyframes floatUp {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(-50px); opacity: 0; }
}

@keyframes slash {
    0% { transform: scale(0.5) rotate(0deg); opacity: 0; }
    50% { transform: scale(1.2) rotate(45deg); opacity: 1; }
    100% { transform: scale(1) rotate(90deg); opacity: 0; }
}

.item-card {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 5px;
    padding: 5px;
    text-align: center;
    cursor: pointer;
    font-size: 0.8rem;
}
.item-card:hover {
    background: rgba(255,255,255,0.3);
}

.equip-slot {
    background: rgba(0,0,0,0.5);
    color: #fff;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.memory-card {
    background-color: white;
    border-radius: 12px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    perspective: 1000px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s;
}

.memory-card.flipped {
    transform: rotateY(180deg);
}

.memory-card .front, .memory-card .back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    padding: 10px;
    box-sizing: border-box;
    text-align: center;
    font-weight: bold;
}

.memory-card .front {
    background-color: var(--secondary-color);
    color: white;
    font-size: 2rem;
    transform: rotateY(0deg);
}

.memory-card .back {
    background-color: white;
    color: var(--text-color);
    border: 2px solid var(--secondary-color);
    transform: rotateY(180deg);
    font-size: 1.2rem;
    word-break: break-word;
}

.memory-card.matched .back {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

/* 拼写挑战 */
.spell-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.spell-card {
    background: white;
    padding: 40px;
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.spell-meaning {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    font-weight: bold;
}

.spell-category {
    color: #888;
    margin-bottom: 30px;
}

.spell-input-area {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.spell-input-area input {
    font-size: 1.5rem;
    text-align: center;
    letter-spacing: 2px;
}

.check-btn {
    padding: 0 30px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 1.2rem;
    cursor: pointer;
}

.spell-feedback {
    height: 30px;
    margin-bottom: 20px;
    font-weight: bold;
    font-size: 1.2rem;
}

.spell-feedback.correct { color: #28a745; }
.spell-feedback.wrong { color: #dc3545; }

.spell-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.icon-btn {
    background: none;
    border: 2px solid #ddd;
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.icon-btn:hover {
    background-color: #f0f0f0;
    border-color: #bbb;
}

.next-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 30px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
}

/* 单词雨 */
.rain-container {
    position: relative;
    height: 500px;
    background-color: #2c3e50;
    border-radius: var(--border-radius);
    overflow: hidden;
    color: white;
}

.rain-input-container {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    z-index: 10;
}

.rain-input-container input {
    width: 100%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
}

.falling-word {
    position: absolute;
    top: -30px;
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    padding: 5px 10px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    white-space: nowrap;
}

.placeholder-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ccc;
    font-size: 1.5rem;
    text-align: center;
}

/* 冒险岛游戏样式 */
.adv-opt-btn {
    padding: 10px 20px;
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 20px;
    color: var(--primary-color);
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.1rem;
    min-width: 120px;
}

.adv-opt-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* 响应式调整 */
@media (max-width: 600px) {
    .game-board {
        grid-template-columns: repeat(3, 1fr);
    }
    
    h1 {
        font-size: 1.8rem;
    }
    
    .nav-btn {
        padding: 8px 16px;
        font-size: 0.9rem;
    }
    
    .snake-container, .adventure-container {
        width: 100% !important;
        height: 300px !important;
    }
    
    #snakeCanvas {
        width: 100%;
        height: 100%;
    }
}