* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: radial-gradient(circle at top, #1e293b 0, #0f172a 45%, #020617 100%);
    color: #fff;
    min-height: 100vh;
    padding: 20px;
}

.page {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: start;
}

.card {
    background: rgba(30, 41, 59, 0.96);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 0 22px 70px rgba(0,0,0,0.35);
}

.badge {
    display: inline-block;
    background: rgba(34,197,94,0.12);
    border: 1px solid rgba(34,197,94,0.28);
    color: #bbf7d0;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 14px;
}

h1 {
    margin: 0 0 8px;
    font-size: 34px;
}

.subtitle {
    color: #cbd5e1;
    line-height: 1.5;
    margin-bottom: 18px;
}

.mode-box {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.mode-btn {
    border: 1px solid rgba(255,255,255,0.08);
    background: #0f172a;
    color: #cbd5e1;
    padding: 13px;
    border-radius: 14px;
    cursor: pointer;
    font-weight: bold;
}

.mode-btn:hover {
    background: #1e293b;
    color: #fff;
}

.mode-btn.active {
    background: #22c55e;
    color: #fff;
    border-color: rgba(34,197,94,0.5);
}

.scoreboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}

.score-card {
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 14px;
    text-align: center;
}

.score-card span {
    display: block;
    color: #94a3b8;
    font-size: 13px;
    margin-bottom: 6px;
}

.score-card strong {
    font-size: 30px;
}

.status {
    background: #020617;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 14px;
    color: #cbd5e1;
    font-weight: bold;
    margin-bottom: 18px;
}

.board {
    width: 100%;
    max-width: 640px;
    aspect-ratio: 1 / 1;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    border: 4px solid #020617;
    border-radius: 18px;
    overflow: hidden;
    margin: 0 auto;
    box-shadow: 0 18px 60px rgba(0,0,0,0.35);
}

.square {
    border: none;
    position: relative;
    cursor: pointer;
    padding: 0;
}

.square:disabled {
    cursor: not-allowed;
}

.light {
    background: #e2e8f0;
}

.dark {
    background: #334155;
}

.dark:hover {
    background: #475569;
}

.square.selected {
    outline: 4px solid #22c55e;
    outline-offset: -4px;
}

.square.possible {
    box-shadow: inset 0 0 0 4px rgba(34,197,94,0.7);
}

.square.capture {
    box-shadow: inset 0 0 0 4px rgba(239,68,68,0.85);
}

.piece {
    width: 72%;
    height: 72%;
    border-radius: 50%;
    position: absolute;
    top: 14%;
    left: 14%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 22px;
    box-shadow: inset 0 -5px 0 rgba(0,0,0,0.25), 0 8px 18px rgba(0,0,0,0.35);
    animation: pop .16s ease;
}

.red {
    background: linear-gradient(145deg, #ef4444, #991b1b);
    border: 2px solid #fecaca;
}

.black {
    background: linear-gradient(145deg, #111827, #020617);
    border: 2px solid #94a3b8;
}

.king::after {
    content: "♛";
    color: #facc15;
    font-size: 24px;
}

@keyframes pop {
    from { transform: scale(.85); }
    to { transform: scale(1); }
}

.side h2 {
    margin: 0 0 12px;
}

.info-box {
    background: #0f172a;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 14px;
}

.info-box strong {
    display: block;
    margin-bottom: 6px;
}

.info-box span {
    color: #94a3b8;
    font-size: 14px;
    line-height: 1.5;
}

.actions {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.btn {
    display: block;
    border: none;
    text-align: center;
    text-decoration: none;
    background: #22c55e;
    color: #fff;
    padding: 14px;
    border-radius: 14px;
    font-weight: bold;
    cursor: pointer;
}

.btn:hover {
    background: #16a34a;
}

.btn-secondary {
    background: #475569;
}

.btn-secondary:hover {
    background: #334155;
}

.rules-list {
    padding-left: 18px;
    color: #cbd5e1;
    line-height: 1.6;
    font-size: 14px;
}

.soon {
    color: #fde68a;
    font-weight: bold;
}

@media (max-width: 920px) {
    .page {
        grid-template-columns: 1fr;
    }

    .side {
        order: -1;
    }
}

@media (max-width: 560px) {
    body {
        padding: 12px;
    }

    .card {
        padding: 18px;
        border-radius: 18px;
    }

    h1 {
        font-size: 28px;
    }

    .piece {
        font-size: 16px;
    }

    .king::after {
        font-size: 18px;
    }

    .score-card strong {
        font-size: 24px;
    }

    .mode-box {
        grid-template-columns: 1fr;
    }
}

.square.last-move {
    box-shadow: inset 0 0 0 4px rgba(59,130,246,0.9);
}

.square.last-capture {
    box-shadow: inset 0 0 0 4px rgba(239,68,68,0.95);
}

.piece.moving {
    animation: movePop .28s ease;
}

@keyframes movePop {
    0% {
        transform: scale(.72);
        opacity: .65;
    }

    70% {
        transform: scale(1.12);
        opacity: 1;
    }

    100% {
        transform: scale(1);
    }
}

.sound-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #0f172a;
    color: #cbd5e1;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 13px;
    font-weight: bold;
    cursor: pointer;
}

.sound-toggle input {
    width: 16px;
    height: 16px;
}