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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* Pastel / beige theme */
    background: radial-gradient(1200px 600px at 20% 10%, rgba(255, 241, 220, 0.9), transparent 60%),
        radial-gradient(1100px 520px at 85% 80%, rgba(224, 246, 235, 0.85), transparent 58%),
        linear-gradient(135deg, #fbf3e6 0%, #f4f7f1 55%, #f7efe6 100%);
    min-height: 100vh;
    color: #2f2a24;
}

/* Landing Page (new) */
.landing {
    color: #2f2a24;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

.landing-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(900px 420px at 80% 25%, rgba(246, 214, 168, 0.55), transparent 55%),
        radial-gradient(700px 380px at 10% 80%, rgba(167, 215, 184, 0.45), transparent 60%),
        linear-gradient(135deg, #fbf3e6 0%, #f4f7f1 55%, #f7efe6 100%);
}

.landing-topbar {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
}

.landing-brand {
    display: flex;
    gap: 0.9rem;
    align-items: center;
    text-decoration: none;
    color: #2f2a24;
}

.landing-logo {
    width: 44px;
    height: 44px;
    border-radius: 12px;
}

.landing-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.landing-brand-title {
    font-weight: 800;
    font-size: 1.05rem;
}

.landing-brand-subtitle {
    font-size: 0.9rem;
    opacity: 0.9;
}

.landing-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.landing-link {
    background: rgba(255, 255, 255, 0.75);
    color: #2f2a24;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.landing-link:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.landing-shell {
    position: relative;
    z-index: 2;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
}

.landing-hero {
    display: grid;
    grid-template-columns: 1.2fr 0.9fr;
    gap: 2.5rem;
    align-items: start;
    margin-top: 1.5rem;
}

.landing-title {
    font-size: 3.1rem;
    letter-spacing: -0.02em;
    margin-bottom: 0.75rem;
}

.landing-subtitle {
    font-size: 1.2rem;
    opacity: 0.95;
    line-height: 1.65;
    margin-bottom: 1.6rem;
}

.cta-buttons {
    display: flex;
    gap: 1rem;
}

.landing-secondary {
    background: rgba(255, 255, 255, 0.75);
    color: #2f2a24;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.landing-cta {
    margin-top: 1rem;
}

.landing-kpis {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.75rem;
}

.kpi {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 16px;
    padding: 0.9rem 1.1rem;
    min-width: 120px;
}

.kpi-value {
    font-size: 1.3rem;
    font-weight: 800;
}

.kpi-label {
    font-size: 0.95rem;
    opacity: 0.9;
}

.landing-cards {
    display: grid;
    gap: 1rem;
}

.feature-card {
    text-align: left;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 253, 248, 0.9);
    color: #2f2a24;
    padding: 1.25rem 1.25rem;
    border-radius: 18px;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-3px);
    background: rgba(255, 253, 248, 0.98);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.12);
}

.feature-card.is-active {
    background: rgba(224, 246, 235, 0.55);
    border-color: rgba(139, 184, 177, 0.7);
}

.feature-emoji {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.feature-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
}

.feature-text {
    opacity: 0.95;
    line-height: 1.55;
}

@media (max-width: 900px) {
    .landing-hero {
        grid-template-columns: 1fr;
    }

    .landing-title {
        font-size: 2.4rem;
    }
}

/* Auth Pages */
.auth-container {
    max-width: 450px;
    margin: 100px auto;
    background: white;
    padding: 3rem;
    border-radius: 15px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
}

.auth-container h2 {
    margin-bottom: 2rem;
    color: #00796b;
    text-align: center;
}

.auth-container input {
    width: 100%;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
}

.auth-container input:focus {
    outline: none;
    border-color: #0f9d58;
}

.error {
    background: #ffebee;
    color: #c62828;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid #ef5350;
}

/* Navbar */
.navbar {
    background: rgba(255, 253, 248, 0.82);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 1.25rem 2.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.08);
}

.navbar h2 {
    color: #2f2a24;
    font-size: 1.7rem;
    letter-spacing: -0.01em;
}

.nav-right {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.user-name {
    color: #555;
    font-weight: 500;
}

.points {
    background: linear-gradient(135deg, #f6d6a8, #f4c7d9);
    padding: 0.55rem 1.1rem;
    border-radius: 999px;
    font-weight: 800;
    color: #2f2a24;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.rank-badge {
    background: rgba(255, 255, 255, 0.75);
    padding: 0.55rem 1.0rem;
    border-radius: 999px;
    font-weight: 900;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.rank-badge[data-rank="Bronze"] {
    background: linear-gradient(135deg, #f2d2c2, #f6e0c9);
}

.rank-badge[data-rank="Silver"] {
    background: linear-gradient(135deg, #e7edf2, #f6f2f7);
}

.rank-badge[data-rank="Gold"] {
    background: linear-gradient(135deg, #ffe3b3, #fff1d6);
}

.streak-badge {
    background: rgba(224, 246, 235, 0.75);
    padding: 0.55rem 1.0rem;
    border-radius: 999px;
    font-weight: 900;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Container */
.container {
    max-width: 1400px;
    margin: 3rem auto;
    padding: 0 2rem;
}

/* Word of the Day */
.word-of-day {
    background: white;
    padding: 2.5rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.word-card h2 {
    font-size: 3rem;
    color: #0f9d58;
    margin-bottom: 1rem;
}

.urdu-text {
    font-size: 2rem;
    color: #333;
    font-weight: 600;
    direction: rtl;
}

.english-text {
    font-size: 1.2rem;
    color: #666;
    margin-top: 0.5rem;
}

.roman-text {
    font-size: 1rem;
    color: #999;
    font-style: italic;
}

/* Progress */
.progress-summary {
    background: linear-gradient(90deg, #ecfdf5 0%, #eff6ff 55%, #f9fafb 100%);
    padding: 1.4rem 1.6rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.progress-text {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: #333;
}

.progress-bar {
    background: #e0e0e0;
    height: 30px;
    border-radius: 15px;
    overflow: hidden;
}

.progress-fill {
    background: linear-gradient(90deg, #a7d7b8, #9bbbdc);
    height: 100%;
    transition: width 0.5s ease;
}

/* Lessons */
.lessons-section h3 {
    color: #2f2a24;
    font-size: 1.8rem;
    margin-bottom: 1.25rem;
}

.lesson-score {
    margin-bottom: 0.75rem;
    color: #333;
    font-size: 1rem;
}

.lesson-badges {
    margin-bottom: 0.75rem;
    font-size: 1.2rem;
    letter-spacing: 2px;
}

.lesson-badges .star {
    color: #f59e0b;
}

/* Game-like badge tiers */
.lesson-card.badge-tier-1 {
    border: 3px solid #cd7f32; /* bronze */
    background: linear-gradient(180deg, #fff 0%, #fff7ed 100%);
}

.lesson-card.badge-tier-2 {
    border: 3px solid #94a3b8; /* silver */
    background: linear-gradient(180deg, #fff 0%, #f1f5f9 100%);
}

.lesson-card.badge-tier-3 {
    border: 3px solid #f59e0b; /* gold */
    background: linear-gradient(180deg, #fff 0%, #fffbeb 100%);
    box-shadow: 0 10px 30px rgba(245, 158, 11, 0.25);
}

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.page-indicator {
    color: #2f2a24;
    font-weight: 800;
}

.btn-disabled {
    opacity: 0.5;
    pointer-events: none;
}

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

.lesson-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.lesson-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.lesson-card.completed {
    border: 3px solid #4caf50;
}

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

.lesson-header h4 {
    color: #0f9d58;
    font-size: 1.5rem;
}

.level-badge {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.lesson-title {
    color: #666;
    margin-bottom: 1rem;
}

.badge-completed {
    background: #4caf50;
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, #8bb8b1, #a7d7b8);
    color: #1f2937;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #7aaea7, #97cfac);
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(47, 42, 36, 0.12);
}

.btn-small {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
}

.btn-icon {
    background: #f5f5f5;
    padding: 0.5rem 1rem;
    font-size: 1.2rem;
}

.btn-full {
    width: 100%;
    text-align: center;
}

/* Assessment Sections */
.assessment-section {
    background: rgba(255, 253, 248, 0.92);
    padding: 2.2rem;
    border-radius: 18px;
    margin-bottom: 2rem;
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.07);
}

.assessment-section h3 {
    color: #2f2a24;
    font-size: 1.65rem;
    margin-bottom: 0.5rem;
}

.instruction {
    color: #666;
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* Words List */
.words-list {
    display: grid;
    gap: 1.5rem;
}

.word-item {
    background: #f9f9f9;
    padding: 1.5rem;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
}

.word-content h4 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.word-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* Sentences */
.sentences-list {
    display: grid;
    gap: 1.5rem;
}

.sentence-item {
    background: #f9f9f9;
    padding: 1.5rem;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
}

.sentence-content p {
    margin-bottom: 0.5rem;
}

.sentence-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* Passage */
.passage-container {
    background: #f9f9f9;
    padding: 2rem;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
}

.passage-text {
    margin-bottom: 2rem;
}

.passage-text .urdu-text {
    font-size: 1.5rem;
    line-height: 2;
    margin-bottom: 1rem;
}

.passage-actions {
    display: flex;
    gap: 1rem;
}

/* MCQ */
#mcq-quiz .question,
.mcq-quiz .question {
    background: #f9f9f9;
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    border: 2px solid #e0e0e0;
}

#mcq-quiz label,
.mcq-quiz label {
    display: block;
    padding: 0.8rem;
    margin: 0.5rem 0;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

#mcq-quiz label:hover,
.mcq-quiz label:hover {
    background: #e8f5e9;
}

#mcq-quiz input[type="radio"],
.mcq-quiz input[type="radio"] {
    margin-right: 1rem;
}

/* Results */
.result-box {
    margin-top: 1rem;
}

.score-display {
    background: #e3f2fd;
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
    font-weight: bold;
    color: #1976d2;
    font-size: 1.1rem;
}

.error-text {
    color: #c62828;
    font-weight: bold;
}

/* XP toast (gamified feedback) */
.xp-toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 99999;
    background: #111827;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 12px 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    transform: translateY(10px);
    opacity: 0;
    transition: transform 0.18s ease, opacity 0.18s ease;
    max-width: min(420px, calc(100vw - 36px));
    font-weight: 800;
    letter-spacing: 0.2px;
}

.xp-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.xp-toast.success {
    background: linear-gradient(135deg, #0f9d58, #1976d2);
}

.xp-toast.warn {
    background: linear-gradient(135deg, #ef4444, #f59e0b);
}

/* Duel cards */
.duel-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.duel-card {
    border-radius: 16px;
    background: #fff;
    border: 2px solid #e0e0e0;
    padding: 1rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.duel-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.12);
}

.duel-card.selected {
    border-color: #1976d2;
    box-shadow: 0 14px 30px rgba(25, 118, 210, 0.18);
}

.duel-badge {
    display: inline-block;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 999px;
    padding: 0.25rem 0.6rem;
    font-weight: 800;
    font-size: 0.85rem;
}

@media (max-width: 768px) {
    .duel-grid {
        grid-template-columns: 1fr;
    }
}

.record-btn {
    background: #f44336;
    color: white;
}

.record-btn:hover {
    background: #d32f2f;
}

/* Responsive */
/* Reusable UI helpers (Culture / Context Words) */
.input {
    width: 100%;
    max-width: 520px;
    padding: 0.9rem 1rem;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
    font-size: 1rem;
}

.inline-form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.tabs {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.tab {
    text-decoration: none;
    padding: 0.6rem 0.95rem;
    border-radius: 999px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.75);
    color: #2f2a24;
    font-weight: 900;
    cursor: pointer;
    font-family: inherit;
}

.tab.active {
    background: linear-gradient(135deg, #8bb8b1, #a7d7b8);
    color: #1f2937;
    border-color: rgba(0, 0, 0, 0.06);
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
    margin-top: 1.25rem;
}

.content-card {
    display: block;
    text-decoration: none;
    background: #fff;
    border-radius: 16px;
    padding: 1.25rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    color: inherit;
}

.content-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16);
}

.content-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.content-card-title {
    font-weight: 800;
    font-size: 1.2rem;
    color: #0f9d58;
}

.content-card-subtitle {
    margin-top: 0.25rem;
    color: #333;
}

.pill {
    background: #e3f2fd;
    color: #1976d2;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
}

.content-card-body {
    margin-top: 0.9rem;
}

.content-card-footer {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1rem;
}

.muted {
    color: #64748b;
    font-size: 0.95rem;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
}

.content-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.split-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.reading-box {
    margin-top: 0.75rem;
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 1.25rem;
    line-height: 1.9;
    white-space: pre-wrap;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.info-card {
    background: #f9f9f9;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 1rem;
}

.info-title {
    font-weight: 800;
    color: #0f9d58;
    margin-bottom: 0.35rem;
}

.info-body {
    color: #334155;
    line-height: 1.7;
}

.examples {
    display: grid;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.example {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 1rem;
}

.quiz-box {
    background: linear-gradient(180deg, #f9fafb 0%, #f8fafc 100%);
    border: 2px solid #e0e0e0;
    border-radius: 14px;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
}

.quiz-box::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(500px 260px at 15% 10%, rgba(15, 157, 88, 0.08), transparent 60%),
        radial-gradient(500px 260px at 85% 80%, rgba(25, 118, 210, 0.08), transparent 60%);
    pointer-events: none;
}

.quiz-box > * {
    position: relative;
}

.quiz-question {
    font-weight: 800;
    margin-bottom: 0.75rem;
}

.quiz-options {
    display: grid;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.quiz-option {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    background: #fff;
    border-radius: 12px;
    padding: 0.9rem 1rem;
    border: 2px solid #e0e0e0;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.quiz-option:active {
    transform: scale(0.99);
}

.quiz-option:hover {
    background: #e8f5e9;
}

.quiz-box.shake {
    animation: shake 0.42s ease;
}

@keyframes shake {
    0% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
    100% { transform: translateX(0); }
}

.sense-list {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin: 0.75rem 0 1rem;
}

.sense-chip {
    border: 2px solid #e0e0e0;
    background: #fff;
    border-radius: 999px;
    padding: 0.5rem 0.9rem;
    cursor: pointer;
    font-weight: 800;
    color: #0f9d58;
}

.sense-chip.active {
    border-color: #0f9d58;
    background: #e8f5e9;
}

@media (max-width: 900px) {
    .split {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .lessons-grid {
        grid-template-columns: 1fr;
    }

    .navbar {
        flex-direction: column;
        gap: 1rem;
    }

    .word-actions,
    .sentence-actions,
    .passage-actions {
        flex-direction: column;
    }
}

/* ==========================================================
   Learn Yourself UI
   ========================================================== */

.learn-hero {
    background: rgba(255, 253, 248, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 18px;
    padding: 1.25rem 1.35rem;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.07);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.learn-hero-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.learn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 1000px) {
    .learn-grid {
        grid-template-columns: 1fr;
    }
}

.learn-card {
    margin-bottom: 0;
}

.learn-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.learn-textarea {
    width: 100%;
    min-height: 240px;
    resize: vertical;
    padding: 1rem;
    border-radius: 14px;
    border: 2px solid #e0e0e0;
    background: #fff;
    font-size: 1rem;
    line-height: 1.6;
}

.learn-textarea:focus {
    outline: none;
    border-color: #0f9d58;
    box-shadow: 0 0 0 4px rgba(15, 157, 88, 0.12);
}

.learn-output {
    background: #fff;
    border-radius: 14px;
    border: 2px solid #e0e0e0;
    padding: 1rem;
    min-height: 240px;
    white-space: pre-wrap;
    line-height: 2;
    user-select: text;
}

.learn-toolbar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 0.9rem;
}

.learn-file {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: 12px;
    padding: 0.55rem 0.75rem;
}

.learn-subsection {
    margin-top: 1rem;
}

.learn-subtitle {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.word-chips {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.word-chip {
    border: 2px solid #e0e0e0;
    background: #fff;
    border-radius: 999px;
    padding: 0.45rem 0.8rem;
    cursor: pointer;
    font-weight: 900;
    color: #0f9d58;
    transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.word-chip:hover {
    background: #e8f5e9;
}

.word-chip.selected {
    border-color: #0f9d58;
    background: rgba(224, 246, 235, 0.65);
}

#tooltip {
    position: absolute;
    z-index: 99999;
    display: none;
    background: #111827;
    color: #fff;
    border-radius: 12px;
    padding: 10px 12px;
    font-weight: 800;
    max-width: min(420px, calc(100vw - 24px));
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

/* ==========================================================
   Dashboard layout refresh
   ========================================================== */

.dashboard-hero {
    background: rgba(255, 253, 248, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 18px;
    padding: 1.25rem 1.35rem;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.07);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.dashboard-hero-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.lessons-cta {
    margin-top: 1.1rem;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.03);
    border: 1px dashed rgba(148, 163, 184, 0.7);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.lessons-cta-main {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.lessons-cta-label {
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    color: #475569;
}

.lessons-cta-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.btn-lessons-outline {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(15, 23, 42, 0.2);
    color: #0f172a;
}

@media (max-width: 768px) {
    .lessons-cta {
        align-items: flex-start;
    }
}

@media (max-width: 1000px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.action-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

@media (max-width: 900px) {
    .action-cards {
        grid-template-columns: 1fr;
    }
}

.action-card {
    display: block;
    text-decoration: none;
    color: inherit;
    background: rgba(255, 253, 248, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 18px;
    padding: 1.15rem 1.25rem;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.07);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    position: relative;
    overflow: hidden;
}

.action-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(520px 260px at 20% 15%, rgba(15, 157, 88, 0.08), transparent 60%),
        radial-gradient(520px 260px at 85% 85%, rgba(25, 118, 210, 0.07), transparent 60%);
    pointer-events: none;
}

.action-card > * {
    position: relative;
}

.action-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 55px rgba(0, 0, 0, 0.12);
}

.action-card-primary {
    border-color: rgba(139, 184, 177, 0.7);
    background: linear-gradient(180deg, rgba(224, 246, 235, 0.65) 0%, rgba(255, 253, 248, 0.92) 100%);
}

.action-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.action-card-title {
    font-weight: 900;
    font-size: 1.05rem;
}

.action-card-subtitle {
    margin-top: 0.7rem;
    font-size: 1.05rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.35;
}

.action-card-footer {
    margin-top: 0.9rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
}

/* ==========================================================
   Lessons list compaction
   ========================================================== */

.lessons-grid-compact {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.lesson-card-compact {
    padding: 1.35rem;
}

.lesson-card.is-current {
    outline: 4px solid rgba(25, 118, 210, 0.2);
}

/* ==========================================================
   Lesson stepper + icon navigation
   ========================================================== */

.lesson-navbar {
    padding: 1rem 1.25rem;
    gap: 1rem;
}

.lesson-nav-title {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.lesson-nav-kicker {
    font-weight: 900;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.75rem;
    color: #475569;
}

.lesson-nav-main {
    font-weight: 900;
    font-size: 1.1rem;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lesson-nav-links {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    align-items: center;
    font-weight: 800;
}

.mini-link {
    color: #1976d2;
    text-decoration: none;
}

.mini-link:hover {
    text-decoration: underline;
}

.icon-btn {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.72);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
}

.icon-btn svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: #0f172a;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.12);
}

.icon-btn:disabled {
    opacity: 0.45;
    pointer-events: none;
}

.icon-btn-small {
    width: 40px;
    height: 40px;
    border-radius: 12px;
}

.lesson-progress {
    margin-bottom: 1.25rem;
}

.stepper {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
}

.step {
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.75);
    padding: 0.85rem 0.9rem;
    cursor: pointer;
    font-weight: 900;
    color: #0f172a;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.step:hover {
    transform: translateY(-1px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.1);
}

.step.active {
    background: linear-gradient(135deg, #8bb8b1, #a7d7b8);
    border-color: rgba(0, 0, 0, 0.06);
}

.step.done {
    box-shadow: inset 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.assessment-panel {
    animation: panelIn 220ms ease;
}

@keyframes panelIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    align-items: center;
    margin-top: 1.25rem;
}

/* ==========================================================
   Candy Crush–style stage success overlay
   ========================================================== */

.stage-success {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 999999;
}

.stage-success.show {
    display: block;
}

.stage-success-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.stage-success-card {
    position: relative;
    max-width: 560px;
    margin: 10vh auto 0;
    background: linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(255, 253, 248, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 22px;
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.4);
    padding: 1.25rem 1.25rem 1.4rem;
    overflow: hidden;
    transform: translateY(10px);
    opacity: 0;
    transition: transform 0.18s ease, opacity 0.18s ease;
}

.stage-success.show .stage-success-card {
    transform: translateY(0);
    opacity: 1;
}

.stage-success-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(680px 320px at 30% 10%, rgba(245, 158, 11, 0.18), transparent 60%),
        radial-gradient(680px 320px at 85% 85%, rgba(236, 72, 153, 0.12), transparent 60%);
    pointer-events: none;
}

.stage-success-card > * {
    position: relative;
}

.stage-success-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.stage-success-title {
    font-weight: 1000;
    font-size: 1.35rem;
    color: #0f172a;
}

.stage-success-subtitle {
    margin-top: 0.35rem;
    color: #334155;
    font-weight: 800;
}

.stage-stars {
    margin-top: 1.1rem;
    display: flex;
    justify-content: center;
    gap: 0.85rem;
    padding: 0.5rem 0 0.25rem;
}

.giant-star {
    width: 86px;
    height: 86px;
    border-radius: 24px;
    display: grid;
    place-items: center;
    transform: translateY(12px) scale(0.85);
    opacity: 0;
    transition: transform 0.22s cubic-bezier(0.22, 1.25, 0.36, 1), opacity 0.22s ease;
    background: rgba(255, 255, 255, 0.85);
    border: 2px solid rgba(0, 0, 0, 0.08);
}

.giant-star svg {
    width: 54px;
    height: 54px;
    fill: #e5e7eb;
    filter: drop-shadow(0 18px 24px rgba(0, 0, 0, 0.18));
}

.giant-star.is-filled svg {
    fill: #f59e0b;
}

.giant-star.pop {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.stage-success-actions {
    margin-top: 1.2rem;
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

@media (prefers-reduced-motion: reduce) {
    .lesson-card,
    .action-card,
    .feature-card,
    .content-card,
    .btn {
        transition: none !important;
    }

    .assessment-panel {
        animation: none !important;
    }
}

/* ==========================================================
   UI preferences: font size + dark mode + reduced motion
   ========================================================== */

html { font-size: 16px; }
html[data-font="sm"] { font-size: 14px; }
html[data-font="md"] { font-size: 16px; }
html[data-font="lg"] { font-size: 18px; }
html[data-font="xl"] { font-size: 20px; }

html[data-motion="reduced"] * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}

/* Dark theme overrides (kept lightweight, no major refactor) */
html[data-theme="dark"] body {
    color: #e5e7eb;
    background:
        radial-gradient(1200px 600px at 20% 10%, rgba(30, 41, 59, 0.9), transparent 60%),
        radial-gradient(1100px 520px at 85% 80%, rgba(17, 24, 39, 0.95), transparent 58%),
        linear-gradient(135deg, #0b1220 0%, #0f172a 55%, #0b1220 100%);
}

html[data-theme="dark"] .navbar {
    background: rgba(17, 24, 39, 0.72);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .navbar h2 { color: #f8fafc; }
html[data-theme="dark"] .user-name { color: rgba(226, 232, 240, 0.9); }

html[data-theme="dark"] .word-of-day,
html[data-theme="dark"] .progress-summary,
html[data-theme="dark"] .assessment-section,
html[data-theme="dark"] .action-card,
html[data-theme="dark"] .content-card,
html[data-theme="dark"] .lesson-card,
html[data-theme="dark"] .dashboard-hero {
    background: rgba(17, 24, 39, 0.82);
    border-color: rgba(255, 255, 255, 0.10);
    box-shadow: 0 18px 55px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .word-item,
html[data-theme="dark"] .sentence-item,
html[data-theme="dark"] .passage-container,
html[data-theme="dark"] .reading-box,
html[data-theme="dark"] .quiz-box,
html[data-theme="dark"] #mcq-quiz .question,
html[data-theme="dark"] .info-card,
html[data-theme="dark"] .example {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(255, 255, 255, 0.10);
}

html[data-theme="dark"] .urdu-text { color: #f8fafc; }
html[data-theme="dark"] .english-text { color: rgba(226, 232, 240, 0.85); }
html[data-theme="dark"] .roman-text { color: rgba(148, 163, 184, 0.9); }
html[data-theme="dark"] .muted { color: rgba(148, 163, 184, 0.95); }

html[data-theme="dark"] .input {
    background: rgba(15, 23, 42, 0.82);
    border-color: rgba(255, 255, 255, 0.12);
    color: #e5e7eb;
}

html[data-theme="dark"] .tab {
    background: rgba(15, 23, 42, 0.82);
    border-color: rgba(255, 255, 255, 0.12);
    color: #e5e7eb;
}

html[data-theme="dark"] .tab.active {
    color: #0b1220;
}

html[data-theme="dark"] .icon-btn {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .icon-btn svg { stroke: #e5e7eb; }

/* ==========================================================
   Profile button + modal
   ========================================================== */

.profile-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.72);
    padding: 0.35rem 0.55rem;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.profile-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.12);
}

.profile-avatar {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    overflow: hidden;
    display: grid;
    place-items: center;
    font-weight: 1000;
    background: linear-gradient(135deg, #8bb8b1, #a7d7b8);
    color: #0b1220;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.profile-caret {
    font-weight: 900;
    color: #0f172a;
    padding-right: 0.15rem;
}

html[data-theme="dark"] .profile-btn {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .profile-caret { color: #e5e7eb; }

.modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 999999;
}

.modal.show {
    display: block;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-card {
    position: relative;
    max-width: 720px;
    margin: 8vh auto 0;
    background: rgba(255, 253, 248, 0.98);
    border: 1px solid rgba(0, 0, 0, 0.10);
    border-radius: 22px;
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.35);
    padding: 1.15rem 1.15rem 1rem;
}

html[data-theme="dark"] .modal-card {
    background: rgba(17, 24, 39, 0.92);
    border-color: rgba(255, 255, 255, 0.12);
}

.modal-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 1000;
    color: #0f172a;
}

html[data-theme="dark"] .modal-title { color: #f8fafc; }

.modal-tabs {
    display: flex;
    gap: 0.6rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.modal-body {
    margin-top: 1rem;
}

.howto h3 {
    margin-bottom: 0.5rem;
}

.howto ul {
    margin-left: 1.1rem;
    line-height: 1.7;
}

.settings-grid {
    display: grid;
    gap: 1rem;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    padding: 0.85rem 0.9rem;
    border-radius: 14px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(255, 255, 255, 0.65);
}

html[data-theme="dark"] .settings-row {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(255, 255, 255, 0.12);
}

.settings-label {
    font-weight: 1000;
    margin-bottom: 0.15rem;
}

.font-controls {
    display: flex;
    gap: 0.45rem;
    align-items: center;
    flex-wrap: wrap;
}

.toggle {
    position: relative;
    width: 56px;
    height: 32px;
    display: inline-block;
}

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

.toggle-track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.55);
    border: 1px solid rgba(0, 0, 0, 0.12);
    transition: background 0.2s ease;
}

.toggle-track::after {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.18);
    transition: transform 0.2s ease;
}

.toggle input:checked + .toggle-track {
    background: rgba(16, 185, 129, 0.75);
}

.toggle input:checked + .toggle-track::after {
    transform: translateX(24px);
}

.modal-footer {
    margin-top: 1rem;
    display: flex;
    justify-content: flex-end;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #f59e0b);
    color: #111827;
    font-weight: 900;
}

/* ==========================================================
   Word Games styles
   ========================================================== */
.games-page {
  max-width: 100%;
  width: 100%;
  min-height: calc(100vh - 120px);
  margin: 2rem auto;
  display: flex;
  flex-direction: column;
}

.games-panels {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (max-width: 768px) {
  .games-page {
    margin: 1.5rem auto;
    padding: 0 1rem 2rem;
  }
}

.games-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.games-tabs .tab {
  border: none;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  background: #e5e7eb;
  cursor: pointer;
  font-size: 0.9rem;
}
.games-tabs .tab.active {
  background: #2563eb;
  color: #fff;
}
.game-panel {
  margin-top: 0.5rem;
}
.game-box {
  min-height: 4rem;
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
  padding: 1rem 1.5rem;
  font-size: 2.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.letters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.letter-btn {
  min-width: 2.4rem;
  padding: 0.45rem 0.8rem;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  background: #fff;
  cursor: pointer;
  font-size: 1.6rem;
}
.game-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
}
.game-feedback {
  margin-top: 0.75rem;
  font-size: 0.95rem;
}
.game-feedback.success {
  color: #15803d;
}
.game-feedback.error {
  color: #b91c1c;
}

.crossword-grid {
  margin-top: 0.75rem;
}
.crossword-table {
  border-collapse: collapse;
}
.crossword-table td {
  width: 32px;
  height: 32px;
  border: 1px solid #e5e7eb;
}
.crossword-table td.crossword-empty {
  background: #f3f4f6;
}
.crossword-cell {
  width: 100%;
  height: 100%;
  border: none;
  text-align: center;
  font-size: 1.1rem;
}
.crossword-cell.crossword-correct {
  background: #dcfce7;
}
.crossword-cell.crossword-wrong {
  background: #fee2e2;
}
.crossword-clues {
  margin-top: 0.75rem;
}

.matching-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-top: 0.75rem;
}
.matching-column {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.matching-word,
.matching-meaning {
  border-radius: 0.75rem;
  border: 1px solid #e5e7eb;
  background: #fff;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  text-align: left;
}
.matching-word.selected,
.matching-meaning.selected {
  outline: 2px solid #2563eb;
}
.matching-word.matched,
.matching-meaning.matched {
  background: #dcfce7;
  opacity: 0.8;
}

.hangman-word {
  margin-top: 0.75rem;
  font-size: 2.4rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.hangman-letter {
  min-width: 1.4rem;
  text-align: center;
}

/* Bingo */
.bingo-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}
.bingo-modes {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.bingo-mode-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.bingo-grid-wrapper {
  margin-top: 1rem;
}
.bingo-grid {
  border-collapse: collapse;
  width: 100%;
  max-width: 480px;
}
.bingo-grid td {
  border: 1px solid #e5e7eb;
  padding: 0.5rem;
  font-size: 0.9rem;
  text-align: center;
  cursor: pointer;
  background: #fff;
}
.bingo-grid td.bingo-marked {
  background: #dcfce7;
}
