.button.green.icon-restart {
    margin: 6rem auto 0 auto;
}


body.game-active #gameRoot:has(.game-screen.bridge) {
    background-color: #cdeaf1;
    background-image:
        url('/games/bridge/assets/water.png'),
        url('/games/bridge/assets/sky.jpg');

    background-position:
        bottom center,
        top center;

    background-size:
        100% 70%,
        100% auto;

    background-repeat:
        no-repeat,
        no-repeat;
}


.left-cliff {}

:root {
    --cell-width: 40px;
    --cell-height: 40px;
}

@media (max-width: 480px) {
    :root {
        --cell-width: 30px;
        --cell-height: 30px;
    }
}

.bridge-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    position: relative;
    max-width: 1000px;
    min-height: 160px;
    margin: 1rem auto 0 auto;
    padding-bottom: 5rem;
}

.cliff {
    width: 100%;
    height: 300px;
    background-size: auto 100%;
    background-repeat: no-repeat;
    flex-shrink: 0;
    z-index: 2;
}

.left-cliff {
    background-image: url('/games/bridge/assets/left-cliff.png');
    background-position: top right;
}

.right-cliff {
    background-image: url('/games/bridge/assets/right-cliff.png');
    background-position: top left;
}

.bridge-grid-wrapper {
    position: relative;
    height: var(--cell-height);
    display: inline-block;
}

.bridge-grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: var(--cell-width);
    gap: 0;
    height: 100%;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.7);
    outline: 2px dotted rgba(255, 255, 255, 0.9);
    overflow: hidden;
    box-shadow:
        0 0 0 2px rgba(255, 255, 255, 0.6);

}

.grid-cell {
    width: var(--cell-width);
    height: var(--cell-height);
    position: relative;
    transition: background 0.2s;
    border-right: 2px dotted rgba(255, 255, 255, 0.9);
    box-sizing: border-box;
}

.grid-cell:last-of-type {

    border-right: none;

}

.grid-cell.highlight {
    background: rgba(255, 215, 0, 0.6);
    box-shadow: inset 0 0 10px rgba(255, 215, 0, 0.8);
}

.placed-pieces-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.placed-pieces-layer .bridge-piece {
    pointer-events: auto;
}

.bridge-piece {
    height: var(--cell-height);
    display: flex;
    align-items: center;
    cursor: grab;
    user-select: none;
    z-index: 20;
    border-radius: 4px;
}

.bridge-piece span {
    flex: 1;
    height: var(--cell-height);
    background-image: url('/games/bridge/assets/bridge.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    border-right: 1px solid rgba(0, 0, 0, 0.1);
}

.bridge-piece span:last-child {
    border-right: none;
}


.bridge-dino {
    position: absolute;
    margin-top: calc(-1 * var(--cell-height) - 30px);
    left: 7%;
    width: 40px;
    height: 40px;
    z-index: 30;
    background: url('/games/bridge/assets/dino.png') no-repeat center/contain;
    pointer-events: none;
}

.bridge-dino.walk {
    animation: dino-walk 3s linear forwards;
}

@keyframes dino-walk {
    from {
        left: 80px;
    }

    to {
        left: calc(100% - 130px);
    }
}

.bridge-tray {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-top: 2rem;
}


.bridge-tray .bridge-piece {
    position: relative;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: transform 0.1s;
}

.bridge-tray .bridge-piece:hover {
    transform: translateY(-2px);
}