:root {
    --primary-color: #FF006E;
    --secondary-color: #FB5607;
    --accent-color: #FFBE0B;
    --purple-color: #8338EC;
    --blue-color: #3A86FF;
    --bg-color: #FAFAFA;
    --card-bg: #FFFFFF;
    --text-primary: #2D3748;
    --text-secondary: #718096;
    --border-color: #E2E8F0;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    --bg-color: #1A202C;
    --card-bg: #2D3748;
    --text-primary: #F7FAFC;
    --text-secondary: #A0AEC0;
    --border-color: #4A5568;
}

[data-theme="colorful"] {
    --bg-color: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --card-bg: rgba(255, 255, 255, 0.9);
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    padding-bottom: 80px;
}

.app-header {
    background: linear-gradient(135deg, var(--primary-color), var(--purple-color));
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

.language-toggle {
    display: flex;
    align-items: center;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.main-content {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

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

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

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

/* Cards */
.welcome-card, .daily-mission-card, .profile-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.welcome-card h2 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.4rem;
}

.welcome-card p {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card i {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-card h3 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stat-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Daily Mission */
.daily-mission-card h3 {
    color: var(--secondary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.mission-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

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

/* Games Grid */
.games-grid, .techniques-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.games-grid {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.game-card, .technique-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.game-card:hover, .technique-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.game-card i, .technique-card i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.game-card:nth-child(1) i { color: var(--primary-color); }
.game-card:nth-child(2) i { color: var(--secondary-color); }
.game-card:nth-child(3) i { color: var(--purple-color); }
.game-card:nth-child(4) i { color: var(--accent-color); }
.game-card:nth-child(5) i { color: var(--blue-color); }
.game-card:nth-child(6) i { color: #FF6B6B; }
.technique-card:nth-child(1) i { color: var(--accent-color); }
.technique-card:nth-child(2) i { color: var(--blue-color); }
.technique-card:nth-child(3) i { color: var(--primary-color); }
.technique-card:nth-child(4) i { color: var(--purple-color); }

.game-card h3, .technique-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.game-card p, .technique-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
}

/* Buttons */
.play-btn, .learn-btn, .submit-btn, .export-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    font-size: 0.95rem;
}

.play-btn:hover, .learn-btn:hover, .submit-btn:hover, .export-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.skip-btn, .play-again-btn {
    background: transparent;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
}

.skip-btn:hover, .play-again-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.danger-btn {
    background: #E53E3E;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.danger-btn:hover {
    background: #C53030;
    transform: translateY(-2px);
}

/* Game Interface */
.game-interface {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-top: 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

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

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

.game-header h3 {
    color: var(--primary-color);
    font-size: 1.3rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
}

.close-btn:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.timer-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--secondary-color);
}

.game-content {
    min-height: 200px;
    margin-bottom: 1.5rem;
}

.game-prompt {
    background: var(--bg-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
    font-size: 1.1rem;
    text-align: center;
}

.game-input {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    margin-bottom: 1rem;
    transition: var(--transition);
}

.game-input:focus {
    border-color: var(--primary-color);
    outline: none;
}

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

.game-results {
    text-align: center;
    padding: 1.5rem;
    background: var(--bg-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

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

.results-stats {
    margin: 1rem 0;
}

.results-stats p {
    margin: 0.5rem 0;
    font-size: 1.1rem;
}

/* Profile Section */
.profile-avatar {
    text-align: center;
    margin-bottom: 1rem;
}

.profile-avatar i {
    font-size: 4rem;
    color: var(--primary-color);
}

.profile-card h3 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.profile-card p {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.achievements-section, .statistics-section, .export-section {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.achievements-section h3, .statistics-section h3, .export-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

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

.achievement-badge {
    text-align: center;
    padding: 1rem;
    border-radius: var(--border-radius);
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.achievement-badge:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.achievement-badge.earned {
    background: linear-gradient(135deg, var(--accent-color), var(--secondary-color));
    color: white;
    border-color: var(--secondary-color);
}

.achievement-badge i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    display: block;
}

.achievement-badge span {
    font-size: 0.85rem;
    font-weight: 600;
}

.stats-detailed {
    display: grid;
    gap: 1rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: var(--bg-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.stat-item span:first-child {
    color: var(--text-secondary);
}

.stat-item span:last-child {
    font-weight: 600;
    color: var(--primary-color);
}

/* Settings */
.settings-group {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

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

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

.setting-item label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
}

.setting-item select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background: var(--card-bg);
    color: var(--text-primary);
    font-size: 1rem;
}

.checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

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

.warning-text {
    color: #E53E3E;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* FAQ */
.faq-container {
    margin-top: 1rem;
}

.faq-item {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

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

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

.faq-icon {
    font-size: 1.2rem;
    color: var(--primary-color);
    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-secondary);
    line-height: 1.6;
    animation: slideDown 0.3s ease;
}

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

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

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    color: var(--primary-color);
    font-size: 1.3rem;
}

.modal-body {
    padding: 1.5rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.modal-body h4 {
    color: var(--text-primary);
    margin: 1rem 0 0.5rem;
    font-size: 1.1rem;
}

.modal-body ul {
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.modal-body li {
    margin-bottom: 0.5rem;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--card-bg);
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    border-top: 1px solid var(--border-color);
    z-index: 100;
}

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

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

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

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

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.toast.show {
    transform: translateX(0);
}

.toast.hidden {
    display: none;
}

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

/* Responsive Design */
@media (min-width: 768px) {
    .main-content {
        padding: 2rem;
    }
    
    .app-header h1 {
        font-size: 2rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .games-grid, .techniques-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
    
    .bottom-nav {
        padding: 1rem 0;
    }
    
    .nav-item {
        padding: 0.75rem;
        min-width: 80px;
    }
    
    .nav-item i {
        font-size: 1.4rem;
    }
    
    .nav-item span {
        font-size: 0.85rem;
    }
}

@media (min-width: 1024px) {
    .main-content {
        padding: 3rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 600px;
        margin: 0 auto 1.5rem;
    }
    
    .games-grid, .techniques-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Loading Animation */
@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
        --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.4);
        --border-color: #000000;
    }
}

/* 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,
    .app-header,
    .game-interface,
    .modal {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .content-section {
        display: block !important;
        page-break-after: always;
    }
}
