/* Idiom King Game - Modern UI Styles */
:root {
    --primary-color: #5b37eb;
    --primary-light: #7c61f0;
    --primary-dark: #4823c8;
    --secondary-color: #ff7e5f;
    --text-color: #333;
    --light-text: #fff;
    --background-color: #f9f9f9;
    --card-bg: #fff;
    --border-radius: 12px;
    --box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --success-color: #4caf50;
    --error-color: #e53935;
    --warning-color: #ff9800;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
header {
    background-color: var(--card-bg);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
}

.logo img {
    height: 40px;
    margin-right: 10px;
}

.logo img.inline {
    height: 30px;
    margin-left: 8px;
    vertical-align: middle;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

.logo span {
    color: var(--primary-color);
}

.user-info {
    display: flex;
    align-items: center;
}

.user-profile {
    display: flex;
    align-items: center;
}

.user-name {
    margin-right: 10px;
    font-weight: 500;
}

.user-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-color);
}

/* Music Controls */
.music-controls {
    display: flex;
    gap: 10px;
    margin-right: 20px;
    align-items: center;
}

.btn-music {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    box-shadow: 0 4px 10px rgba(91, 55, 235, 0.3);
}

.btn-music:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 15px rgba(91, 55, 235, 0.4);
}

.btn-music.muted {
    background: linear-gradient(135deg, #999, #666);
}

.btn-music.muted:hover {
    background: linear-gradient(135deg, #777, #555);
}

.btn-music i {
    transition: all 0.3s ease;
}

.btn-music:active {
    transform: translateY(0) scale(0.95);
}

/* Music indicator animation */
.btn-music.playing i {
    animation: musicPulse 1.5s infinite;
}

@keyframes musicPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Button Styles */
.btn {
    padding: 10px 20px;
    border-radius: var(--border-radius);
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn i {
    margin-right: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--light-text);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(91, 55, 235, 0.3);
}

.btn-secondary {
    background-color: #e0e0e0;
    color: var(--text-color);
}

.btn-secondary:hover {
    background-color: #d0d0d0;
    transform: translateY(-2px);
}

.btn-mode, .btn-type {
    padding: 12px 24px;
    margin: 0 10px;
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 2px solid #e0e0e0;
    min-width: 180px;
}

.btn-mode.active, .btn-type.active {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 5px 15px rgba(91, 55, 235, 0.2);
}

.btn-start {
    background-color: var(--secondary-color);
    color: var(--light-text);
    padding: 14px 40px;
    font-size: 1.2rem;
    margin-top: 30px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-start:hover {
    background-color: #ff6a46;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 126, 95, 0.4);
}

.btn-stop {
    background-color: var(--error-color);
    color: var(--light-text);
    padding: 14px 40px;
    font-size: 1.2rem;
    margin-top: 30px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-stop:hover {
    background-color: #c62828;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(229, 57, 53, 0.4);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Error and Loading States */
.error-message {
    background-color: rgba(229, 57, 53, 0.1);
    border: 1px solid var(--error-color);
    border-radius: var(--border-radius);
    padding: 15px;
    margin: 20px 0;
    text-align: center;
    color: var(--error-color);
    font-weight: 500;
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.connection-status {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 15px;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 1001;
    transition: var(--transition);
}

.connection-status.connected {
    background-color: rgba(76, 175, 80, 0.9);
    color: white;
}

.connection-status.disconnected {
    background-color: rgba(229, 57, 53, 0.9);
    color: white;
}

/* Promotional Overlay */
.promo-overlay {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 25px;
    border-radius: 15px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    z-index: 1001;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 90%;
    width: auto;
    min-width: 300px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 15px;
}

.promo-overlay.show {
    transform: translateX(-50%) translateY(0);
}

.promo-overlay.hide {
    transform: translateX(-50%) translateY(100%);
}

.promo-content {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.promo-icon {
    font-size: 1.5rem;
    color: #ffd700;
    animation: bounce 2s infinite;
    flex-shrink: 0;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-8px);
    }
    60% {
        transform: translateY(-4px);
    }
}

.promo-text {
    flex: 1;
    line-height: 1.4;
}

.promo-text p {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
}

.promo-link {
    color: #ffd700;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border-bottom: 1px solid transparent;
}

.promo-link:hover {
    color: #fff;
    border-bottom-color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.promo-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.promo-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.promo-close:active {
    transform: scale(0.95);
}

/* Responsive Design for Promo Overlay */
@media (max-width: 768px) {
    .promo-overlay {
        bottom: 15px;
        left: 15px;
        right: 15px;
        transform: translateY(100%);
        max-width: none;
        min-width: auto;
        width: auto;
        padding: 12px 18px;
        border-radius: 12px;
    }
    
    .promo-overlay.show {
        transform: translateY(0);
    }
    
    .promo-overlay.hide {
        transform: translateY(100%);
    }
    
    .promo-content {
        gap: 12px;
    }
    
    .promo-icon {
        font-size: 1.3rem;
    }
    
    .promo-text p {
        font-size: 0.9rem;
    }
    
    .promo-close {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .promo-overlay {
        bottom: 10px;
        left: 10px;
        right: 10px;
        padding: 10px 15px;
        border-radius: 10px;
    }
    
    .promo-content {
        gap: 10px;
        flex-direction: column;
        text-align: center;
    }
    
    .promo-icon {
        font-size: 1.2rem;
    }
    
    .promo-text p {
        font-size: 0.85rem;
    }
    
    .promo-close {
        position: absolute;
        top: 8px;
        right: 8px;
        width: 24px;
        height: 24px;
        font-size: 0.9rem;
    }
}

/* Game Mode Selection */
.game-modes, .game-types {
    margin: 30px 0;
    text-align: center;
}

.game-modes h2, .game-types h2 {
    margin-bottom: 20px;
    font-weight: 600;
    color: var(--text-color);
}

.mode-buttons, .type-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
}

.start-game-container {
    text-align: center;
    margin: 30px 0;
}

/* Language Mode Selection */
.language-modes {
    margin: 30px 0;
    text-align: center;
}

.language-modes h2 {
    margin-bottom: 20px;
    font-weight: 600;
    color: var(--text-color);
}

.language-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
}

.btn-language {
    padding: 12px 24px;
    margin: 0 10px;
    background-color: var(--card-bg);
    color: var(--text-color);
    border: 2px solid #e0e0e0;
    min-width: 180px;
}

.btn-language.active {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    box-shadow: 0 5px 15px rgba(255, 126, 95, 0.2);
}

/* Game Container */
.game-container {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 30px;
    margin: 30px 0;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.score-container {
    display: flex;
    align-items: center;
}

.score {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-right: 20px;
}

.streak-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.streak-icons {
    display: flex;
    margin-bottom: 5px;
}

.streak-icon {
    color: #d0d0d0;
    font-size: 1.2rem;
    margin: 0 3px;
    transition: var(--transition);
}

.streak-icon.active {
    color: #ffc107;
    transform: scale(1.2);
}

.streak-bonus {
    font-size: 0.8rem;
    color: #ffc107;
    font-weight: 600;
    opacity: 0;
    transition: var(--transition);
}

.streak-bonus.active {
    opacity: 1;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Timer */
.timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timer-bar {
    width: 200px;
    height: 8px;
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.timer-progress {
    height: 100%;
    width: 100%;
    background-color: var(--primary-color);
    transition: width 1s linear;
}

.timer-text {
    font-size: 1rem;
    font-weight: 600;
}

.timer-warning .timer-progress {
    background-color: var(--warning-color);
}

.timer-danger .timer-progress {
    background-color: var(--error-color);
}

/* Question Container */
.question-container {
    margin-top: 20px;
}

.question-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.question-image {
    width: 100%;
    max-width: 400px;
    height: 250px;
    margin-bottom: 30px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.question-image img {
    width: 100%;
    height: 100%;
    object-fit: fill;
    transition: transform 0.5s ease;
}

.question-image img:hover {
    transform: scale(1.05);
}

.question-idiom {
    text-align: center;
    margin-bottom: 30px;
}

.question-idiom h3 {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.question-idiom p {
    color: #666;
    font-size: 1.2rem;
}

/* Options Grid */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    width: 100%;
}

.option {
    background-color: #f5f5f5;
    border-radius: var(--border-radius);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100px;
    border: 2px solid transparent;
}

.option:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.option.selected {
    border-color: var(--primary-color);
}

.option.correct {
    background-color: rgba(76, 175, 80, 0.2);
    border-color: var(--success-color);
}

.option.incorrect {
    background-color: rgba(229, 57, 53, 0.2);
    border-color: var(--error-color);
}

.option.image-option {
    padding: 10px;
}

.option.image-option img {
    width: 100%;
    height: 180px;
    object-fit: fill;
    border-radius: 8px;
}

.option.idiom-option {
    flex-direction: column;
}

.option.idiom-option h4 {
    font-size: 1.2rem;
    margin-bottom: 5px;
}

.option.idiom-option p {
    font-size: 0.9rem;
    color: #666;
}

/* Battle Info */
.battle-info {
    margin-top: 40px;
    background-color: #f5f5f5;
    border-radius: var(--border-radius);
    padding: 20px;
}

.battle-info h3 {
    text-align: center;
    margin-bottom: 20px;
    font-weight: 600;
}

.battle-scores {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.player-score {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.player-name {
    font-weight: 600;
    width: 100px;
}

.score-bar {
    flex: 1;
    height: 10px;
    background-color: #e0e0e0;
    border-radius: 5px;
    margin: 0 20px;
    overflow: hidden;
}

.score-progress {
    height: 100%;
    width: 0;
    transition: width 0.5s ease;
}

.your-progress {
    background-color: var(--primary-color);
}

.opponent-progress {
    background-color: var(--secondary-color);
}

.score-value {
    font-weight: 700;
    width: 50px;
    text-align: right;
}

/* Achievement Timeline */
.achievement-timeline {
    margin: 50px 0;
    text-align: center;
}

.achievement-timeline h3 {
    margin-bottom: 30px;
    font-weight: 600;
}

.timeline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    margin: 40px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 4px;
    background-color: #e0e0e0;
    z-index: -1;
}

.timeline-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

.timeline-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #e0e0e0;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
    transition: var(--transition);
}

.timeline-icon i {
    font-size: 1.5rem;
    color: #777;
    transition: var(--transition);
}

.timeline-content h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 5px;
}

.timeline-content p {
    font-size: 0.8rem;
    color: #777;
}

.timeline-item.achieved .timeline-icon {
    background-color: var(--primary-color);
}

.timeline-item.achieved .timeline-icon i {
    color: white;
}

.timeline-item.current .timeline-icon {
    background-color: var(--secondary-color);
    animation: pulse 1.5s infinite;
}

.timeline-item.current .timeline-icon i {
    color: white;
}

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

.modal.active {
    display: flex;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 30px;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.4s;
    max-height: 90%;
    overflow: auto;
}

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

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--text-color);
}

.modal h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
    text-align: center;
}

.result-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 30px;
}

.result-status {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.result-status.correct {
    color: var(--success-color);
}

.result-status.incorrect {
    color: var(--error-color);
}

.idiom-details {
    text-align: center;
}

.idiom-details h3 {
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.idiom-details p {
    margin-bottom: 10px;
}

/* Enhanced Result Modal */
.meaning-content {
    margin: 15px 0;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.examples-content {
    margin-top: 20px;
    padding: 15px;
    background-color: #f5f5f5;
    border-radius: var(--border-radius);
}

.examples-content h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.example-item {
    margin: 10px 0;
    padding: 10px;
    background-color: white;
    border-radius: 8px;
    border-left: 3px solid var(--secondary-color);
    line-height: 1.6;
    white-space: pre-line;
}

.example-item:empty {
    display: none;
}

/* Chinese Mode Styling */
.zh-mode .question-idiom h3 {
    font-family: 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
    font-size: 2.5rem;
}

.zh-mode .option.idiom-option h4 {
    font-family: 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
    font-size: 1.4rem;
}

.zh-mode .idiom-details h3 {
    font-family: 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
    font-size: 2rem;
}

/* Pinyin styling */
.pinyin-text {
    color: #666;
    font-style: italic;
    font-size: 0.9em;
    margin: 5px 0;
}

/* Line break support */
.text-with-breaks {
    white-space: pre-line;
    line-height: 1.6;
}

/* Achievement Modal */
.achievement-content {
    text-align: center;
    padding: 40px;
}

.achievement-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.achievement-icon i {
    padding: 20px;
    background-color: rgba(91, 55, 235, 0.1);
    border-radius: 50%;
    animation: shine 2s infinite;
}

@keyframes shine {
    0% { box-shadow: 0 0 0 0 rgba(91, 55, 235, 0.5); }
    70% { box-shadow: 0 0 0 20px rgba(91, 55, 235, 0); }
    100% { box-shadow: 0 0 0 0 rgba(91, 55, 235, 0); }
}

/* Battle Result Modal */
.battle-result-info {
    margin-bottom: 30px;
}

.battle-scores-final {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 20px;
}

.battle-player {
    text-align: center;
}

.battle-player h3 {
    margin-bottom: 10px;
}

.battle-score {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.battle-vs {
    font-size: 1.5rem;
    font-weight: 700;
    color: #999;
}

.battle-reward {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
}

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

/* Fireworks Animation */
.fireworks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

/* Footer */
footer {
    background-color: #333;
    color: white;
    padding: 40px 0;
    margin-top: 50px;
}

.footer {
    background-color: #2e2e2e;
    color: #fff;
    padding: 30px 0;
    text-align: center;
    font-size: 14px;
}

.footer a {
    color: #ccc;
    text-decoration: none;
    margin: 0 5px;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: var(--primary-color);
}

.footer .dmca-badge img {
    margin-bottom: 10px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.footer-logo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.footer-logo img {
    height: 30px;
    margin-bottom: 10px;
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    color: white;
    text-decoration: none;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-light);
}

/* Animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s;
}

/* Score Display Section */
.score-display-section {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 20px;
    margin: 20px 0;
    text-align: center;
}

.score-display-section h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
    font-weight: 600;
}

.score-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

.score-stat {
    background-color: #f9f9f9;
    border-radius: var(--border-radius);
    padding: 15px;
    text-align: center;
}

.score-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.score-stat-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.game-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.game-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
}

/* User Statistics Section */
.user-stats {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.user-stats h2 {
    color: white;
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.8em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.3s ease;
    cursor: default;
}

.stat-card.expandable {
    cursor: pointer;
    background: linear-gradient(135deg, #ff9a56 0%, #ffad56 100%);
    color: white;
}

.stat-card.expandable:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(255, 154, 86, 0.4);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.stat-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5em;
    flex-shrink: 0;
}

.stat-card.expandable .stat-icon {
    background: rgba(255, 255, 255, 0.2);
}

.stat-info h3 {
    font-size: 2em;
    font-weight: 700;
    margin: 0;
    color: #333;
    line-height: 1;
}

.stat-card.expandable .stat-info h3,
.stat-card.expandable .stat-info p {
    color: white;
}

.stat-info p {
    margin: 5px 0 0 0;
    color: #666;
    font-size: 0.9em;
    font-weight: 500;
}

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

#stop-game {
    display: none; /* Hide if it exists */
}

/* Detailed Statistics Modal */
.stats-modal {
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.detailed-stats-content {
    margin: 20px 0;
}

.stats-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.summary-item h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.performance-chart {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
}

.chart-item {
    margin-bottom: 15px;
}

.chart-bar {
    height: 20px;
    border-radius: 10px;
    margin-bottom: 8px;
    transition: width 0.8s ease;
    position: relative;
}

.correct-bar {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

.wrong-bar {
    background: linear-gradient(135deg, #f44336 0%, #da190b 100%);
}

.chart-label {
    font-size: 0.9em;
    color: #666;
    font-weight: 500;
}

.score-breakdown {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
}

.score-breakdown p {
    margin: 10px 0;
    display: flex;
    justify-content: space-between;
    color: #333;
}

.score-breakdown span {
    font-weight: 600;
    color: #667eea;
}

/* Responsive Design */
@media (max-width: 768px) {
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .timeline {
        flex-wrap: wrap;
        justify-content: center;
        gap: 20px;
    }
    
    .timeline::before {
        display: none;
    }
    
    .timeline-item {
        margin-bottom: 20px;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 20px;
    }
    
    .footer-logo {
        align-items: center;
    }
    
    .game-header {
        flex-direction: column;
        gap: 20px;
    }
    
    .timer-container {
        width: 100%;
    }
    
    .timer-bar {
        width: 100%;
    }
    
    .language-buttons {
        flex-direction: column;
    }
    
    .btn-language {
        width: 100%;
        margin: 5px 0;
    }
    
    .zh-mode .question-idiom h3 {
        font-size: 2rem;
    }
    
    .zh-mode .option.idiom-option h4 {
        font-size: 1.2rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .stat-card {
        padding: 15px;
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.2em;
    }
    
    .stat-info h3 {
        font-size: 1.5em;
    }
    
    .stats-summary {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .game-header {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    .game-controls {
        order: 3;
        width: 100%;
        justify-content: center;
    }

    /* Header responsive layout */
    header .container {
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 10px;
    }

    /* Ensure child sections span full width and center content */
    header .logo,
    header .user-info,
    header nav {
        width: 100%;
        justify-content: center;
    }

    /* Center music / theme controls on small screens */
    header .music-controls {
        margin: 12px 0;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .mode-buttons, .type-buttons {
        flex-direction: column;
    }
    
    .btn-mode, .btn-type {
        width: 100%;
        margin: 5px 0;
    }
    
    .score-container {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .score {
        margin-right: 0;
    }
}

/* Battle Mode Options */
.battle-options {
    margin-top: 20px;
    padding: 20px;
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.battle-options h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary-color);
    font-weight: 600;
}

.battle-mode-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.battle-mode-buttons .btn {
    min-width: 140px;
    padding: 12px 20px;
}

.room-input {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: var(--border-radius);
}

.room-input input {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    font-size: 1rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    width: 120px;
    transition: var(--transition);
}

.room-input input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(91, 55, 235, 0.1);
}

.room-input .btn {
    padding: 10px 20px;
    min-width: 80px;
}

/* Room Overlay Styles */
.room-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1001;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.room-overlay.hidden {
    display: none;
}

.room-overlay.fade-in {
    animation: fadeIn 0.3s ease;
}

.room-overlay.fade-out {
    animation: fadeOut 0.3s ease;
}

.overlay-content {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s ease;
}

.overlay-content .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.overlay-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.overlay-message {
    color: #666;
    margin-bottom: 25px;
    line-height: 1.5;
}

.overlay-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.overlay-actions .btn {
    min-width: 100px;
}

/* Game Result Modal for Room Battles */
.game-result-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1002;
    display: none;
    justify-content: center;
    align-items: center;
}

.game-result-modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.game-result-modal .modal-content {
    max-width: 500px;
    width: 90%;
    text-align: center;
}

.result-header {
    margin-bottom: 30px;
}

.result-header h2 {
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.result-header .result-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.result-header .result-icon i {
    color: var(--primary-color);
    animation: bounce 1s infinite;
}

.result-stats {
    background-color: #f9f9f9;
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 30px;
}

.result-stats .stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.result-stats .stat:last-child {
    margin-bottom: 0;
}

.stat-label {
    font-weight: 500;
    color: #666;
}

.stat-value {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.2rem;
}

.result-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.result-actions .btn {
    min-width: 120px;
    padding: 12px 20px;
}

/* Question entrance animation for room battles */
.game-container.question-enter {
    animation: questionEnter 0.6s ease;
}

@keyframes questionEnter {
    0% {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Option entrance animation */
.option-item {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.option-item.option-enter {
    opacity: 1;
    transform: translateY(0);
}

/* Result popup for room battles */
.result-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background-color: var(--card-bg);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    z-index: 1003;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.result-popup.result-show {
    transform: translate(-50%, -50%) scale(1);
}

.result-popup.correct {
    border: 3px solid var(--success-color);
}

.result-popup.incorrect {
    border: 3px solid var(--error-color);
}

.result-popup .result-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 2rem;
    color: white;
}

.result-popup.correct .result-icon {
    background-color: var(--success-color);
}

.result-popup.incorrect .result-icon {
    background-color: var(--error-color);
}

.result-popup .result-text {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.result-popup.correct .result-text {
    color: var(--success-color);
}

.result-popup.incorrect .result-text {
    color: var(--error-color);
}

/* Responsive Design for Battle Mode */
@media (max-width: 768px) {
    .battle-mode-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .battle-mode-buttons .btn {
        width: 100%;
        max-width: 250px;
    }
    
    .room-input {
        flex-direction: column;
        gap: 15px;
    }
    
    .room-input input {
        width: 100%;
        max-width: 200px;
    }
    
    .overlay-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .overlay-actions .btn {
        width: 100%;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .result-actions .btn {
        width: 100%;
    }
    
    .result-popup {
        width: 90%;
        max-width: 300px;
        padding: 20px;
    }
    
    .result-popup .result-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .result-popup .result-text {
        font-size: 1.2rem;
    }
}
