/* General Body & Typography */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.container {
    width: 95%;
    max-width: 1400px; /* Allow wider view on large screens */
    margin: 0 auto;
    padding: 10px 0;
}
main.container {
    flex-grow: 1;
}
h1, h2, h3, h4 {
    color: #005f73;
}
a {
    color: #0077b6;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* Header & Footer */
.main-header {
    background-color: #005f73;
    color: #ffffff;
    padding: 10px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.main-header .logo {
    font-size: 1.8em;
    font-weight: bold;
    color: #ffffff;
}
.main-header .logo:hover {
    text-decoration: none;
}
.main-header nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
}
.main-header nav ul li {
    display: inline-block;
    margin-left: 20px;
}
.main-header nav a {
    color: #ffffff;
    font-size: 1.1em;
}
.main-footer {
    background-color: #333;
    color: #f4f7f6;
    text-align: center;
    padding: 15px 0;
    margin-top: auto;
}

/* Login/Register Form Wrapper */
.wrapper {
    width: 100%;
    max-width: 400px;
    margin: 50px auto;
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.wrapper h2 {
    text-align: center;
    margin-bottom: 20px;
}
.wrapper p {
    text-align: center;
}
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}
.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
}
.has-error .form-control {
    border-color: #dc3545;
}
.help-block {
    color: #dc3545;
    font-size: 0.9em;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 25px;
    background-color: #0077b6;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.1em;
    text-align: center;
    transition: background-color 0.3s;
}
.btn:hover {
    background-color: #005f73;
    text-decoration: none;
}
.btn-primary {
    background-color: #007bff;
}
.btn-primary:hover {
    background-color: #0069d9;
}
.btn-default {
    background-color: #6c757d;
    width: 100%;
    margin-top: 10px;
}
.btn-success {
    background-color: #218838;
}
.btn-success:hover {
    background-color: #1e7e34;
}

/* Dashboard */
.dashboard-container {
    text-align: center;
}
.game-selection {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-top: 40px;
    flex-wrap: wrap;
}
.game-card {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    width: 300px;
    text-align: left;
}

/* Memory Match Game & Photo Album (can be condensed if not used often) */
/* ... */

/* --- Hand and Foot Game Page --- */
.hand-and-foot-container {
    max-width: 1400px;
    margin: 0 auto;
}
#game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #e9ecef;
    padding: 8px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
}
#game-header h1 {
    font-size: 1.5em;
    margin: 0;
}
#game-info span {
    margin-left: 20px;
}
#players-area {
    background: #fff;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
}
.team-area {
    margin-bottom: 10px;
}
.player-tag {
    display: inline-block;
    background: #0077b6;
    color: #fff;
    padding: 5px 10px;
    border-radius: 15px;
    margin: 0 5px;
    font-size: 0.9em;
}
.player-tag.current-player-you {
    border: 2px solid #333;
}
.player-tag.current-turn {
    box-shadow: 0 0 10px 3px yellow;
    font-weight: bold;
}
#game-controls {
    text-align: center;
    margin-bottom: 10px;
    min-height: 45px;
}
#game-board {
    background: #006A4E;
    color: white;
    padding: 15px;
    border-radius: 10px;
}
#center-piles {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 15px 0;
}
.pile {
    width: 80px;
    height: 112px;
    border: 2px dashed rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    position: relative;
}
.pile.clickable {
    border: 3px dashed #ffc107;
    cursor: pointer;
}
#stock-pile .card-back {
    width: 72px;
    height: 104px;
    background: repeating-linear-gradient(45deg, #4a90e2, #4a90e2 10px, #50a3f0 10px, #50a3f0 20px);
    border: 1px solid #fff;
    border-radius: 4px;
    margin: 3px;
}
#stock-count {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 5px;
    border-radius: 5px;
    font-size: 0.8em;
}
.card-area {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 8px;
    border-radius: 8px;
    min-height: 120px;
}

/* --- NEW CARD VISUAL STYLES --- */
.card {
    width: 75px;
    height: 105px;
    background-color: white;
    border: 1px solid #333;
    border-radius: 5px;
    position: relative;
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: bold;
    font-size: 14px;
}
.card.red { color: #D60000; }
.card.black { color: #000000; }
.card .rank {
    position: absolute;
    top: 5px;
    left: 7px;
}
.card .suit {
    position: absolute;
    top: 20px;
    left: 7px;
    font-size: 12px;
}
.card .suit-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
    opacity: 0.7;
}
.card.joker .suit-center {
    font-size: 18px;
    text-align: center;
    line-height: 1.1;
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
.card.selected {
    transform: translateY(-15px);
    box-shadow: 0 6px 15px 4px #ffc107;
}
.card.sortable-ghost {
    opacity: 0.4;
    background: #ccc;
}
#player-actions {
    text-align: center;
    padding: 10px;
    min-height: 50px;
}
.action-btn {
    margin: 0 8px;
    padding: 10px 20px;
    font-size: 1em;
}
#game-log {
    margin-top: 20px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    max-height: 200px;
    overflow-y: auto;
}
#log-messages p {
    margin: 2px 0;
    font-size: 0.9em;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 2px;
}

/* --- Meld Display Styles --- */
#melds-area {
    background: rgba(0, 0, 0, 0.1);
    padding: 10px;
    border-radius: 8px;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.team-melds {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}
.team-melds h4 {
    width: 100%;
    margin: 0 0 5px 0;
    font-size: 1em;
    text-shadow: 1px 1px 2px black;
}
.meld-container {
    position: relative;
    width: 75px;
    height: 105px;
    cursor: pointer;
}
.meld-container.dirty .card {
    border: 2px solid #ffc107;
}
.meld-container.book .card {
    box-shadow: 0 0 10px 4px gold;
}
.meld-container .card { cursor: default; }
.meld-container .card:hover { transform: none; box-shadow: none; }
.meld-stack-card {
    position: absolute;
    top: 0;
    left: 0;
}
.meld-card-count {
    position: absolute;
    bottom: 5px;
    right: 5px;
    color: white;
    font-size: 1.1em;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 5px;
    border: 1px solid white;
    z-index: 10;
    min-width: 20px;
    text-align: center;
}
.meld-card-count.counter-clean { background-color: #c82333; }
.meld-card-count.counter-dirty { background-color: #23272b; }
.go-out-intent {
    color: #ffc107;
    font-weight: bold;
    text-align: center;
    background-color: rgba(255, 193, 7, 0.1);
    border: 1px solid #ffc107;
    border-radius: 5px;
    padding: 5px;
    margin: 0 0 10px 0;
    width: 100%;
}

/* --- Lobby and Score Summary Styles --- */
.score-summary-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 20px 0;
    text-align: left;
}
.score-card {
    background: #fff;
    color: #333;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    width: 300px;
}
.score-card h2, .score-card h3 {
    text-align: center;
    margin-top: 0;
}
.score-card p {
    display: flex;
    justify-content: space-between;
    font-size: 1.1em;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
    margin-bottom: 5px;
}
.score-card hr {
    border: none;
    border-top: 1px solid #ccc;
    margin: 10px 0;
}
.lobby-teams-container {
    display: flex;
    justify-content: space-around;
    gap: 20px;
    margin: 20px 0;
}
.lobby-team-box {
    flex: 1;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    min-height: 150px;
}
.lobby-team-box h3 {
    margin-top: 0;
    text-align: center;
    border-bottom: 2px solid #ccc;
    padding-bottom: 10px;
}
.lobby-join-buttons {
    text-align: center;
    margin-top: 20px;
}
.lobby-join-buttons .btn {
    margin: 0 10px;
}


/* --- MOBILE RESPONSIVENESS --- */
@media screen and (max-width: 800px) {
    .container {
        width: 95%;
    }
    .main-header nav ul {
        display: none;
    }
    #game-board {
        padding: 10px;
    }
    #melds-area {
        flex-direction: column;
    }
    .team-melds {
        gap: 10px;
    }
    .card {
        width: 60px;
        height: 84px;
        font-size: 12px;
    }
    .card .suit-center {
        font-size: 28px;
    }
    .card.selected {
        transform: translateY(-10px);
    }
    .pile {
        width: 66px;
        height: 90px;
    }
    #stock-pile .card-back {
        width: 60px;
        height: 84px;
    }
    .meld-container {
        width: 60px;
        height: 84px;
    }
    .meld-container .card {
        width: 60px;
        height: 84px;
    }
    .meld-stack-card {
        top: 0;
        left: 0;
    }
    .meld-card-count {
        font-size: 1em;
        bottom: 5px;
        right: 5px;
        padding: 2px 6px;
    }
    .meld-title {
        display: none;
    }
    #player-actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    .action-btn {
        width: 100%;
        padding: 12px;
        margin: 0;
        font-size: 1em;
    }
    .lobby-teams-container {
        flex-direction: column;
    }
    .score-summary-container {
        flex-direction: column;
    }
    .score-card {
        width: auto;
    }
}