:root {
    --primary-purple: #7c3aed;
    --primary-blue: #3b82f6;
    --success-green: #10b981;
    --warning-yellow: #f59e0b;
    --error-red: #ef4444;
    --dark-bg: #1e1b4b;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-white: #ffffff;
    --text-light: #e0e7ff;
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--primary-purple) 50%, var(--primary-blue) 100%);
    color: var(--text-white);
    min-height: 100vh;
    overflow-x: hidden;
}

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

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

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.game-header h1 {
    font-size: 2.5rem;
    background: linear-gradient(45deg, var(--text-white), var(--text-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.back-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-white);
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.game-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen {
    display: none;
    width: 100%;
    max-width: 900px;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: block;
}

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

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    padding: 30px;
    box-shadow: var(--shadow-xl);
}

.welcome-card h2 {
    font-size: 2rem;
    margin-bottom: 15px;
    text-align: center;
}

.story-intro {
    margin: 20px 0;
}

.narrative-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-light);
    margin-bottom: 15px;
    font-style: italic;
}

.character-intro {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 30px 0;
    justify-content: center;
}

.luna-large {
    font-size: 4rem;
    animation: float 3s ease-in-out infinite;
}

.speech-bubble {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 15px 20px;
    position: relative;
    max-width: 300px;
    font-style: italic;
}

.speech-bubble::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    border-right: 10px solid var(--glass-border);
}

.narrative-bar {
    margin-bottom: 20px;
}

.narrative-content {
    padding: 15px 20px;
    text-align: center;
    font-style: italic;
    animation: fadeIn 0.5s ease;
}

.dialogue-animate {
    animation: dialoguePulse 0.5s ease;
}

@keyframes dialoguePulse {
    0% { opacity: 0.7; transform: scale(0.98); }
    50% { opacity: 1; transform: scale(1.02); }
    100% { opacity: 1; transform: scale(1); }
}

.current-focus {
    margin-bottom: 30px;
    text-align: center;
}

.focus-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    padding: 20px;
    background: rgba(124, 58, 237, 0.2);
    border: 2px solid rgba(124, 58, 237, 0.4);
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.3);
}

.focus-icon {
    font-size: 3rem;
}

.focus-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.focus-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--warning-yellow);
}

.focus-subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-top: 5px;
}

.focus-description {
    font-style: italic;
    color: var(--text-light);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}



.start-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: var(--text-white);
    border: none;
    padding: 20px;
    border-radius: 15px;
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.start-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

.game-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.stat-item {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 600;
}

.character-area {
    margin-bottom: 30px;
}

.character-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 150px;
    position: relative;
}

.character {
    text-align: center;
    position: relative;
}

.character-sprite {
    font-size: 4rem;
    animation: float 3s ease-in-out infinite;
}

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

.character-name {
    margin-top: 10px;
    font-size: 1.1rem;
    font-weight: 600;
}

.character-title {
    font-size: 0.9rem;
    color: var(--text-light);
    font-style: italic;
    margin-top: 5px;
}

.spell-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    pointer-events: none;
}

.spell-name {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.85rem;
    color: var(--warning-yellow);
    font-style: italic;
    white-space: nowrap;
    opacity: 0;
    animation: fadeInOut 3s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

.spell-effect.success::after {
    content: '✨';
    font-size: 3rem;
    animation: sparkle 1s ease;
}

.spell-effect.fail::after {
    content: '💥';
    font-size: 3rem;
    animation: shake 0.5s ease;
}

@keyframes sparkle {
    0% { opacity: 0; transform: scale(0); }
    50% { opacity: 1; transform: scale(1.5) rotate(180deg); }
    100% { opacity: 0; transform: scale(0) rotate(360deg); }
}

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

.question-card {
    margin-bottom: 20px;
}

.spell-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.question-type {
    background: rgba(124, 58, 237, 0.3);
    display: inline-block;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.spell-type {
    background: rgba(245, 158, 11, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--warning-yellow);
    font-style: italic;
}

.question-text {
    font-size: 1.3rem;
    margin-bottom: 30px;
    line-height: 1.6;
    min-height: 60px;
}

.answer-area {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.answer-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    padding: 15px;
    font-size: 1.1rem;
    color: var(--text-white);
    transition: all 0.3s ease;
}

.answer-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.submit-btn {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-blue));
    color: var(--text-white);
    border: none;
    padding: 15px 30px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.hint-area {
    margin-top: 20px;
}

.hint-btn {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: var(--text-white);
    padding: 10px 20px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.hint-btn:hover {
    background: rgba(245, 158, 11, 0.3);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
}

.hint-content {
    margin-top: 15px;
    padding: 15px;
    background: rgba(245, 158, 11, 0.1);
    border-left: 3px solid var(--warning-yellow);
    border-radius: 10px;
}

.feedback-area {
    margin-top: 20px;
}

.feedback-content {
    text-align: center;
}

.feedback-message {
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.feedback-message .correct {
    color: var(--success-green);
}

.feedback-message .incorrect {
    color: var(--error-red);
}

.feedback-explanation {
    font-size: 1.1rem;
    margin-bottom: 20px;
    color: var(--text-light);
}

.continue-btn {
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    color: var(--text-white);
    padding: 12px 30px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.continue-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.progress-bar-container {
    margin-top: 30px;
}

.progress-bar {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    height: 20px;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, var(--primary-purple), var(--primary-blue));
    height: 100%;
    width: 0%;
    transition: width 0.5s ease;
}

.progress-label {
    text-align: center;
    margin-top: 10px;
    font-size: 0.9rem;
    color: var(--text-light);
}

.complete-card {
    text-align: center;
}

.complete-card h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
}

.complete-narrative {
    margin-bottom: 20px;
}

.rank-achieved {
    margin: 20px 0;
}

.rank-achieved h3 {
    color: var(--warning-yellow);
    font-size: 1.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.complete-character {
    font-size: 5rem;
    margin-bottom: 30px;
    animation: celebrate 1s ease;
}

@keyframes celebrate {
    0% { transform: scale(0) rotate(0); }
    50% { transform: scale(1.2) rotate(180deg); }
    100% { transform: scale(1) rotate(360deg); }
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.result-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 20px;
}

.result-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.result-value {
    display: block;
    font-size: 2rem;
    font-weight: 600;
}

.topic-progress {
    margin-bottom: 30px;
}

.topic-progress h3 {
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.topic-result {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 10px;
}

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

.replay-btn, .home-btn {
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    color: var(--text-white);
    padding: 15px 30px;
    border-radius: 12px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.replay-btn:hover, .home-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

@media (max-width: 768px) {
    .game-header h1 {
        font-size: 1.8rem;
    }
    
    .topic-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }
    
    .mode-buttons {
        grid-template-columns: 1fr;
    }
    
    .answer-area {
        flex-direction: column;
    }
    
    .game-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .complete-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .replay-btn, .home-btn {
        width: 100%;
    }
}
/* Celebration Styles */
.spell-effect.levelup::after {
    content: '⭐';
    font-size: 4rem;
    animation: levelupSpin 2s ease;
}

@keyframes levelupSpin {
    0% { opacity: 0; transform: scale(0) rotate(0); }
    50% { opacity: 1; transform: scale(1.5) rotate(180deg); }
    100% { opacity: 0; transform: scale(2) rotate(360deg); }
}

.massive-celebration {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.95) 0%, rgba(59, 130, 246, 0.95) 100%);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: celebrateIn 0.5s ease;
}

.celebration-content {
    text-align: center;
    padding: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 30px;
    backdrop-filter: blur(20px);
    max-width: 600px;
    animation: bounceScale 1s ease;
}

.celebration-content h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.celebration-content h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: var(--warning-yellow);
}

.celebration-content h3 {
    font-size: 2rem;
    margin: 20px 0;
    color: var(--text-white);
}

.celebration-content p {
    font-size: 1.2rem;
    margin: 15px 0;
    color: var(--text-light);
}

.celebration-icons {
    font-size: 3rem;
    margin: 20px 0;
    animation: float 2s ease-in-out infinite;
}

.celebration-content button {
    background: linear-gradient(135deg, var(--success-green), #059669);
    color: var(--text-white);
    border: none;
    padding: 15px 40px;
    border-radius: 15px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 30px;
    box-shadow: var(--shadow-xl);
    transition: all 0.3s ease;
}

.celebration-content button:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-2xl);
}

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

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


/* Rank Up Overlay */
.rank-up-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.9) 0%, rgba(59, 130, 246, 0.9) 100%);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.rank-up-content {
    text-align: center;
    padding: 40px;
    background: rgba(255, 255, 255, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.4);
    border-radius: 25px;
    backdrop-filter: blur(20px);
    max-width: 500px;
    animation: rankUpBounce 0.6s ease;
    box-shadow: 0 0 50px rgba(255, 255, 255, 0.3);
}

.rank-up-content h2 {
    font-size: 2.5rem;
    margin-bottom: 25px;
    color: var(--text-white);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.rank-badge {
    margin: 20px auto;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: inline-block;
}

.rank-icon {
    font-size: 4rem;
    margin-bottom: 10px;
    animation: float 2s ease-in-out infinite;
}

.rank-title {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--warning-yellow);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.rank-up-content h3 {
    font-size: 1.5rem;
    margin: 20px 0 10px;
    color: var(--text-white);
}

.rank-up-content p {
    font-size: 1.1rem;
    margin: 15px 0;
    color: var(--text-light);
    font-style: italic;
}

.streak-display {
    font-size: 1.3rem;
    margin: 20px 0;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    display: inline-block;
    color: var(--text-white);
    font-weight: 600;
}

.rank-up-content button {
    background: linear-gradient(135deg, var(--success-green), #059669);
    color: var(--text-white);
    border: none;
    padding: 15px 35px;
    border-radius: 12px;
    font-size: 1.15rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
    box-shadow: var(--shadow-xl);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.rank-up-content button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    background: linear-gradient(135deg, #059669, #047857);
}

@keyframes rankUpBounce {
    0% { 
        opacity: 0;
        transform: scale(0.3) rotate(-10deg);
    }
    50% { 
        transform: scale(1.1) rotate(5deg);
    }
    100% { 
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

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

