body {
    min-height: 100vh;
    background: linear-gradient(135deg, #102016 0%, #1a3c2a 45%, #0f172a 100%);
}

.game-container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 20px;
}

.header h1,
.breadcrumb,
.breadcrumb a {
    color: #f8fafc;
}

.game-area {
    position: relative;
    background: rgba(255, 255, 255, 0.96);
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.status {
    min-height: 1.7em;
    margin: 12px 0 16px;
    color: #17324d;
    font-weight: 700;
    font-size: 1.15rem;
    text-align: center;
}

.online-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.opponent-name {
    color: #475569;
    font-weight: 700;
}

.scoreboard {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0 auto 18px;
    max-width: 680px;
}

.score-card {
    border: 2px solid #d9e7dd;
    border-radius: 14px;
    padding: 12px 14px;
    background: #f8fff9;
    color: #17324d;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.score-card.active {
    border-color: #22c55e;
    background: #ecfdf3;
}

.score-name {
    display: block;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.score-points {
    display: block;
    margin-top: 4px;
    color: #166534;
    font-weight: 800;
}

.gin-table {
    display: grid;
    grid-template-columns: 1fr minmax(220px, 280px) 1fr;
    gap: 18px;
    align-items: stretch;
}

.opponent-zone,
.player-zone,
.pile-zone,
.analysis-card,
.result-panel {
    border: 1px solid #dce8df;
    border-radius: 16px;
    background: #f8fafc;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.opponent-zone,
.player-zone {
    padding: 14px;
}

.zone-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.zone-heading h2,
.analysis-card h2 {
    margin: 0;
    color: #17324d;
    font-size: 1.05rem;
}

.zone-summary {
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 700;
}

.card-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    min-height: 108px;
    align-content: flex-start;
}

.gin-card {
    width: 58px;
    min-width: 58px;
    height: 84px;
    border: 2px solid #cbd5e1;
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    color: #0f172a;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 7px 5px;
    font-weight: 900;
    box-shadow: 0 5px 12px rgba(15, 23, 42, 0.16);
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.gin-card:hover:not(:disabled),
.gin-card.selected {
    transform: translateY(-6px);
    border-color: #22c55e;
    box-shadow: 0 10px 20px rgba(34, 197, 94, 0.22);
}

.gin-card:disabled {
    cursor: default;
}

.gin-card.red-suit {
    color: #dc2626;
}

.gin-card.black-suit {
    color: #111827;
}

.gin-card .rank {
    font-size: 1.05rem;
    line-height: 1;
}

.gin-card .suit {
    font-size: 1.45rem;
    line-height: 1;
}

.card-back {
    background: repeating-linear-gradient(45deg, #14532d, #14532d 8px, #166534 8px, #166534 16px);
    border-color: #bbf7d0;
    color: #f0fdf4;
    justify-content: center;
    font-size: 1.5rem;
}

.pile-zone {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    padding: 16px;
    background: #ecfdf3;
}

.pile-card {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
}

.pile-button {
    min-height: 108px;
    border: 2px dashed #16a34a;
    border-radius: 14px;
    background: #f0fdf4;
    color: #14532d;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 800;
}

.pile-button.discard {
    border-style: solid;
    background: #fff7ed;
    color: #9a3412;
}

.pile-icon {
    font-size: 2.2rem;
}

.discard-card-label {
    display: flex;
    align-items: center;
    justify-content: center;
}

.pile-card button:not(.pile-button),
.action-buttons button,
.game-buttons button,
.pass-card button {
    padding: 10px 14px;
    border: none;
    border-radius: 10px;
    background: #1d4ed8;
    color: white;
    font-weight: 800;
    cursor: pointer;
    transition: opacity 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.pile-card button:not(.pile-button):hover:not(:disabled),
.action-buttons button:hover:not(:disabled),
.game-buttons button:hover:not(:disabled),
.pass-card button:hover:not(:disabled) {
    transform: translateY(-1px);
    background: #2563eb;
}

button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
}

.analysis-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(180px, 1fr);
    gap: 14px;
    margin-top: 16px;
}

.analysis-card {
    padding: 14px;
}

.meld-summary {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
    color: #334155;
}

.meld-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
}

.meld-label {
    min-width: 58px;
    color: #166534;
    font-weight: 800;
}

.mini-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 40px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: white;
    font-weight: 900;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.12);
}

.mini-card.red-suit {
    color: #dc2626;
}

.deadwood-value {
    margin: 10px 0 4px;
    color: #b45309;
    font-size: 2.4rem;
    font-weight: 900;
    text-align: center;
}

.deadwood-note {
    margin: 0;
    color: #64748b;
    text-align: center;
    font-weight: 700;
}

.action-buttons,
.game-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

#knock-btn {
    background: #f59e0b;
}

#knock-btn:hover:not(:disabled) {
    background: #d97706;
}

#gin-btn {
    background: #16a34a;
}

#gin-btn:hover:not(:disabled) {
    background: #15803d;
}

#exit-game-btn.btn-secondary,
#restart-btn {
    background: #475569;
}

.message-log {
    min-height: 1.4em;
    margin-top: 12px;
    color: #334155;
    font-weight: 700;
    text-align: center;
}

.result-panel {
    margin-top: 16px;
    padding: 16px;
    color: #17324d;
}

.result-panel h2,
.result-panel h3 {
    margin: 0 0 10px;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.result-hand {
    border: 1px solid #dce8df;
    border-radius: 12px;
    background: white;
    padding: 12px;
}

.result-hand .card-row {
    min-height: auto;
    justify-content: flex-start;
}

.pass-cover {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.88);
}

.game-area .game-buttons {
    position: relative;
    z-index: 11;
}

.pass-card {
    max-width: 420px;
    width: 100%;
    padding: 28px;
    border-radius: 18px;
    background: white;
    color: #17324d;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.pass-card h2 {
    margin-top: 0;
}

.pass-hint {
    color: #64748b;
    font-weight: 700;
}

@media (max-width: 900px) {
    .gin-table {
        grid-template-columns: 1fr;
    }

    .pile-zone {
        flex-direction: row;
    }

    .pile-card {
        flex: 1;
    }
}

@media (max-width: 620px) {
    .game-container {
        padding: 12px;
    }

    .game-area {
        padding: 16px;
    }

    .scoreboard,
    .analysis-grid,
    .result-grid {
        grid-template-columns: 1fr;
    }

    .pile-zone {
        flex-direction: column;
    }

    .gin-card {
        width: 48px;
        min-width: 48px;
        height: 70px;
        padding: 5px 4px;
    }

    .gin-card .suit {
        font-size: 1.15rem;
    }

    .card-row {
        gap: 6px;
        min-height: 86px;
    }
}
