/* Shared playing-card faces + oval table */

.card-face {
    --card-w: 4.4rem;
    --card-h: 6.2rem;
    position: relative;
    display: inline-block;
    width: var(--card-w);
    height: var(--card-h);
    border-radius: 0.45rem;
    border: 1px solid #c5c0b0;
    background: linear-gradient(165deg, #ffffff 0%, #f7f4ea 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    color: #1a1a1a;
    font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
    vertical-align: top;
    flex-shrink: 0;
    user-select: none;
    overflow: hidden;
}

.card-face.small {
    --card-w: 3.1rem;
    --card-h: 4.4rem;
}

.card-face.tiny {
    --card-w: 2.35rem;
    --card-h: 3.3rem;
    font-size: 0.78rem;
}

.card-face.red {
    color: #c41e2a;
}

.card-face.black {
    color: #141414;
}

.card-face .corner {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 0.95;
    font-weight: 700;
    z-index: 2;
}

.card-face .corner.tl {
    top: 0.18rem;
    left: 0.22rem;
}

.card-face .corner.br {
    bottom: 0.18rem;
    right: 0.22rem;
    transform: rotate(180deg);
}

.card-face .corner .rank {
    font-size: 1.05em;
    letter-spacing: -0.02em;
}

.card-face .corner .suit {
    font-size: 0.78em;
    margin-top: -0.05em;
}

.card-face .pip {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.85em;
    opacity: 0.92;
}

.card-face.tiny .pip {
    font-size: 1.2em;
}

.card-face.fan-card .pip,
.card-face.fan-card .corner.br {
    /* Left strip is what matters when cards overlap */
    opacity: 0.55;
}

.card-face.fan-card:last-child .pip,
.card-face.fan-card:last-child .corner.br,
.card-face.fan-card:hover .pip,
.card-face.fan-card.playable .pip {
    opacity: 0.95;
}

.card-face.playable {
    cursor: pointer;
    outline: 2px solid #e8c547;
    outline-offset: 2px;
    z-index: 30;
}

.card-face.playable:active {
    transform: translateY(-2px);
}

.card-face:disabled,
button.card-face:disabled {
    opacity: 0.72;
    cursor: default;
    outline: none;
}

button.card-face {
    padding: 0;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
}

.card-back {
    width: var(--card-w, 2.2rem);
    height: var(--card-h, 3.1rem);
    border-radius: 0.35rem;
    border: 2px solid #c9a227;
    background:
        linear-gradient(135deg, #5a1d2a 25%, transparent 25%) -0.4rem 0 / 0.8rem 0.8rem,
        linear-gradient(225deg, #5a1d2a 25%, transparent 25%) -0.4rem 0 / 0.8rem 0.8rem,
        linear-gradient(315deg, #5a1d2a 25%, transparent 25%) 0 0 / 0.8rem 0.8rem,
        linear-gradient(45deg, #5a1d2a 25%, transparent 25%) 0 0 / 0.8rem 0.8rem,
        #7a2434;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    display: inline-block;
    flex-shrink: 0;
}

.card-back.tiny {
    --card-w: 1.5rem;
    --card-h: 2.1rem;
}

/* Own hand (play view) – overlapping fan like reference */
.felt-stage {
    margin: 0.75rem 0 0;
    padding: 1rem 0.5rem 1.25rem;
    border-radius: 1rem;
    background:
        radial-gradient(ellipse at center, #2f6b45 0%, #1e4a30 55%, #163624 100%);
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.35);
    color: #f2e6c8;
}

.your-turn-banner {
    text-align: center;
    margin: 0 0 0.85rem;
    font-family: "Palatino Linotype", Palatino, Georgia, serif;
    font-size: 1.15rem;
    letter-spacing: 0.12em;
    color: #e8c547;
    text-transform: uppercase;
}

.your-turn-banner.hidden {
    display: none !important;
}

.your-turn-banner::before,
.your-turn-banner::after {
    content: "✦";
    margin: 0 0.55rem;
    opacity: 0.8;
}

.hand-fan {
    display: flex;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: flex-end;
    gap: 0;
    overflow-x: auto;
    overflow-y: visible;
    padding: 1.25rem 0.75rem 0.85rem;
    min-height: 7.5rem;
}

.hand-fan .card-face.fan-card {
    margin-left: calc(var(--card-w) * -0.62);
    transition: transform 0.12s ease, margin 0.12s ease;
    z-index: 1;
}

.hand-fan .card-face.fan-card:first-child {
    margin-left: 0;
}

.hand-fan .card-face.fan-card:hover,
.hand-fan .card-face.fan-card.playable {
    transform: translateY(-0.85rem);
    z-index: 40;
}

.hand-fan .card-face.fan-card:nth-child(1) { z-index: 1; }
.hand-fan .card-face.fan-card:nth-child(2) { z-index: 2; }
.hand-fan .card-face.fan-card:nth-child(3) { z-index: 3; }
.hand-fan .card-face.fan-card:nth-child(4) { z-index: 4; }
.hand-fan .card-face.fan-card:nth-child(5) { z-index: 5; }
.hand-fan .card-face.fan-card:nth-child(6) { z-index: 6; }
.hand-fan .card-face.fan-card:nth-child(7) { z-index: 7; }
.hand-fan .card-face.fan-card:nth-child(8) { z-index: 8; }
.hand-fan .card-face.fan-card:nth-child(9) { z-index: 9; }
.hand-fan .card-face.fan-card:nth-child(10) { z-index: 10; }
.hand-fan .card-face.fan-card:nth-child(n+11) { z-index: 11; }

.trick-center {
    min-height: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-end;
    gap: 0.65rem;
    margin-bottom: 0.35rem;
}

.trick-center-play {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.trick-center-play .name {
    font-size: 0.8rem;
    opacity: 0.9;
}

.trick-center-play .name.lead-name {
    font-weight: 700;
}

.trick-center-play.trick-leader .card-face,
.table-played-card.trick-leader .card-face {
    box-shadow:
        0 0 0 2px #e8c547,
        0 3px 10px rgba(0, 0, 0, 0.45);
}

.players-status {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin: 0.75rem 0;
    padding: 0.65rem 0.75rem;
    background: rgba(10, 10, 10, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 0.55rem;
    color: #f5f5f5;
}

.player-status-row {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: baseline;
    font-size: 0.95rem;
}

.player-status-row .name {
    font-weight: 500;
    color: #f5f5f5;
}

.player-status-row.trick-lead .name {
    font-weight: 700;
}

.player-status-row.trick-leader {
    outline: 2px solid #e8c547;
    outline-offset: 2px;
    border-radius: 0.35rem;
    padding: 0.15rem 0.35rem;
}

.player-status-row.current-turn .name::after {
    content: " ·";
    color: #e8c547;
}

.player-status-row .meta {
    color: #d7ecdb;
    font-size: 0.88rem;
    white-space: nowrap;
}

.player-body.felt-mode .round-header h2,
.player-body.felt-mode .round-header .phase,
.player-body.felt-mode .round-header .hint {
    color: #e8f5e9;
}

.player-body.felt-mode .bid-section .field {
    color: #e8f5e9;
}

/* Oval table (table view) */
.table-arena {
    position: relative;
    width: 100%;
    max-width: 920px;
    margin: 0.5rem auto 1rem;
    aspect-ratio: 16 / 11;
    min-height: 360px;
}

.table-felt {
    position: absolute;
    inset: 12% 8%;
    border-radius: 50%;
    background:
        radial-gradient(ellipse at center, #348a52 0%, #1f5a36 60%, #143f26 100%);
    border: 10px solid #5c3a1e;
    box-shadow:
        inset 0 0 50px rgba(0, 0, 0, 0.35),
        0 8px 24px rgba(0, 0, 0, 0.45);
}

.table-center-info {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #e8f5e9;
    z-index: 2;
    pointer-events: none;
}

.table-center-info .phase {
    margin: 0.15rem 0;
    color: #d7ecdb;
}

.table-played {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
}

.table-played-card {
    position: absolute;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.45));
    transition: left 280ms ease-out, top 280ms ease-out;
}

.table-played-card.card-flying {
    z-index: 6;
}

.table-played-card.card-landed {
    z-index: 3;
}

.seat {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 7.5rem;
    z-index: 4;
    text-align: center;
}

.seat.trick-leader .seat-plate {
    box-shadow: 0 0 0 2px #e8c547;
}

.seat-plate {
    background: rgba(10, 10, 10, 0.78);
    color: #f5f5f5;
    border-radius: 0.55rem;
    padding: 0.35rem 0.45rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 0.8rem;
    line-height: 1.25;
}

.seat.current .seat-plate {
    box-shadow: 0 0 0 2px #e8c547;
}

.seat.dealer .seat-plate::after {
    content: "D";
    display: inline-block;
    margin-left: 0.35rem;
    width: 1.1rem;
    height: 1.1rem;
    line-height: 1.1rem;
    border-radius: 50%;
    background: #c62828;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
    vertical-align: middle;
}

.seat-name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.seat-meta {
    opacity: 0.85;
    font-size: 0.75rem;
}

.seat-cards {
    display: flex;
    justify-content: center;
    gap: 0.15rem;
    margin-bottom: 0.25rem;
    min-height: 2.2rem;
}

.seat-label {
    position: absolute;
    top: -1.1rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    color: #c9a227;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}

.table-body header {
    background: #1a3324;
}

.table-body {
    background: #0f1a14;
}

.table-body .panel {
    max-width: 980px;
    background: #15241c;
    border-color: #2a4033;
    color: #e8efe9;
}

.table-body .hint,
.table-body .phase {
    color: #a7b8ad;
}

.table-body .players-table,
.table-body #protocolTable {
    color: #e8efe9;
}

.player-body.felt-mode {
    background: #122018;
}

.player-body.felt-mode .panel {
    background: transparent;
    border: none;
    box-shadow: none;
    max-width: 960px;
}

.player-body.felt-mode header {
    background: #1a3324;
}

.trump-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0 0 0.65rem;
    padding: 0.35rem 0.7rem;
    border-radius: 0.55rem;
    background: rgba(10, 10, 10, 0.78);
    border: 1px solid rgba(232, 197, 71, 0.55);
    color: #f5f5f5;
    font-size: 0.9rem;
    line-height: 1.1;
}

.trump-badge.hidden {
    display: none !important;
}

.trump-badge .trump-label {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.72rem;
    color: #e8c547;
}

.trump-badge .trump-symbol {
    font-size: 1.35rem;
}

.trump-badge.red .trump-symbol,
.trump-badge.red .trump-name {
    color: #ff6b73;
}

.trump-badge.black .trump-symbol,
.trump-badge.black .trump-name {
    color: #f0f0f0;
}

.trump-badge.table-trump {
    position: absolute;
    left: 3%;
    top: 4%;
    z-index: 5;
    margin: 0;
}

.round-results-corner {
    position: absolute;
    right: 3%;
    top: 4%;
    z-index: 5;
    min-width: 7.5rem;
    max-width: 11rem;
    padding: 0.4rem 0.55rem;
    border-radius: 0.5rem;
    background: rgba(10, 10, 10, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #eef5ef;
    font-size: 0.72rem;
    line-height: 1.25;
}

.round-results-corner.hidden {
    display: none !important;
}

.round-results-corner .title {
    color: #e8c547;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.65rem;
    margin-bottom: 0.3rem;
}

.round-results-corner .round-result-row {
    display: flex;
    justify-content: space-between;
    gap: 0.45rem;
    margin: 0.12rem 0;
}

.round-results-corner .name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.round-results-corner .detail {
    opacity: 0.9;
    white-space: nowrap;
}

.seat-order-section {
    margin: 0.75rem 0 1rem;
}

.seat-order-list {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
}

.seat-order-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin: 0.35rem 0;
    padding: 0.35rem 0.45rem;
    border-radius: 0.4rem;
    background: rgba(0, 0, 0, 0.06);
}

.seat-order-number {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: #c62828;
    color: #fff;
    font-weight: 700;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.seat-order-name {
    flex: 1;
    font-weight: 600;
}

.seat-order-actions {
    display: flex;
    gap: 0.25rem;
}

.seat-order-actions button {
    padding: 0.15rem 0.45rem;
    min-width: 2rem;
}

.checkbox-field {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.55rem;
}

.checkbox-field input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
}

@media (max-width: 640px) {
    .card-face {
        --card-w: 3.4rem;
        --card-h: 4.8rem;
    }

    .hand-fan .card-face.fan-card {
        margin-left: calc(var(--card-w) * -0.58);
    }

    .seat {
        width: 5.8rem;
    }

    .table-arena {
        min-height: 300px;
    }
}
