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

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

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

.app-header {
    background: linear-gradient(90deg, var(--primary-color), var(--purple-color));
    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.8rem;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    margin: 0;
}

.main-content {
    padding: 1rem;
    padding-bottom: 80px;
    min-height: calc(100vh - 140px);
}

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

.content-section.active {
    display: block;
}

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

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

.difficulty-selector label {
    margin-right: 0.5rem;
    font-weight: bold;
}

.difficulty-selector select {
    background: var(--background-light);
    color: var(--text-primary);
    border: 2px solid var(--purple-color);
    border-radius: 8px;
    padding: 0.5rem;
    font-size: 1rem;
    box-shadow: 0 0 10px rgba(131, 56, 236, 0.3);
}

.game-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--background-light);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 2px solid var(--blue-color);
    box-shadow: 0 0 10px rgba(58, 134, 255, 0.3);
}

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

.stat-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(255, 190, 11, 0.5);
}

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

.control-btn {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: var(--text-primary);
    border: none;
    border-radius: 8px;
    padding: 0.7rem 1rem;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(255, 0, 110, 0.3);
}

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

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

.control-btn.active {
    background: linear-gradient(45deg, var(--accent-color), var(--secondary-color));
    box-shadow: 0 4px 15px rgba(255, 190, 11, 0.4);
}

.game-grid {
    display: grid;
    gap: 2px;
    background: var(--background-light);
    padding: 10px;
    border-radius: 12px;
    margin: 0 auto 1rem;
    max-width: 90vw;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--purple-color);
}

.grid-cell {
    aspect-ratio: 1;
    background: var(--background-medium);
    border: 1px solid var(--text-muted);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    min-height: 40px;
}

.grid-cell:hover {
    background: var(--background-light);
    border-color: var(--blue-color);
    box-shadow: 0 0 10px rgba(58, 134, 255, 0.3);
}

.grid-cell.has-star {
    background: linear-gradient(45deg, var(--primary-color), var(--purple-color));
    color: var(--text-primary);
    font-size: 1.5rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 15px rgba(255, 0, 110, 0.5);
}

.grid-cell.has-mark {
    background: var(--background-light);
    color: var(--text-muted);
    font-size: 1.5rem;
}

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

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

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

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

.game-status {
    text-align: center;
}

.validation-message {
    font-size: 0.9rem;
    color: var(--warning-color);
    margin-bottom: 0.5rem;
    min-height: 1.2rem;
}

.completion-message {
    background: linear-gradient(45deg, var(--success-color), var(--accent-color));
    color: var(--background-dark);
    padding: 1rem;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: bold;
    margin-top: 1rem;
    box-shadow: 0 4px 20px rgba(0, 255, 136, 0.3);
}

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

/* Achievements Section */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.achievement-card {
    background: var(--background-light);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    border: 2px solid var(--background-medium);
    transition: all 0.3s ease;
}

.achievement-card.unlocked {
    border-color: var(--accent-color);
    box-shadow: 0 4px 20px rgba(255, 190, 11, 0.3);
}

.achievement-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    filter: grayscale(100%);
    transition: filter 0.3s ease;
}

.achievement-card.unlocked .achievement-icon {
    filter: none;
}

.achievement-card h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.achievement-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.achievement-status {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    background: var(--text-muted);
    color: var(--background-dark);
}

.achievement-card.unlocked .achievement-status {
    background: var(--success-color);
    color: var(--background-dark);
}

.stats-summary {
    background: var(--background-light);
    border-radius: 12px;
    padding: 1.5rem;
    border: 2px solid var(--blue-color);
}

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

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

.stat-item {
    text-align: center;
    background: var(--background-medium);
    padding: 1rem;
    border-radius: 8px;
}

.stat-number {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(255, 0, 110, 0.5);
}

.stat-item .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* Settings Section */
.settings-group {
    background: var(--background-light);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 2px solid var(--background-medium);
}

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

.setting-item {
    margin-bottom: 1.5rem;
}

.setting-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.setting-label input[type="checkbox"] {
    margin-right: 0.8rem;
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
}

.setting-select {
    background: var(--background-medium);
    color: var(--text-primary);
    border: 2px solid var(--purple-color);
    border-radius: 8px;
    padding: 0.5rem;
    font-size: 1rem;
    width: 100%;
    max-width: 200px;
}

.setting-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.3rem;
}

.danger-btn {
    background: linear-gradient(45deg, var(--error-color), #cc0000);
    color: var(--text-primary);
    border: none;
    border-radius: 8px;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

/* Help Section */
.help-section {
    background: var(--background-light);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 2px solid var(--blue-color);
}

.help-section h3 {
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.help-content ul {
    list-style: none;
    padding-left: 0;
}

.help-content li {
    margin-bottom: 0.8rem;
    padding-left: 1.5rem;
    position: relative;
}

.help-content li::before {
    content: "▶";
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

/* FAQ Section */
.faq-section {
    background: var(--background-light);
    border-radius: 12px;
    padding: 1.5rem;
    border: 2px solid var(--purple-color);
}

.faq-section h3 {
    color: var(--accent-color);
    margin-bottom: 1rem;
}

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

.faq-item {
    border: 1px solid var(--background-medium);
    border-radius: 8px;
    overflow: hidden;
}

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

.faq-question:hover {
    background: var(--background-light);
}

.faq-question[aria-expanded="true"] {
    background: var(--primary-color);
}

.faq-icon {
    font-size: 1.2rem;
    font-weight: bold;
    transition: transform 0.3s ease;
}

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

.faq-answer {
    background: var(--background-dark);
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-answer:not([hidden]) {
    max-height: 200px;
    padding: 1rem;
}

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

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, var(--background-dark), var(--background-medium));
    display: flex;
    justify-content: space-around;
    padding: 0.5rem;
    border-top: 2px solid var(--primary-color);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 8px;
    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: bold;
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .app-header h1 {
        font-size: 1.5rem;
    }
    
    .game-info {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    .game-stats {
        justify-content: center;
    }
    
    .control-btn {
        padding: 0.6rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .grid-cell {
        min-height: 35px;
        font-size: 1rem;
    }
    
    .grid-cell.has-star {
        font-size: 1.2rem;
    }
    
    .achievements-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 0.5rem;
        padding-bottom: 80px;
    }
    
    .control-btn {
        padding: 0.5rem;
        font-size: 0.7rem;
        gap: 0.3rem;
    }
    
    .grid-cell {
        min-height: 30px;
        font-size: 0.9rem;
    }
    
    .grid-cell.has-star {
        font-size: 1rem;
    }
    
    .nav-item span {
        font-size: 0.6rem;
    }
}

/* Dark theme variations */
body.dark-theme {
    --background-dark: #000000;
    --background-medium: #111111;
    --background-light: #222222;
}

/* Light theme variations */
body.light-theme {
    --background-dark: #f0f0f0;
    --background-medium: #e0e0e0;
    --background-light: #d0d0d0;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
}

/* Utility classes */
.hidden {
    display: none !important;
}

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

.mb-1 {
    margin-bottom: 1rem;
}

.mt-1 {
    margin-top: 1rem;
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--text-muted);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

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