.hidden {
    display: none !important;
}

.setup-screen,
.game-area {
    background: rgba(255, 255, 255, 0.96);
    border-radius: 16px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.14);
    color: #1a1a2e;
    margin: 20px auto;
    max-width: 1120px;
    padding: 24px;
}

.setup-screen {
    max-width: 560px;
    text-align: center;
}

.setup-screen .input-group {
    align-items: center;
    display: flex;
    gap: 14px;
    justify-content: space-between;
    margin: 16px auto;
    max-width: 420px;
}

.setup-screen select {
    border: 2px solid #d9e2f2;
    border-radius: 10px;
    color: #1a1a2e;
    font-size: 1rem;
    padding: 10px 12px;
}

#back-to-modes,
#back-to-modes-from-setup {
    margin-top: 14px;
}

.tile-rummy-stats {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 16px 0;
}

.tile-rummy-stats span,
.opponent-card,
.result-panel,
.action-log {
    background: #f6f8ff;
    border: 1px solid #dfe7fb;
    border-radius: 12px;
    padding: 10px 12px;
}

.turn-indicator {
    background: linear-gradient(135deg, #1a1a2e, #253064);
    border-radius: 12px;
    color: #fff;
    font-weight: 700;
    margin: 12px 0;
    padding: 12px 16px;
    text-align: center;
}

.status {
    background: #fff7df;
    border: 1px solid #ffe08a;
    border-radius: 12px;
    color: #5b4200;
    font-weight: 700;
    margin: 12px 0;
    min-height: 46px;
    padding: 12px 16px;
}

.online-info {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 10px;
}

.online-badge {
    background: #1a7f37;
    border-radius: 999px;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 5px 10px;
}

.opponents-summary {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin: 16px 0;
}

.opponent-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.opponent-card strong {
    color: #202449;
}

.opponent-card .melded {
    color: #1a7f37;
    font-weight: 700;
}

.opponent-card .not-melded {
    color: #9a6700;
    font-weight: 700;
}

.section-heading {
    align-items: flex-start;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
}

.section-heading h2 {
    color: #1a1a2e;
    margin: 0;
}

.section-heading p {
    color: #536079;
    margin: 4px 0 0;
}

.rack-heading-row {
    align-items: center;
}

.sort-controls,
.turn-controls,
.game-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.small-btn {
    background: #edf2ff;
    border: 1px solid #c8d5f4;
    border-radius: 999px;
    color: #24305c;
    cursor: pointer;
    font-weight: 700;
    padding: 8px 12px;
}

.small-btn.active {
    background: #24305c;
    color: #fff;
}

.table-area,
.rack-area {
    background: #ffffff;
    border: 1px solid #e3e8f5;
    border-radius: 16px;
    margin: 18px 0;
    padding: 18px;
}

.table-sets {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    margin-top: 16px;
}

.empty-table {
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 14px;
    color: #64748b;
    grid-column: 1 / -1;
    padding: 28px;
    text-align: center;
}

.table-set {
    background: linear-gradient(180deg, #f8fbff, #eef4ff);
    border: 2px solid #d8e3f8;
    border-radius: 14px;
    padding: 12px;
}

.table-set.chosen {
    border-color: #6c63ff;
    box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.16);
}

.set-header {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    margin-bottom: 10px;
}

.set-header span {
    color: #27345f;
    font-weight: 800;
}

.set-header button {
    background: #fff;
    border: 1px solid #c8d5f4;
    border-radius: 999px;
    color: #24305c;
    cursor: pointer;
    font-weight: 700;
    padding: 6px 10px;
}

.set-header button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.set-tiles,
.rack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.rack {
    align-items: center;
    background: #eef2f7;
    border-radius: 14px;
    min-height: 92px;
    margin-top: 16px;
    padding: 14px;
}

.tile {
    align-items: center;
    background: #fff;
    border: 3px solid currentColor;
    border-radius: 10px;
    box-shadow: 0 3px 0 rgba(15, 23, 42, 0.14);
    color: #111827;
    cursor: pointer;
    display: inline-flex;
    flex-direction: column;
    font-family: inherit;
    font-weight: 900;
    height: 68px;
    justify-content: center;
    min-width: 48px;
    padding: 6px;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.tile:hover:not(:disabled) {
    box-shadow: 0 6px 12px rgba(15, 23, 42, 0.18);
    transform: translateY(-2px);
}

.tile:disabled {
    cursor: not-allowed;
    opacity: 0.72;
}

.tile.selected {
    background: #fff4cc;
    box-shadow: 0 0 0 4px rgba(255, 193, 7, 0.35);
    transform: translateY(-4px);
}

.tile-number {
    font-size: 1.35rem;
    line-height: 1;
}

.tile-color-mark {
    font-size: 0.78rem;
    line-height: 1;
    margin-top: 5px;
}

.tile-red {
    color: #d62828;
}

.tile-blue {
    color: #1664c0;
}

.tile-green {
    color: #18864b;
}

.tile-orange {
    color: #d66a00;
}

.turn-controls {
    margin: 18px 0 12px;
}

.turn-controls button,
.game-buttons button,
#start-game-btn {
    background: linear-gradient(135deg, #6c63ff, #5147d9);
    border: none;
    border-radius: 10px;
    color: #fff;
    cursor: pointer;
    font-size: 0.98rem;
    font-weight: 800;
    padding: 12px 16px;
}

.turn-controls button:disabled,
.game-buttons button:disabled {
    cursor: not-allowed;
    filter: grayscale(0.3);
    opacity: 0.45;
}

.turn-controls .btn-secondary,
.game-buttons .btn-secondary,
.setup-screen .btn-secondary {
    background: #e9edf7;
    color: #253064;
}

.action-log {
    color: #334155;
    font-weight: 700;
    min-height: 44px;
    text-align: center;
}

.result-panel {
    background: #eafaf0;
    border-color: #9be7b0;
    color: #14532d;
    font-weight: 800;
    margin: 14px 0;
    text-align: center;
}

.result-panel ul {
    display: inline-block;
    margin: 8px auto 0;
    padding-left: 20px;
    text-align: left;
}

@media (max-width: 760px) {
    .setup-screen,
    .game-area {
        border-radius: 12px;
        margin: 12px;
        padding: 16px;
    }

    .tile-rummy-stats {
        grid-template-columns: 1fr;
    }

    .section-heading,
    .rack-heading-row,
    .setup-screen .input-group {
        align-items: stretch;
        flex-direction: column;
    }

    .sort-controls,
    .turn-controls,
    .game-buttons {
        align-items: stretch;
        flex-direction: column;
    }

    .tile {
        height: 58px;
        min-width: 42px;
    }

    .tile-number {
        font-size: 1.12rem;
    }

    .table-sets {
        grid-template-columns: 1fr;
    }
}
