:root {
    --bg-color: #F8F5F0;
    /* Creamy off-white as in image */
    --card-bg: #FFFFFF;
    --primary-text: #1F4E5F;
    /* Teal/Nice Dark Green */
    --secondary-text: #6B7B8C;
    --accent-color: #D4A373;
    /* Gold-ish/Beige */
    --font-ar: 'Scheherazade New', serif;
    --font-en: 'Inter', sans-serif;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    --radius: 20px;
    --input-bg: #FFFFFF;
    --btn-bg: #FFFFFF;
    --border-color: rgba(0, 0, 0, 0.05);
    --hafiz-overlay-bg: #F8F5F0;
    --badge-bg: #FFF5F0;
    --badge-text: #D88C6C;
    --progress-bg: #ddd;
    --search-btn-bg: #1F4E5F;
    --search-btn-text: #FFFFFF;
    --switcher-bg: rgba(255, 255, 255, 0.5);
    --switcher-text-inactive: #6B7B8C;
    --btn-text-color: #FFFFFF;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --primary-text: #f0f0f0;
    --secondary-text: #b0b0b0;
    --accent-color: #D4A373;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --input-bg: #2d2d2d;
    --btn-bg: #2d2d2d;
    --border-color: rgba(255, 255, 255, 0.15);
    --hafiz-overlay-bg: #121212;
    --badge-bg: #332b26;
    --badge-text: #e6b17e;
    --progress-bg: #333;
    --search-btn-bg: #D4A373;
    --search-btn-text: #121212;
    --switcher-bg: rgba(45, 45, 45, 0.6);
    --switcher-text-inactive: #888;
    --btn-text-color: #121212;
}

html {
    color-scheme: light dark;
}

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

body {
    background-color: var(--bg-color);
    font-family: var(--font-en);
    direction: ltr;
    text-align: left;
    color: var(--primary-text);
    display: flex;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

body.ltr-mode,
html[dir="ltr"] body {
    direction: ltr;
    text-align: left;
    font-family: var(--font-en);
}

body.rtl-mode,
html[dir="rtl"] body {
    direction: rtl;
    text-align: right;
    font-family: var(--font-ar), var(--font-en);
}

.container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Search */
/* Language Switcher */
.lang-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 5px;
    background: var(--switcher-bg);
    padding: 5px;
    border-radius: 30px;
    backdrop-filter: blur(5px);
    z-index: 3000;
    border: 1px solid var(--border-color);
}

.lang-btn {
    border: none;
    background: transparent;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--switcher-text-inactive);
    transition: all 0.2s;
}

.lang-btn:hover {
    color: var(--primary-text);
}

.lang-btn.active {
    background: var(--primary-text);
    color: var(--bg-color);
}

.theme-btn {
    background: transparent;
    border: none;
    color: var(--secondary-text);
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    padding: 5px;
    border-radius: 50%;
    transition: color 0.3s;
}

.theme-btn:hover {
    color: var(--primary-text);
}

.divider {
    width: 1px;
    background-color: var(--secondary-text);
    opacity: 0.3;
    margin: 0 5px;
}

/* LTR Support */
body.ltr-mode {
    direction: ltr;
    text-align: left;
}

body.ltr-mode #searchInput {
    direction: ltr;
    text-align: left;
    padding-left: 4.2rem;
    padding-right: 4.2rem;
}

body.ltr-mode #searchBtn {
    left: auto;
    right: 10px;
}

body.ltr-mode #micBtn {
    left: 12px;
    right: auto;
}

body.ltr-mode .back-btn {
    flex-direction: row;
}

body.ltr-mode .hafiz-setup #hafizSurahSelect,
body.ltr-mode .hafiz-setup #hafizAyahInput {
    direction: ltr;
    text-align: left;
}

body.ltr-mode .tafsir-selector {
    justify-content: flex-start;
    direction: ltr;
}

/* Flip directional icons in LTR */
body.ltr-mode .nav-round-btn ion-icon,
body.ltr-mode .skip-word-btn ion-icon {
    transform: scaleX(-1);
}

/* Keep Quran Content RTL regardless of UI Language */
.ayah-text-ar,
.tafsir-text,
.quran-text,
.hafiz-feedback-area {
    direction: rtl !important;
    text-align: right !important;
}

.search-container {
    text-align: center;
    margin-top: 15vh;
    transition: all 0.5s ease;
    width: 100%;
}

.search-container.compact {
    margin-top: 0;
    margin-bottom: 2rem;
    display: none;
    /* Hide when viewing */
}

.app-title {
    font-family: var(--font-ar);
    font-size: 3rem;
    margin-bottom: 1.5rem;
    color: var(--primary-text);
}

.search-box {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

#searchInput {
    width: 100%;
    padding: 1.2rem 4rem 1.2rem 4rem;
    /* Padding for both icons */
    border: 2px solid transparent;
    border-radius: 50px;
    font-size: 1.1rem;
    background: var(--input-bg);
    color: var(--primary-text);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
    font-family: 'Amiri', var(--font-en);
    /* Support Arabic in input */
    direction: rtl;
    text-align: right;
}

#searchInput:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 4px 25px rgba(212, 163, 115, 0.25);
}

#micBtn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--accent-color);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#micBtn:hover {
    color: var(--primary-text);
    background: var(--border-color);
    transform: translateY(-50%) scale(1.1);
}

#searchBtn {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--search-btn-bg);
    border: none;
    color: var(--search-btn-text);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

#searchBtn:hover {
    filter: brightness(1.1);
    transform: translateY(-50%) scale(1.05);
}

#micBtn.listening {
    color: #e74c3c;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4);
        transform: translateY(-50%) scale(1);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(231, 76, 60, 0);
        transform: translateY(-50%) scale(1.05);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(231, 76, 60, 0);
        transform: translateY(-50%) scale(1);
    }
}

.search-hint {
    margin-top: 1rem;
    color: var(--secondary-text);
    font-size: 0.9rem;
}

/* Viewer Container */
.viewer-container {
    width: 100%;
    animation: fadeIn 0.6s ease-out;
}

.hidden {
    display: none !important;
}

.back-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--secondary-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.back-btn:hover {
    color: var(--primary-text);
}

/* Headers */
.surah-header {
    text-align: center;
    margin-bottom: 2rem;
}

.surah-name-ar {
    font-family: var(--font-ar);
    font-size: 3rem;
    /* 48px equivalent */
    color: var(--primary-text);
    margin-bottom: 0.2rem;
}

.surah-name-en {
    font-weight: 300;
    color: var(--secondary-text);
    font-size: 1.2rem;
}

/* Nav */
.ayah-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.nav-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--btn-bg);
    border: 1px solid var(--border-color);
    /* very subtle */
    color: var(--primary-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.nav-btn:hover:not(:disabled) {
    background: var(--bg-color);
    transform: scale(1.05);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ayah-badge {
    background: var(--badge-bg);
    /* Light accent bg */
    padding: 0.5rem 1.5rem;
    border-radius: 12px;
    color: var(--badge-text);
    /* Earthy orange */
    font-weight: 600;
    font-size: 1rem;
}

/* Card */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 3rem;
    box-shadow: var(--shadow);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.ayah-text-ar {
    font-family: var(--font-ar);
    font-size: 3.5rem;
    /* Slightly smaller to fit better */
    line-height: 2.2;
    /* Increased to prevents cuts */
    color: var(--primary-text);
    margin-bottom: 2rem;
    direction: rtl;

    /* Text Wrapping Protection */
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;

    /* Prevent clipping */
    padding: 10px;
}

.basmala {
    font-size: 2.2rem;
    /* Adjusted */
    color: var(--accent-color);
    margin-bottom: 1rem;
    font-family: 'Amiri', serif;
    width: 100%;
    text-align: center;
    line-height: 1.6;
}

.ayah-content {
    display: inline;
    line-height: 2.2;
}

.ayah-translation {
    font-size: 1.15rem;
    color: var(--secondary-text);
    font-style: italic;
    line-height: 1.6;
    margin-bottom: 2.5rem;
}

.tafsir-section {
    text-align: right;
    direction: rtl;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-bottom: 2rem;
}

.tafsir-title {
    font-family: 'Amiri', serif;
    color: var(--primary-text);
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.tafsir-text {
    font-family: 'Amiri', serif;
    font-size: 1rem;
    color: var(--secondary-text);
    line-height: 1.8;
}

.hafiz-status {
    margin: 1rem 0;
    font-size: 1.2rem;
    color: var(--secondary-text);
    min-height: 1.5rem;
    direction: rtl;
    /* Ensure ellipsis ... appears on left */
}

/* Audio Player */
.audio-player {
    display: flex;
    align-items: center;
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 15px;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.play-btn {
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--secondary-text);
}

.progress-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.time-display {
    font-size: 0.8rem;
    color: #888;
    font-variant-numeric: tabular-nums;
}

.progress-bar-bg {
    flex: 1;
    height: 4px;
    background: var(--progress-bg);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
    /* Increase hit area */
    box-sizing: content-box;
    /* Fix for collapsed height */
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
    background-clip: padding-box;
}

.progress-bar-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0%;
    background: var(--primary-text);
    border-radius: 2px;
    transition: width 0.1s linear;
    pointer-events: none;
    /* Let clicks pass to bg */
}

/* Volume */
.volume-container {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-left: 10px;
}

.volume-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--secondary-text);
    font-size: 1.2rem;
    display: flex;
    align-items: center;
}

.volume-slider {
    width: 60px;
    cursor: pointer;
    accent-color: var(--primary-text);
}

/* Toggle expansion */
.expansion-controls {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toggle-expansion-btn {
    width: 100%;
    background: var(--bg-color);
    color: var(--primary-text);
    border: none;
    padding: 0.8rem;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background 0.2s;
}

.toggle-expansion-btn:hover {
    filter: brightness(0.95);
}

.tafsir-selector {
    display: flex;
    justify-content: flex-start;
    direction: rtl;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--secondary-text);
}

#tafsirSelect {
    padding: 5px 10px;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    font-family: var(--font-en);
    background: var(--input-bg);
    color: var(--primary-text);
}

/* Hafiz Setup Inputs */
#hafizSurahSelect,
#hafizAyahInput {
    background: var(--card-bg);
    color: var(--primary-text);
    border: 1px solid var(--border-color);
}

/* Ensure options are readable */
select option {
    background: var(--bg-color);
    color: var(--primary-text);
}

.full-explanation {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-color);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    line-height: 1.8;
    position: relative;
    /* For button positioning */
}

.explanation-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.5rem;
    gap: 10px;
    align-items: center;
}

.voice-select {
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    font-family: var(--font-en);
    background: var(--input-bg);
    color: var(--primary-text);
    outline: none;
    cursor: pointer;
    font-size: 0.85rem;
    direction: rtl; /* Default Arabic RTL */
    transition: border-color 0.2s, background 0.2s;
}

.voice-select:hover {
    border-color: var(--primary-color);
}

body.ltr-mode .voice-select {
    direction: ltr; /* English LTR */
}

#playExplanationBtn {
    background: transparent;
    color: var(--primary-text);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

#playExplanationBtn:hover {
    background: var(--border-color);
}

#playExplanationBtn.loading {
    opacity: 0.7;
    cursor: default;
    pointer-events: none;
}

#playExplanationBtn.loading ion-icon {
    display: none;
}

#playExplanationBtn.loading::before {
    content: "";
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--primary-text);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    display: inline-block;
}

#playExplanationBtn.playing {
    color: var(--accent-color);
    border-color: var(--accent-color);
    background: rgba(212, 163, 115, 0.1);
}

.full-explanation p {
    margin: 0;
    text-align: justify;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--secondary-text);
    direction: rtl;
    text-align: right;
    font-family: var(--font-ar);
}

.footer-note {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.8rem;
    color: #ccc;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-text);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Blind Mode Switch */
.hafiz-option-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 1rem 0;
    font-size: 0.95rem;
    color: var(--secondary-text);
}

.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

[data-theme="dark"] .slider {
    background-color: #555;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #4CAF50;
    /* Vibrant Green */
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--primary-gold);
}

input:checked+.slider:before {
    transform: translateX(22px);
}

.hidden-word {
    color: transparent !important;
    background: rgba(0, 0, 0, 0.06) !important;
    border-radius: 6px;
    filter: none;
    transition: background 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* Memorizer Styles */
/* Memorizer Styles */
.hafiz-btn {
    background: var(--card-bg);
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    padding: 0.8rem 2.5rem;
    border-radius: 50px;
    font-family: 'Amiri', serif;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.hafiz-btn:hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(212, 163, 115, 0.3);
}

.hafiz-btn ion-icon {
    font-size: 1.4rem;
}

#hafiz-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--hafiz-overlay-bg);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    font-family: var(--font-ar);
    overflow-y: auto;
}

.hafiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-top: 40px;
    /* Space for language switcher */
}

.hafiz-setup {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
}

#hafizSurahSelect,
#hafizAyahInput {
    padding: 1rem;
    font-size: 1.2rem;
    width: 100%;
    max-width: 400px;
    border-radius: 10px;
    border: 1px solid #ccc;
    font-family: 'Amiri', serif;
    text-align: right;
    direction: rtl;
}

.primary-btn {
    background: var(--primary-text);
    color: var(--btn-text-color);
    border: none;
    padding: 1rem 3rem;
    border-radius: 50px;
    font-size: 1.3rem;
    cursor: pointer;
    margin-top: 1rem;
}

.hafiz-session {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.hafiz-info {
    margin-top: 1rem;
    font-size: 1.5rem;
    color: var(--primary-text);
    font-family: var(--font-ar);
}

.hafiz-nav-row {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 0.5rem;
}

.nav-round-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: white;
    border: 1px solid #ddd;
    color: var(--secondary-text);
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.nav-round-btn:hover {
    background: #f0f0f0;
    color: var(--primary-text);
}

.big-mic-btn {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--accent-color);
    color: var(--accent-color);
    font-size: 3rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.big-mic-btn.active {
    background: #e74c3c;
    color: white;
    border-color: #c0392b;
    animation: pulse 1.5s infinite;
}

.hafiz-feedback-area {
    width: 100%;
    min-height: 200px;
    max-height: 50vh;
    overflow-y: auto;
    text-align: center;
    padding: 2rem;
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow);
    direction: rtl;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) #f0f0f0;
}

.quran-text {
    line-height: 2.6;
    width: 100%;
}

.quran-text span {
    font-size: 2.5rem;
    margin: 0 5px;
    display: inline-block;
    /* Better flow */
    font-family: var(--font-ar);
    transition: color 0.3s, opacity 0.3s;
}

.word-correct {
    color: #27ae60;
    opacity: 1;
}

.word-pending {
    color: #ccc;
}


/* Blurry hint */

.hafiz-options {
    margin-top: auto;
    font-size: 1.1rem;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    animation: fadeIn 0.3s;
}

.modal-content {
    background: white;
    padding: 2rem;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    font-family: var(--font-ar);
    animation: scaleIn 0.3s;
    direction: rtl;
    background: var(--card-bg);
}

.modal-icon {
    font-size: 4rem;
    color: #27ae60;
    margin-bottom: 1rem;
}

.modal-content h2 {
    color: var(--primary-text);
    margin-bottom: 0.5rem;
    font-size: 2rem;
}

.modal-content p {
    color: var(--secondary-text);
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Memorization Trigger */
.memorize-action {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.memorize-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-gold);
    color: var(--dark-bg);
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.memorize-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 175, 55, 0.5);
    background: #e5c150;
}

.memorize-btn ion-icon {
    font-size: 1.5rem;
}

/* Skip Word Button */
.skip-word-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #aeaeae;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    margin: 10px auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.skip-word-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--primary-gold);
    border-color: var(--primary-gold);
}

.skip-word-btn ion-icon {
    font-size: 1.1rem;
}

/* PWA Update Toast */
.update-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    color: var(--primary-text);
    padding: 12px 20px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: 10000;
    font-family: var(--font-ar);
    animation: fadeIn 0.3s ease;
    direction: rtl; /* Default Arabic RTL */
}

.update-toast.hidden {
    display: none !important;
}

.update-toast span {
    font-size: 0.95rem;
    font-weight: 500;
}

body.ltr-mode .update-toast {
    direction: ltr;
    font-family: var(--font-en);
}

/* App Version Badge */
.app-version {
    display: inline-block;
    margin-left: 8px;
    margin-right: 8px;
    font-size: 0.75rem;
    background: var(--input-bg);
    color: var(--secondary-text);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    vertical-align: middle;
}

/* PWA Install Banner */
.pwa-install-banner {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    color: var(--primary-text);
    padding: 14px 20px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    z-index: 9999;
    max-width: 92vw;
    width: 420px;
    animation: fadeIn 0.3s ease;
    direction: rtl;
}

.pwa-install-banner.hidden {
    display: none !important;
}

.pwa-install-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pwa-install-info ion-icon {
    font-size: 2rem;
    color: var(--emerald, #4eba88);
    flex-shrink: 0;
}

.pwa-install-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.pwa-install-text strong {
    font-size: 0.95rem;
    color: var(--primary-text);
}

.pwa-install-text span {
    font-size: 0.78rem;
    color: var(--secondary-text);
}

.pwa-install-btns {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.pwa-install-btns .primary-btn {
    padding: 6px 14px;
    font-size: 0.85rem;
    border-radius: 12px;
    cursor: pointer;
}

.dismiss-btn {
    background: transparent;
    border: none;
    color: var(--secondary-text);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color 0.2s ease;
}

.dismiss-btn:hover {
    color: var(--primary-text);
}

body.ltr-mode .pwa-install-banner {
    direction: ltr;
}

/* Header Install Button */
.install-pwa-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(78, 186, 136, 0.2), rgba(78, 186, 136, 0.05));
    border: 1px solid rgba(78, 186, 136, 0.4);
    color: var(--primary-text);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.install-pwa-btn:hover {
    background: rgba(78, 186, 136, 0.3);
    border-color: rgba(78, 186, 136, 0.7);
    transform: translateY(-1px);
}

.install-pwa-btn ion-icon {
    font-size: 1rem;
    color: #4eba88;
}

.install-pwa-btn.hidden {
    display: none !important;
}