/* The table itself: play area, cards, hand sections, bidding, blind bidding, results, bottom nav. */
/* PLAY AREA */
.play-area {
    padding: 20px 8px;
    margin-bottom: 12px;
    min-height: 140px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.play-area.hidden-for-phase {
    display: none;
}

.trick-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    gap: 20px;
    flex-wrap: wrap;
}

.trick-card {
    background: white;
    border: 2px solid #333;
    border-radius: 10px;
    padding: 16px 12px;
    width: 120px;
    height: 140px;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex-shrink: 0;
}

.trick-card .player-name {
    font-size: 13px;
    font-weight: 600;
    color: #666;
    margin-bottom: 6px;
}

.trick-card .card-content {
    font-size: 32px;
    font-weight: bold;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.trick-card-placeholder {
    width: 120px;
    height: 140px;
    border: 2px dashed #ccc;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #999;
    font-size: 14px;
    flex-shrink: 0;
}

/* CARD COLORS */
.trick-card.spade,
.card.spade,
.spade {
    color: #000;
}

.trick-card.heart,
.card.heart,
.heart {
    color: #ff0000;
}

.trick-card.diamond,
.card.diamond,
.diamond {
    color: #ff6200;
}

.trick-card.club,
.card.club,
.club {
    color: #333;
}

/* MESSAGES */
.message {
    text-align: center;
    padding: 10px 12px;
    margin-bottom: 20px;
    border-radius: 6px;
    font-weight: 400;
    background: #f8f9fa;
    color: #495057;
    font-size: 14px;
    line-height: 1.3;
    border-left: 4px solid #6c757d;
}

.message.success {
    color: #28a745;
    border-left-color: #28a745;
}

.message.error {
    color: #dc3545;
    border-left-color: #dc3545;
}

/* GAME OVER (2026-09-06): one quiet card. Result, ratchet bar, four-number tally, actions. */
.game-over {
    text-align: center;
    padding: 22px 18px 18px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}
.go-result { font-size: 26px; font-weight: 700; color: #333; line-height: 1.1; }
.go-result.won { color: #28a745; }
.go-result.lost { color: #6c757d; }
.go-score { font-size: 14px; color: #666; margin-top: 4px; }
.go-ratchet { margin: 18px auto 0; max-width: 340px; }
.go-ratchet-text { font-size: 14px; font-weight: 600; color: #333; margin-bottom: 8px; }
.go-bar { position: relative; height: 8px; background: #e9ecef; border-radius: 4px; }
.go-bar-fill { position: absolute; top: 0; height: 100%; border-radius: 4px; background: #667eea; }
.go-bar-fill.down { background: #dc3545; }
.go-bar-mark { position: absolute; top: 50%; width: 14px; height: 14px; margin-left: -7px; transform: translateY(-50%);
    border-radius: 50%; background: #fff; border: 2px solid #adb5bd; box-sizing: border-box; }
.go-bar-mark.after { border-color: #667eea; background: #667eea; }
.go-bar-rungs { display: flex; justify-content: space-between; font-size: 10px; color: #999; margin-top: 6px;
    text-transform: uppercase; letter-spacing: 0.04em; }
.go-ratchet-why { font-size: 12px; color: #777; margin-top: 10px; line-height: 1.5; }
.go-why-line { padding: 5px 0; text-align: left; }
.go-why-line + .go-why-line { border-top: 1px solid #ececf2; }
.go-why-line b { display: block; color: #444; font-weight: 600; }
.go-why-line span { display: block; color: #999; }
.go-why-link { display: block; color: #5a67d8; text-decoration: none; }
.go-why-link:hover { text-decoration: underline; }
.go-tally { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 18px 0 0; }
.go-tile { background: #f8f9fa; border-radius: 8px; padding: 10px 4px; }
.go-tile-v { font-size: 18px; font-weight: 700; color: #333; }
.go-tile-k { font-size: 10px; color: #888; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.04em; }
.go-hands { margin-top: 16px; overflow-x: auto; }
.go-hands-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.go-hands-table th { font-size: 10px; color: #888; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; padding: 4px 6px; border-bottom: 1px solid #e9ecef; }
.go-hands-table td { padding: 5px 6px; border-bottom: 1px solid #f1f3f5; color: #333; }
.go-hands-table td:first-child { color: #999; }
.go-hands-table td.set { color: #dc3545; }
.go-slash { color: #aaa; padding: 0 1px; }
.go-hands-table td.go-mid { white-space: nowrap; }
.go-hands-table .heart { color: #dc3545; }
.go-mid-w { color: #999; font-size: 11px; }
.go-history { margin-top: 22px; padding-top: 16px; border-top: 1px solid #e9ecef; }
.go-history-title { font-size: 14px; font-weight: 600; color: #333; }
.go-history-title small { color: #999; font-weight: 400; }
.go-history .go-tally { margin-top: 10px; }
.go-rungs { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: #666; }
.go-rungs b { color: #333; }
/* Actions sit under the ratchet dial, above the tally: three small buttons, one color each. */
.go-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; }
.game-over .go-btn { display: inline-flex; align-items: center; gap: 5px; padding: 8px 10px; font-size: 12px;
    min-width: 0; border-radius: 6px; background: none; box-shadow: none; }
.game-over .go-btn:hover:not(:disabled) { transform: none; filter: brightness(1.08); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15); }
.go-again { background: #28a745 !important; }
.go-share { background: #1976d2 !important; }
.go-detail { background: #fd7e14 !important; }

/* HAND OVER (2026-09-06): the summary takes the board's place. Same shell as .game-over. */
.hand-over { text-align: center; padding: 20px 18px 16px; background: #fff; border: 1px solid #e9ecef;
    border-radius: 12px; margin-bottom: 15px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08); }
.ho-title { font-size: 12px; color: #999; text-transform: uppercase; letter-spacing: 0.06em; }
.ho-line { font-size: 17px; font-weight: 600; color: #333; margin-top: 4px; line-height: 1.3; }
.ho-scores { display: flex; justify-content: center; gap: 28px; margin: 14px 0 16px; }
.ho-score-v { font-size: 26px; font-weight: 700; color: #333; }
.ho-score-v small { font-size: 13px; font-weight: 600; color: #888; }
.ho-score-v small.up { color: #28a745; }
.ho-score-v small.down { color: #dc3545; }
.ho-score-v small.bags { color: #e67e22; }
.ho-score-k { font-size: 11px; color: #888; text-transform: uppercase; letter-spacing: 0.04em; }
.ho-notes { display: flex; flex-direction: column; gap: 4px; text-align: center; }
.ho-note { font-size: 13px; color: #555; }
.ho-note.bad { color: #dc3545; }
.ho-note.good { color: #28a745; }
.ho-middle { margin-top: 14px; font-size: 13px; color: #555; }
.ho-middle .heart { color: #dc3545; }
.ho-middle-info { color: #888; }
.ho-section { margin-top: 18px; text-align: left; }
.ho-h { font-size: 11px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; text-align: center; }
.ho-mid-cards { display: flex; justify-content: center; gap: 28px; }
.ho-mid { text-align: center; }
.ho-mid .card { cursor: default; margin: 0 auto; }
.ho-mid-k { font-size: 11px; color: #888; margin-top: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.ho-middle { text-align: center; margin-top: 8px; }
.ho-notes { margin-top: 0; }
.ho-laydown { font-size: 13px; color: #555; background: #fff8e1; border: 1px solid #ffe08a; border-radius: 6px; padding: 8px 10px; margin-bottom: 8px; line-height: 1.4; }
.ho-laydown .held { color: #28a745; }
.ho-laydown .missed { color: #dc3545; }
.trick-line.laid { opacity: 0.6; }
.trick-line.laid .trick-number::after { content: '·'; margin-left: 3px; color: #e0a800; }
.trick-winner.you { color: #28a745; }
.trick-winner.marta { color: #6c757d; }
@media (min-width: 640px) { .trick-history { grid-template-columns: 1fr 1fr; } }

/* The play / discard button stretches to the hand's width on every screen (Andy, 2026-09-06) */
.controls #actionButton { display: block; width: 100%; padding: 16px 20px; font-size: 18px; border-radius: 10px; }

/* Otto Matic, the referee (2026-09-06): a lay down on the table */
.referee { background: #fff8e1; border: 2px solid #f6c453; border-radius: 12px; padding: 16px 18px; margin-bottom: 15px; text-align: center; }
.referee-who { font-size: 11px; font-weight: 700; color: #a07a1a; text-transform: uppercase; letter-spacing: 0.08em; }
.referee-call { font-size: 17px; font-weight: 600; color: #333; margin-top: 6px; line-height: 1.3; }
.referee-why { font-size: 13px; color: #555; margin-top: 6px; line-height: 1.4; }
.referee-actions { display: flex; gap: 10px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.referee-lay { background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%); padding: 14px 22px; font-size: 16px; }
.referee-play { background: #fff; color: #333; border: 2px solid #ccc; padding: 14px 22px; font-size: 16px; }

/* BUTTONS */
button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* NEXT HAND BUTTON */

.next-hand-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    padding: 16px 20px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.next-hand-btn:hover {
    background: linear-gradient(135deg, #45a049 0%, #4CAF50 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

/* HAND SECTIONS */
.hand-section {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 15px;
}

.hand-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* CARD GRIDS */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 8px;
    justify-content: center;
    margin-bottom: 12px;
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
}

.card {
    background: white;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 14px 8px;
    min-width: 70px;
    min-height: 90px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 18px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card:hover:not(.disabled) {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.card.selected {
    border-color: #4CAF50;
    background: #e8f5e9;
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(76, 175, 80, 0.4);
}

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

/* MOBILE OPTIMIZATIONS */
@media (max-width: 767px) {

    /* Compact 5x2 card layout */
    .cards {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        grid-template-rows: auto auto auto;
        gap: 5px;
        max-width: 300px;
        margin: 0 auto 10px auto;
    }

    .card {
        min-width: 50px;
        min-height: 65px;
        font-size: 14px;
        padding: 8px 4px;
        border-radius: 5px;
    }

    .card:hover:not(.disabled) {
        transform: translateY(-2px);
        box-shadow: 0 3px 6px rgba(0, 0, 0, 0.2);
    }

    .card.selected {
        transform: translateY(-2px);
        box-shadow: 0 3px 8px rgba(76, 175, 80, 0.4);
    }

    .hand-section {
        padding: 10px;
        margin-bottom: 12px;
    }
}

/* BIDDING SECTIONS */
.bidding-section {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
    text-align: center;
}

.bid-first-value { color: #1976d2; }
.bidding-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.bidding-prompt {
    font-size: 14px;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.3;
}

.bid-buttons[hidden], .bid-confirmation-buttons[hidden] { display: none; }   /* the bid is in, Marta's turn */

.bid-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 10px;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
}

.bid-buttons button {
    padding: 12px 6px;
    font-size: 14px;
    background: #6c757d;
    color: white;
    font-weight: 600;
    min-width: 40px;
    border-radius: 6px;
    min-height: 50px;
}

.bid-buttons button:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* Mobile bidding 6x2 layout */
@media (max-width: 767px) {
    .bid-buttons {
        display: grid;
        grid-template-columns: repeat(6, 1fr);
        grid-template-rows: auto auto;
        gap: 4px;
        max-width: 300px;
    }

    .bid-buttons button {
        padding: 8px 2px;
        font-size: 11px;
        min-width: 45px;
        border-radius: 4px;
        min-height: 36px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

    .bid-buttons button small {
        font-size: 8px;
        margin-top: 1px;
        opacity: 0.9;
    }

    /* 6x2 grid arrangement */
    .bid-buttons button:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }

    .bid-buttons button:nth-child(2) {
        grid-column: 2;
        grid-row: 1;
    }

    .bid-buttons button:nth-child(3) {
        grid-column: 3;
        grid-row: 1;
    }

    .bid-buttons button:nth-child(4) {
        grid-column: 4;
        grid-row: 1;
    }

    .bid-buttons button:nth-child(5) {
        grid-column: 5;
        grid-row: 1;
    }

    .bid-buttons button:nth-child(6) {
        grid-column: 6;
        grid-row: 1;
    }

    .bid-buttons button:nth-child(7) {
        grid-column: 1;
        grid-row: 2;
    }

    .bid-buttons button:nth-child(8) {
        grid-column: 2;
        grid-row: 2;
    }

    .bid-buttons button:nth-child(9) {
        grid-column: 3;
        grid-row: 2;
    }

    .bid-buttons button:nth-child(10) {
        grid-column: 4;
        grid-row: 2;
    }

    .bid-buttons button:nth-child(11) {
        grid-column: 5 / span 2;
        grid-row: 2;
        min-width: 90px;
    }
}

/* BID CONFIRMATION BUTTONS */
#confirmBidButton {
    background: #28a745;
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    margin-right: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

#confirmBidButton:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4);
}

#cancelBidButton {
    background: #6c757d;
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

#cancelBidButton:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.bid-btn.selected {
    background: #28a745;
    color: white;
    border: 3px solid #1e7e34;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

/* BLIND BIDDING */
.blind-decision-section {
    background: #fff2f2;
    border: 2px solid #e57373;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

.blind-bidding-section {
    background: #fff2f2;
    border: 2px solid #e57373;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
}

.blind-header h3 {
    color: #d32f2f;
    margin-bottom: 6px;
    font-size: 16px;
    font-weight: 600;
}

.blind-header p {
    font-size: 12px;
    margin-bottom: 6px;
    color: #333;
    line-height: 1.3;
}

.blind-warning {
    background: #ffcdd2;
    color: #d32f2f;
    padding: 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    margin-bottom: 8px;
}

.blind-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    max-width: 280px;
    margin: 0 auto;
}

.blind-bid-btn {
    background: #d32f2f;
    color: white;
    font-weight: 600;
    padding: 12px 6px;
    font-size: 12px;
    min-height: 45px;
}

.blind-bid-btn:hover {
    background: #c62828;
    transform: translateY(-2px);
}

@media (max-width: 767px) {
    .blind-buttons {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        grid-template-rows: auto auto;
        gap: 6px;
        max-width: 250px;
    }

    /* the shared 6x2 nth-child placement above pins buttons 4-6 to columns 4-6 of a 3-column grid; let these flow */
    .bid-buttons.blind-buttons .blind-bid-btn { grid-column: auto; grid-row: auto; }

    .blind-bid-btn {
        padding: 10px 4px;
        font-size: 11px;
        min-height: 40px;
        border-radius: 5px;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        line-height: 1.1;
    }
}

.trick-history {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2px 14px;
    font-size: 13px;
    background: #f8f9fa;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}
.trick-line { display: flex; gap: 6px; align-items: baseline; padding: 3px 0; }
.trick-number { color: #999; font-size: 11px; width: 26px; }
.trick-cards { color: #333; }
.trick-winner { color: #28a745; font-size: 11px; margin-left: auto; }

/* BOTTOM NAVIGATION */
.bottom-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    padding: 4px 8px;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.1);
    z-index: 997;
    text-align: center;
    border-top: 1px solid #e9ecef;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.bottom-new-game-btn,
.bottom-rules-btn {
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    height: 22px;
    min-width: 50px;
}

.bottom-new-game-btn {
    background: #dc3545;
    color: white;
}

.bottom-new-game-btn:hover {
    background: #c82333;
}

.bottom-rules-btn {
    background: #28a745;
    color: white;
}

.bottom-rules-btn:hover {
    background: #218838;
}

#toggleComputerHand {
    font-size: 12px;
    padding: 6px 10px;
    background: #6c757d;
    border-radius: 4px;
}

#toggleComputerHand:hover {
    background: #5a6268;
}


/* Estimated game outcome after this hand's scoring. */
.ho-forecast { font-size: 12.5px; color: #666; text-align: center; padding: 7px 8px; margin: 8px 0 2px;
          background: #f5f6fb; border-radius: 7px; line-height: 1.45; }
.ho-forecast b { display: block; color: #333; }
.ho-forecast details { margin-top: 5px; }
.ho-forecast summary { cursor: pointer; color: #4b5292; }
.ho-forecast details[open] summary { margin-bottom: 5px; }
