/* styles/letratros.css */

/* Contenedor principal */
.lt-main {
    display: flex;
    justify-content: center;
    padding: 20px;
    background-color: var(--bg-main, #f4f4f4);
    min-height: calc(100vh - 120px);
    font-family: 'Inter', sans-serif;
}

.lt-game-container {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ESCRITORIO (Dos Columnas) */
@media (min-width: 900px) {
    .lt-game-container {
        max-width: 1000px;
        flex-direction: row;
        align-items: flex-start;
        gap: 40px;
    }

    .lt-col-board {
        flex: 1;
        max-width: 500px;
        /* IMPORTANTE: Para que el mensaje absoluto se posicione respecto a esto */
        position: relative;
    }

    .lt-col-controls {
        flex: 1;
        max-width: 450px;
        display: flex;
        flex-direction: column;
        gap: 15px;
        position: sticky;
        top: 20px;
    }

    .lt-board-grid {
        width: 100%;
        max-width: 500px;
    }
}

/* En móvil también necesitamos relative si la estructura cambia, 
   pero por defecto .lt-col-board lo manejará si está presente.
   Si en móvil no usas .lt-col-board, asegúrate de añadir relative al padre. */
.lt-col-board {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* MARCADORES */
.lt-scoreboard {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.lt-score-box,
.lt-reroll-box {
    flex: 1;
    background: var(--bg-secondary, #fff);
    border: 1px solid var(--border-light, #ddd);
    padding: 10px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.9rem;
    color: #555;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.lt-score-val,
.lt-reroll-val {
    font-size: 1.5rem;
    font-weight: 800;
    margin-top: 5px;
}

.lt-score-val {
    color: var(--primary, #333);
}

.lt-reroll-val {
    color: #f59f00;
}

/* MENSAJES (SOLUCIÓN DEL SALTO) */
.lt-message {
    /* Posicionamiento absoluto para que no empuje el contenido */
    position: absolute;
    top: 50%;
    /* Centrado verticalmente respecto al tablero */
    left: 50%;
    transform: translate(-50%, -50%);

    /* Diseño tipo "Toast" flotante */
    background-color: rgba(51, 51, 51, 0.95);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    z-index: 100;
    /* Siempre encima */
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    /* Para poder clicar a través si se queda pillado (opcional) */
    width: max-content;
    max-width: 80%;
}

/* Colores específicos según tipo */
.lt-message.error {
    background-color: rgba(201, 42, 42, 0.95);
    border: none;
    color: white;
}

.lt-message.success {
    background-color: rgba(43, 138, 62, 0.95);
    border: none;
    color: white;
}

.lt-message.info {
    background-color: rgba(25, 113, 194, 0.95);
    border: none;
    color: white;
}

.hidden {
    display: none !important;
}

/* TABLERO */
.lt-board-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    background: #ced4da;
    padding: 5px;
    border-radius: 8px;
    aspect-ratio: 1;
    margin: 0 auto;
}

.lt-cell {
    background: #fff;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}

.lt-cell:hover {
    background: #f8f9fa;
}

.lt-cell.active-input {
    background-color: #e7f5ff;
    border: 2px solid var(--primary, #228be6);
    box-shadow: 0 0 5px rgba(34, 139, 230, 0.3);
}

/* FICHAS */
.lt-tile {
    width: 90%;
    height: 90%;
    background: #fff9db;
    border: 2px solid #eaddad;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    font-size: 1.2rem;
    color: #495057;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.1);
    position: relative;
    user-select: none;
}

.lt-tile.rare {
    background: #ffe3e3;
    border-color: #ffa8a8;
    color: #c92a2a;
}

.lt-tile-points {
    position: absolute;
    bottom: 2px;
    right: 3px;
    font-size: 0.6rem;
    font-weight: 600;
    color: #868e96;
}

.lt-cell.locked .lt-tile {
    background: #e9ecef;
    border-color: #dee2e6;
    color: #868e96;
    box-shadow: none;
}

.lt-cell.temp .lt-tile {
    border-color: var(--primary, #333);
    transform: scale(1.05);
}

/* MANO */
.lt-hand-area {
    background: var(--bg-secondary, #fff);
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border-light, #ddd);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.lt-hand-grid {
    display: flex;
    justify-content: center;
    gap: 5px;
    height: 50px;
}

.lt-hand-slot {
    width: 11%;
    aspect-ratio: 1;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.1s;
}

.lt-hand-slot.selected .lt-tile {
    transform: translateY(-8px);
    border-color: var(--primary, #333);
    box-shadow: 0 6px 8px rgba(0, 0, 0, 0.2);
}

.lt-hand-slot.reroll-select .lt-tile {
    opacity: 0.6;
    border-color: #f59f00;
}

/* CONTROLES */
.lt-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lt-btn {
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
    transition: transform 0.1s;
}

.lt-btn:active {
    transform: scale(0.98);
}

.lt-btn-primary {
    background: var(--primary, #228be6);
    color: white;
}

.lt-btn-warning {
    background: #fab005;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.lt-btn-secondary {
    background: #e9ecef;
    color: #495057;
}

.lt-instructions {
    text-align: center;
    font-size: 0.8rem;
    color: #888;
    margin-top: 10px;
}

/* TECLADO */
.keyboard {
    width: 100%;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    user-select: none;
}

.kb-row {
    display: flex;
    justify-content: center;
    gap: 4px;
    width: 100%;
}

.kb-key {
    flex: 1;
    background: #dce1ed;
    border: 1px solid #c8d0e0;
    border-radius: 4px;
    height: 45px;
    font-weight: 700;
    font-size: 0.95rem;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    touch-action: manipulation;
}

.kb-key:active {
    background: #bcc5d8;
}

.kb-key.key-big {
    flex: 1.5;
    font-size: 0.8rem;
}

.kb-key.has-letter {
    background: #fff;
    border-color: #aaa;
    position: relative;
}

.kb-key.has-letter::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 5px;
    height: 5px;
    background-color: var(--primary, #228be6);
    border-radius: 50%;
}

/* MODAL */
.lt-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.lt-modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* styles/letratros.css */
* {
    box-sizing: border-box;
}

.lt-main {
    display: flex;
    justify-content: center;
    padding: 20px;
    background-color: var(--bg-main, #f4f4f4);
    min-height: calc(100vh - 120px);
    font-family: 'Inter', sans-serif;
}

.lt-game-container {
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ESCRITORIO */
@media (min-width: 900px) {
    .lt-game-container {
        max-width: 1000px;
        flex-direction: row;
        align-items: flex-start;
        /* CRUCIAL: Evita que el tablero se estire verticalmente */
        gap: 40px;
    }

    .lt-col-board {
        flex: 1;
        max-width: 500px;
        position: relative;
    }

    .lt-col-controls {
        flex: 1;
        max-width: 450px;
        display: flex;
        flex-direction: column;
        gap: 15px;
        position: sticky;
        top: 20px;
    }
}

.lt-col-board {
    position: relative;
}

/* MARCADORES */
.lt-scoreboard {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.lt-score-box,
.lt-reroll-box {
    flex: 1;
    background: var(--bg-secondary, #fff);
    border: 1px solid var(--border-light, #ddd);
    padding: 10px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.9rem;
    color: #555;
}

.lt-score-val,
.lt-reroll-val {
    font-size: 1.5rem;
    font-weight: 800;
    margin-top: 5px;
}

.lt-score-val {
    color: var(--primary, #333);
}

.lt-reroll-val {
    color: #f59f00;
}

/* MENSAJE FLOTANTE */
.lt-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(51, 51, 51, 0.95);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    z-index: 100;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    width: max-content;
    pointer-events: none;
}

.lt-message.error {
    background-color: rgba(201, 42, 42, 0.95);
}

.lt-message.success {
    background-color: rgba(43, 138, 62, 0.95);
}

.lt-message.info {
    background-color: rgba(25, 113, 194, 0.95);
}

.hidden {
    display: none !important;
}

/* TABLERO */
.lt-board-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-template-rows: repeat(7, 1fr);
    /* Fuerza filas iguales a columnas */
    gap: 5px;

    width: 100%;
    aspect-ratio: 1;
    /* Cuadrado perfecto */

    background: #ced4da;
    padding: 5px;
    border-radius: 8px;
    margin: 0 auto;
}

.lt-cell {
    width: 100%;
    height: 100%;
    background: #fff;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    position: relative;
    transition: background 0.2s;
}

.lt-cell:hover {
    background: #f8f9fa;
}

.lt-cell.active-input {
    background-color: #e7f5ff;
    border: 2px solid var(--primary, #228be6);
    box-shadow: 0 0 5px rgba(34, 139, 230, 0.3);
}

/* FICHAS Y RESTO DE ELEMENTOS IGUAL QUE ANTES */
.lt-tile {
    width: 90%;
    height: 90%;
    background: #fff9db;
    border: 2px solid #eaddad;
    border-radius: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    font-size: 1.2rem;
    color: #495057;
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.1);
    position: relative;
    user-select: none;
}

.lt-tile.rare {
    background: #ffe3e3;
    border-color: #ffa8a8;
    color: #c92a2a;
}

.lt-tile-points {
    position: absolute;
    bottom: 2px;
    right: 3px;
    font-size: 0.6rem;
    font-weight: 600;
    color: #868e96;
}

.lt-cell.locked .lt-tile {
    background: #e9ecef;
    border-color: #dee2e6;
    color: #868e96;
    box-shadow: none;
}

.lt-cell.temp .lt-tile {
    border-color: var(--primary, #333);
    transform: scale(1.05);
}

.lt-hand-area {
    background: var(--bg-secondary, #fff);
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border-light, #ddd);
}

.lt-hand-grid {
    display: flex;
    justify-content: center;
    gap: 5px;
    height: 50px;
}

.lt-hand-slot {
    width: 11%;
    aspect-ratio: 1;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 6px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.lt-hand-slot.selected .lt-tile {
    transform: translateY(-8px);
    border-color: var(--primary, #333);
}

.lt-hand-slot.reroll-select .lt-tile {
    opacity: 0.6;
    border-color: #f59f00;
}

.lt-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.lt-btn {
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

.lt-btn-primary {
    background: var(--primary, #228be6);
    color: white;
}

.lt-btn-warning {
    background: #fab005;
    color: #fff;
}

.lt-btn-secondary {
    background: #e9ecef;
    color: #495057;
}

.lt-instructions {
    text-align: center;
    font-size: 0.8rem;
    color: #888;
    margin-top: 10px;
}

.keyboard {
    width: 100%;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    user-select: none;
}

.kb-row {
    display: flex;
    justify-content: center;
    gap: 4px;
    width: 100%;
}

.kb-key {
    flex: 1;
    background: #dce1ed;
    border: 1px solid #c8d0e0;
    border-radius: 4px;
    height: 45px;
    font-weight: 700;
    font-size: 0.95rem;
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.kb-key.has-letter {
    background: #fff;
    border-color: #aaa;
    position: relative;
}

.kb-key.has-letter::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 5px;
    height: 5px;
    background-color: var(--primary, #228be6);
    border-radius: 50%;
}

.lt-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.lt-modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    width: 90%;
    max-width: 400px;
}

/* styles/letratros.css */

/* Contenedor principal */
.lt-main {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    /* Clave para evitar el corte */
    padding: 30px 15px;
    min-height: 100vh;
}

/* El tablero de letratros */
#board-container {
    margin-bottom: 40px;
    /* Separar del texto SEO */
}
/* Para Chrome, Safari y Opera */
.lt-main::-webkit-scrollbar {
    display: none;
}

/* Para Firefox, IE y Edge */
.lt-main {
    -ms-overflow-style: none;
    /* IE y Edge */
    scrollbar-width: none;
    /* Firefox */
}