/* Cribbage — shared by the solo (cribbage.html) and online (cribbage-online.html) pages */

.board-wrap {
    background: #5d4037;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    max-width: 700px;
    margin: 10px auto;
    padding: 8px 10px;
}

.board-wrap svg { display: block; width: 100%; height: auto; }

.score-bar {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 8px auto;
    flex-wrap: wrap;
}

.player-chip {
    background: white;
    border: 3px solid transparent;
    border-radius: 999px;
    padding: 6px 16px;
    font-size: 15px;
    font-weight: bold;
    color: #555;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.player-chip.active { border-color: #f9a825; background: #fffde7; color: #333; }

.player-chip .dealer-tag {
    background: #5d4037;
    color: white;
    border-radius: 999px;
    font-size: 11px;
    padding: 1px 8px;
    margin-left: 6px;
    vertical-align: middle;
}

.chip-p0 { border-left: 8px solid #1565c0; }
.chip-p1 { border-left: 8px solid #c62828; }

/* Table zones */
.table-zone { max-width: 760px; margin: 0 auto 20px; padding: 0 6px; }

.opp-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    min-height: 70px;
}

.opp-row .card-back, .crib-zone .card-back {
    width: 46px;
    height: 66px;
    border-radius: 5px;
    background: linear-gradient(135deg, #5d4037, #8d6e63);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), inset 0 0 0 2px rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.opp-row .card-back img, .crib-zone .card-back img { width: 60%; opacity: 0.9; }

.opp-fan { display: flex; }

.opp-fan .card-back { margin-left: -26px; }

.opp-fan .card-back:first-child { margin-left: 0; }

.crib-zone {
    display: flex;
    align-items: center;
    gap: 10px;
}

.crib-zone .crib-label { color: #555; font-weight: bold; font-size: 13px; text-align: center; }

.crib-stack { position: relative; width: 52px; height: 66px; }

.crib-stack .card-back { position: absolute; top: 0; }

.starter-card img { width: 46px; border-radius: 5px; background: white; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3); }

/* Pegging area */
.peg-area {
    background: rgba(255, 255, 255, 0.75);
    border-radius: 12px;
    min-height: 108px;
    margin: 10px 0;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.count-bubble {
    background: #5d4037;
    color: white;
    border-radius: 50%;
    width: 58px;
    height: 58px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.count-bubble .num { font-size: 20px; line-height: 1; }
.count-bubble .lbl { font-size: 9px; opacity: 0.8; }

.played-stack { display: flex; }

.played-stack img {
    width: 46px;
    border-radius: 5px;
    margin-left: -26px;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.played-stack img:first-child { margin-left: 0; }

.played-stack img.old-round { filter: grayscale(0.8) brightness(0.85); }

.peg-flash {
    background: #fff8e1;
    border: 2px solid #f9a825;
    color: #6d4c00;
    font-weight: bold;
    border-radius: 8px;
    padding: 4px 12px;
    animation: pegflash-in 0.3s ease;
}

@keyframes pegflash-in { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* My hand + actions */
.my-hand {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 100px;
    align-items: flex-end;
}

.my-hand img {
    width: clamp(52px, 11vw, 78px);
    border-radius: 6px;
    background: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
    transition: transform 0.15s;
}

.my-hand img.selectable { cursor: pointer; }
.my-hand img.selectable:hover { transform: translateY(-6px); }
.my-hand img.selected { transform: translateY(-14px); outline: 3px solid #1565c0; outline-offset: -3px; }
.my-hand img.unplayable { opacity: 0.45; }

.action-bar { text-align: center; margin: 10px 0; min-height: 46px; }

.action-btn {
    padding: 12px 26px;
    border: none;
    border-radius: 10px;
    background: #5d4037;
    color: white;
    font-size: 17px;
    font-weight: bold;
    cursor: pointer;
    margin: 0 6px;
}

.action-btn:disabled { opacity: 0.5; cursor: default; }
.action-btn.primary { background: #2e7d32; }

/* Show-phase breakdown */
.show-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    max-width: 460px;
    margin: 10px auto;
    padding: 12px 16px;
    text-align: left;
}

.show-panel h3 { margin: 0 0 8px; color: #5d4037; font-size: 16px; }

.show-panel .show-cards { display: flex; gap: 4px; justify-content: center; margin-bottom: 8px; }

.show-panel .show-cards img { width: 46px; border-radius: 5px; background: white; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }

.show-panel .show-cards img.starter { outline: 3px solid #f9a825; outline-offset: -3px; }

.show-panel table { width: 100%; border-collapse: collapse; font-size: 14px; }

.show-panel td { padding: 3px 4px; border-bottom: 1px solid #eee; }

.show-panel td:last-child { text-align: right; font-weight: bold; }

.show-panel .total-row td { border-top: 2px solid #5d4037; border-bottom: none; font-weight: bold; }

/* Setup / lobby reuse (online page) */
.setup-box, .join-box, .lobby-box {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    max-width: 420px;
    margin: 20px auto;
    padding: 20px;
}

.join-box input, .lobby-box input {
    display: block;
    width: 90%;
    margin: 8px auto;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #ccc;
    border-radius: 8px;
    text-align: center;
}

.join-box button, .lobby-box button, .big-start-btn {
    width: 95%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    background: #5d4037;
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 8px;
}

.join-divider { color: #999; margin: 10px 0; }

.join-error { color: #c62828; font-weight: bold; min-height: 20px; margin-top: 8px; }

.room-code-display { font-size: 40px; font-weight: bold; letter-spacing: 8px; color: #5d4037; }

.lobby-box ul { list-style: none; padding: 0; font-size: 17px; }

@media (max-width: 700px) {
    .opp-row .card-back, .crib-zone .card-back { width: 38px; height: 54px; }
    .played-stack img, .starter-card img, .show-panel .show-cards img { width: 40px; }
}
