/* Parchis-specific board and controls. */
#screen-parchis-game {
    background: #1a3c28;
    gap: 16px;
    overflow: hidden;
}

/* ── Tablero ── */
#parchis-board {
    position: relative;
    width: 83vmin;
    height: 83vmin;
    background: url('../images/parchis/Tablero_de_juego_del_parchis.svg') center / contain no-repeat;
}

/* ── Fichas ── */
.ficha {
    position: absolute;
    width: 3.8%;
    height: 3.8%;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    transition: top 0.4s ease-in-out, left 0.4s ease-in-out, transform 0.3s ease;
    z-index: 10;
    user-select: none;
}

.ficha-roja {
    background: radial-gradient(circle at 35% 30%, #ff9090, #cc1f1f 50%, #7a0000);
    border: 2px solid #5a0000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.55), inset 0 2px 5px rgba(255,160,160,0.45);
}
.ficha-azul {
    background: radial-gradient(circle at 35% 30%, #80c8ff, #0060aa 50%, #003366);
    border: 2px solid #002244;
    box-shadow: 0 4px 8px rgba(0,0,0,0.55), inset 0 2px 5px rgba(128,200,255,0.45);
}
.ficha-amarillo {
    background: radial-gradient(circle at 35% 30%, #fff080, #d4aa00 50%, #806000);
    border: 2px solid #604800;
    box-shadow: 0 4px 8px rgba(0,0,0,0.55), inset 0 2px 5px rgba(255,240,100,0.45);
}
.ficha-verde {
    background: radial-gradient(circle at 35% 30%, #80ee80, #1a8a1a 50%, #0a4a0a);
    border: 2px solid #083808;
    box-shadow: 0 4px 8px rgba(0,0,0,0.55), inset 0 2px 5px rgba(128,238,128,0.45);
}

.ficha:hover {
    filter: brightness(1.15);
    z-index: 15;
}

.ficha.movible {
    cursor: pointer;
    animation: pulsoMovible 0.9s ease-in-out infinite alternate;
}
@keyframes pulsoMovible {
    from { filter: brightness(1); }
    to   { filter: brightness(1.45) drop-shadow(0 0 4px white); }
}

.ficha.seleccionada {
    box-shadow:
        0 0 0 2.5px #fff,
        0 0 0 5px rgba(255, 230, 0, 0.85),
        0 4px 10px rgba(0,0,0,0.5),
        inset 0 2px 5px rgba(255,160,160,0.45);
    z-index: 20;
    filter: brightness(1.1);
}

/* ── Panel dado ── */
#panel-dado {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    justify-content: stretch;
    gap: 18px;
    width: 83vmin;
    min-height: 48px;
}

#btn-dado {
    grid-column: 2;
    justify-self: center;
    padding: 12px 26px;
    background: linear-gradient(145deg, #e74c3c, #c0392b);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.35);
    transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s;
}
#btn-dado:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.35);
}
#btn-dado:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

#btn-mover {
    grid-column: 3;
    justify-self: start;
    padding: 12px 26px;
    background: linear-gradient(145deg, #27ae60, #1e8449);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: bold;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.35);
    transition: transform 0.12s, box-shadow 0.12s;
    display: none;
}
#btn-mover:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0,0,0,0.35);
}

#mensaje {
    grid-column: 3;
    justify-self: start;
    color: #c8e6c9;
    font-size: 13px;
    min-width: 200px;
}

/* ── Overlay resultado ── */
#overlay-resultado {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.78);
    align-items: center; justify-content: center;
    z-index: 500;
}
#overlay-resultado.visible { display: flex; }
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.72);
    align-items: center; justify-content: center;
    z-index: 520;
}
.modal-overlay.visible { display: flex; }
.res-box {
    background: linear-gradient(135deg, #1a4a2a, #0d2818);
    border: 3px solid #f0c040;
    border-radius: 20px;
    padding: 40px 50px;
    text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    min-width: 300px;
}
.res-icon  { font-size: 56px; line-height: 1; }
.res-title { font-size: 2.2rem; font-weight: 900; letter-spacing: 4px; color: #fff; }
.res-sub   { font-size: 1rem; color: #c0e0c0; }
.res-timer {
    font-size: 2.4rem; font-weight: 900;
    color: #f0c040; min-width: 2ch; text-align: center;
}
.res-timer.urgente { color: #e04040; }
.res-timer-label { font-size: 0.65rem; color: #70a070; letter-spacing: 1px; }
.res-actions { display: flex; gap: 12px; margin-top: 6px; flex-wrap: wrap; justify-content: center; }
.res-btn {
    padding: 10px 22px; border: none; border-radius: 8px;
    font-size: 14px; font-weight: bold; cursor: pointer;
    transition: filter 0.15s;
}
.res-btn:hover { filter: brightness(1.15); }
.res-btn-primary   { background: #2a7a3a; color: #c8ecd8; }
.res-btn-secondary { background: #3a3a5a; color: #a0a0c0; }
.rules-box { max-width: 560px; width: min(92vw, 560px); }
.rules-content { color: #c0e0c0; font-size: 14px; line-height: 1.45; text-align: left; }
.rules-content ul { padding-left: 20px; margin-top: 10px; }
.rules-content li + li { margin-top: 6px; }
.ps-slot.abandoned {
    filter: grayscale(0.9) brightness(0.58);
    opacity: 0.72;
}

/* ── Log de dados ── */
#dado-log {
    display: flex;
    flex-direction: column-reverse; /* más reciente arriba */
    gap: 3px;
    position: fixed;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    max-height: 70vh;
    overflow-y: auto;
    z-index: 100;
}
.log-e {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(0,0,0,0.45);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 15px;
    white-space: nowrap;
    backdrop-filter: blur(3px);
}
.log-e b {
    font-size: 13px;
    font-weight: 700;
    min-width: 10px;
}
.log-e small {
    font-size: 9px;
    opacity: 0.65;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.log-rojo     { color: #ff7070; }
.log-azul     { color: #70a8ff; }
.log-amarillo { color: #f0d050; }
.log-verde    { color: #60c870; }

#bonus-label {
    grid-column: 3;
    justify-self: start;
    display: none;
    color: #ffd700;
    font-size: 13px;
    font-weight: bold;
    animation: pulse 0.8s ease-in-out infinite alternate;
}
@keyframes pulse { from { opacity: 1; } to { opacity: 0.5; } }

/* ── Panel de jugadores ── */
#player-panel {
    position: fixed;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 100;
}

@media (max-width: 600px) {
    body { padding-bottom: 66px; }

    #dado-log { display: none; }

    #player-panel {
        top: auto;
        right: 0; left: 0; bottom: 0;
        transform: none;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
        padding: 6px 8px;
        background: rgba(0,0,0,0.75);
        backdrop-filter: blur(4px);
        border-top: 1px solid rgba(255,255,255,0.1);
    }

    .ps-slot {
        min-width: 0;
        flex: 1 1 auto;
        max-width: 48%;
        padding: 5px 8px;
    }
}
.ps-slot {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0,0,0,0.42);
    border-radius: 8px;
    padding: 6px 10px;
    min-width: 130px;
    backdrop-filter: blur(3px);
    border: 1px solid transparent;
    transition: background 0.25s, border-color 0.25s;
}
.ps-slot.turno-activo {
    background: rgba(255,255,255,0.13);
    border-color: rgba(255,255,255,0.25);
}
.ps-slot.soy-yo { border-right: 2.5px solid rgba(255,255,255,0.45); }
.ps-dot {
    width: 14px; height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.ps-rojo    .ps-dot { background: #cc1f1f; }
.ps-azul    .ps-dot { background: #0060aa; }
.ps-amarillo .ps-dot { background: #d4aa00; }
.ps-verde   .ps-dot { background: #1a8a1a; }
.ps-info { display: flex; flex-direction: column; gap: 1px; }
.ps-name {
    font-size: 11px;
    color: #d0d0d0;
    font-weight: 500;
    white-space: nowrap;
}
.turno-activo .ps-name { color: #fff; font-weight: 700; }
.ps-fichas {
    font-size: 9px;
    color: #707070;
    letter-spacing: 2px;
}
.turno-activo .ps-fichas { color: #a0a0a0; }
.ps-timer {
    display: none;
    align-self: flex-start;
    margin-top: 2px;
    padding: 1px 6px;
    border-radius: 5px;
    border: 1px solid rgba(240,192,64,0.45);
    color: #f0c040;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.35;
    letter-spacing: 0;
}
.ps-timer.low {
    color: #ff8040;
    border-color: #ff8040;
}
.ps-timer.crit {
    color: #ff3030;
    border-color: #ff3030;
}
#parchis-turn-timer {
    display: none;
    grid-column: 1;
    justify-self: end;
    padding: 9px 14px;
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(120, 24, 18, 0.72), rgba(56, 14, 12, 0.82));
    border: 1px solid rgba(231,76,60,0.55);
    color: #ffd7d2;
    font-size: 0.86rem;
    font-weight: 900;
    line-height: 1;
    min-width: 48px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.28);
    backdrop-filter: blur(3px);
}
#parchis-turn-timer.low {
    color: #ffe0a8;
    border-color: #f39c12;
    background: linear-gradient(145deg, rgba(150, 82, 18, 0.76), rgba(74, 39, 10, 0.84));
}
#parchis-turn-timer.crit {
    color: #fff;
    border-color: #ff3030;
    background: linear-gradient(145deg, rgba(210, 42, 34, 0.9), rgba(115, 14, 14, 0.92));
}

/* ── Lobby ── */
#parchis-lobby {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
}
.parchis-lobby-box {
    background: linear-gradient(135deg, #0d2818, #1a4a2a);
    border: 2px solid #2a7a3a;
    border-radius: 16px;
    padding: 32px 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-width: 300px;
}
.lobby-parchis-title {
    font-size: 1.2rem;
    font-weight: 800;
    color: #c8e6c9;
    letter-spacing: 3px;
}
.lobby-parchis-hint {
    font-size: 0.65rem;
    color: #70a070;
    letter-spacing: 1.5px;
}
.lobby-parchis-code {
    font-size: 2.2rem;
    font-weight: 900;
    color: #f0c040;
    letter-spacing: 8px;
}
#lobby-parchis-players {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    margin-top: 4px;
}
.lobby-parchis-slot {
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}
.lobby-parchis-slot.slot-human {
    background: rgba(40,120,60,0.4);
    color: #c8e6c9;
    border: 1px solid #2a7a3a;
}
.lobby-parchis-slot.slot-bot {
    background: rgba(40,40,70,0.5);
    color: #8080a0;
    border: 1px solid #2a2a5a;
}
.lobby-parchis-waiting {
    font-size: 11px;
    color: #70a070;
}
.lobby-parchis-start {
    margin-top: 6px;
    padding: 10px 24px;
    background: linear-gradient(145deg, #2a7a3a, #1e5a2a);
    color: #c8e6c9;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: filter 0.15s;
}
.lobby-parchis-start:hover { filter: brightness(1.15); }
