h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #591405;
}

.cloud-save-restore {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-bottom: 20px;
    background: white;
    padding: 15px 28px;
    margin-top: 20px;
    border-radius: 32px;
}

.mode-selector {
    display: flex;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
    background: white;
    padding: 15px;
    margin-top: 20px;
    border-radius: 10px;
    border: dotted 1px #be4f23;
    background: #fff7f1;
}

.header p:not(:first-child) {
    margin-top: 20px;
}

.header ul {
    list-style: none;
    padding: 0;
    margin: 0;
    margin-top: 16px;
}

.header ul li {
    padding: 8px 12px;
    margin-bottom: 10px;
    background: #e3e3e3;
    border-radius: 6px;
}

.mode-selector label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: 500;
}

.mode-selector input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

@media (max-width: 600px) {
    .game-info {
        flex-direction: column;
        gap: 10px;
    }
}

.steps-counter,
.keys-inventory {
    font-size: 18px;
    color: #333;
    display: flex;
    align-items: center;
    gap: 6px;
}

.keys-inventory strong {
    margin-right: 10px;
}

#keys-display {
    display: flex;
    gap: 8px;
}

#keys-display p {
    font-size: 18px;
}

.key-item {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.pieces-list {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    background: white;
    padding: 10px;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow-y: auto;
}

.piece-item {
    /*border: 2px solid #ddd;*/
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.piece-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    /*border-color: #667eea;*/
}

.piece-item.used {
    opacity: 0.4;
    cursor: not-allowed;
}

.piece-item.selected {
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.piece-item.not-placeable {
    opacity: 0.5;
    filter: grayscale(70%);
    border-color: #999;
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.piece-item.not-placeable:hover {
    transform: none;
    box-shadow: none;
}

.piece-item.free-placement-piece {
    cursor: grab;
}

.piece-item.free-placement-piece:active {
    cursor: grabbing;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(90deg);
    }
}

.game-board-container {
    display: flex;
    background: white;
    border-radius: 10px;
    position: relative;
    overflow: auto;
}

.mode-game .game-board-container {
    padding-bottom: 20px;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    flex-shrink: 0;
    gap: 5px;
    margin: auto;
    box-sizing: content-box;
    border: solid 5px #444;
    padding: 4px;
    border-radius: 2px;
    position: relative;
}

.mode-freePlacement .game-board {
    margin: 160px;
    margin-top: 700px;
}

.board-cell {
    width: 100%;
    height: 100%;
    border: 2px solid #ddd;
    border-radius: 5px;
    position: relative;
    background: #f9f9f9;
    display: flex;
    align-items: center;
    justify-content: center;
}

.board-cell.has-piece {
    border: none;
    /*border-color: #333;*/
}

.board-cell.player-position {
    /*border: 3px solid #ff6b6b;*/
    /*box-shadow: 0 0 15px rgba(255, 107, 107, 0.6);*/
    box-shadow: 0 0 3px 4px rgba(255, 107, 107, 0.6);
}

.piece-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.message-area,
.room-description,
.lexique-info {
    margin-top: 20px;
    padding: 15px;
    background: #F2F2F2;
    border-radius: 10px;
    min-height: 50px;
    text-align: center;
    border: dotted 1px transparent;
}

.lexique-info {
    text-align: left;
}

.room-description {
    font-family: monospace;
    font-size: 14px;
}

.message-area.info {
    background: #e3f2fd;
    color: #1976d2;
    border-color: #1976d2;
}

.message-area.error {
    background: #ffebee;
    color: #c62828;
    border-color: #c62828;
}

.message-area.success {
    background: #e8f5e9;
    color: #2e7d32;
    border-color: #2e7d32;
}

.lexique-info {
    background: #fff7f1;
    border-color: #be4f23;
}

#debug-list {
    display: none;
}

@media (min-width: 768px) {
    .mode-selector {
        flex-direction: row;
    }
}

.confirm-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(3px);
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    min-width: 300px;
    text-align: center;
    max-width: 600px;
}

.modal-actions {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    gap: 12px;
}

.main-button {
    background-color: #be4f23;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}

.main-button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.secondary-button {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
}
