:root {
    --primary: #FF006E;
    --secondary: #FB5607;
    --accent: #FFBE0B;
    --purple: #8338EC;
    --blue: #3A86FF;
    --dark: #1a1a1a;
    --darker: #0d1117;
    --light: #ffffff;
    --gray: #6b7280;
    --success: #10b981;
    --error: #ef4444;
    --warning: #f59e0b;
    
    --neon-glow: 0 0 20px;
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

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

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

/* Header */
header {
    background: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 2px solid var(--primary);
    box-shadow: var(--neon-glow) var(--primary);
}

header h1 {
    text-align: center;
    font-size: 1.8rem;
    background: linear-gradient(45deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: var(--neon-glow) var(--primary);
    margin-bottom: 0.5rem;
}

.header-stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--accent);
}

.stat i {
    color: var(--primary);
}

/* Main Content */
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-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.control-btn {
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    border: none;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius);
    color: var(--light);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
    min-width: 100px;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--neon-glow) var(--primary);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn.danger {
    background: linear-gradient(45deg, var(--error), #dc2626);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: var(--shadow);
}

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

.difficulty-selector label {
    color: var(--accent);
    margin-right: 0.5rem;
    font-weight: 600;
}

.difficulty-selector select {
    background: var(--dark);
    border: 2px solid var(--primary);
    color: var(--light);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
}

.region-info {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--gray);
}

.region-info span {
    color: var(--accent);
}

/* Game Container */
#game-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

#grid-container {
    display: inline-block;
    background: var(--darker);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 2px solid var(--purple);
    box-shadow: var(--neon-glow) var(--purple);
}

.game-grid {
    display: grid;
    gap: 2px;
    background: var(--dark);
    padding: 4px;
    border-radius: 8px;
}

.grid-cell {
    width: 40px;
    height: 40px;
    background: var(--darker);
    border: 1px solid var(--gray);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-weight: bold;
    font-size: 1.1rem;
    border-radius: 4px;
    position: relative;
}

.grid-cell:hover {
    border-color: var(--accent);
    background: rgba(255, 190, 11, 0.1);
}

.grid-cell.filled {
    background: var(--primary);
    color: var(--light);
    border-color: var(--primary);
    box-shadow: inset 0 0 10px rgba(255, 0, 110, 0.3);
}

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

.grid-cell.hint {
    background: var(--accent) !important;
    color: var(--dark) !important;
    animation: pulse 1s infinite;
}

.grid-cell.completed {
    background: var(--success) !important;
    box-shadow: var(--neon-glow) var(--success);
}

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

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

/* Number Selector */
#number-selector {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    max-width: 300px;
    width: 100%;
}

.number-btn {
    width: 50px;
    height: 50px;
    background: linear-gradient(45deg, var(--blue), var(--purple));
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--light);
    box-shadow: var(--shadow);
}

.number-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--neon-glow) var(--blue);
}

.number-btn.selected {
    border-color: var(--accent);
    box-shadow: var(--neon-glow) var(--accent);
    transform: scale(1.1);
}

.number-btn.erase {
    background: linear-gradient(45deg, var(--error), #dc2626);
}

/* Messages */
.message {
    background: var(--dark);
    border: 2px solid var(--primary);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-top: 1rem;
    text-align: center;
    box-shadow: var(--neon-glow) var(--primary);
}

.message.hidden {
    display: none;
}

.message.success {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    box-shadow: var(--neon-glow) var(--success);
}

.message.error {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.1);
    box-shadow: var(--neon-glow) var(--error);
}

.message.warning {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
    box-shadow: var(--neon-glow) var(--warning);
}

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

.tutorial-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--accent);
}

#tutorial-content {
    background: var(--darker);
    border-radius: var(--border-radius);
    padding: 2rem;
    border: 2px solid var(--blue);
    box-shadow: var(--neon-glow) var(--blue);
    margin-bottom: 2rem;
    min-height: 400px;
}

.tutorial-step {
    display: none;
}

.tutorial-step.active {
    display: block;
    animation: slideIn 0.3s ease-in-out;
}

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

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

.tutorial-step p, .tutorial-step li {
    line-height: 1.6;
    margin-bottom: 0.8rem;
    color: var(--gray);
}

.tutorial-step ul, .tutorial-step ol {
    margin-left: 1.5rem;
}

.tutorial-example {
    background: var(--dark);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin: 1rem 0;
    border: 1px solid var(--purple);
}

.mini-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    width: fit-content;
    margin: 0 auto 1rem;
}

.mini-cell {
    width: 30px;
    height: 30px;
    background: var(--darker);
    border: 1px solid var(--gray);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border-radius: 4px;
}

.mini-cell.filled {
    background: var(--primary);
    color: var(--light);
}

.tutorial-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-btn {
    background: linear-gradient(45deg, var(--purple), var(--blue));
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    color: var(--light);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}

.nav-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--neon-glow) var(--purple);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#step-indicator {
    color: var(--accent);
    font-weight: 600;
}

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

.stats-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--accent);
}

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

.stat-card {
    background: var(--darker);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    border: 2px solid var(--primary);
    box-shadow: var(--neon-glow) var(--primary);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--neon-glow) var(--primary), var(--shadow);
}

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

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--accent);
}

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

.difficulty-stats {
    background: var(--darker);
    border-radius: var(--border-radius);
    padding: 2rem;
    border: 2px solid var(--blue);
    box-shadow: var(--neon-glow) var(--blue);
    margin-bottom: 2rem;
}

.difficulty-stats h3 {
    color: var(--blue);
    margin-bottom: 1rem;
    text-align: center;
}

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

.difficulty-stat {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.difficulty-name {
    min-width: 80px;
    color: var(--accent);
    font-weight: 600;
}

.progress-bar {
    flex: 1;
    height: 10px;
    background: var(--dark);
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, var(--primary), var(--secondary));
    transition: width 0.3s ease;
    width: 0%;
}

.difficulty-count {
    min-width: 30px;
    text-align: center;
    color: var(--gray);
}

/* Settings Section */
.settings-container {
    max-width: 600px;
    margin: 0 auto;
}

.settings-container h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--accent);
}

.settings-group {
    background: var(--darker);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 2px solid var(--purple);
    box-shadow: var(--neon-glow) var(--purple);
}

.settings-group h3 {
    color: var(--purple);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    color: var(--light);
    font-weight: 500;
}

.setting-item select {
    background: var(--dark);
    border: 2px solid var(--primary);
    color: var(--light);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    min-width: 120px;
}

.toggle-switch {
    position: relative;
    width: 60px;
    height: 30px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray);
    transition: var(--transition);
    border-radius: 30px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: var(--light);
    transition: var(--transition);
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
    box-shadow: var(--neon-glow) var(--primary);
}

input:checked + .slider:before {
    transform: translateX(30px);
}

/* FAQ Section */
.faq-section {
    margin: 3rem 0;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.faq-section h2 {
    text-align: center;
    margin-bottom: 2rem;
    color: var(--accent);
}

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

.faq-item {
    background: var(--darker);
    border-radius: var(--border-radius);
    border: 2px solid var(--blue);
    overflow: hidden;
    transition: var(--transition);
}

.faq-item:hover {
    box-shadow: var(--neon-glow) var(--blue);
}

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

.faq-question:hover {
    background: rgba(58, 134, 255, 0.1);
}

.faq-icon {
    color: var(--blue);
    font-size: 1.2rem;
    transition: var(--transition);
}

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

.faq-answer {
    padding: 0 1.5rem 1.5rem;
    color: var(--gray);
    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: rgba(26, 26, 26, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem;
    border-top: 2px solid var(--primary);
    box-shadow: 0 -4px 20px rgba(255, 0, 110, 0.3);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    color: var(--gray);
    text-decoration: none;
    transition: var(--transition);
    border-radius: var(--border-radius);
    min-width: 60px;
}

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

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

.nav-item:hover {
    color: var(--accent);
    background: rgba(255, 190, 11, 0.1);
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .game-controls {
        justify-content: stretch;
    }
    
    .control-btn {
        flex: 1;
        min-width: auto;
        font-size: 0.8rem;
        padding: 0.6rem 0.8rem;
    }
    
    .game-info {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .grid-cell {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .number-btn {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    #number-selector {
        grid-template-columns: repeat(5, 1fr);
        max-width: 250px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .tutorial-navigation {
        flex-direction: column;
        gap: 1rem;
    }
    
    .difficulty-stat {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .difficulty-name {
        min-width: auto;
        text-align: center;
    }
}

@media (max-width: 480px) {
    main {
        padding: 0.5rem;
    }
    
    header {
        padding: 0.75rem;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .header-stats {
        gap: 1rem;
    }
    
    .grid-cell {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }
    
    .number-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    #tutorial-content {
        padding: 1rem;
    }
    
    .faq-question {
        padding: 1rem;
    }
    
    .nav-item span {
        font-size: 0.6rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary: #ff1a7a;
        --secondary: #ff6b1a;
        --accent: #ffd700;
        --purple: #9d4edd;
        --blue: #4dabf7;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Print styles */
@media print {
    .bottom-nav,
    .game-controls,
    #number-selector {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .game-grid {
        border: 2px solid black !important;
    }
    
    .grid-cell {
        border: 1px solid black !important;
        background: white !important;
        color: black !important;
    }
}
