/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 0;
}

/* Layout principal con sticky footer */
.page-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

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

h1 {
    color: white;
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    color: rgba(255,255,255,0.9);
    font-size: 1.2em;
}

/* Área de juego */
.game-area {
    background: rgba(255,255,255,0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* Pirámide */
.pyramid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 20px;
    position: relative;
}

/* Triángulo de fondo sutil */
.pyramid::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 0;
    height: 0;
    margin: auto;
    border-left: 200px solid transparent;
    border-right: 200px solid transparent;
    border-bottom: 300px solid rgba(102, 126, 234, 0.15);
    z-index: -1;
    pointer-events: none;
}

/* Niveles de la pirámide */
.pyramid-level {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
}

/* Efecto visual de escalones */
.pyramid-level::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    height: 2px;
    background: linear-gradient(90deg, transparent, #ddd, transparent);
    z-index: -1;
}

.level-1::before { width: 90%; }
.level-2::before { width: 70%; }
.level-3::before { width: 50%; }
.level-4::before { display: none; }

/* Cajas de números */
.number-box {
    width: 60px;
    height: 60px;
    background: white;
    border: 3px solid #667eea;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.number-box.target {
    width: 80px;
    height: 80px;
    font-size: 2em;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    border-color: #ffa500;
    box-shadow: 0 6px 12px rgba(255,165,0,0.3);
    position: relative;
}

/* Corona eliminada para diseño más limpio */

.number-box.empty {
    background: #f5f5f5;
    border-style: dashed;
    color: #999;
    font-size: 1.2em;
}

.number-box.revealed {
    animation: reveal 0.5s ease;
    background: #e8f5e9;
    border-color: #4caf50;
}

/* Cajas de operaciones */
.operation-box {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px;
    background: rgba(255,255,255,0.8);
    border-radius: 8px;
}

/* Nuevas cajas de operaciones mejoradas */
.operation-box-new {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: rgba(255,255,255,0.9);
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.operation-box-new:hover {
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102,126,234,0.1);
}

.operation-text {
    font-size: 1em;
    font-weight: bold;
    color: #333;
    margin-bottom: 5px;
    text-align: center;
}

.number-input {
    width: 60px;
    height: 35px;
    border: 2px solid #ddd;
    border-radius: 5px;
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    padding: 5px;
    transition: all 0.3s ease;
}

.number-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.number-input.correct {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.number-input.incorrect {
    background: #ffebee;
    border-color: #f44336;
    animation: shake 0.5s;
}

.number-input.solution {
    background: #fff3e0;
    border-color: #ff9800;
    color: #e65100;
    font-weight: bold;
}

.operation-box input {
    width: 70px;
    height: 40px;
    border: 2px solid #ddd;
    border-radius: 5px;
    text-align: center;
    font-size: 1.1em;
    font-weight: bold;
    padding: 5px;
    transition: all 0.3s ease;
}

.operation-box input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1);
}

.operation-box input.correct {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.operation-box input.incorrect {
    background: #ffebee;
    border-color: #f44336;
    animation: shake 0.5s;
}

.operation-box input.solution {
    background: #fff3e0;
    border-color: #ff9800;
    color: #e65100;
    font-weight: bold;
}

.operator {
    font-size: 1.3em;
    font-weight: bold;
    color: #666;
}

/* Controles */
.controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 30px 0;
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 25px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.btn-secondary {
    background: white;
    color: #667eea;
    border: 2px solid #667eea;
}

.btn-warning {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

/* Panel de información */
.info-panel {
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 20px;
    background: rgba(102,126,234,0.1);
    border-radius: 15px;
    margin-top: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.info-label {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 5px;
}

.info-value {
    font-size: 1.8em;
    font-weight: bold;
    color: #764ba2;
}

/* Área de mensajes */
.message-area {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.message {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    margin-bottom: 10px;
    animation: slideIn 0.3s ease;
}

.message.success {
    border-left: 4px solid #4caf50;
}

.message.error {
    border-left: 4px solid #f44336;
}

.message.hint {
    border-left: 4px solid #ffa500;
}

/* Animaciones */
@keyframes reveal {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Temporizador */
.timer-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.timer-circle {
    position: relative;
    width: 80px;
    height: 80px;
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
}

.timer-text span {
    font-size: 1.5em;
    font-weight: bold;
    color: #333;
    display: block;
}

.timer-text small {
    font-size: 0.7em;
    color: #666;
    margin-top: -5px;
}

.timer-svg {
    position: absolute;
    top: 0;
    left: 0;
}

.timer-svg circle {
    transition: stroke 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    .game-area {
        padding: 20px;
    }

    .number-box {
        width: 50px;
        height: 50px;
        font-size: 1.2em;
    }

    .number-box.target {
        width: 70px;
        height: 70px;
        font-size: 1.6em;
    }

    .operation-box input {
        width: 60px;
        height: 35px;
        font-size: 1em;
    }

    .operation-box-new {
        padding: 8px;
        gap: 6px;
    }

    .operation-text {
        font-size: 0.9em;
    }

    .number-input {
        width: 50px;
        height: 30px;
        font-size: 1em;
    }

    .controls {
        flex-wrap: wrap;
    }

    .info-panel {
        gap: 20px;
    }

    .timer-circle {
        width: 60px;
        height: 60px;
    }

    .timer-svg {
        width: 60px;
        height: 60px;
    }

    .timer-text span {
        font-size: 1.2em;
    }

    .pyramid::before {
        border-left-width: 150px;
        border-right-width: 150px;
        border-bottom-width: 220px;
    }
}