:root {
    --primary-color: #FF006E;
    --secondary-color: #FB5607;
    --accent-color: #FFBE0B;
    --purple-color: #8338EC;
    --blue-color: #3A86FF;
    --bg-primary: #0a0a0f;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --text-primary: #ffffff;
    --text-secondary: #b8b8d1;
    --text-muted: #7a7a95;
    --success-color: #00ff88;
    --error-color: #ff4757;
    --warning-color: #ffa502;
    --border-radius: 12px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --glow: 0 0 20px rgba(255, 0, 110, 0.3);
}

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

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

.app-header {
    background: linear-gradient(90deg, var(--purple-color), var(--primary-color));
    padding: 1rem;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.header-content h1 {
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.header-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
}

.level-indicator,
.score-indicator {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.app-main {
    flex: 1;
    padding: 1rem;
    padding-bottom: 120px;
    max-width: 1200px;
    margin: 0 auto;
}

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

.screen.active {
    display: block;
}

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

.screen-content {
    max-width: 800px;
    margin: 0 auto;
}

.welcome-card {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    padding: 2rem;
    border-radius: var(--border-radius);
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 0, 110, 0.2);
}

.welcome-card h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.primary-btn {
    background: linear-gradient(45deg, var(--primary-color), var(--purple-color));
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

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

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.8rem 1.5rem;
    border-radius: var(--border-radius);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    backdrop-filter: blur(10px);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

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

.danger-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 20px rgba(255, 71, 87, 0.3);
}

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

.stat-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem 1rem;
    border-radius: var(--border-radius);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 0.5rem;
}

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

.challenge-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    backdrop-filter: blur(10px);
}

.challenge-info {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.challenge-type {
    background: linear-gradient(45deg, var(--blue-color), var(--purple-color));
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.difficulty-badge {
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.difficulty-badge.easy {
    background: var(--success-color);
    color: var(--bg-primary);
}

.difficulty-badge.medium {
    background: var(--warning-color);
    color: var(--bg-primary);
}

.difficulty-badge.hard {
    background: var(--error-color);
    color: white;
}

.timer-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent-color);
}

.challenge-container {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 0, 110, 0.1);
}

.challenge-question h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.challenge-content {
    margin-bottom: 2rem;
}

.challenge-content p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.challenge-visual {
    background: rgba(255, 255, 255, 0.02);
    padding: 2rem;
    border-radius: var(--border-radius);
    margin: 1rem 0;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed rgba(255, 255, 255, 0.1);
}

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

.option-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 2px solid rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    backdrop-filter: blur(10px);
}

.option-btn:hover {
    border-color: var(--primary-color);
    background: rgba(255, 0, 110, 0.1);
}

.option-btn.selected {
    border-color: var(--primary-color);
    background: linear-gradient(45deg, rgba(255, 0, 110, 0.2), rgba(131, 56, 236, 0.2));
    box-shadow: var(--glow);
}

.challenge-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

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

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

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    padding: 2rem;
    border-radius: var(--border-radius);
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 0, 110, 0.2);
}

.feedback-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1rem;
}

.feedback-header i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.feedback-header i.success {
    color: var(--success-color);
}

.feedback-header i.error {
    color: var(--error-color);
}

.feedback-stats {
    display: flex;
    justify-content: space-around;
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
}

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

.feedback-stat .stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

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

.stat-card {
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    padding: 1.5rem;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

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

.achievements-section,
.progress-section {
    margin: 2rem 0;
}

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

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

.achievement-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.achievement-item.unlocked {
    border-color: var(--accent-color);
    background: linear-gradient(45deg, rgba(255, 190, 11, 0.1), rgba(251, 86, 7, 0.1));
}

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

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

.achievement-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.category-progress {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.category-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.category-name {
    font-weight: 600;
    color: var(--text-primary);
}

.category-percentage {
    color: var(--accent-color);
    font-weight: 600;
}

.progress-bar {
    background: rgba(255, 255, 255, 0.1);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 4px;
    transition: width 0.3s ease;
}

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

.settings-group h3 {
    color: var(--accent-color);
    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(--text-primary);
    font-weight: 500;
}

.setting-item select,
.setting-item input[type="time"] {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem;
    border-radius: 6px;
    font-size: 0.9rem;
}

.toggle-switch {
    position: relative;
    width: 50px;
    height: 24px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: 0.3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background: linear-gradient(45deg, var(--primary-color), var(--purple-color));
}

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

.setting-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

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

.faq-section {
    background: rgba(255, 255, 255, 0.02);
    padding: 2rem;
    border-radius: var(--border-radius);
    margin: 2rem 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 1rem;
}

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

.faq-question:hover {
    color: var(--primary-color);
}

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

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

.faq-answer {
    padding: 0 0 1rem 0;
    color: var(--text-secondary);
    line-height: 1.6;
    transition: all 0.3s ease;
}

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

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    display: flex;
    justify-content: space-around;
    padding: 0.8rem 0 calc(0.8rem + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
}

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

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

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

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

.nav-item:hover {
    color: var(--primary-color);
    transform: translateY(-2px);
}

.app-footer {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 2rem;
    position: relative;
    z-index: 10;
}

@media (max-width: 768px) {
    .app-main {
        padding: 0.5rem;
        padding-bottom: 100px;
    }
    
    .welcome-card {
        padding: 1.5rem;
    }
    
    .welcome-card h2 {
        font-size: 1.5rem;
    }
    
    .quick-stats {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .challenge-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .challenge-container {
        padding: 1rem;
    }
    
    .challenge-options {
        grid-template-columns: 1fr;
    }
    
    .challenge-actions {
        flex-direction: column;
    }
    
    .stats-overview {
        grid-template-columns: 1fr;
    }
    
    .achievements-grid {
        grid-template-columns: 1fr;
    }
    
    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .setting-actions {
        flex-direction: column;
    }
    
    .header-content {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .header-stats {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .modal-content {
        margin: 1rem;
        width: calc(100% - 2rem);
    }
    
    .faq-question {
        font-size: 1rem;
    }
    
    .nav-item i {
        font-size: 1.3rem;
    }
    
    .nav-item span {
        font-size: 0.7rem;
    }
}
