body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
    background: linear-gradient(to bottom right, #eff6ff, #eef2ff, #faf5ff);
    min-height: 100vh;
    color: #333;
    transition: background 0.3s, color 0.3s;
}
img{
    max-width: 100%;
    height: auto;
}

body.dark {
    background: linear-gradient(to bottom right, #1e293b, #334155, #475569);
    color: #e2e8f0;
}

.container { padding: 2rem; max-width: 1200px; margin: 0 auto; }
.nav { background: rgba(255, 255, 255, 0.9); padding: 1rem; border-radius: 0.5rem; margin-bottom: 2rem; display: flex; gap: 1rem; justify-content: center; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.dark .nav { background: rgba(31, 41, 55, 0.9); }
.nav-link { text-decoration: none; color: #4b5563; font-weight: 500; padding: 0.5rem 1rem; border-radius: 0.25rem; transition: background-color 0.2s ease, color 0.2s ease; }
.dark .nav-link { color: #d1d5db; }
.nav-link:hover { background: #f3f4f6; color: #1f2937; }
.dark .nav-link:hover { background: #4b5563; color: #fff; }
.nav-link.active { background: #4f46e5; color: white; }
.nav-button { padding: 0.5rem 1rem; border: none; background: #e5e7eb; border-radius: 0.25rem; cursor: pointer; }
.dark .nav-button { background: #6b7280; color: #fff; }
.content { max-width: 56rem; margin: 0 auto; }
.header { text-align: center; margin-bottom: 3rem; }
.title { font-size: 3rem; font-weight: bold; background: linear-gradient(to right, #6b7280, #4f46e5); -webkit-background-clip: text; background-clip: text; color: transparent; margin-bottom: 1rem; }
.subtitle { font-size: 1.25rem; color: #4b5563; }
.dark .subtitle { color: #d1d5db; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2rem; margin-bottom: 2rem; }
.card { text-decoration: none; background: white; border-radius: 0.5rem; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); border: 2px solid #e5e7eb; transition: box-shadow 0.2s ease; cursor: pointer; }
.dark .card { background: #1f2937; border-color: #4b5563; }
.card:hover { box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1); }
.card-content { padding: 2rem; }
.icon { width: 4rem; height: 4rem; border-radius: 50%; background: rgba(79, 70, 229, 0.1); display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; font-size: 2rem; }
.dark .icon { background: rgba(139, 92, 246, 0.1); }
.card-title { font-size: 1.5rem; font-weight: bold; color: #1f2937; margin-bottom: 0.5rem; }
.dark .card-title { color: #e2e8f0; }
.card-text { color: #4b5563; }
.dark .card-text { color: #d1d5db; }

.lesson, .test-options, .practice-options, .game-options { background: white; padding: 2rem; border-radius: 0.5rem; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); margin-bottom: 2rem; }
.dark .lesson, .dark .test-options, .dark .practice-options, .dark .game-options { background: #1f2937; }
.lesson-title { font-size: 1.5rem; font-weight: bold; margin-bottom: 1rem; }
.dark .lesson-title { color: #e2e8f0; }
.lesson-text { margin-bottom: 1rem; color: #4b5563; }
.dark .lesson-text { color: #d1d5db; }
.code-block { background: #f3f4f6; padding: 1rem; border-radius: 0.25rem; font-family: monospace; margin-bottom: 1rem; white-space: pre-wrap; }
.dark .code-block { background: #4b5563; color: #e2e8f0; }
.typing-area { width: 100%; padding: 1rem; border: 1px solid #d1d5db; border-radius: 0.25rem; font-family: monospace; resize: vertical; margin-bottom: 1rem; }
.dark .typing-area { border-color: #6b7280; background: #374151; color: #e2e8f0; }
.button { padding: 0.75rem 2rem; font-size: 0.875rem; font-weight: 500; border-radius: 0.375rem; transition: background-color 0.2s ease, color 0.2s ease; cursor: pointer; border: 1px solid #d1d5db; background: white; color: #374151; margin-right: 0.5rem; }
.dark .button { background: #374151; color: #e2e8f0; border-color: #6b7280; }
.button:hover { background: #f3f4f6; color: #1f2937; }
.dark .button:hover { background: #4b5563; color: #fff; }
.back-button { margin-top: 2rem; display: block; text-align: center; }

.test-area, .practice-area, .game-area { background: white; padding: 2rem; border-radius: 0.5rem; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); }
.dark .test-area, .dark .practice-area, .dark .game-area { background: #1f2937; }
.test-text, .practice-text { margin-bottom: 1rem; font-family: monospace; white-space: pre-wrap; }
.dark .test-text, .dark .practice-text { color: #e2e8f0; }
.test-text .error { background: #fecaca; }
.dark .test-text .error { background: #dc2626; }
.test-text .correct { animation: correct 0.2s; }
@keyframes correct { 0% { background: #bbf7d0; } 100% { background: none; } }
.dark .test-text .correct { animation: correct-dark 0.2s; }
@keyframes correct-dark { 0% { background: #166534; } 100% { background: none; } }
.stats { margin: 1rem 0; display: flex; gap: 1rem; }
.dark .stats { color: #d1d5db; }
.hidden { display: none; }
.falling-words { position: relative; height: 300px; overflow: hidden; margin-bottom: 1rem; }
.word { position: absolute; left: 50%; transform: translateX(-50%); color: #4f46e5; font-weight: bold; }
.dark .word { color: #8b5cf6; }
.game-input { width: 100%; padding: 0.75rem; border: 1px solid #d1d5db; border-radius: 0.25rem; }
.dark .game-input { border-color: #6b7280; background: #374151; color: #e2e8f0; }
.progress-bar { width: 100%; height: 10px; background: #e5e7eb; border-radius: 5px; margin: 1rem 0; }
.progress-fill { height: 100%; background: #4f46e5; border-radius: 5px; transition: width 0.2s; }
.dark .progress-bar { background: #4b5563; }
.dark .progress-fill { background: #8b5cf6; }
.tips { margin-top: 1rem; font-style: italic; color: #6b7280; }
.dark .tips { color: #9ca3af; }
.history { margin-top: 2rem; }
.history h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.dark .history { color: #d1d5db; }
.achievements { margin-top: 2rem; text-align: center; }
.achievements h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }
.dark .achievements { color: #d1d5db; }
#stats-graph { display: block; margin: 2rem auto; }

.toast { position: fixed; top: 1rem; right: 1rem; z-index: 100; pointer-events: none; }
.toast-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }

@media (max-width: 768px) {
    .container { padding: 1rem; }
    .nav { flex-wrap: wrap; }
    .cards { grid-template-columns: 1fr; }
    .stats { flex-direction: column; }
    .button { padding: 1rem 2.5rem; font-size: 1rem; }
    .typing-area { font-size: 1.1rem; padding: 1.5rem; }
}
.learn-options { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 1rem; 
    justify-content: center; 
    margin-bottom: 2rem; 
}
.learn-btn { 
    flex: 1 1 200px; 
    max-width: 200px; 
}
.lesson-target { 
    font-family: monospace; 
    white-space: pre-wrap; 
    margin-bottom: 1rem; 
    padding: 1rem; 
    background: #f3f4f6; 
    border-radius: 0.25rem; 
}
.dark .lesson-target { 
    background: #4b5563; 
    color: #e2e8f0; 
}
.lesson-target .correct { 
    animation: correct 0.2s; 
}
.lesson-target .error { 
    background: #fecaca; 
}
.dark .lesson-target .error { 
    background: #dc2626; 
}
.keyboard { 
    margin: 1rem 0; 
    display: flex; 
    flex-direction: column; 
    gap: 0.5rem; 
    align-items: center; 
}
.key-row { 
    display: flex; 
    gap: 0.5rem; 
}
.key { 
    width: 40px; 
    height: 40px; 
    background: #e5e7eb; 
    border: 1px solid #d1d5db; 
    border-radius: 0.25rem; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-family: monospace; 
}
.dark .key { 
    background: #4b5563; 
    border-color: #6b7280; 
    color: #e2e8f0; 
}
.key.active { 
    background: #4f46e5; 
    color: white; 
}
.spacebar { 
    width: 200px; 
    height: 40px; 
    background: #e5e7eb; 
    border: 1px solid #d1d5db; 
    border-radius: 0.25rem; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-family: monospace; 
}
.dark .spacebar { 
    background: #4b5563; 
    border-color: #6b7280; 
    color: #e2e8f0; 
}
.spacebar.active { 
    background: #4f46e5; 
    color: white; 
}
.lesson-buttons { 
    display: flex; 
    gap: 1rem; 
    margin-top: 1rem; 
}
.result-board { 
    background: white; 
    padding: 2rem; 
    border-radius: 0.5rem; 
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); 
    margin-top: 2rem; 
    text-align: center; 
}
.dark .result-board { 
    background: #1f2937; 
}
.result-board h2 { 
    font-size: 1.5rem; 
    margin-bottom: 1rem; 
}
.dark .result-board h2 { 
    color: #e2e8f0; 
}
.achievements, .dis-achievements, .progress { 
    margin-bottom: 1rem; 
}
.dark .achievements, .dark .dis-achievements, .dark .progress { 
    color: #d1d5db; 
}


.tips { 
    margin-top: 1rem; 
    font-style: italic; 
    color: #6b7280; 
}
.dark .tips { 
    color: #9ca3af; 
}
.keyboard .key-row:first-child { 
    background: #f9fafb; 
    padding: 0.5rem; 
    border-radius: 0.25rem; 
}
.dark .keyboard .key-row:first-child { 
    background: #374151; 
}

.goal-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
}
.dark .goal-form {
    background: #1f2937;
}
.goal-form label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #4b5563;
}
.dark .goal-form label {
    color: #d1d5db;
}
.goal-form input, .goal-form select {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
}
.dark .goal-form input, .dark .goal-form select {
    border-color: #6b7280;
    background: #374151;
    color: #e2e8f0;
}
.challenge-area {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.dark .challenge-area {
    background: #1f2937;
}
.motivational-quote {
    font-style: italic;
    color: #6b7280;
    margin-bottom: 1rem;
    text-align: center;
}
.dark .motivational-quote {
    color: #9ca3af;
}
.challenge-text {
    font-family: monospace;
    white-space: pre-wrap;
    padding: 1rem;
    background: #f3f4f6;
    border-radius: 0.25rem;
    margin-bottom: 1rem;
}
.dark .challenge-text {
    background: #4b5563;
    color: #e2e8f0;
}
.success-stats, .failure-stats {
    background: white;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin-bottom: 2rem;
    text-align: center;
}
.dark .success-stats, .dark .failure-stats {
    background: #1f2937;
}
.success-stats h2, .failure-stats h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}
.dark .success-stats h2, .dark .failure-stats h2 {
    color: #e2e8f0;
}
.failure-stats .tip {
    margin-top: 1rem;
    font-style: italic;
    color: #6b7280;
}
.dark .failure-stats .tip {
    color: #9ca3af;
}

/* Existing styles remain, add or modify these: */

.practice-section {
    background: linear-gradient(to bottom, #f8fafc, #ffffff);
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.dark .practice-section {
    background: linear-gradient(to bottom, #1e293b, #2d3748);
}

.difficulty-selector {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.difficulty-selector label {
    font-weight: 500;
    color: #4a5568;
}

.dark .difficulty-selector label {
    color: #e2e8f0;
}

#difficulty {
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    background: #ffffff;
    font-size: 1rem;
    transition: border-color 0.2s, background 0.2s;
}

.dark #difficulty {
    border-color: #4a5568;
    background: #2d3748;
    color: #e2e8f0;
}

#difficulty:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
}

.paragraph-list {
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
    transition: background 0.3s, box-shadow 0.3s;
}

.dark .paragraph-list {
    background: #2d3748;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.paragraph-list p {
    margin-bottom: 1rem;
    color: #4a5568;
    font-style: italic;
}

.dark .paragraph-list p {
    color: #a0aec0;
}

.paragraph-list .button {
    display: block;
    margin: 0 auto;
    width: fit-content;
    background: #4f46e5;
    color: #ffffff;
    border: none;
    padding: 0.75rem 1.5rem;
}

.dark .paragraph-list .button {
    background: #7e5bef;
}

.paragraph-list .button:hover {
    background: #4338ca;
}

.dark .paragraph-list .button:hover {
    background: #6d5ac7;
}

.practice-area {
    background: #ffffff;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: background 0.3s, box-shadow 0.3s;
}

.dark .practice-area {
    background: #2d3748;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.motivational-quote {
    font-style: italic;
    color: #7e5bef;
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.125rem;
}

.dark .motivational-quote {
    color: #a78bfa;
}

.practice-text {
    font-family: monospace;
    white-space: pre-wrap;
    padding: 1rem;
    background: #f7fafc;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dark .practice-text {
    background: #374151;
    border-color: #4a5568;
    color: #e2e8f0;
}

.typing-area {
    width: 100%;
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-family: monospace;
    resize: vertical;
    margin-bottom: 1rem;
    font-size: 1rem;
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s, background 0.2s;
}

.dark .typing-area {
    border-color: #4a5568;
    background: #374151;
    color: #e2e8f0;
}

.typing-area:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.3);
}

.stats {
    margin: 1rem 0;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.875rem;
}

.stats span {
    background: #f7fafc;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border: 1px solid #e2e8f0;
}

.dark .stats span {
    background: #374151;
    border-color: #4a5568;
    color: #e2e8f0;
}

.progress-bars {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 1rem 0;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    display: flex;
    align-items: center;
    position: relative;
}

.progress-bar span {
    margin-left: 0.5rem;
    font-size: 0.875rem;
    color: #4a5568;
    position: absolute;
    left: 100%;
    top: -1.5rem;
}

.dark .progress-bar {
    background: #4a5568;
}

.dark .progress-bar span {
    color: #a0aec0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(to right, #4f46e5, #7e5bef);
    border-radius: 5px;
    transition: width 0.2s;
}

.dark .progress-fill {
    background: linear-gradient(to right, #7e5bef, #a78bfa);
}

.practice-feedback {
    margin: 1rem 0;
    text-align: center;
    font-style: italic;
    color: #7e5bef;
    font-size: 1rem;
    animation: fadeIn 1s ease-in-out;
}

.dark .practice-feedback {
    color: #a78bfa;
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.practice-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: center;
}

.button {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #4a5568;
    margin-right: 0.5rem;
}

.dark .button {
    background: #374151;
    color: #e2e8f0;
    border-color: #4a5568;
}

.button:hover {
    background: #4f46e5;
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.dark .button:hover {
    background: #7e5bef;
}

.back-button {
    margin-top: 2rem;
    display: block;
    text-align: center;
    background: #4f46e5;
    color: #ffffff;
    padding: 0.75rem 2rem;
}

.dark .back-button {
    background: #7e5bef;
}

.back-button:hover {
    background: #4338ca;
}

.dark .back-button:hover {
    background: #6d5ac7;
}

.hidden { display: none; }
.container { max-width: 800px; margin: 0 auto; padding: 20px; }
.nav { display: flex; gap: 15px; margin-bottom: 20px; }
.nav-link { text-decoration: none; color: #333; }
.nav-link.active { font-weight: bold; }
.button { background: #4f46e5; color: white; border: none; cursor: pointer; }
.button:disabled { background: #ccc; cursor: not-allowed; }
.practice-container { margin-top: 20px; }
.stats { display: flex; flex-wrap: wrap; gap: 20px; }
.progress-bar { height: 20px; background: #ddd; margin: 10px 0; }
.progress-fill { height: 100%; background: #4f46e5; width: 0; transition: width 0.3s; }
.result { margin-top: 20px; text-align: center; }