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

:root {
    --primary-color: #FF006E;
    --secondary-color: #FB5607;
    --accent-color: #FFBE0B;
    --purple-color: #8338EC;
    --blue-color: #3A86FF;
    --terminal-green: #00ff00;
    --dark-bg: #0a0a0a;
    --card-bg: #1a1a1a;
    --text-light: #ffffff;
    --text-gray: #cccccc;
    --border-color: #333333;
    --success-color: #4CAF50;
    --danger-color: #f44336;
    --warning-color: #ff9800;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--dark-bg) 0%, #1a1a2e 100%);
    color: var(--text-light);
    min-height: 100vh;
    padding-bottom: 80px;
    line-height: 1.6;
}

/* Focus styles for accessibility */
*:focus {
    outline: 2px solid var(--terminal-green);
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

*:focus-visible {
    outline: 2px solid var(--terminal-green);
    outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--terminal-green);
    color: var(--dark-bg);
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 10001;
    font-weight: bold;
}

.skip-link:focus {
    top: 6px;
}

/* Header */
header {
    background: var(--card-bg);
    border-bottom: 2px solid var(--terminal-green);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 255, 0, 0.1);
}

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

.header-content h1 {
    color: var(--terminal-green);
    font-size: 1.5rem;
    text-shadow: 0 0 10px var(--terminal-green);
}

.language-toggle {
    display: flex;
    gap: 0.5rem;
}

.lang-btn {
    background: transparent;
    border: 1px solid var(--terminal-green);
    color: var(--terminal-green);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    min-width: 44px;
    min-height: 44px;
}

.lang-btn.active,
.lang-btn:hover {
    background: var(--terminal-green);
    color: var(--dark-bg);
    box-shadow: 0 0 10px var(--terminal-green);
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

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

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

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

/* Welcome Card */
.welcome-card {
    background: var(--card-bg);
    border: 1px solid var(--terminal-green);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0, 255, 0, 0.1);
}

.welcome-card h2 {
    color: var(--terminal-green);
    margin-bottom: 1rem;
    font-size: 1.8rem;
}

.welcome-card p {
    color: var(--text-gray);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

.daily-stats {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--terminal-green);
    text-shadow: 0 0 10px var(--terminal-green);
}

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

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

.game-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.game-card:hover {
    border-color: var(--terminal-green);
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 255, 0, 0.2);
}

.game-card:focus-within {
    border-color: var(--terminal-green);
    box-shadow: 0 0 0 2px var(--terminal-green);
}

.game-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.game-card h3 {
    color: var(--terminal-green);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.game-card p {
    color: var(--text-gray);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    flex-grow: 1;
}

.play-btn {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    border: none;
    color: white;
    padding: 0.8rem 2rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-height: 44px;
    min-width: 120px;
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(255, 0, 110, 0.4);
}

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

.back-btn {
    background: transparent;
    border: 1px solid var(--terminal-green);
    color: var(--terminal-green);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    min-height: 44px;
}

.back-btn:hover {
    background: var(--terminal-green);
    color: var(--dark-bg);
}

#game-title {
    color: var(--terminal-green);
    font-size: 1.5rem;
}

.game-info {
    display: flex;
    gap: 1rem;
    font-weight: bold;
}

.score, .level {
    color: var(--accent-color);
}

.game-container {
    background: var(--card-bg);
    border: 1px solid var(--terminal-green);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    min-height: 400px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Responsive game container adjustments */
@media (max-width: 600px) {
    .game-container {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
        min-height: 350px;
    }
}

#game-area {
    min-height: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 2rem;
    width: 100%;
    overflow: hidden;
}

/* Responsive game area adjustments */
@media (max-width: 600px) {
    #game-area {
        min-height: 250px;
        margin-bottom: 1.5rem;
    }
}

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

/* Responsive game controls adjustments */
@media (max-width: 600px) {
    .game-controls {
        gap: 0.8rem;
        padding: 0.8rem 0;
    }
}

.control-btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    min-width: 100px;
}

.control-btn.primary {
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.control-btn.danger {
    background: var(--danger-color);
    color: white;
}

.control-btn:not(.primary):not(.danger) {
    background: var(--card-bg);
    border: 1px solid var(--terminal-green);
    color: var(--terminal-green);
}

.control-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

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

.modal-content {
    background: var(--card-bg);
    border: 2px solid var(--terminal-green);
    border-radius: 12px;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    text-align: center;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-content h3 {
    color: var(--terminal-green);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.result-stats {
    margin-bottom: 2rem;
}

.result-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: rgba(0, 255, 0, 0.1);
    border-radius: 8px;
}

.result-label {
    color: var(--text-gray);
}

.result-value {
    color: var(--terminal-green);
    font-weight: bold;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Progress Section */
.progress-overview {
    margin-bottom: 2rem;
}

.progress-card {
    background: var(--card-bg);
    border: 1px solid var(--terminal-green);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.progress-card h3 {
    color: var(--terminal-green);
    margin-bottom: 1.5rem;
    text-align: center;
}

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

.stat-box {
    background: rgba(0, 255, 0, 0.1);
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    border: 1px solid var(--terminal-green);
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: bold;
    color: var(--terminal-green);
    margin-bottom: 0.5rem;
}

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

/* Achievements */
.achievements-section {
    margin-bottom: 2rem;
}

.achievements-section h3 {
    color: var(--terminal-green);
    margin-bottom: 1rem;
    text-align: center;
}

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

.achievement-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.achievement-item.unlocked {
    border-color: var(--terminal-green);
    background: rgba(0, 255, 0, 0.1);
}

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

.achievement-name {
    color: var(--terminal-green);
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.achievement-desc {
    font-size: 0.8rem;
    color: var(--text-gray);
}

/* Charts */
.progress-charts {
    margin-bottom: 2rem;
}

.progress-charts h3 {
    color: var(--terminal-green);
    margin-bottom: 1rem;
    text-align: center;
}

.chart-container {
    background: var(--card-bg);
    border: 1px solid var(--terminal-green);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
}

#progress-chart {
    max-width: 100%;
    height: auto;
}

/* Export Section */
.export-section {
    text-align: center;
}

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

.settings-group h3 {
    color: var(--terminal-green);
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

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

.setting-item label {
    color: var(--text-light);
    font-weight: 500;
    min-width: 150px;
}

.setting-item select,
.setting-item input[type="time"] {
    background: var(--dark-bg);
    border: 1px solid var(--terminal-green);
    color: var(--text-light);
    padding: 0.5rem;
    border-radius: 4px;
    min-width: 120px;
    min-height: 44px;
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--terminal-green);
    min-width: 20px;
    min-height: 20px;
}

.setting-help {
    font-size: 0.8rem;
    color: var(--text-gray);
    font-style: italic;
    margin-top: 0.25rem;
    width: 100%;
    flex-basis: 100%;
}

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

.faq-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item:hover {
    border-color: var(--terminal-green);
}

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

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

.faq-question[aria-expanded="true"] {
    color: var(--terminal-green);
    border-bottom: 1px solid var(--border-color);
}

.faq-icon {
    font-size: 1.2rem;
    font-weight: bold;
    transition: transform 0.3s ease;
    min-width: 20px;
    text-align: center;
}

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

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

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

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

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

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-gray);
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    min-width: 60px;
    min-height: 60px;
    justify-content: center;
}

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

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

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

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

footer a {
    color: var(--terminal-green);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Game Specific Styles */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

/* Responsive grid adjustments for different screen sizes */
@media (max-width: 600px) {
    .memory-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 350px;
        gap: 8px;
    }
}

.memory-card {
    aspect-ratio: 1;
    background: var(--card-bg);
    border: 2px solid var(--terminal-green);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    user-select: none;
    min-height: 60px;
    min-width: 60px;
}

.memory-card:hover {
    background: rgba(0, 255, 0, 0.1);
    transform: scale(1.05);
}

.memory-card.flipped {
    background: var(--terminal-green);
    color: var(--dark-bg);
}

.memory-card.matched {
    background: var(--success-color);
    border-color: var(--success-color);
    cursor: default;
}

.sequence-display {
    text-align: center;
    margin-bottom: 2rem;
}

.sequence-number {
    display: inline-block;
    width: 60px;
    height: 60px;
    background: var(--terminal-green);
    color: var(--dark-bg);
    border-radius: 50%;
    line-height: 60px;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0.5rem;
    animation: pulse 0.5s ease;
}

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

.sequence-input {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.sequence-btn {
    width: 50px;
    height: 50px;
    background: var(--card-bg);
    border: 2px solid var(--terminal-green);
    color: var(--terminal-green);
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.3s ease;
    min-width: 50px;
    min-height: 50px;
}

.sequence-btn:hover {
    background: var(--terminal-green);
    color: var(--dark-bg);
    transform: scale(1.1);
}

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

.symbols-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
    width: 100%;
}

/* Responsive symbols grid adjustments */
@media (max-width: 600px) {
    .symbols-grid {
        grid-template-columns: repeat(5, 1fr);
        max-width: 350px;
        gap: 8px;
    }
}

.symbol-item {
    aspect-ratio: 1;
    background: var(--card-bg);
    border: 2px solid var(--terminal-green);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    min-height: 60px;
    min-width: 60px;
}

.symbol-item:hover {
    background: rgba(0, 255, 0, 0.1);
    transform: scale(1.05);
}

.symbol-item.correct {
    background: var(--success-color);
    border-color: var(--success-color);
}

.symbol-item.wrong {
    background: var(--danger-color);
    border-color: var(--danger-color);
}

.reaction-area {
    text-align: center;
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

/* Responsive reaction area adjustments */
@media (max-width: 600px) {
    .reaction-area {
        padding: 3rem 1.5rem;
        min-height: 250px;
    }
}

.reaction-circle {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    margin: 0 auto 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 4px solid var(--terminal-green);
    background: var(--card-bg);
    min-width: 200px;
    min-height: 200px;
}

.reaction-circle.waiting {
    background: var(--warning-color);
    border-color: var(--warning-color);
    color: var(--dark-bg);
}

.reaction-circle.ready {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
    animation: glow 0.5s ease infinite alternate;
}

@keyframes glow {
    from { box-shadow: 0 0 20px var(--success-color); }
    to { box-shadow: 0 0 40px var(--success-color); }
}

.reaction-time {
    font-size: 2rem;
    color: var(--terminal-green);
    font-weight: bold;
    text-shadow: 0 0 10px var(--terminal-green);
}

.game-instructions {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 255, 0, 0.1);
    border-radius: 8px;
    border: 1px solid var(--terminal-green);
    text-align: center;
}

/* Responsive game instructions adjustments */
@media (max-width: 600px) {
    .game-instructions {
        margin-top: 0.8rem;
        padding: 0.8rem;
        font-size: 0.9rem;
    }
}

.game-instructions p {
    margin-bottom: 0.5rem;
    color: var(--text-light);
}

.game-instructions p:last-child {
    margin-bottom: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    /* Header adjustments */
    .header-content h1 {
        font-size: 1.2rem;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    /* Main layout */
    main {
        padding: 0.5rem;
    }
    
    /* Games grid */
    .games-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .game-card {
        padding: 1rem;
        min-height: auto;
    }
    
    .game-header {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .game-info {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    /* Daily stats */
    .daily-stats {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    /* Achievements */
    .achievements-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    /* Game containers */
    .game-container {
        padding: 1rem;
        margin-bottom: 1rem;
        min-height: auto;
    }
    
    #game-area {
        min-height: 250px;
        margin-bottom: 1rem;
    }
    
    /* Memory game */
    .memory-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 280px;
        gap: 8px;
    }
    
    .memory-card {
        font-size: 1.2rem;
        min-height: 50px;
        min-width: 50px;
    }
    
    /* Sequence game */
    .sequence-display {
        margin-bottom: 1rem;
    }
    
    .sequence-number {
        width: 50px;
        height: 50px;
        line-height: 50px;
        font-size: 1.2rem;
        margin: 0.3rem;
    }
    
    .sequence-input {
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .sequence-btn {
        width: 45px;
        height: 45px;
        font-size: 1rem;
        min-width: 45px;
        min-height: 45px;
    }
    
    /* Symbols game */
    .symbols-grid {
        grid-template-columns: repeat(4, 1fr);
        max-width: 280px;
        gap: 8px;
    }
    
    .symbol-item {
        font-size: 1.2rem;
        min-height: 50px;
        min-width: 50px;
    }
    
    /* Reaction game */
    .reaction-area {
        padding: 2rem 1rem;
    }
    
    .reaction-circle {
        width: 140px;
        height: 140px;
        font-size: 0.9rem;
        min-width: 140px;
        min-height: 140px;
        margin-bottom: 1rem;
    }
    
    .reaction-time {
        font-size: 1.5rem;
    }
    
    /* Game controls */
    .game-controls {
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .control-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        min-width: 80px;
        min-height: 40px;
    }
    
    /* Settings */
    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    /* Modals */
    .modal-content {
        width: 95%;
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .modal-buttons {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    /* Instructions */
    .game-instructions {
        margin-top: 0.5rem;
        padding: 0.8rem;
        font-size: 0.9rem;
    }
    
    /* Bottom navigation */
    .bottom-nav {
        padding: 0.5rem;
    }
    
    .nav-item {
        padding: 0.5rem;
        min-width: 60px;
    }
    
    .nav-item span {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    /* Main layout */
    main {
        padding: 0.3rem;
    }
    
    /* Header */
    header {
        padding: 0.5rem;
    }
    
    .header-content h1 {
        font-size: 1rem;
    }
    
    /* Welcome card */
    .welcome-card {
        padding: 1rem;
    }
    
    /* Game containers */
    .game-container {
        padding: 0.8rem;
        margin-bottom: 0.8rem;
    }
    
    #game-area {
        min-height: 200px;
        margin-bottom: 0.8rem;
    }
    
    /* Progress and settings */
    .progress-card,
    .settings-group {
        padding: 1rem;
    }
    
    /* Memory game - optimized for small screens */
    .memory-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 220px;
        gap: 4px;
    }
    
    .memory-card {
        font-size: 1rem;
        min-height: 45px;
        min-width: 45px;
        border-radius: 6px;
    }
    
    /* Sequence game */
    .sequence-number {
        width: 40px;
        height: 40px;
        line-height: 40px;
        font-size: 1rem;
        margin: 0.2rem;
    }
    
    .sequence-input {
        gap: 0.3rem;
    }
    
    .sequence-btn {
        width: 40px;
        height: 40px;
        font-size: 0.9rem;
        min-width: 40px;
        min-height: 40px;
    }
    
    /* Symbols game */
    .symbols-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 220px;
        gap: 4px;
    }
    
    .symbol-item {
        font-size: 1rem;
        min-height: 45px;
        min-width: 45px;
        border-radius: 6px;
    }
    
    /* Reaction game */
    .reaction-area {
        padding: 1rem 0.5rem;
    }
    
    .reaction-circle {
        width: 120px;
        height: 120px;
        font-size: 0.8rem;
        min-width: 120px;
        min-height: 120px;
        margin-bottom: 0.8rem;
    }
    
    .reaction-time {
        font-size: 1.3rem;
    }
    
    /* Game controls */
    .game-controls {
        gap: 0.3rem;
    }
    
    .control-btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
        min-width: 70px;
        min-height: 36px;
    }
    
    /* Instructions */
    .game-instructions {
        margin-top: 0.3rem;
        padding: 0.6rem;
        font-size: 0.8rem;
    }
    
    /* Bottom navigation */
    .bottom-nav {
        padding: 0.3rem;
    }
    
    .nav-item {
        padding: 0.3rem;
        min-width: 50px;
    }
    
    .nav-item span {
        font-size: 0.6rem;
    }
    
    /* Modals */
    .modal-content {
        width: 98%;
        padding: 1rem;
        margin: 0.5rem;
    }
    
    /* Daily stats */
    .daily-stats {
        padding: 0.8rem;
        gap: 0.8rem;
    }
    
    .stats-grid {
        gap: 0.8rem;
    }
    
    /* Settings */
    .setting-item {
        gap: 0.3rem;
    }
}

/* Extra small screens (smartphones pequenos) */
@media (max-width: 360px) {
    /* Main layout */
    main {
        padding: 0.2rem;
    }
    
    /* Header */
    header {
        padding: 0.3rem;
    }
    
    .header-content h1 {
        font-size: 0.9rem;
    }
    
    /* Game containers */
    .game-container {
        padding: 0.6rem;
        margin-bottom: 0.6rem;
    }
    
    #game-area {
        min-height: 180px;
        margin-bottom: 0.6rem;
    }
    
    /* Memory game - ultra compact */
    .memory-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 200px;
        gap: 3px;
    }
    
    .memory-card {
        font-size: 0.9rem;
        min-height: 40px;
        min-width: 40px;
        border-radius: 4px;
    }
    
    /* Sequence game */
    .sequence-number {
        width: 35px;
        height: 35px;
        line-height: 35px;
        font-size: 0.9rem;
        margin: 0.15rem;
    }
    
    .sequence-btn {
        width: 35px;
        height: 35px;
        font-size: 0.8rem;
        min-width: 35px;
        min-height: 35px;
    }
    
    /* Symbols game */
    .symbols-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 200px;
        gap: 3px;
    }
    
    .symbol-item {
        font-size: 0.9rem;
        min-height: 40px;
        min-width: 40px;
        border-radius: 4px;
    }
    
    /* Reaction game */
    .reaction-circle {
        width: 100px;
        height: 100px;
        font-size: 0.7rem;
        min-width: 100px;
        min-height: 100px;
        margin-bottom: 0.6rem;
    }
    
    .reaction-time {
        font-size: 1.1rem;
    }
    
    /* Game controls */
    .control-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.7rem;
        min-width: 60px;
        min-height: 32px;
    }
    
    /* Instructions */
    .game-instructions {
        margin-top: 0.2rem;
        padding: 0.4rem;
        font-size: 0.7rem;
    }
    
    /* Bottom navigation */
    .bottom-nav {
        padding: 0.2rem;
    }
    
    .nav-item {
        padding: 0.2rem;
        min-width: 45px;
    }
    
    .nav-item span {
        font-size: 0.5rem;
    }
    
    /* Modals */
    .modal-content {
        width: 99%;
        padding: 0.8rem;
        margin: 0.3rem;
    }
    
    /* Daily stats */
    .daily-stats {
        padding: 0.6rem;
        gap: 0.6rem;
    }
    
    /* Settings */
    .progress-card,
    .settings-group {
        padding: 0.8rem;
    }
}

/* Landscape orientation for mobile devices */
@media (max-width: 768px) and (orientation: landscape) {
    /* Reduce padding to maximize game area */
    main {
        padding: 0.2rem;
    }
    
    .game-container {
        padding: 1rem;
        min-height: 300px;
    }
    
    #game-area {
        min-height: 200px;
        margin-bottom: 1rem;
    }
    
    /* Optimize grids for landscape */
    .memory-grid {
        max-width: 300px;
        gap: 6px;
    }
    
    .memory-card {
        min-height: 50px;
        min-width: 50px;
    }
    
    .symbols-grid {
        max-width: 300px;
        gap: 6px;
    }
    
    .symbol-item {
        min-height: 50px;
        min-width: 50px;
    }
    
    /* Optimize reaction game */
    .reaction-area {
        padding: 1rem;
        min-height: 200px;
    }
    
    .reaction-circle {
        width: 120px;
        height: 120px;
        min-width: 120px;
        min-height: 120px;
    }
    
    /* Optimize sequence game */
    .sequence-number {
        width: 45px;
        height: 45px;
        line-height: 45px;
        margin: 0.2rem;
    }
    
    .sequence-btn {
        width: 45px;
        height: 45px;
        min-width: 45px;
        min-height: 45px;
    }
    
    /* Reduce header size */
    header {
        padding: 0.3rem;
    }
    
    .header-content h1 {
        font-size: 1rem;
    }
    
    /* Optimize controls */
    .game-controls {
        gap: 0.5rem;
        padding: 0.5rem 0;
    }
    
    .control-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        min-width: 80px;
        min-height: 36px;
    }
    
    /* Optimize instructions */
    .game-instructions {
        margin-top: 0.5rem;
        padding: 0.5rem;
        font-size: 0.8rem;
    }
    
    /* Optimize bottom navigation */
    .bottom-nav {
        padding: 0.2rem;
    }
    
    .nav-item {
        padding: 0.2rem;
        min-width: 50px;
    }
    
    .nav-item span {
        font-size: 0.6rem;
    }
}

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

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --border-color: #ffffff;
        --text-gray: #ffffff;
    }
    
    .game-card,
    .progress-card,
    .settings-group {
        border-width: 2px;
    }
}

/* Colorblind mode */
.colorblind-mode {
    --primary-color: #0066cc;
    --secondary-color: #ff9900;
    --success-color: #006600;
    --danger-color: #cc0000;
    --warning-color: #ffcc00;
}

.colorblind-mode .memory-card.flipped {
    background: #0066cc;
}

.colorblind-mode .symbol-item.correct {
    background: #006600;
    border-color: #006600;
}

.colorblind-mode .symbol-item.wrong {
    background: #cc0000;
    border-color: #cc0000;
}

/* Print styles */
@media print {
    .bottom-nav,
    .game-controls,
    .back-btn {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .page-section {
        display: block !important;
        page-break-inside: avoid;
    }
    
    .game-card,
    .progress-card,
    .settings-group {
        border: 1px solid #000 !important;
        background: white !important;
        color: black !important;
    }
}
