/* Reset styles to prevent theme interference */
#vocab-game-container * {
    box-sizing: border-box;
}

#vocab-game-container button {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: inherit;
    line-height: inherit;
    text-transform: none;
    -webkit-appearance: button;
    letter-spacing: normal;
}

#vocab-game-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

#game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#game-header > div {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#game-header .label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

#current-score {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
}

#question-number {
    font-size: 28px;
    font-weight: bold;
    color: #764ba2;
}

#timer {
    font-size: 32px;
    font-weight: bold;
    color: #f093fb;
}

#timer.warning {
    color: #ff6b6b;
    animation: pulse 0.5s infinite;
}

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

#game-screen {
    background: white;
    border-radius: 15px;
    padding: 40px;
    min-height: 400px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.screen {
    display: none;
}

.screen.active {
    display: block;
}

#start-screen {
    text-align: center;
}

#start-screen h2 {
    color: #667eea;
    font-size: 36px;
    margin-bottom: 20px;
}

#start-screen p {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
}

.difficulty-selection {
    margin: 40px 0;
    clear: both;
    width: 100%;
}

.difficulty-selection h3 {
    color: #667eea;
    font-size: 24px;
    margin-bottom: 25px;
    text-align: center;
}

.difficulty-buttons {
    display: flex !important;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin-bottom: 30px;
    align-items: stretch;
}

#vocab-game-container .difficulty-btn {
    flex: 1 1 200px;
    max-width: 220px;
    min-width: 180px;
    background: white !important;
    border: 3px solid #e9ecef !important;
    padding: 25px 20px !important;
    border-radius: 15px !important;
    cursor: pointer !important;
    transition: all 0.3s ease;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    font-family: inherit;
    line-height: 1.4;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
    pointer-events: auto !important;
    outline: none;
}

#vocab-game-container .difficulty-btn * {
    pointer-events: none;
}

#vocab-game-container .difficulty-btn:hover {
    border-color: #667eea !important;
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
    background: white !important;
}

#vocab-game-container .difficulty-btn.selected {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-color: #667eea !important;
    transform: scale(1.05);
}

#vocab-game-container .difficulty-btn.selected .diff-title,
#vocab-game-container .difficulty-btn.selected .diff-desc,
#vocab-game-container .difficulty-btn.selected .diff-points {
    color: white !important;
}

#vocab-game-container .diff-title {
    font-size: 22px;
    font-weight: bold;
    color: #667eea;
    display: block;
    margin: 0;
    padding: 0;
}

#vocab-game-container .diff-desc {
    font-size: 14px;
    color: #666;
    display: block;
    margin: 0;
    padding: 0;
}

#vocab-game-container .diff-points {
    font-size: 13px;
    color: #999;
    font-style: italic;
    display: block;
    margin: 0;
    padding: 0;
}

.instructions {
    text-align: left;
    display: inline-block;
    margin: 30px 0;
    padding: 20px 40px;
    background: #f8f9fa;
    border-radius: 10px;
}

.instructions li {
    font-size: 16px;
    color: #444;
    margin: 10px 0;
    line-height: 1.6;
}

.color-hint {
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.synonym-color {
    color: #2f9e44;
    background: #d3f9d8;
}

.antonym-color {
    color: #e03131;
    background: #ffe3e3;
}

.user-welcome {
    background: #e7f5ff;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: center;
}

.user-welcome p {
    margin: 0 0 15px 0;
    color: #1971c2;
    font-size: 16px;
}

.secondary-button {
    background: #1971c2;
    color: white;
    border: none;
    padding: 10px 25px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.secondary-button:hover {
    background: #1864ab;
    transform: translateY(-1px);
}

.login-prompt,
.login-reminder {
    background: #fff3bf;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    text-align: center;
    border: 2px solid #ffd43b;
}

.login-prompt p,
.login-reminder {
    margin: 0;
    color: #f76707;
    font-size: 15px;
}

.login-prompt a,
.login-reminder a {
    color: #1971c2;
    font-weight: 600;
    text-decoration: underline;
}

.save-notice {
    background: #d3f9d8;
    color: #2f9e44;
    padding: 10px;
    border-radius: 8px;
    margin: 15px 0;
    font-weight: 600;
}

.game-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 50px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.game-button:active {
    transform: translateY(0);
}

#question-text {
    font-size: 18px;
    color: #666;
    margin-bottom: 15px;
    font-weight: 500;
}

#question-text.synonym-question {
    color: #2f9e44;
    font-weight: 600;
}

#question-text.antonym-question {
    color: #e03131;
    font-weight: 600;
}

#target-word {
    font-size: 42px;
    font-weight: bold;
    text-align: center;
    margin: 30px 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#target-word.synonym-word {
    color: #2f9e44;
    text-shadow: 0 2px 4px rgba(47, 158, 68, 0.2);
}

#target-word.antonym-word {
    color: #e03131;
    text-shadow: 0 2px 4px rgba(224, 49, 49, 0.2);
}

#options-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 40px;
}

.option-btn {
    background: #f8f9fa;
    border: 3px solid #e9ecef;
    padding: 20px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-btn:hover {
    background: #e9ecef;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.option-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.option-btn.correct {
    background: #51cf66;
    border-color: #37b24d;
    color: white;
    animation: correctAnswer 0.5s ease;
}

.option-btn.incorrect {
    background: #ff6b6b;
    border-color: #fa5252;
    color: white;
    animation: shake 0.5s ease;
}

@keyframes correctAnswer {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

#feedback {
    margin-top: 30px;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
}

#feedback.hidden {
    display: none;
}

#feedback.correct {
    background: #d3f9d8;
    color: #2b8a3e;
    border: 2px solid #51cf66;
}

#feedback.incorrect {
    background: #ffe3e3;
    color: #c92a2a;
    border: 2px solid #ff6b6b;
}

.points-earned {
    font-size: 24px;
    margin-top: 10px;
    color: #667eea;
}

#end-screen {
    text-align: center;
}

#end-screen h2 {
    color: #667eea;
    font-size: 36px;
    margin-bottom: 30px;
}

#final-results {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    margin: 30px 0;
}

.final-score {
    font-size: 48px;
    font-weight: bold;
    color: #667eea;
    margin: 20px 0;
}

#final-score-value {
    color: #764ba2;
}

.accuracy {
    font-size: 24px;
    color: #666;
    margin: 15px 0;
}

#performance-message {
    font-size: 20px;
    color: #444;
    margin-top: 20px;
    font-style: italic;
}

.difficulty-played {
    font-size: 18px;
    color: #666;
    margin: 10px 0;
}

#study-list {
    margin-top: 40px;
    text-align: left;
}

#study-list h3 {
    color: #667eea;
    font-size: 28px;
    margin-bottom: 15px;
    text-align: center;
}

.study-intro {
    text-align: center;
    color: #666;
    font-size: 16px;
    margin-bottom: 25px;
}

#missed-words-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.word-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.word-title {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 15px;
    text-align: center;
    letter-spacing: 1px;
}

.asked-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
    line-height: 1.8;
    font-size: 15px;
}

.user-wrong {
    color: #ff6b6b;
    font-weight: 600;
}

.correct-highlight {
    color: #51cf66;
    font-weight: 600;
}

.word-section {
    margin: 10px 0;
    padding: 10px 0;
    line-height: 1.6;
}

.word-section strong {
    color: #667eea;
    font-size: 16px;
}

.word-section span {
    color: #444;
    font-size: 15px;
}

#progress-screen h2 {
    color: #667eea;
    font-size: 36px;
    margin-bottom: 30px;
    text-align: center;
}

#progress-content {
    margin: 30px 0;
}

.progress-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 25px;
    border: 2px solid #e9ecef;
}

.progress-section h3 {
    color: #667eea;
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
}

.section-intro {
    text-align: center;
    color: #666;
    margin-bottom: 20px;
}

#top-scores-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.score-item {
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #667eea;
}

.score-points {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

.score-details {
    font-size: 14px;
    color: #666;
}

.score-details .difficulty-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 10px;
}

.difficulty-badge.normal {
    background: #d0ebff;
    color: #1971c2;
}

.difficulty-badge.difficult {
    background: #ffe3e3;
    color: #c92a2a;
}

.difficulty-badge.insane {
    background: #f3d9fa;
    color: #9c36b5;
}

#problem-words-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.problem-word-card {
    background: #fff5f5;
    border: 2px solid #ffc9c9;
    border-radius: 10px;
    padding: 15px;
}

.problem-word-title {
    font-size: 22px;
    font-weight: bold;
    color: #c92a2a;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.missed-badge {
    background: #c92a2a;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 14px;
}

.problem-word-lists {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 10px;
}

.word-list-section {
    background: white;
    padding: 10px;
    border-radius: 6px;
}

.word-list-section strong {
    color: #667eea;
    display: block;
    margin-bottom: 5px;
}

.word-list-section span {
    color: #444;
    font-size: 14px;
    line-height: 1.6;
}

#badges-display {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.badge-item {
    background: white;
    border: 3px solid #e9ecef;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
}

.badge-item.earned {
    border-color: #ffd43b;
    background: linear-gradient(135deg, #fff9db 0%, #fff3bf 100%);
    box-shadow: 0 4px 15px rgba(255, 212, 59, 0.3);
}

.badge-item.locked {
    opacity: 0.4;
}

.badge-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.badge-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.badge-description {
    font-size: 12px;
    color: #666;
    line-height: 1.4;
}

.badge-earned-date {
    font-size: 11px;
    color: #999;
    margin-top: 8px;
    font-style: italic;
}

.badge-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    text-align: center;
    max-width: 400px;
    animation: badgePopIn 0.5s ease forwards;
}

@keyframes badgePopIn {
    0% {
        transform: translate(-50%, -50%) scale(0);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

.badge-notification-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    display: none;
}

.badge-notification-overlay.active {
    display: block;
}

.badge-notification .badge-icon {
    font-size: 80px;
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.badge-notification h3 {
    color: #667eea;
    font-size: 24px;
    margin: 20px 0 10px;
}

.badge-notification p {
    color: #666;
    font-size: 16px;
    margin-bottom: 25px;
}

.badge-notification button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    font-style: italic;
}

/* Responsive design */
@media (max-width: 768px) {
    #vocab-game-container {
        padding: 20px;
        margin: 20px;
    }
    
    #game-header {
        flex-direction: column;
        gap: 15px;
    }
    
    .difficulty-buttons {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    #vocab-game-container .difficulty-btn {
        max-width: 100% !important;
        width: 100% !important;
    }
    
    #options-container {
        grid-template-columns: 1fr;
    }
    
    #target-word {
        font-size: 32px;
    }
    
    .final-score {
        font-size: 36px;
    }
    
    .word-card {
        padding: 15px;
    }
    
    .word-title {
        font-size: 20px;
    }
}

/* ==========================================
   VERSION 5.0 - STORY MODE STYLES
   ========================================== */

/* Game Mode Selection */
.game-mode-selection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 30px 0;
}

.mode-btn {
    background: white;
    border: 3px solid #e9ecef;
    border-radius: 15px;
    padding: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: #333;
}

.mode-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.mode-btn.story-mode {
    border-color: #667eea;
    background: linear-gradient(135deg, #f8f7ff 0%, #ffffff 100%);
    color: #667eea;
}

.mode-btn.story-mode:hover {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.mode-btn.quick-play {
    border-color: #ff6347;
    background: linear-gradient(135deg, #fff7f6 0%, #ffffff 100%);
    color: #ff6347;
}

.mode-btn.quick-play:hover {
    border-color: #ff6347;
    background: linear-gradient(135deg, #ff6347 0%, #ff4757 100%);
    color: white;
}

.mode-icon {
    font-size: 48px;
}

.mode-title {
    font-size: 24px;
    font-weight: 700;
}

.mode-desc {
    font-size: 14px;
    opacity: 0.8;
}

/* Player Stats */
#player-stats {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.stat-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

.avatar-large {
    font-size: 64px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.player-info {
    flex: 1;
}

#player-level-title {
    margin: 0 0 10px 0;
    color: #667eea;
    font-size: 22px;
}

.xp-bar-container {
    position: relative;
    background: #e9ecef;
    border-radius: 20px;
    height: 30px;
    overflow: hidden;
}

.xp-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.5s ease;
    border-radius: 20px;
}

#xp-text {
    position: relative;
    display: block;
    text-align: center;
    line-height: 30px;
    font-weight: 600;
    color: #333;
    z-index: 1;
}

.streak-display {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    padding: 10px;
    background: #fff5f5;
    border-radius: 10px;
}

#streak-flame {
    font-size: 28px;
    animation: flamePulse 1s infinite;
}

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

/* Daily Challenge Card */
.challenge-card {
    background: white;
    border: 3px solid #667eea;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
}

.challenge-card h3 {
    margin: 0 0 10px 0;
    color: #667eea;
}

#challenge-text {
    font-size: 16px;
    margin: 10px 0;
    font-weight: 600;
}

.challenge-progress-bar {
    background: #e9ecef;
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
    margin: 15px 0;
}

.challenge-progress {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.5s ease;
    border-radius: 10px;
}

.challenge-card.completed {
    border-color: #2ecc40;
    background: linear-gradient(135deg, #d3f9d8 0%, #ffffff 100%);
}

.challenge-card.completed .challenge-progress {
    background: #2ecc40;
}

.challenge-reward {
    font-weight: 600;
    color: #f76707;
    text-align: center;
    margin: 10px 0 0 0;
}

/* Story Worlds Map */
#story-worlds-map {
    display: grid;
    gap: 20px;
    margin: 25px 0;
}

.world-card {
    background: white;
    border: 3px solid #e9ecef;
    border-radius: 15px;
    padding: 25px;
    transition: all 0.3s ease;
}

.world-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.world-card.current {
    border-color: #667eea;
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.4);
    background: linear-gradient(135deg, #f8f7ff 0%, #ffffff 100%);
}

.world-card.locked {
    opacity: 0.5;
    filter: grayscale(100%);
}

.world-card.completed {
    background: linear-gradient(135deg, #d3f9d8 0%, #e7f9ea 100%);
    border-color: #2ecc40;
}

.world-icon {
    font-size: 72px;
    text-align: center;
    margin-bottom: 15px;
}

.world-card h3 {
    color: #667eea;
    text-align: center;
    margin: 0 0 10px 0;
    font-size: 24px;
}

.world-card p {
    text-align: center;
    color: #666;
    margin: 0 0 20px 0;
}

.stage-indicators {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.stage-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #e9ecef;
    border: 3px solid #ccc;
    transition: all 0.3s ease;
}

.stage-dot.completed {
    background: #2ecc40;
    border-color: #2ecc40;
}

.stage-dot.current {
    background: #667eea;
    border-color: #667eea;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7); }
    50% { transform: scale(1.2); box-shadow: 0 0 0 10px rgba(102, 126, 234, 0); }
}

.unlock-text {
    text-align: center;
    color: #999;
    font-size: 14px;
    margin-top: 15px;
    font-weight: 600;
}

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

/* Button Styles */
.game-button {
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.game-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.game-button.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.game-button.secondary {
    background: linear-gradient(135deg, #ff6347 0%, #ff4757 100%);
}

.game-button.large {
    font-size: 22px;
    padding: 20px 50px;
}

/* Avatar Screen */
.avatar-preview {
    text-align: center;
    margin: 30px 0;
    padding: 30px;
    background: linear-gradient(135deg, #f8f7ff 0%, #ffffff 100%);
    border-radius: 15px;
}

.avatar-xlarge {
    font-size: 120px;
    margin-bottom: 20px;
}

#avatar-preview-name {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
    margin: 0;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin: 20px 0 30px 0;
}

.avatar-option {
    background: white;
    border: 3px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

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

.avatar-option.selected {
    border-color: #667eea;
    background: linear-gradient(135deg, #f8f7ff 0%, #ffffff 100%);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

.avatar-option.locked {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(100%);
}

.avatar-option.locked:hover {
    transform: none;
    box-shadow: none;
}

.avatar-option .avatar-icon {
    font-size: 56px;
    margin-bottom: 10px;
}

.avatar-option .avatar-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.unlock-level, .unlock-xp {
    font-size: 12px;
    color: #999;
    margin-top: 5px;
}

.avatar-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

/* Stage Intro Screen */
.stage-intro-content {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
    padding: 50px 30px;
}

#stage-world-name {
    color: #667eea;
    font-size: 32px;
    margin-bottom: 20px;
}

.stage-icon-large {
    font-size: 120px;
    margin: 30px 0;
}

#stage-title {
    color: #333;
    font-size: 36px;
    margin-bottom: 20px;
}

#stage-description {
    font-size: 20px;
    color: #666;
    margin: 25px 0;
    line-height: 1.6;
}

.stage-boss-warning {
    background: linear-gradient(135deg, #ff6347 0%, #ff4757 100%);
    color: white;
    padding: 25px;
    border-radius: 15px;
    margin: 30px 0;
    animation: warningPulse 2s infinite;
}

@keyframes warningPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 99, 71, 0.7); }
    50% { box-shadow: 0 0 0 20px rgba(255, 99, 71, 0); }
}

.stage-boss-warning h3 {
    margin: 0 0 10px 0;
    font-size: 28px;
}

.stage-boss-warning p {
    margin: 0;
    font-size: 18px;
}

.stage-boss-warning.hidden {
    display: none;
}

/* XP Earned Badge */
.xp-earned-badge {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #ffd43b 0%, #ffaa00 100%);
    color: #333;
    font-size: 48px;
    font-weight: 900;
    padding: 40px 60px;
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(255, 212, 59, 0.6);
    z-index: 10001;
    animation: xpBounce 0.6s ease;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.xp-earned-badge.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
}

@keyframes xpBounce {
    0% { transform: translate(-50%, -50%) scale(0); }
    50% { transform: translate(-50%, -50%) scale(1.3); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

/* Level Up Notification */
.badge-notification-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.badge-notification-overlay.active {
    opacity: 1;
}

.badge-notification {
    background: white;
    border-radius: 20px;
    padding: 50px;
    text-align: center;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: bounceIn 0.6s ease;
}

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

.badge-notification.level-up {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.badge-notification.boss-defeated {
    background: linear-gradient(135deg, #ffd43b 0%, #ffaa00 100%);
    color: #333;
}

.level-badge {
    font-size: 100px;
    animation: spin 3s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.boss-icon {
    font-size: 100px;
    animation: shake 0.5s infinite;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px) rotate(-5deg); }
    75% { transform: translateX(10px) rotate(5deg); }
}

.badge-notification h2 {
    margin: 20px 0 10px 0;
    font-size: 36px;
}

.badge-notification h3 {
    margin: 10px 0;
    font-size: 28px;
}

.badge-notification p {
    margin: 15px 0;
    font-size: 18px;
}

.unlock-text {
    color: #ffd43b;
    font-weight: 700;
}

.xp-bonus {
    font-size: 24px;
    font-weight: 900;
    color: #ff6347;
}

.badge-notification button {
    margin-top: 30px;
}

/* Badge Items */
.badge-icon {
    font-size: 64px;
    margin-bottom: 15px;
}

.badge-item {
    background: white;
    border: 3px solid #667eea;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.badge-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.badge-item.locked {
    opacity: 0.4;
    border-color: #ccc;
    filter: grayscale(100%);
}

.badge-name {
    font-weight: 700;
    color: #667eea;
    margin: 10px 0 5px 0;
}

.badge-desc {
    font-size: 14px;
    color: #666;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-mode-selection {
        grid-template-columns: 1fr;
    }
    
    .mode-btn {
        padding: 25px;
    }
    
    .mode-icon {
        font-size: 40px;
    }
    
    .mode-title {
        font-size: 20px;
    }
    
    .stat-row {
        flex-direction: column;
        text-align: center;
    }
    
    .avatar-large {
        font-size: 56px;
    }
    
    #player-level-title {
        font-size: 18px;
    }
    
    .world-icon {
        font-size: 56px;
    }
    
    .world-card h3 {
        font-size: 20px;
    }
    
    .stage-indicators {
        gap: 8px;
    }
    
    .stage-dot {
        width: 20px;
        height: 20px;
        border: 2px solid #ccc;
    }
    
    .story-buttons {
        flex-direction: column;
    }
    
    .game-button {
        width: 100%;
    }
    
    .avatar-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 10px;
    }
    
    .avatar-option {
        padding: 15px;
    }
    
    .avatar-option .avatar-icon {
        font-size: 40px;
    }
    
    .avatar-xlarge {
        font-size: 80px;
    }
    
    .stage-intro-content {
        padding: 30px 20px;
    }
    
    #stage-world-name {
        font-size: 24px;
    }
    
    .stage-icon-large {
        font-size: 80px;
    }
    
    #stage-title {
        font-size: 28px;
    }
    
    #stage-description {
        font-size: 16px;
    }
    
    .xp-earned-badge {
        font-size: 32px;
        padding: 25px 40px;
    }
    
    .badge-notification {
        padding: 30px;
        max-width: 90%;
        margin: 20px;
    }
    
    .level-badge, .boss-icon {
        font-size: 70px;
    }
    
    .badge-notification h2 {
        font-size: 28px;
    }
    
    .badge-notification h3 {
        font-size: 22px;
    }
    
    .badge-icon {
        font-size: 48px;
    }
}

/* Additional polish */
* {
    -webkit-tap-highlight-color: transparent;
}

button {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.screen {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
/* CONTRAST AND READABILITY IMPROVEMENTS FOR VERSION 5.0 */

/* ==================================================
   CRITICAL: Add these styles to fix ALL contrast issues
   ================================================== */

/* Main Title and Subtitle - Need WHITE on purple background */
.game-title {
    color: white !important;
    font-size: 48px !important;
    font-weight: 900 !important;
    margin: 0 0 10px 0 !important;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3) !important;
}

.game-subtitle {
    color: white !important;
    font-size: 20px !important;
    margin: 0 0 30px 0 !important;
    opacity: 0.95 !important;
}

/* All Screen Headings (h2) on purple background */
#story-mode-screen > h2,
#avatar-screen > h2,
#difficulty-screen > h2,
#progress-screen > h2,
#results-screen > h2 {
    color: white !important;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3) !important;
}

/* Menu Buttons - Need solid backgrounds */
.menu-button {
    background: white !important;
    color: #667eea !important;
    border: 3px solid white !important;
    padding: 15px 30px !important;
    border-radius: 12px !important;
    font-size: 18px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

.menu-button:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3) !important;
    background: #f8f7ff !important;
}

/* Mode Selection Buttons - Already fixed but reinforcing */
.mode-btn {
    background: white !important;
    color: #333 !important;
}

.mode-btn.story-mode {
    color: #667eea !important;
}

.mode-btn.story-mode .mode-title {
    color: #667eea !important;
}

.mode-btn.story-mode .mode-desc {
    color: #666 !important;
}

.mode-btn.quick-play {
    color: #ff6347 !important;
}

.mode-btn.quick-play .mode-title {
    color: #ff6347 !important;
}

.mode-btn.quick-play .mode-desc {
    color: #666 !important;
}

/* Back Button - white background on purple */
.back-button {
    background: white !important;
    color: #667eea !important;
    border: 3px solid white !important;
    padding: 12px 25px !important;
    border-radius: 10px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
}

.back-button:hover {
    background: #f8f7ff !important;
    transform: translateX(-3px) !important;
}

/* Story Mode Screen - All white backgrounds for cards */
#player-stats {
    background: white !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

/* Player Level Title */
#player-level-title {
    color: #667eea !important;
    font-weight: 700 !important;
}

/* XP Text overlay - ensure it's dark */
#xp-text {
    color: #333 !important;
    font-weight: 700 !important;
    text-shadow: none !important;
}

/* Streak Display */
.streak-display {
    background: white !important;
    color: #333 !important;
    font-weight: 700 !important;
}

#streak-count {
    color: #333 !important;
}

/* Challenge Card */
.challenge-card {
    background: white !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

.challenge-card h3 {
    color: #667eea !important;
}

#challenge-text {
    color: #333 !important;
    font-weight: 600 !important;
}

.challenge-reward {
    color: #333 !important;
}

#challenge-reward-xp {
    color: #f76707 !important;
    font-weight: 900 !important;
}

/* World Cards */
.world-card {
    background: white !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15) !important;
}

.world-card h3 {
    color: #667eea !important;
}

.world-card p {
    color: #666 !important;
}

.world-card.current {
    border-color: #667eea !important;
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.4) !important;
}

.world-card.completed {
    background: linear-gradient(135deg, #d3f9d8 0%, #ffffff 100%) !important;
}

.world-card.completed h3 {
    color: #2ecc40 !important;
}

.world-card.locked {
    background: #f8f9fa !important;
}

.unlock-text {
    color: #666 !important;
    font-weight: 600 !important;
}

/* Story Buttons */
.story-buttons {
    margin-top: 30px;
}

.game-button {
    padding: 15px 30px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    border: none !important;
    border-radius: 12px !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

.game-button.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
}

.game-button.secondary {
    background: linear-gradient(135deg, #ff6347 0%, #ff4757 100%) !important;
    color: white !important;
}

.game-button:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3) !important;
}

/* Plain game-button (not primary/secondary) */
.game-button:not(.primary):not(.secondary):not(.large) {
    background: white !important;
    color: #667eea !important;
    border: 3px solid white !important;
}

/* Avatar Screen */
#avatar-screen {
    color: white !important;
}

#avatar-screen h2 {
    color: white !important;
}

#avatar-screen h3 {
    color: white !important;
    margin-top: 30px !important;
    margin-bottom: 15px !important;
}

.avatar-preview {
    background: white !important;
    color: #333 !important;
}

#avatar-preview-name {
    color: #667eea !important;
}

.avatar-grid {
    /* Grid items have their own backgrounds */
}

.avatar-option {
    background: white !important;
    color: #333 !important;
}

.avatar-option .avatar-name {
    color: #333 !important;
}

.avatar-option.selected {
    background: linear-gradient(135deg, #f8f7ff 0%, #ffffff 100%) !important;
    border-color: #667eea !important;
}

.avatar-option.locked {
    background: #f8f9fa !important;
}

.unlock-level, .unlock-xp {
    color: #999 !important;
}

/* Stage Intro Screen */
.stage-intro-content {
    background: white !important;
    border-radius: 20px !important;
    padding: 50px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3) !important;
}

#stage-world-name {
    color: #667eea !important;
}

#stage-title {
    color: #333 !important;
}

#stage-description {
    color: #666 !important;
}

.stage-boss-warning {
    background: linear-gradient(135deg, #ff6347 0%, #ff4757 100%) !important;
    color: white !important;
}

.stage-boss-warning h3,
.stage-boss-warning p {
    color: white !important;
}

/* Difficulty Screen */
#difficulty-screen {
    background: white !important;
    border-radius: 20px !important;
    padding: 40px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25) !important;
}

#difficulty-screen h2 {
    color: #667eea !important;
    text-shadow: none !important;
}

/* Difficulty buttons already have good contrast */

/* Progress Screen */
#progress-screen {
    background: white !important;
    border-radius: 20px !important;
    padding: 40px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25) !important;
}

#progress-screen h2 {
    color: #667eea !important;
    text-shadow: none !important;
}

#progress-screen h3 {
    color: #667eea !important;
}

.progress-section {
    background: #f8f9fa !important;
    padding: 25px !important;
    border-radius: 15px !important;
    margin-bottom: 25px !important;
}

.badges-container {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)) !important;
    gap: 15px !important;
}

.badge-item {
    background: white !important;
    padding: 20px !important;
    border-radius: 12px !important;
    text-align: center !important;
}

.badge-name {
    color: #667eea !important;
}

.badge-desc {
    color: #666 !important;
}

.badge-item.locked {
    background: #f8f9fa !important;
    opacity: 0.6 !important;
}

/* Top Scores List */
#top-scores-list {
    background: #f8f9fa !important;
    padding: 20px !important;
    border-radius: 10px !important;
}

.scores-table {
    width: 100% !important;
    background: white !important;
    border-radius: 8px !important;
    overflow: hidden !important;
}

.scores-table th {
    background: #667eea !important;
    color: white !important;
    padding: 12px !important;
    text-align: left !important;
}

.scores-table td {
    padding: 12px !important;
    color: #333 !important;
    border-bottom: 1px solid #e9ecef !important;
}

/* Problem Words List */
#problem-words-list {
    background: #f8f9fa !important;
    padding: 20px !important;
    border-radius: 10px !important;
}

.problem-words-list ul {
    list-style: none !important;
    padding: 0 !important;
}

.problem-words-list li {
    background: white !important;
    padding: 15px !important;
    margin-bottom: 10px !important;
    border-radius: 8px !important;
    color: #333 !important;
    border-left: 4px solid #ff6347 !important;
}

.problem-words-list strong {
    color: #ff6347 !important;
}

.miss-count {
    color: #999 !important;
    font-size: 14px !important;
}

/* Results Screen */
#results-screen {
    background: white !important;
    border-radius: 20px !important;
    padding: 40px !important;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25) !important;
}

#results-screen h2 {
    color: #667eea !important;
    text-shadow: none !important;
}

.results-summary {
    background: #f8f9fa !important;
    padding: 25px !important;
    border-radius: 15px !important;
    margin: 25px 0 !important;
}

.result-label {
    color: #666 !important;
}

.result-value {
    color: #667eea !important;
    font-weight: 900 !important;
}

.missed-words-container {
    background: #fff5f5 !important;
    padding: 25px !important;
    border-radius: 15px !important;
    margin-top: 25px !important;
}

.missed-words-container h3 {
    color: #ff6347 !important;
}

.missed-word-item {
    background: white !important;
    color: #333 !important;
    padding: 12px 20px !important;
    border-radius: 8px !important;
    margin-bottom: 10px !important;
    border-left: 4px solid #ff6347 !important;
    font-weight: 600 !important;
}

/* Results Buttons */
.results-buttons {
    margin-top: 30px !important;
    display: flex !important;
    gap: 15px !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
}

/* XP Earned Badge */
.xp-earned-badge {
    background: linear-gradient(135deg, #ffd43b 0%, #ffaa00 100%) !important;
    color: #333 !important;
    font-weight: 900 !important;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5) !important;
}

/* Level Up Notification */
.level-up {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
}

.level-up h2,
.level-up h3,
.level-up p {
    color: white !important;
}

.unlock-text {
    color: #ffd43b !important;
}

/* Boss Defeated */
.boss-defeated {
    background: linear-gradient(135deg, #ffd43b 0%, #ffaa00 100%) !important;
    color: #333 !important;
}

.boss-defeated h2,
.boss-defeated p {
    color: #333 !important;
}

.xp-bonus {
    color: #ff6347 !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .game-title {
        font-size: 36px !important;
    }
    
    .game-subtitle {
        font-size: 16px !important;
    }
    
    .stage-intro-content {
        padding: 30px !important;
    }
}

/* Additional Polish */
#vocab-game-container {
    /* Main purple background is fine, but let's make it slightly darker for better contrast */
    background: linear-gradient(135deg, #5a67d8 0%, #6b3f9f 100%) !important;
}

/* Ensure all screens are readable */
.screen {
    /* Most screens should have backgrounds now */
}

/* Make sure all headings in story mode are white */
#story-mode-screen h2,
#story-mode-screen h3 {
    color: white !important;
}

/* But override for headings inside white cards */
#player-stats h3,
.challenge-card h3,
.world-card h3 {
    color: #667eea !important;
}
