body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f0f0f0;
    text-align: center;
}

#lobby {
    max-width: 400px;
    margin: 50px auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

#lobby input {
    width: 80%;
    padding: 10px;
    margin: 10px 0;
}

.btn {
    padding: 10px 20px;
    font-size: 1.1rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s;
    font-weight: bold;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    background: #ccc !important;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #0056b3;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

#lobby button {
    width: 85%;
}

#game {
    max-width: 600px;
    margin: 0 auto;
}

.header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

#diceContainer {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

.die {
    width: 60px;
    height: 60px;
    background: white;
    border: 2px solid #333;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.die.held {
    background: #ffcc00;
}

.die.rolling {
    animation: spin 0.1s linear infinite, blur 0.5s linear infinite;
}

.die {
    transition: transform 0.3s ease-out;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes blur {
    0%, 100% { filter: blur(0px); }
    50% { filter: blur(2px); }
}

table {
    width: 100%;
    background: white;
    border-collapse: collapse;
    margin: 20px 0;
}

th, td {
    border: 1px solid #ccc;
    padding: 10px;
}

.preview-score {
    color: #888;
    font-style: italic;
}

tr.scored {
    background-color: #e8f5e9;
}

tr.available-cat:hover {
    background-color: #f5f5f5;
    cursor: pointer;
}

.current-player-row {
    background-color: #d1ecf1;
}

#scoreboard {
    max-width: 900px;
    margin: 20px auto;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
}

#rankingList {
    list-style-position: inside;
    font-size: 1.5rem;
    padding: 0;
    margin: 20px 0;
}

#rankingList li {
    margin: 10px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
}

.table-container {
    overflow-x: auto;
    margin: 20px 0;
}

#breakdownTable {
    width: 100%;
}

#breakdownTable th {
    background: #007bff;
    color: white;
}

#backToLobby {
    margin-top: 20px;
}

#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.toast {
    background: #333;
    color: white;
    padding: 12px 24px;
    margin-bottom: 10px;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    animation: fadeInOut 3s forwards;
    font-weight: bold;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-20px); }
    10% { opacity: 1; transform: translateY(0); }
    90% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-20px); }
}

.die.grayed-out {
    background: #e0e0e0;
    color: #888;
    border-color: #bbb;
    cursor: default;
}

#orderDiceContainer {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    margin: 20px 0;
}

.order-die-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

#orderList {
    list-style: none;
    padding: 0;
    margin: 20px 0;
}

#orderList li {
    padding: 8px;
    background: white;
    border: 1px solid #ddd;
    margin-bottom: 5px;
    border-radius: 4px;
}

@media (max-width: 600px) {
    .die {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
}
