:root {
    --primary-color: #ffcc00;
    --secondary-color: #ff6600;
    --bg-dark: #121212;
    --pizza-base: #8b0000; /* Rojo oscuro */
    --text-light: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: hidden;
    overflow-y: auto;
}

#game-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* Pantallas */
.landing-screen, .game-screen, .flavors-screen {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    z-index: 10;
    width: 100%;
}

.landing-screen.active, .game-screen.active, .flavors-screen.active {
    display: flex;
}

.landing-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    z-index: -1;
    pointer-events: none;
    filter: brightness(0.4) saturate(1.2) contrast(1.2); /* Efecto remasterizado y oscuro para resaltar el texto */
}

.landing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    z-index: 2;
    position: relative;
    padding: 3rem;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 204, 0, 0.2);
}

.title {
    font-size: 5rem;
    font-weight: 800;
    text-transform: uppercase;
    background: linear-gradient(to bottom, #fff, var(--primary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 10px 30px rgba(0,0,0,0.5);
    margin-bottom: 2rem;
}

.start-btn {
    padding: 1.5rem 4rem;
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--primary-color);
    color: #000;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(255, 204, 0, 0.3);
}

.start-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(255, 204, 0, 0.5);
}

/* Pizza Wrapper Adaptativo */
.pizza-wrapper {
    width: 400px;
    height: 400px;
    max-width: min(85vw, 450px);
    max-height: min(85vw, 450px);
    aspect-ratio: 1 / 1;
    position: relative;
    animation: gentle-pulse 4s infinite ease-in-out;
    margin: 0 auto;
}

.pizza-base {
    width: 100%;
    height: 100%;
    background-color: #a50000; /* Rojo Pasión Sólido */
    border-radius: 50%;
    box-shadow: 0 0 50px rgba(139, 0, 0, 0.3), 
                inset 0 0 40px rgba(0, 0, 0, 0.4);
    border: 12px solid #c2ad88;
    position: relative;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.pizza-base.golden-border {
    border-color: #ffcc00; /* Amarillo dorado suave */
    box-shadow: 0 0 30px rgba(255, 204, 0, 0.3), 
                inset 0 0 40px rgba(0, 0, 0, 0.4);
}

@keyframes gentle-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

.pizza-slices-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.pizza-wedge {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #fff9e6 0%, #f7e38d 100%); /* Efecto de queso fundido */
    box-shadow: inset 0 0 15px rgba(255, 204, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
    /* Recortar todo el contenido al área de la cuña */
    -webkit-mask-image: var(--mask);
    mask-image: var(--mask);
}

.pizza-wedge.filled {
    opacity: 1;
}

.topping-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

/* Jamón (Cuadritos rosados) */
.ham-cube {
    position: absolute;
    width: 14px;
    height: 14px;
    background-color: #ff9999; /* Rosado jamón más vívido */
    border-radius: 0;
}

/* Chorizo (Círculos marroncitos) */
.chorizo-slice {
    position: absolute;
    width: 15px;
    height: 15px;
    background-color: #8d4925; /* Marrón rojizo carne */
    border-radius: 50%;
    box-shadow: inset -1px -1px 2px rgba(0,0,0,0.4);
}

/* Maíz (Puntitos amarillos) */
.corn-kernel {
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: #ffcc00; /* Amarillo maíz */
    border-radius: 2px;
    box-shadow: 1px 1px 1px rgba(0,0,0,0.1);
}

/* Carbonara (Palitos de tocineta) */
.bacon-strip {
    position: absolute;
    width: 20px;
    height: 5px;
    background-color: #63331d; /* Marrón carne oscuro */
    border-radius: 2px;
    box-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

/* Napolitana (Puntos negros/hierbas) */
.napolitana-dot {
    position: absolute;
    background-color: #000000;
    border-radius: 50%;
    pointer-events: none;
}

/* Pepperoni (Rodajas rojas) */
.pepperoni-slice {
    position: absolute;
    width: 28px;
    height: 28px;
    background-color: #b02100; /* Rojo pepperoni profundo */
    border-radius: 50%;
    box-shadow: inset -2px -2px 4px rgba(0,0,0,0.4),
                1px 1px 2px rgba(0,0,0,0.2);
    border: 1px solid #8a1a00;
}

/* Tropical (Cerezas - Círculos rojo claro) */
.cherry-topping {
    position: absolute;
    width: 12px;
    height: 12px;
    background-color: #ff0000; /* Rojo brillante / Cereza */
    border-radius: 50%;
    box-shadow: inset -1px -1px 3px rgba(0,0,0,0.3),
                0 0 5px rgba(255, 0, 0, 0.4);
}

/* Tentación (Chocolate fundido) */
.chocolate-drizzle {
    position: absolute;
    width: 45px;
    height: 4px;
    background: linear-gradient(to right, #5d2e06, #7b3f00, #5d2e06); /* Café chocolate brillante */
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.6), 0 0 4px rgba(123, 63, 0, 0.4);
    opacity: 1;
    z-index: 5;
}

/* Tentación (Frutas) */
.strawberry {
    position: absolute;
    width: 18px;
    height: 18px;
    background-color: #ff3333;
    clip-path: polygon(50% 0%, 100% 40%, 80% 100%, 20% 100%, 0% 40%); /* Forma de fresa */
    box-shadow: inset -2px -2px 4px rgba(0,0,0,0.3);
    z-index: 3;
}

.banana-slice {
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: #fff9e6;
    border: 2px solid #f2e6b1;
    border-radius: 50%;
    box-shadow: inset 0 0 5px rgba(0,0,0,0.1);
    z-index: 3;
}

.banana-slice::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 4px;
    background-color: #d9c585;
    border-radius: 50%;
}



/* Opciones de Porciones */
.options-container {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
}

.option-btn {
    position: absolute;
    width: 70px;
    height: 70px;
    background: var(--glass-bg);
    border: 2px solid var(--glass-border);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 700;
    pointer-events: auto;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
}

.option-btn:hover {
    background: var(--primary-color);
    color: #000;
    transform: scale(1.2);
    border-color: var(--primary-color);
}

.option-btn.active {
    background: var(--primary-color);
    color: #000;
    transform: scale(1.2);
    box-shadow: 0 0 30px rgba(255, 204, 0, 0.5);
}

/* Botones de Tipo de Orden */
.type-btn {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    background: var(--glass-bg);
    color: white;
    border: 2px solid var(--glass-border);
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.type-btn:hover {
    background: rgba(255, 204, 0, 0.2);
    border-color: var(--primary-color);
}
.type-btn.active {
    background: var(--primary-color);
    color: #000;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.5);
    transform: scale(1.05);
}

/* Posiciones de los nuevos botones de tamaño */
.btn-familiar { top: 15%; left: 10%; width: 100px; height: 100px; }
.btn-medium { top: 45%; left: 10%; width: 90px; height: 90px; }
.btn-junior { bottom: 15%; left: 10%; width: 80px; height: 80px; }

.ready-btn {
    padding: 1rem 3rem;
    font-size: 1.3rem;
    font-weight: 800;
    background: var(--primary-color);
    color: #000;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s ease;
    margin-top: 1rem;
}

.ready-btn.show {
    opacity: 1;
    pointer-events: auto;
}

/* Pantalla de Sabores */
.flavors-screen {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    height: 100vh;
    padding: 2rem;
    z-index: 20;
    overflow-y: auto;
}

.flavors-layout {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 4rem;
    width: 100%;
    flex: 1;
}

.pizza-preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
}

.flavor-rule {
    background: #e63946;
    border: 2px solid #ff6b6b;
    color: #ffffff;
    padding: 0.7rem 2rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
    box-shadow: 0 0 20px rgba(230, 57, 70, 0.6), 0 4px 10px rgba(0,0,0,0.3);
    animation: pulse-rule 1.5s infinite;
}

@keyframes pulse-rule {
    0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(230, 57, 70, 0.6); }
    50% { transform: scale(1.06); box-shadow: 0 0 35px rgba(230, 57, 70, 0.9); }
}

.flavors-selection {
    flex: 1.5;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.subtitle {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    text-transform: uppercase;
    font-weight: 800;
}

.flavors-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem;
}

/* Tarjeta de Sabor con Contador */
.flavor-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.flavor-info {
    flex: 1;
}

.flavor-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.counter-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 1px solid var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}

.counter-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: #000;
}

.counter-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.1);
}

.flavor-count {
    font-size: 1.5rem;
    font-weight: 800;
    min-width: 30px;
    text-align: center;
    color: var(--primary-color);
}

/* Resumen de Porciones */
.portions-summary {
    background: rgba(255, 179, 0, 0.1);
    border: 1px solid var(--primary-color);
    border-radius: 10px;
    padding: 0.8rem 2rem;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
}

.remaining-count {
    color: var(--primary-color);
    font-weight: 800;
}

.flavor-name {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.special-note {
    color: #ff4d4d;
    font-size: 0.75rem;
    font-weight: 400;
    font-style: italic;
    background: rgba(255, 77, 77, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 77, 77, 0.2);
}

.flavor-desc {
    font-size: 0.8rem;
    opacity: 0.8;
}

.flavors-footer {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
    padding-bottom: 2rem;
}

.back-btn {
    padding: 1rem 2.5rem;
    background: transparent;
    border: 2px solid var(--glass-border);
    color: white;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

@media (max-width: 900px) {
    .flavors-layout {
        flex-direction: column;
        gap: 2rem;
    }
    .pizza-preview-container .pizza-wrapper {
        width: 200px;
        height: 200px;
    }
}

.slice-line {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 2px rgba(0, 0, 0, 0.2);
    transform-origin: center;
    transition: width 0.4s ease-out;
}


/* Nuevos Contenedores de Opciones */
.options-container, .slice-options-container {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    z-index: 100;
}

.slice-options-container {
    margin-top: 1rem;
    min-height: 120px;
    align-items: center;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--primary-color);
    text-shadow: 0 4px 10px rgba(0,0,0,0.5);
    margin-bottom: 1rem;
}

/* Mexicana (Doritos) */
.dorito-chip {
    position: absolute;
    width: 16px;
    height: 16px;
    background-color: #ff8c00;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    box-shadow: 1px 1px 2px rgba(0,0,0,0.4);
    z-index: 4;
}

/* ========================================================
   CONTROLES Y SOPORTE DE CONSOLAS (PlayStation, Xbox, TV)
   ======================================================== */
.gamepad-badge {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(18, 18, 18, 0.92);
    border: 1px solid var(--primary-color);
    box-shadow: 0 0 25px rgba(255, 179, 0, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 50px;
    padding: 0.6rem 1.4rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    display: none;
    align-items: center;
    gap: 0.8rem;
    z-index: 9999;
    animation: fadeInBadge 0.5s ease-out;
}

.gamepad-badge.active {
    display: flex;
}

.gamepad-badge i {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.gamepad-badge .btn-hint {
    background: rgba(255, 255, 255, 0.15);
    padding: 2px 7px;
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--primary-color);
}

@keyframes fadeInBadge {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Foco para navegación con mando de PlayStation o teclado */
.gamepad-focused {
    outline: 3px solid var(--primary-color) !important;
    outline-offset: 4px !important;
    transform: scale(1.06) !important;
    box-shadow: 0 0 25px rgba(255, 179, 0, 0.8) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

/* ========================================================
   ADAPTABILIDAD UNIVERSAL (Estilo Flutter: Móviles, Tablets, TV)
   ======================================================== */
@media (max-width: 768px) {
    .title {
        font-size: clamp(2.2rem, 7vw, 3.5rem);
    }

    .landing-content {
        padding: 2rem 1.5rem;
        width: 90%;
        max-width: 400px;
    }

    .start-btn {
        padding: 1.2rem 2.5rem;
        font-size: 1.2rem;
        width: 100%;
        max-width: 300px;
    }

    .section-title {
        font-size: 1.8rem;
        text-align: center;
    }

    .options-container, .slice-options-container {
        gap: 0.8rem;
    }

    .order-type-buttons {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
    }

    .type-btn {
        flex: 1;
        min-width: 140px;
        padding: 0.8rem 1rem;
        font-size: 0.95rem;
    }

    /* En la pantalla de sabores, apilar pizza arriba compacta y sabores abajo */
    .flavors-layout {
        flex-direction: column;
        gap: 1.2rem;
        width: 100%;
    }

    .pizza-preview-container {
        position: sticky;
        top: 70px;
        background: rgba(18, 18, 18, 0.85);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        padding: 0.5rem 0;
        z-index: 15;
        border-radius: 16px;
        width: 100%;
        gap: 0.8rem;
    }

    .flavor-rule {
        font-size: 0.85rem;
        padding: 0.4rem 1.2rem;
        letter-spacing: 1.5px;
    }

    .pizza-preview-container .pizza-wrapper {
        width: 170px !important;
        height: 170px !important;
    }

    .flavors-selection {
        width: 100%;
        flex: unset;
    }

    .flavors-grid {
        max-height: none;
        padding: 0.5rem;
        gap: 0.8rem;
    }

    .flavor-card {
        padding: 0.8rem 1rem;
    }

    /* Botones táctiles cómodos para los dedos (mínimo 40px) */
    .counter-btn {
        width: 42px;
        height: 42px;
        font-size: 1.4rem;
    }

    .flavors-footer {
        flex-direction: row;
        width: 100%;
        gap: 1rem;
        justify-content: center;
    }

    .back-btn, .ready-btn {
        flex: 1;
        max-width: 200px;
        text-align: center;
        padding: 0.9rem 1rem;
        font-size: 0.95rem;
    }
}

@media (max-width: 420px) {
    .pizza-preview-container .pizza-wrapper {
        width: 150px !important;
        height: 150px !important;
    }

    .gamepad-badge {
        bottom: 10px;
        right: 10px;
        left: 10px;
        justify-content: center;
        font-size: 0.75rem;
    }
}
