:root {
            --bg-light: #f8f9fa;
            --bg-dark: #1a1a1a;
            --text-light: #ffffff;
            --text-dark: #f8f9fa;
            --card-light: rgba(255, 255, 255, 0.9);
            --card-dark: rgba(33, 37, 41, 0.9);

    --text-color: #f0f0f0;
    --container-bg: #3c3c3c;
    --header-color: #f0f0f0;
    --button-primary: #1bd21b;
    --button-primary-hover: #ff03af;
    --button-secondary: #3d0dd0;
    --button-secondary-hover: #ff03af;
    --button-danger: #ff1900;
    --button-danger-hover: #ffd503;
    --games-list-bg: #444;
    --game-item-bg: #555;
    --board-border: #666;
    --square-selected: #5cb85c;
    --square-possible-move: #d4ac0d;
    --modal-bg: #5c5252a9;
    --modal-overlay: rgba(0, 0, 0, 0.7);
    --chat-bg: #444;
    --chat-message-bg: #555;
    --chat-input-bg: #666;
    --chat-border: #777;
    --bg-color: #1e2124;
    --board-shadow: rgba(0, 0, 0, 0.3);
    --player-info: #ff0202;

    --white-square: #f0d9b5;
    --black-square: #b58863;

 }

[data-theme="light"] {
    --bg-color: #f5f5f5;
    --text-color: #ffffff;
    --container-bg: white;
    --header-color: #333;
    --button-primary: #4CAF50;
    --button-primary-hover: #45a049;
    --button-secondary: #2196F3;
    --button-secondary-hover: #0b7dda;
    --button-danger: #f44336;
    --button-danger-hover: #da190b;
    --games-list-bg: #f5f5f5;
    --game-item-bg: white;
    --board-border: #333;
    --square-selected: #7fc97f;
    --square-possible-move: #ffeb3b;
    --modal-bg: rgb(233, 220, 220);
    --modal-overlay: rgba(0, 0, 0, 0.5);
    --chat-bg: #f9f9f9;
    --chat-message-bg: #e9e9e9;
    --chat-input-bg: white;
    --chat-border: #ddd;
    --board-shadow: rgba(248, 245, 245, 0.722);
    --player-info: #ff0000;
}
/* Board color schemes */
[data-board-color="default"] {
    --white-square: #f0d9b5;
    --black-square: #b58863;
}

[data-board-color="blue"] {
    --white-square: #dee3e6;
    --black-square: #8ca2ad;
}

[data-board-color="green"] {
    --white-square: #eeeed2;
    --black-square: #769656;
}

[data-board-color="red"] {
    --white-square: #f5d6d6;
    --black-square: #b33e3e;
}

[data-board-color="purple"] {
    --white-square: #e8d6f5;
    --black-square: #9b59b6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s;
}

            

        body {
            transition: all 0.3s ease;
            background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: var(--text-light);
            min-height: 100vh;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body.dark-mode {
            background-image: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
            color: var(--text-dark);
        }

         .main-container {
            backdrop-filter: blur(20px);
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 20px;
            padding: 30px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
            max-width: 600px;
            width: 100%;
            align-items: center;
            justify-content: center;
            margin-top: 60px;
        }
        .main-container .card {
            backdrop-filter: blur(20px);
            background-color: #363691;
            border-radius: 20px;
            width: 100%;
        }

        .list-group-item {
            background-color: #363691;
            color: #fff;
            border: 1px solid rgba(255, 255, 255, 0.3);
        }
        
        .chess-title {
            font-size: 3rem;
            font-weight: bold;
            text-align: center;
            color: white;
            margin-bottom: 30px;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
        }
        
        .form-control {
            background: rgba(255, 255, 255, 0.1);
            border: 1px solid rgba(255, 255, 255, 0.3);
            color: white !important;
            border-radius: 10px;
            padding: 12px 15px;
        }

        .form-control::placeholder {
            color: rgba(255, 255, 255, 0.7) !important;
        }
        
        .form-control:focus {
            background: rgba(255, 255, 255, 0.2);
            border-color: rgba(255, 255, 255, 0.5);
            color: white !important;
            box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25);
        }
        
        
        .btn-custom {
            background: linear-gradient(45deg, #667eea, #764ba2);
            border: none;
            border-radius: 10px;
            padding: 12px 25px;
            font-weight: 600;
            color: white;
            transition: all 0.3s ease;
        }
        
        .btn-custom:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
            color: white;
        }
        
        .section-title {
            color: white;
            font-weight: 600;
            margin-bottom: 20px;
            text-align: center;
        }
        
        .divider {
            height: 1px;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
            margin: 30px 0;
        }
        
        .alert {
            border-radius: 10px;
            border: none;
        }
        
        @media (max-width: 768px) {
            .main-container {
                padding: 30px 20px;
            }
            
            .chess-title {
                font-size: 2rem;
            }
            
            .gabung {
                margin-top: 30px;
            }
            
        }

        .chess-container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 20px;
        }

        .game-header {
            background: var(--card-light);
            backdrop-filter: blur(10px);
            border-radius: 15px;
            padding: 20px;
            margin-bottom: 20px;
            border: 1px solid rgba(255, 255, 255, 0.2);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        }

        .dark-mode .game-header {
            background: var(--card-dark);
            border: 1px solid rgba(255, 255, 255, 0.1);
        }

        
.games-list {
    background-color: #363691;
    margin-top: 20px;
    padding: 20px;
    border-radius: 5px;
}

.game-item {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-item button {
    background: var(--button-secondary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 3px;
    cursor: pointer;
}

.game-item button:hover {
    background: var(--button-secondary-hover);
}


.game-info {
    text-align: center;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px;
}

.player-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px;
    border-radius: 5px;
    background: var(--game-item-bg);
    min-width: 150px;
}

.player-info.active {
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.7);
    background-color: var(--player-info);
    animation: animate-pulse 3s linear infinite;
}

@keyframes animate-pulse{
    0%{
        box-shadow: 0 0 0 0 rgba(255,109,74,0.7),  0 0 0 0 rgba(255,109,74,0.7);
    }
    40%{
        box-shadow: 0 0 0 50px rgba(255,109,74,0.0),  0 0 0 0 rgba(255,109,74,0.7);
    }
    80%{
        box-shadow: 0 0 0 50px rgba(255,109,74,0.0),  0 0 0 30px rgba(255,109,74,0);
    }
    100%{
        box-shadow: 0 0 0 0 rgba(255,109,74,0.0),  0 0 0 30px rgba(255,109,74,0);
    }
    
}


.game-status {
    flex-grow: 1;
    text-align: center;
    font-weight: bold;
    font-size: 1rem;
}
#currentTurn {
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.7;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.game-area {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.game-board-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 20px;
    flex-wrap: wrap;
}

.chess-board {
    display: grid;
    grid-template-columns: repeat(8, 60px);
    grid-template-rows: repeat(8, 60px);
    gap: 0;
    margin: 0 auto;
    border: 2px solid var(--board-border);
    box-shadow: 0 10px 30px var(--board-shadow);
    width: fit-content;
}

.chess-board.flipped {
    transform: rotate(180deg);
}

.square {
    width: 60px;
    height: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    font-size: 40px;
    position: relative;
    user-select: none;
}

.square.white {
    background-color: var(--white-square);
}

.square.black {
    background-color: var(--black-square);
}

.square.selected {
    background-color: var(--square-selected) !important;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.square.possible-move {
    background-color: var(--square-possible-move) !important;
}

.piece {
    user-select: none;
    cursor: grab;
    font-size: 45px;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
}

.piece.flipped {
    transform: rotate(180deg);
}

.piece.dragging {
    opacity: 0.6;
}

.game-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.game-controls button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.btn-primary {
    background: var(--button-primary);
    color: white;
    padding: 10px;
}

.btn-primary:hover {
    background: var(--button-primary-hover);
}

.btn-secondary {
    background: var(--button-secondary);
    color: white;
    padding: 10px;
}

.btn-secondary:hover {
    background: var(--button-secondary-hover);
}

.btn-danger {
    background: var(--button-danger);
    color: white;
    padding: 10px;
}

.btn-danger:hover {
    background: var(--button-danger-hover);
}

/* Chat System */
.game-sidebar {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
}
.lainnya {
    margin-top: 30px;
}

.chat-container {
    background: var(--chat-bg);
    border-radius: 5px;
    border: 1px solid var(--chat-border);
    display: flex;
    flex-direction: column;
    height: 400px;
}

.chat-header {
    padding: 10px;
    background: var(--button-secondary);
    color: white;
    border-top-left-radius: 5px;
    border-top-right-radius: 5px;
    font-weight: bold;
}

.chat-messages {
    flex-grow: 1;
    padding: 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 340px;
}

.chat-message {
    align-self: flex-start;
    padding: 8px 12px;
    border-radius: 5px;
    background: #311ca3;
    max-width: 80%;
    word-break: break-word;
}

.chat-message.own {
    align-self: flex-end;
    background: #333a41;
    color: white;
}

.chat-message .sender {
    font-weight: bold;
    margin-bottom: 3px;
    background: var(--chat-bg);
    color: #ffffff;
    max-width: fit-content;
}

.chat-input-container {
    display: flex;
    padding: 10px;
    border-top: 1px solid var(--chat-border);
}

.chat-input {
    flex-grow: 1;
    padding: 8px;
    border: 1px solid var(--chat-border);
    border-radius: 3px;
    background: var(--chat-input-bg);
    color: var(--text-color);
}

.chat-send {
    padding: 8px 15px;
    background: #03ad61;
    color: white;
    border: none;
    border-radius: 3px;
    margin-left: 5px;
    cursor: pointer;
}

/* Settings panel */
.settings-panel {
    padding: 15px;
}

.settings-group {
    margin-bottom: 15px;
}

.settings-group h3 {
    margin-bottom: 10px;
    text-align: left;
    font-size: 16px;
}

.color-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.color-option {
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    overflow: hidden;
}

.color-option.active {
    border-color: var(--button-secondary);
}

.color-option-inner {
    width: 50%;
    height: 100%;
}

.color-option-inner:first-child {
    background-color: var(--white-square);
}

.color-option-inner:last-child {
    background-color: var(--black-square);
}

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--button-secondary);
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

/* Modal styles */
.modal-overlay1 {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--modal-overlay);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay1.active {
    opacity: 1;
    visibility: visible;
}

.modal1 {
    background: var(--modal-bg);
    color: var(--text-color);
    border-radius: 10px;
    padding: 20px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transform: translateY(-20px);
    transition: transform 0.3s;
}

.modal-overlay1.active .modal1 {
    transform: translateY(0);
}

.modal1-header {
    text-align: center;
    color: var(--text-color);
    margin-bottom: 20px;
}

.modal1-body {
    margin-bottom: 20px;
    color: var(--text-color);
}

.modal1-footer {
    display: flex;
    justify-content: center;
    gap: 10px;
    color: var(--text-color);
}

/* Responsive design */
@media (max-width: 768px) {

    .menu button {
    
        padding: 8px 15px;
        margin: 5px;
        font-size: 10px;
     
    }
    
    .game-board-container {
        flex-direction: column;
        align-items: center;
    }
    
    .game-sidebar {
        width: 100%;
        max-width: 480px;
    }
    
    .chess-board {
        grid-template-columns: repeat(8, 40px);
        grid-template-rows: repeat(8, 40px);
    }
    
    .square {
        width: 40px;
        height: 40px;
        font-size: 30px;
    }
    
    .piece {
        font-size: 30px;
    }
    
    .game-info {
        width: 100%;
        gap: 10px;
    }
    
    .gabung {
        margin-top: 30px;
    }
   
}

@media (max-width: 480px) {
    .chess-board {
        grid-template-columns: repeat(8, 40px);
        grid-template-rows: repeat(8, 40px);
    }
    
    .square {
        width: 40px;
        height: 40px;
        font-size: 25px;
    }
    
    .piece {
        font-size: 25px;
    }
    
    .game-controls {
        align-items: center;
    }
    
    .gabung {
        margin-top: 30px;
    }
    
}

#checkmate-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
  animation: fadeIn 0.5s ease forwards;
}

.checkmate-text {
  font-size: 5rem;
  color: gold;
  font-weight: bold;
  text-shadow: 0 0 20px rgba(255,215,0,0.8), 0 0 40px rgba(255,215,0,0.6);
  animation: zoomIn 1s ease forwards;
}

@keyframes zoomIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modalDC {
      display:none; position:fixed; inset:0; 
      background:rgba(0,0,0,.5); 
      align-items:center; justify-content:center;
}
.modalDC .box {
      background:#fff; padding:20px 24px; border-radius:12px; min-width:280px;
      box-shadow:0 10px 30px rgba(0,0,0,.2);
}

.dot1 {
  height: 25px;
  width: 25px;
  background-color: #b58863;
  border-radius: 50%;
  display: inline-block;
}
.dot2 {
  height: 25px;
  width: 25px;
  background-color: #8ca2ad;
  border-radius: 50%;
  display: inline-block;
}
.dot3 {
  height: 25px;
  width: 25px;
  background-color: #769656;
  border-radius: 50%;
  display: inline-block;
}
.dot4 {
  height: 25px;
  width: 25px;
  background-color: #b33e3e;
  border-radius: 50%;
  display: inline-block;
}
.dot5 {
  height: 25px;
  width: 25px;
  background-color: #9b59b6;
  border-radius: 50%;
  display: inline-block;
}
