* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #e5e7eb; /* gris clar amb més contrast de les cartes blanques */
    font-family: Arial, sans-serif;
    display: flex;
    justify-content: center;
}

#game-container {
    width: 100%;
    max-width: 1000px;
    padding: 16px;
}

h1 {
    text-align: center;
    margin-bottom: 10px;
    color: #111827; /* text més fosc */
}

h2 {
    margin: 10px 0;
    text-align: center;
    color: #111827;
}

/* Barra de jugadors */
#players-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    overflow-x: auto;
}

.player-panel {
    flex: 1;
    min-width: 0;
    background: #ffffff;
    border-radius: 10px;
    padding: 8px;
    text-align: center;
    box-shadow: 0 0 5px #b1b1b1; /* ombra una mica més marcada */
    font-size: 14px;
}

.player-panel .player-name {
    font-weight: bold;
    margin-bottom: 4px;
    color: #111827;
}

.player-panel .player-tiles-count {
    color: #374151;
}

.player-panel.active {
    border: 2px solid #1d4ed8; /* blau més profund */
    box-shadow: 0 0 8px rgba(37, 99, 235, 0.65);
}

/* Taula de combinacions */
#table {
    min-height: 160px;
    background: #ffffff;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 0 5px #9ca3af;
    margin-bottom: 12px;
}

.meld-row {
    margin-bottom: 8px;
    padding: 4px;
    display: inline-flex;
    flex-wrap: wrap;
    border-radius: 8px;
    background: #f8fafc; /* lleugerament més clar que el fons global */
    box-shadow: 0 0 3px #9ca3af;
}

/* Fitxes */
.tile {
    display: inline-block;
    padding: 6px 10px;
    margin: 2px;
    background: #ffffff;
    border-radius: 6px;
    border: 2px solid #374151; /* contorn més fosc */
    font-weight: bold;
    font-size: 14px;
    user-select: none;
    color: #111827;
}

.tile.joker {
    border-style: dashed;
}

#player-tiles .tile {
    cursor: pointer;
}

#player-tiles .tile.selected {
    background: #1d4ed8; /* blau intens */
    color: #ffffff;
}

/* Zona inferior */
#bottom-area {
    margin-top: 12px;
}

#timer {
    margin-bottom: 8px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    color: #111827;
}

/* Accions jugador */
#player-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

#player-actions button {
    padding: 10px 14px;
    border-radius: 8px;
    border: none;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 0 4px #6b7280; /* ombra una mica més fosca */
}

/* Botons principals */
#btn-play {
    background: #22c55e; /* verd una mica més viu */
    color: white;
}

#btn-draw {
    background: #f59e0b; /* groc-taronja més contrastat */
    color: #111827;
}

/* Botons d’ordenació */
#btn-group,
#btn-scale {
    background: #d1d5db; /* gris amb més contrast */
    color: #111827;
}

/* Modal final */
#modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.80); /* fons fosc lleugerament blau */
    display: flex;
    justify-content: center;
    align-items: center;
}

.hidden {
    display: none !important;
}

#modal-content {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    width: 80%;
    max-width: 400px;
    box-shadow: 0 0 10px rgba(15, 23, 42, 0.85);
}

#modal-content button {
    margin-top: 10px;
    padding: 10px 12px;
    width: 100%;
    border-radius: 8px;
    border: none;
    cursor: pointer;
}

#btn-new {
    background: #22c55e;
    color: white;
}

#btn-exit {
    background: #dc3545;
    color: white;
}

#exit-config {
    margin-top: 16px;
}

#exit-config input {
    width: 100%;
    padding: 8px;
    margin-bottom: 6px;
}

/* Responsive mòbil */
@media (max-width: 600px) {
    #game-container {
        padding: 10px;
    }
    .tile {
        font-size: 12px;
        padding: 4px 6px;
    }
}
