/* ==========================================================================
   TECLITA NINJA: MECANOGRAFÍA ARCADE • ESTILOS (3ER GRADO)
   ========================================================================== */

:root {
    --bg-dojo: #060913;
    --primary-cyan: #06B6D4;
    --accent-gold: #F59E0B;
    --neon-pink: #F43F5E;
    --neon-green: #10B981;
    --neon-purple: #8B5CF6;
    
    --font-kids: 'Fredoka', cursive, sans-serif;
    --font-pixel: 'Press Start 2P', monospace;
}

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

body.ninja-body {
    min-height: 100vh;
    background: radial-gradient(circle at 50% 10%, #1E1B4B 0%, #060913 70%, #02040A 100%);
    color: #FFFFFF;
    font-family: var(--font-kids);
    overflow-x: hidden;
    padding-bottom: 20px;
}

/* 1. HEADER */
.ninja-header {
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.btn-ninja-nav {
    background: rgba(30, 41, 59, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    text-decoration: none;
    font-weight: 800;
    padding: 8px 18px;
    border-radius: 99px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-ninja-nav:hover {
    background: var(--neon-purple);
    transform: scale(1.05);
}

.ninja-title-group {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.badge-grade {
    background: var(--neon-pink);
    color: #FFFFFF;
    font-weight: 900;
    font-size: 0.8rem;
    padding: 3px 12px;
    border-radius: 99px;
}

.ninja-title {
    font-size: 1.45rem;
    font-weight: 900;
    background: linear-gradient(135deg, #FFFFFF 0%, #F43F5E 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ninja-tools {
    display: flex;
    gap: 8px;
}

.btn-tool {
    background: rgba(30, 41, 59, 0.85);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.btn-tool:hover {
    background: var(--primary-cyan);
    color: #000;
}

/* 2. MODOS DE DIFICULTAD */
.ninja-modes-bar {
    max-width: 1200px;
    margin: 0 auto 12px auto;
    padding: 0 20px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
}

.ninja-mode-btn {
    background: rgba(30, 41, 59, 0.7);
    border: 2px solid rgba(255, 255, 255, 0.15);
    color: #E2E8F0;
    font-family: var(--font-kids);
    font-weight: 800;
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 99px;
    cursor: pointer;
    transition: all 0.2s;
}

.ninja-mode-btn:hover {
    border-color: var(--neon-pink);
}

.ninja-mode-btn.active {
    background: var(--neon-pink);
    border-color: #FDA4AF;
    color: #FFFFFF;
    box-shadow: 0 0 15px rgba(244, 63, 94, 0.6);
    transform: scale(1.05);
}

/* 3. ARENA Y HUD */
.ninja-arena-container {
    max-width: 950px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ninja-hud-bar {
    display: flex;
    justify-content: space-around;
    background: rgba(19, 27, 46, 0.9);
    border: 2px solid rgba(244, 63, 94, 0.4);
    border-radius: 18px;
    padding: 10px 15px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}

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

.hud-lbl {
    font-size: 0.75rem;
    color: #94A3B8;
    font-weight: 800;
}

.hud-val {
    font-size: 1.3rem;
    font-weight: 900;
    color: #38BDF8;
}

/* Escenario Dojo */
.ninja-dojo-stage {
    position: relative;
    width: 100%;
    height: 360px;
    background: linear-gradient(180deg, #060B18 0%, #0D152A 100%);
    border: 3px solid #38BDF8;
    border-radius: 22px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.7);
}

.laser-danger-line {
    position: absolute;
    bottom: 45px;
    left: 0;
    right: 0;
    height: 3px;
    background: #EF4444;
    box-shadow: 0 0 12px #EF4444;
}

.ninja-teclita-avatar {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    background-image: url('../assets/teclita.jpg');
    background-size: cover;
    background-position: center;
    border-radius: 50%;
    border: 3px solid #38BDF8;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.8);
    transition: left 0.15s ease-out;
}

.laser-blade {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 70px;
    height: 4px;
    background: #00F0FF;
    box-shadow: 0 0 10px #00F0FF, 0 0 20px #00F0FF;
    transform: translate(-50%, -50%) rotate(-45deg);
    opacity: 0;
}

.laser-blade.slashing {
    opacity: 1;
    animation: slashAnim 0.2s ease-out;
}

@keyframes slashAnim {
    0% { transform: translate(-50%, -50%) rotate(-90deg) scale(0.5); opacity: 1; }
    50% { transform: translate(-50%, -50%) rotate(0deg) scale(1.4); opacity: 1; }
    100% { transform: translate(-50%, -50%) rotate(90deg) scale(0.5); opacity: 0; }
}

/* Chips de Palabras que Caen */
.falling-word-chip {
    position: absolute;
    background: rgba(15, 23, 42, 0.95);
    border: 2px solid #38BDF8;
    border-radius: 12px;
    padding: 6px 14px;
    font-family: var(--font-pixel);
    font-size: 1.05rem;
    color: #FFFFFF;
    box-shadow: 0 4px 15px rgba(0,0,0,0.6);
    white-space: nowrap;
    transition: transform 0.1s linear;
}

.falling-word-chip.active-target {
    border-color: #FDE047;
    box-shadow: 0 0 20px rgba(253, 224, 71, 0.8);
}

.typed-char {
    color: #34D399;
    text-shadow: 0 0 8px #10B981;
}

.remaining-char {
    color: #FFFFFF;
}

/* Pantalla de Inicio / Pausa */
.stage-overlay {
    position: absolute;
    inset: 0;
    background: rgba(6, 9, 19, 0.92);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    text-align: center;
    z-index: 50;
}

.stage-overlay.hidden {
    display: none;
}

.ninja-poster {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 3px solid var(--neon-pink);
    box-shadow: 0 0 25px rgba(244, 63, 94, 0.6);
}

.btn-ninja-start {
    background: linear-gradient(135deg, #E11D48 0%, #F43F5E 100%);
    color: #FFFFFF;
    font-family: var(--font-kids);
    font-size: 1.2rem;
    font-weight: 900;
    padding: 14px 28px;
    border-radius: 99px;
    border: none;
    cursor: pointer;
    box-shadow: 0 6px 25px rgba(244, 63, 94, 0.5);
    transition: all 0.2s;
}

.btn-ninja-start:hover {
    transform: scale(1.05);
    box-shadow: 0 0 35px rgba(244, 63, 94, 0.8);
}

/* 4. TECLADO VISUAL GUÍA */
.visual-keyboard-wrapper {
    background: rgba(15, 23, 42, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 12px;
    display: flex;
    justify-content: center;
}

.visual-keyboard {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    max-width: 680px;
}

.kb-row {
    display: flex;
    justify-content: center;
    gap: 4px;
}

.kb-key {
    background: #1E293B;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    color: #CBD5E1;
    font-family: var(--font-pixel);
    font-size: 0.75rem;
    height: 34px;
    min-width: 32px;
    padding: 0 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.1s;
}

.kb-key.pressed {
    background: #06B6D4;
    color: #000000;
    box-shadow: 0 0 12px #06B6D4;
    transform: translateY(2px);
}

.kb-key.highlight-target {
    border-color: #FDE047;
    background: rgba(245, 158, 11, 0.35);
    color: #FDE047;
}

/* 5. MODAL DE RESULTADOS */
.ninja-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 17, 0.95);
    backdrop-filter: blur(12px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 200;
}

.ninja-modal-overlay.active {
    display: flex;
}

.ninja-modal-card {
    background: #FFFFFF;
    color: #0F172A;
    width: 100%;
    max-width: 520px;
    border-radius: 28px;
    border: 8px solid var(--neon-pink);
    padding: 30px;
    text-align: center;
    box-shadow: 0 25px 70px rgba(0,0,0,0.8);
    animation: zoomIn 0.3s ease;
}

.modal-badge {
    background: var(--neon-pink);
    color: #FFFFFF;
    font-size: 0.85rem;
    font-weight: 900;
    padding: 4px 16px;
    border-radius: 99px;
    display: inline-block;
    margin-bottom: 8px;
}

.modal-title {
    font-size: 1.8rem;
    font-weight: 900;
    margin-bottom: 15px;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.res-box {
    background: #F8FAFC;
    border: 2px dashed #CBD5E1;
    border-radius: 14px;
    padding: 10px;
    display: flex;
    flex-direction: column;
}

.res-lbl {
    font-size: 0.8rem;
    color: #64748B;
    font-weight: 800;
}

.res-num {
    font-size: 1.4rem;
    font-weight: 900;
    color: #0284C7;
}

.modal-actions {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.btn-modal {
    font-family: var(--font-kids);
    font-size: 1.05rem;
    font-weight: 900;
    padding: 12px 22px;
    border-radius: 16px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-again { background: var(--neon-pink); color: #FFFFFF; }
.btn-exit { background: #334155; color: #FFFFFF; }
.btn-modal:hover { transform: scale(1.05); }
