/* ==============================================================================
   LA TIERRITA - Tablero de 40 Casillas Colombianas
   CSS Grid 11x11, Dados 3D Reales con Puntos, Numeración y Feed en Vivo
   ============================================================================== */

.game-layout {
    display: flex;
    gap: 20px;
    width: 100%;
    align-items: flex-start;
}

@media (max-width: 1100px) {
    .game-layout {
        flex-direction: column;
        align-items: center;
    }
}

/* Tablero Cuadrado */
.board-container {
    background: #FFF4DC;
    border: 6px solid #174B3A;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    width: 860px;
    height: 860px;
    max-width: 95vw;
    max-height: 95vw;
    display: grid;
    grid-template-columns: 1.6fr repeat(9, 1fr) 1.6fr;
    grid-template-rows: 1.6fr repeat(9, 1fr) 1.6fr;
    position: relative;
    user-select: none;
}

/* Casillas */
.tile {
    background: #FFFAF0;
    border: 1px solid rgba(23, 75, 58, 0.25);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 3px;
    position: relative;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
    font-size: 0.65rem;
    overflow: hidden;
}

.tile:hover {
    background: #FFF9C4;
    z-index: 30;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* Número de Casilla (#0 a #39) */
.tile-number {
    position: absolute;
    top: 2px;
    left: 2px;
    background: #174B3A;
    color: #F6D98A;
    font-size: 0.55rem;
    font-weight: 900;
    padding: 1px 4px;
    border-radius: 4px;
    border: 1px solid rgba(246, 217, 138, 0.5);
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
    z-index: 25;
    letter-spacing: -0.2px;
}

.tile-color-bar {
    width: 100%;
    height: 14px;
    border-radius: 2px;
    box-shadow: inset 0 -1px 2px rgba(0,0,0,0.25);
}

.tile-name {
    font-weight: 800;
    color: #174B3A;
    text-align: center;
    line-height: 1.15;
    margin: 2px 0;
    word-break: break-word;
    font-size: 0.65rem;
}

.tile-price {
    font-weight: 900;
    color: #C76B45;
    font-size: 0.63rem;
    background: rgba(199, 107, 69, 0.1);
    padding: 1px 4px;
    border-radius: 4px;
}

.tile-icon {
    font-size: 1.15rem;
}

/* Esquinas */
.tile-corner {
    background: #FFF0D4;
    font-weight: 800;
    text-align: center;
    padding: 6px;
}

.tile-corner .tile-icon {
    font-size: 1.9rem;
    margin: 3px 0;
}

/* Indicador de Dueño y Casas */
.tile-owner-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
    z-index: 20;
}

.tile-buildings {
    display: flex;
    gap: 2px;
    margin-top: 1px;
    z-index: 20;
}

.building-house {
    width: 8px;
    height: 8px;
    background: #2E7D32;
    border-radius: 1px;
    border: 1px solid #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.building-hotel {
    width: 12px;
    height: 9px;
    background: #C62828;
    border-radius: 2px;
    border: 1px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* Fichas de Jugadores */
.tokens-container {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    position: absolute;
    bottom: 2px;
    left: 2px;
    z-index: 50;
}

.player-token {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFF;
    font-size: 0.7rem;
    font-weight: 900;
    box-shadow: 0 3px 6px rgba(0,0,0,0.5), inset 0 1px 2px rgba(255,255,255,0.6);
    border: 2px solid #FFF;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

.player-token img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Centro del Tablero */
.board-center {
    grid-column: 2 / 11;
    grid-row: 2 / 11;
    background: radial-gradient(circle, #FFF9EB 0%, #F5E5C0 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    position: relative;
    border-radius: 10px;
    box-shadow: inset 0 0 20px rgba(23, 75, 58, 0.08);
}

.board-center-logo {
    text-align: center;
}

.board-center-title {
    font-size: 2.3rem;
    font-weight: 900;
    color: #174B3A;
    letter-spacing: 3px;
    text-shadow: 1px 2px 0 #F6D98A, 2px 3px 6px rgba(0,0,0,0.15);
}

.board-center-tagline {
    font-size: 0.95rem;
    color: #C76B45;
    font-weight: 800;
    font-style: italic;
}

/* ==============================================================================
   DADOS 3D REALES CON PUNTOS (PIPS)
   ============================================================================== */
.dice-arena {
    display: flex;
    gap: 20px;
    align-items: center;
    justify-content: center;
    margin: 14px 0;
    perspective: 800px;
}

.real-die {
    width: 62px;
    height: 62px;
    background: radial-gradient(circle at 35% 35%, #FFFFFF 0%, #F4F1EA 60%, #E2DCce 100%);
    border: 2px solid #C8C0B0;
    border-radius: 14px;
    box-shadow: 
        0 8px 16px rgba(0,0,0,0.25),
        inset 0 2px 4px rgba(255,255,255,0.9),
        inset 0 -3px 6px rgba(0,0,0,0.15);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 8px;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Puntos del dado */
.pip {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin: auto;
    background: radial-gradient(circle at 35% 35%, #37474F 0%, #212121 80%, #000 100%);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.8), 0 1px 1px rgba(255,255,255,0.5);
    visibility: hidden;
}

/* El punto 1 central puede ser rojo rubí */
.pip-center-red {
    background: radial-gradient(circle at 35% 35%, #E53935 0%, #B71C1C 80%, #7F0000 100%) !important;
    width: 13px !important;
    height: 13px !important;
}

/* Animación de Lanzamiento */
.real-die.rolling {
    animation: rollDice3D 0.5s ease-in-out infinite;
}

@keyframes rollDice3D {
    0%   { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(1); }
    25%  { transform: rotateX(180deg) rotateY(90deg) rotateZ(45deg) scale(1.12); }
    50%  { transform: rotateX(270deg) rotateY(180deg) rotateZ(-90deg) scale(0.92); }
    75%  { transform: rotateX(360deg) rotateY(270deg) rotateZ(180deg) scale(1.08); }
    100% { transform: rotateX(720deg) rotateY(360deg) rotateZ(0deg) scale(1); }
}

/* Acciones en el Centro */
.turn-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 10px;
}

.turn-banner {
    background: #174B3A;
    color: #F6D98A;
    padding: 8px 22px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 1.05rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1.5px solid rgba(246, 217, 138, 0.4);
}

/* Panel Lateral */
.game-sidebar {
    flex: 1;
    min-width: 330px;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Participantes y Saldos */
.players-list-panel {
    background: #FFF;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    border: 2px solid rgba(246, 217, 138, 0.7);
}

.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    background: #F8FAFC;
    border-left: 6px solid #CBD5E1;
    transition: all 0.2s;
}

.player-item.is-active-turn {
    background: #FEF9C3;
    border-left-color: #EAB308;
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.25);
    transform: scale(1.02);
}

.player-info-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.player-avatar-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 3px 8px rgba(0,0,0,0.25);
    border: 2px solid #FFF;
    overflow: hidden;
    background: #174B3A;
}

.player-avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-name-txt {
    font-weight: 800;
    font-size: 1rem;
    color: #174B3A;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-cash-txt {
    font-weight: 900;
    color: #2E7D32;
    font-size: 1.05rem;
    white-space: nowrap;
}

/* ==============================================================================
   FEED EN VIVO DE LA PARTIDA (MEJORADO)
   ============================================================================== */
.game-feed-panel {
    background: #FFF;
    border-radius: 14px;
    padding: 16px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    border: 2px solid rgba(246, 217, 138, 0.7);
    display: flex;
    flex-direction: column;
}

.feed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1.5px solid #F1F5F9;
}

.feed-live-badge {
    background: #DCFCE7;
    color: #166534;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid #86EFAC;
}

.live-dot {
    width: 6px;
    height: 6px;
    background: #22C55E;
    border-radius: 50%;
    animation: blinkDot 1s infinite alternate;
}

@keyframes blinkDot {
    from { opacity: 0.3; }
    to { opacity: 1; }
}

.feed-list {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

.feed-list::-webkit-scrollbar {
    width: 5px;
}
.feed-list::-webkit-scrollbar-thumb {
    background: #CBD5E1;
    border-radius: 4px;
}

.feed-card {
    background: #F8FAFC;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 0.8rem;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    transition: background 0.15s;
    animation: fadeInFeed 0.3s ease-out;
}

@keyframes fadeInFeed {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.feed-icon {
    font-size: 1.15rem;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 1px;
}

.feed-content {
    flex: 1;
    color: #334155;
    line-height: 1.35;
}

.feed-highlight-gain {
    color: #15803D;
    font-weight: 800;
}

.feed-highlight-pay {
    color: #B91C1C;
    font-weight: 800;
}

/* Tarjeta Título de Propiedad */
.deed-card {
    background: #FFFDF9;
    border: 3px solid #1E293B;
    border-radius: 14px;
    box-shadow: 0 20px 45px rgba(0,0,0,0.35);
    max-width: 360px;
    width: 92%;
    overflow: hidden;
}

.deed-header {
    padding: 16px;
    color: #FFF;
    text-align: center;
    border-bottom: 2px solid #1E293B;
}

.deed-subtag {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    opacity: 0.9;
}

.deed-title {
    font-size: 1.5rem;
    font-weight: 900;
    margin: 4px 0 2px 0;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.deed-region {
    font-size: 0.8rem;
    font-weight: 700;
    opacity: 0.95;
}

.deed-body {
    padding: 18px;
    font-size: 0.85rem;
}

.deed-rent-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

.deed-rent-table tr {
    border-bottom: 1px solid #E2E8F0;
    height: 24px;
}

.deed-rent-table td:last-child {
    text-align: right;
    font-weight: 800;
    color: #174B3A;
}

.deed-costs-box {
    background: #F8FAFC;
    border-radius: 8px;
    padding: 10px;
    font-size: 0.78rem;
    color: #475569;
    margin-bottom: 16px;
    border: 1px dashed #CBD5E1;
}

.deed-costs-box div {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}
