/* Reset y configuración base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#app {
    width: 100%;
    max-width: 500px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    min-height: 90vh;
    display: flex;
    flex-direction: column;
}

/* HEADER - Igual que tu app Android */
.header {
    background: linear-gradient(135deg, #6A0DAD 0%, #8A2BE2 100%);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    box-shadow: 0 4px 12px rgba(106, 13, 173, 0.3);
}

.logo {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    margin-right: 20px;
    border: 3px solid white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    object-fit: contain;
    background-color: white;
}

.stats {
    flex: 1;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.stat {
    text-align: center;
    color: white;
}

.stat-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 2px;
}

.stat-label {
    font-size: 12px;
    opacity: 0.9;
}

/* CONTENIDO PRINCIPAL */
.content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.screen {
    display: none;
    animation: fadeIn 0.5s ease;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* PANTALLA DE BIENVENIDA */
.welcome-title {
    color: #333;
    text-align: center;
    font-size: 28px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #6A0DAD, #8A2BE2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-subtitle {
    color: #666;
    text-align: center;
    font-size: 16px;
    margin-bottom: 30px;
}

.instructions {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    border: 2px solid #e9ecef;
}

.instruction-item {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    font-size: 16px;
    color: #333;
}

.instruction-item:last-child {
    margin-bottom: 0;
}

.instruction-icon {
    font-size: 24px;
    margin-right: 15px;
    width: 40px;
    text-align: center;
}

.button-primary {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #6A0DAD 0%, #8A2BE2 100%);
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 15px;
    box-shadow: 0 6px 20px rgba(106, 13, 173, 0.3);
}

.button-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(106, 13, 173, 0.4);
}

.button-primary:active {
    transform: translateY(0);
}

.install-hint {
    background: #e3f2fd;
    border-radius: 10px;
    padding: 15px;
    margin-top: 20px;
    border-left: 4px solid #2196f3;
    font-size: 14px;
}

.share-icon {
    background: #333;
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
}

/* CONTENEDOR DE IMAGEN ADAPTABLE */
.image-container {
    width: 100%;
    height: 220px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
    background-color: #f8f9fa;
    border-radius: 12px;
    overflow: hidden;
    border: 2px dashed #dee2e6;
}

/* IMAGEN DE PREGUNTA ADAPTABLE */
.question-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

/* PANTALLA DE PREGUNTAS */
.question-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    font-size: 14px;
    color: #666;
}

.question-text {
    font-size: 18px;
    line-height: 1.5;
    color: #333;
    margin-bottom: 25px;
    font-weight: 600;
    text-align: center;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option {
    padding: 16px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    text-align: left;
    font-size: 16px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
}

.option:hover {
    border-color: #6A0DAD;
    background: #f9f0ff;
}

.option-letter {
    background: #6A0DAD;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-weight: bold;
    flex-shrink: 0;
}

.option.correct {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.option.correct .option-letter {
    background: #28a745;
}

.option.incorrect {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.option.incorrect .option-letter {
    background: #dc3545;
}

.option.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.feedback {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-weight: bold;
    animation: slideIn 0.5s ease;
}

.feedback.correct {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.feedback.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* PANTALLA DE RESULTADOS */
.result-icon {
    font-size: 80px;
    text-align: center;
    margin-bottom: 20px;
}

.result-title {
    text-align: center;
    color: #333;
    font-size: 28px;
    margin-bottom: 30px;
}

.result-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 15px;
}

.result-stat {
    text-align: center;
}

.result-stat-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 5px;
}

.result-stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #6A0DAD;
}

.result-message {
    background: #f0f8ff;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    margin-bottom: 20px;
    border-left: 4px solid #6A0DAD;
}

.button-secondary {
    width: 100%;
    padding: 16px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 15px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 10px;
}

.button-secondary:hover {
    background: #5a6268;
}

/* PIE DE PÁGINA */
.footer {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.progress-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: linear-gradient(135deg, #6A0DAD 0%, #8A2BE2 100%);
    width: 0%;
    transition: width 0.5s ease;
}

/* Responsive para iPhone */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    #app {
        min-height: 95vh;
        border-radius: 15px;
    }
    
    .header {
        padding: 12px 15px;
    }
    
    .logo {
        width: 50px;
        height: 50px;
    }
    
    .stat-value {
        font-size: 20px;
    }
    
    .content {
        padding: 15px;
    }
    
    .image-container {
        height: 180px;
    }
    
    .question-text {
        font-size: 16px;
    }
    
    .welcome-title {
        font-size: 24px;
    }
    
    .button-primary {
        padding: 16px;
        font-size: 16px;
    }
}

/* Modo pantalla completa (PWA) */
@media (display-mode: standalone) {
    body {
        padding: 0;
    }
    
    #app {
        border-radius: 0;
        min-height: 100vh;
        max-width: none;
    }
    
    .image-container {
        height: 240px;
    }
}

/* Ajustes para imágenes muy pequeñas o muy grandes */
@media (max-height: 700px) {
    .image-container {
        height: 180px;
    }
}

@media (max-height: 600px) {
    .image-container {
        height: 150px;
    }
    
    .question-text {
        font-size: 16px;
        margin-bottom: 15px;
    }
    
    .option {
        padding: 12px;
        font-size: 14px;
    }
}

/* Para cuando no hay imagen */
.no-image .image-container {
    display: none;
}

/* Estados de carga de imagen */
.image-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}