:root {
    --primary-color: #FF6B6B;
    --secondary-color: #4ECDC4;
    --dark-bg: #2C3E50;
    --light-text: #ECF0F1;
    --accent: #FFE66D;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Fredoka', sans-serif;
    touch-action: none;
    /* Prevenir zoom y scroll en móviles */
}

body {
    background-color: var(--dark-bg);
    color: var(--light-text);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    max-width: 800px;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--dark-bg);
    transition: opacity 0.3s ease;
    padding: 20px;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

.screen.active {
    opacity: 1;
    z-index: 10;
}

#game-screen {
    justify-content: flex-start;
}

h1 {
    font-size: 4rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 0px #000;
}

.subtitle {
    font-size: 1.2rem;
    margin-bottom: 3rem;
    color: var(--secondary-color);
}

.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s;
    width: 100%;
    max-width: 300px;
    margin: 10px 0;
    text-transform: uppercase;
}

.btn:active {
    transform: scale(0.95);
}

.btn.primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 0 #c0392b;
}

.btn.secondary {
    background-color: var(--secondary-color);
    color: white;
    box-shadow: 0 4px 0 #16a085;
}

.divider {
    margin: 20px 0;
    font-weight: bold;
    color: #95a5a6;
}

.join-container {
    width: 100%;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

input {
    padding: 15px;
    border-radius: 15px;
    border: 3px solid var(--secondary-color);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1.2rem;
    text-align: center;
    outline: none;
    text-transform: uppercase;
}

input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.code-box {
    font-size: 3rem;
    font-weight: bold;
    letter-spacing: 5px;
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0;
    color: var(--accent);
    border: 2px dashed var(--accent);
    min-width: 250px;
    text-align: center;
}

.code-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
}

.copy-btn {
    width: 60px;
    height: 60px;
    font-size: 1.8rem;
    background: var(--secondary-color);
    box-shadow: 0 4px 0 #16a085;
    border-radius: 15px;
    /* Cuadrado redondeado */
}

.copy-btn:hover {
    background: #48c9c0;
    transform: translateY(-2px);
}

.copy-btn:active {
    box-shadow: 0 2px 0 #16a085;
    transform: translateY(2px);
}

/* Game Styles */
/* Game Header Layout */
.game-top-bar {
    width: 100%;
    max-width: 800px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    position: relative;
    /* Para z-index */
    z-index: 100;
    /* Encima del overlay */
}

.score-container {
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 2rem;
    font-weight: bold;
    color: white;
}

.score-container .vs {
    font-size: 1rem;
    color: #95a5a6;
}

#score-left {
    color: var(--primary-color);
}

#score-right {
    color: var(--secondary-color);
}

.controls-container {
    display: flex;
    gap: 10px;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 12px;
    width: 45px;
    height: 45px;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.icon-btn.bad {
    background: rgba(231, 76, 60, 0.2);
}

.icon-btn.bad:hover {
    background: rgba(231, 76, 60, 0.4);
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 50;
    backdrop-filter: blur(5px);
}

.overlay h2 {
    font-size: 3rem;
    color: var(--accent);
}

.overlay.hidden {
    display: none;
}

#touch-zone {
    width: 100%;
    flex: 1;
    min-height: 20%;
    /* Reduced to give more space to game */
    background: rgba(255, 255, 255, 0.05);
    /* Visual feedback for the zone */
    display: flex;
    justify-content: center;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    touch-action: none;
    position: relative;
    z-index: 20;
}

.controls-hint {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.2rem;
    pointer-events: none;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.3;
    }

    50% {
        opacity: 0.8;
    }

    100% {
        opacity: 0.3;
    }
}

.footer-credit {
    margin-top: 40px;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 600;
    letter-spacing: 1px;
}

/* Landscape Mode Adjustments */
@media (orientation: landscape) and (max-height: 600px) {
    #touch-zone {
        display: none !important;
    }

    #game-screen {
        justify-content: center;
        /* Center canvas vertically */
        padding-bottom: 0;
    }

    .game-top-bar {
        position: absolute;
        /* Float header on top to save space */
        top: 0;
        left: 0;
        width: 100%;
        background: transparent;
        pointer-events: none;
        /* Let clicks pass through if needed */
        z-index: 100;
        padding-top: 10px;
        /* Fix top cutoff */
    }

    .game-top-bar .icon-btn,
    .game-top-bar .score-container {
        pointer-events: auto;
        /* Re-enable button clicks */
        background: rgba(0, 0, 0, 0.5);
        /* Add contrasts */
        padding: 4px 8px;
        /* Slightly smaller padding */
        border-radius: 8px;
        transform: scale(0.85);
        /* Slightly smaller scale */
        transform-origin: top center;
        /* Scale from top */
    }

    .controls-hint {
        display: none;
    }
}