/* ==========================================================================
   HOJA DE ESTILOS - MARTILLO DEL SABER 3D
   ========================================================================== */

:root {
    --bg-dark: #0f0f1a;
    --neon-pink: #ff007f;
    --neon-blue: #00f3ff;
    --neon-green: #39ff14;
    --neon-yellow: #fffb00;
    --neon-orange: #ff9a00;
    --text-white: #ffffff;
    --card-bg: rgba(16, 16, 30, 0.85);
    --card-border: rgba(0, 243, 255, 0.3);
    --font-primary: 'Nunito', sans-serif;
    --font-arcade: 'Fredoka One', cursive;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-white);
    font-family: var(--font-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    cursor: none; /* Ocultamos el cursor para reemplazarlo con el mazo 3D */
}

.game-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* ===================== BOTÓN VOLVER ===================== */
.btn-back {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 300;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.25);
    color: var(--text-white);
    padding: 10px 18px;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.btn-back:hover {
    background: var(--neon-pink);
    border-color: var(--neon-pink);
    box-shadow: 0 0 15px var(--neon-pink);
    transform: translateX(-3px);
    cursor: none;
}

/* ===================== HUD ===================== */
.hud-header {
    position: absolute;
    top: 15px;
    right: 20px;
    left: 140px;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    padding: 12px 25px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5), inset 0 0 10px rgba(0,243,255,0.05);
}

.hud-item-question {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.hud-label {
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--neon-blue);
    text-shadow: 0 0 5px rgba(0,243,255,0.5);
    margin-bottom: 3px;
    text-transform: uppercase;
}

.question-display {
    font-family: var(--font-arcade);
    font-size: 1.9rem;
    color: var(--neon-yellow);
    letter-spacing: 2px;
    text-shadow: 0 0 12px rgba(255,251,0,0.7);
    line-height: 1.1;
}

.hud-stats {
    display: flex;
    gap: 25px;
    margin-left: 20px;
}

.hud-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-family: var(--font-arcade);
}

.hud-stat span:first-child {
    font-family: var(--font-primary);
    font-size: 0.7rem;
    font-weight: 900;
    color: #a29bfe;
}

.stat-val {
    font-size: 1.7rem;
    color: var(--text-white);
    text-shadow: 0 0 8px rgba(255,255,255,0.5);
}

#lbl-lives { color: #ff7675; text-shadow: 0 0 8px rgba(255,118,117,0.6); }

/* ===================== CANVAS ===================== */
.canvas-container {
    flex-grow: 1;
    width: 100%;
    height: 100%;
}

/* ===================== INSTRUCCIONES ===================== */
.hud-instructions {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    background: rgba(15,15,26,0.9);
    border: 1px solid rgba(255,255,255,0.1);
    color: #b2bec3;
    padding: 8px 22px;
    border-radius: 30px;
    font-size: 0.9rem;
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    text-align: center;
    white-space: nowrap;
}

/* ===================== MODALES ===================== */
.modal-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 200;
    background: rgba(5,5,10,0.85);
    backdrop-filter: blur(18px);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-content {
    background: rgba(20,20,35,0.9);
    border: 2px solid var(--neon-blue);
    box-shadow: 0 0 40px rgba(0,243,255,0.3), inset 0 0 20px rgba(0,243,255,0.08);
    padding: 40px;
    border-radius: 24px;
    width: 90%;
    max-width: 600px;
    text-align: center;
    transform: scale(1);
    transition: transform 0.4s ease;
}

.large-content {
    max-width: 780px;
}

.modal-overlay.hidden .modal-content {
    transform: scale(0.8);
}

.arcade-logo {
    font-family: var(--font-arcade);
    font-size: 2rem;
    color: var(--text-white);
    text-shadow: 0 0 10px var(--neon-blue), 0 0 20px var(--neon-pink);
    letter-spacing: 2px;
    margin-bottom: 20px;
    animation: pulseGlow 2s infinite ease-in-out;
}

.modal-description {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #dfe6e9;
    margin-bottom: 25px;
}

/* ===================== SELECTOR DE CATEGORÍAS ===================== */
.category-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 10px;
}

.btn-category {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 22px 18px;
    border-radius: 18px;
    border: 2px solid rgba(0,243,255,0.25);
    background: rgba(255,255,255,0.05);
    color: var(--text-white);
    cursor: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.btn-category:hover {
    border-color: var(--neon-blue);
    background: rgba(0,243,255,0.12);
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 10px 25px rgba(0,243,255,0.3);
}

.btn-category[data-cat="math"]:hover  { border-color: var(--neon-yellow); background: rgba(255,251,0,0.1); box-shadow: 0 10px 25px rgba(255,251,0,0.25); }
.btn-category[data-cat="water"]:hover { border-color: var(--neon-blue);   background: rgba(0,243,255,0.1); box-shadow: 0 10px 25px rgba(0,243,255,0.25); }
.btn-category[data-cat="words"]:hover { border-color: var(--neon-pink);   background: rgba(255,0,127,0.1); box-shadow: 0 10px 25px rgba(255,0,127,0.25); }
.btn-category[data-cat="grammar"]:hover { border-color: var(--neon-green); background: rgba(57,255,20,0.1); box-shadow: 0 10px 25px rgba(57,255,20,0.25); }

.cat-icon {
    font-size: 2.6rem;
    line-height: 1;
}

.cat-title {
    font-family: var(--font-arcade);
    font-size: 1.2rem;
    color: var(--text-white);
}

.cat-desc {
    font-size: 0.82rem;
    color: #b2bec3;
    text-align: center;
    line-height: 1.3;
}

/* ===================== BOTÓN ARCADE ===================== */
.btn-arcade {
    font-family: var(--font-arcade);
    font-size: 1.25rem;
    padding: 16px 36px;
    border-radius: 40px;
    background: linear-gradient(135deg, var(--neon-pink), #bd0868);
    border: none;
    color: var(--text-white);
    cursor: none;
    box-shadow: 0 6px 20px rgba(255,0,127,0.4);
    transition: all 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
}

.btn-arcade:hover {
    transform: translateY(-4px) scale(1.04);
    box-shadow: 0 10px 30px rgba(255,0,127,0.6), 0 0 20px var(--neon-pink);
}

/* ===================== TEMAS DE MODALES ===================== */
.win-theme {
    border-color: var(--neon-green);
    box-shadow: 0 0 40px rgba(57,255,20,0.3), inset 0 0 20px rgba(57,255,20,0.08);
}
.win-theme .arcade-logo { text-shadow: 0 0 10px var(--neon-green), 0 0 20px #00b894; }
.win-theme .btn-arcade  { background: linear-gradient(135deg, var(--neon-green), #00b894); box-shadow: 0 6px 20px rgba(57,255,20,0.4); }

.gameover-theme {
    border-color: #ff7675;
    box-shadow: 0 0 40px rgba(255,118,117,0.3), inset 0 0 20px rgba(255,118,117,0.08);
}
.gameover-theme .arcade-logo { text-shadow: 0 0 10px #ff7675, 0 0 20px #d63031; }
.gameover-theme .btn-arcade  { background: linear-gradient(135deg, #ff7675, #d63031); box-shadow: 0 6px 20px rgba(255,118,117,0.4); }
.gameover-theme .btn-arcade:hover { box-shadow: 0 10px 30px rgba(255,118,117,0.6), 0 0 20px #ff7675; }

.stats-summary {
    background: rgba(0,0,0,0.3);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 25px;
    border: 1px solid rgba(255,255,255,0.06);
    font-size: 1.1rem;
}

.victory-decoration {
    font-size: 3rem;
    margin: 10px 0 15px;
    animation: bounceEmoji 1s infinite ease-in-out;
}

/* ===================== ANIMACIONES ===================== */
@keyframes pulseGlow {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.88; transform: scale(0.97); }
}

@keyframes bounceEmoji {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50%       { transform: translateY(-10px) rotate(5deg); }
}

/* Efecto flash de pantalla al errar */
.flash-red {
    animation: flashRed 0.35s ease;
}
@keyframes flashRed {
    0%   { filter: none; }
    30%  { filter: brightness(0.5) sepia(1) hue-rotate(280deg) saturate(5); }
    100% { filter: none; }
}

/* Efecto flash verde al acertar */
.flash-green {
    animation: flashGreen 0.35s ease;
}
@keyframes flashGreen {
    0%   { filter: none; }
    30%  { filter: brightness(1.4) sepia(1) hue-rotate(70deg) saturate(5); }
    100% { filter: none; }
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
    .hud-header { left: 20px; top: 75px; right: 20px; }
    .question-display { font-size: 1.3rem; }
    .category-grid { grid-template-columns: 1fr; }
    .modal-content { padding: 25px; }
    .arcade-logo { font-size: 1.5rem; }
    .cat-icon { font-size: 2rem; }
}
