/**
 * NewGearCars Minijuegos
 * Estilos
 */

/* Reset */
.ngc-arcade * {
    box-sizing: border-box;
}

.ngc-arcade {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Header del arcade */
.ngc-arcade-header {
    text-align: center;
    margin-bottom: 30px;
}

.ngc-arcade-header h2 {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: #1a1a1a;
}

.ngc-arcade-header p {
    font-size: 16px;
    color: #666;
    margin: 0;
}

/* Grid de juegos */
.ngc-games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 15px;
    margin-bottom: 40px;
}

.ngc-game-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    overflow: visible;
}

.ngc-game-card:hover {
    border-color: transparent;
    transform: translateY(-3px);
    box-shadow: none;
}

.ngc-game-card:hover .ngc-game-img {
    opacity: 0.85;
}

.ngc-game-img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    display: block;
    border-radius: 10px;
    transition: opacity 0.2s;
}

.ngc-game-name {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 2px;
    padding-top: 10px;
    display: block;
}

.ngc-game-desc {
    font-size: 13px;
    color: #1a1a1a;
    display: block;
    padding-bottom: 0;
}

/* Highscores summary */
.ngc-highscores-summary {
    background: #f8f8f8;
    border-radius: 12px;
    padding: 20px;
}

.ngc-highscores-summary h3 {
    font-size: 18px;
    margin: 0 0 15px 0;
    color: #1a1a1a;
}

.ngc-scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.ngc-score-item {
    background: #fff;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e0e0e0;
}

.ngc-score-item .game-name {
    font-size: 12px;
    color: #888;
    display: block;
    margin-bottom: 4px;
}

.ngc-score-item .game-score {
    font-size: 20px;
    font-weight: 700;
    color: #E10600;
}

/* Contenedor del juego */
.ngc-game-container {
    background: #1a1a1a;
    border-radius: 12px;
    overflow: hidden;
}

.ngc-game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: #000;
    border-bottom: 2px solid #333;
}

.ngc-back-btn {
    background: none;
    border: 1px solid #555;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.ngc-back-btn:hover {
    background: #333;
    border-color: #888;
}

.ngc-game-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.ngc-game-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.ngc-game-score {
    font-size: 16px;
    color: #E10600;
    font-weight: 600;
}

/* Área de juego */
.ngc-game-area {
    position: relative;
    width: 100%;
    min-height: 450px;
    background: #2a2a2a;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 10px;
    box-sizing: border-box;
    overflow: hidden;
}

.ngc-carrera-wrapper,
.ngc-parking-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    max-width: 100%;
}

.ngc-game-area canvas {
    display: block;
    max-width: 100%;
    border-radius: 8px;
    touch-action: none;
}

/* Game Over */
.ngc-game-over {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.ngc-game-over-content {
    text-align: center;
    color: #fff;
    padding: 40px;
}

.ngc-game-over-content h3 {
    font-size: 32px;
    margin: 0 0 20px 0;
    color: #E10600;
}

.ngc-final-score {
    font-size: 24px;
    margin: 0 0 10px 0;
}

.ngc-final-score span {
    color: #E10600;
    font-weight: 700;
}

.ngc-best-score {
    font-size: 16px;
    color: #888;
    margin: 0 0 30px 0;
}

.ngc-best-score span {
    color: #ffd700;
}

.ngc-game-over-btns {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.ngc-btn-primary,
.ngc-btn-secondary {
    padding: 12px 30px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.ngc-btn-primary {
    background: #E10600;
    color: #fff;
}

.ngc-btn-primary:hover {
    background: #ff1a1a;
}

.ngc-btn-secondary {
    background: #333;
    color: #fff;
    border: 1px solid #555;
}

.ngc-btn-secondary:hover {
    background: #444;
}

/* Instrucciones de juego */
.ngc-game-instructions {
    text-align: center;
    padding: 40px;
    color: #fff;
}

.ngc-game-instructions h3 {
    font-size: 24px;
    margin: 0 0 15px 0;
}

.ngc-game-instructions p {
    font-size: 16px;
    color: #aaa;
    margin: 0 0 30px 0;
}

.ngc-start-btn {
    padding: 15px 50px;
    font-size: 20px;
    font-weight: 700;
    background: #E10600;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.ngc-start-btn:hover {
    background: #ff1a1a;
    transform: scale(1.05);
}

/* Quiz específico */
.ngc-quiz-container {
    width: 100%;
    max-width: 500px;
    padding: 30px;
}

.ngc-quiz-question {
    text-align: center;
    margin-bottom: 30px;
}

.ngc-quiz-logo {
    width: 180px;
    height: 180px;
    margin: 0 auto 20px;
    background: #fff;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.ngc-quiz-logo img {
    max-width: 140px;
    max-height: 140px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.ngc-quiz-logo svg {
    width: 100%;
    height: 100%;
    max-width: 130px;
    max-height: 130px;
}

/* Siluetas */
.ngc-quiz-silueta {
    width: 320px;
    height: 180px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #e8e8e8 0%, #f5f5f5 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    box-sizing: border-box;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.ngc-quiz-silueta img {
    max-width: 280px;
    max-height: 150px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.ngc-quiz-prompt {
    font-size: 18px;
    color: #fff;
}

.ngc-quiz-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.ngc-quiz-option {
    padding: 15px 20px;
    background: #333;
    border: 2px solid #444;
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.ngc-quiz-option:hover {
    border-color: #E10600;
    background: #3a3a3a;
}

.ngc-quiz-option.correct {
    background: #16a34a;
    border-color: #16a34a;
}

.ngc-quiz-option.incorrect {
    background: #dc2626;
    border-color: #dc2626;
}

.ngc-quiz-timer {
    text-align: center;
    margin-bottom: 20px;
    font-size: 24px;
    color: #E10600;
    font-weight: 700;
}

.ngc-quiz-progress {
    text-align: center;
    margin-bottom: 15px;
    color: #888;
    font-size: 14px;
}

/* Reflejos - Semáforo F1 */
.ngc-reflejos-container {
    text-align: center;
    padding: 40px;
}

/* Semáforo estilo F1 - 5 luces horizontales */
.ngc-f1-semaforo {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 0 auto 30px;
    background: #1a1a1a;
    border-radius: 12px;
    padding: 20px 30px;
    border: 4px solid #333;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.ngc-f1-light {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #2a2a2a;
    border: 3px solid #444;
    transition: all 0.15s ease;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}

.ngc-f1-light.on {
    background: #ff0000;
    border-color: #ff3333;
    box-shadow: 0 0 25px #ff0000, 0 0 50px #ff0000, inset 0 -5px 10px rgba(0,0,0,0.3);
}

/* Semáforo clásico (mantener por compatibilidad) */
.ngc-semaforo {
    width: 120px;
    margin: 0 auto 30px;
    background: #333;
    border-radius: 12px;
    padding: 15px;
}

.ngc-semaforo-light {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 10px auto;
    background: #444;
    transition: all 0.1s;
}

.ngc-semaforo-light.red {
    background: #ff0000;
    box-shadow: 0 0 30px #ff0000;
}

.ngc-semaforo-light.yellow {
    background: #ffcc00;
    box-shadow: 0 0 30px #ffcc00;
}

.ngc-semaforo-light.green {
    background: #00ff00;
    box-shadow: 0 0 30px #00ff00;
}

.ngc-reflejos-result {
    font-size: 56px;
    font-weight: 700;
    color: #E10600;
    margin: 20px 0 10px;
    text-shadow: 0 2px 10px rgba(225, 6, 0, 0.3);
}

.ngc-reflejos-msg {
    font-size: 18px;
    color: #aaa;
    margin: 10px 0;
}

.ngc-reflejos-btn {
    margin-top: 30px;
    padding: 20px 60px;
    font-size: 24px;
    font-weight: 700;
    background: #E10600;
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ngc-reflejos-btn:hover {
    background: #ff1a1a;
    transform: scale(1.02);
}

.ngc-reflejos-btn:disabled {
    background: #555;
    cursor: not-allowed;
    transform: none;
}

/* Parking game */
.ngc-parking-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px;
    background: #111;
}

.ngc-parking-row {
    display: flex;
    gap: 8px;
}

.ngc-parking-btn {
    width: 60px;
    height: 60px;
    font-size: 24px;
    background: #333;
    border: 2px solid #555;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: all 0.1s;
    user-select: none;
    -webkit-user-select: none;
}

.ngc-parking-btn:hover {
    background: #444;
    border-color: #666;
}

.ngc-parking-btn:active {
    background: #E10600;
    border-color: #E10600;
    transform: scale(0.95);
}

/* Hint de controles */
.ngc-controls-hint {
    text-align: center;
    color: #888;
    font-size: 13px;
    margin: 10px 0 0;
    padding: 0 15px;
}

/* Responsive */
@media (max-width: 600px) {
    .ngc-arcade {
        padding: 15px;
    }
    
    .ngc-arcade-header h2 {
        font-size: 24px;
    }
    
    .ngc-games-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .ngc-game-card {
        padding: 0;
    }
    
    .ngc-game-img {
        height: 100px;
    }
    
    .ngc-game-name {
        font-size: 14px;
    }
    
    .ngc-game-area {
        min-height: 400px;
    }
    
    .ngc-quiz-options {
        grid-template-columns: 1fr;
    }
    
    .ngc-game-header {
        flex-direction: column;
        gap: 10px;
    }
}

/* Controles duales para Parking */
.ngc-dual-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    padding: 10px;
    flex-wrap: wrap;
}

.ngc-control-gas,
.ngc-control-steer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.ngc-control-label {
    color: #888;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#ngc-gas-canvas,
#ngc-steer-canvas {
    touch-action: none;
    cursor: pointer;
}

/* Desbloqueo de coches */
.ngc-car-unlock {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #000;
    padding: 15px 30px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: bold;
    z-index: 1000;
    animation: unlockPop 0.5s ease;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.5);
}

@keyframes unlockPop {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.1); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Wrapper carrera */
.ngc-carrera-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
}

.ngc-parking-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
}

.ngc-controls-hint {
    color: #888;
    font-size: 13px;
    margin: 8px 0 0 0;
    text-align: center;
}

.ngc-reflejos-msg.small {
    font-size: 13px;
    opacity: 0.7;
}

/* ====================================
   LEADERBOARD - Clean, sin cajas
   ==================================== */

.ngc-leaderboards-section {
    margin-top: 50px;
    padding: 0;
    background: none;
}

.ngc-leaderboards-section h3 {
    font-family: inherit;
    font-size: 20px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 6px 0;
    text-align: left;
}

.ngc-lb-subtitle {
    text-align: left;
    color: #999;
    font-size: 13px;
    margin: 0 0 24px 0;
    font-family: inherit;
}

.ngc-all-leaderboards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.ngc-lb-card {
    background: none;
    border-radius: 0;
    padding: 0;
    border: none;
}

.ngc-lb-card h4 {
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px 0;
    text-align: left;
    text-transform: none;
    letter-spacing: 0;
    padding-bottom: 6px;
    border-bottom: 2px solid #E10600;
}

.ngc-lb-hint {
    display: inline;
    color: #999;
    font-size: 11px;
    font-weight: 400;
    margin-left: 4px;
}

.ngc-lb-table {
    width: 100%;
    border-collapse: collapse;
}

.ngc-lb-table tr {
    border-bottom: none;
}

.ngc-lb-table tr.ngc-me {
    background: none;
}

.ngc-lb-table tr.ngc-me td {
    font-weight: 700;
}

.ngc-lb-table td {
    padding: 3px 0;
    font-family: inherit;
    font-size: 13px;
    color: #333;
    vertical-align: baseline;
}

.ngc-lb-pos {
    width: 20px;
    text-align: left;
    color: #999;
    font-size: 12px;
}

.ngc-lb-name {
    font-weight: 400;
    color: #333;
}

.ngc-lb-score {
    text-align: right;
    color: #E10600;
    font-weight: 700;
    font-size: 13px;
}

.ngc-no-records {
    text-align: left;
    color: #999;
    font-size: 12px;
    padding: 4px 0;
    margin: 0;
    font-style: italic;
}

.ngc-loading {
    text-align: center;
    color: #999;
    padding: 20px;
    font-size: 13px;
}

/* Modal nombre */
.ngc-name-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.ngc-name-modal-content {
    background: #1a1a1a;
    border-radius: 16px;
    padding: 30px;
    text-align: center;
    border: 2px solid #333;
    max-width: 90%;
    width: 300px;
}

.ngc-name-modal-content h3 {
    color: #fff;
    font-size: 22px;
    margin: 0 0 8px 0;
}

.ngc-name-hint {
    color: #888;
    font-size: 13px;
    margin: 0 0 20px 0;
}

.ngc-name-modal-content input {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    background: #333;
    border: 2px solid #444;
    border-radius: 8px;
    color: #fff;
    text-align: center;
    outline: none;
    box-sizing: border-box;
}

.ngc-name-modal-content input:focus {
    border-color: #E10600;
}

.ngc-name-modal-content button {
    width: 100%;
    margin-top: 15px;
}

/* Record status */
.ngc-record-status {
    margin: 10px 0;
    min-height: 28px;
}

.ngc-saving {
    color: #888;
    font-size: 13px;
}

.ngc-world-record {
    display: inline-block;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    font-size: 18px;
    font-weight: 700;
    padding: 8px 20px;
    border-radius: 8px;
    animation: pulse 0.5s ease;
}

.ngc-personal-best {
    color: #00ff00;
    font-size: 16px;
    font-weight: 600;
}

.ngc-position-info {
    margin: 8px 0 15px;
}

.ngc-position {
    color: #fff;
    font-size: 14px;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@media (max-width: 600px) {
    .ngc-all-leaderboards {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* ====================================
   CARRERA - SELECTOR DE COCHES v16
   ==================================== */

.ngc-car-selector {
    text-align: center;
    padding: 20px;
}

.ngc-car-selector h3 {
    color: #fff;
    margin: 0 0 20px 0;
    font-size: 20px;
}

.ngc-car-preview {
    margin: 0 auto 10px;
    width: 100px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ngc-car-name {
    color: #fff;
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
}

.ngc-car-nav {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 20px;
}

.ngc-car-nav-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid #E10600;
    background: transparent;
    color: #E10600;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
}

.ngc-car-nav-btn:hover {
    background: #E10600;
    color: #fff;
}

.ngc-start-race {
    padding: 15px 40px;
    font-size: 18px;
}

/* Botones de control (pausa, fullscreen) */
.ngc-game-controls {
    position: absolute;
    top: 35px;
    right: 5px;
    display: flex;
    gap: 5px;
    z-index: 100;
}

.ngc-ctrl-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ngc-ctrl-btn:hover {
    background: rgba(225, 6, 0, 0.8);
}

.ngc-carrera-wrapper {
    position: relative;
    display: inline-block;
}

.ngc-carrera-wrapper:fullscreen,
.ngc-carrera-wrapper:-webkit-full-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.ngc-carrera-wrapper:fullscreen canvas,
.ngc-carrera-wrapper:-webkit-full-screen canvas {
    max-height: 100vh;
    width: auto !important;
    height: auto !important;
    max-width: 100vw;
}

.ngc-carrera-wrapper:fullscreen .ngc-game-controls,
.ngc-carrera-wrapper:-webkit-full-screen .ngc-game-controls {
    position: fixed;
    top: 10px;
    right: 10px;
}

/* Pseudo-fullscreen para móvil (iOS y otros sin soporte) */
.ngc-carrera-wrapper.ngc-pseudo-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    background: #000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.ngc-carrera-wrapper.ngc-pseudo-fullscreen canvas {
    max-height: 90vh !important;
    max-width: 95vw !important;
    width: auto !important;
    height: auto !important;
}

.ngc-carrera-wrapper.ngc-pseudo-fullscreen .ngc-game-controls {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 100000;
}

/* Overlay de pausa */
.ngc-pause-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.ngc-pause-content {
    background: #1a1a1a;
    border-radius: 16px;
    padding: 30px 40px;
    text-align: center;
    border: 2px solid #333;
}

.ngc-pause-content h3 {
    color: #fff;
    font-size: 28px;
    margin: 0 0 25px 0;
}

.ngc-pause-content button {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    padding: 12px 30px;
}

/* ====================================
   PARKING - JOYSTICK PS v16
   ==================================== */

.ngc-ps-joystick-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 15px;
}

.ngc-ps-joystick-container canvas {
    touch-action: none;
    cursor: pointer;
}

.ngc-ps-joystick-container .ngc-control-label {
    color: #888;
    font-size: 12px;
    margin-top: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Ocultar controles antiguos si existen */
.ngc-dual-controls {
    display: none !important;
}

/* Selector de coches - info de desbloqueo */
.ngc-car-unlock-info {
    margin-bottom: 15px;
    font-size: 14px;
    min-height: 20px;
}

.ngc-car-unlock-info .ngc-unlocked {
    color: #4CAF50;
}

.ngc-car-unlock-info .ngc-locked {
    color: #E10600;
    font-weight: bold;
}

.ngc-start-race.ngc-btn-disabled {
    background: #555 !important;
    cursor: not-allowed;
    opacity: 0.7;
}

.ngc-start-race.ngc-btn-disabled:hover {
    background: #555 !important;
}
