/* Matrix Game Styles */
/* Estilos específicos para el juego de matriz HSK */

.matrix-game-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Pantalla de configuración */
.matrix-config-screen {
    background: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(255, 215, 0, 0.02) 10px,
            rgba(255, 215, 0, 0.02) 20px
        ),
        linear-gradient(
            135deg,
            rgba(139, 69, 19, 0.15) 0%,
            rgba(196, 30, 58, 0.12) 50%,
            rgba(139, 69, 19, 0.15) 100%
        );
    border: 3px solid transparent;
    border-image: linear-gradient(
        135deg,
        rgba(255, 215, 0, 0.5),
        rgba(196, 30, 58, 0.3),
        rgba(255, 215, 0, 0.5)
    ) 1;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        inset 0 1px 3px rgba(255, 215, 0, 0.1);
    animation: slideIn 0.5s ease;
}

.matrix-title {
    font-size: 2.5rem;
    color: white;
    text-align: center;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.matrix-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    margin-bottom: 40px;
}

.matrix-settings {
    background: 
        linear-gradient(
            135deg,
            rgba(255, 215, 0, 0.08) 0%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(196, 30, 58, 0.08) 100%
        );
    border: 2px solid rgba(255, 215, 0, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: inset 0 1px 2px rgba(255, 215, 0, 0.1);
}

.setting-group {
    margin-bottom: 30px;
}

.setting-label {
    display: block;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
}

.matrix-select {
    width: 100%;
    padding: 12px 20px;
    font-size: 1rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.matrix-select:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.matrix-select option {
    background: #4a5568;
    color: white;
}

/* Selector de dificultad */
.difficulty-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.diff-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.diff-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.diff-btn.active {
    background: 
        linear-gradient(
            135deg,
            rgba(255, 215, 0, 0.3) 0%,
            rgba(196, 30, 58, 0.8) 50%,
            rgba(139, 69, 19, 0.4) 100%
        );
    border: 2px solid rgba(255, 215, 0, 0.6);
    transform: scale(1.05);
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.3),
        inset 0 1px 4px rgba(255, 215, 0, 0.2);
}

.diff-icon {
    font-size: 2rem;
}

.diff-name {
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
}

.diff-desc {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

/* Botón de inicio */
.matrix-start-btn {
    width: 100%;
    padding: 18px;
    background: 
        linear-gradient(
            135deg,
            rgba(255, 215, 0, 0.2) 0%,
            rgba(196, 30, 58, 0.9) 50%,
            rgba(139, 69, 19, 0.3) 100%
        );
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 15px;
    color: white;
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 10px 30px rgba(196, 30, 58, 0.4),
        inset 0 1px 4px rgba(255, 215, 0, 0.3),
        0 0 20px rgba(255, 215, 0, 0.2);
}

.matrix-start-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(245, 87, 108, 0.4);
}

.matrix-start-btn:active {
    transform: translateY(0);
}

/* Sección de puntuaciones altas */
.high-scores-section {
    background: 
        linear-gradient(
            135deg,
            rgba(255, 215, 0, 0.08) 0%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(196, 30, 58, 0.08) 100%
        );
    border: 2px solid rgba(255, 215, 0, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 25px;
    box-shadow: inset 0 1px 2px rgba(255, 215, 0, 0.1);
}

.high-scores-section h3 {
    color: white;
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.high-scores-list {
    max-height: 300px;
    overflow-y: auto;
}

.score-item {
    display: grid;
    grid-template-columns: 50px 1fr 80px 100px;
    gap: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin-bottom: 10px;
    color: white;
    align-items: center;
}

.score-rank {
    font-weight: 600;
    color: #fbbf24;
}

.score-value {
    font-size: 1.1rem;
    font-weight: 600;
}

.score-accuracy {
    text-align: center;
    color: #10b981;
}

.score-date {
    text-align: right;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

.no-scores {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    padding: 20px;
}

/* Pantalla de juego */
.matrix-game-screen {
    background: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(255, 215, 0, 0.02) 10px,
            rgba(255, 215, 0, 0.02) 20px
        ),
        linear-gradient(
            135deg,
            rgba(139, 69, 19, 0.15) 0%,
            rgba(196, 30, 58, 0.12) 50%,
            rgba(139, 69, 19, 0.15) 100%
        );
    border: 3px solid transparent;
    border-image: linear-gradient(
        135deg,
        rgba(255, 215, 0, 0.5),
        rgba(196, 30, 58, 0.3),
        rgba(255, 215, 0, 0.5)
    ) 1;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        inset 0 1px 3px rgba(255, 215, 0, 0.1);
    animation: slideIn 0.5s ease;
}

.game-header {
    display: grid;
    grid-template-columns: 1fr auto 120px;
    gap: 20px;
    margin-bottom: 30px;
    align-items: center;
}

.game-stats {
    display: flex;
    gap: 30px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin-bottom: 5px;
}

.stat-value {
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
}

/* Timer */
.game-timer {
    display: flex;
    align-items: center;
    gap: 15px;
}

.timer-bar-container {
    width: 200px;
    height: 30px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.timer-bar {
    height: 100%;
    background: #10b981;
    transition: width 1s linear, background-color 0.3s ease;
    border-radius: 15px;
}

.timer-text {
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    min-width: 50px;
}

/* Controles del juego */
.game-controls {
    display: flex;
    gap: 10px;
}

.control-btn {
    width: 50px;
    height: 50px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Palabra objetivo */
.target-word {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: 
        linear-gradient(
            135deg,
            rgba(255, 215, 0, 0.08) 0%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(196, 30, 58, 0.08) 100%
        );
    border: 2px solid rgba(255, 215, 0, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: inset 0 1px 2px rgba(255, 215, 0, 0.1);
}

.target-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.target-pinyin {
    font-size: 3rem;
    color: white;
    font-weight: 600;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.target-meaning {
    font-size: 1.3rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Matriz de caracteres */
.character-matrix {
    display: grid;
    gap: 10px;
    width: 100%;
    max-width: min(90vw, 700px);
    margin: 0 auto;
    padding: 15px;
    box-sizing: border-box;
}

.matrix-char {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.95);
    border: 3px solid transparent;
    border-radius: 12px;
    font-size: clamp(1.5rem, 4vw, 2.2rem);
    font-weight: 600;
    color: #4a5568;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.5s ease backwards;
    font-family: 'Noto Sans SC', sans-serif;
    min-height: 50px;
    box-sizing: border-box;
}

.matrix-char:hover {
    transform: scale(1.1);
    background: white;
    box-shadow: 
        0 10px 30px rgba(0, 0, 0, 0.2),
        0 0 20px rgba(255, 215, 0, 0.3);
    border-color: rgba(255, 215, 0, 0.6);
}

.matrix-char:active {
    transform: scale(0.95);
}

.matrix-char.correct {
    background: 
        linear-gradient(
            135deg,
            rgba(255, 215, 0, 0.9) 0%,
            rgba(16, 185, 129, 0.8) 50%,
            rgba(196, 30, 58, 0.7) 100%
        );
    color: white;
    border: 2px solid rgba(255, 215, 0, 0.8);
    animation: correctPulse 0.6s ease;
}

.matrix-char.wrong {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    color: white;
    animation: shake 0.5s ease;
}

.matrix-char.highlight-correct {
    background: 
        linear-gradient(
            135deg,
            rgba(255, 215, 0, 0.9) 0%,
            rgba(253, 230, 138, 0.8) 100%
        );
    color: #4a5568;
    border: 2px solid rgba(255, 215, 0, 0.8);
    animation: glow 1s ease infinite;
}

/* Feedback overlay */
.feedback-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px 40px;
    border-radius: 15px;
    font-size: 1.5rem;
    font-weight: 600;
    color: white;
    z-index: 1000;
    display: none;
    animation: feedbackPop 0.8s ease;
}

.feedback-overlay.correct {
    background: linear-gradient(135deg, #10b981 0%, #34d399 100%);
}

.feedback-overlay.wrong {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
}

/* Pause overlay */
.pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 20px;
}

.pause-content {
    text-align: center;
    color: white;
}

.pause-content h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

/* Pantalla de resultados */
.matrix-results-screen {
    background: 
        repeating-linear-gradient(
            45deg,
            transparent,
            transparent 10px,
            rgba(255, 215, 0, 0.02) 10px,
            rgba(255, 215, 0, 0.02) 20px
        ),
        linear-gradient(
            135deg,
            rgba(139, 69, 19, 0.15) 0%,
            rgba(196, 30, 58, 0.12) 50%,
            rgba(139, 69, 19, 0.15) 100%
        );
    border: 3px solid transparent;
    border-image: linear-gradient(
        135deg,
        rgba(255, 215, 0, 0.5),
        rgba(196, 30, 58, 0.3),
        rgba(255, 215, 0, 0.5)
    ) 1;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        inset 0 1px 3px rgba(255, 215, 0, 0.1);
    animation: slideIn 0.5s ease;
    text-align: center;
}

.results-title {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

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

.result-card {
    background: 
        linear-gradient(
            135deg,
            rgba(255, 215, 0, 0.08) 0%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(196, 30, 58, 0.08) 100%
        );
    border: 2px solid rgba(255, 215, 0, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    box-shadow: inset 0 1px 2px rgba(255, 215, 0, 0.1);
}

.result-card.highlight {
    background: 
        linear-gradient(
            135deg,
            rgba(255, 215, 0, 0.3) 0%,
            rgba(196, 30, 58, 0.8) 50%,
            rgba(139, 69, 19, 0.4) 100%
        );
    border: 2px solid rgba(255, 215, 0, 0.6);
    transform: scale(1.1);
    box-shadow: 
        0 0 20px rgba(255, 215, 0, 0.3),
        inset 0 1px 4px rgba(255, 215, 0, 0.2);
}

.result-icon {
    font-size: 2rem;
}

.result-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

.result-value {
    color: white;
    font-size: 1.5rem;
    font-weight: 600;
}

.new-record {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 30px;
    display: inline-block;
    animation: bounce 1s ease infinite;
}

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

.action-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-btn.primary {
    background: 
        linear-gradient(
            135deg,
            rgba(255, 215, 0, 0.2) 0%,
            rgba(196, 30, 58, 0.9) 50%,
            rgba(139, 69, 19, 0.3) 100%
        );
    border: 2px solid rgba(255, 215, 0, 0.5);
    color: white;
    box-shadow: 
        0 4px 12px rgba(196, 30, 58, 0.3),
        inset 0 1px 4px rgba(255, 215, 0, 0.2);
}

.action-btn.secondary {
    background: 
        linear-gradient(
            135deg,
            rgba(255, 215, 0, 0.1) 0%,
            rgba(255, 255, 255, 0.2) 50%,
            rgba(196, 30, 58, 0.1) 100%
        );
    border: 2px solid rgba(255, 215, 0, 0.3);
    color: white;
    backdrop-filter: blur(10px);
    box-shadow: inset 0 1px 2px rgba(255, 215, 0, 0.1);
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Animaciones */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes correctPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
    }
}

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
    }
    50% {
        box-shadow: 0 0 40px rgba(251, 191, 36, 0.8);
    }
}

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

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

/* Responsive design */
@media (max-width: 768px) {
    .matrix-config-screen,
    .matrix-game-screen,
    .matrix-results-screen {
        padding: 15px;
    }
    
    .matrix-title {
        font-size: 2rem;
    }
    
    .difficulty-selector {
        grid-template-columns: 1fr;
    }
    
    .game-header {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .game-stats {
        justify-content: space-around;
        gap: 15px;
    }
    
    .game-timer {
        justify-content: center;
    }
    
    .timer-bar-container {
        width: 100%;
        max-width: 250px;
    }
    
    .game-controls {
        justify-content: center;
    }
    
    .target-pinyin {
        font-size: 2rem;
    }
    
    .character-matrix {
        gap: 8px;
        padding: 10px;
        max-width: min(95vw, 500px);
    }
    
    .matrix-char {
        font-size: clamp(1.2rem, 3.5vw, 1.8rem);
        border-radius: 8px;
        min-height: 40px;
    }
    
    .results-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .results-actions {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .character-matrix {
        gap: 6px;
        padding: 8px;
        max-width: min(98vw, 400px);
    }
    
    .matrix-char {
        font-size: clamp(1rem, 3vw, 1.5rem);
        border-radius: 6px;
        min-height: 35px;
        border-width: 2px;
    }
    
    .target-word {
        padding: 20px;
    }
    
    .target-pinyin {
        font-size: 1.8rem;
    }
    
    .game-stats {
        gap: 10px;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
}
