/* ==========================================================================
   juegos/assets/css/juego_math.css
   ========================================================================== */

.game-header { text-align: center; padding: 40px 20px 20px; position: relative; z-index: 2; }
.game-header h1 { font-size: 2.8rem; font-weight: 800; color: var(--text-main); margin-bottom: 10px; letter-spacing: -1px; }
.game-header p { color: var(--text-muted); font-size: 1.1rem; max-width: 600px; margin: 0 auto; }

.game-container {
    max-width: 700px; margin: 20px auto 60px; background: var(--glass-bg);
    backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border); border-radius: 30px; padding: 25px;
    box-shadow: var(--glass-shine), 0 20px 40px rgba(255, 149, 0, 0.15);
    transition: box-shadow 0.3s, border-color 0.3s; position: relative;
}

[data-theme="dark"] .game-container {
    box-shadow: var(--glass-shine), 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(255, 149, 0, 0.15);
    border-bottom: 2px solid var(--theme-color, #FF9500);
}

.damage-flash { animation: flashRed 0.4s ease; }
@keyframes flashRed {
    0%, 100% { border-color: var(--glass-border); box-shadow: var(--glass-shine); }
    50% { border-color: #FF3B30; box-shadow: inset 0 0 40px rgba(255, 59, 48, 0.4), 0 0 40px rgba(255, 59, 48, 0.4); }
}

.status-bar {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px;
    padding: 10px 20px; background: rgba(255, 149, 0, 0.1); border-radius: 15px;
    border: 1px solid rgba(255, 149, 0, 0.3); flex-wrap: wrap; gap: 10px; visibility: hidden;
}

.status-item { font-size: 1.2rem; font-weight: 700; color: var(--text-main); display: flex; align-items: center; gap: 8px; }
#level-val { color: #5856D6; }
#score-val { color: var(--theme-color, #FF9500); font-size: 1.4rem; }
.lives-container { color: #FF3B30; letter-spacing: 2px; }

.game-wrapper {
    position: relative; border-radius: 15px; min-height: 400px; padding: 10px;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
}

.math-board {
    background: var(--bg-main); border: 3px solid var(--glass-border); border-radius: 20px;
    width: 100%; max-width: 500px; padding: 40px 20px; text-align: center; margin-bottom: 30px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05), 0 10px 25px rgba(0, 0, 0, 0.1);
    display: none; position: relative;
}

[data-theme="dark"] .math-board { border-color: rgba(255, 149, 0, 0.3); background: rgba(0, 0, 0, 0.4); }

.math-equation {
    font-size: 4rem; font-weight: 900; color: var(--text-main); letter-spacing: 5px;
    font-family: 'Courier New', Courier, monospace; text-shadow: 2px 2px 0px rgba(255, 149, 0, 0.2);
}

.options-grid { display: flex; justify-content: center; gap: 20px; width: 100%; display: none; flex-wrap: wrap; }

.btn-option {
    background: var(--bg-main); border: 2px solid var(--glass-border); color: var(--text-main);
    width: 100px; height: 100px; border-radius: 20px; font-size: 2.5rem; font-weight: 800;
    cursor: pointer; transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1); position: relative; overflow: hidden;
    display: flex; align-items: center; justify-content: center; font-family: 'Courier New', Courier, monospace;
}
.btn-option:hover {
    transform: translateY(-5px) scale(1.05); border-color: var(--theme-color, #FF9500);
    color: var(--theme-color, #FF9500); box-shadow: 0 15px 25px rgba(255, 149, 0, 0.2);
}
.btn-option:active { transform: scale(0.95); }

.btn-option::after {
    content: ''; position: absolute; top: 50%; left: -50%; width: 200%; height: 4px;
    background: #fff; transform: rotate(-45deg) translateY(-50%); opacity: 0;
    box-shadow: 0 0 10px #fff, 0 0 20px #34C759; pointer-events: none;
}
.btn-option.correct { background: #34C759; color: white; border-color: #34C759; box-shadow: 0 0 30px rgba(52, 199, 89, 0.6); }
.btn-option.correct::after { animation: slashAnimation 0.4s ease-out forwards; }
@keyframes slashAnimation {
    0% { opacity: 1; transform: rotate(-45deg) translateY(-50%) translateX(-50%); }
    100% { opacity: 0; transform: rotate(-45deg) translateY(-50%) translateX(50%); }
}

.btn-option.wrong { background: #FF3B30; color: white; border-color: #FF3B30; animation: shakeWrong 0.4s ease; }
@keyframes shakeWrong { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }

.game-overlay {
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; flex-direction: column;
    justify-content: center; align-items: center; background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px); z-index: 10; text-align: center; padding: 20px; border-radius: 15px;
}
[data-theme="dark"] .game-overlay { background: rgba(20, 25, 38, 0.85); }
.game-overlay h2 { font-size: 2.5rem; color: var(--theme-color, #FF9500); margin-bottom: 10px; font-weight: 800; }

.btn-game {
    background: linear-gradient(135deg, var(--theme-color, #FF9500), #E67E22); color: white; border: none;
    padding: 14px 30px; border-radius: 50px; font-size: 1.1rem; font-weight: 700; cursor: pointer;
    box-shadow: 0 8px 20px rgba(255, 149, 0, 0.4); transition: all 0.3s; margin-top: 15px;
    display: inline-flex; align-items: center; gap: 8px;
}
.btn-game:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 12px 25px rgba(255, 149, 0, 0.6); }

.btn-back {
    position: absolute; top: 20px; left: 20px; display: flex; align-items: center; gap: 8px;
    text-decoration: none; color: var(--text-main); font-weight: 600; background: var(--glass-bg);
    border: 1px solid var(--glass-border); padding: 8px 16px; border-radius: 50px;
    backdrop-filter: blur(10px); transition: all 0.3s ease; z-index: 10;
}
.btn-back:hover { background: var(--theme-color, #FF9500); color: white; border-color: var(--theme-color, #FF9500); transform: translateY(-2px); box-shadow: 0 5px 15px rgba(255, 149, 0, 0.3); }
.btn-volver-juegos { display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); text-decoration: none; font-weight: 600; transition: color 0.3s; padding: 10px; }
.btn-volver-juegos:hover { color: var(--primary); }

.modal-top3-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px); z-index: 9999; display: none; justify-content: center; align-items: center; padding: 20px;
}
.modal-top3-content {
    background: var(--bg-main); border: 1px solid var(--glass-border); border-radius: 25px;
    width: 100%; max-width: 450px; padding: 30px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    position: relative; animation: popIn 0.3s ease; text-align: center;
}
@keyframes popIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }
.btn-cerrar-modal { position: absolute; top: 15px; right: 20px; background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; }
.btn-cerrar-modal:hover { color: #FF3B30; }
.modal-top3-icon { font-size: 4rem; margin-bottom: 15px; filter: drop-shadow(0 5px 10px rgba(0, 0, 0, 0.2)); color: #FFD700; }
.modal-top3-title { font-size: 1.8rem; font-weight: 800; color: var(--text-main); margin-bottom: 5px; }
.modal-top3-subtitle { font-size: 1rem; color: var(--text-muted); margin-bottom: 25px; }

.ranking-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; text-align: left; }
.ranking-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; background: var(--glass-bg); border: 1px solid var(--glass-border); border-radius: 15px; }
.ranking-item .rank-pos { font-size: 1.5rem; font-weight: 800; width: 30px; }
.ranking-item.pos-1 { border-color: #FFD700; background: rgba(255, 215, 0, 0.1); } .ranking-item.pos-1 .rank-pos { color: #FFD700; }
.ranking-item.pos-2 { border-color: #C0C0C0; background: rgba(192, 192, 192, 0.1); } .ranking-item.pos-2 .rank-pos { color: #C0C0C0; }
.ranking-item.pos-3 { border-color: #CD7F32; background: rgba(205, 127, 50, 0.1); } .ranking-item.pos-3 .rank-pos { color: #CD7F32; }
.rank-info { flex-grow: 1; padding-left: 15px; }
.rank-name { font-weight: 700; color: var(--text-main); font-size: 1.1rem; }
.rank-score { font-weight: 900; font-size: 1.2rem; color: var(--text-main); }

@media (max-width: 768px) {
    .game-header h1 { font-size: 2.2rem; }
    .game-container { padding: 15px; margin: 10px 15px 40px; }
    .math-equation { font-size: 2.8rem; }
    .btn-option { width: 80px; height: 80px; font-size: 2rem; }
    .status-bar { font-size: 1rem; justify-content: center; }
    .btn-back { position: relative; top: 0; left: 0; margin: 0 auto 20px auto; width: max-content; }
}