* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-image: url('/images/spradlins.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: white;
    min-height: 100vh;
    position: relative;
}

/* Add overlay to improve text readability */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: -1;
}

.screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
}

.hidden {
    display: none !important;
}

/* Login Screen */
.login-container {
    background: rgba(139, 69, 19, 0.9); /* Saddle brown with transparency */
    border-radius: 15px;
    padding: 40px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 215, 0, 0.5); /* Gold border */
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.login-container h1 {
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-form input {
    padding: 15px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 16px;
}

.login-form input::placeholder {
    color: #666;
}

.login-form select {
    padding: 15px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 14px;
    cursor: pointer;
    height: 50px;
    box-sizing: border-box;
}

.login-form select option {
    background: white;
    color: #333;
}

.login-form button {
    padding: 15px;
    border: none;
    border-radius: 8px;
    background: #e74c3c;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.login-form button:hover {
    background: #c0392b;
}

/* Lobby Screen */
.lobby-container {
    background: rgba(139, 69, 19, 0.9); /* Saddle brown with transparency */
    border-radius: 15px;
    padding: 30px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 215, 0, 0.5); /* Gold border */
    max-width: 600px;
    width: 100%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.lobby-container h2 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 2em;
}

.room-info {
    text-align: center;
    margin-bottom: 20px;
}

.room-info p {
    margin: 5px 0;
    font-size: 1.1em;
}

.players-list {
    margin-bottom: 20px;
}

.players-list h3 {
    margin-bottom: 10px;
}

.players-list ul {
    list-style: none;
}

.players-list li {
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    margin: 5px 0;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-ready {
    background: rgba(0, 100, 0, 0.4) !important;
}

.lobby-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
}

.lobby-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    background: #3498db;
    color: white;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s;
}

.lobby-actions button:hover {
    background: #2980b9;
}

.lobby-actions button.ready {
    background: #2ecc71;
}

.lobby-actions button.ready:hover {
    background: #27ae60;
}

/* Game Screen */
.game-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.game-header {
    margin-bottom: 20px;
}

.scores {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(139, 69, 19, 0.9); /* Saddle brown */
    padding: 15px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 215, 0, 0.3); /* Gold border */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.team-score {
    text-align: center;
    padding: 15px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    min-width: 200px;
}

.team-score.my-team {
    background: rgba(46, 204, 113, 0.2);
    border-color: #2ecc71;
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.3);
}

.team-score h3 {
    margin-bottom: 10px;
    font-size: 1.2em;
    color: #ecf0f1;
}

.team-score.my-team h3 {
    color: #2ecc71;
    text-shadow: 0 0 10px rgba(46, 204, 113, 0.5);
}

.team-players {
    margin-bottom: 10px;
    font-size: 0.9em;
}

.team-players .player-name {
    display: block;
    padding: 2px 0;
    color: #bdc3c7;
}

.team-players .player-name.current-user {
    color: #f39c12;
    font-weight: bold;
}

.team-score .score {
    font-size: 2.5em;
    font-weight: bold;
    color: #ecf0f1;
}

.team-score.my-team .score {
    color: #2ecc71;
}

.game-info {
    text-align: center;
    padding: 15px;
}

.game-info p {
    margin: 8px 0;
    font-size: 1.1em;
    color: #ecf0f1;
}

.current-player {
    font-weight: bold;
    color: #f39c12 !important;
    background: rgba(243, 156, 18, 0.1);
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid rgba(243, 156, 18, 0.3);
}

.game-board-container {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.game-board {
    flex: 1;
    min-height: 300px;
    background: radial-gradient(ellipse at center, #0d5016 0%, #0a3d11 100%); /* Green felt texture */
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid #8B4513; /* Brown border to look like table edge */
    box-shadow: 
        inset 0 0 20px rgba(0, 0, 0, 0.3),
        0 8px 32px rgba(0, 0, 0, 0.5);
    position: relative;
}

/* Add subtle felt texture */
.game-board::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 50%, transparent 20%, rgba(255,255,255,0.02) 21%, rgba(255,255,255,0.02) 34%, transparent 35%, transparent),
        linear-gradient(0deg, rgba(255,255,255,0.02) 50%, transparent 50%);
    border-radius: 15px;
    pointer-events: none;
}

.game-messages-sidebar {
    width: 250px;
    background: rgba(139, 69, 19, 0.9); /* Saddle brown */
    border-radius: 10px;
    padding: 15px;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    border: 2px solid rgba(255, 215, 0, 0.3); /* Gold border */
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.game-messages-sidebar h4 {
    margin-bottom: 10px;
    color: #ecf0f1;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 8px;
}

.game-messages {
    flex: 1;
    overflow-y: auto;
    max-height: 250px;
    padding-right: 5px;
}

.game-messages::-webkit-scrollbar {
    width: 6px;
}

.game-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.game-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.game-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.played-cards {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.current-trick {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 20px;
    justify-items: center;
    align-items: center;
}

.played-card-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.played-card {
    transform: scale(0.8);
    pointer-events: none;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.4);
}

.player-label {
    font-size: 0.9em;
    font-weight: bold;
    color: #ecf0f1;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

.player-hand {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.player-hand h3 {
    margin-bottom: 10px;
    text-align: center;
}

.hand-cards {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: center;
}

.card {
    width: 90px;
    height: 126px;
    background: white;
    border-radius: 12px;
    border: 2px solid #333;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    font-size: 18px;
    font-weight: bold;
    color: #333;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    padding: 8px;
    box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.3);
    font-family: 'Arial', sans-serif;
}

.card * {
    pointer-events: none; /* Prevent child elements from intercepting clicks */
}

.card:hover {
    transform: translateY(-12px);
    box-shadow: 3px 8px 16px rgba(0, 0, 0, 0.4);
}

.card.red {
    color: #e74c3c;
}

.card.playable {
    border-color: #2ecc71;
    box-shadow: 0 0 15px rgba(46, 204, 113, 0.7);
}

.card.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.card.disabled:hover {
    transform: none;
}

/* Card layout for standard cards */
.card .rank-suit-top {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1;
    position: absolute;
    top: 8px;
    left: 8px;
}

.card .rank-suit-bottom {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    transform: rotate(180deg);
    line-height: 1;
    position: absolute;
    bottom: 8px;
    right: 8px;
}

.card .rank {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 2px;
}

.card .suit {
    font-size: 16px;
}

.card .center-suit {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 32px;
    opacity: 0.8;
    font-weight: bold;
}

/* Special styling for joker */
.card.joker {
    background: linear-gradient(135deg, #8e44ad, #3498db);
    color: white;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.card.joker .rank-suit-top,
.card.joker .rank-suit-bottom,
.card.joker .center-suit {
    display: none;
}

.game-actions {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.bidding-section, .trump-selection {
    margin-bottom: 15px;
}

.bidding-section h3, .trump-selection h3 {
    margin-bottom: 10px;
    text-align: center;
}

.bid-btn, .trump-btn {
    padding: 10px 15px;
    margin: 5px;
    border: none;
    border-radius: 5px;
    background: #3498db;
    color: white;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s, opacity 0.3s;
}

.bid-btn:hover, .trump-btn:hover {
    background: #2980b9;
}

.bid-btn:disabled, .trump-btn:disabled {
    background: #7f8c8d;
    cursor: not-allowed;
    opacity: 0.6;
}

.bid-btn:disabled:hover, .trump-btn:disabled:hover {
    background: #7f8c8d;
}

.trump-btn {
    font-size: 24px;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    border: 2px solid #8B4513;
}

.trump-btn[data-suit="hearts"] {
    color: #e74c3c; /* Red for hearts */
}

.trump-btn[data-suit="diamonds"] {
    color: #e74c3c; /* Red for diamonds */
}

.trump-btn[data-suit="spades"] {
    color: #000; /* Black for spades */
}

.trump-btn[data-suit="clubs"] {
    color: #000; /* Black for clubs */
}

.trump-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.05);
}

.game-phase-indicator {
    background: rgba(255, 255, 255, 0.1);
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: bold;
}

.game-messages div {
    margin: 5px 0;
    padding: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    font-size: 0.9em;
    line-height: 1.3;
}

.message.info {
    border-left: 3px solid #3498db;
}

.message.success {
    border-left: 3px solid #2ecc71;
}

.message.error {
    border-left: 3px solid #e74c3c;
}

/* Responsive Design */
@media (max-width: 768px) {
    .scores {
        flex-direction: column;
        gap: 10px;
    }
    
    .game-board-container {
        flex-direction: column;
    }
    
    .game-messages-sidebar {
        width: 100%;
        order: -1;
        max-height: 150px;
    }
    
    .hand-cards {
        gap: 2px;
    }
    
    .card {
        width: 70px;
        height: 98px;
        font-size: 14px;
        padding: 6px;
    }
    
    .card .rank {
        font-size: 16px;
    }
    
    .card .suit {
        font-size: 12px;
    }
    
    .card .center-suit {
        font-size: 24px;
    }
    
    .card .rank-suit-top {
        top: 6px;
        left: 6px;
    }
    
    .card .rank-suit-bottom {
        bottom: 6px;
        right: 6px;
    }
    
    .game-actions {
        text-align: center;
    }
}

@media (max-width: 480px) {
    .card {
        width: 60px;
        height: 84px;
        font-size: 12px;
        padding: 4px;
    }
    
    .card .rank {
        font-size: 14px;
    }
    
    .card .suit {
        font-size: 10px;
    }
    
    .card .center-suit {
        font-size: 20px;
    }
    
    .card .rank-suit-top {
        top: 4px;
        left: 4px;
    }
    
    .card .rank-suit-bottom {
        bottom: 4px;
        right: 4px;
    }
}

.scoring-display {
    margin-bottom: 15px;
}

.scoring-breakdown {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    line-height: 1.4;
}

.scoring-breakdown h4 {
    color: #FFD700;
    margin-bottom: 10px;
    text-align: center;
    font-size: 1.2em;
}

.point-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    margin-bottom: 8px;
}

.point-line:last-child {
    border-bottom: none;
}

.point-line:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}

/* Grid layout for points */
.points-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px 25px;
    margin-bottom: 20px;
}

.point-item {
    display: flex;
    flex-direction: column;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.point-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.point-name {
    font-weight: bold;
    font-size: 1em;
    color: #FFD700;
}


.point-detail {
    font-style: italic;
    color: #ccc;
    font-size: 0.85em;
    line-height: 1.2;
    text-align: left;
}

.point-winner {
    font-weight: bold;
    font-size: 0.9em;
}

.point-winner.team1 {
    color: #2ecc71;
}

.point-winner.team2 {
    color: #3498db;
}

.scoring-totals {
    display: flex;
    justify-content: space-around;
    background: rgba(255, 215, 0, 0.2);
    border-radius: 8px;
    padding: 15px 10px;
    margin-top: 20px;
    border: 1px solid #FFD700;
}

.team-total {
    text-align: center;
}

.team-total h5 {
    margin-bottom: 8px;
    color: #FFD700;
    font-size: 1em;
}

.team-total .total-points {
    font-size: 1.8em;
    font-weight: bold;
}

.next-hand-btn {
    width: 100%;
    padding: 12px;
    background: #2ecc71;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.next-hand-btn:hover {
    background: #27ae60;
}

.next-hand-btn:disabled {
    background: #7f8c8d;
    cursor: not-allowed;
}

.bid-result {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
}

.bid-result.bid-made {
    background: rgba(46, 204, 113, 0.2);
    border: 1px solid #2ecc71;
    color: #2ecc71;
}

.bid-result.bid-failed {
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid #e74c3c;
    color: white;
}

/* Responsive: single column on small screens */
@media (max-width: 768px) {
    .points-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

.game-over-info {
    background: rgba(255, 215, 0, 0.3);
    border: 2px solid #FFD700;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
    text-align: center;
}

.game-over-info h4 {
    color: #FFD700;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.game-over-info p {
    margin: 8px 0;
    font-size: 1.1em;
}

.game-over-info .winner {
    font-size: 1.3em;
    font-weight: bold;
    color: #FFD700;
    margin-top: 15px;
}

/* Chat Section */
.chat-section {
    margin-bottom: 20px;
}

.chat-messages {
    height: 200px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 10px;
    overflow-y: auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-message {
    margin-bottom: 8px;
    font-size: 0.9em;
    line-height: 1.3;
}

.chat-player {
    font-weight: bold;
    margin-right: 5px;
}

.chat-player.team1 {
    color: #2ecc71;
}

.chat-player.team2 {
    color: #3498db;
}

.chat-text {
    color: #fff;
}

.chat-input {
    display: flex;
    gap: 8px;
}

.chat-input input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 0.9em;
}

.chat-input input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.chat-input input:focus {
    outline: none;
    border-color: #FFD700;
    background: rgba(255, 255, 255, 0.15);
}

.chat-input button {
    padding: 8px 15px;
    background: #FFD700;
    color: #000;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    font-size: 0.9em;
}

.chat-input button:hover {
    background: #FFA500;
}

.chat-input button:disabled {
    background: #7f8c8d;
    cursor: not-allowed;
}

/* Trick Winner Notification */
.trick-winner-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    pointer-events: none;
}

.notification-content {
    background: rgba(255, 215, 0, 0.95);
    color: #000;
    padding: 20px 30px;
    border-radius: 12px;
    font-size: 1.4em;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    border: 2px solid #FFD700;
    animation: trickWinnerSlide 3s ease-in-out;
}

@keyframes trickWinnerSlide {
    0% {
        opacity: 0;
        transform: translateY(-30px);
    }
    20%, 80% {
        opacity: 1;
        transform: translateY(0);
    }
    100% {
        opacity: 0;
        transform: translateY(30px);
    }
}

.trick-winner-notification.hidden {
    display: none;
}

.joker {
    position: relative;
    overflow: hidden;
}

.joker-full-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}