/* === PALETA DOPAMINÉRGICA === */
:root {
    --bg-dark: #111230;
    --bg-card: rgba(22, 18, 60, 0.92);
    --neon-pink: #ff1a6e;
    --neon-cyan: #00eeff;
    --neon-yellow: #ffe000;
    --neon-green: #39ff14;
    --neon-purple: #cc44ff;
    --accent: #00eeff;
    --primary-text: #f0f0ff;
    --bean-color: #ff1a6e;
}

/* === FONDO ANIMADO === */
body {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    background: var(--bg-dark);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    color: var(--primary-text);
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
}

/* Gradiente animado en fondo */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(180, 74, 255, 0.25) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 70%, rgba(0, 245, 255, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 45, 120, 0.1) 0%, transparent 60%);
    animation: bgPulse 6s ease-in-out infinite alternate;
    z-index: 0;
    pointer-events: none;
}

@keyframes bgPulse {
    0% {
        opacity: 0.7;
        transform: scale(1);
    }

    100% {
        opacity: 1;
        transform: scale(1.05);
    }
}

/* === LAYOUT === */
.main-container {
    text-align: center;
    width: 90%;
    max-width: 900px;
    position: relative;
    z-index: 10;
    padding: 1rem 0 3rem 0;
}

header {
    padding: 2rem 0 1rem;
}

/* === TITLE === */
h1 {
    font-weight: 700;
    font-size: 2.4rem;
    margin-bottom: 0.3rem;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink), var(--neon-yellow));
    background-size: 200%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: textShimmer 3s linear infinite;
}

@keyframes textShimmer {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 200% 50%;
    }
}

header p {
    color: rgba(200, 200, 255, 0.6);
    font-size: 1rem;
    margin: 0;
}

/* === JARS === */
.jars-container {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 2.5rem 0;
    align-items: flex-end;
    flex-wrap: wrap;
}

.jar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.bean-count {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-purple));
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: countPop 0.3s ease;
    margin: 0 auto;
}

@keyframes countPop {
    0% {
        transform: scale(1.4);
    }

    100% {
        transform: scale(1);
    }
}

/* Jar Styling con Imagen */
.jar {
    width: 130px;
    height: 180px;
    background-image: url('jar.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center bottom;
    position: relative;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    padding: 8px 18px 22px 18px;
    gap: 2px;
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.3s ease;
    background-color: transparent;
    border: none;
    box-shadow: none;
    mix-blend-mode: normal;
    filter: drop-shadow(0 0 8px rgba(0, 245, 255, 0.2));
}

.jar.selected {
    filter: drop-shadow(0 0 20px var(--neon-cyan)) drop-shadow(0 0 40px var(--neon-cyan));
    transform: scale(1.08) translateY(-6px);
}

.jar:hover:not(.selected) {
    transform: translateY(-8px);
    filter: drop-shadow(0 0 12px rgba(180, 74, 255, 0.5));
}

/* === BEANS === */
.bean {
    width: 34px;
    height: 18px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

.bean:hover {
    transform: scale(1.18) rotate(-5deg);
    filter: brightness(1.2);
}

.bean.marked-for-removal {
    opacity: 0.35;
    filter: grayscale(80%);
    animation: pulse 0.8s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.6;
        transform: scaleX(1);
    }

    50% {
        opacity: 1;
    }
}

.input-warning {
    color: #ff3366;
    font-size: 0.95rem;
    font-weight: 700;
    margin-top: 0.5rem;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* === STATUS & CONTROLS === */
.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    margin-top: 1.5rem;
}

.status-message {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.5rem 1.2rem;
    animation: statusFade 0.4s ease;
    letter-spacing: 0.05em;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes statusFade {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === BUTTONS === */
button {
    padding: 13px 32px;
    font-size: 1.1rem;
    font-family: inherit;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
    color: #000;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow:
        0 0 15px rgba(0, 245, 255, 0.4),
        0 4px 20px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.03em;
}

button:hover {
    transform: translateY(-3px) scale(1.04);
    box-shadow:
        0 0 25px rgba(0, 245, 255, 0.7),
        0 0 50px rgba(180, 74, 255, 0.3),
        0 6px 25px rgba(0, 0, 0, 0.3);
}

button:active {
    transform: translateY(0) scale(0.98);
}

button:disabled {
    background: rgba(80, 80, 100, 0.4);
    color: rgba(200, 200, 255, 0.3);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* === UTILITY === */
.hidden {
    display: none !important;
}

/* === SETUP SCREEN === */
.setup-screen {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    padding: 2.5rem;
    border-radius: 20px;
    margin-top: 1.5rem;
    border: 1px solid rgba(0, 238, 255, 0.3);
    box-shadow:
        0 0 40px rgba(0, 238, 255, 0.12),
        0 0 80px rgba(180, 74, 255, 0.08),
        inset 0 0 30px rgba(180, 74, 255, 0.06);
}

.setup-screen h2 {
    color: var(--neon-cyan);
    margin-top: 0;
}

.setup-screen p {
    color: rgba(200, 200, 255, 0.65);
}

.setup-inputs {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.input-group label {
    font-weight: 600;
    color: var(--neon-purple);
    text-shadow: 0 0 8px var(--neon-purple);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.input-group input {
    width: 65px;
    padding: 10px;
    font-size: 1.6rem;
    text-align: center;
    border: 2px solid rgba(0, 245, 255, 0.3);
    border-radius: 12px;
    background: rgba(0, 0, 30, 0.6);
    font-family: inherit;
    color: var(--neon-yellow);
    font-weight: 700;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.3);
}

/* === TURN SELECTOR === */
.turn-selector {
    margin-bottom: 2rem;
}

.turn-selector p {
    font-weight: 600;
    margin-bottom: 1rem;
    color: rgba(200, 200, 255, 0.8);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.9rem;
}

.radio-group {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.radio-label {
    cursor: pointer;
    position: relative;
}

.radio-label input {
    display: none;
}

.radio-custom {
    display: block;
    padding: 10px 24px;
    background: rgba(0, 0, 30, 0.5);
    border: 2px solid rgba(180, 74, 255, 0.3);
    border-radius: 50px;
    transition: all 0.25s;
    font-weight: 600;
    color: rgba(200, 200, 255, 0.6);
}

.radio-label input:checked+.radio-custom {
    background: linear-gradient(135deg, rgba(180, 74, 255, 0.3), rgba(0, 245, 255, 0.2));
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.3);
}

.radio-label:hover .radio-custom {
    transform: translateY(-2px);
    border-color: rgba(180, 74, 255, 0.6);
}

/* === LOGO === */
.game-logo {
    max-width: 200px;
    height: auto;
    margin-bottom: 1rem;
    filter: brightness(1.1) drop-shadow(0 0 10px rgba(0, 245, 255, 0.3));
}

/* === GAME AREA === */
.game-area {
    background: var(--bg-card);
    backdrop-filter: blur(14px);
    border-radius: 20px;
    border: 1px solid rgba(0, 238, 255, 0.25);
    padding: 2rem 2rem 1.5rem;
    margin-top: 1.5rem;
    box-shadow: 0 0 30px rgba(0, 238, 255, 0.07), 0 0 60px rgba(204, 68, 255, 0.05);
}

/* Botones inferiores siempre visibles */
.bottom-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    flex-wrap: wrap;
}

.btn-config {
    background: rgba(255, 255, 255, 0.06) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    color: rgba(200, 200, 255, 0.75) !important;
    box-shadow: none !important;
    font-size: 0.9rem !important;
    padding: 9px 20px !important;
}

.btn-config:hover {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #fff !important;
    transform: translateY(-2px) !important;
    box-shadow: none !important;
}

.btn-restart {
    font-size: 1rem !important;
    padding: 9px 24px !important;
}

/* === INFO BUTTON === */
.btn-info {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(0, 245, 255, 0.5);
    color: var(--neon-cyan);
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 245, 255, 0.2);
    padding: 0;
    transition: all 0.2s ease;
    z-index: 100;
}

.btn-info:hover {
    background: rgba(0, 245, 255, 0.2);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(0, 245, 255, 0.5);
}

/* Logo link: quitar subrayado y borde */
header a {
    display: inline-block;
    text-decoration: none;
    border: none;
    outline: none;
    background: transparent;
    border-radius: 12px;
    padding: 4px 12px;
    margin-bottom: 10px;
    transition: all 0.25s;
}

header a:hover {
    transform: scale(1.05);
}

header a:hover .game-logo {
    filter: none;
}

/* === MODAL === */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 10, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(8px);
}

.modal-content {
    background: rgba(15, 5, 40, 0.95);
    border: 1px solid rgba(0, 245, 255, 0.3);
    padding: 3rem 2.5rem;
    border-radius: 24px;
    text-align: center;
    max-width: 90%;
    width: 420px;
    box-shadow:
        0 0 40px rgba(0, 245, 255, 0.2),
        0 0 80px rgba(180, 74, 255, 0.15),
        0 20px 40px rgba(0, 0, 0, 0.5);
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        transform: scale(0.5);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-img {
    width: 160px;
    height: auto;
    margin: 1.5rem auto;
    display: block;
    filter: drop-shadow(0 0 20px rgba(255, 45, 120, 0.5));
    animation: imgBounce 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.2s both;
}

@keyframes imgBounce {
    from {
        transform: scale(0) rotate(-20deg);
    }

    to {
        transform: scale(1) rotate(0deg);
    }
}

.modal h2 {
    font-size: 2rem;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-pink));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.modal p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: rgba(200, 200, 255, 0.7);
}

.modal-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.btn-share {
    background: linear-gradient(135deg, #00c853, #69f0ae) !important;
    color: #003d1a !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 15px rgba(0, 200, 83, 0.35) !important;
}

.btn-share:hover {
    box-shadow: 0 6px 24px rgba(0, 200, 83, 0.55) !important;
}

.btn-outline {
    background: transparent !important;
    border: 2px solid rgba(180, 74, 255, 0.5) !important;
    color: var(--neon-purple) !important;
    box-shadow: none !important;
}

.btn-outline:hover {
    background: rgba(180, 74, 255, 0.15) !important;
}

/* Second button in modal: outlined style */
.modal-buttons button:last-child {
    background: transparent;
    border: 2px solid rgba(180, 74, 255, 0.5);
    color: var(--neon-purple);
    box-shadow: none;
}

.modal-buttons button:last-child:hover {
    background: rgba(180, 74, 255, 0.15);
    box-shadow: 0 0 15px rgba(180, 74, 255, 0.4);
}

/* === INSTRUCTIONS TEXT === */
.instructions-content {
    text-align: left;
}

.instructions-content h2 {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.inst-text {
    font-size: 1.05rem;
    color: rgba(200, 200, 255, 0.9);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.inst-text p {
    color: rgba(200, 200, 255, 0.9);
    margin-bottom: 1rem;
    font-size: 1.05rem;
}

.inst-text ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.inst-text li {
    margin-bottom: 0.5rem;
}

.inst-text strong {
    color: var(--neon-pink);
}

/* === HAND === */
.opponent-hand {
    position: fixed;
    top: -500px;
    right: 15%;
    width: 160px;
    z-index: 100;
    pointer-events: none;
    transition: transform 1s cubic-bezier(0.25, 1, 0.5, 1);
    transform-origin: top center;
    overflow: visible;
}

/* Animación de dedos: abrir y cerrar */
@keyframes fingerWiggle {
    0% {
        transform: rotate(0deg);
    }

    40% {
        transform: rotate(18deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

.opponent-hand.hand-moving .h-tip {
    animation: fingerWiggle 0.45s ease-in-out infinite;
}

/* Stagger entre dedos para efecto ondulado */
.opponent-hand.hand-moving #hf1 .h-tip {
    animation-delay: 0.00s;
}

.opponent-hand.hand-moving #hf2 .h-tip {
    animation-delay: 0.08s;
}

.opponent-hand.hand-moving #hf3 .h-tip {
    animation-delay: 0.16s;
}

.opponent-hand.hand-moving #hf4 .h-tip {
    animation-delay: 0.24s;
}

/* === SOUND CONTROLS === */
.sound-control-wrapper {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    background: rgba(10, 20, 30, 0.4);
    border: 2px solid rgba(0, 245, 255, 0.5);
    border-radius: 40px;
    padding: 0;
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 0 10px rgba(0, 245, 255, 0.2);
    overflow: hidden;
}

.sound-control-wrapper:hover {
    box-shadow: 0 0 15px rgba(0, 245, 255, 0.4);
    background: rgba(0, 245, 255, 0.1);
}

.btn-sound {
    position: static;
    margin: 0;
    border: none;
    box-shadow: none;
    background: transparent;
}

.btn-sound:hover {
    transform: none;
    background: transparent;
}

.volume-slider-container {
    width: 0;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    align-items: center;
}

.sound-control-wrapper:hover .volume-slider-container {
    width: 90px;
    opacity: 1;
    padding-right: 15px;
}

#volume-slider {
    width: 100%;
    cursor: pointer;
    accent-color: var(--neon-cyan);
}

/* === SPLASH SCREEN === */
.splash-overlay {
    display: flex;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(15, 20, 30, 0.95) 0%, rgba(5, 5, 10, 0.98) 100%);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    transition: opacity 0.8s ease-in-out, visibility 0.8s ease-in-out;
}

.splash-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.splash-logo {
    max-width: 350px;
    width: 80vw;
    height: auto;
    filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.6)) drop-shadow(0 0 30px rgba(0, 245, 255, 0.4));
    animation: logoCrash 1.2s cubic-bezier(0.1, 0.9, 0.2, 1.5) forwards, glowingPulse 2s infinite alternate ease-in-out;
    transform: scale(0);
}

.splash-logo.fade-out {
    animation: logoFadeOut 0.5s ease-in forwards;
}

@keyframes logoCrash {
    0% {
        transform: scale(0) translateY(100px);
        opacity: 0;
    }

    60% {
        transform: scale(1.4);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes glowingPulse {
    0% {
        filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.5)) drop-shadow(0 0 30px rgba(0, 245, 255, 0.6)) brightness(1.1);
    }

    100% {
        filter: drop-shadow(0 0 30px rgba(255, 255, 255, 0.9)) drop-shadow(0 0 60px rgba(0, 245, 255, 0.9)) drop-shadow(0 0 40px rgba(180, 74, 255, 0.6)) brightness(1.3);
    }
}

@keyframes logoFadeOut {
    to {
        transform: scale(0.8);
        opacity: 0;
        visibility: hidden;
    }
}

.main-container.hidden-during-splash {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.8s ease-in-out;
}

/* === MOBILE === */
@media (max-width: 768px) {
    h1 {
        font-size: 1.6rem;
    }

    .jars-container {
        gap: 0.2rem;
        margin: 1.5rem 0;
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.5rem;
        justify-content: center;
    }

    .jar {
        width: 75px;
        height: 110px;
        padding: 5px 5px 10px 5px;
        flex-shrink: 0;
    }

    .bean {
        width: 22px;
        height: 11px;
    }

    .bean-count {
        font-size: 1.3rem;
    }

    .game-logo {
        max-width: 140px;
    }

    .setup-inputs {
        gap: 1.2rem;
    }

    .opponent-hand {
        width: 130px;
    }
}