:root {
    --grid-size: 5;
    --lapis-lazuli: #25587E;
    --blood-red: #651600;
    --cadet-gray: #97A9B4;
    --licorice: #1C080B;
    --dun: #D4CAB8;
    --tyrian-purple: #751444;
    --old-lace: #FFF7E9;
}

.background {
    background: linear-gradient(120deg, #74ebd5, #acb6e5, #a1c4fd, #c2e9fb);
    background-size: 400% 400%;
    animation: gradientMove 20s ease infinite;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

@keyframes gradientMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

body {
    font-family: 'Share Tech Mono', 'Poppins', monospace;
    text-align: center;
    color: #333;
    margin: 0;
}

header {
    padding: 20px;
    color: #222;
}

main {
    flex: 1;
}

h1 {
    font-family: "Share Tech Mono", monospace;
    margin: 0;
    font-size: 3rem;
    text-shadow: 2px 2px 6px rgba(0,0,0,0.3);
}
.controles { margin: 20px; }
button {
    padding: 10px 20px;
    font-family: 'Oswald', sans-serif;
    font-size: 16px;
    cursor: pointer;
    border: none;
    background-image: linear-gradient(45deg, var(--lapis-lazuli), var(--tyrian-purple));
    color: var(--old-lace);
    border-radius: 8px;
    margin: 5px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.toggle-btn {
    filter: grayscale(1) brightness(0.8);
}

.toggle-btn.active {
    filter: none;
    background-image: linear-gradient(45deg, var(--blood-red), var(--tyrian-purple));
    box-shadow: 0 0 8px rgba(0,0,0,0.3);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    background-image: linear-gradient(45deg, var(--blood-red), var(--tyrian-purple));
}

select {
    padding: 10px;
    font-size: 16px;
    border-radius: 5px;
    margin: 5px;
    border: 1px solid #ccc;
}
#tablero {
    display: grid;
    grid-template-columns: repeat(var(--grid-size), 1fr);
    gap: 10px;
    width: 90%;
    max-width: 800px;
    margin: 20px auto;
}
.tarjeta {
    font-family: "Share Tech Mono", monospace;
    background-color: #fff;
    border: 2px solid #ddd;
    border-radius: 8px;
    aspect-ratio: 1.5 / 1;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.tarjeta:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 10px rgba(0,0,0,0.2);
}

.vista-espia .tarjeta.rojo {
    background-color: #ffadad;
    color: #fff;
    font-weight: bold;
}
.vista-espia .tarjeta.azul {
    background-color: #a0c4ff;
    color: #fff;
    font-weight: bold;
}
#tablero.modo-tablet .tarjeta {
    position: relative;
    font-size: 0.8em;
    color: transparent;
    overflow: hidden;
}

#tablero.modo-tablet .tarjeta::before,
#tablero.modo-tablet .tarjeta::after {
    content: attr(data-palabra);
    position: absolute;
    left: 0;
    right: 0;
    height: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
    pointer-events: none;
}

#tablero.modo-tablet .tarjeta::before {
    top: 0;
    transform: rotate(180deg);
    color: var(--tyrian-purple);
    border-bottom: 1px solid #ddd;
}

#tablero.modo-tablet .tarjeta::after {
    bottom: 0;
    color: #333;
    border-top: 1px solid #ddd;
}


#tablero.modo-tablet.vista-espia .tarjeta.asesino::before,
#tablero.modo-tablet.vista-espia .tarjeta.asesino::after,
#tablero.modo-tablet .tarjeta.revelada.asesino::before,
#tablero.modo-tablet .tarjeta.revelada.asesino::after {
    color: #fff;
}

#tablero.modo-tablet.vista-espia .tarjeta.asesino {
    color: #fff;
}


.vista-espia .tarjeta.rojo { background-color: #ffadad; }
.vista-espia .tarjeta.azul { background-color: #a0c4ff; }
.vista-espia .tarjeta.neutro { background-color: #fdffb6; }
.vista-espia .tarjeta.asesino { background-color: #444; color: white; }



.tarjeta:hover { transform: scale(1.05); }
.vista-espia .tarjeta[data-rol="rojo"]:not(.revelada) {
    background-color: #ffadad;
    color: #fff;
    font-weight: bold;
}
.vista-espia .tarjeta[data-rol="azul"]:not(.revelada) {
    background-color: #a0c4ff;
    color: #fff;
    font-weight: bold;
}
.vista-espia .tarjeta[data-rol="neutro"]:not(.revelada) { background-color: #fdffb6; }
.vista-espia .tarjeta[data-rol="asesino"]:not(.revelada) { background-color: #444; color: white; }

.tarjeta.revelada {
    transform: none;
    color: white;
}

.tarjeta.revelada.rojo { background-color: #ffadad; }
.tarjeta.revelada.azul { background-color: #a0c4ff; }
.tarjeta.revelada.neutro { background-color: #fdffb6; color: black; }
.tarjeta.revelada.asesino { background-color: #444; color: white; }


#turno {
    font-weight: bold;
    margin: 10px 0;
}

.turno-boton {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 6px;
    color: #fff !important;
    font-weight: bold;
}

.turno-boton.rojo { background-color: #ff6b6b; }
.turno-boton.azul { background-color: #4d90fe; }

.rojo { color: #ff0000; }
.azul { color: #0000ff; }

.tooltip {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.tooltip-contenido {
    background: #000;
    color: #fff;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
    text-align: center;
}
.tooltip textarea {
    width: 100%;
    margin-top: 10px;
    padding: 10px;
    height: 60px;
}
.tooltip.oculto {
    display: none;
}

.mensaje-victoria {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px 30px;
    font-size: 2rem;
    font-weight: bold;
    border-radius: 12px;
    z-index: 2000;
    background: rgba(255,255,255,0.95);
}
.mensaje-victoria.rojo {
    background-color: #ffadad;
    color: #fff;
}
.mensaje-victoria.azul {
    background-color: #a0c4ff;
    color: #fff;
}
.mensaje-victoria.oculto { display: none; }

@keyframes parpadeo {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.8); }
    50% { box-shadow: 0 0 10px rgba(255, 215, 0, 0.2); }
}

.tarjeta.seleccionada {
    animation: parpadeo 1s infinite;
    background: radial-gradient(circle at center, #d2b48c, #8b4513);
    color: #fff;
    transform: scale(1.3);
    z-index: 5;
}

button:disabled {
    background: var(--cadet-gray);
    color: var(--licorice);
    cursor: not-allowed;
}

.confirmar-wrapper {
    margin: 10px 0 20px;
    display: flex;
    justify-content: center;
}

#confirmar {
    background-color: #ff3333;
    border-radius: 50%;
    width: 80px;
    height: 80px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid #b30000;
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.7), inset 0 0 5px rgba(255,255,255,0.5);
}
#confirmar:hover:not(:disabled) {
    box-shadow: 0 0 15px rgba(255, 0, 0, 0.9), inset 0 0 5px rgba(255,255,255,0.8);
    transform: scale(1.05);
}

.confirmar-svg {
    width: 70px;
    height: 70px;
}

.confirmar-texto {
    fill: #fff;
    font-size: 1rem;
    font-weight: bold;
    text-transform: uppercase;
}

.eft2 {
    font-family: 'Oswald', sans-serif;
    color: #fff;
    background: #ff1f8f;
    border-radius: 3em .5em 2em .5em/ .4em 2em .5em 3em;
    padding: 0.2em 0.5em;
    display: inline-block;
}

.eft2 span { display: inline-block; }
.eft2 span:nth-child(10n + 1) { color: blue; }
.eft2 span:nth-child(10n + 2) { color: white; background-color: red; font-size: 120%; }
.eft2 span:nth-child(10n + 3) { color: green; }
.eft2 span:nth-child(10n + 4) { color: #fff; text-decoration: underline; }
.eft2 span:nth-child(10n + 5) { color: pink; font-style: italic; }
.eft2 span:nth-child(10n + 6) { color: skyblue; font-style: italic; }
.eft2 span:nth-child(10n + 7) { color: yellowgreen; text-decoration: underline; }
.eft2 span:nth-child(10n + 8) { color: orange; text-decoration: underline; }
.eft2 span:nth-child(10n + 9) { color: white; background-color: purple; font-size: 150%; border-radius: 15px; padding: 3px; }
.eft2 span:nth-child(10n + 10) { color: navy; }


@media (max-width: 1024px) {
    button {
        padding: 8px 15px;
        font-size: 14px;
    }
    .tarjeta {
        font-size: 1em;
    }
}

@media (max-width: 600px) {
    button {
        padding: 4px 8px;
        font-size: 12px;
    }
    .tarjeta {
        font-size: 0.7em;
    }
    .tarjeta:hover {
        transform: scale(1.1);
    }
    .tarjeta.revelada {
        transform: none;
    }
    .tarjeta.seleccionada {
        transform: scale(1.8);
    }
    #tablero {
        width: 100%;
        gap: 5px;
    }
    h1.eft2 {
        font-size: 2rem;
    }
}




.tooltip-container {
    position: relative;
    display: inline-block;
    vertical-align: middle;
}


#icono-ayuda {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 30px;
    height: 30px;
    background-color: #6c757d;
    color: white;
    font-weight: bold;
    font-size: 20px;
    border-radius: 50%;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

#icono-ayuda:hover {
    background-color: #5a6268;
}


#tooltip-ayuda {
    position: absolute;
    top: 125%;
    bottom: auto;
    left: 50%;
    transform: translateX(-80%);
    width: 80vw;
    max-width: 600px;
    background-color: #fff;
    color: #333;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100;
    text-align: left;
    line-height: 1.5;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

@media (max-width: 600px) {
    #tooltip-ayuda {
        width: 60vw;
        max-width: none;
    }
}


#tooltip-ayuda::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    margin-left: -8px;
    border-width: 8px;
    border-style: solid;
    border-color: transparent transparent #fff transparent;
}


.tooltip-oculto {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-80%) translateY(-10px);
}


#tooltip-ayuda h3 {
    margin-top: 0;
    color: #007bff;
}

#tooltip-ayuda hr {
    border: none;
    border-top: 1px solid #eee;
    margin: 10px 0;
}

#tooltip-ayuda ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#tooltip-ayuda li {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}


.color-caja {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    margin-right: 10px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.1);
}

.color-caja.azul { background-color: #a0c4ff; }
.color-caja.rojo { background-color: #ffadad; }
.color-caja.amarillo { background-color: #fdffb6; }
.color-caja.negro { background-color: #444; }

footer.credit {
    font-family: "Share Tech Mono", monospace;
    color: #555;
    font-size: 0.8rem;
    margin: 20px 0;
}

#languageToggle {
    position: absolute;
    top: 10px;
    left: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.6); 
    padding: 2px 6px;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1000;
    font-weight: bold;
    border-radius: 4px;
}

.lang-btn span {
    display: inline-block;
}
