/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

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

.title {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* Screen Management */
.screen {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: block;
}

/* Menu Screen */
.menu-container {
    max-width: 600px;
    margin: 0 auto;
}

.menu-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.menu-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px var(--shadow);
    border-color: var(--accent-primary);
}

.menu-btn.primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
}

.btn-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}

.btn-text {
    font-size: 1.3rem;
    font-weight: 600;
}

.btn-desc {
    font-size: 0.95rem;
    opacity: 0.8;
}

/* Difficulty Selector */
.difficulty-selector {
    text-align: center;
}

.difficulty-selector h3 {
    margin-bottom: 20px;
    color: var(--text-secondary);
}

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

.difficulty-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-weight: 500;
}

.difficulty-btn:hover {
    transform: translateY(-2px);
    background: var(--accent-primary);
    color: white;
}

/* Game Screen */
.game-container {
    max-width: 1200px;
    margin: 0 auto;
}

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

.back-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
}

.back-btn:hover {
    background: var(--accent-primary);
    color: white;
}

.game-info {
    display: flex;
    gap: 20px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Keyboard Instructions */
.keyboard-instructions {
    text-align: center;
    margin-bottom: 15px;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 8px 16px;
    background: var(--glass-bg);
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

/* Bot Toggle */
.bot-toggle-container {
    text-align: center;
    margin-bottom: 30px;
}

.bot-toggle {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.bot-slider {
    position: relative;
    width: 50px;
    height: 26px;
    background: var(--bg-tertiary);
    border-radius: 13px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#bot-toggle:checked + .bot-slider {
    background: var(--accent-primary);
}

.bot-icon {
    font-size: 16px;
    transition: all 0.3s ease;
}

.bot-label {
    font-weight: 500;
    color: var(--text-secondary);
}

/* Main Game Area - Responsive Layout */
.game-main {
    display: flex;
    gap: 30px;
    align-items: flex-start;
    justify-content: center;
    margin-bottom: 30px;
}

/* Sudoku Board */
.sudoku-container {
    flex-shrink: 0;
}

.sudoku-board {
    display: grid;
    grid-template-columns: repeat(9, 1fr);
    grid-template-rows: repeat(9, 1fr);
    gap: 2px;
    background: var(--box-border);
    padding: 8px;
    border-radius: 12px;
    width: 450px;
    height: 450px;
    border: 3px solid var(--box-border);
    position: relative;
}

/* 3x3 Box Separators */
.sudoku-board::before,
.sudoku-board::after {
    content: '';
    position: absolute;
    background: var(--box-border);
    z-index: 1;
    pointer-events: none;
}

.sudoku-board::before {
    width: 3px;
    height: calc(100% - 16px);
    top: 8px;
    left: calc(33.333% + 1px);
}

.sudoku-board::after {
    width: 3px;
    height: calc(100% - 16px);
    top: 8px;
    right: calc(33.333% + 1px);
}

.sudoku-board .horizontal-separator {
    position: absolute;
    width: calc(100% - 16px);
    height: 3px;
    background: var(--box-border);
    left: 8px;
    z-index: 1;
    pointer-events: none;
}

.sudoku-board .horizontal-separator:first-of-type {
    top: calc(33.333% + 1px);
}

.sudoku-board .horizontal-separator:last-of-type {
    bottom: calc(33.333% + 1px);
}

.sudoku-cell {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    position: relative;
    z-index: 2;
}

/* Alternating 3x3 box backgrounds for better visual separation */
.sudoku-cell:nth-child(3n+1):nth-child(-n+3),
.sudoku-cell:nth-child(3n+2):nth-child(-n+3),
.sudoku-cell:nth-child(3n+3):nth-child(-n+3),
.sudoku-cell:nth-child(n+10):nth-child(-n+12),
.sudoku-cell:nth-child(n+19):nth-child(-n+21),
.sudoku-cell:nth-child(n+28):nth-child(-n+30),
.sudoku-cell:nth-child(n+37):nth-child(-n+39),
.sudoku-cell:nth-child(n+46):nth-child(-n+48),
.sudoku-cell:nth-child(n+55):nth-child(-n+57),
.sudoku-cell:nth-child(n+64):nth-child(-n+66),
.sudoku-cell:nth-child(n+73):nth-child(-n+75) {
    background: var(--bg-secondary);
}

.sudoku-cell:nth-child(n+4):nth-child(-n+6),
.sudoku-cell:nth-child(n+13):nth-child(-n+15),
.sudoku-cell:nth-child(n+22):nth-child(-n+24),
.sudoku-cell:nth-child(n+31):nth-child(-n+33),
.sudoku-cell:nth-child(n+40):nth-child(-n+42),
.sudoku-cell:nth-child(n+49):nth-child(-n+51),
.sudoku-cell:nth-child(n+58):nth-child(-n+60),
.sudoku-cell:nth-child(n+67):nth-child(-n+69),
.sudoku-cell:nth-child(n+76):nth-child(-n+78) {
    background: var(--bg-tertiary);
}

.sudoku-cell:nth-child(n+7):nth-child(-n+9),
.sudoku-cell:nth-child(n+16):nth-child(-n+18),
.sudoku-cell:nth-child(n+25):nth-child(-n+27),
.sudoku-cell:nth-child(n+34):nth-child(-n+36),
.sudoku-cell:nth-child(n+43):nth-child(-n+45),
.sudoku-cell:nth-child(n+52):nth-child(-n+54),
.sudoku-cell:nth-child(n+61):nth-child(-n+63),
.sudoku-cell:nth-child(n+70):nth-child(-n+72),
.sudoku-cell:nth-child(n+79):nth-child(-n+81) {
    background: var(--bg-secondary);
}

.sudoku-cell:hover {
    background: var(--glass-bg) !important;
}

.sudoku-cell.selected {
    background: var(--accent-primary) !important;
    color: white;
    box-shadow: 0 0 0 3px var(--accent-secondary);
    z-index: 10;
}

.sudoku-cell.given {
    background: var(--bg-tertiary) !important;
    color: var(--accent-tertiary);
    font-weight: 700;
}

.sudoku-cell.bot-entry {
    background: rgba(16, 185, 129, 0.2) !important;
    color: var(--success);
    font-weight: 700;
}

.sudoku-cell.error {
    background: var(--error) !important;
    color: white;
    animation: shake 0.5s ease-in-out;
}

.sudoku-cell.hint {
    background: var(--success) !important;
    color: white;
    animation: pulse 1s ease-in-out;
}

.sudoku-cell.highlighted {
    background: var(--hint-bg) !important;
    border: 2px solid var(--highlight);
    animation: glow 1.5s ease-in-out infinite;
}

.sudoku-cell.conflict {
    background: rgba(239, 68, 68, 0.3) !important;
    border: 2px solid var(--error);
}

.sudoku-cell input {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    text-align: center;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    outline: none;
}

/* Manual Board */
.manual-board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.manual-board {
    width: 400px;
    height: 400px;
}

.manual-board .sudoku-cell {
    background: var(--glass-bg) !important;
    border: 1px solid var(--glass-border);
}

.manual-board .sudoku-cell input {
    color: var(--text-primary);
}

/* Validation Status */
.validation-status {
    margin-bottom: 20px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    min-height: 20px;
    transition: all 0.3s ease;
}

.validation-status.valid {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid var(--success);
    color: var(--success);
}

.validation-status.invalid {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid var(--error);
    color: var(--error);
}

.validation-status.warning {
    background: rgba(245, 158, 11, 0.2);
    border: 1px solid var(--warning);
    color: var(--warning);
}

/* Bot Panel */
.bot-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 20px;
    width: 350px;
    height: fit-content;
    display: none;
    flex-shrink: 0;
}

.bot-panel.active {
    display: block;
    animation: slideDown 0.3s ease-out;
}

.bot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.bot-title {
    font-weight: 600;
    font-size: 1.1rem;
}

.bot-status {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.bot-suggestion {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    min-height: 80px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.bot-welcome {
    text-align: center;
}

.bot-welcome p {
    margin-bottom: 8px;
}

.bot-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bot-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    text-align: left;
}

.bot-btn:hover {
    background: var(--accent-secondary);
    transform: translateY(-1px);
}

.bot-btn.solve-btn {
    background: var(--success);
    margin-top: 8px;
    font-weight: 600;
}

.bot-btn.solve-btn:hover {
    background: #059669;
}

/* Game Controls */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.control-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-weight: 500;
}

.control-btn:hover {
    transform: translateY(-2px);
    background: var(--bg-tertiary);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.control-btn.primary {
    background: var(--accent-primary);
    color: white;
}

.control-btn.primary:hover {
    background: var(--accent-secondary);
}

.control-btn.primary:disabled {
    background: var(--accent-primary);
    opacity: 0.5;
}

/* Manual Input Screen */
.manual-container {
    max-width: 600px;
    margin: 0 auto;
}

.manual-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.manual-header h2 {
    color: var(--text-primary);
}

.manual-instructions {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 30px;
    line-height: 1.5;
}

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

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 2000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    animation: scaleIn 0.3s ease-out;
}

.modal-content h2 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 25px;
    line-height: 1.5;
}

.modal-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stat-value {
    color: var(--accent-primary);
    font-weight: 600;
    font-size: 1.1rem;
}

.modal-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.modal-btn {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-weight: 500;
}

.modal-btn:hover {
    transform: translateY(-2px);
    background: var(--bg-tertiary);
}

.modal-btn.primary {
    background: var(--accent-primary);
    color: white;
}

.modal-btn.primary:hover {
    background: var(--accent-secondary);
}

/* Solve Animation */
.solve-animation {
    margin: 20px 0;
    display: flex;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--glass-border);
    border-top: 4px solid var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .game-main {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }
    
    .bot-panel {
        width: 100%;
        max-width: 450px;
    }
    
    .bot-actions {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .bot-btn {
        flex: 1;
        min-width: 120px;
        text-align: center;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .title {
        font-size: 2.5rem;
    }
    
    .menu-options {
        gap: 15px;
    }
    
    .menu-btn {
        padding: 20px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .sudoku-board {
        width: 350px;
        height: 350px;
    }
    
    .manual-board {
        width: 350px;
        height: 350px;
    }
    
    .sudoku-cell {
        font-size: 1rem;
    }
    
    .game-controls {
        gap: 10px;
    }
    
    .control-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .modal-content {
        padding: 30px 20px;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .theme-dropdown {
        right: -20px;
        min-width: 260px;
    }
    
    .theme-options {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 2rem;
    }
    
    .sudoku-board {
        width: 300px;
        height: 300px;
    }
    
    .manual-board {
        width: 300px;
        height: 300px;
    }
    
    .sudoku-cell {
        font-size: 0.9rem;
    }
    
    .difficulty-options {
        flex-direction: column;
        align-items: center;
    }
    
    .difficulty-btn {
        width: 200px;
    }
    
    .bot-actions {
        flex-direction: column;
    }
    
    .bot-btn {
        text-align: center;
    }
    
    .theme-selector {
        top: 10px;
        right: 10px;
    }
    
    .theme-toggle-btn {
        padding: 8px 12px;
        font-size: 12px;
    }
}