/* ==========================================================================
   juegos/assets/css/juego_ahorcado.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: 800px; 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(88, 86, 214, 0.15);
    position: relative; transition: box-shadow 0.3s, border-color 0.3s;
}

[data-theme="dark"] .game-container {
    box-shadow: var(--glass-shine), 0 20px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(88, 86, 214, 0.15);
    border-bottom: 2px solid var(--theme-color, #5856D6);
}

.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: var(--text-main); background: var(--bg-main);
    border: 2px solid var(--glass-border); transition: all 0.3s ease; box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}
.level-btn:hover { transform: translateY(-2px); }
.level-btn.active { color: white; border-color: transparent; }

.level-btn.facil.active { background: #34C759; box-shadow: 0 8px 20px rgba(52, 199, 89, 0.4); }
.level-btn.medio.active { background: #0A84FF; box-shadow: 0 8px 20px rgba(10, 132, 255, 0.4); }
.level-btn.dificil.active { background: #FF9500; box-shadow: 0 8px 20px rgba(255, 149, 0, 0.4); }
.level-btn.muy_dificil.active { background: #FF3B30; box-shadow: 0 8px 20px rgba(255, 59, 48, 0.4); }
.level-btn.caxcan.active { background: linear-gradient(135deg, #AF52DE, #5856D6); box-shadow: 0 8px 20px rgba(175, 82, 222, 0.4); }

.status-bar-wrapper { visibility: hidden; margin-bottom: 20px; }
.status-bar {
    display: flex; justify-content: space-between; align-items: center; padding: 10px 20px;
    background: rgba(0, 0, 0, 0.05); border-radius: 15px; border: 1px solid var(--glass-border);
    flex-wrap: wrap; gap: 10px;
}
[data-theme="dark"] .status-bar { background: rgba(255, 255, 255, 0.05); }

.status-item { font-size: 1.2rem; font-weight: 700; color: var(--text-main); display: flex; align-items: center; gap: 8px; }
.lives-container { color: #FF3B30; letter-spacing: 2px; font-size: 1.5rem; transition: all 0.3s ease; }

.timer-container {
    width: 100%; height: 12px; background: rgba(0, 0, 0, 0.08); border-radius: 10px;
    margin-top: 10px; overflow: hidden; display: none; box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}
[data-theme="dark"] .timer-container { background: rgba(255, 255, 255, 0.1); }
.timer-bar { height: 100%; width: 100%; background: #34C759; border-radius: 10px; transition: width 0.1s linear, background-color 0.3s; }

.game-wrapper {
    position: relative; border-radius: 15px; min-height: 400px; padding: 10px;
    display: flex; flex-direction: column; align-items: center; justify-content: space-between; overflow: hidden;
}

.hangman-container { width: 100%; max-width: 180px; margin: 0 auto 20px; visibility: hidden; }
.hangman-svg { width: 100%; height: auto; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1)); }
.h-part { opacity: 0; transform: translateY(-10px) scale(0.9); transform-origin: center; transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.h-part.visible { opacity: 1; transform: translateY(0) scale(1); }

.hint-box {
    text-align: center; margin-bottom: 30px; background: var(--bg-main); padding: 15px 25px;
    border-radius: 15px; border: 1px solid var(--glass-border); box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    width: 100%; max-width: 600px; visibility: hidden;
}
.hint-title {
    color: var(--theme-color, #5856D6); font-size: 0.95rem; text-transform: uppercase;
    font-weight: 800; margin-bottom: 5px; letter-spacing: 1px;
}
.hint-text { color: var(--text-main); font-size: 1.15rem; font-weight: 600; line-height: 1.5; }

.word-display { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-bottom: 40px; perspective: 1000px; }
.letter-box {
    width: 48px; height: 58px; border: 2px solid var(--glass-border); border-radius: 10px;
    background: rgba(0,0,0,0.02); box-shadow: inset 0 2px 5px rgba(0,0,0,0.05); display: flex;
    align-items: center; justify-content: center; font-size: 2.2rem; font-weight: 800;
    color: transparent; text-transform: uppercase; transition: all 0.3s ease;
}
[data-theme="dark"] .letter-box { background: rgba(255,255,255,0.02); box-shadow: inset 0 2px 5px rgba(0,0,0,0.2); }
.letter-box.space-box { border: none; background: transparent; box-shadow: none; width: 20px; }
.letter-box.revealed {
    background: rgba(52, 199, 89, 0.1); border-color: #34C759; color: #34C759;
    box-shadow: 0 5px 15px rgba(52, 199, 89, 0.2); animation: elegantReveal 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

@keyframes elegantReveal {
    0% { transform: translateY(20px) rotateX(-90deg); opacity: 0; }
    50% { transform: translateY(-5px) rotateX(10deg); opacity: 1; }
    100% { transform: translateY(0) rotateX(0); opacity: 1; }
}

.keyboard {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 650px;
    padding: 20px; background: rgba(0, 0, 0, 0.03); border-radius: 20px;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05); visibility: hidden;
}
[data-theme="dark"] .keyboard { background: rgba(255, 255, 255, 0.03); box-shadow: inset 0 2px 10px rgba(0,0,0,0.2); }

.key-btn {
    width: 44px; height: 50px; border-radius: 12px; background: linear-gradient(145deg, var(--bg-main), rgba(0,0,0,0.05));
    box-shadow: 2px 4px 8px rgba(0,0,0,0.1), inset 1px 1px 2px rgba(255,255,255,0.8);
    border: none; color: var(--text-main); font-size: 1.3rem; font-weight: 700; cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275); display: flex;
    align-items: center; justify-content: center; user-select: none; touch-action: manipulation;
}
[data-theme="dark"] .key-btn {
    background: linear-gradient(145deg, rgba(255,255,255,0.1), rgba(0,0,0,0.3));
    box-shadow: 2px 4px 8px rgba(0,0,0,0.3), inset 1px 1px 2px rgba(255,255,255,0.1);
}

.key-btn:hover:not(:disabled) {
    transform: translateY(-4px) scale(1.05); box-shadow: 0 8px 15px rgba(88, 86, 214, 0.2);
    background: var(--bg-main); border: 2px solid var(--theme-color, #5856D6); color: var(--theme-color, #5856D6);
}
.key-btn:active:not(:disabled) { transform: scale(0.9); }
.key-btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; transform: none; }
.key-btn.correct { background: #34C759 !important; color: white !important; box-shadow: 0 4px 10px rgba(52, 199, 89, 0.3) !important; opacity: 1; }
.key-btn.wrong { background: #FF3B30 !important; color: white !important; box-shadow: 0 4px 10px rgba(255, 59, 48, 0.3) !important; opacity: 0.5; }

.damage-flash { animation: flashRed 0.4s ease; }
@keyframes flashRed {
    0%, 100% { box-shadow: var(--glass-shine); border-color: var(--glass-border); }
    50% { box-shadow: inset 0 0 50px rgba(255, 59, 48, 0.4); border-color: #FF3B30; }
}

.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.9);
    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.9); }
.game-overlay h2 { font-size: 2.5rem; color: var(--theme-color, #5856D6); margin-bottom: 10px; font-weight: 800; }

.btn-game {
    background: var(--theme-color, #5856D6); color: white; border: none; padding: 14px 40px;
    border-radius: 50px; font-size: 1.2rem; font-weight: 700; cursor: pointer;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2); transition: all 0.3s; margin-top: 20px;
    display: inline-flex; align-items: center; gap: 8px; touch-action: manipulation;
}
.btn-game:hover { transform: translateY(-3px) scale(1.05); box-shadow: 0 12px 25px rgba(0, 0, 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; margin-top: 20px;
}
.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; }

.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; }
    .status-bar { justify-content: center; }
    .letter-box { width: 35px; height: 45px; font-size: 1.8rem; }
    .key-btn { width: 36px; height: 42px; font-size: 1.1rem; }
    .hint-text { font-size: 1.05rem; }
}