/* Chinese Composition Game Styles */

/* Mobile-first responsive design */
@media (max-width: 768px) {
    body {
        margin: 10px;
        font-size: 14px;
    }
    
    .game-container {
        padding: 20px;
        margin: 10px auto;
    }
    
    .level-progress {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .level-indicator {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .level-indicator::after {
        display: none;
    }
    
    .blank-input {
        min-width: 80px;
        font-size: 14px;
        margin: 2px;
        display: block;
        margin-bottom: 10px;
        color: #2c3e50;
    }
    
    .blank-input::placeholder {
        color: #6c757d;
        opacity: 1;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 14px;
        margin: 5px;
        display: block;
        width: 100%;
        max-width: 200px;
        margin-left: auto;
        margin-right: auto;
    }
    
    .action-buttons {
        display: flex;
        flex-direction: column;
        align-items: center;
    }
}

/* Tablet styles */
@media (min-width: 769px) and (max-width: 1024px) {
    .game-container {
        max-width: 700px;
    }
    
    .blank-input {
        min-width: 90px;
    }
}

/* Desktop styles */
@media (min-width: 1025px) {
    .game-container {
        max-width: 800px;
    }
}

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

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

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

@keyframes glow {
    from {
        box-shadow: 0 0 5px #2196f3;
    }
    to {
        box-shadow: 0 0 20px #2196f3, 0 0 30px #2196f3;
    }
}

@keyframes celebration {
    0% {
        transform: scale(1) rotate(0deg);
    }
    25% {
        transform: scale(1.1) rotate(3deg);
    }
    50% {
        transform: scale(1.2) rotate(-3deg);
    }
    75% {
        transform: scale(1.1) rotate(2deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
    }
}

@keyframes confettiFall {
    0% {
        transform: translateY(-10px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes flashFade {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

.game-container {
    animation: fadeIn 0.5s ease-out;
}

.feedback {
    animation: fadeIn 0.3s ease-out;
}

/* Input focus effects */
.blank-input:focus {
    transform: scale(1.05);
    transition: all 0.3s ease;
    animation: glow 1s infinite alternate;
}

/* Answer effect classes */
.correct-answer {
    animation: bounce 0.6s ease-in-out;
    background: linear-gradient(45deg, #4caf50, #81c784) !important;
    color: white !important;
    font-weight: bold !important;
}

.incorrect-answer {
    animation: shake 0.5s ease-in-out;
    background: linear-gradient(45deg, #f44336, #ef5350) !important;
    color: white !important;
}

.celebration-mode {
    animation: celebration 1s ease-in-out;
}

/* Button effects */
.btn {
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.95);
}

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

/* Progress indicator animations */
.level-indicator {
    transition: all 0.3s ease;
}

.level-indicator.current {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 15px rgba(33, 150, 243, 0.5);
    }
    50% {
        box-shadow: 0 0 25px rgba(33, 150, 243, 0.8);
    }
    100% {
        box-shadow: 0 0 15px rgba(33, 150, 243, 0.5);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
        color: #f0f0f0;
    }
    
    .game-container {
        background: #333;
        color: #f0f0f0;
    }
    
    .exercise-content {
        background: #444;
        color: #f0f0f0;
    }
    
    .blank-input {
        background: #555;
        color: #f0f0f0;
        border-color: #999;
    }
    
    .hint {
        background: #444;
        border-left-color: #ff9800;
        color: #ffcc80;
    }
    
    .level-indicator::after {
        background: #bbb;
    }
}

/* Print styles */
@media print {
    .action-buttons,
    .level-progress,
    .achievement {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .game-container {
        box-shadow: none !important;
        border: 1px solid #888;
    }
}

/* Accessibility improvements */
.btn:focus,
.blank-input:focus {
    outline: 2px solid #2196f3;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .level-indicator {
        border: 2px solid white;
    }
    
    .blank-input {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .level-indicator.current {
        animation: none;
        box-shadow: 0 0 15px rgba(33, 150, 243, 0.5);
    }
}