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

:root {
    --primary-pink: #FF006E;
    --primary-orange: #FB5607;
    --primary-yellow: #FFBE0B;
    --primary-purple: #8338EC;
    --primary-blue: #3A86FF;
    --dark-bg: #0a0a0a;
    --darker-bg: #050505;
    --card-bg: #1a1a1a;
    --text-light: #ffffff;
    --text-muted: #cccccc;
    --border-color: #333333;
    --success-color: #00ff88;
    --error-color: #ff4444;
    --warning-color: var(--primary-yellow);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--dark-bg) 0%, var(--darker-bg) 100%);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
    padding-bottom: 80px;
}

/* Header */
.app-header {
    background: var(--card-bg);
    border-bottom: 2px solid var(--primary-purple);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 0 20px rgba(131, 56, 236, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-header h1 {
    font-size: 1.5rem;
    background: linear-gradient(45deg, var(--primary-pink), var(--primary-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255, 0, 110, 0.5);
}

.header-controls {
    display: flex;
    gap: 0.5rem;
}

.header-btn {
    background: linear-gradient(45deg, var(--primary-purple), var(--primary-blue));
    border: none;
    color: var(--text-light);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    box-shadow: 0 0 15px rgba(131, 56, 236, 0.3);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 25px rgba(131, 56, 236, 0.6);
}

/* Main Content */
.app-main {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.section {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Game Section */
.game-info {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 0 20px rgba(131, 56, 236, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.difficulty-selector label {
    color: var(--text-muted);
    margin-right: 0.5rem;
}

.difficulty-selector select {
    background: var(--dark-bg);
    color: var(--text-light);
    border: 1px solid var(--primary-purple);
    border-radius: 8px;
    padding: 0.5rem;
    font-size: 1rem;
}

.game-stats {
    display: flex;
    gap: 1rem;
    font-weight: bold;
    color: var(--primary-yellow);
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.game-board {
    display: grid;
    gap: 2px;
    background: var(--primary-purple);
    padding: 10px;
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(131, 56, 236, 0.4);
    margin: 0 auto;
}

.game-board.size-6 { grid-template-columns: repeat(6, 1fr); }
.game-board.size-8 { grid-template-columns: repeat(8, 1fr); }
.game-board.size-10 { grid-template-columns: repeat(10, 1fr); }

.cell {
    width: 45px;
    height: 45px;
    background: var(--card-bg);
    border: 2px solid transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.cell:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.cell.fixed {
    background: linear-gradient(45deg, var(--primary-purple), var(--primary-blue));
    color: var(--text-light);
    cursor: not-allowed;
    box-shadow: 0 0 15px rgba(131, 56, 236, 0.5);
}

.cell.user {
    background: linear-gradient(45deg, var(--primary-pink), var(--primary-orange));
    color: var(--text-light);
    box-shadow: 0 0 15px rgba(255, 0, 110, 0.5);
}

.cell.hint {
    background: linear-gradient(45deg, var(--primary-yellow), var(--primary-orange));
    color: var(--dark-bg);
    box-shadow: 0 0 15px rgba(255, 190, 11, 0.5);
}

.cell.error {
    border-color: var(--error-color);
    box-shadow: 0 0 15px rgba(255, 68, 68, 0.5);
    animation: shake 0.5s ease-in-out;
}

.cell.valid {
    border-color: var(--success-color);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.game-controls {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.control-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
    justify-content: center;
}

.control-btn.validate {
    background: linear-gradient(45deg, var(--success-color), #00cc70);
    color: var(--dark-bg);
}

.control-btn.clear {
    background: linear-gradient(45deg, var(--primary-orange), var(--primary-yellow));
    color: var(--dark-bg);
}

.control-btn.solve {
    background: linear-gradient(45deg, var(--primary-purple), var(--primary-pink));
    color: var(--text-light);
}

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

.game-message {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 1rem;
    margin-top: 1rem;
    text-align: center;
    border: 2px solid var(--primary-purple);
    box-shadow: 0 0 20px rgba(131, 56, 236, 0.3);
}

.game-message.hidden {
    display: none;
}

.game-message.success {
    border-color: var(--success-color);
    background: linear-gradient(45deg, rgba(0, 255, 136, 0.1), rgba(0, 204, 112, 0.1));
}

.game-message.error {
    border-color: var(--error-color);
    background: linear-gradient(45deg, rgba(255, 68, 68, 0.1), rgba(255, 34, 34, 0.1));
}

.rules-summary {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 1rem;
    margin-top: 1rem;
    border: 1px solid var(--border-color);
}

.rules-summary h3 {
    color: var(--primary-yellow);
    margin-bottom: 0.5rem;
}

.rules-summary ul {
    list-style: none;
    padding-left: 0;
}

.rules-summary li {
    padding: 0.3rem 0;
    color: var(--text-muted);
}

/* Tutorial Section */
.tutorial-content {
    max-width: 800px;
    margin: 0 auto;
}

.tutorial-content h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-yellow);
    font-size: 2rem;
}

.tutorial-step {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 0 20px rgba(131, 56, 236, 0.2);
}

.tutorial-step h3 {
    color: var(--primary-pink);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.tutorial-step p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.tutorial-example {
    background: var(--dark-bg);
    border-radius: 10px;
    padding: 1rem;
    margin-top: 1rem;
}

.mini-board {
    display: flex;
    gap: 5px;
    margin-bottom: 0.5rem;
    justify-content: center;
}

.mini-board .cell {
    width: 30px;
    height: 30px;
    font-size: 1rem;
}

.mini-board .cell.deduced {
    background: linear-gradient(45deg, var(--primary-yellow), var(--primary-orange));
    color: var(--dark-bg);
}

.mini-board .cell.empty {
    background: var(--border-color);
    color: var(--text-muted);
}

.tutorial-btn {
    background: linear-gradient(45deg, var(--primary-purple), var(--primary-blue));
    color: var(--text-light);
    border: none;
    padding: 1rem 2rem;
    border-radius: 25px;
    font-size: 1.1rem;
    cursor: pointer;
    display: block;
    margin: 2rem auto 0;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(131, 56, 236, 0.3);
}

.tutorial-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 30px rgba(131, 56, 236, 0.6);
}

/* Statistics Section */
.stats-content {
    max-width: 800px;
    margin: 0 auto;
}

.stats-content h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-yellow);
    font-size: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: 0 0 20px rgba(131, 56, 236, 0.2);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.stat-info h3 {
    font-size: 2rem;
    color: var(--primary-pink);
    margin-bottom: 0.5rem;
}

.stat-info p {
    color: var(--text-muted);
}

.difficulty-stats {
    background: var(--card-bg);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border-color);
}

.difficulty-stats h3 {
    color: var(--primary-purple);
    margin-bottom: 1rem;
}

.difficulty-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.difficulty-item {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
}

.difficulty-label {
    font-weight: bold;
}

.reset-btn {
    background: linear-gradient(45deg, var(--error-color), #cc3333);
    color: var(--text-light);
    border: none;
    padding: 1rem 2rem;
    border-radius: 25px;
    font-size: 1rem;
    cursor: pointer;
    display: block;
    margin: 0 auto;
    transition: all 0.3s ease;
}

.reset-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(255, 68, 68, 0.3);
}

/* FAQ Section */
.faq-content {
    max-width: 800px;
    margin: 0 auto;
}

.faq-content h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--primary-yellow);
    font-size: 2rem;
}

.faq-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.faq-item {
    background: var(--card-bg);
    border-radius: 15px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    box-shadow: 0 0 20px rgba(131, 56, 236, 0.2);
}

.faq-question {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-light);
    padding: 1.5rem;
    text-align: left;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.3s ease;
}

.faq-question:hover {
    background: rgba(131, 56, 236, 0.1);
}

.faq-question[aria-expanded="true"] {
    background: rgba(131, 56, 236, 0.2);
}

.faq-icon {
    font-size: 1.5rem;
    color: var(--primary-purple);
    transition: transform 0.3s ease;
}

.faq-question[aria-expanded="true"] .faq-icon {
    transform: rotate(45deg);
}

.faq-answer {
    padding: 0 1.5rem 1.5rem;
    color: var(--text-muted);
    line-height: 1.6;
    animation: slideDown 0.3s ease-out;
}

.faq-answer[hidden] {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border-top: 2px solid var(--primary-purple);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.5rem 0;
    z-index: 1000;
    box-shadow: 0 -5px 20px rgba(131, 56, 236, 0.3);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    padding: 0.5rem;
    border-radius: 10px;
    transition: all 0.3s ease;
    min-width: 60px;
}

.nav-item i {
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
}

.nav-item span {
    font-size: 0.7rem;
    font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
    color: var(--primary-purple);
    background: rgba(131, 56, 236, 0.1);
    transform: translateY(-2px);
}

.nav-item.active {
    color: var(--primary-pink);
    box-shadow: 0 0 15px rgba(255, 0, 110, 0.3);
}

/* Footer */
footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-header {
        padding: 0.8rem;
    }
    
    .app-header h1 {
        font-size: 1.3rem;
    }
    
    .header-controls {
        gap: 0.3rem;
    }
    
    .header-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .game-info {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .game-stats {
        justify-content: center;
    }
    
    .cell {
        width: 35px;
        height: 35px;
        font-size: 1.2rem;
    }
    
    .mini-board .cell {
        width: 25px;
        height: 25px;
        font-size: 0.9rem;
    }
    
    .control-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        min-width: 100px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .nav-item span {
        font-size: 0.6rem;
    }
}

@media (max-width: 480px) {
    .app-main {
        padding: 0.5rem;
    }
    
    .cell {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }
    
    .game-controls {
        flex-direction: column;
        width: 100%;
    }
    
    .control-btn {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .tutorial-step,
    .stat-card,
    .difficulty-stats,
    .faq-item {
        padding: 1rem;
    }
}

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

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

/* Glow Effects */
.glow {
    box-shadow: 0 0 20px currentColor;
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}
