/* CSS-Variablen für Hell/Dunkel-Modus */
:root {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e8e8e8;
    --text-primary: #1a1a1a;
    --text-secondary: #666666;
    --board-light: #f0d9b5;
    --board-dark: #b58863;
    --piece-white: #ffffff;
    --piece-black: #2c2c2c;
    --piece-border: #333333;
    --highlight: #7fc97f;
    --highlight-capture: #fb6f6f;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-strong: rgba(0, 0, 0, 0.2);
    --overlay-bg: rgba(0, 0, 0, 0.7);
}

body.dark-mode {
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --bg-tertiary: #3a3a3a;
    --text-primary: #e0e0e0;
    --text-secondary: #a0a0a0;
    --board-light: #769656;
    --board-dark: #4a5f3a;
    --piece-white: #e8e8e8;
    --piece-black: #1a1a1a;
    --piece-border: #cccccc;
    --highlight: #7fc97f;
    --highlight-capture: #fb6f6f;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-strong: rgba(0, 0, 0, 0.5);
    --overlay-bg: rgba(0, 0, 0, 0.85);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.3s ease, color 0.3s ease;
}

.container {
    width: 100%;
    max-width: 800px;
    padding: 20px;
    position: relative;
}

/* Hauptmenü */
.menu-screen {
    display: none;
    text-align: center;
    background: var(--bg-secondary);
    padding: 60px 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px var(--shadow-strong);
    transition: all 0.3s ease;
}

.menu-screen.active {
    display: block;
}

.menu-screen h1 {
    font-size: 3.5rem;
    margin-bottom: 50px;
    color: var(--text-primary);
    text-shadow: 2px 2px 4px var(--shadow);
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 400px;
    margin: 0 auto;
}

.menu-btn {
    padding: 18px 40px;
    font-size: 1.2rem;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--shadow);
}

.menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--shadow-strong);
}

.menu-btn:active {
    transform: translateY(0);
}

.menu-btn.secondary {
    background: linear-gradient(135deg, #868f96 0%, #596164 100%);
}

/* Spielbildschirm */
.game-screen {
    display: none;
}

.game-screen.active {
    display: block;
}

/* Obere Leiste */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px var(--shadow);
}

.player-indicator {
    font-size: 1.3rem;
    font-weight: 600;
    padding: 10px 20px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.control-buttons {
    display: flex;
    gap: 10px;
}

.icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--bg-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px var(--shadow);
}

.icon-btn:hover {
    background: var(--highlight);
    transform: scale(1.1);
}

.icon-btn svg {
    fill: var(--text-primary);
}

/* Spielbrett */
.board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 0;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1;
    border: 4px solid var(--bg-secondary);
    border-radius: 8px;
    box-shadow: 0 8px 30px var(--shadow-strong);
    overflow: hidden;
}

.square {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.square.light {
    background: var(--board-light);
}

.square.dark {
    background: var(--board-dark);
}

.square.playable:hover {
    filter: brightness(1.1);
}

.square.selected {
    background: var(--highlight) !important;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.square.possible-move {
    position: relative;
}

.square.possible-move::after {
    content: '';
    position: absolute;
    width: 30%;
    height: 30%;
    background: var(--highlight);
    border-radius: 50%;
    opacity: 0.7;
}

.square.possible-capture::after {
    content: '';
    position: absolute;
    width: 50%;
    height: 50%;
    background: var(--highlight-capture);
    border-radius: 50%;
    opacity: 0.7;
    border: 3px solid white;
}

/* Spielsteine */
.piece {
    width: 75%;
    height: 75%;
    border-radius: 50%;
    border: 3px solid var(--piece-border);
    box-shadow: 0 4px 8px var(--shadow);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.piece:hover {
    transform: scale(1.05);
}

.piece.white {
    background: radial-gradient(circle at 30% 30%, var(--piece-white), #d0d0d0);
}

.piece.black {
    background: radial-gradient(circle at 30% 30%, #4a4a4a, var(--piece-black));
}

.piece.king::before {
    content: '♔';
    font-size: 2rem;
    color: gold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    position: absolute;
}

.piece.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

/* Spielinfo */
.game-info {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 10px var(--shadow);
}

.score {
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.score-item {
    font-size: 1.3rem;
    font-weight: 600;
}

.score-label {
    color: var(--text-secondary);
    margin-right: 10px;
}

/* Overlays */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay-bg);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.overlay.active {
    display: flex;
}

.overlay-content {
    background: var(--bg-secondary);
    padding: 50px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 50px var(--shadow-strong);
    min-width: 350px;
}

.overlay-content h2 {
    font-size: 2.5rem;
    margin-bottom: 30px;
    color: var(--text-primary);
}

.overlay-content .menu-btn {
    width: 100%;
    margin-top: 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .menu-screen h1 {
        font-size: 2.5rem;
        margin-bottom: 30px;
    }

    .menu-btn {
        padding: 15px 30px;
        font-size: 1rem;
    }

    .top-bar {
        flex-direction: column;
        gap: 15px;
    }

    .board {
        max-width: 100%;
    }

    .piece.king::before {
        font-size: 1.5rem;
    }

    .overlay-content {
        padding: 30px;
        min-width: 280px;
        margin: 20px;
    }

    .overlay-content h2 {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .menu-screen h1 {
        font-size: 2rem;
    }

    .player-indicator {
        font-size: 1rem;
    }

    .icon-btn {
        width: 40px;
        height: 40px;
    }

    .icon-btn svg {
        width: 20px;
        height: 20px;
    }

    .score-item {
        font-size: 1.1rem;
    }

    .piece.king::before {
        font-size: 1.2rem;
    }
}

/* Animationen */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.overlay.active .overlay-content {
    animation: fadeIn 0.3s ease;
}

@keyframes pieceCapture {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.5;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.piece.captured {
    animation: pieceCapture 0.3s ease;
}
