/* ==========================================================================
   juegos/assets/css/juego_planetas.css
   ========================================================================== */

:root {
    --space-bg: #0B0D17;
    --space-accent: var(--theme-color, #0A84FF);
}

body.solar-system-theme {
    background-color: var(--space-bg);
    background-image: radial-gradient(white, rgba(255, 255, 255, .2) 2px, transparent 4px), 
                      radial-gradient(white, rgba(255, 255, 255, .15) 1px, transparent 3px), 
                      radial-gradient(white, rgba(255, 255, 255, .1) 2px, transparent 4px);
    background-size: 550px 550px, 350px 350px, 250px 250px;
    background-position: 0 0, 40px 60px, 130px 270px;
    color: #ffffff;
}

.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: #ffffff; margin-bottom: 10px;
    letter-spacing: -1px; text-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}
.game-header p { color: rgba(255, 255, 255, 0.7); font-size: 1.1rem; max-width: 600px; margin: 0 auto; }

.game-container {
    max-width: 700px; margin: 20px auto 60px; background: rgba(20, 25, 38, 0.7);
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 30px; padding: 25px;
    box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.05), 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(108, 99, 255, 0.2);
    border-bottom: 2px solid var(--space-accent); position: relative;
}

.level-selector { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 25px; }
.level-btn {
    padding: 10px 20px; border-radius: 50px; text-decoration: none; font-weight: 700;
    font-size: 0.95rem; color: #fff; background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2); transition: all 0.3s ease;
}
.level-btn:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.2); }
.level-btn.active { color: white; border-color: var(--space-accent); background: var(--space-accent); box-shadow: 0 8px 20px rgba(255, 255, 255, 0.2); }

.status-bar {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px;
    padding: 10px 20px; background: rgba(255, 255, 255, 0.05); border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1); visibility: hidden; flex-wrap: wrap; gap: 10px;
}

.status-item { font-size: 1.2rem; font-weight: 700; color: #ffffff; display: flex; align-items: center; gap: 8px; }
.status-item span { color: var(--space-accent); }

.timer-danger { color: #FF3B30 !important; animation: pulseTimer 0.5s infinite alternate; }
@keyframes pulseTimer { 0% { transform: scale(1); } 100% { transform: scale(1.15); } }

.game-wrapper {
    position: relative; border-radius: 15px; min-height: 400px;
    padding: 10px 0; display: flex; flex-direction: column; align-items: center; overflow: hidden;
}

/* MODO 1: TABLA (SWAP) */
.solar-system-board { width: 100%; max-width: 450px; display: flex; flex-direction: column; align-items: center; gap: 12px; display: none; }
.sun-header {
    background: linear-gradient(135deg, #FF9500, #FF3B30); color: white; font-size: 1.5rem;
    font-weight: 900; padding: 15px 40px; border-radius: 50px 50px 10px 10px; width: 100%;
    text-align: center; margin-bottom: 10px; box-shadow: 0 10px 30px rgba(255, 149, 0, 0.4);
    text-transform: uppercase; letter-spacing: 2px; position: relative; overflow: hidden;
}
.sun-header::after { content: '☀️'; position: absolute; left: 20px; top: 50%; transform: translateY(-50%); font-size: 1.8rem; }

.planet-card {
    width: 100%; background: rgba(255, 255, 255, 0.05); border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px; padding: 12px 20px; display: flex; align-items: center; gap: 15px;
    cursor: pointer; position: relative; transition: all 0.3s ease; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); user-select: none;
}
.planet-card:active { transform: scale(0.97); }
.planet-card.selected {
    border-color: var(--space-accent); background: rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 0 0 1px var(--space-accent), 0 8px 25px rgba(255, 255, 255, 0.1);
    transform: translateX(10px); z-index: 5;
}
.solar-system-board.solved .planet-card { border-color: #34C759 !important; box-shadow: 0 5px 15px rgba(52, 199, 89, 0.2) !important; }

.planet-emoji { font-size: 2.2rem; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5)); }
.planet-name { color: #ffffff; font-size: 1.3rem; font-weight: 700; letter-spacing: 1px; flex-grow: 1; }

/* MODO 2: UNIVERSO ANIMADO (ORBITAS) */
.orbit-board { width: 100%; max-width: 500px; display: none; flex-direction: column; align-items: center; gap: 20px; }
.universe-container {
    width: 100%; max-width: 380px; aspect-ratio: 1/1; background: radial-gradient(circle at center, #0B0D17 0%, #000000 100%);
    border-radius: 50%; position: relative; overflow: hidden;
    box-shadow: 0 0 30px rgba(108, 99, 255, 0.2), inset 0 0 40px #000; border: 2px solid rgba(255, 255, 255, 0.1);
}
.mini-star { position: absolute; background: white; border-radius: 50%; width: 2px; height: 2px; box-shadow: 0 0 5px white; animation: twinkle linear infinite; }
@keyframes twinkle { 0%, 100% { opacity: 0.2; transform: scale(0.8); } 50% { opacity: 1; transform: scale(1.2); } }

.sun-center {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 3rem; text-shadow: 0 0 20px #FF9500, 0 0 40px #FF3B30; z-index: 10; animation: pulseSun 2s infinite alternate;
}
@keyframes pulseSun { 0% { text-shadow: 0 0 20px #FF9500, 0 0 40px #FF3B30; transform: translate(-50%, -50%) scale(1); } 100% { text-shadow: 0 0 30px #FF9500, 0 0 60px #FF3B30; transform: translate(-50%, -50%) scale(1.05); } }

.orbit-ring { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); border: 1px dashed rgba(255, 255, 255, 0.15); border-radius: 50%; }
.orbit-wrapper { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); border-radius: 50%; animation: spinOrbit linear infinite; display: none; }
@keyframes spinOrbit { 0% { transform: translate(-50%, -50%) rotate(0deg); } 100% { transform: translate(-50%, -50%) rotate(360deg); } }

.planet-on-orbit {
    position: absolute; top: -14px; left: 50%; transform: translateX(-50%); font-size: 1.4rem;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.4)); animation: counterSpin linear infinite;
}
@keyframes counterSpin { 0% { transform: translateX(-50%) rotate(0deg); } 100% { transform: translateX(-50%) rotate(-360deg); } }

.target-planet-display { background: rgba(255, 255, 255, 0.05); border: 2px dashed var(--space-accent); padding: 15px; border-radius: 20px; text-align: center; width: 100%; margin-top: 10px; }
.target-planet-display h3 { color: rgba(255, 255, 255, 0.7); font-size: 1rem; margin-bottom: 5px; font-weight: 600; }
.target-planet-display .the-planet { font-size: 2rem; color: #fff; font-weight: 800; display: flex; justify-content: center; align-items: center; gap: 10px; }

.orbits-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; }
.orbit-slot {
    background: rgba(0, 0, 0, 0.5); border: 2px solid rgba(255, 255, 255, 0.1); height: 60px;
    border-radius: 15px; display: flex; align-items: center; justify-content: center;
    font-size: 1rem; color: rgba(255, 255, 255, 0.4); font-weight: 800; cursor: pointer;
    transition: all 0.2s ease; flex-direction: column;
}
.orbit-slot:hover { border-color: var(--space-accent); color: white; background: rgba(255, 255, 255, 0.05); }
.orbit-slot.filled { background: rgba(255, 255, 255, 0.1); border-color: #34C759; color: white; cursor: default; }

/* MODO 3: TRIVIA (CAXCAN) */
.trivia-board {
    width: 100%; max-width: 500px; display: none; flex-direction: column; align-items: center;
    gap: 20px; background: rgba(255, 255, 255, 0.05); padding: 30px 20px; border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}
.trivia-question { font-size: 1.4rem; font-weight: 800; text-align: center; margin-bottom: 15px; line-height: 1.4; }
.trivia-opts { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.btn-trivia {
    background: rgba(0, 0, 0, 0.4); border: 2px solid rgba(255, 255, 255, 0.2); color: white;
    padding: 15px; font-size: 1.1rem; font-weight: 700; border-radius: 15px; cursor: pointer; transition: all 0.2s ease;
}
.btn-trivia:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--space-accent); }
.btn-trivia.correct { background: #34C759 !important; border-color: #34C759 !important; }
.btn-trivia.wrong { background: #FF3B30 !important; border-color: #FF3B30 !important; }

/* ALERTAS DE ACIERTO/ERROR */
.feedback-overlay {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0);
    z-index: 100; display: flex; align-items: center; justify-content: center; width: 140px; height: 140px;
    border-radius: 50%; background: rgba(20, 25, 38, 0.9); backdrop-filter: blur(10px); opacity: 0;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s; pointer-events: none; border: 4px solid transparent;
}
.feedback-overlay i { font-size: 5rem; }
.feedback-overlay.show-correct { transform: translate(-50%, -50%) scale(1); opacity: 1; color: #34C759; box-shadow: 0 10px 40px rgba(52, 199, 89, 0.4); border-color: #34C759; }
.feedback-overlay.show-wrong { transform: translate(-50%, -50%) scale(1); opacity: 1; color: #FF3B30; box-shadow: 0 10px 40px rgba(255, 59, 48, 0.4); border-color: #FF3B30; }

.btn-check {
    background: linear-gradient(135deg, var(--space-accent), #4F46E5); color: white; border: none;
    padding: 14px 40px; border-radius: 50px; font-size: 1.1rem; font-weight: 700; cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4); transition: all 0.3s; margin-top: 30px; display: none; gap: 10px; align-items: center;
}
.btn-check:hover { transform: translateY(-3px) scale(1.05); }
.btn-check.shake { animation: shakeBtn 0.4s ease; background: linear-gradient(135deg, #FF3B30, #C92A2A); }
@keyframes shakeBtn { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }

/* Overlays (Menús) */
.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(11, 13, 23, 0.9);
    backdrop-filter: blur(10px); z-index: 10; text-align: center; padding: 20px; border-radius: 15px;
}
.game-overlay h2 { font-size: 2.5rem; color: var(--space-accent); margin-bottom: 10px; font-weight: 800; text-shadow: 0 0 15px rgba(255, 255, 255, 0.2); }

.btn-game {
    background: linear-gradient(135deg, var(--space-accent), #4F46E5); color: #ffffff; border: none;
    padding: 14px 40px; border-radius: 50px; font-size: 1.2rem; font-weight: 800; cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3); transition: all 0.3s; margin-top: 20px; display: inline-flex; align-items: center; gap: 8px;
}
.btn-game:hover { transform: translateY(-3px) scale(1.05); }

.btn-volver-juegos { display: inline-flex; align-items: center; gap: 8px; color: rgba(255, 255, 255, 0.6); text-decoration: none; font-weight: 600; transition: color 0.3s; margin-top: 20px; }
.btn-volver-juegos:hover { color: #ffffff; }

/* Modal Top 3 */
.modal-top3-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px); z-index: 9999; display: none; justify-content: center; align-items: center; padding: 20px;
}
.modal-top3-content {
    background: rgba(20, 25, 38, 1); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 25px;
    width: 100%; max-width: 450px; padding: 30px; box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    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: rgba(255, 255, 255, 0.5); 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.5)); color: #FFD700; }
.modal-top3-title { font-size: 1.8rem; font-weight: 800; color: #fff; margin-bottom: 5px; }

.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: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.1); 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: #fff; font-size: 1.1rem; }
.rank-score { font-weight: 900; font-size: 1.2rem; color: #fff; }

@media (max-width: 768px) {
    .game-header h1 { font-size: 2.2rem; }
    .game-container { padding: 15px; margin: 10px 15px 40px; }
    .planet-emoji { font-size: 1.8rem; }
    .planet-name { font-size: 1.1rem; }
    .planet-card { padding: 10px 15px; }
    .sun-header { font-size: 1.2rem; padding: 12px 20px; }
    .universe-container { max-width: 320px; }
    .orbits-grid { grid-template-columns: repeat(4, 1fr); gap: 8px; }
    .orbit-slot { height: 55px; font-size: 0.9rem; }
    .trivia-question { font-size: 1.2rem; }
    .feedback-overlay { width: 100px; height: 100px; }
    .feedback-overlay i { font-size: 3.5rem; }
}
@media (max-width: 400px) { .universe-container { max-width: 280px; } }