.game-room-layout {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
    gap: 1.5rem;
    width: 100%;
    padding: 1rem 0;
}

.game-room-board {
    flex-shrink: 0;
}

.game-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin: 0 auto;
    padding: 0;
}

.player-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: var(--board-size-px, 480px);
    padding: 6px 0;
    box-sizing: border-box;
}

.board-row {
    padding: 0;
    margin: 0;
}

.player-info {
    flex-grow: 1;
    display: flex;
    align-items: center;
}

.clock-container {
    margin-left: 12px;
}

.game-sidebar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    width: 240px;
    flex-shrink: 0;
    min-height: 0;
    position: relative;
}

.game-sidebar-stable {
    position: relative;
    z-index: 1;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.game-sidebar-messages {
    position: absolute;
    top: calc(50% + 7rem);
    left: 0;
    right: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 0;
}

.draw-rule-message {
    margin-bottom: 0;
}

.game-sidebar .moves-tree {
    height: 150px;
    min-height: 150px;
    max-height: 150px;
}

.game-controls {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
    position: relative;
    padding-bottom: 1rem;
}

.game-controls-left {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.25rem;
}

.game-controls-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.sidebar-dialog-container {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 0.25rem;
    display: flex;
    justify-content: center;
}

.sidebar-dialog-container .draw-offer {
    margin-top: 0 !important;
}

.confirmation-dialog-btn {
    width: 2.5rem;
    height: 2.5rem;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.confirmation-dialog-btn--with-label {
    width: auto;
    min-width: 5.5rem;
    padding: 0 0.75rem;
    gap: 0.4rem;
}

.confirmation-dialog-icon {
    width: 1.25rem;
    height: 1.25rem;
}

.confirmation-dialog-btn-text {
    font-size: 0.9rem;
    line-height: 1;
}

.game-control-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    min-width: 2.5rem;
    min-height: 2.5rem;
    padding: 0;
    box-sizing: border-box;
    background-color: #fff;
    border: 1px solid #6c757d;
    border-radius: 0.25rem;
    cursor: pointer;
    color: #212529;
}

.game-control-btn:hover:not(:disabled) {
    background-color: #f8f9fa;
    border-color: #adb5bd;
}

.game-control-btn--selected {
    background-color: #adb5bd;
    border-color: #6c757d;
}

.game-control-btn--selected:hover:not(:disabled) {
    background-color: #9ca3af;
    border-color: #6c757d;
}

.game-control-btn--attention {
    border-color: #c57b2b;
    background-color: #fff6e7;
    animation: game-control-pulse 1.2s ease-in-out infinite;
}

.game-control-btn--attention:hover:not(:disabled) {
    background-color: #ffefcf;
    border-color: #a8641a;
}

.game-control-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.game-control-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.game-control-btn img.game-control-icon {
    filter: brightness(0);
}

.game-control-btn img.game-control-icon--draw {
    width: 1.5rem;
    height: 1.5rem;
    filter: brightness(0) contrast(1.2);
}

.game-control-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    white-space: nowrap;
    background: #212529;
    color: #fff;
    border-radius: 0.25rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0s;
}

.game-control-btn:hover .game-control-tooltip {
    opacity: 1;
}

@keyframes game-control-pulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(197, 123, 43, 0.08);
    }
    50% {
        box-shadow: 0 0 0 0.35rem rgba(197, 123, 43, 0.18);
    }
}

@media (max-width: 980px) {
    .game-room-layout {
        flex-direction: column;
        align-items: center;
        gap: 0.25rem;
        --board-size-override: 100vw;
        padding: 0.25rem 0 0.5rem;
    }

    .game-room {
        margin-left: -1.5rem;
        margin-right: -1.5rem;
    }

    .player-row {
        padding: 2px 0 2px 0.75rem;
    }

    .board-row .board {
        margin-bottom: 0;
    }

    .board-row .board-container {
        vertical-align: top;
    }

    .game-sidebar {
        width: var(--board-size-px, 480px);
        position: static;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        box-sizing: border-box;
    }

    .game-sidebar-stable {
        display: flex;
        flex-direction: column;
        gap: 0.4rem;
    }

    .game-sidebar-stable .game-controls {
        order: -1;
        padding-bottom: 0;
        margin-top: 0.5rem;
    }

    .game-sidebar-messages {
        position: static;
        top: auto;
        left: auto;
        right: auto;
        bottom: auto;
        max-height: 240px;
        overflow-y: auto;
        margin-top: 0.5rem;
    }
}
