* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
}

/* Cover Page Styles */
.cover-page {
    text-align: center;
    padding: 40px;
}

.cover-page h1 {
    font-size: 4rem;
    margin-bottom: 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.choose-text {
    font-size: 1.5rem;
    color: #4ecca3;
    margin-bottom: 40px;
}

.king-selection {
    display: flex;
    gap: 60px;
    justify-content: center;
    align-items: center;
}

.king-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 30px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.king-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #4ecca3;
    transform: scale(1.05);
}

.king-option:active {
    transform: scale(0.98);
}

.king-piece {
    width: 120px;
    height: 120px;
    margin-bottom: 15px;
    transition: transform 0.3s ease;
}

.king-option:hover .king-piece {
    transform: scale(1.1);
}

.king-piece svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.4));
}

.king-option span {
    font-size: 1.3rem;
    font-weight: bold;
    color: #fff;
}

/* Difficulty Selection Styles */
.difficulty-presets {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-bottom: 30px;
}

.difficulty-btn {
    padding: 15px 35px;
    font-size: 1.1rem;
    font-weight: bold;
    border: 2px solid #4ecca3;
    border-radius: 10px;
    background: transparent;
    color: #4ecca3;
    cursor: pointer;
    transition: all 0.3s ease;
}

.difficulty-btn:hover {
    background: rgba(78, 204, 163, 0.2);
}

.difficulty-btn.active {
    background: #4ecca3;
    color: #1a1a2e;
}

.elo-slider-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px 0;
}

.mode-toggle {
    margin: 25px 0 10px 0;
}

.toggle-btn {
    background: transparent;
    border: none;
    color: #4ecca3;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 8px 16px;
    transition: all 0.2s;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.toggle-btn:hover {
    color: #6fe8be;
}

#elo-slider {
    width: 300px;
    height: 8px;
    border-radius: 4px;
    background: #333;
    outline: none;
    -webkit-appearance: none;
}

#elo-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #4ecca3;
    cursor: pointer;
    transition: transform 0.2s;
}

#elo-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.elo-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #4ecca3;
    min-width: 60px;
}

.start-btn {
    padding: 18px 60px;
    font-size: 1.3rem;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    background: #4ecca3;
    color: #1a1a2e;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.start-btn:hover {
    background: #3db892;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(78, 204, 163, 0.4);
}

.back-btn {
    padding: 12px 30px;
    font-size: 1rem;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #888;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
    margin-left: 15px;
}

.back-btn:hover {
    color: #fff;
}

.container {
    text-align: center;
    padding: 20px;
}

h1 {
    margin-bottom: 20px;
    font-size: 2.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.game-info {
    margin-bottom: 15px;
}

#turn-indicator {
    font-size: 1.2rem;
    font-weight: bold;
    color: #4ecca3;
}

/* Evaluation Bar */
.eval-bar-container {
    display: flex;
    align-items: flex-start;
    padding-right: 10px;
    height: 560px;
}

.eval-bar {
    width: 24px;
    height: 560px;
    background: #ffffff;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 2px solid #4a4a6a;
}

.eval-bar-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50%;
    background: #1a1a2e;
    transition: height 0.5s ease;
}

.eval-bar-score {
    position: absolute;
    width: 100%;
    text-align: center;
    font-size: 0.7rem;
    font-weight: bold;
    z-index: 1;
    padding: 4px 0;
    color: #1a1a2e;
    top: 50%;
    transform: translateY(-50%);
    text-shadow: 0 0 3px rgba(255, 255, 255, 0.8);
}

.eval-bar-score.black-advantage {
    color: #ffffff;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.8);
}

/* Board wrapper with labels */
.board-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 0;
}

.rank-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 560px;
    padding-right: 8px;
}

.rank-labels span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 70px;
    font-size: 0.9rem;
    font-weight: bold;
    color: #888;
}

.board-container {
    display: flex;
    flex-direction: column;
}

.file-labels {
    display: flex;
    justify-content: space-around;
    width: 560px;
    padding-top: 8px;
}

.file-labels span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 70px;
    font-size: 0.9rem;
    font-weight: bold;
    color: #888;
}

#chess-board {
    display: grid;
    grid-template-columns: repeat(8, 70px);
    grid-template-rows: repeat(8, 70px);
    border: 4px solid #4a4a6a;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.square {
    width: 70px;
    height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

.square.light {
    background-color: #eeeed2;
}

.square.dark {
    background-color: #769656;
}

.square.selected {
    background-color: #baca44 !important;
}

.square.last-move-from {
    background-color: #aaa23a !important;
}

.square.last-move-to {
    background-color: #cdd26a !important;
}

.square.valid-move {
    position: relative;
}

.square.valid-move::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 50%;
}

.square.valid-move.has-piece::after {
    width: 100%;
    height: 100%;
    background-color: transparent;
    border: 4px solid rgba(0, 0, 0, 0.2);
    border-radius: 0;
    box-sizing: border-box;
}

.square:hover {
    opacity: 0.9;
}

.piece {
    width: 90%;
    height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.1s;
    touch-action: none;
}

.piece svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.3));
    pointer-events: none;
}

.piece:hover {
    transform: scale(1.1);
}

.piece.ghost {
    opacity: 0.9;
    cursor: grabbing;
    transform: scale(1.1);
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
}

.controls {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

.controls button {
    padding: 12px 30px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    background-color: #4ecca3;
    color: #1a1a2e;
}

.controls button:hover {
    background-color: #3db892;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(78, 204, 163, 0.4);
}

.controls button:active {
    transform: translateY(0);
}

/* Training Mode Toggle */
.training-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.training-toggle label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #aaa;
    font-size: 0.95rem;
}

.training-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #4ecca3;
}

.training-toggle .toggle-label {
    color: #4ecca3;
}

/* Move Feedback Popup */
.move-feedback {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    border-radius: 12px;
    background: #2a2a4a;
    border-left: 4px solid;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    animation: slideIn 0.3s ease;
    max-width: 280px;
}

.move-feedback.inaccuracy {
    border-color: #f0ad4e;
    background: linear-gradient(135deg, #2a2a4a 0%, #3a3a2a 100%);
}

.move-feedback.mistake {
    border-color: #e67e22;
    background: linear-gradient(135deg, #2a2a4a 0%, #4a2a2a 100%);
}

.move-feedback.blunder {
    border-color: #e74c3c;
    background: linear-gradient(135deg, #2a2a4a 0%, #5a2020 100%);
}

.feedback-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.feedback-icon {
    font-size: 1.5rem;
}

.move-feedback.inaccuracy .feedback-icon { color: #f0ad4e; }
.move-feedback.mistake .feedback-icon { color: #e67e22; }
.move-feedback.blunder .feedback-icon { color: #e74c3c; }

.feedback-label {
    font-size: 1.1rem;
    font-weight: bold;
    color: #fff;
}

.feedback-details {
    color: #ccc;
    font-size: 0.9rem;
    line-height: 1.5;
}

.feedback-details p {
    margin: 5px 0;
}

.feedback-details strong {
    color: #fff;
}

.feedback-close {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.feedback-close:hover {
    color: #fff;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.move-feedback.fade-out {
    animation: fadeOut 0.3s ease forwards;
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

