/* ==========================================================================
   IQRAA AI - منصة اقرأ بذكاء
   Arabic Dyslexia Adaptive Learning Platform
   Universal Cognitive Accessibility & Dyslexia Ergonomics
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&family=Tajawal:wght@400;500;700;800&family=Amiri:wght@400;700&display=swap');

:root {
    /* Color Palette - Default Irlen Warm Cream */
    --bg-main: #FAF8F5;
    --bg-card: #FFFFFF;
    --bg-card-subtle: #F5EFE6;
    --bg-elevated: #FFFFFF;
    --border-color: #E6DFD5;
    --border-subtle: #EDE7DD;

    --text-primary: #1E293B;
    --text-secondary: #475569;
    --text-muted: #64748B;

    /* Theme Accents */
    --primary: #0284C7;
    --primary-light: #E0F2FE;
    --primary-dark: #0369A1;

    --accent-emerald: #059669;
    --accent-emerald-light: #D1FAE5;

    --accent-amber: #D97706;
    --accent-amber-light: #FEF3C7;

    --accent-rose: #E11D48;
    --accent-rose-light: #FFE4E6;

    --accent-purple: #7C3AED;
    --accent-purple-light: #EDE9FE;

    /* Dyslexia Tashkeel Colors */
    --fatha-color: #EF4444;
    --damma-color: #2563EB;
    --kasra-color: #059669;
    --sukun-color: #7C3AED;
    --tanween-color: #D97706;

    /* Typography & Spacing */
    --font-base: 'Tajawal', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-size-base: 18px;
    --line-height-base: 1.85;
    --letter-spacing-base: 0.04em;
    --word-spacing-base: 0.08em;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;

    --shadow-soft: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 10px 25px -5px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 35px -10px rgba(0, 0, 0, 0.12);
}

/* Color Theme Presets */
body[data-theme="irlen"] {
    --bg-main: #FAF8F5;
    --bg-card: #FFFFFF;
    --bg-card-subtle: #F3ECE1;
    --text-primary: #1E293B;
    --border-color: #E7DFD4;
}

body[data-theme="sepia"] {
    --bg-main: #FBF6EA;
    --bg-card: #FFFDF9;
    --bg-card-subtle: #F3EBD6;
    --text-primary: #2B231A;
    --border-color: #E5D9BF;
}

body[data-theme="mint"] {
    --bg-main: #F0F8F4;
    --bg-card: #FFFFFF;
    --bg-card-subtle: #E1F1E8;
    --text-primary: #132A1E;
    --border-color: #CCE8D7;
}

body[data-theme="dark"] {
    --bg-main: #0F172A;
    --bg-card: #1E293B;
    --bg-card-subtle: #334155;
    --text-primary: #F8FAFC;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    --border-color: #334155;
    --shadow-soft: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
}

body[data-theme="white"] {
    --bg-main: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-card-subtle: #F1F5F9;
    --text-primary: #0F172A;
    --border-color: #E2E8F0;
}

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

html {
    direction: rtl;
    text-align: right;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-base);
    font-size: var(--font-size-base);
    line-height: var(--line-height-base);
    letter-spacing: var(--letter-spacing-base);
    word-spacing: var(--word-spacing-base);
    transition: background-color 0.25s ease, color 0.25s ease;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Header & Main Nav */
.header-glass {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-card);
    border-bottom: 2px solid var(--border-color);
    box-shadow: var(--shadow-soft);
    padding: 12px 24px;
}

.header-container {
    max-width: 1380px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    height: 42px;
    width: auto;
    border-radius: 8px;
}

.brand-text h1 {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.2;
}

.brand-text p {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.badge-adc {
    background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%);
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--radius-full);
}

/* Nav Portal Tabs */
.nav-tabs {
    display: flex;
    background: var(--bg-card-subtle);
    padding: 4px;
    border-radius: var(--radius-full);
    gap: 4px;
}

.nav-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 700;
    padding: 8px 18px;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-tab-btn:hover {
    color: var(--primary);
}

.nav-tab-btn.active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-header-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1.5px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 7px 14px;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-header-action:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}

.btn-primary-action {
    background: var(--primary);
    color: #FFFFFF;
    border: none;
}

.btn-primary-action:hover {
    background: var(--primary-dark);
    color: #FFFFFF;
}

/* Main Container */
.main-wrapper {
    max-width: 1380px;
    margin: 24px auto;
    padding: 0 20px 60px 20px;
}

/* Portal Views */
.portal-view {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.portal-view.active {
    display: block;
}

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

/* Floating Accessibility Toolbar */
.access-bar-drawer {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.access-group {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 700;
}

.access-group label {
    color: var(--text-muted);
}

.theme-palette {
    display: flex;
    gap: 6px;
}

.theme-swatch {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 2px solid #CBD5E1;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.theme-swatch:hover, .theme-swatch.active {
    transform: scale(1.15);
    border-color: var(--primary);
}

.theme-swatch.swatch-irlen { background: #FAF8F5; }
.theme-swatch.swatch-sepia { background: #FBF6EA; }
.theme-swatch.swatch-mint  { background: #F0F8F4; }
.theme-swatch.swatch-dark  { background: #1E293B; }
.theme-swatch.swatch-white { background: #FFFFFF; }

.font-size-ctrls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-ctrl {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background: var(--bg-card-subtle);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 800;
    font-size: 15px;
}

.btn-ctrl:hover {
    background: var(--primary);
    color: #FFF;
}

/* Cards & Layout */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.card-box {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 24px;
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-box:hover {
    box-shadow: var(--shadow-md);
}

.card-header-clean {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1.5px solid var(--border-subtle);
}

.card-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Banner / Hero Component */
.hero-banner {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.08) 0%, rgba(5, 150, 105, 0.08) 100%);
    border: 2px solid var(--primary-light);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.hero-content h2 {
    font-size: 26px;
    font-weight: 900;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.hero-content p {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 720px;
}

.hero-stats-row {
    display: flex;
    gap: 16px;
}

.hero-stat-pill {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 18px;
    text-align: center;
    box-shadow: var(--shadow-soft);
}

.hero-stat-num {
    font-size: 22px;
    font-weight: 900;
    color: var(--primary);
    display: block;
}

.hero-stat-lbl {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 700;
}

/* Learner Lab Navigation */
.lab-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 22px;
    overflow-x: auto;
    padding-bottom: 6px;
}

.lab-tab-item {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 800;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: all 0.2s ease;
}

.lab-tab-item:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.lab-tab-item.active {
    background: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
    box-shadow: var(--shadow-soft);
}

.lab-view {
    display: none;
}

.lab-view.active {
    display: block;
}

/* Exercise Simulator Layout */
.simulator-box {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 30px;
    text-align: center;
    box-shadow: var(--shadow-md);
    position: relative;
}

.simulator-prompt {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.big-letter-display {
    font-size: 96px;
    line-height: 1.1;
    font-weight: 900;
    color: var(--primary);
    background: var(--bg-card-subtle);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 170px;
    min-height: 150px;
    padding: 16px 28px;
    border-radius: var(--radius-lg);
    border: 3px dashed var(--border-color);
    margin-bottom: 24px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.big-letter-display:hover {
    border-color: var(--primary);
    transform: scale(1.03);
}

.big-letter-display .speaker-icon {
    font-size: 28px;
    margin-right: 12px;
    color: var(--accent-amber);
}

/* Dot Highlighting Pulse */
.dot-highlight {
    color: #EF4444;
    text-shadow: 0 0 12px rgba(239, 68, 68, 0.7);
    animation: dotPulse 1.5s infinite;
}

@keyframes dotPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.85; }
}

/* Quiz Option Buttons */
.quiz-options-grid {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.btn-option {
    font-size: 32px;
    font-weight: 800;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2.5px solid var(--border-color);
    border-radius: var(--radius-md);
    min-width: 90px;
    min-height: 75px;
    padding: 10px 24px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: var(--shadow-soft);
}

.btn-option:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
}

.btn-option.correct {
    background: var(--accent-emerald-light) !important;
    border-color: var(--accent-emerald) !important;
    color: #065F46 !important;
}

.btn-option.wrong {
    background: #FEF2F2 !important;
    border-color: #EF4444 !important;
    color: #991B1B !important;
}

.feedback-msg {
    margin-top: 18px;
    font-size: 16px;
    font-weight: 800;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Scaffolding Hint Drawer */
.scaffold-drawer {
    background: #FFFBEB;
    border: 2px dashed #F59E0B;
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-top: 20px;
    text-align: right;
    display: none;
    animation: fadeIn 0.25s ease;
}

.scaffold-drawer.visible {
    display: block;
}

.scaffold-title {
    font-weight: 800;
    color: #B45309;
    font-size: 14.5px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

/* Tashkeel & Phonetics Lab */
.tashkeel-selector {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tashkeel-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 12px 18px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.tashkeel-card:hover, .tashkeel-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-2px);
}

.tashkeel-symbol {
    font-size: 34px;
    font-weight: 900;
    line-height: 1.2;
}

.tashkeel-fatha { color: var(--fatha-color); }
.tashkeel-damma { color: var(--damma-color); }
.tashkeel-kasra { color: var(--kasra-color); }
.tashkeel-sukun { color: var(--sukun-color); }

.contrast-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin: 16px 0;
}

.contrast-table th, .contrast-table td {
    padding: 14px 18px;
    text-align: center;
    border-bottom: 1px solid var(--border-subtle);
}

.contrast-table th {
    background: var(--bg-card-subtle);
    font-size: 14.5px;
    font-weight: 800;
    color: var(--text-secondary);
}

.contrast-table td {
    font-size: 22px;
    font-weight: 800;
}

.btn-listen-cell {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
}

.btn-listen-cell:hover {
    background: var(--primary-light);
}

/* Syllable Assembly Lab */
.syllable-display-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    min-height: 80px;
    flex-wrap: wrap;
}

.syllable-tile {
    font-size: 30px;
    font-weight: 900;
    padding: 10px 22px;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    background: var(--bg-card);
    box-shadow: var(--shadow-soft);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    position: relative;
}

.syllable-tile:hover {
    border-color: var(--primary);
    transform: scale(1.05);
}

.syllable-tile.placed {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary-dark);
}

.syllable-slot {
    min-width: 75px;
    height: 70px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card-subtle);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 800;
}

/* Reading Passage & Karaoke */
.reading-passage-box {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 30px;
    position: relative;
    user-select: text;
}

.passage-text {
    font-size: 26px;
    line-height: 2.2;
    word-spacing: 0.15em;
    letter-spacing: 0.05em;
    color: var(--text-primary);
}

.passage-word {
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.passage-word:hover {
    background-color: var(--primary-light);
}

.passage-word.active-karaoke {
    background-color: #FEF08A;
    color: #854D0E;
    box-shadow: 0 0 10px rgba(234, 179, 8, 0.4);
    font-weight: 800;
}

/* Reading Ruler Overlay */
.reading-ruler {
    position: fixed;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(254, 240, 138, 0.25);
    border-top: 2px dashed #EAB308;
    border-bottom: 2px dashed #EAB308;
    pointer-events: none;
    z-index: 999;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.28);
    display: none;
    transition: top 0.05s ease-out;
}

.reading-ruler.active {
    display: block;
}

/* Teacher Dashboard */
.stat-card-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.metric-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.metric-lbl {
    font-size: 13.5px;
    color: var(--text-muted);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.metric-val {
    font-size: 32px;
    font-weight: 900;
    color: var(--text-primary);
    margin: 8px 0;
}

.metric-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    display: inline-block;
    align-self: flex-start;
}

.badge-green { background: #D1FAE5; color: #065F46; }
.badge-blue { background: #E0F2FE; color: #0369A1; }
.badge-amber { background: #FEF3C7; color: #92400E; }
.badge-purple { background: #EDE9FE; color: #5B21B6; }

/* SVG Chart Container */
.chart-box {
    width: 100%;
    height: 240px;
    position: relative;
    margin-top: 10px;
}

/* IEP Pedagogical Card */
.iep-card {
    background: #FFFDF7;
    border: 2px solid #FDE68A;
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-soft);
}

.iep-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    margin-bottom: 16px;
    border-bottom: 2px solid #FEF3C7;
    flex-wrap: wrap;
    gap: 10px;
}

.iep-title {
    font-size: 18px;
    font-weight: 900;
    color: #92400E;
    display: flex;
    align-items: center;
    gap: 8px;
}

.iep-list {
    list-style: none;
    margin: 12px 0;
}

.iep-list li {
    padding: 8px 0 8px 24px;
    position: relative;
    font-size: 14.5px;
    color: #451A03;
    font-weight: 600;
    line-height: 1.6;
}

.iep-list li::before {
    content: '✓';
    position: absolute;
    right: 0;
    color: #059669;
    font-weight: 900;
}

/* Parent Portal Guide Cards */
.parent-tip-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.parent-tip-icon {
    font-size: 32px;
    background: var(--bg-card-subtle);
    padding: 10px;
    border-radius: var(--radius-md);
}

.parent-tip-content h3 {
    font-size: 16px;
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.parent-tip-content p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Modal Windows */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    padding: 28px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close-btn {
    position: absolute;
    top: 18px;
    left: 18px;
    background: var(--bg-card-subtle);
    border: none;
    font-size: 18px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Footer */
.site-footer {
    border-top: 2px solid var(--border-color);
    background: var(--bg-card);
    padding: 24px;
    text-align: center;
    font-size: 13.5px;
    color: var(--text-muted);
    margin-top: 40px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 18px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
}

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

/* Print Styles for Clinical IEP */
@media print {
    body {
        background: #FFF !important;
        color: #000 !important;
        font-size: 12pt;
    }
    .header-glass, .nav-tabs, .access-bar-drawer, .site-footer, .btn-header-action, .lab-tabs {
        display: none !important;
    }
    .portal-view {
        display: block !important;
    }
    .card-box, .iep-card {
        border: 1px solid #CCC !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }
}

/* ==========================================================================
   Welcome Screen & Simple Registration Wizard
   ========================================================================== */
.wizard-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: fadeIn 0.25s ease-out;
}

.wizard-overlay.active {
    display: flex;
}

.wizard-card {
    background: var(--bg-card);
    border: 3px solid var(--primary);
    border-radius: 28px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
    width: 100%;
    max-width: 680px;
    padding: 36px 32px;
    position: relative;
    max-height: 92vh;
    overflow-y: auto;
    text-align: center;
}

.wizard-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 28px;
    position: relative;
}

.step-dot {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--bg-card-subtle);
    border: 2px solid var(--border-color);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 900;
    transition: all 0.25s ease;
}

.step-dot.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #FFFFFF;
    box-shadow: 0 0 14px rgba(2, 132, 199, 0.5);
    transform: scale(1.1);
}

.step-dot.done {
    background: var(--accent-emerald);
    border-color: var(--accent-emerald);
    color: #FFFFFF;
}

.step-connector {
    width: 32px;
    height: 4px;
    background: var(--border-color);
    border-radius: 2px;
    transition: background 0.25s ease;
}

.step-connector.active {
    background: var(--primary);
}

.wizard-step-pane {
    display: none;
    animation: fadeIn 0.25s ease-out;
}

.wizard-step-pane.active {
    display: block;
}

.wizard-title {
    font-size: 26px;
    font-weight: 900;
    color: var(--primary-dark);
    margin-bottom: 8px;
}

.wizard-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    line-height: 1.6;
}

/* Role Selector Cards */
.role-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.role-card {
    background: var(--bg-card-subtle);
    border: 2.5px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 14px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.role-card:hover, .role-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.role-card-icon {
    font-size: 44px;
    margin-bottom: 10px;
    display: block;
}

.role-card-title {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: block;
}

.role-card-desc {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

/* Avatar Picker Grid */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 16px 0;
}

.avatar-choice {
    font-size: 38px;
    background: var(--bg-card-subtle);
    border: 2.5px solid var(--border-color);
    border-radius: 18px;
    padding: 12px 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.avatar-choice:hover, .avatar-choice.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: scale(1.12);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

/* Wizard Input Fields */
.wizard-input {
    width: 100%;
    padding: 14px 18px;
    font-size: 16px;
    font-family: inherit;
    font-weight: 700;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
    margin-bottom: 16px;
}

.wizard-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

/* Theme Preference Cards */
.theme-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin: 18px 0;
}

.theme-preview-card {
    border: 2.5px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 10px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.theme-preview-card.selected {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.theme-preview-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    margin: 0 auto 8px auto;
    border: 2px solid rgba(0,0,0,0.1);
}

.wizard-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 28px;
    padding-top: 18px;
    border-top: 2px solid var(--border-subtle);
}

.btn-wizard {
    padding: 12px 24px;
    font-size: 15.5px;
    font-weight: 800;
    font-family: inherit;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-wizard-primary {
    background: var(--primary);
    color: #FFFFFF;
    box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4);
}

.btn-wizard-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-wizard-secondary {
    background: var(--bg-card-subtle);
    color: var(--text-secondary);
    border: 1.5px solid var(--border-color);
}

.btn-wizard-secondary:hover {
    background: var(--border-color);
}

/* ==========================================================================
   Canva-Style Learning Map Board (لوحة خارطة التعلم التفاعلية)
   ========================================================================== */
.canva-board-container {
    background: linear-gradient(180deg, #F0F9FF 0%, #E0F2FE 30%, #F5F3FF 70%, #FEF3C7 100%);
    border: 3px solid #BAE6FD;
    border-radius: 32px;
    padding: 32px 24px;
    margin-bottom: 32px;
    position: relative;
    box-shadow: 0 20px 40px -15px rgba(2, 132, 199, 0.15);
    overflow: hidden;
}

body[data-theme="dark"] .canva-board-container {
    background: linear-gradient(180deg, #1E293B 0%, #0F172A 50%, #1E1B4B 100%);
    border-color: #334155;
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
}

body[data-theme="sepia"] .canva-board-container {
    background: linear-gradient(180deg, #FBF6EA 0%, #F5EBD6 40%, #EDE0C4 100%);
    border-color: #D6C29D;
}

body[data-theme="mint"] .canva-board-container {
    background: linear-gradient(180deg, #F0FDF4 0%, #DCFCE7 40%, #E0F2FE 100%);
    border-color: #A7F3D0;
}

/* Gamer HUD Bar */
.map-hud-bar {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 8px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: var(--shadow-md);
    margin-bottom: 28px;
    flex-wrap: wrap;
    position: relative;
    z-index: 10;
}

.hud-player-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hud-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-light);
    border: 2px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    user-select: none;
}

.hud-name-box strong {
    font-size: 15px;
    font-weight: 900;
    color: var(--text-primary);
    display: block;
    line-height: 1.2;
}

.hud-name-box span {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 700;
}

.hud-stats-group {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.hud-stat-pill {
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 13.5px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hud-stat-pill.stars { color: #D97706; background: #FEF3C7; border-color: #FDE68A; }
.hud-stat-pill.gems  { color: #0284C7; background: #E0F2FE; border-color: #BAE6FD; }
.hud-stat-pill.streak{ color: #E11D48; background: #FFE4E6; border-color: #FECDD3; }

/* Canva Map Track & Nodes */
.map-canvas-track {
    position: relative;
    max-width: 960px;
    margin: 0 auto;
    padding: 20px 0;
}

/* Background Winding Path SVG */
.map-svg-trail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.map-svg-trail path {
    fill: none;
    stroke: #38BDF8;
    stroke-width: 8;
    stroke-dasharray: 12, 10;
    stroke-linecap: round;
    animation: dashPulse 25s linear infinite;
}

@keyframes dashPulse {
    to { stroke-dashoffset: -1000; }
}

/* Milestone Cards */
.milestones-wrapper {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 36px;
}

.milestone-row {
    display: flex;
    align-items: center;
    width: 100%;
}

.milestone-row.pos-right { justify-content: flex-start; }
.milestone-row.pos-center{ justify-content: center; }
.milestone-row.pos-left  { justify-content: flex-end; }

.milestone-card {
    background: var(--bg-card);
    border: 3px solid var(--border-color);
    border-radius: 24px;
    padding: 20px 24px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    user-select: none;
}

.milestone-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 35px -8px rgba(0, 0, 0, 0.18);
    border-color: var(--primary);
}

.milestone-card.active-stage {
    border-color: var(--primary);
    box-shadow: 0 0 0 5px var(--primary-light), 0 16px 32px -8px rgba(2, 132, 199, 0.35);
}

.milestone-card.locked {
    opacity: 0.65;
    filter: grayscale(0.4);
    cursor: not-allowed;
}

.milestone-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.milestone-icon-badge {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: var(--shadow-soft);
}

.icon-oasis   { background: linear-gradient(135deg, #E0F2FE, #BAE6FD); }
.icon-valley  { background: linear-gradient(135deg, #FEF3C7, #FDE68A); }
.icon-bridge  { background: linear-gradient(135deg, #EDE9FE, #DDD6FE); }
.icon-castle  { background: linear-gradient(135deg, #D1FAE5, #A7F3D0); }
.icon-tower   { background: linear-gradient(135deg, #FFE4E6, #FECDD3); }

.milestone-stage-tag {
    font-size: 11px;
    font-weight: 900;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
}

.tag-done   { background: #D1FAE5; color: #065F46; }
.tag-active { background: #E0F2FE; color: #0369A1; }
.tag-locked { background: #F1F5F9; color: #64748B; }

.milestone-title {
    font-size: 19px;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.milestone-desc {
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 14px;
}

.milestone-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 10px;
    border-top: 1.5px solid var(--border-subtle);
}

.milestone-stars {
    font-size: 18px;
    letter-spacing: 2px;
    color: #F59E0B;
}

.btn-milestone-play {
    background: var(--primary);
    color: #FFFFFF;
    border: none;
    padding: 6px 16px;
    border-radius: var(--radius-full);
    font-size: 13.5px;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s ease;
}

.btn-milestone-play:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* Floating Helper Guide */
.map-floating-tip {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    border: 2px dashed #38BDF8;
    border-radius: var(--radius-lg);
    padding: 12px 20px;
    margin-top: 24px;
    text-align: center;
    font-size: 14px;
    font-weight: 800;
    color: #0369A1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-soft);
}

/* ==========================================================================
   UI/UX & Logic Enhancements: Confetti, Focus Mask, Tashkeel Magnifier,
   Milestone Pawn, Certificate of Achievement & Study Timer
   ========================================================================== */

/* Confetti Fullscreen Canvas */
#confetti-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 3000;
}

/* Focus Mask Mode */
.focus-mask-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 998;
    background: radial-gradient(circle at center, transparent 180px, rgba(15, 23, 42, 0.75) 320px);
    display: none;
    transition: opacity 0.3s ease;
}

.focus-mask-overlay.active {
    display: block;
}

/* Tashkeel Magnifier & Colors */
.tashkeel-magnified {
    font-size: 1.18em;
    font-weight: 900;
}

body.tashkeel-enhanced .tashkeel-fatha,
body.tashkeel-enhanced [data-tashkeel="fatha"] {
    color: #DC2626 !important;
    text-shadow: 0 0 6px rgba(220, 38, 38, 0.4);
}

body.tashkeel-enhanced .tashkeel-damma,
body.tashkeel-enhanced [data-tashkeel="damma"] {
    color: #2563EB !important;
    text-shadow: 0 0 6px rgba(37, 99, 235, 0.4);
}

body.tashkeel-enhanced .tashkeel-kasra,
body.tashkeel-enhanced [data-tashkeel="kasra"] {
    color: #059669 !important;
    text-shadow: 0 0 6px rgba(5, 150, 105, 0.4);
}

/* Syllable Color Separation */
body.syllable-highlighted .syl-1 {
    background-color: rgba(37, 99, 235, 0.12);
    border-radius: 4px;
    padding: 1px 3px;
}
body.syllable-highlighted .syl-2 {
    background-color: rgba(217, 119, 6, 0.14);
    border-radius: 4px;
    padding: 1px 3px;
}
body.syllable-highlighted .syl-3 {
    background-color: rgba(16, 185, 129, 0.14);
    border-radius: 4px;
    padding: 1px 3px;
}

/* Milestone Player Pawn Pin */
.milestone-player-pawn {
    position: absolute;
    top: -18px;
    right: 24px;
    background: #0284C7;
    color: #FFFFFF;
    border: 3px solid #FFFFFF;
    border-radius: var(--radius-full);
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 900;
    box-shadow: 0 8px 16px rgba(2, 132, 199, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    animation: bouncePawn 2s infinite ease-in-out;
    z-index: 10;
}

@keyframes bouncePawn {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

/* Milestone Briefing Modal */
.briefing-modal-card {
    background: var(--bg-card);
    border: 3px solid var(--primary);
    border-radius: 28px;
    padding: 32px;
    max-width: 580px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.3);
}

.briefing-skills-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 18px 0;
    text-align: right;
}

.briefing-skill-item {
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-color);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 13.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Certificate of Achievement Card */
.certificate-card {
    background: #FFFEF7;
    border: 6px double #D97706;
    border-radius: 24px;
    padding: 36px 28px;
    text-align: center;
    margin: 20px auto;
    max-width: 620px;
    position: relative;
    box-shadow: 0 20px 40px rgba(217, 119, 6, 0.15);
}

.certificate-seal {
    width: 80px;
    height: 80px;
    margin: 0 auto 12px auto;
    background: linear-gradient(135deg, #F59E0B, #D97706);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: #FFF;
    box-shadow: 0 8px 20px rgba(217, 119, 6, 0.4);
}

/* Study Timer Widget */
.study-timer-box {
    background: linear-gradient(135deg, #065F46 0%, #047857 100%);
    color: #FFFFFF;
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    box-shadow: var(--shadow-md);
    margin-bottom: 24px;
}

.timer-digits {
    font-size: 54px;
    font-weight: 900;
    letter-spacing: 2px;
    font-family: monospace;
    margin: 12px 0;
    color: #A7F3D0;
    text-shadow: 0 0 16px rgba(167, 243, 208, 0.4);
}

.btn-timer-action {
    background: #FFFFFF;
    color: #065F46;
    border: none;
    font-size: 15px;
    font-weight: 800;
    font-family: inherit;
    padding: 10px 24px;
    border-radius: var(--radius-full);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.2s ease;
    margin: 0 4px;
}

.btn-timer-action:hover {
    transform: translateY(-2px);
    background: #F0FDF4;
}

/* Sound Wave Pulse */
.audio-pulse-ring {
    display: inline-block;
    width: 12px;
    height: 12px;
    background: #059669;
    border-radius: 50%;
    margin-right: 6px;
    animation: audioPulse 1.2s infinite ease-in-out;
}

@keyframes audioPulse {
    0%, 100% { transform: scale(0.9); opacity: 0.6; }
    50% { transform: scale(1.4); opacity: 1; }
}

/* Story Pill Switcher */
.story-pills-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.btn-story-pill {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 8px 18px;
    font-size: 13.5px;
    font-weight: 800;
    font-family: inherit;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-story-pill:hover, .btn-story-pill.active {
    background: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
    box-shadow: var(--shadow-soft);
}

/* ==========================================================================
   28 ARABIC LETTERS AUDIO SOUND STUDIO & SOUNDBOARD
   استوديو المسارات الصوتية ومخارج الحروف الـ 28
   ========================================================================== */
.sound-studio-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Master Audio Player HUD Bar */
.audio-master-hud {
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.08) 0%, rgba(124, 58, 237, 0.08) 100%);
    border: 2px solid var(--primary-light);
    border-radius: var(--radius-lg);
    padding: 18px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

body[data-theme="dark"] .audio-master-hud {
    background: rgba(30, 41, 59, 0.85);
    border-color: #334155;
}

.audio-now-playing {
    display: flex;
    align-items: center;
    gap: 16px;
}

.audio-glyph-preview {
    width: 60px;
    height: 60px;
    background: var(--bg-card);
    border: 3px solid var(--primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 34px;
    font-weight: 900;
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.15);
    transition: transform 0.25s ease;
}

.audio-glyph-preview.anim-bounce {
    animation: glyphBounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes glyphBounce {
    0% { transform: scale(0.85); }
    50% { transform: scale(1.18); }
    100% { transform: scale(1); }
}

.audio-info-meta h4 {
    margin: 0 0 4px 0;
    font-size: 19px;
    font-weight: 900;
    color: var(--text-primary);
}

.audio-info-meta p {
    margin: 0;
    font-size: 13.5px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Audio Waveform Visualizer */
.audio-waveform-bars {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 36px;
    padding: 0 10px;
}

.wave-bar {
    width: 5px;
    height: 8px;
    background: var(--primary);
    border-radius: 4px;
    transition: height 0.15s ease, background-color 0.2s ease;
}

.wave-bar:nth-child(2) { background: #059669; }
.wave-bar:nth-child(3) { background: #D97706; }
.wave-bar:nth-child(4) { background: #7C3AED; }
.wave-bar:nth-child(5) { background: #E11D48; }
.wave-bar:nth-child(6) { background: #0284C7; }
.wave-bar:nth-child(7) { background: #10B981; }

.audio-waveform-bars.playing .wave-bar {
    animation: waveBounce 0.6s infinite ease-in-out alternate;
}

.audio-waveform-bars.playing .wave-bar:nth-child(1) { animation-delay: 0.05s; }
.audio-waveform-bars.playing .wave-bar:nth-child(2) { animation-delay: 0.15s; }
.audio-waveform-bars.playing .wave-bar:nth-child(3) { animation-delay: 0.30s; }
.audio-waveform-bars.playing .wave-bar:nth-child(4) { animation-delay: 0.10s; }
.audio-waveform-bars.playing .wave-bar:nth-child(5) { animation-delay: 0.25s; }
.audio-waveform-bars.playing .wave-bar:nth-child(6) { animation-delay: 0.40s; }
.audio-waveform-bars.playing .wave-bar:nth-child(7) { animation-delay: 0.20s; }

@keyframes waveBounce {
    0% { height: 6px; }
    100% { height: 32px; }
}

.audio-controls-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-audio-ctl {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 7px 15px;
    font-size: 13px;
    font-weight: 800;
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-audio-ctl:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

.btn-audio-ctl.active {
    background: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
}

/* Studio Filters & Search */
.studio-filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding-bottom: 4px;
}

.btn-studio-filter {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-studio-filter:hover, .btn-studio-filter.active {
    background: var(--primary);
    color: #FFFFFF;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25);
}

/* Soundboard Grid (28 Letters) */
.soundboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
    gap: 16px;
}

@media (max-width: 768px) {
    .soundboard-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
}

.letter-audio-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.25s ease, border-color 0.2s ease;
    cursor: pointer;
    overflow: hidden;
}

.letter-audio-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.letter-audio-card.is-active-letter {
    border-color: var(--primary);
    background: linear-gradient(to bottom, var(--bg-card), var(--primary-light));
    box-shadow: 0 0 0 3px var(--primary-light);
}

.letter-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.letter-card-badge {
    font-size: 11px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-card-subtle);
    color: var(--text-muted);
}

.letter-card-body {
    display: flex;
    align-items: center;
    gap: 14px;
}

.letter-card-glyph {
    font-size: 42px;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
    min-width: 52px;
    text-align: center;
}

.letter-card-meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.letter-card-name {
    font-size: 16px;
    font-weight: 900;
    color: var(--text-primary);
}

.letter-card-makhraj {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Master Play Button */
.btn-card-play-master {
    width: 100%;
    background: var(--primary-light);
    color: var(--primary-dark);
    border: 1.5px solid transparent;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-card-play-master:hover {
    background: var(--primary);
    color: #FFFFFF;
}

/* Vowel Chips Row (ـَ ، ـُ ، ـِ) */
.card-vowels-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.btn-vowel-chip {
    border: 1px solid var(--border-color);
    background: var(--bg-card-subtle);
    border-radius: 8px;
    padding: 5px 2px;
    font-size: 15px;
    font-weight: 900;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.btn-vowel-chip .vowel-label {
    font-size: 9.5px;
    font-weight: 700;
    color: var(--text-muted);
}

.btn-vowel-chip.fatha {
    color: var(--fatha-color);
}
.btn-vowel-chip.fatha:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--fatha-color);
}

.btn-vowel-chip.damma {
    color: var(--damma-color);
}
.btn-vowel-chip.damma:hover {
    background: rgba(37, 99, 235, 0.15);
    border-color: var(--damma-color);
}

.btn-vowel-chip.kasra {
    color: var(--kasra-color);
}
.btn-vowel-chip.kasra:hover {
    background: rgba(5, 150, 105, 0.15);
    border-color: var(--kasra-color);
}

/* Card Footer: Memory Hook & Inspector */
.letter-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding-top: 4px;
    border-top: 1px dashed var(--border-color);
    font-size: 11.5px;
}

.btn-hook-inspect {
    background: none;
    border: none;
    color: var(--primary);
    font-weight: 800;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: inherit;
}

.btn-hook-inspect:hover {
    background: var(--primary-light);
    text-decoration: underline;
}

/* Letter Inspector Modal Full Detailed Card */
.inspector-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.08) 0%, rgba(124, 58, 237, 0.08) 100%);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 20px;
}

.inspector-big-glyph {
    font-size: 72px;
    font-weight: 900;
    color: var(--primary);
    line-height: 1;
    text-shadow: 0 4px 12px rgba(2, 132, 199, 0.2);
}

.inspector-audio-pills {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 16px 0;
}

.btn-pill-play {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 800;
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn-pill-play:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.inspector-box-section {
    background: var(--bg-card-subtle);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 12px;
}

.inspector-box-section h5 {
    margin: 0 0 6px 0;
    font-size: 14px;
    font-weight: 900;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.inspector-box-section p {
    margin: 0;
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.example-chips-list {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.example-word-pill {
    background: var(--bg-card);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 5px 14px;
    font-size: 15px;
    font-weight: 900;
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.example-word-pill:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(1.05);
}

