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

:root {
    --primary: #FFD700;
    --bg: #121212;
    --card: #1e1e1e;
    --text: #ffffff;
    --selected: #2a9d8f;
    --danger: #ef476f;
    --text-light: #b0b0b0;
    --white: #ffffff;
    --shadow: 0 2px 10px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 20px rgba(0,0,0,0.5);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-image: url('/images/fondo_vertical%202.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
    padding-bottom: 100px; /* Espacio para el banner sticky */
    color: var(--text);
    background-color: var(--bg);
}

/* Contenedor Principal */
.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    background: var(--card);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    margin-top: 20px;
    margin-bottom: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Contenedor de Instrucciones Desplegable */
.instructions-container {
    max-width: 500px;
    margin: 0 auto 20px;
    padding: 0;
}

.instructions-toggle {
    width: 100%;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid var(--primary);
    border-radius: 15px;
    padding: 15px 20px;
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.instructions-toggle:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: #ffed4e;
}

.instructions-toggle.active {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-bottom: none;
}

.instructions-toggle-text {
    color: var(--primary);
}

.instructions-toggle-icon {
    color: var(--primary);
    font-size: 0.9rem;
    transition: transform 0.3s;
}

.instructions-toggle.active .instructions-toggle-icon {
    transform: rotate(180deg);
}

.instructions-content {
    background: rgba(0, 0, 0, 0.8);
    border-radius: 0 0 15px 15px;
    padding: 20px;
    border: 2px solid var(--primary);
    border-top: none;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }
    to {
        opacity: 1;
        max-height: 500px;
    }
}

.instructions-text {
    color: var(--primary);
    font-size: 0.95rem;
    line-height: 2;
    margin: 0;
    text-align: left;
}

.instructions-text strong {
    color: var(--primary);
    font-weight: 700;
    font-size: 1rem;
}

/* Pantallas */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

h1 {
    color: var(--primary);
    text-align: center;
    margin-bottom: 10px;
    font-size: 2rem;
}

h2 {
    color: var(--primary);
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

h3 {
    color: var(--text-dark);
    margin-bottom: 15px;
    font-size: 1.2rem;
}

.subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 30px;
    font-size: 0.9rem;
}

/* Inputs */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 500;
}

.input-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.input-group input {
    background: var(--bg);
    color: var(--text);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Botones */
.button-group {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background: var(--primary);
    color: var(--bg);
    font-weight: 600;
}

.btn-primary:hover {
    background: #ffed4e;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--selected);
    color: var(--white);
}

.btn-secondary:hover {
    background: #238a7d;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.85rem;
    background: var(--selected);
    color: var(--white);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    margin-top: 10px;
}

/* Divider */
.divider {
    text-align: center;
    margin: 30px 0;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: #e0e0e0;
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

.divider span {
    background: var(--white);
    padding: 0 15px;
    color: var(--text-light);
}

/* Código de Sala */
.room-code-display {
    text-align: center;
    margin: 30px 0;
    padding: 20px;
    background: var(--card);
    border: 2px solid var(--primary);
    border-radius: 15px;
    color: var(--white);
}

.room-code-display .label {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 10px;
}

.room-code-display h1 {
    font-size: 3rem;
    letter-spacing: 10px;
    color: var(--white);
    margin: 15px 0;
    font-weight: 700;
}

/* Lista de Jugadores */
.players-list {
    margin: 30px 0;
}

.players-list h3 {
    text-align: center;
    color: var(--text);
    margin-bottom: 15px;
}

#playersList {
    list-style: none;
    background: var(--bg);
    border-radius: 10px;
    padding: 15px;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#playersList li {
    padding: 12px;
    margin-bottom: 8px;
    background: var(--card);
    border-radius: 8px;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow);
    color: var(--text);
}

#playersList li:last-child {
    margin-bottom: 0;
}

#playersList li::before {
    content: '👤';
    margin-right: 10px;
    font-size: 1.2rem;
}

/* Selección de Grupo */
.group-selection {
    margin: 30px 0;
    padding: 20px;
    background: var(--bg);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.group-selection h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--text);
}

.group-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.group-btn {
    padding: 18px 20px;
    background: var(--card);
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: var(--text);
}

.group-btn strong {
    font-size: 1.1rem;
    color: var(--primary);
}

.group-btn span {
    font-size: 0.85rem;
    color: var(--text-light);
    font-style: italic;
}

.group-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.group-btn.selected {
    border-color: var(--primary);
    background: rgba(255, 215, 0, 0.1);
    box-shadow: var(--shadow);
}

.selected-group-display {
    margin-top: 20px;
    padding: 15px;
    background: var(--card);
    border-radius: 10px;
    text-align: center;
    border: 2px solid var(--primary);
}

.selected-group-display p {
    margin: 0;
    color: var(--text);
}

.selected-group-display strong {
    color: var(--primary);
    font-size: 1.1rem;
}

/* Vista de Juego */
.game-content {
    margin: 30px 0;
}

.location-word-container {
    width: 100%;
    margin: 40px auto;
    padding: clamp(20px, 5vw, 40px) clamp(15px, 4vw, 20px);
    background: var(--card);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    border: 4px solid var(--primary);
}

.location-word {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: clamp(4px, 1vw, 8px);
    min-height: clamp(100px, 20vh, 150px);
}

.location-letter {
    display: inline-block;
    font-size: clamp(1.5rem, 8vw, 4rem);
    font-weight: 900;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: clamp(1px, 1vw, 4px);
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
    animation: letterPop 0.5s ease-out both;
    line-height: 1.2;
}

@keyframes letterPop {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(10deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.instruction {
    text-align: center;
    color: var(--text-light);
    font-style: italic;
    margin-top: 15px;
}

.impostor-message {
    text-align: center;
    padding: 40px 20px;
    background: var(--card);
    border: 3px solid var(--danger);
    border-radius: 15px;
    color: var(--white);
    box-shadow: var(--shadow-lg);
}

.impostor-message h3 {
    font-size: 2rem;
    margin-bottom: 20px;
    color: var(--white);
}

.impostor-message p {
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Mensajes de Error */
.error-message {
    margin-top: 15px;
    padding: 12px;
    background: rgba(239, 71, 111, 0.2);
    color: var(--danger);
    border-radius: 8px;
    text-align: center;
    display: none;
    border: 1px solid var(--danger);
}

.error-message.show {
    display: block;
}

/* Banner Publicitario Sticky */
.ad-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 100px;
    background: var(--card);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    border-top: 2px solid var(--primary);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5);
}

.community-banner {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--white);
    transition: opacity 0.3s;
}

.community-banner:hover {
    opacity: 0.9;
}

.community-banner-content {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 0 20px;
    width: 100%;
    max-width: 600px;
}

.community-icon {
    font-size: 2rem;
}

.community-text {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 5px;
}

.community-text strong {
    font-size: 1rem;
    font-weight: 700;
}

.community-text span {
    font-size: 0.85rem;
    opacity: 0.9;
}

.community-arrow {
    font-size: 1.5rem;
    font-weight: bold;
}

.ad-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Modal Intersticial */
.ad-interstitial {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.interstitial-content {
    background: var(--card);
    border-radius: 20px;
    padding: 30px;
    max-width: 90%;
    text-align: center;
    border: 2px solid var(--primary);
    color: var(--text);
}

.countdown {
    font-size: 4rem;
    font-weight: 700;
    color: var(--primary);
    margin: 20px 0;
}

.ad-container {
    margin-top: 20px;
    min-height: 250px;
    background: var(--bg);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ad-placeholder-large {
    color: var(--text-light);
    font-size: 1rem;
}

/* Responsive - Mobile First */
@media (max-width: 480px) {
    .container {
        margin: 10px;
        padding: 15px;
        border-radius: 15px;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    .room-code-display h1 {
        font-size: 2.5rem;
        letter-spacing: 8px;
    }

    .ad-banner {
        height: 80px;
    }

    body {
        padding-bottom: 80px;
    }

    .community-banner-content {
        padding: 0 15px;
        gap: 10px;
    }

    .community-icon {
        font-size: 1.5rem;
    }

    .community-text strong {
        font-size: 0.9rem;
    }

    .community-text span {
        font-size: 0.75rem;
    }

    .community-arrow {
        font-size: 1.2rem;
    }

    .location-letter {
        font-size: clamp(1.2rem, 6vw, 2.5rem);
        letter-spacing: clamp(0.5px, 0.5vw, 2px);
    }

    .location-word-container {
        padding: clamp(15px, 4vw, 30px) clamp(10px, 3vw, 15px);
        margin: 20px auto;
        border-width: 3px;
    }

    .location-word {
        min-height: clamp(80px, 15vh, 120px);
        gap: clamp(2px, 0.8vw, 6px);
    }

    .group-btn {
        padding: 15px;
    }

    .group-btn strong {
        font-size: 1rem;
    }

    .group-btn span {
        font-size: 0.8rem;
    }

    .instructions-toggle {
        padding: 12px 15px;
        font-size: 1rem;
    }

    .instructions-content {
        padding: 15px;
    }

    .instructions-text {
        font-size: 0.85rem;
        line-height: 1.8;
    }

    .instructions-text strong {
        font-size: 0.9rem;
    }
}

/* Scrollbar personalizado */
#playersList::-webkit-scrollbar {
    width: 6px;
}

#playersList::-webkit-scrollbar-track {
    background: var(--bg);
    border-radius: 10px;
}

#playersList::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

#playersList::-webkit-scrollbar-thumb:hover {
    background: #ffed4e;
}

