/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    overflow-y: auto;
}

:root {
    --bg-primary: #262422;
    --bg-secondary: #302e2b;
    --bg-tertiary: #431e7a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-primary: #a165e6;
    --accent-secondary: #431e7a;
    --board-light: #ebecd0;
    --board-dark: #739552;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.2);
    --shadow-heavy: rgba(0, 0, 0, 0.3);
    --border-radius: 12px;
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

body.light-mode {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e0e0e0;
    --text-primary: #333333;
    --text-secondary: #666666;
    --shadow-light: rgba(0, 0, 0, 0.05);
    --shadow-medium: rgba(0, 0, 0, 0.1);
    --shadow-heavy: rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100vh;
}

/* ===== HEADER ===== */
.game-header {
    background: var(--bg-secondary);
    padding: 10px 15px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px var(--shadow-medium);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    flex-shrink: 0;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.game-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn-large {
    padding: 20px 40px;
    font-size: 1.3rem;
    font-weight: 700;
}

.game-title {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--accent-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-info {
    display: flex;
    align-items: center;
    gap: 40px;
    flex-wrap: wrap;
}

.turn-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px var(--shadow-light);
}

.turn-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.turn-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.turn-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    box-shadow: 0 2px 8px var(--shadow-light);
    transition: var(--transition-normal);
}

.turn-icon.black {
    background: #1a1a1a;
}

.timers {
    display: flex;
    gap: 15px;
}

.timer {
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    text-align: center;
    min-width: 90px;
    box-shadow: 0 2px 10px var(--shadow-light);
    transition: var(--transition-normal);
}

.timer.active {
    border: 2px solid var(--accent-primary);
    box-shadow: 0 0 10px rgba(233, 69, 96, 0.2);
}

.timer-label {
    font-size: 0.8rem;
    color: var(--text-primary);
    display: block;
}

.timer-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ===== MAIN GAME AREA ===== */
.game-main {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    flex-wrap: wrap;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ===== CAPTURED PIECES ===== */
.captured-pieces-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.captured-pieces {
    background: var(--bg-secondary);
    padding: 10px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px var(--shadow-medium);
}

.captured-pieces.captured-black {
    order: 1;
}

.captured-pieces.captured-white {
    order: 2;
}

.captured-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 10px;
}

.captured-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-height: 40px;
}

.captured-piece {
    width: 28px;
    height: 28px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px var(--shadow-light));
}

/* ===== BOARD CONTAINER ===== */
.board-container {
    position: relative;
    flex: 0 0 auto;
    width: min(80vh, 100%);
    max-width: 100%;
    margin: 0 auto;
    max-height: calc(100vh - 200px);
}

.board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 8px 32px var(--shadow-heavy);
    position: relative;
    transform-style: preserve-3d;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    backface-visibility: hidden;
}


.board.flipped {
    transform: rotate(180deg);
}

.board.flipped .piece {
    transform: rotate(-180deg);
}

.square {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    cursor: pointer;
    transition: background-color 0.25s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
}

.square.light {
    background: var(--board-light);
}

.square.light:hover {
    background: #d4d5b8;
}

.square.dark {
    background: var(--board-dark);
}

.square.dark:hover {
    background: #6a8a4a;
}

.square.light.selected {
    background: #f5f682 !important;
}

.square.dark.selected {
    background: #b9ca43 !important;
}

.square.light.possible-move::after {
    content: '';
    position: absolute;
    width: 30%;
    height: 30%;
    background: rgba(153, 156, 150, 0.6);
    border-radius: 50%;
}

.square.dark.possible-move::after {
    content: '';
    position: absolute;
    width: 30%;
    height: 30%;
    background: rgba(235, 236, 208, 0.6);
    border-radius: 50%;
}

.square.light.possible-capture::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid rgba(115, 149, 82, 0.8);
    border-radius: 50%;
}

.square.dark.possible-capture::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid rgba(235, 236, 208, 0.8);
    border-radius: 50%;
}

.square.light.en-passant::before {
    content: 'En Passant';
    position: absolute;
    font-size: 0.7rem;
    font-weight: 600;
    color: #5a6a3a;
    background: rgba(235, 236, 208, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 20;
    white-space: nowrap;
}

.square.dark.en-passant::before {
    content: 'En Passant';
    position: absolute;
    font-size: 0.7rem;
    font-weight: 600;
    color: #c0c1a0;
    background: rgba(115, 149, 82, 0.9);
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 20;
    white-space: nowrap;
}

.square.light.in-check {
    background: rgb(230, 106, 106) !important;
}

.square.dark.in-check {
    background: rgb(224, 88, 88) !important;
}

.square.light.last-move {
    background: #f5f682 !important;
}

.square.dark.last-move {
    background: #b9ca43 !important;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.6;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

@keyframes check-pulse {
    0%, 100% {
        box-shadow: inset 0 0 20px rgba(255, 0, 0, 0.5);
    }
    50% {
        box-shadow: inset 0 0 40px rgba(255, 0, 0, 0.8);
    }
}

/* ===== PIECES ===== */
.piece {
    width: 90%;
    height: 90%;
    object-fit: contain;
    transition: transform 0.25s ease, filter 0.25s ease;
    filter: drop-shadow(0 3px 6px var(--shadow-medium));
    z-index: 10;
}

.piece:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 4px 8px var(--shadow-medium));
}

.piece.moving {
    animation: piece-move 0.2s ease;
}

@keyframes piece-move {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

/* ===== BOARD COORDINATES ===== */
.board-coordinates {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.coord-left {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 12.5%;
    pointer-events: none;
}

.coord-left span {
    position: absolute;
    top: 4px;
    left: 4px;
    font-size: clamp(0.5rem, 1.5vw, 0.95rem);
    font-weight: 700;
    color: #c0c1a0;
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.45);
}

.coord-left span:nth-child(odd) {
    color: #739552;
}

.coord-left span:nth-child(1) { top: 4px; }
.coord-left span:nth-child(2) { top: calc(12.5% + 4px); }
.coord-left span:nth-child(3) { top: calc(25% + 4px); }
.coord-left span:nth-child(4) { top: calc(37.5% + 4px); }
.coord-left span:nth-child(5) { top: calc(50% + 4px); }
.coord-left span:nth-child(6) { top: calc(62.5% + 4px); }
.coord-left span:nth-child(7) { top: calc(75% + 4px); }
.coord-left span:nth-child(8) { top: calc(87.5% + 4px); }

.coord-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 12.5%;
    pointer-events: none;
}

.coord-bottom span {
    position: absolute;
    bottom: 4px;
    right: 4px;
    font-size: clamp(0.5rem, 1.5vw, 0.95rem);
    font-weight: 700;
    color: #c0c1a0;
    text-shadow: 0 0 1px rgba(0, 0, 0, 0.45);
}

.coord-bottom span:nth-child(even) {
    color: #739552;
}

.board-coordinates.flipped .coord-left span:nth-child(odd) {
    color: #c0c1a0;
}

.board-coordinates.flipped .coord-left span:nth-child(even) {
    color: #739552;
}

.board-coordinates.flipped .coord-bottom span:nth-child(odd) {
    color: #739552;
}

.board-coordinates.flipped .coord-bottom span:nth-child(even) {
    color: #c0c1a0;
}

.coord-bottom span:nth-child(1) { right: calc(87.5% + 4px); }
.coord-bottom span:nth-child(2) { right: calc(75% + 4px); }
.coord-bottom span:nth-child(3) { right: calc(62.5% + 4px); }
.coord-bottom span:nth-child(4) { right: calc(50% + 4px); }
.coord-bottom span:nth-child(5) { right: calc(37.5% + 4px); }
.coord-bottom span:nth-child(6) { right: calc(25% + 4px); }
.coord-bottom span:nth-child(7) { right: calc(12.5% + 4px); }
.coord-bottom span:nth-child(8) { right: 4px; }

.board-coordinates.flipped .coord-left span:nth-child(1) { top: calc(87.5% + 4px); }
.board-coordinates.flipped .coord-left span:nth-child(2) { top: calc(75% + 4px); }
.board-coordinates.flipped .coord-left span:nth-child(3) { top: calc(62.5% + 4px); }
.board-coordinates.flipped .coord-left span:nth-child(4) { top: calc(50% + 4px); }
.board-coordinates.flipped .coord-left span:nth-child(5) { top: calc(37.5% + 4px); }
.board-coordinates.flipped .coord-left span:nth-child(6) { top: calc(25% + 4px); }
.board-coordinates.flipped .coord-left span:nth-child(7) { top: calc(12.5% + 4px); }
.board-coordinates.flipped .coord-left span:nth-child(8) { top: 4px; }

.board-coordinates.flipped .coord-bottom span:nth-child(1) { right: 4px; }
.board-coordinates.flipped .coord-bottom span:nth-child(2) { right: calc(12.5% + 4px); }
.board-coordinates.flipped .coord-bottom span:nth-child(3) { right: calc(25% + 4px); }
.board-coordinates.flipped .coord-bottom span:nth-child(4) { right: calc(37.5% + 4px); }
.board-coordinates.flipped .coord-bottom span:nth-child(5) { right: calc(50% + 4px); }
.board-coordinates.flipped .coord-bottom span:nth-child(6) { right: calc(62.5% + 4px); }
.board-coordinates.flipped .coord-bottom span:nth-child(7) { right: calc(75% + 4px); }
.board-coordinates.flipped .coord-bottom span:nth-child(8) { right: calc(87.5% + 4px); }

/* ===== SIDEBAR ===== */
.game-sidebar {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 20px var(--shadow-medium);
    min-width: 250px;
    max-width: 350px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow: visible;
    min-height: 450px;
}

.sidebar-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
}

/* ===== MOVE HISTORY ===== */
.move-history {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.move-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-gutter: stable;
    max-height: 300px;
    padding-right: 8px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    align-content: start;
}

.move-list::-webkit-scrollbar {
    width: 6px;
}

.move-list::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.move-list::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 3px;
}

.move-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    font-size: 0.85rem;
    transition: var(--transition-fast);
    min-height: 32px;
}

.move-item:hover {
    background: var(--accent-secondary);
    transform: translateX(3px);
}

.move-item.latest {
    background: var(--accent-primary);
    color: white;
}

.move-item.latest .move-number,
.move-item.latest .move-content {
    color: white;
}

.move-number {
    color: var(--text-secondary);
    font-weight: 600;
}

.move-content {
    color: var(--text-primary);
    font-weight: 500;
}

/* ===== GAME CONTROLS ===== */
.game-controls {
    display: none;
}

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 15px var(--shadow-medium);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px var(--shadow-medium);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-tertiary {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.btn-icon {
    font-size: 1rem;
}

/* ===== GAME STATUS ===== */
.game-status {
    display: none;
}

/* ===== MODALS ===== */
.modal {
    display: flex;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.72);
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}


.modal-content {
    background: rgba(48, 46, 43, 0.98);
    padding: 30px 25px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    max-width: 90vw;
    width: auto;
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
    opacity: 0;
    transform: translateY(-24px) scale(0.96);
    transition: opacity 0.6s ease, transform 0.6s ease;
    animation: none;
}

.modal.active .modal-content {
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: modal-appear 0.6s ease 0.1s forwards;
}

@keyframes modal-appear {
    from {
        opacity: 0;
        transform: translateY(-24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}


.modal-title {
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 15px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.modal-text {
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
    font-weight: 400;
}

/* ===== PROMOTION MODAL ===== */
.promotion-pieces {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.promotion-piece {
    width: clamp(50px, 12vw, 70px);
    height: clamp(50px, 12vw, 70px);
    background: var(--bg-tertiary);
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition-normal);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px;
}

.promotion-piece:hover {
    background: var(--accent-primary);
    transform: scale(1.05);
}

.promotion-piece img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ===== GAME STATS ===== */
.game-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 25px 0 30px 0;
    padding: 20px;
    background: rgba(67, 30, 122, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(161, 101, 230, 0.2);
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}

/* ===== VICTORY MODAL ===== */
.victory-content {
    padding: 50px 40px;
}

.victory-title {
    background: linear-gradient(135deg, #ffd700, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.victory-text {
    font-size: 1.3rem;
    margin-bottom: 30px;
}

.victory-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.victory-content .btn {
    margin: 8px;
}

/* ===== MODAL BUTTONS ===== */
.modal-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.modal-content .btn {
    margin: 0;
    min-width: clamp(100px, 25vw, 140px);
    padding: 10px 16px;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-content .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(161, 101, 230, 0.3);
}

.modal-content .btn:active {
    transform: translateY(-1px);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (min-width: 1024px) {
    .game-main {
        flex-direction: row;
        align-items: flex-start;
        gap: 20px;
    }

    .board-container {
        width: min(65vh, 100%);
        max-height: calc(100vh - 200px);
        flex: 0 0 auto;
    }

    .game-sidebar {
        width: 100%;
        max-width: 400px;
        max-height: calc(100vh - 200px);
        flex: 1;
    }

    .captured-pieces-section {
        margin-bottom: 15px;
        gap: 10px;
    }

    .captured-pieces,
    .move-history {
        width: 100%;
    }
}

@media (max-width: 900px) {
    .game-header {
        flex-direction: column;
        text-align: center;
        align-items: center;
        gap: 10px;
    }

    .header-controls {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .game-buttons {
        justify-content: center;
    }

    .timers {
        justify-content: center;
    }

    .board-container {
        width: min(75vh, 100%);
        max-height: calc(100vh - 280px);
    }

    .game-sidebar {
        max-height: 180px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 8px;
        gap: 8px;
    }

    .game-header {
        padding: 8px 12px;
    }

    .game-title {
        font-size: 1.3rem;
    }

    .board-container {
        width: min(80vh, 100%);
        max-height: calc(100vh - 300px);
    }

    .game-sidebar {
        padding: 12px;
        max-height: 150px;
    }

    .sidebar-title {
        font-size: 1rem;
        margin-bottom: 10px;
    }

    .captured-pieces {
        padding: 8px;
    }

    .captured-label {
        font-size: 0.75rem;
    }

    .captured-piece {
        width: 24px;
        height: 24px;
    }

    .coord-left span,
    .coord-bottom span {
        font-size: 0.75rem;
    }

    .move-list {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .move-item {
        padding: 4px 8px;
        font-size: 0.8rem;
        min-height: 28px;
    }

    .modal-content {
        padding: 25px 20px;
    }

    .modal-title {
        font-size: 1.6rem;
    }

    .modal-text {
        font-size: 1rem;
    }

    .game-stats {
        padding: 12px;
        margin: 15px 0 20px 0;
    }

    .stat-item {
        padding: 5px 0;
    }

    .promotion-piece {
        width: 50px;
        height: 50px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 5px;
        gap: 5px;
    }

    .game-header {
        padding: 6px 10px;
        gap: 8px;
    }

    .game-title {
        font-size: 1.1rem;
    }

    .turn-indicator {
        padding: 6px 10px;
        gap: 6px;
    }

    .turn-label {
        font-size: 0.8rem;
    }

    .turn-text {
        font-size: 0.95rem;
    }

    .turn-icon {
        width: 20px;
        height: 20px;
    }

    .timer {
        padding: 6px 10px;
        min-width: 75px;
    }

    .timer-label {
        font-size: 0.7rem;
    }

    .timer-value {
        font-size: 1rem;
    }

    .btn-small {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    .btn-icon {
        font-size: 0.9rem;
    }

    .board-container {
        width: min(85vh, 100%);
        max-height: calc(100vh - 320px);
    }

    .game-sidebar {
        padding: 10px;
        max-height: 120px;
        gap: 10px;
    }

    .sidebar-title {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }

    .captured-pieces {
        padding: 6px;
    }

    .captured-label {
        font-size: 0.7rem;
        margin-bottom: 6px;
    }

    .captured-piece {
        width: 20px;
        height: 20px;
    }

    .coord-left span,
    .coord-bottom span {
        font-size: 0.65rem;
    }

    .move-item {
        padding: 3px 6px;
        font-size: 0.75rem;
        min-height: 24px;
    }

    .modal-content {
        padding: 20px 15px;
    }

    .modal-title {
        font-size: 1.4rem;
    }

    .modal-text {
        font-size: 0.9rem;
    }

    .promotion-piece {
        width: 45px;
        height: 45px;
    }
}

@media (max-height: 600px) {
    .game-header {
        padding: 6px 12px;
        gap: 8px;
    }

    .game-title {
        font-size: 1.2rem;
    }

    .turn-indicator {
        padding: 5px 10px;
    }

    .timer {
        padding: 5px 10px;
        min-width: 80px;
    }

    .timer-value {
        font-size: 1rem;
    }

    .board-container {
        width: min(70vh, 100%);
        max-height: calc(100vh - 180px);
    }

    .game-sidebar {
        max-height: 100px;
        padding: 10px;
        gap: 8px;
    }

    .sidebar-title {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }

    .captured-pieces {
        padding: 6px;
    }

    .captured-label {
        font-size: 0.7rem;
    }

    .captured-piece {
        width: 22px;
        height: 22px;
    }

    .move-item {
        padding: 3px 6px;
        font-size: 0.75rem;
        min-height: 24px;
    }
}

/* ===== FOOTER ===== */
.game-footer {
    margin-top: 5px;
    padding: 8px 15px;
    text-align: center;
    background: var(--bg-secondary);
    border-top: 1px solid rgba(161, 101, 230, 0.2);
    font-size: 0.75rem;
    color: var(--text-secondary);
    transition: all var(--transition-normal);
    flex-shrink: 0;
}

.game-footer p {
    margin: 0;
    letter-spacing: 0.5px;
}

.game-footer:hover {
    color: var(--text-primary);
    border-top-color: rgba(161, 101, 230, 0.4);
}
