:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(45deg, #f093fb 0%, #f5576c 100%);
    --accent-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --dark-color: #1f2937;
    --light-color: #f8fafc;
    --border-radius: 16px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-xl: 0 35px 60px -12px rgba(0, 0, 0, 0.3);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease-out;
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.2);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--primary-gradient);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    pointer-events: none;
}

.game-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: var(--shadow-xl);
    padding: 40px;
    max-width: 600px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
    z-index: 1;
}

.header {
    text-align: center;
    margin-bottom: 40px;
}

.title {
    font-size: 3em;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    letter-spacing: -0.02em;
}

.subtitle {
    color: #64748b;
    font-size: 1.1em;
    font-weight: 500;
    margin-bottom: 20px;
}

.stats-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.stat-item {
    background: var(--light-color);
    padding: 15px;
    border-radius: var(--border-radius);
    text-align: center;
    border: 2px solid #e2e8f0;
    transition: var(--transition);
}

.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.stat-value {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--dark-color);
}

.stat-label {
    font-size: 0.85em;
    color: #64748b;
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

.control-group {
    background: var(--light-color);
    padding: 20px;
    border-radius: var(--border-radius);
    border: 2px solid #e2e8f0;
    transition: var(--transition);
}

.control-group:hover {
    border-color: #667eea;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.control-group h3 {
    margin-bottom: 15px;
    color: var(--dark-color);
    font-size: 1.2em;
    font-weight: 600;
}

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

.radio-option {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: var(--transition);
}

.radio-option:hover {
    background: rgba(102, 126, 234, 0.1);
}

.radio-option input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.radio-option span {
    font-weight: 500;
    color: var(--dark-color);
}

.game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 40px 0;
    background: var(--light-color);
    padding: 25px;
    border-radius: 20px;
    border: 3px solid #e2e8f0;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.cell {
    aspect-ratio: 1;
    background: white;
    border: 3px solid #e2e8f0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3em;
    font-weight: 900;
    cursor: pointer;
    transition: var(--transition);
    min-height: 90px;
    position: relative;
    overflow: hidden;
}

.cell::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--primary-gradient);
    opacity: 0;
    transition: var(--transition);
}

.cell:hover:not(.disabled) {
    border-color: #667eea;
    transform: scale(1.05) rotate(1deg);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.3);
}

.cell:hover:not(.disabled)::before {
    opacity: 0.1;
}

.cell.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.cell.disabled:hover {
    transform: none;
    border-color: #e2e8f0;
    box-shadow: none;
}

.cell.x {
    color: var(--danger-color);
    text-shadow: 2px 2px 4px rgba(239, 68, 68, 0.3);
}

.cell.o {
    color: var(--info-color);
    text-shadow: 2px 2px 4px rgba(59, 130, 246, 0.3);
}

.cell.winning {
    background: linear-gradient(45deg, #10b981, #34d399);
    color: white;
    animation: winPulse 1s ease-in-out infinite alternate;
}

.cell.bot-move {
    animation: botMove 0.6s ease-out;
}

.cell.player-move {
    animation: playerMove 0.4s ease-out;
}

@keyframes winPulse {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

@keyframes botMove {
    0% { transform: scale(0) rotate(180deg); opacity: 0; }
    50% { transform: scale(1.2) rotate(90deg); opacity: 0.8; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

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

.game-info {
    text-align: center;
    margin: 30px 0;
}

.status {
    font-size: 1.4em;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 20px;
    padding: 15px;
    background: var(--light-color);
    border-radius: var(--border-radius);
    border: 2px solid #e2e8f0;
}

.status.bot-turn {
    border-color: var(--info-color);
    background: rgba(59, 130, 246, 0.1);
}

.status.player-turn {
    border-color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
}

.status.game-over {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    min-width: 140px;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.5);
}

.btn-secondary {
    background: #64748b;
    color: white;
    box-shadow: 0 8px 25px rgba(100, 116, 139, 0.3);
}

.btn-secondary:hover {
    background: #475569;
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(100, 116, 139, 0.4);
}

.btn-danger {
    background: var(--secondary-gradient);
    color: white;
    box-shadow: 0 8px 25px rgba(245, 87, 108, 0.4);
}

.btn-danger:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(245, 87, 108, 0.5);
}

.analysis-panel {
    margin-top: 30px;
    padding: 25px;
    background: var(--dark-color);
    color: white;
    border-radius: var(--border-radius);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    line-height: 1.6;
    box-shadow: var(--shadow-lg);
}

.analysis-panel.hidden {
    display: none;
}

.analysis-header {
    color: #10b981;
    font-weight: 700;
    margin-bottom: 15px;
    font-size: 1.1em;
}

.analysis-content {
    color: #e5e7eb;
}

.analysis-content .highlight {
    color: #fbbf24;
    font-weight: 600;
}

.analysis-content .success {
    color: #10b981;
}

.analysis-content .danger {
    color: #ef4444;
}

.analysis-content .info {
    color: #3b82f6;
}

.difficulty-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
    padding: 15px;
    background: rgba(239, 68, 68, 0.1);
    border: 2px solid var(--danger-color);
    border-radius: var(--border-radius);
    color: var(--danger-color);
    font-weight: 600;
}

.difficulty-indicator::before {
    content: '⚠️';
    font-size: 1.2em;
}

.github-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--dark-color);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.github-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

@media (max-width: 768px) {
    .game-container {
        padding: 25px;
        margin: 10px;
    }
    
    .controls {
        grid-template-columns: 1fr;
    }
    
    .stats-bar {
        grid-template-columns: 1fr;
    }
    
    .title {
        font-size: 2.2em;
    }
    
    .cell {
        font-size: 2.2em;
        min-height: 70px;
    }
    
    .buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .github-badge {
        position: static;
        margin-bottom: 20px;
        align-self: center;
    }
}

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Professional Footer Styles */
.footer {
    margin-top: 40px;
    padding: 30px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: var(--border-radius);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.footer-attribution {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--dark-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-attribution .heart {
    color: #ef4444;
    font-size: 1.2em;
    animation: heartbeat 2s ease-in-out infinite;
}

.footer-links {
    display: flex;
    gap: 20px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 25px;
    text-decoration: none;
    color: var(--dark-color);
    font-weight: 500;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.footer-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: white;
    border-color: #667eea;
}

.footer-link.github {
    background: var(--dark-color);
    color: white;
    border-color: var(--dark-color);
}

.footer-link.github:hover {
    background: #374151;
    transform: translateY(-2px) scale(1.05);
}

.footer-divider {
    width: 60px;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: 1px;
    margin: 10px 0;
}

.footer-copyright {
    font-size: 0.9em;
    color: #64748b;
    font-weight: 400;
}

@keyframes heartbeat {
    0%, 50%, 100% { transform: scale(1); }
    25%, 75% { transform: scale(1.1); }
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 10px rgba(102, 126, 234, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(102, 126, 234, 0); }
}

/* Keyboard shortcuts indicator */
.keyboard-hint {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--dark-color);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.8em;
    opacity: 0;
    transform: translateY(20px);
    transition: var(--transition);
    z-index: 1000;
    max-width: 200px;
}

.keyboard-hint.show {
    opacity: 0.9;
    transform: translateY(0);
}

.keyboard-hint kbd {
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
}

/* Enhanced Professional Styling */
.game-container {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: var(--shadow-xl);
    padding: 40px;
    max-width: 600px;
    width: 100%;
    border: 1px solid var(--glass-border);
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.game-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-gradient);
    z-index: 2;
}

/* Enhanced Button Styles */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    min-width: 140px;
    position: relative;
    overflow: hidden;
    font-family: inherit;
    letter-spacing: 0.025em;
}

.btn:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Enhanced Stats Bar */
.stat-item {
    background: var(--glass-bg);
    padding: 20px 15px;
    border-radius: var(--border-radius);
    text-align: center;
    border: 1px solid var(--glass-border);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    transform: scaleX(0);
    transition: var(--transition);
}

.stat-item:hover::before {
    transform: scaleX(1);
}

/* Enhanced Mobile Responsiveness */
@media (max-width: 768px) {
    .game-container {
        padding: 25px;
        margin: 10px;
        border-radius: 20px;
    }
    
    .controls {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stats-bar {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .title {
        font-size: 2.2em;
    }
    
    .cell {
        font-size: 2.2em;
        min-height: 70px;
    }
    
    .buttons {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    
    .btn {
        min-width: 200px;
    }
    
    .github-badge {
        position: static;
        margin-bottom: 20px;
        align-self: center;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 10px;
    }
    
    .footer-content {
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .game-container {
        padding: 20px;
        margin: 5px;
    }
    
    .title {
        font-size: 1.8em;
    }
    
    .subtitle {
        font-size: 1em;
    }
    
    .cell {
        font-size: 2em;
        min-height: 60px;
    }
    
    .control-group {
        padding: 15px;
    }
    
    .stat-item {
        padding: 15px 10px;
    }
}