/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #f1f1f1;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

header h1 {
    font-size: 2.8rem;
    margin-bottom: 8px;
    background: linear-gradient(90deg, #00dbde, #fc00ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.subtitle {
    font-size: 1.2rem;
    color: #a0a0c0;
    font-weight: 500;
}

/* Game Wrapper */
.game-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 30px;
}

/* Game Info */
.game-info {
    flex: 1;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.player-info {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 25px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.player-info.active {
    border-color: #00dbde;
    box-shadow: 0 0 20px rgba(0, 219, 222, 0.3);
}

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

.player-icon {
    font-size: 2rem;
}

.player-icon.black {
    color: #000;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.player-icon.white {
    color: #fff;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.player-info h3 {
    font-size: 1.8rem;
    font-weight: 700;
}

.player-score {
    font-size: 2.2rem;
    font-weight: 700;
    text-align: center;
    margin: 15px 0;
}

.turn-indicator {
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    text-align: center;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.game-controls {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.game-status {
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn {
    padding: 15px 25px;
    border: none;
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn {
    background: linear-gradient(90deg, #00dbde, #fc00ff);
    color: white;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #f1f1f1;
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Board Container */
.board-container {
    position: relative;
    flex: 2;
    min-width: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    gap: 2px;
    background-color: #0a6e3c;
    border: 4px solid #8b4513;
    border-radius: 8px;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 1/1;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

.cell {
    background-color: #0a6e3c;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    position: relative;
}

.cell:hover {
    background-color: #0d8c4d;
}

.cell.valid:hover {
    background-color: rgba(0, 219, 222, 0.3);
}

.disk {
    width: 85%;
    height: 85%;
    border-radius: 50%;
    position: absolute;
    transition: transform 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.disk.black {
    background: radial-gradient(circle at 30% 30%, #666, #000);
}

.disk.white {
    background: radial-gradient(circle at 30% 30%, #fff, #ccc);
}

.disk.placed {
    animation: placeDisk 0.3s ease-out;
}

@keyframes placeDisk {
    0% { transform: scale(0); }
    70% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.board-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 0, 0, 0.85);
    color: white;
    padding: 20px 40px;
    border-radius: 10px;
    font-size: 1.8rem;
    font-weight: 700;
    z-index: 10;
    display: none;
    animation: fadeInOut 1.5s ease;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
    20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    80% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

/* Move History */
.move-history {
    flex: 1;
    min-width: 300px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 25px;
}

.move-history h3 {
    font-size: 1.5rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 10px;
}

.history-list::-webkit-scrollbar {
    width: 8px;
}

.history-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.history-list::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #00dbde, #fc00ff);
    border-radius: 10px;
}

.history-item {
    padding: 12px 15px;
    margin-bottom: 10px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-player {
    display: flex;
    align-items: center;
    gap: 10px;
}

.history-disk {
    width: 20px;
    height: 20px;
    border-radius: 50%;
}

.history-disk.black {
    background: #000;
}

.history-disk.white {
    background: #fff;
}

/* Rules Modal */
.rules-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.rules-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    border: 2px solid rgba(0, 219, 222, 0.3);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 25px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 2rem;
    display: flex;
    align-items: center;
    gap: 15px;
}

.close-modal {
    background: none;
    border: none;
    color: #f1f1f1;
    font-size: 2.5rem;
    cursor: pointer;
    transition: color 0.3s;
    line-height: 1;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: #00dbde;
}

.modal-body {
    padding: 30px;
}

.rules-section {
    margin-bottom: 30px;
}

.rules-section h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #00dbde;
    display: flex;
    align-items: center;
    gap: 10px;
}

.rules-section p, .rules-section ul {
    font-size: 1.1rem;
    color: #d0d0e0;
}

.rules-section ul {
    padding-left: 20px;
}

.rules-section li {
    margin-bottom: 10px;
}

.setup-example {
    margin: 20px 0;
    display: flex;
    justify-content: center;
}

.example-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 3px;
    width: 200px;
    height: 200px;
    background-color: #0a6e3c;
    border: 2px solid #8b4513;
    border-radius: 5px;
    padding: 5px;
}

.example-cell {
    background-color: #0a6e3c;
    border-radius: 3px;
    position: relative;
}

.example-cell.black::after, .example-cell.white::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    border-radius: 50%;
}

.example-cell.black::after {
    background: #000;
}

.example-cell.white::after {
    background: #fff;
}

/* Footer */
footer {
    text-align: center;
    padding: 25px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    color: #a0a0c0;
    font-size: 1rem;
}

/* Responsive Design */
@media (max-width: 1100px) {
    .game-wrapper {
        flex-direction: column;
    }
    
    .board-container {
        order: -1;
    }
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    .board {
        max-width: 400px;
    }
    
    .player-info, .game-controls, .move-history {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    header {
        padding: 15px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .board {
        max-width: 350px;
    }
    
    .modal-content {
        width: 95%;
        padding: 10px;
    }
    
    .modal-header h2 {
        font-size: 1.5rem;
    }
}