/* Plennen Game Styles 
    Based on Ride The Bus template
*/

/* General Wrapper */
#pln-game-wrapper {
    font-family: 'Press Start 2P', monospace;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    /* Force container to fill available width and not shrink */
    min-width: 100%; 
    max-width: 1400px; /* Increased max-width for larger desktop view */
    margin: 0 auto;
    background-color: #111827;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    border: 2px solid #374151;
    height: 900px; /* Increased height */
    position: relative;
    color: white;
    box-sizing: border-box;
}

/* Enforce desktop width */
@media (min-width: 768px) {
    #pln-game-wrapper {
        min-width: 800px; 
    }
}

/* Header & Info */
.pln-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #374151;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.pln-title {
    color: #fbbf24;
    text-shadow: 2px 2px #000;
    font-size: 2rem; /* Larger Title */
    margin: 0;
}

.pln-info {
    font-size: 1rem; /* Larger Info */
    color: #9ca3af;
    text-align: right;
}

.pln-trump-indicator {
    display: inline-block;
    padding: 5px 12px;
    background: #374151;
    border-radius: 4px;
    margin-left: 5px;
    color: #fff;
    font-size: 1.2rem;
}

.suit-hearts, .suit-diamonds { color: #ef4444; }
.suit-clubs, .suit-spades { color: #93c5fd; }
.suit-none { color: #d1d5db; }

/* Message Bar */
.pln-message-bar {
    text-align: center;
    color: #fbbf24;
    font-size: 1.2rem; /* Larger Message */
    height: 30px;
    margin-bottom: 15px;
    width: 100%;
    z-index: 5;
}

/* Game Area (Grid) */
.pln-table-area {
    position: relative;
    flex-grow: 1;
    width: 100%;
    min-width: 700px; /* Wider table area */
    background: #1f2937;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Player Positions */
.pln-player-spot {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    transition: all 0.3s ease;
    z-index: 10; 
}

.pln-top { top: 30px; left: 50%; transform: translateX(-50%); }
.pln-left { left: 30px; top: 35%; transform: translateY(-50%); }
.pln-right { right: 30px; top: 35%; transform: translateY(-50%); }
.pln-bottom { 
    bottom: 120px; /* Adjusted for larger cards */
    left: 50%; 
    transform: translateX(-50%); 
    width: 90%; 
}

/* Avatars & Stats */
.pln-avatar {
    width: 70px;
    height: 70px;
    background: #374151;
    border: 3px solid #4b5563;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 10px;
    position: relative;
    z-index: 2;
}

.pln-active-turn .pln-avatar {
    border-color: #fbbf24;
    box-shadow: 0 0 15px #fbbf24;
}

.pln-stats {
    background: rgba(0,0,0,0.6);
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    color: #e5e7eb;
    text-align: center;
    margin-top: 5px;
}

.pln-bid-bubble {
    font-size: 1rem;
    color: #fbbf24;
    background: #000;
    border: 2px solid #fbbf24;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: -5px;
    right: -5px;
}

/* Playing Cards (On Table) */
.pln-card {
    width: 80px; /* Larger played cards */
    height: 112px;
    background: white;
    border-radius: 6px;
    color: black;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.5);
    user-select: none;
    position: relative;
    transition: transform 0.2s;
}

.pln-card.red { color: #dc2626; }
.pln-card.black { color: #1e293b; }

/* Table Center (Trick) */
.pln-trick-zone {
    width: 400px;
    height: 350px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pln-played-card {
    position: absolute;
    transition: all 0.5s ease-out;
    transform: translate(-50%, -50%);
    z-index: 30; 
}

.played-0 { top: 80%; left: 50%; } 
.played-1 { top: 50%; left: 20%; } 
.played-2 { top: 20%; left: 50%; } 
.played-3 { top: 50%; left: 80%; } 

/* Player Hand (Your Cards) */
.pln-hand {
    display: flex;
    justify-content: center;
    gap: -20px; /* More overlap for larger cards */
    margin-top: 15px;
    flex-wrap: wrap;
    max-width: 100%;
}

.pln-hand-card {
    width: 90px; /* Much Larger Hand Cards */
    height: 126px;
    background: white;
    border-radius: 10px;
    margin: 0 -25px;
    border: 2px solid #9ca3af;
    cursor: pointer;
    transition: transform 0.2s, z-index 0s;
    position: relative; 
    box-shadow: -4px 0 8px rgba(0,0,0,0.3);
}

.pln-hand-card.red { color: #ef4444 !important; }
.pln-hand-card.black { color: #111827 !important; }

.pln-hand-card:hover {
    transform: translateY(-40px) scale(1.1);
    z-index: 100;
    border-color: #fbbf24;
}

.pln-hand-card.disabled {
    filter: brightness(0.5);
    cursor: not-allowed;
}

/* Card Inner Layout */
.pln-card-corner-tl { position: absolute; top: 6px; left: 8px; font-size: 1.4rem; font-weight: bold; line-height: 1; }
.pln-card-corner-bl { position: absolute; bottom: 8px; left: 8px; font-size: 1.6rem; line-height: 1; }
.pln-card-corner-br { position: absolute; bottom: 6px; right: 8px; font-size: 1.4rem; font-weight: bold; transform: rotate(180deg); line-height: 1; }
.pln-card-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 3rem; opacity: 0.15; }

/* Bidding Panel */
.pln-bid-panel {
    background: rgba(17, 24, 39, 0.95);
    border: 2px solid #fbbf24;
    padding: 25px;
    border-radius: 8px;
    text-align: center;
    z-index: 20;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    min-width: 300px;
}

.pln-bid-control-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 25px;
    margin: 20px 0;
}

.pln-bid-display {
    font-size: 2.5rem;
    color: #fbbf24;
    width: 60px;
    text-align: center;
}

.pln-btn {
    background-color: #2563eb;
    color: white;
    border: 2px solid #1d4ed8;
    padding: 15px 25px;
    font-family: 'Press Start 2P', monospace;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.1s;
    border-radius: 6px;
}

.pln-btn:hover { background-color: #3b82f6; transform: scale(1.05); }
.pln-btn:active { transform: scale(0.95); }
.pln-btn:disabled { background-color: #4b5563; border-color: #374151; cursor: not-allowed; transform: none; }

/* Scoreboard Overlay */
.pln-modal-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    border-radius: 10px;
}

.pln-modal-content {
    background: #1f2937;
    padding: 20px;
    border: 2px solid #fbbf24;
    border-radius: 8px;
    text-align: center;
    width: 95%;
    max-width: 1300px; /* Very wide for table */
    max-height: 90%;
    display: flex;
    flex-direction: column;
}

.pln-scoreboard-container {
    overflow-x: auto; /* Horizontal scroll */
    margin-top: 15px;
    border: 1px solid #4b5563;
}

.pln-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.7rem; /* Smaller font for dense table */
    white-space: nowrap;
}

.pln-history-table th, .pln-history-table td {
    border: 1px solid #4b5563;
    padding: 8px;
    text-align: center;
}

.pln-history-table th {
    background: #111827;
    color: #fbbf24;
    position: sticky;
    top: 0;
}

.pln-history-table tr:nth-child(even) {
    background-color: #374151;
}

/* Responsive tweaks for Mobile Devices */
@media (max-width: 600px) {
    #pln-game-wrapper { 
        height: auto; 
        min-height: 80vh; /* Full viewport height */
        padding: 5px; /* Reduced padding */
        min-width: auto; 
    }

    .pln-title { font-size: 1.2rem; }
    .pln-message-bar { font-size: 0.9rem; margin-bottom: 5px; }

    /* Adjust Table Area */
    .pln-table-area { 
        min-width: 100%; 
        min-height: 500px; /* Ensure space for trick zone */
        align-items: flex-start; /* Align trick zone better from top */
        padding-top: 20px; /* Space between header and players */
    } 

    /* Horizontal Alignment of Opponents at Top */
    .pln-avatar { width: 45px; height: 45px; font-size: 1.2rem; margin-bottom: 2px; }
    .pln-stats { font-size: 0.6rem; padding: 2px 4px; }
    .pln-player-spot { padding: 0; width: auto; }

    /* Reposition Opponents to top row */
    .pln-left { 
        top: 10px; 
        left: 5px; 
        width: auto;
        transform: none; /* Reset vertical centering */
    } 
    .pln-top { 
        top: 10px; 
        left: 50%; 
        transform: translateX(-50%); 
        width: auto;
    } 
    .pln-right { 
        top: 10px; 
        right: 5px; 
        width: auto;
        transform: none; /* Reset vertical centering */
    }
    
    /* Center Trick Zone and Create Space */
    .pln-trick-zone { 
        width: 100%; 
        height: 300px; /* Increased height */
        margin-top: 80px; /* Push down to clear top players */
    }
    
    /* Adjust User Position */
    .pln-bottom { bottom: 10px; width: 100%; }

    /* Cards Scaling */
    .pln-card { width: 50px; height: 70px; font-size: 1.2rem; }
    .pln-hand-card { width: 55px; height: 77px; margin: 0 -8px; }
    .pln-c  ard-corner-tl { font-size: 0.9rem; left: 3px; top: 3px; }
    .pln-card-corner-br { font-size: 0.9rem; right: 3px; bottom: 3px; }
    .pln-card-corner-bl { font-size: 1.1rem; left: 3px; bottom: 3px; }
    .pln-card-center { font-size: 1.8rem; }
    
    /* Adjust Played Card Positions for better visual center in new layout */
    .played-1 { top: 45%; left: 30%; } 
    .played-3 { top: 45%; left: 70%; }
    
    .pln-history-table { font-size: 0.5rem; }
}