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

body {
    font-family: "Open Sans", sans-serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-variation-settings: "wdth" 100;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 30px;
    max-width: 600px;
    width: 100%;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2.5em;
}

h2 {
    color: #555;
    margin-bottom: 20px;
    text-align: center;
}

h3 {
    color: #666;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.setup-section {
    margin-bottom: 25px;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.radio-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.radio-group label:hover {
    border-color: #667eea;
    background-color: #f8f9ff;
}

.radio-group input[type="radio"] {
    margin-right: 10px;
    transform: scale(1.2);
}

.radio-group input[type="radio"]:checked + span,
.radio-group label:has(input[type="radio"]:checked) {
    border-color: #667eea;
    background-color: #f0f4ff;
    font-weight: bold;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease;
    width: 100%;
    margin-top: 20px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #dee2e6;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 5px;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.current-player {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
}

.symbol-selector {
    display: flex;
    gap: 10px;
}

.symbol-btn {
    width: 50px;
    height: 50px;
    border: 3px solid #ddd;
    background: white;
    border-radius: 8px;
    font-size: 1.5em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.1s ease;
}

.symbol-btn:hover {
    transform: scale(1.05);
}

.symbol-btn#selectX {
    color: #e74c3c;
}

.symbol-btn#selectX:hover {
    border-color: #e74c3c;
}

.symbol-btn#selectX.active {
    border-color: #e74c3c;
    background: #fdf2f2;
    color: #e74c3c;
}

.symbol-btn#selectO {
    color: #3498db;
}

.symbol-btn#selectO:hover {
    border-color: #3498db;
}

.symbol-btn#selectO.active {
    border-color: #3498db;
    background: #f0f8ff;
    color: #3498db;
}

.game-status {
    font-size: 1.1em;
    color: #666;
    text-align: center;
    width: 100%;
    margin-top: 10px;
    min-height: 2.5em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: 3px;
    background: #333;
    border-radius: 10px;
    padding: 10px;
    margin: 20px 0;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.cell {
    aspect-ratio: 1;
    background: white;
    border: none;
    border-radius: 5px;
    font-size: 1.5em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 50px;
}

.cell:hover:not(.occupied) {
    background: #f0f4ff;
    transform: scale(1.05);
}

.cell.occupied {
    cursor: not-allowed;
}

.cell.x {
    color: #e74c3c;
}

.cell.o {
    color: #3498db;
}

.cell.winning {
    background: #f1c40f !important;
    animation: pulse 1s infinite;
}

.cell.last-move {
    background: #e8f4fd !important;
    border: 2px solid #667eea !important;
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.3);
}

.cell.last-move.x {
    background: #fdf2f2 !important;
    border: 2px solid #e74c3c !important;
    box-shadow: 0 0 8px rgba(231, 76, 60, 0.3);
}

.cell.last-move.o {
    background: #f0f8ff !important;
    border: 2px solid #3498db !important;
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.3);
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.game-controls {
    text-align: center;
    margin-top: 20px;
}

.info-sections {
    margin-top: 40px;
}

.collapsible-section {
    margin-bottom: 25px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 5px solid #667eea;
    overflow: hidden;
    transition: all 0.3s ease;
}

.collapsible-section:hover {
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.1);
}

.section-header {
    padding: 20px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    transition: background-color 0.3s ease;
    user-select: none;
}

.section-header:hover {
    background: #e9ecef;
}

.section-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.2em;
}

.toggle-icon {
    font-size: 1.2em;
    color: #667eea;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.toggle-icon.collapsed {
    transform: rotate(-90deg);
}

.section-content {
    padding: 0 20px 20px 20px;
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.section-content.collapsed {
    max-height: 0;
    padding: 0 20px;
}

.section-content ul {
    list-style-position: inside;
    color: #555;
    margin: 0;
}

.section-content li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.reference {
    margin: 0;
}

.reference p {
    color: #666;
    font-size: 0.9em;
    margin: 0;
}

.reference a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.reference a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.section-content p {
    margin-bottom: 12px;
    line-height: 1.6;
    color: #555;
}

.section-content strong {
    color: #333;
}

.strategy-sources {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.strategy-sources p {
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.strategy-sources ul {
    list-style-position: inside;
    color: #555;
    margin: 0;
}

.strategy-sources li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.strategy-sources a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.strategy-sources a:hover {
    color: #764ba2;
    text-decoration: underline;
}

.game-over {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.game-over-content {
    background: white;
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.game-over h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 2em;
}

.game-over p {
    color: #666;
    margin-bottom: 30px;
    font-size: 1.2em;
    line-height: 1.4;
}

@media (max-width: 600px) {
    .container {
        padding: 20px;
        margin: 10px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .game-info {
        flex-direction: column;
        text-align: center;
    }
    
    .game-status {
        font-size: 1em;
        min-height: 2em;
    }
    
    .game-board {
        max-width: 300px;
    }
    
    .cell {
        min-height: 40px;
        font-size: 1.2em;
    }
    
    .radio-group {
        gap: 8px;
    }
    
    .radio-group label {
        padding: 8px;
        font-size: 0.9em;
    }
}
