* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #1e1e1e;
    color: #eee;
}

.container {
    max-width: 500px;
    margin: 40px auto;
    padding: 20px;
}

.card {
    background: #2a2a2a;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

input, select, button {
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    border-radius: 6px;
    border: none;
    font-size: 16px;
}

button {
    background: #4a4a4a;
    color: white;
    cursor: pointer;
}

button:hover {
    background: #5a5a5a;
}

.hidden {
    display: none;
}

.game {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.header {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: #2a2a2a;
}

#board {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.set {
    display: flex;
    gap: 4px;
    padding: 8px;
    margin-bottom: 8px;
    background: #2a2a2a;
    border-radius: 8px;
    min-height: 60px;
}

.tile {
    width: 44px;
    height: 60px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.tile.black { background: #222; color: white; }
.tile.red { background: #c0392b; color: white; }
.tile.blue { background: #2980b9; color: white; }
.tile.yellow { background: #f1c40f; color: black; }
.tile.joker { background: #555; color: white; }

#rack {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 10px;
    background: #2a2a2a;
    min-height: 80px;
}

.actions {
    display: flex;
    gap: 8px;
    padding: 10px;
    background: #2a2a2a;
}

.actions button {
    flex: 1;
}

.drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.8;
}

/* Must win over .game { display: flex; }. */
.hidden {
    display: none !important;
}

.status {
    margin: 0;
    padding: 12px 16px;
    background: #303030;
    overflow-wrap: anywhere;
}

#players {
    padding: 0;
    list-style: none;
}

#players li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #444;
}

#players button {
    width: auto;
    margin: 0;
}

#tableQr,
#qr {
    display: block;
    margin: 16px auto;
    background: white;
    max-width: 100%;
    object-fit: contain;
}

.game-help {
    margin: 0;
    padding: 10px;
    color: #ccc;
}

.tile {
    flex: 0 0 44px;
}

.set {
    overflow-x: auto;
}

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

@media (max-width: 600px) {
    .container {
        margin: 12px auto;
        padding: 12px;
    }

    .actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .game {
        height: 100dvh;
    }
}