* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial Rounded MT Bold', 'Arial', sans-serif;
}

body {
    background-color: #f0f7ff;
    color: #333;
    line-height: 1.6;
    padding: 20px;
    min-height: 100vh;
    background-image: radial-gradient(#a8d8ff 1px, transparent 1px);
    background-size: 20px 20px;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    background-color: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 80, 180, 0.15);
    overflow: hidden;
    border: 8px solid #4d9fff;
}

header {
    background: linear-gradient(135deg, #4d9fff 0%, #2a6dcc 100%);
    color: white;
    padding: 25px;
    text-align: center;
    position: relative;
}

h1 {
    font-size: 2.8rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 1px;
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

.game-container {
    display: flex;
    flex-direction: column;
    padding: 25px;
}

/* 模式选择区域 */
.mode-selection {
    background-color: #e6f2ff;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 5px 15px rgba(0, 60, 150, 0.1);
}

.mode-selection h2 {
    color: #2a6dcc;
    margin-bottom: 15px;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.mode-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
}

.mode-btn {
    padding: 25px 30px;
    font-size: 1.4rem;
    font-weight: bold;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: white;
    color: #333;
    box-shadow: 0 4px 8px rgba(0, 60, 150, 0.15);
    min-width: 250px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.mode-btn i {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.mode-btn p {
    font-size: 1rem;
    font-weight: normal;
    color: #666;
    margin-top: 5px;
}

.mode-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 7px 14px rgba(0, 60, 150, 0.2);
}

.mode-btn.active {
    transform: scale(1.05);
    box-shadow: 0 10px 20px rgba(0, 60, 150, 0.25);
}

.mode-btn[data-mode="normal"] {
    border: 3px solid #2ecc71;
    color: #27ae60;
}

.mode-btn[data-mode="normal"]:hover,
.mode-btn[data-mode="normal"].active {
    background: linear-gradient(135deg, #e6f7e6 0%, #d4f1d4 100%);
}

.mode-btn[data-mode="challenge"] {
    border: 3px solid #e74c3c;
    color: #c0392b;
}

.mode-btn[data-mode="challenge"]:hover,
.mode-btn[data-mode="challenge"].active {
    background: linear-gradient(135deg, #ffe6e6 0%, #f8d7da 100%);
}

.mode-btn[data-mode="study"] {
    border: 3px solid #9b59b6;
    color: #8e44ad;
}

.mode-btn[data-mode="study"]:hover,
.mode-btn[data-mode="study"].active {
    background: linear-gradient(135deg, #f5e6ff 0%, #e6d4f7 100%);
}

/* 游戏区域 */
.game-area {
    display: none;
    flex-direction: column;
    gap: 25px;
}

/* 学习成语区域 */
.study-area {
    display: none;
    flex-direction: column;
    gap: 25px;
}

.study-header {
    background-color: #f5e6ff;
    padding: 20px 25px;
    border-radius: 15px;
    border: 3px solid #9b59b6;
}

.study-header h2 {
    color: #8e44ad;
    margin-bottom: 20px;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.study-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
    align-items: center;
}

.search-container {
    flex: 1;
    min-width: 300px;
    position: relative;
    display: flex;
    align-items: center;
}

.search-container i {
    position: absolute;
    left: 15px;
    color: #8e44ad;
    font-size: 1.2rem;
}

#idiom-search {
    width: 100%;
    padding: 15px 15px 15px 45px;
    font-size: 1.2rem;
    border: 2px solid #9b59b6;
    border-radius: 10px;
    outline: none;
    transition: all 0.3s ease;
}

#idiom-search:focus {
    box-shadow: 0 0 0 3px rgba(155, 89, 182, 0.3);
}

.filter-container {
    display: flex;
    gap: 15px;
    align-items: center;
}

#grade-filter {
    padding: 12px 20px;
    font-size: 1.1rem;
    border: 2px solid #9b59b6;
    border-radius: 10px;
    background-color: white;
    color: #333;
    cursor: pointer;
    outline: none;
}

.back-btn {
    padding: 12px 25px;
    font-size: 1.1rem;
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.back-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}

.idioms-list-container {
    background-color: white;
    border-radius: 15px;
    padding: 20px;
    border: 2px solid #e6d4f7;
    box-shadow: 0 5px 15px rgba(155, 89, 182, 0.1);
}

.idiom-count {
    font-size: 1.2rem;
    color: #8e44ad;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e6d4f7;
}

.idiom-count span {
    font-weight: bold;
    font-size: 1.4rem;
    color: #9b59b6;
}

.idioms-list {
    max-height: 500px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 10px;
}

.idiom-card {
    background-color: #f9f0ff;
    border-radius: 12px;
    padding: 20px;
    border-left: 5px solid #9b59b6;
    transition: all 0.3s ease;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.idiom-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.idiom-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.idiom-card-idiom {
    font-size: 1.8rem;
    font-weight: bold;
    color: #8e44ad;
}

.idiom-card-grade {
    background-color: #8e44ad;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
}

.idiom-card-pinyin {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 10px;
    font-style: italic;
}

.idiom-card-meaning {
    font-size: 1rem;
    color: #555;
    line-height: 1.5;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #e6f2ff;
    padding: 15px 25px;
    border-radius: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.mode-indicator {
    font-size: 1.4rem;
    color: #2a6dcc;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

.timer-container {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.4rem;
    color: #e74c3c;
    font-weight: bold;
}

.timer {
    font-size: 2.2rem;
    background-color: white;
    padding: 10px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    min-width: 120px;
    text-align: center;
}

.score-container {
    font-size: 1.5rem;
    color: #2a6dcc;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
}

.current-idiom-container {
    background-color: #fff9e6;
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(255, 193, 7, 0.1);
    border: 3px dashed #ffc107;
}

.current-idiom-container h3 {
    color: #e6a700;
    margin-bottom: 15px;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.current-idiom {
    font-size: 3.5rem;
    color: #e6a700;
    font-weight: bold;
    letter-spacing: 2px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    margin: 10px 0;
}

.idiom-pinyin {
    font-size: 1.4rem;
    color: #b38700;
    margin-top: 10px;
}

.idiom-meaning {
    font-size: 1.3rem;
    color: #666;
    margin-top: 15px;
    line-height: 1.8;
    padding: 15px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 10px;
}

.input-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
    background-color: #e6f7e6;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(46, 204, 113, 0.1);
    border: 3px dashed #2ecc71;
}

.input-area h3 {
    color: #27ae60;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.input-container {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

#idiom-input {
    flex: 1;
    min-width: 300px;
    padding: 18px 20px;
    font-size: 1.8rem;
    border: 3px solid #2ecc71;
    border-radius: 12px;
    outline: none;
    text-align: center;
    color: #2e6d44;
    font-weight: bold;
}

#idiom-input:focus {
    box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.3);
}

.buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 18px 30px;
    font-size: 1.5rem;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 1;
    min-width: 200px;
}

.submit-btn {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
}

.hint-btn {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
}

.restart-btn {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
}

.btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 7px 14px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(-2px);
}

.history-container {
    background-color: #f5e6ff;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(155, 89, 182, 0.1);
    border: 3px dashed #9b59b6;
}

.history-container h3 {
    color: #8e44ad;
    margin-bottom: 15px;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 15px;
    background-color: white;
    border-radius: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.history-item {
    background-color: #e6d4f7;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 1.3rem;
    font-weight: bold;
    color: #8e44ad;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.1);
}

.rules {
    background-color: #fff0e6;
    padding: 20px;
    border-radius: 15px;
    margin-top: 25px;
    border-left: 5px solid #ff8c42;
}

.rules h3 {
    color: #e67e22;
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.rules ul {
    padding-left: 25px;
    font-size: 1.1rem;
    color: #666;
}

.rules li {
    margin-bottom: 8px;
}

.message {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 20px 40px;
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: bold;
    z-index: 1000;
    display: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: fadeInOut 3s ease;
}

.success {
    background-color: #2ecc71;
    color: white;
}

.error {
    background-color: #e74c3c;
    color: white;
}

.info {
    background-color: #3498db;
    color: white;
}

@keyframes fadeInOut {
    0% { opacity: 0; top: 0; }
    15% { opacity: 1; top: 30px; }
    85% { opacity: 1; top: 30px; }
    100% { opacity: 0; top: 0; }
}

footer {
    text-align: center;
    padding: 25px;
    color: #666;
    font-size: 1.1rem;
    border-top: 2px solid #eaeaea;
    margin-top: 25px;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        border-radius: 15px;
        border-width: 5px;
    }
    
    h1 {
        font-size: 2.2rem;
    }
    
    .mode-btn {
        min-width: 100%;
        padding: 20px;
        font-size: 1.2rem;
    }
    
    .current-idiom {
        font-size: 2.8rem;
    }
    
    #idiom-input {
        min-width: 100%;
        font-size: 1.5rem;
        padding: 15px;
    }
    
    .btn {
        min-width: 100%;
        padding: 15px 20px;
    }
    
    .timer {
        font-size: 1.8rem;
        min-width: 100px;
    }
    
    .game-header {
        flex-direction: column;
        text-align: center;
    }
    
    .study-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-container {
        min-width: 100%;
    }
    
    .filter-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .idioms-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.8rem;
    }
    
    .current-idiom {
        font-size: 2.2rem;
    }
    
    .history-list {
        max-height: 150px;
    }
    
    .idiom-card {
        padding: 15px;
    }
    
    .idiom-card-idiom {
        font-size: 1.5rem;
    }
}
