.game-layout {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    gap: 2rem;
    padding: 4rem 1rem 1rem 1rem;
    min-height: calc(100vh - 120px);
    box-sizing: border-box;
}

.board-container {
    flex: 1.4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
}

.info-wrapper {
    flex: 0.8;
    width: 100%;
}

.glass-card {
    background: rgba(10, 15, 25, 0.65);
    backdrop-filter: blur(8px);
    border: 1px solid var(--surface-border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    box-sizing: border-box;
}

/* Scoreboard */
.scoreboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    text-align: center;
    margin-bottom: 1.5rem;
}

.score-box {
    background: rgba(19, 34, 56, 0.3);
    border: 1px solid var(--surface-border);
    padding: 0.75rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.score-box.active-w {
    border-color: #ffffff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.score-box.active-b {
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.2);
}

.score-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 0.25rem;
}

.score-val {
    font-size: 1.8rem;
    font-weight: 800;
}

.score-val.w-color {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

.score-val.b-color {
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(0, 210, 255, 0.4);
}

/* Dama Board Wrapper */
.dama-board-wrapper {
    position: relative;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1 / 1;
    margin: 0 auto;
    background: #0d121d;
    border: 12px solid #1c273a;
    border-radius: 12px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.7), inset 0 0 20px rgba(0, 210, 255, 0.05);
    box-sizing: border-box;
    container-type: inline-size;
    container-name: board;
}

.dama-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    height: 100%;
    width: 100%;
    position: relative;
}

/* Cells */
.dama-cell {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.dama-cell.cell-light {
    background: rgba(25, 40, 65, 0.15);
}

.dama-cell.cell-dark {
    background: rgba(10, 15, 25, 0.45);
}

/* Highlight valid targets */
.dama-cell.valid-target {
    box-shadow: inset 0 0 12px rgba(0, 210, 255, 0.4);
    border: 2px solid var(--accent-color);
    cursor: pointer;
}

.dama-cell.valid-target.drag-hover {
    background: rgba(0, 210, 255, 0.2) !important;
    box-shadow: inset 0 0 18px rgba(0, 210, 255, 0.6), 0 0 8px var(--accent-color) !important;
}

/* Highlight last move start and end squares */
.dama-cell.last-move {
    background: rgba(0, 102, 255, 0.22) !important;
    box-shadow: inset 0 0 12px rgba(0, 102, 255, 0.35);
}

/* Checkers styling */
.dama-piece {
    width: 80%;
    height: 80%;
    border-radius: 50%;
    position: absolute;
    cursor: pointer;
    box-sizing: border-box;
    transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.dama-piece.color-w {
    background: radial-gradient(circle, #ffffff 0%, #e0e0e0 60%, #a8a8a8 100%);
    border: 2px solid #ffffff;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.6), 0 0 6px rgba(255, 255, 255, 0.4);
    color: #ffffff;
}

.dama-piece.color-b {
    background: radial-gradient(circle, #223147 0%, #0f1826 70%, #050910 100%);
    border: 2px solid #8da4be;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.8), inset 0 1px 2px rgba(255, 255, 255, 0.15);
    color: #8da4be;
}

.dama-piece.selected {
    border-color: #ffffff !important;
    box-shadow: 0 0 12px #ffffff, 0 0 20px #ffffff;
    transform: scale(1.1) !important;
    z-index: 100 !important;
}

.dama-piece.draggable {
    cursor: grab !important;
    touch-action: none;
}

.dama-piece.draggable:active {
    cursor: grabbing !important;
}

.dama-piece.dragging {
    opacity: 0.9;
    transform: scale(1.1) !important;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.6), 0 0 15px var(--accent-color) !important;
    z-index: 2000 !important;
    pointer-events: none;
}

/* King decoration */
.dama-piece.king::after {
    content: "\f521";
    /* Crown icon */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 1.5rem;
    color: #ffb703;
    text-shadow: 0 0 8px rgba(255, 183, 3, 0.8);
    position: absolute;
}

/* Glow active turn player pieces */
@keyframes activeTurnGlow {
    0% {
        box-shadow: 0 3px 6px rgba(0, 0, 0, 0.6), 0 0 6px var(--accent-color);
    }

    100% {
        box-shadow: 0 3px 6px rgba(0, 0, 0, 0.6), 0 0 18px var(--accent-color), 0 0 10px var(--accent-color);
    }
}

.dama-piece.glow-active {
    animation: activeTurnGlow 1.4s infinite alternate;
    border-color: var(--accent-color) !important;
}

/* Controls styling */
.control-group {
    margin-bottom: 1.2rem;
}

.control-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.control-buttons-row {
    display: flex;
    gap: 0.5rem;
}

.toggle-btn {
    flex: 1;
    background: rgba(19, 34, 56, 0.3);
    border: 1px solid var(--surface-border);
    color: var(--text-secondary);
    padding: 0.6rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    border-color: var(--accent-color);
    color: #ffffff;
}

.toggle-btn.active {
    background: var(--active-bg);
    border-color: var(--accent-color);
    color: var(--accent-color);
    box-shadow: 0 0 8px rgba(0, 210, 255, 0.2);
}

.game-actions {
    display: flex;
    gap: 0.8rem;
    margin-top: 1.5rem;
}

.action-btn {
    flex: 1;
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.action-btn:hover {
    background: rgba(0, 210, 255, 0.1);
    box-shadow: 0 0 12px rgba(0, 210, 255, 0.3);
}

.action-btn.danger {
    border-color: #ff3333;
    color: #ff3333;
}

.action-btn.danger:hover {
    background: rgba(255, 51, 51, 0.1);
    box-shadow: 0 0 12px rgba(255, 51, 51, 0.3);
}

.icon-btn {
    background: transparent;
    border: 1px solid var(--surface-border);
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    box-sizing: border-box;
}

.icon-btn:hover {
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.icon-btn.muted {
    color: #ff3333;
    border-color: #ff3333;
}

.game-status-bar {
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1.2rem;
    color: #ffffff;
    min-height: 1.8rem;
}

.game-status-bar span.turn-w {
    color: #ffffff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.game-status-bar span.turn-b {
    color: var(--accent-color);
    text-shadow: 0 0 8px rgba(0, 210, 255, 0.5);
}

/* Modals & Guides */
.game-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    border-radius: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.game-modal-overlay.show {
    display: flex;
    opacity: 1;
}

.modal-card {
    background: var(--surface-color);
    border: 1px solid var(--accent-color);
    border-radius: 16px;
    padding: 2.2rem;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(0, 210, 255, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 85%;
    box-sizing: border-box;
}

.game-modal-overlay.show .modal-card {
    transform: scale(1);
}

.modal-title {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.modal-title.w-win {
    color: #ffffff;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.modal-title.b-win {
    color: var(--accent-color);
    text-shadow: 0 0 15px rgba(0, 210, 255, 0.5);
}

.modal-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.modal-card .action-btn {
    width: fit-content;
    margin: 1.5rem auto 0 auto;
    flex: none;
}

/* Rules Modal */
#rulesModal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(5, 10, 18, 0.85) !important;
    backdrop-filter: blur(6px) !important;
    z-index: 250 !important;
    border-radius: 0 !important;
    display: none;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

#rulesModal.show {
    display: flex !important;
}

.rules-card {
    background: rgba(10, 15, 25, 0.95) !important;
    border: 2px solid var(--accent-color) !important;
    border-radius: 16px !important;
    padding: 2rem !important;
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.8), 0 0 30px rgba(0, 210, 255, 0.25) !important;
    max-width: 550px;
    width: 95%;
    text-align: left;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-sizing: border-box;
}

#rulesModal.show .rules-card {
    transform: scale(1) !important;
}

.rules-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--surface-border);
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.rules-header h3 {
    font-size: 1.5rem;
    color: var(--accent-color);
    font-weight: 700;
}

.close-rules-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-rules-btn:hover {
    color: #ffffff;
}

.rules-body {
    overflow-y: auto;
    padding-right: 8px;
    margin-bottom: 1.5rem;
}

.rule-slide {
    display: none;
}

.rule-slide.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

.rule-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.8rem;
}

.rule-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 1.2rem;
}

/* Rules Visual Diagrams */
.rules-diagram {
    display: flex;
    justify-content: center;
    margin: 1.2rem 0;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--surface-border);
    border-radius: 8px;
    padding: 1.5rem;
    box-sizing: border-box;
}

.mini-grid {
    display: grid;
    grid-template-columns: repeat(4, 36px);
    grid-template-rows: repeat(4, 36px);
    gap: 2px;
    background: #0d121d;
    border: 3px solid #1c273a;
    border-radius: 4px;
}

.mini-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.mini-cell.cell-light {
    background: rgba(25, 40, 65, 0.15);
}

.mini-cell.cell-dark {
    background: rgba(10, 15, 25, 0.45);
}

.mini-piece {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.mini-piece.color-w {
    background: radial-gradient(circle, #ffffff 0%, #e0e0e0 60%, #a8a8a8 100%);
    border: 1px solid #ffffff;
}

.mini-piece.color-b {
    background: radial-gradient(circle, #223147 0%, #0f1826 70%, #050910 100%);
    border: 1px solid #8da4be;
}

.mini-piece.king {
    display: flex;
    align-items: center;
    justify-content: center;
}

.mini-piece.king::after {
    content: "\f521";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.8rem;
    color: #ffb703;
}

.mini-arrow {
    position: absolute;
    color: var(--accent-color);
    font-size: 1.2rem;
    z-index: 15;
    filter: drop-shadow(0 0 3px var(--accent-color));
    pointer-events: none;
}

.rules-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rules-dots {
    display: flex;
    gap: 8px;
}

.rules-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--surface-border);
    cursor: pointer;
    transition: all 0.2s;
}

.rules-dot.active {
    background: var(--accent-color);
    box-shadow: 0 0 8px var(--accent-color);
    transform: scale(1.2);
}

.rules-nav-btn {
    background: transparent;
    border: 1px solid var(--surface-border);
    color: var(--text-primary);
    padding: 0.4rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.rules-nav-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Advanced Fullscreen Mode Styles */
.game-layout:fullscreen {
    background: radial-gradient(circle at center, #0d1527 0%, #03060c 100%) !important;
    padding: 2rem 3rem !important;
    overflow-y: auto !important;
    min-height: 100vh !important;
    height: auto !important;
    width: 100vw !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3rem !important;
    box-sizing: border-box !important;
}

.game-layout:fullscreen .board-container {
    flex: 1.6 !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center;
}

.game-layout:fullscreen .dama-board-wrapper {
    max-width: 85vw !important;
    max-height: 80vh !important;
    width: 80vh !important;
    aspect-ratio: 1 / 1 !important;
    border: 12px solid #1c273a !important;
    border-radius: 16px !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(0, 210, 255, 0.2) !important;
}

.game-layout:fullscreen .info-wrapper {
    flex: 0.7 !important;
    max-width: 380px !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center;
}

.game-layout:fullscreen .glass-card {
    border-width: 1.5px !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7) !important;
}

/* Desktop: Align info-wrapper top with board top */
@media (min-width: 1025px) {
    .info-wrapper {
        margin-top: 3rem;
    }
}

/* Responsiveness */
@media (max-width: 1024px) or (orientation: portrait) {
    .game-layout {
        flex-direction: column;
        align-items: center;
        padding: 3rem 0.5rem 1rem 0.5rem;
        gap: 1.5rem;
    }

    .board-container {
        width: 100%;
    }

    .info-wrapper {
        width: 100%;
        max-width: 600px;
    }

    .game-layout:fullscreen {
        flex-direction: column !important;
        padding: 1rem !important;
        gap: 1rem !important;
    }

    .game-layout:fullscreen .board-container {
        flex: 1.8 !important;
        width: 100% !important;
    }

    .game-layout:fullscreen .dama-board-wrapper {
        width: 70cqi !important;
        max-width: 85vw !important;
        max-height: 60vh !important;
    }

    .game-layout:fullscreen .info-wrapper {
        flex: 1 !important;
        max-width: 100% !important;
    }
}