* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #07111f;
    --panel: rgba(255, 255, 255, .07);
    --border: rgba(255, 255, 255, .13);
    --text: #fff;
    --light: #f0d9b5;
    --dark: #b58863;
    --accent: #00d4ff;
}

body {
    min-height: 100vh;
    font-family: Arial, Tahoma, sans-serif;
    background:
        radial-gradient(circle at top right, #12365f, transparent 35%),
        radial-gradient(circle at bottom left, #0c2940, transparent 35%),
        var(--bg);
    color: var(--text);
}

header {
    padding: 20px 5%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: rgba(0, 0, 0, .25);
    backdrop-filter: blur(15px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    border-radius: 14px;
    background: linear-gradient(135deg, #00d4ff, #006eff);
    box-shadow: 0 0 30px rgba(0, 212, 255, .3);
}

.logo h1 {
    font-size: 22px;
}

.logo p {
    color: #9fb3ca;
    font-size: 12px;
    margin-top: 4px;
}

.user {
    text-align: left;
}

.user strong {
    display: block;
}

.user span {
    color: #8da2b9;
    font-size: 12px;
}

.container {
    width: min(1400px, 94%);
    margin: 30px auto;
    display: grid;
    grid-template-columns: minmax(400px, 1fr) 380px;
    gap: 25px;
}

.chess-area,
.panel {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 25px;
    backdrop-filter: blur(15px);
    box-shadow: 0 25px 70px rgba(0, 0, 0, .3);
}

.chess-area {
    padding: 22px;
}

.player {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 5px 15px;
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #172b42;
    font-size: 23px;
}

.player-name {
    font-weight: bold;
}

.player-color {
    display: block;
    color: #8da2b9;
    font-size: 12px;
    margin-top: 4px;
}

.timer {
    background: #091523;
    padding: 9px 18px;
    border-radius: 12px;
    font-size: 22px;
    font-weight: bold;
}

#board {
    width: min(80vw, 700px);
    aspect-ratio: 1;
    margin: auto;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    border: 6px solid #111;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.square {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.light {
    background: var(--light);
}

.dark {
    background: var(--dark);
}

.piece {
    font-size: clamp(32px, 6vw, 68px);
    line-height: 1;
    text-shadow: 2px 3px 4px rgba(0, 0, 0, .55);
    pointer-events: none;
}

.selected {
    box-shadow: inset 0 0 0 5px #00e5ff;
}

.possible::after {
    content: "";
    position: absolute;
    width: 22%;
    height: 22%;
    border-radius: 50%;
    background: rgba(0, 0, 0, .28);
}

.capture {
    box-shadow: inset 0 0 0 6px rgba(255, 70, 70, .75);
}

.board-bottom {
    display: flex;
    justify-content: space-between;
    margin-top: 18px;
    color: #91a6bd;
    font-size: 13px;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.panel {
    padding: 18px;
}

.panel h2 {
    font-size: 17px;
    margin-bottom: 14px;
}

/* GAME MODE */
.mode-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.mode {
    padding: 12px 5px;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .05);
    color: white;
    cursor: pointer;
    transition: .2s;
}

.mode.active {
    background: linear-gradient(135deg, #00b7ff, #006eff);
    border-color: #00d4ff;
    box-shadow: 0 0 20px rgba(0, 212, 255, .2);
}

/* DIFFICULTY */
.level-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 7px;
}

.level {
    padding: 10px 3px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .05);
    color: white;
    cursor: pointer;
    transition: .2s;
}

.level:hover {
    background: rgba(0, 212, 255, .15);
}

.level.active {
    background: linear-gradient(135deg, #00b7ff, #006eff);
    border-color: #00d4ff;
}

/* BUTTONS */
.buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 9px;
}

.action {
    padding: 12px;
    border-radius: 11px;
    border: 1px solid var(--border);
    color: white;
    background: rgba(255, 255, 255, .07);
    cursor: pointer;
    transition: .2s;
}

.action:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, .14);
}

.primary {
    background: linear-gradient(135deg, #00b7ff, #006eff);
    border: none;
}

/* STATUS */
.status {
    padding: 12px;
    text-align: center;
    border-radius: 11px;
    color: #a5e9ff;
    background: rgba(0, 212, 255, .08);
    border: 1px solid rgba(0, 212, 255, .2);
}

/* MOVES */
.moves {
    max-height: 300px;
    overflow-y: auto;
}

.move-row {
    display: grid;
    grid-template-columns: 35px 1fr 1fr;
    gap: 6px;
    padding: 9px 5px;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    font-size: 14px;
}

.move-number {
    color: #71869d;
}

.move-cell {
    padding: 5px;
    border-radius: 7px;
}

.move-cell.good {
    background: rgba(0, 210, 120, .10);
}

.move-cell.bad {
    background: rgba(255, 80, 80, .10);
}

.move-cell.neutral {
    background: rgba(255, 255, 255, .04);
}

/* ANALYSIS */
.analysis {
    display: none;
}

.analysis-title {
    color: #00d4ff;
    margin-bottom: 12px;
}

.analysis-item {
    padding: 12px;
    margin-bottom: 8px;
    border-radius: 11px;
    background: rgba(255, 255, 255, .045);
    border: 1px solid rgba(255, 255, 255, .07);
}

.analysis-item strong {
    display: block;
    margin-bottom: 5px;
}

.excellent {
    color: #42e6a4;
}

.good {
    color: #7ddcff;
}

.warning {
    color: #ffc857;
}

.bad {
    color: #ff7373;
}

/* THEMES */
.themes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.theme {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, .05);
    color: white;
    border-radius: 9px;
    padding: 9px;
    cursor: pointer;
}

.preview {
    display: flex;
    height: 18px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}

.preview span {
    flex: 1;
}

footer {
    text-align: center;
    padding: 25px;
    color: #6e849c;
    font-size: 12px;
}

@media(max-width:900px) {
    .container {
        grid-template-columns: 1fr;
    }

    #board {
        width: min(94vw, 650px);
    }
}

@media(max-width:500px) {
    header {
        padding: 15px;
    }

    .user {
        display: none;
    }

    .chess-area {
        padding: 10px;
    }

    .timer {
        font-size: 17px;
        padding: 8px 12px;
    }
}