:root {
    --primary: #FF006E;
    --secondary: #FB5607;
    --accent: #FFBE0B;
    --purple: #8338EC;
    --blue: #3A86FF;
    --bg-dark: #0a0a0a;
    --bg-light: #1a1a1a;
    --text-light: #ffffff;
    --text-muted: #cccccc;
    --border: #333333;
    --success: #00ff88;
    --error: #ff4444;
    --warning: #ffaa00;
}

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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-light) 100%);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--purple) 100%);
    padding: 1rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(255, 0, 110, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

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

.header-stats span {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Main Content */
.app-main {
    padding: 1rem;
    padding-bottom: 80px;
    min-height: calc(100vh - 140px);
}

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

.screen.active {
    display: block;
}

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

/* Welcome Screen */
.welcome-container {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.welcome-content h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(255, 190, 11, 0.5);
}

.welcome-content p {
    margin-bottom: 2rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.game-config {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.config-group {
    margin-bottom: 1rem;
    text-align: left;
}

.config-group:last-child {
    margin-bottom: 0;
}

.config-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--text-light);
}

.config-group select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--bg-light);
    color: var(--text-light);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.config-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(255, 0, 110, 0.3);
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: white;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--purple) 100%);
    box-shadow: 0 4px 15px rgba(255, 0, 110, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 0, 110, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
    box-shadow: 0 4px 15px rgba(251, 86, 7, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(251, 86, 7, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--error) 0%, #cc0000 100%);
    box-shadow: 0 4px 15px rgba(255, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 68, 68, 0.4);
}

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

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

.game-controls button {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
}

.grid-container {
    display: grid;
    gap: 2px;
    background: var(--border);
    border-radius: 10px;
    padding: 10px;
    margin: 1rem auto;
    width: fit-content;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.grid-cell {
    width: 60px;
    height: 60px;
    background: var(--bg-light);
    border: 2px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.grid-cell:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.grid-cell.selected {
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(255, 190, 11, 0.5);
}

.grid-cell.prefilled {
    background: rgba(131, 56, 236, 0.2);
    border-color: var(--purple);
    cursor: default;
}

.grid-cell.prefilled:hover {
    transform: none;
}

.grid-cell.conflict {
    background: rgba(255, 68, 68, 0.2);
    border-color: var(--error);
    animation: shake 0.5s ease-in-out;
}

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

.grid-cell.hint {
    background: rgba(0, 255, 136, 0.2);
    border-color: var(--success);
    animation: pulse 1s ease-in-out;
}

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

/* Symbol Palette */
.symbol-palette {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.symbol-btn {
    width: 50px;
    height: 50px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--bg-light);
    color: var(--text-light);
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.symbol-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

.symbol-btn.selected {
    border-color: var(--primary);
    background: rgba(255, 0, 110, 0.2);
    box-shadow: 0 0 15px rgba(255, 0, 110, 0.5);
}

.symbol-btn.color-symbol {
    border-radius: 50%;
}

/* Game Info */
.game-info {
    text-align: center;
    margin-top: 1rem;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--border);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--success) 0%, var(--accent) 100%);
    width: 0%;
    transition: width 0.5s ease;
}

#progress-text {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Stats Screen */
.stats-container {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.stats-container h2 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(255, 190, 11, 0.5);
}

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

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

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

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

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

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

.settings-container h2 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(255, 190, 11, 0.5);
}

.settings-group {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

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

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

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

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

.toggle-switch {
    position: relative;
    width: 50px;
    height: 25px;
    appearance: none;
    background: var(--border);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-switch:checked {
    background: var(--primary);
}

.toggle-switch::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 21px;
    height: 21px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch:checked::before {
    transform: translateX(25px);
}

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

.faq-container h2 {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(255, 190, 11, 0.5);
}

.faq-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 1rem;
    overflow: hidden;
}

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

.faq-question:hover {
    background: rgba(255, 255, 255, 0.05);
}

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

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

.faq-answer {
    padding: 0 1rem;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-answer.show {
    padding: 1rem;
    max-height: 200px;
}

.faq-answer p {
    color: var(--text-muted);
    line-height: 1.6;
    margin: 0;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--bg-dark) 0%, var(--bg-light) 100%);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.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.25rem;
}

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

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

.nav-item:hover {
    color: var(--text-light);
    background: rgba(255, 255, 255, 0.05);
}

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

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

.modal-content {
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-dark) 100%);
    border: 2px solid var(--primary);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: var(--accent);
}

.modal-content p {
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.modal-stats {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1rem;
    margin: 1rem 0;
}

.modal-stats p {
    margin: 0.5rem 0;
    color: var(--text-light);
}

.modal-content button {
    margin: 0.5rem;
}

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

/* Responsive Design */
@media (max-width: 480px) {
    .app-header h1 {
        font-size: 1.3rem;
    }
    
    .header-stats {
        gap: 1rem;
        font-size: 0.8rem;
    }
    
    .grid-cell {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .symbol-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    
    .game-controls {
        gap: 0.25rem;
    }
    
    .game-controls button {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .welcome-content h2 {
        font-size: 1.5rem;
    }
    
    .nav-item span {
        font-size: 0.65rem;
    }
}

@media (min-width: 768px) {
    .app-main {
        padding: 2rem;
    }
    
    .grid-cell {
        width: 70px;
        height: 70px;
        font-size: 1.8rem;
    }
    
    .symbol-btn {
        width: 60px;
        height: 60px;
        font-size: 1.4rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Color symbol styles */
.color-red { background-color: #ff4444 !important; }
.color-blue { background-color: #4444ff !important; }
.color-green { background-color: #44ff44 !important; }
.color-yellow { background-color: #ffff44 !important; }
.color-purple { background-color: #ff44ff !important; }
.color-orange { background-color: #ff8844 !important; }

/* Animation for completed grid */
.grid-container.completed {
    animation: celebrationGlow 2s ease-in-out;
}

@keyframes celebrationGlow {
    0%, 100% { 
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    }
    50% { 
        box-shadow: 0 8px 32px rgba(255, 0, 110, 0.8),
                    0 0 60px rgba(255, 190, 11, 0.6);
    }
}

/* 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);
    animation: spin 1s ease-in-out infinite;
}

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