.embed-only-back-button {
    position: fixed;
    top: 12px;
    left: 14px;
    z-index: 10000;
    min-width: 76px;
    height: 40px;
    padding: 0 16px;
    border: 0;
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.86);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.22);
}
.embed-only-back-button:hover { background: #2563eb; }


#backBtn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.6) !important;
}

#backBtn:active {
    transform: scale(0.95);
}

.manual-youtube-trigger {
    
    width: 200px !important;
    height: 150px !important;
    min-width: 200px !important;
    max-width: 200px !important;
    min-height: 150px !important;
    max-height: 150px !important;

    position: absolute !important;
    top: calc(50% + 50px) !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;

    border: none !important;
    background: transparent !important;

    z-index: 99999 !important;

    display: block !important;
    pointer-events: auto !important;

    resize: none !important;

    clip-path: circle(25px at center) !important;

    box-sizing: border-box !important;
    padding: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-bottom: 0 !important;
}

.manual-youtube-video {
    object-fit: cover !important;
}

#loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #ffffff; 
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999; 
}

.loader {
    width: 50px;
    height: 50px;
    border: 5px solid #f3f3f3; 
    border-top: 5px solid #3498db; 
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.fade-out {
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

:root { 
    --main-color: #1f2937; 
    --accent-color: #1d4ed8; 
    --sub-color: #15803d; 
    --bg-color: #eef2ff; 
    --surface-color: #ffffff; 
    --story-color: #6d28d9; 
    --word-color: #c2410c; 
    --text-color: #111827; 
    --muted-color: #475569; 
    --border-color: #d1d5db; 
    --text-red: #b91c1c; 
    --section-gap: 40px; 
}

body { 
    direction: rtl; 
    font-family: 'Outfit', 'Segoe UI', Tahoma, sans-serif; 
    background: var(--bg-color); 
    padding: 0; margin: 0; color: var(--text-color);
}

/* Reserve homepage gate height so seo-hero below does not jump (CLS) */
#main-content:has(> .edu-level-gate-shell--skeleton),
#main-content:has(> .edu-level-gate-shell) {
    min-height: min(72vh, 780px);
    width: 100%;
}
#quick-access-section.is-home-hidden {
    display: none !important;
}

/* Reserve media space before third-party content is ready. */
.video-embed-block {
    width: 100%;
    min-height: 315px;
    contain: layout paint;
}

.video-embed-block iframe {
    display: block;
    width: 100%;
    height: 315px;
    aspect-ratio: 16 / 9;
    border: 0;
}

.yt-gesture-ifr {
    width: 1px !important;
    height: 1px !important;
    min-width: 1px !important;
    min-height: 1px !important;
}

.skip-link {
    position: absolute;
    top: 0;
    left: 0;
    transform: translateY(-100%);
    background: var(--main-color);
    color: #ffffff;
    padding: 10px 16px;
    z-index: 10000;
    text-decoration: none;
    font-weight: 700;
}

.skip-link:focus {
    transform: translateY(0);
    outline: 3px solid #fde047;
    outline-offset: 4px;
}

button:focus, input:focus, textarea:focus, select:focus {
    outline: 3px solid #facc15;
    outline-offset: 2px;
}

button, input, textarea, select {
    font: inherit;
}

input, textarea, select {
    background: var(--surface-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

input::placeholder,
textarea::placeholder {
    color: #64748b;
    opacity: 1;
}

.auto-box,
.converter-container,
.modal-box,
.card,
#main-content {
    background: var(--surface-color);
}

.auto-box {
    border: 1px solid var(--border-color) !important;
}

.auto-box .multi-box-title,
.auto-box label,
.auto-box span,
.auto-box p,
.auto-box div,
.auto-box small {
    color: var(--text-color) !important;
}

.auto-box .hint-text,
.auto-box .description-text {
    color: var(--muted-color) !important;
}

img, video, iframe { 
    max-width: 100%; 
    height: auto; 
    display: block;
    contain: layout;
}

img[width][height] {
    width: auto;
    max-width: 100%;
}

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
}

.container,
#main-content,
.story-content-view,
.word-card-content-view,
.content-zoom-shell,
.content-zoom-viewport,
.content-zoom-layer,
.converter-container,
.nav-bar,
.app-header,
#quick-access-section {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.quick-access-row,
.nav-buttons-container,
.page-jump-controls {
    min-width: 0;
    box-sizing: border-box;
}

.quick-access-row {
    width: 100%;
}

.nav-buttons-container {
    justify-content: center !important;
}

.page-jump-controls {
    justify-content: center;
    max-width: 100%;
}

.section-resizer {
    display: none;
}

.section-resizer::after {
    content: "↕ شد لتكبير المسافة";
    position: absolute; left: 50%; top: 50%;
    transform: translate(-50%, -50%); font-size: 10px; color: #aaa; pointer-events: none;
}

.app-header { background: transparent; padding: 2px 6px; box-shadow: none; position: sticky; top: 0; z-index: 100; margin-bottom: 0; }
.app-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.home-page-btn {
    flex: 0 0 auto;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 5px 9px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.home-page-btn:hover { background: #dbeafe; }
#status {
    display: flex;
    width: auto;
    margin: 2px auto 0;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 4px 8px;
    padding: 1px 6px;
    min-width: 0;
    text-align: center;
    font-size: 0.55rem;
    color: #34495e;
    background: rgba(52, 152, 219, 0.08);
    border-radius: 999px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.nav-bar { display: flex; align-items: center; gap: 6px; max-width: 1150px; margin: 0 auto; }
.back-btn { background: #2c3e50; color: white; border: none; padding: 10px 14px; border-radius: 12px; cursor: pointer; font-weight: bold; display: inline-flex; align-items: center; gap: 6px; transition: 0.2s; }
.back-btn:hover { opacity: 0.92; transform: translateY(-1px); }

.back-quality {
    display: inline-flex;
    flex: 0 0 auto; 
    align-items: center;
    gap: 6px;
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: none;
    box-shadow: none;
    white-space: nowrap; 
    width: auto; 
}
.back-quality .back-btn { display: inline-flex; padding: 0; background: transparent; border: none; font-weight: bold; color: var(--main-color); }

.login-wrap {
    display: inline-flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    padding: 0;
    background: transparent;
    border-radius: 0;
    border: none;
    box-shadow: none;
    width: auto; 
    flex: 0 0 auto;
}
.login-wrap .btn-admin-access { padding: 0; margin: 0; background: transparent; color: var(--main-color); border: none; display: inline-flex; }

h1 { 
    display: flex !important;
    text-align: center; color: var(--main-color); margin: 0 auto; 
    font-size: clamp(1rem, 2.1vw, 1.4rem); flex-grow: 1; position: relative; cursor: move;       
    resize: both; overflow: auto; align-items: center; justify-content: center;
    min-width: 100px; min-height: 0; border: none; white-space: pre-wrap; 
    padding: 0;
}

h1:hover { border-color: transparent; }

.admin-login-trigger {
    position: relative;
    display: inline-block;
    cursor: pointer;
    color: inherit;
    text-decoration: none;
}

.admin-login-trigger .admin-login-icon {
    position: absolute;
    inset: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85em;
    opacity: 0;
    pointer-events: none;
}

.admin-login-trigger:hover {
    text-decoration: none;
}

#main-content { display: flex; flex-direction: column; flex-wrap: nowrap; gap: 0 !important; justify-content: flex-start; align-items: stretch; margin-top: 0 !important; padding-top: 0 !important; }
#main-content.main-list { justify-content: center; align-items: center; min-height: min(72vh, 780px); }
#main-content.main-list > .card { width: 100%; max-width: 760px; margin-left: auto; margin-right: auto; }
#main-content h2, .section-title {
    width: 100%;
    text-align: center;
    margin-top: 0 !important;
    margin-bottom: 10px !important;
    font-size: 2rem !important;
    line-height: 1.2 !important;
    letter-spacing: 0.02em !important;
    color: var(--main-color);
    font-weight: 800;
    text-shadow: 0 1px 0 rgba(255,255,255,0.55);
    padding: 6px 12px !important;
}

#main-content > .story-content-view,
#main-content > .word-card-content-view {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

.story-content-view .content-fixed-ui,
.word-card-content-view .content-fixed-ui {
    margin: 0 !important;
    padding: 0 !important;
}

.story-content-view .display-controls,
.word-card-content-view .display-controls {
    margin: 0 !important;
    padding: 6px 8px !important;
}

#quick-access-section,
.converter-container {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

.container { max-width: 800px; margin: 0 auto; padding: 0 15px; min-height: auto; }
button { cursor: pointer; border-radius: 8px; border: none; font-weight: 600; transition: 0.2s; display: inline-flex; align-items: center; gap: 6px; user-select: none; }
button:hover { opacity: 0.9; transform: translateY(-1px); }
button:active { transform: scale(0.98); }

.btn-main-add { background: var(--main-color); color: white; padding: 12px 25px; width: 100%; justify-content: center; margin-bottom: 20px; }
.btn-del { background: #fdfdfd; color: #888; border: 1px solid #ddd; font-size: 11px; padding: 0; margin: 2px; width: 30px; height: 30px; min-width: 30px; min-height: 30px; flex: 0 0 30px; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.btn-admin-access { background: #34495e; color: white; padding: 2px 6px; font-size: 0.28rem; line-height: 1; }

.converter-container { background: white; padding: 20px; border-radius: 15px; box-shadow: 0 2px 5px rgba(0,0,0,0.05); margin-bottom: 0 !important; border: 1px solid #eee; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #333; color: white; padding: 10px 20px; border-radius: 30px; z-index: 3000; display: none; font-size: 0.9rem; }
.loading-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(255,255,255,0.8); display: none; justify-content: center; align-items: center; z-index: 2500; }

.spinner { width: 40px; height: 40px; border: 4px solid #f3f3f3; border-top: 4px solid var(--main-color); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.confirm-modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); display: none; justify-content: center; align-items: center; z-index: 3000; }
.confirm-box { background: white; padding: 25px; border-radius: 15px; width: 90%; max-width: 350px; text-align: center; }
.confirm-btns { display: flex; gap: 10px; justify-content: center; margin-top: 20px; }
.btn-yes { background: var(--text-red); color: white; padding: 8px 20px; }
.btn-no { background: #ccc; color: #333; padding: 8px 20px; }
.empty-state { text-align: center; padding: 50px 20px; color: #888; font-weight: bold; }

.card { 
    background: #ffffff; border-radius: 8px; padding: 12px; box-shadow: none; 
    border: 4px solid var(--main-color); display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: move; box-sizing: border-box; position: relative; overflow: hidden; 
    resize: both; width: auto; min-width: 100px; min-height: 100px; height: 100px; margin: 8px; 
    aspect-ratio: 1 / 1; contain: layout;
}
body.viewer-mode .card,
body.viewer-mode .card-title,
body.viewer-mode .wordIcon {
    resize: none !important;
}

body.viewer-mode .card {
    cursor: pointer;
}

body.viewer-mode .card-title,
body.viewer-mode .wordIcon {
    cursor: pointer;
}
.card.main-section-card {
    overflow: visible;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    width: 100% !important;
    max-width: 820px !important;
    min-width: 0 !important;
    margin-bottom: var(--section-gap);
    aspect-ratio: 4 / 3 !important;
    resize: none !important;
}

/* Adventure Islands cards for the Kids Arabic level. */
.kids-adventure-card {
    width: 100% !important;
    max-width: 680px !important;
    min-height: 100px !important;
    height: 100px !important;
    max-height: 100px !important;
    aspect-ratio: auto !important;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 20px !important;
    margin: 0 auto 38px !important;
    border: 4px solid #fff !important;
    border-radius: 35px !important;
    cursor: pointer;
    overflow: visible !important;
    transition: transform .2s cubic-bezier(.175,.885,.32,1.275), box-shadow .2s ease;
}
.kids-adventure-card:hover { transform: translateY(-6px) scale(1.01); }
.kids-adventure-card.theme-family { background: linear-gradient(135deg,#fff0f3,#ffe3e8) !important; border-color: #ff4d6d !important; box-shadow: 0 10px 0 #c9184a,0 15px 25px rgba(201,24,74,.2) !important; }
.kids-adventure-card.theme-places { background: linear-gradient(135deg,#e0f2fe,#bae6fd) !important; border-color: #0284c7 !important; box-shadow: 0 10px 0 #0369a1,0 15px 25px rgba(3,105,161,.2) !important; }
.kids-adventure-card.theme-animals { background: linear-gradient(135deg,#fef3c7,#fde68a) !important; border-color: #f59e0b !important; box-shadow: 0 10px 0 #b45309,0 15px 25px rgba(180,83,9,.2) !important; }
.kids-adventure-card.theme-colors { background: linear-gradient(135deg,#f3e8ff,#e9d5ff) !important; border-color: #9333ea !important; box-shadow: 0 10px 0 #6b21a8,0 15px 25px rgba(107,33,168,.2) !important; }
.kids-adventure-card.theme-verbs { background: linear-gradient(135deg,#dcfce7,#bbf7d0) !important; border-color: #10b981 !important; box-shadow: 0 10px 0 #047857,0 15px 25px rgba(4,120,87,.2) !important; }
.kids-adventure-left { display:flex;align-items:center;gap:16px;min-width:0; }
.kids-adventure-lesson-badge { position:relative;width:94px;height:62px;border-radius:20px;display:flex;align-items:center;justify-content:center;flex-shrink:0;background:linear-gradient(145deg,#ffffff 0%,#ecfdf5 100%);color:#064e3b;border:3px solid #059669;box-shadow:0 5px 0 #047857,0 8px 14px rgba(4,120,87,.22),inset 0 1px 0 #fff;font-family:'Poppins','Cairo',sans-serif;font-size:15px;font-weight:900;letter-spacing:.01em;line-height:1.05;text-align:center;text-shadow:0 1px 0 #fff; }
.kids-adventure-meta { display:flex;flex-direction:column;min-width:0; }
.kids-adventure-title { font-family:'Poppins','Cairo',sans-serif;font-size:21px;font-weight:700;color:#0f172a;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
.kids-adventure-go { display:none; }
/* Kids word icons: one shared green capsule design. */
.kids-adventure-card {
    width: calc(50% - 6px) !important;
    max-width: none !important;
    min-width: 280px !important;
    height: 90px !important;
    min-height: 90px !important;
    max-height: 90px !important;
    margin: 0 !important;
    padding: 10px 14px !important;
    border: 2px solid #10b981 !important;
    border-radius: 50px !important;
    background: linear-gradient(135deg, #34d399, #059669) !important;
    box-shadow: 0 8px 0 #047857, 0 12px 20px rgba(4, 120, 87, .2) !important;
}
.kids-adventure-card .kids-adventure-lesson-badge {
    width: 94px;
    height: 62px;
    border: 3px solid #059669;
    color: #064e3b;
}
.kids-adventure-card .kids-adventure-title {
    color: #064e3b;
    font-family: 'Poppins', 'Cairo', sans-serif;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
    text-shadow: 0 1px 0 rgba(255,255,255,.55);
}
.kids-adventure-card .kids-adventure-go { display: none; }
.kids-adventure-card .kids-adventure-left { width: 100%; }
#main-content:has(.kids-adventure-card) { gap: 58px !important; align-items: center; }
@media (max-width:560px) {
    .kids-adventure-card { width:100% !important;min-width:0 !important;min-height:82px !important;height:82px !important;max-height:82px !important;padding:8px 12px !important;margin-bottom:18px !important;border-width:2px !important;border-radius:42px !important;gap:8px; }
    .kids-adventure-left { gap:9px; }
    .kids-adventure-lesson-badge { width:78px;height:52px;font-size:13px;border-width:2px;border-radius:16px;box-shadow:0 4px 0 #047857,0 6px 10px rgba(4,120,87,.18); }
    .kids-adventure-title { font-size:17px;white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere;word-break:break-word;line-height:1.25; }
}

#main-content.main-list > .card.main-section-card,
.main-section-card .card-title {
    resize: none !important;
}

.card-image-area { width: 100%; flex: 1; min-height: 0; max-height: 100%; background-size: contain; background-repeat: no-repeat; background-position: center; background-color: #ffffff; flex-shrink: 0; contain: layout; }
.card-footer { background: #ffffff; flex-shrink: 0; display: flex; align-items: center; justify-content: center; padding: 10px; height: 50px; border-top: 1px solid #eee; overflow: hidden; }

.card-title {
    font-size: 0.9rem; font-weight: 900; color: #1f2937; text-align: center; width: 100%; cursor: move;
    resize: both; overflow: auto; white-space: normal; display: flex; align-items: center; justify-content: center;
    gap: 6px; min-height: 20px; line-height: 1.3; word-break: break-word; overflow-wrap: anywhere; padding: 0;
}
.main-section-card .card-title {
    position: absolute;
    top: 8px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    z-index: 20;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: auto;
    width: auto;
    max-width: 100%;
    padding: 10px 16px;
    border-radius: 6px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 900;
    line-height: 1.25;
    letter-spacing: 0.02em;
    border: 3px solid #1d4ed8;
    word-break: break-word;
    overflow-wrap: anywhere;
    white-space: normal;
    text-shadow: none;
    margin: 2px auto 0;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    resize: none !important;
}
.main-section-card .main-section-admin-tools {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 30;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    max-width: calc(100% - 16px);
    padding: 2px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
}
.card-subtitle {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; margin: 6px auto 0; padding: 6px 12px;
    border-radius: 4px; background: #10b981; color: #ffffff; font-size: 0.8rem;
    font-weight: 900; line-height: 1.2; max-width: fit-content; box-shadow: 0 3px 8px rgba(16, 185, 129, 0.3); white-space: nowrap; border: 2px solid #059669;
}
.card:active { z-index: 999; }
.card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.card.sub-card { border-right-color: var(--sub-color); }
.card.story-card { border-right-color: var(--story-color); }
.card.word-card { border-right-color: var(--word-color); background: #fffaf5; } 

#main-content.arabic-grammar-level > .card.word-card,
#main-content.arabic-grammar-level > .card.sub-card {
    width: 100% !important;
    max-width: 980px !important;
    min-width: 0 !important;
    min-height: 110px !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 auto 20px !important;
    padding: 22px 35px !important;
    aspect-ratio: auto !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 20px;
    position: relative;
    overflow: hidden !important;
    cursor: pointer;
    background: linear-gradient(135deg, rgba(25, 28, 36, .98), rgba(15, 17, 21, .99)) !important;
    border: 1px solid rgba(212, 175, 55, .4) !important;
    border-radius: 18px !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, .12), inset 0 1px 0 rgba(255, 255, 255, .1) !important;
    transition: all .4s cubic-bezier(.16, 1, .3, 1);
}

#main-content.arabic-grammar-level > .card.word-card::before,
#main-content.arabic-grammar-level > .card.sub-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(212, 175, 55, .2), transparent);
    transition: .6s;
    pointer-events: none;
}

#main-content.arabic-grammar-level > .card.word-card:hover::before,
#main-content.arabic-grammar-level > .card.sub-card:hover::before { left: 100%; }

#main-content.arabic-grammar-level > .card.word-card:hover,
#main-content.arabic-grammar-level > .card.sub-card:hover {
    transform: translateY(-4px) scale(1.005);
    border-color: rgba(212, 175, 55, .9) !important;
    box-shadow: 0 16px 35px rgba(0, 0, 0, .22), 0 0 20px rgba(212, 175, 55, .2) !important;
}

#main-content.arabic-grammar-level .grammar-card-left {
    display: flex;
    align-items: center;
    gap: 22px;
    min-width: 0;
}

#main-content.arabic-grammar-level .grammar-icon-box {
    width: 54px;
    height: 54px;
    min-width: 54px;
    border-radius: 14px;
    background: linear-gradient(135deg, #2a2415, #14110b);
    border: 1px solid rgba(212, 175, 55, .5);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d4af37;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .4);
    transition: all .3s ease;
}

#main-content.arabic-grammar-level .card:hover .grammar-icon-box {
    background: linear-gradient(135deg, #d4af37, #aa7c11);
    color: #0d0f12;
    box-shadow: 0 0 20px rgba(212, 175, 55, .5);
}

#main-content.arabic-grammar-level .grammar-card-left .card-title {
    width: auto;
    min-width: 0;
    min-height: 0;
    padding: 0;
    color: #fff;
    font-family: 'Cinzel', serif;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: .5px;
    text-align: start;
    justify-content: flex-start;
    transition: color .3s ease;
}

#main-content.arabic-grammar-level .card:hover .grammar-card-left .card-title { color: #f7e08b; }

#main-content.arabic-grammar-level .grammar-start-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    padding: 10px 20px;
    border-radius: 30px;
    background: linear-gradient(135deg, rgba(212, 175, 55, .15), rgba(212, 175, 55, .05));
    border: 1px solid rgba(212, 175, 55, .6);
    color: #d4af37;
    font-family: 'Cinzel', serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
    transition: all .3s ease;
}

#main-content.arabic-grammar-level .grammar-start-btn i {
    font-size: 12px;
    transition: transform .3s ease;
}

#main-content.arabic-grammar-level .card:hover .grammar-start-btn {
    background: linear-gradient(135deg, #d4af37, #aa7c11);
    color: #0d0f12;
    border-color: #f7e08b;
    box-shadow: 0 0 15px rgba(212, 175, 55, .5);
}

#main-content.arabic-grammar-level .card:hover .grammar-start-btn i { transform: translateX(3px); }

@media (max-width: 768px) {
    #main-content.arabic-grammar-level > .card.word-card,
    #main-content.arabic-grammar-level > .card.sub-card {
        min-height: 90px !important;
        padding: 16px 18px !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 14px;
    }

    #main-content.arabic-grammar-level .grammar-start-btn {
        align-self: flex-end;
        padding: 8px 16px;
        font-size: 12px;
    }

    #main-content.arabic-grammar-level .grammar-card-left .card-title { font-size: 17px; }
    #main-content.arabic-grammar-level .grammar-icon-box {
        width: 44px;
        height: 44px;
        min-width: 44px;
        font-size: 16px;
    }
}

#main-content.tajweed-level > .card.kids-adventure-card {
    width: calc(50% - 6px) !important;
    max-width: none !important;
    min-width: 280px !important;
    min-height: 90px !important;
    height: 90px !important;
    max-height: 90px !important;
    margin: 0 !important;
    padding: 10px 14px !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    border: 2px solid #10b981 !important;
    border-radius: 50px !important;
    background: linear-gradient(135deg, #34d399, #059669) !important;
    box-shadow: 0 8px 0 #047857, 0 12px 20px rgba(4, 120, 87, .2) !important;
}

#main-content.tajweed-level > .card.kids-adventure-card:hover {
    transform: translateY(-6px) scale(1.01);
}

@media (max-width: 560px) {
    #main-content.tajweed-level > .card.kids-adventure-card {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 82px !important;
        height: 82px !important;
        max-height: 82px !important;
        padding: 8px 12px !important;
        margin-bottom: 18px !important;
        border-radius: 42px !important;
    }
}

#main-content.beginner-student-view > .sub-card:not(.pillars-sub-card):not(.prophet-sub-card):not(.quran-exam-card),
#main-content.beginner-student-view > .word-card:not(.quran-exam-card) {
    display: grid;
    grid-template-columns: 65px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 20px;
    row-gap: 6px;
    min-height: 112px;
    height: auto !important;
    width: 100%;
    max-width: 850px;
    margin: 0 auto 20px;
    padding: 24px;
    border: 2px solid #1f2937;
    border-inline-end: 5px solid #0f9f58;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 18px 40px rgba(112, 144, 176, 0.12);
    aspect-ratio: auto;
    overflow: hidden;
}
#main-content.beginner-student-view > .sub-card:not(.pillars-sub-card):not(.prophet-sub-card):not(.quran-exam-card),
#main-content.beginner-student-view > .word-card:not(.quran-exam-card) {
    width: 100% !important;
    max-width: 850px !important;
    min-width: 0 !important;
    height: 112px !important;
    min-height: 112px !important;
    max-height: 112px !important;
}
#main-content.beginner-student-view > .sub-card:not(.pillars-sub-card):not(.prophet-sub-card):not(.quran-exam-card) .card-title,
#main-content.beginner-student-view > .word-card:not(.quran-exam-card) .card-title {
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 100% !important;
    max-height: none !important;
}
#main-content.beginner-student-view > .word-card:not(.quran-exam-card) {
    border-inline-end-color: #ff6b00;
}
#main-content.beginner-no-card-resize > .sub-card:not(.pillars-sub-card):not(.prophet-sub-card):not(.quran-exam-card),
#main-content.beginner-no-card-resize > .word-card:not(.quran-exam-card),
#main-content.beginner-no-card-resize > .sub-card:not(.pillars-sub-card):not(.prophet-sub-card):not(.quran-exam-card) .card-title,
#main-content.beginner-no-card-resize > .word-card:not(.quran-exam-card) .card-title {
    resize: none !important;
}
#main-content.beginner-student-view > .sub-card:not(.pillars-sub-card):not(.prophet-sub-card):not(.quran-exam-card)::before,
#main-content.beginner-student-view > .word-card:not(.quran-exam-card)::before {
    grid-column: 1;
    grid-row: 1 / span 2;
    width: 65px;
    height: 65px;
    border-radius: 18px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}
#main-content.beginner-student-view > .sub-card:not(.pillars-sub-card):not(.prophet-sub-card):not(.quran-exam-card)::before {
    content: "💬";
    background: #fff2e8;
    color: #ff6b00;
}
#main-content.beginner-student-view > .word-card:not(.quran-exam-card)::before {
    content: "🔤";
    background: #e6f7ff;
    color: #0091ff;
}
#main-content.beginner-student-view > .sub-card:not(.pillars-sub-card):not(.prophet-sub-card):not(.quran-exam-card) .card-title,
#main-content.beginner-student-view > .word-card:not(.quran-exam-card) .card-title {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-height: 0;
    justify-content: flex-start;
    padding: 0;
    color: #2b3674;
    font-size: 20px;
    line-height: 1.4;
    text-align: start;
}
#main-content.beginner-student-view > .word-card:not(.quran-exam-card) .card-title__icon {
    display: none;
}
#main-content.beginner-student-view > .sub-card:not(.pillars-sub-card):not(.prophet-sub-card):not(.quran-exam-card) .card-subtitle,
#main-content.beginner-student-view > .word-card:not(.quran-exam-card) .card-subtitle {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
    margin: 0;
    padding: 4px 12px;
    border: 0;
    border-radius: 30px;
    background: #e9edf7;
    color: #4318ff;
    box-shadow: none;
    font-size: 13px;
}
#main-content.beginner-student-view > .sub-card:not(.pillars-sub-card):not(.prophet-sub-card):not(.quran-exam-card)::after,
#main-content.beginner-student-view > .word-card:not(.quran-exam-card)::after {
    content: "Start Lesson  ▶";
    grid-column: 3;
    grid-row: 1 / span 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 12px 22px;
    border-radius: 14px;
    background: linear-gradient(135deg, #868cff 0%, #4318ff 100%);
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 10px 20px rgba(67, 24, 255, 0.24);
    white-space: nowrap;
}
@media (max-width: 650px) {
    #main-content.beginner-student-view > .sub-card:not(.pillars-sub-card):not(.prophet-sub-card):not(.quran-exam-card),
    #main-content.beginner-student-view > .word-card:not(.quran-exam-card) {
        grid-template-columns: 65px minmax(0, 1fr);
        padding: 18px;
        height: auto !important;
        min-height: 100px !important;
        max-height: none !important;
    }
    #main-content.beginner-student-view > .sub-card:not(.pillars-sub-card):not(.prophet-sub-card):not(.quran-exam-card)::after,
    #main-content.beginner-student-view > .word-card:not(.quran-exam-card)::after {
        grid-column: 1 / span 2;
        grid-row: 3;
        width: 100%;
    }
}

#main-content.beginner-student-view > .story-card:not(.quran-exam-card) {
    display: grid;
    grid-template-columns: 65px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 20px;
    row-gap: 6px;
    min-height: 112px;
    height: 112px !important;
    width: 100%;
    max-width: 850px;
    margin: 0 auto 20px;
    padding: 24px;
    border: 2px solid #1f2937;
    border-inline-end: 5px solid #0f9f58;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 18px 40px rgba(112, 144, 176, 0.12);
    aspect-ratio: auto;
    overflow: hidden;
}
#main-content.beginner-student-view > .story-card:not(.quran-exam-card)::before {
    content: "📖";
    grid-column: 1;
    grid-row: 1 / span 2;
    width: 65px;
    height: 65px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    background: #e6f7ff;
    color: #0091ff;
}
#main-content.beginner-student-view > .story-card:not(.quran-exam-card) .card-title {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-height: 0;
    justify-content: flex-start;
    padding: 0;
    color: #2b3674;
    font-size: 20px;
    line-height: 1.4;
    text-align: start;
}
#main-content.beginner-student-view > .story-card:not(.quran-exam-card)::after {
    content: "Start Lesson  ▶";
    grid-column: 3;
    grid-row: 1 / span 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 12px 22px;
    border-radius: 14px;
    background: linear-gradient(135deg, #868cff 0%, #4318ff 100%);
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 10px 20px rgba(67, 24, 255, 0.24);
    white-space: nowrap;
}
@media (max-width: 650px) {
    #main-content.beginner-student-view > .story-card:not(.quran-exam-card) {
        grid-template-columns: 65px minmax(0, 1fr);
        padding: 18px;
        height: auto !important;
        min-height: 100px !important;
        max-height: none !important;
    }
    #main-content.beginner-student-view > .story-card:not(.quran-exam-card)::after {
        grid-column: 1 / span 2;
        grid-row: 3;
        width: 100%;
    }
}

#main-content.intermediate-student-view > .sub-card:not(.pillars-sub-card):not(.prophet-sub-card):not(.quran-exam-card),
#main-content.intermediate-student-view > .word-card:not(.quran-exam-card) {
    display: grid;
    grid-template-columns: 65px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 20px;
    row-gap: 6px;
    min-height: 112px;
    width: 100%;
    max-width: 850px;
    height: 112px !important;
    max-height: 112px !important;
    margin: 0 auto 20px;
    padding: 24px;
    border: 2px solid #164e63;
    border-inline-end: 5px solid #0891b2;
    border-radius: 20px;
    background: #ffffff;
    box-shadow: 0 18px 40px rgba(112, 144, 176, 0.12);
    aspect-ratio: auto;
    overflow: hidden;
    resize: none !important;
}

#main-content.intermediate-student-view > .word-card:not(.quran-exam-card) {
    border-inline-end-color: #db2777;
}

#main-content.intermediate-student-view > .sub-card:not(.pillars-sub-card):not(.prophet-sub-card):not(.quran-exam-card)::before,
#main-content.intermediate-student-view > .word-card:not(.quran-exam-card)::before {
    grid-column: 1;
    grid-row: 1 / span 2;
    width: 65px;
    height: 65px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    flex-shrink: 0;
}

#main-content.intermediate-student-view > .sub-card:not(.pillars-sub-card):not(.prophet-sub-card):not(.quran-exam-card)::before {
    content: "💬";
    background: #cffafe;
    color: #0e7490;
}

#main-content.intermediate-student-view > .word-card:not(.quran-exam-card)::before {
    content: "🔤";
    background: #fce7f3;
    color: #be185d;
}

#main-content.intermediate-student-view > .sub-card:not(.pillars-sub-card):not(.prophet-sub-card):not(.quran-exam-card) .card-title,
#main-content.intermediate-student-view > .word-card:not(.quran-exam-card) .card-title {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
    min-height: 0;
    max-width: 100%;
    padding: 0;
    color: #2b3674;
    font-size: 20px;
    line-height: 1.4;
    text-align: start;
    justify-content: flex-start;
    resize: none !important;
}

#main-content.intermediate-student-view > .sub-card:not(.pillars-sub-card):not(.prophet-sub-card):not(.quran-exam-card)::after,
#main-content.intermediate-student-view > .word-card:not(.quran-exam-card)::after {
    content: "Start Lesson  ▶";
    grid-column: 2;
    grid-row: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: start;
    min-height: 28px;
    padding: 4px 14px;
    border-radius: 8px;
    background: #0f766e;
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

#main-content.intermediate-student-view > .word-card:not(.quran-exam-card)::after {
    background: #be185d;
}

#main-content.intermediate-student-view > .word-card:not(.quran-exam-card) .card-title__icon {
    display: none;
}

#main-content.intermediate-student-view > .sub-card:not(.pillars-sub-card):not(.prophet-sub-card):not(.quran-exam-card) .card-subtitle,
#main-content.intermediate-student-view > .word-card:not(.quran-exam-card) .card-subtitle {
    position: absolute;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    bottom: 8px;
    margin: 0;
    padding: 4px 12px;
    border: 0;
    border-radius: 30px;
    background: #e9edf7;
    color: #4318ff;
    box-shadow: none;
    font-size: 13px;
}

@media (max-width: 650px) {
    #main-content.intermediate-student-view > .sub-card:not(.pillars-sub-card):not(.prophet-sub-card):not(.quran-exam-card),
    #main-content.intermediate-student-view > .word-card:not(.quran-exam-card) {
        grid-template-columns: 65px minmax(0, 1fr);
        height: auto !important;
        min-height: 100px !important;
        max-height: none !important;
        padding: 18px;
    }
}

#main-content:has(.pillars-sub-card),
#main-content.pillars-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 22px;
    align-items: stretch;
    padding: 40px 20px !important;
    background: #f4ece1 !important;
}

#main-content:has(.pillars-sub-card) > .pillars-sub-card,
#main-content.pillars-list > .pillars-sub-card {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 3 / 1;
    margin: 0;
    padding: 16px 18px;
    border: 2px solid #e2d7c5;
    border-radius: 20px;
    background: #fffdf9;
    box-shadow: 0 8px 20px rgba(60, 45, 20, 0.05);
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease, border-color 0.3s ease;
}

#main-content:has(.pillars-sub-card) > .pillars-sub-card:hover,
#main-content.pillars-list > .pillars-sub-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 30px rgba(60, 45, 20, 0.1);
    border-color: #d4af37;
}

.pillars-sub-card .pillars-badge {
    font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 800;
    color: #7c4a03;
    background: #fef3d6;
    padding: 6px 16px;
    border-radius: 30px;
    margin-bottom: 5px;
    border: 1px solid #f6e2b3;
}

.pillars-sub-card .pillars-arabic-title {
    font-family: 'Amiri', 'Traditional Arabic', serif;
    font-size: 26px;
    font-weight: 700;
    color: #1b4332;
    margin: 0 0 2px;
    line-height: 1.3;
}

.pillars-sub-card .pillars-english-title {
    font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
    font-size: 17px;
    font-weight: 800;
    color: #2b2d42;
    margin: 0 0 4px;
    line-height: 1.3;
}

.pillars-sub-card .pillars-section-desc {
    font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: #4a4e69;
    line-height: 1.6;
    margin: 0 0 8px;
}

.pillars-sub-card .pillars-start-btn {
    display: block;
    width: 100%;
    margin-top: auto;
    padding: 7px 0;
    background: #2b2d42;
    color: #ffffff;
    border-radius: 12px;
    font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
    font-size: 13px;
    font-weight: 800;
    transition: background 0.2s ease, color 0.2s ease;
}

.pillars-sub-card:hover .pillars-start-btn {
    background: #d4af37;
    color: #1b4332;
}

.pillars-sub-card > div {
    width: 100%;
    margin-top: 10px;
}

@media (max-width: 600px) {
    #main-content:has(.pillars-sub-card),
    #main-content.pillars-list {
        grid-template-columns: 1fr;
        padding: 24px 14px !important;
    }

    #main-content:has(.pillars-sub-card) > .pillars-sub-card,
    #main-content.pillars-list > .pillars-sub-card {
        min-height: 0;
        padding: 12px 14px;
    }
}

#main-content:has(.quran-exam-card) {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    padding: 40px 20px !important;
    background-color: #f9f9f9 !important;
    background-image: linear-gradient(135deg, #f9f9f9 25%, #f0f4f1 100%) !important;
}

#main-content:has(.quran-exam-card) > .card {
    width: 100%;
    max-width: 850px;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 24px 30px;
    aspect-ratio: auto;
}

.quran-exam-card {
    display: block !important;
    position: relative;
    overflow: hidden;
    direction: ltr;
    text-align: left;
    background: #ffffff !important;
    border: 1px solid #e0e6e2 !important;
    border-left: 6px solid #2d6a4f !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .03) !important;
    color: inherit;
    transition: transform .3s ease, box-shadow .3s ease, border-color .3s ease;
}

.quran-exam-card::after {
    content: '❖';
    position: absolute;
    bottom: -15px;
    right: -10px;
    z-index: 0;
    color: rgba(197, 155, 39, .05);
    font-size: 60px;
    pointer-events: none;
}

.quran-exam-card:hover {
    transform: translateY(-4px);
    border-color: #2d6a4f !important;
    box-shadow: 0 8px 20px rgba(45, 106, 79, .15) !important;
}

.quran-exam-card__content {
    position: relative;
    z-index: 1;
}

.quran-exam-card__title {
    margin: 0 0 6px;
    color: #1a1a1a;
    font-family: 'Poppins', sans-serif;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    text-align: left;
}

.quran-exam-card__description {
    margin: 0 0 16px;
    color: #5c6c64;
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    line-height: 1.5;
    text-align: left;
}

.quran-exam-card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px dashed #e0e6e2;
}

.quran-exam-card__count {
    padding: 4px 12px;
    border: 1px solid #f2e6c4;
    border-radius: 20px;
    background: #fffcf0;
    color: #c59b27;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 700;
}

.quran-exam-card__start {
    color: #2d6a4f;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 700;
}

.quran-exam-card:hover .quran-exam-card__start { color: #1b4332; }

.quran-exam-card .prophet-sub-card__admin-tools { direction: ltr; }

#main-content:has(.prophet-sub-card) {
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center;
    padding: 40px 20px !important;
    background: #f0ebe1 !important;
}

#main-content:has(.prophet-sub-card) > .card {
    width: 100%;
    max-width: 80vw;
    min-width: 0;
    height: auto;
    min-height: 0;
    margin: 0;
    aspect-ratio: auto;
    padding: 18px 30px;
}

.prophet-sub-card {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    direction: rtl;
    border: 1px solid #dcd4b8 !important;
    border-radius: 12px !important;
    background: linear-gradient(180deg, #ffffff 0%, #faf8f2 100%) !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, .06), inset 0 0 0 1px #fff !important;
    color: #171717;
    transition: transform .2s ease, box-shadow .2s ease;
}

.prophet-sub-card,
.prophet-word-card,
.prophet-content-card {
    resize: none !important;
    width: 100% !important;
    max-width: 80vw !important;
    min-width: 0 !important;
    height: 150px !important;
    min-height: 150px !important;
    max-height: 150px !important;
}

.prophet-word-card,
.prophet-content-card {
    margin: 0 auto !important;
    aspect-ratio: auto !important;
}

.prophet-sub-card .card-title,
.prophet-word-card .card-title,
.prophet-content-card .card-title {
    resize: none !important;
}

.prophet-sub-card::before {
    display: none;
}

.prophet-sub-card:hover {
    transform: translateY(-2px);
    border-color: #c5a059 !important;
    box-shadow: 0 6px 15px rgba(0, 0, 0, .1) !important;
}

.prophet-sub-card .card-title {
    position: relative;
    z-index: 1;
    flex: 1.2;
    order: 2;
    color: #1a1a1a;
    font-family: "Amiri", "Noto Naskh Arabic", serif;
    font-size: 32px;
    min-height: 0;
    width: auto;
    max-width: none;
    font-weight: 700;
    line-height: 1.25;
    white-space: nowrap;
    overflow: visible;
    text-align: center;
}

.prophet-sub-card__admin-tools {
    position: absolute;
    top: 4px;
    left: 6px;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 2px;
    direction: ltr;
}

.prophet-sub-card__admin-tools .btn-del {
    margin: 0;
    width: 30px !important;
    min-width: 30px !important;
    max-width: 30px !important;
    height: 30px !important;
    min-height: 30px !important;
    max-height: 30px !important;
    padding: 0 !important;
    font-size: 10px !important;
    line-height: 1 !important;
    flex: 0 0 30px !important;
}

.prophet-sub-card .card-subtitle { position: absolute; z-index: 2; bottom: 3px; right: 50%; background: #4d9b72; border-color: #3b7d5a; }

@media (max-width: 560px) {
    #main-content:has(.prophet-sub-card) { gap: 18px; padding: 40px 20px !important; }
    #main-content:has(.prophet-sub-card) > .card { width: 100%; height: auto; min-height: 0; padding: 18px 30px; }
    .prophet-sub-card { flex-direction: column !important; gap: 10px; text-align: center; }
    .prophet-sub-card .card-title { font-size: 26px; }
}

.story-content-view { background: white; padding: 0 30px 30px; border-radius: 20px; box-shadow: 0 4px 20px rgba(0,0,0,0.08); position: relative; }
.word-card-content-view {
    background: white; padding: 0 30px 30px; border-radius: 20px; box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-top: 3px solid var(--word-color, #e67e22);
}

.embed-only-content {
    min-height: 100vh !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.embed-only-content > .content-fixed-ui:not(.content-nav-fixed) {
    display: none !important;
}

.embed-only-content .content-zoom-shell,
.embed-only-content .content-zoom-viewport,
.embed-only-content .content-zoom-layer {
    width: 100% !important;
    max-width: none !important;
    min-height: calc(100vh - 76px) !important;
    height: calc(100vh - 76px) !important;
    padding: 0 !important;
    margin: 0 !important;
}

.embed-only-content .content-zoom-viewport {
    overflow-x: auto !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
}

.embed-only-body {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.custom-embed-html {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

.embed-only-frame {
    display: block;
    width: 100%;
    height: 100%;
    min-height: calc(100vh - 76px);
    border: 0;
    border-radius: 0;
    background: #fff;
}

.embed-only-content .content-nav-fixed {
    position: fixed !important;
    z-index: 100 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    padding: 8px 12px !important;
    margin: 0 !important;
    background: rgba(255, 255, 255, 0.94) !important;
    box-sizing: border-box !important;
}

.embed-only-content .content-nav-fixed .nav-controls {
    padding-right: 104px !important;
    box-sizing: border-box !important;
}

.embed-only-content .content-nav-fixed {
    z-index: 2147483001 !important;
    pointer-events: none !important;
}
.embed-only-content .content-nav-fixed .nav-controls,
.embed-only-content .content-nav-fixed .nav-nav-btn {
    pointer-events: auto !important;
}

body.embed-only-page {
    overflow: hidden !important;
}

body.embed-only-page .app-header,
body.embed-only-page #quick-access-section,
body.embed-only-page #admin-tools,
body.embed-only-page #seo-hero-main,
body.embed-only-page #pen-toolbar-float-disabled {
    display: none !important;
}

body.embed-only-page .container,
body.embed-only-page #main-content {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

body.embed-only-page #main-content {
    min-height: 100vh !important;
}

@media (min-width: 861px) {
    
    .container,
    #main-content {
        max-width: calc(100% - 60px) !important;
        margin: 0 30px !important;
        width: auto !important;
        box-sizing: border-box;
        padding: 0 !important;
    }

    .story-content-view,
    .word-card-content-view {
        
        margin: 0;
        padding: 0 30px 0px !important;
        border-radius: 0 !important;
        box-shadow: none !important;
        background: #fff;
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: auto;
        box-sizing: border-box;
        width: 100%;
        max-width: none;
    }

    .story-content-view .content-fixed-ui,
    .word-card-content-view .content-fixed-ui {
        max-width: 100%;
        padding: 0 !important;
    }

    .story-content-view .display-controls,
    .word-card-content-view .display-controls {
        margin: 0 0 18px !important;
        padding: 14px 18px !important;
        border-radius: 0 !important;
        background: #f7f9fc !important;
        box-shadow: none !important;
    }

    .story-content-view .nav-controls,
    .word-card-content-view .nav-controls {
        gap: 12px;
        justify-content: space-between;
        margin: 0 !important;
        padding: 0 !important;
    }
}

@media (min-width: 861px) {
    .story-content-view,
    .word-card-content-view {
        font-size: 1.7rem; 
        line-height: 1.6;
    }

    .story-content-view .line-en,
    .word-card-content-view .line-en,
    #story-mixed-body .line-en {
        font-size: 12.8px !important; 
    }

    .story-content-view .wordIcon,
    .word-card-content-view .wordIcon {
        font-size: 68px !important; 
    }

    .story-content-view .card-title,
    .word-card-content-view .card-title {
        font-size: 1.87rem !important; 
    }
}

@media (max-width: 860px) {
    #headerPrevBtn,
    #headerNextBtn {
        display: none !important;
    }

    .container,
    #main-content,
    .story-content-view,
    .word-card-content-view,
    .content-zoom-shell,
    .content-zoom-viewport,
    .content-zoom-layer,
    .converter-container,
    .nav-bar,
    .app-header,
    #quick-access-section {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .container {
        max-width: 100% !important;
        padding: 0 10px !important;
    }

    .nav-bar {
        flex-wrap: wrap;
        justify-content: space-between;
    }

    .app-title-row {
        gap: 5px;
    }

    .home-page-btn {
        padding: 4px 7px;
        font-size: 0.68rem;
    }

    .converter-container {
        margin-bottom: 0 !important;
        padding: 18px 16px !important;
    }

    #main-content {
        padding: 0 !important;
        gap: 0 !important;
        margin-top: 0 !important;
    }

    .card {
        width: 100% !important;
        max-width: 100% !important;
        min-height: 240px !important;
        height: auto !important;
        padding: 18px !important;
    }

    .story-content-view,
    .word-card-content-view {
        padding: 22px 22px 0px 22px !important;
        border-radius: 18px !important;
        display: flex !important;
        flex-direction: column !important;
        height: auto !important;
    }

    #main-content h2,
    .section-title {
        font-size: 2.4rem !important;
        line-height: 1.08 !important;
    }

    #goToPageLabel {
        display: none !important;
    }

    #goPageBtn,
    #backPageBtn {
        flex: 1 1 auto !important;
        width: 50% !important;
        max-width: 120px !important;
        min-width: 60px !important;
        padding: 10px 12px !important;
        min-height: 44px !important;
        height: 44px !important;
        font-size: 14px !important;
        font-weight: 600 !important;
        border-radius: 12px !important;
        border: none !important;
        cursor: pointer !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        transition: all 0.2s ease !important;
        box-sizing: border-box !important;
    }

    #goPageBtn {
        background: var(--accent-color) !important;
        color: white !important;
        box-shadow: 0 3px 8px rgba(52, 152, 219, 0.3) !important;
        margin-right: 8px !important;
    }

    #backPageBtn {
        background: #666 !important;
        color: white !important;
        box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2) !important;
        margin-left: 8px !important;
    }

    #goPageBtn:hover {
        background: var(--accent-color, #2980b9) !important;
        box-shadow: 0 4px 10px rgba(52, 152, 219, 0.5) !important;
    }

    #backPageBtn:hover {
        background: #555 !important;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35) !important;
    }

}

.story-content-view.story-pron-listen-on .wordIcon[data-pron-linked="1"] {
    cursor: pointer !important;
    border-bottom: 2px dotted var(--accent-color, #3498db);
}
.story-content-view.story-pron-listen-on .wordIcon[data-pron-linked="1"]:hover {
    border-color: var(--story-color, #e67e22);
    background: rgba(52, 152, 219, 0.08);
    border-radius: 4px;
}
.listen-label-en { font-weight: 800; color: var(--accent-color, #3498db); }
.listen-label-ar { font-family: 'Traditional Arabic', serif; font-size: 0.85em; color: #444; }
.display-controls { display: flex; gap: 6px; margin-bottom: 12px; font-weight: bold; background: #f5f5f5; padding: 6px 8px; border-radius: 8px; align-items: center; flex-wrap: wrap; }
.display-controls label { margin: 0; padding: 0; }
.control-item { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; font-size: 0.76rem; line-height: 1.2; }
.control-item input { width: 14px; height: 14px; margin: 0; accent-color: var(--accent-color, #3498db); }
.control-item-pron { font-family: 'Traditional Arabic', serif; }

.control-item-word-pron {
    cursor: pointer;
    font-family: 'Traditional Arabic', serif;
    gap: 4px;
    padding: 2px 5px;
    border-radius: 6px;
    transition: background 0.2s, box-shadow 0.2s;
}
.control-item-word-pron input {
    width: 14px;
    height: 14px;
    margin: 0;
    accent-color: var(--word-color, #e67e22);
    cursor: pointer;
}
.control-item-word-pron--on {
    background: rgba(230, 126, 34, 0.12);
    box-shadow: inset 0 0 0 1px rgba(230, 126, 34, 0.35);
}
.word-pron-mini-icon {
    font-size: 0.85rem;
    line-height: 1;
    opacity: 0.92;
}
.word-pron-mini-en {
    font-weight: 800;
    font-size: 0.72rem;
    color: var(--word-color, #e67e22);
    letter-spacing: 0.02em;
}
.word-pron-mini-ar {
    font-size: 0.72rem;
    color: #555;
}
.word-card-content-view.word-pronounce-active .wordIcon--word-pron {
    cursor: pointer !important;
    border-bottom: 2px dotted var(--word-color, #e67e22);
}
.word-card-content-view.word-pronounce-active .wordIcon--word-pron:hover {
    background: rgba(230, 126, 34, 0.1);
    border-radius: 4px;
}
.dialect-box { background: #fff; padding: 4px 6px; border-radius: 6px; border: 1px solid #ccc; display: flex; gap: 6px; align-items: center; }
.dialect-box label { display: inline-flex; align-items: center; gap: 4px; padding: 2px 5px; margin: 0; font-size: 0.75rem; cursor: pointer; }
.dialect-box input { width: 14px; height: 14px; margin: 0; }
.pronoun-toolbar-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border: 1px solid #c4b5fd;
    border-radius: 12px;
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    color: #5b21b6;
    box-shadow: 0 2px 8px rgba(109, 40, 217, .12);
    flex-shrink: 0;
}
.pronoun-toolbar-title {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding-right: 5px;
    border-right: 1px solid #c4b5fd;
    font-size: .78rem;
    font-weight: 800;
}
.pronoun-toolbar-title i { color: #7c3aed; font-size: 1rem; }
.pronoun-toolbar-group label {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin: 0;
    padding: 3px 5px;
    border-radius: 7px;
    cursor: pointer;
    font-size: .76rem;
    font-weight: 800;
    transition: background .15s ease, color .15s ease;
}
.pronoun-toolbar-group label:has(input:checked) { background: #7c3aed; color: #fff; }
.pronoun-toolbar-group input { width: 13px; height: 13px; margin: 0; accent-color: #7c3aed; }

/* Content toolbar: intentionally mirrors the shared toolbar design used by stories and words. */
.custom-content-toolbar {
    width: 100%;
    max-width: 100vw;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: flex-start !important;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    flex-wrap: nowrap !important;
    direction: ltr !important;
    min-width: 0;
    margin-bottom: 12px;
}
.custom-content-toolbar .dialects-box {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f1f5f9;
    border: 2px solid #cbd5e1;
    border-radius: 12px;
    padding: 8px 14px;
    flex-shrink: 0;
}
.custom-content-toolbar .item-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 12px;
    font-family: 'Inter', 'Cairo', sans-serif;
    font-size: 1.15rem;
    font-weight: 800;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    transition: transform 0.15s ease;
    flex-shrink: 0;
    margin: 0;
}
.custom-content-toolbar .item-card:hover { transform: translateY(-2px); }
.custom-content-toolbar .dialect-item {
    padding: 0;
    background: none;
    border: none;
    color: #1e293b;
}
.custom-content-toolbar .bg-plural { background-color: #f3e8ff; border: 1px solid #d8b4fe; color: #6b21a8; }
.custom-content-toolbar .bg-pronounce { background-color: #fff7ed; border: 1px solid #ffedd5; color: #9a3412; }
.custom-content-toolbar .bg-us { background-color: #e0f2fe; border: 1px solid #bae6fd; color: #0369a1; }
.custom-content-toolbar .bg-eg { background-color: #dcfce7; border: 1px solid #bbf7d0; color: #15803d; }
.custom-content-toolbar .bg-tashkeel { background-color: #fef3c7; border: 1px solid #fde68a; color: #b45309; }
.custom-content-toolbar .toolbar-divider {
    width: 2px;
    height: 36px;
    background-color: #e2e8f0;
    flex-shrink: 0;
}
.custom-content-toolbar input[type="radio"],
.custom-content-toolbar input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin: 0;
    cursor: pointer;
    accent-color: #2563eb;
    flex-shrink: 0;
}
.custom-content-toolbar .icon-plus { color: #9333ea; font-size: 1.4rem; }
.custom-content-toolbar .icon-sound { color: #1e3a8a; font-size: 1.4rem; }
.custom-content-toolbar .icon-star { color: #f59e0b; font-size: 1.4rem; }
.custom-content-toolbar .ar-text { font-family: 'Cairo', sans-serif; }

@media (max-width: 1200px) {
    .custom-content-toolbar .item-card { padding: 6px 10px; font-size: 1rem; gap: 6px; }
    .custom-content-toolbar .dialects-box { padding: 6px 10px; gap: 8px; }
    .custom-content-toolbar input[type="radio"],
    .custom-content-toolbar input[type="checkbox"] { width: 18px; height: 18px; }
}

@media (max-width: 860px) {
    .quick-access-row,
    .nav-buttons-container,
    .page-jump-controls {
        min-width: 0 !important;
        box-sizing: border-box !important;
    }
    #quick-access-section {
        width: 100% !important;
        max-width: 100% !important;
        padding: 8px !important;
    }
    .quick-access-row {
        width: 100% !important;
        gap: 8px !important;
    }
    .nav-buttons-container {
        width: 100% !important;
        flex: 0 0 100% !important;
        gap: 6px !important;
    }
    .page-jump-controls {
        width: 100% !important;
        max-width: 100% !important;
        gap: 6px !important;
        flex-wrap: nowrap !important;
        justify-content: center !important;
        overflow: hidden;
    }
    #jumpToNumber {
        flex: 1 1 auto !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        height: 44px !important;
        padding: 8px 10px !important;
    }
    #goPageBtn,
    #backPageBtn {
        flex: 0 0 auto !important;
        width: auto !important;
        max-width: none !important;
        min-width: 62px !important;
        margin: 0 !important;
        padding: 10px 13px !important;
    }

    .custom-content-toolbar {
        justify-content: flex-start !important;
        align-content: center;
        overflow: visible;
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        padding: 8px;
        gap: 6px;
    }
    .custom-content-toolbar .dialects-box {
        grid-column: 1 / -1;
        width: max-content;
        max-width: 100%;
        flex-wrap: nowrap;
        justify-content: center;
        gap: 4px;
        padding: 6px;
        overflow: hidden;
    }
    .custom-content-toolbar .item-card {
        width: 100%;
        min-width: 0;
        justify-content: center;
        flex-shrink: 1;
        max-width: 100%;
        white-space: nowrap;
        padding: 6px 4px;
        font-size: 0.78rem;
        gap: 4px;
    }
    .custom-content-toolbar .bg-plural,
    .custom-content-toolbar .bg-us,
    .custom-content-toolbar .bg-eg,
    .custom-content-toolbar .bg-tashkeel {
        grid-column: span 2;
    }
    .custom-content-toolbar .bg-pronounce {
        grid-column: span 4;
    }
    .custom-content-toolbar .dialect-item {
        width: auto;
        flex-shrink: 0;
        padding: 0 2px;
        font-size: 0.78rem;
    }
    .custom-content-toolbar .toolbar-divider {
        display: none;
    }
}

.hide-ar .line-ar { display: none !important; }
.hide-ar .line-container,
.hide-en .line-container {
    line-height: 1.1;
    margin-bottom: 0.2rem !important;
}
.hide-ar .line-en,
.hide-en .line-ar {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}
.hide-ar .line-en {
    margin-bottom: 0.15rem;
}
.hide-en .line-en { display: none !important; }
.hide-ar .content-zoom-viewport,
.hide-en .content-zoom-viewport {
    margin-bottom: 0 !important;
}
.hide-ar .line-en::after,
.hide-en .line-en::after {
    display: none !important;
}
.line-container {
    display: block;
    width: 100%;
    margin-bottom: 5px;
    line-height: 0.45; 
    white-space: pre-wrap;
    word-break: break-word;
}

.line-container.line-ar { position: relative; }
.line-arrow {
    display: none !important;
}
.line-arrow::before {
    content: "";
}

@media (max-width: 860px) {
    .line-arrow { display: none !important; }
    .line-arrow::before { content: ""; }
}

.hide-ar .line-arrow,
.story-content-view.hide-ar .line-arrow,
.word-card-content-view.hide-ar .line-arrow { display: none !important; }

.line-arrow-overlay { display: none !important; position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; z-index: 60; overflow: visible; }
.line-ar {
    text-align: right;
    direction: rtl;
}
.line-en {
    text-align: left;
    direction: ltr;
    color: var(--accent-color);
    margin-bottom: 10px; 
    font-weight: 800;
    font-size: 10.125px !important; 
    line-height: 1.2;
    position: relative; 
    padding-bottom: 10px;
    text-shadow: 0 1px 2px rgba(92,107,192,0.18);
    font-family: 'Outfit', 'Inter', 'Segoe UI', Tahoma, sans-serif;
}
.wordIcon span[style*="color:blue"] {
    font-size: 0.66em !important; 
}

.line-en::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 6px;
    height: 4px;
    background: linear-gradient(90deg, rgba(22,33,120,0.98) 0%, rgba(42,58,150,0.98) 50%, rgba(72,94,190,0.98) 100%);
    box-shadow: 0 8px 20px rgba(22,33,120,0.30);
    border-radius: 4px;
    pointer-events: none;
    opacity: 1;
}

.hide-ar .line-en,
.story-content-view.hide-ar .line-en,
.word-card-content-view.hide-ar .line-en {
    padding-bottom: 0 !important;
    margin-bottom: 2px !important;
}
.hide-ar .line-en::after,
.story-content-view.hide-ar .line-en::after,
.word-card-content-view.hide-ar .line-en::after {
    display: none !important;
}
.word-wrapper { position: relative; display: inline-block; margin: 15px 12px; vertical-align: middle; }

.wordIcon { 
    font-family: 'Traditional Arabic', serif; font-size: 40px; cursor: move; user-select: none; 
    transition: 0.2s; resize: both; overflow: auto; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid rgba(0,0,0,0.08); border-radius: 14px; background: rgba(255,255,255,0.95);
    padding: 4px 10px; margin: 0 4px 6px 0;
    line-height: normal;
    font-weight: normal;
    -webkit-tap-highlight-color: transparent;
}

.story-content-view .wordIcon,
.word-card-content-view .wordIcon {
    display: inline !important;
    border: none !important;
    background: transparent !important;
    border-radius: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    line-height: 1.2 !important;
    vertical-align: baseline !important;
}

.word-box-mode {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 8px 10px !important;
    width: 100% !important;
    overflow-x: hidden !important;
}

.word-box-mode .word-wrapper {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 4px 3px !important;
    flex: 1 1 88px !important;
    min-width: 88px !important;
    max-width: 140px !important;
    min-height: 48px !important;
}

.word-box-mode .wordIcon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border: 2px solid rgba(37, 99, 235, 0.30) !important;
    background: rgba(255, 255, 255, 0.98) !important;
    border-radius: 14px !important;
    padding: 8px 12px !important;
    margin: 0 !important;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.10), inset 0 1px 0 rgba(255,255,255,0.8) !important;
    min-width: 58px !important;
    min-height: 42px !important;
    max-width: 100% !important;
    max-height: 60px !important;
    transform: scale(2) !important;
    transform-origin: center center !important;
    font-size: 32px !important;
    line-height: 1 !important;
    vertical-align: baseline !important;
    color: #111827 !important;
    overflow: hidden !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
    flex: 0 0 auto !important;
}

.word-box-mode .wordIcon .word-ar-layer,
.word-box-mode .wordIcon .word-flip-front,
.word-box-mode .wordIcon .word-flip-back {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #111827 !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
}

.word-box-mode .wordIcon .tashkeel-red,
.word-box-mode .wordIcon .word-ar-layer .tashkeel-red {
    color: #111827 !important;
}

.word-box-mode .wordIcon--yt-overlay-host {
    position: relative;
}

.word-box-mode .word-wrapper .interaction-icon {
    transform: scale(1.1) !important;
}

.wordIcon--yt-overlay-host {
    position: relative;
}

.yt-gesture-slot {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-width: 100%;
    min-height: 100%;
    z-index: 25;
    pointer-events: auto;
    box-sizing: border-box;
}

.yt-gesture-ifr {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    margin: 0;
    padding: 0;
    opacity: 0;
    pointer-events: none;
    -webkit-tap-highlight-color: transparent;
}

.yt-gesture-cap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    margin: 0;
    padding: 0;
    opacity: 0;
    z-index: 26;
    cursor: pointer;
    pointer-events: auto;
    background: transparent;
    -webkit-tap-highlight-color: transparent;
}
.yt-gesture-cap:focus-visible {
    outline: none;
}

.word-card-content-view:not(.word-pronounce-active) .yt-word-play-crop {
    display: none !important;
}

.word-card-content-view.word-pronounce-active .yt-word-play-crop {
    display: block !important;
    left: auto !important;
    right: -2px;
    top: -2px;
}

.word-card-content-view.word-pronounce-active .wordIcon.yt-inline-word-frame-host .word-flip-inner,
.word-card-content-view.word-pronounce-active .wordIcon.yt-inline-word-frame-host .word-ar-layer,
.word-card-content-view.word-pronounce-active .wordIcon.yt-inline-word-frame-host .tashkeel-red {
    pointer-events: none;
}

.word-card-content-view.word-pronounce-active .wordIcon.yt-inline-word-frame-host .yt-gesture-slot {
    pointer-events: none !important;
}

.wordIcon.word-flip-host {
    perspective: 900px;
    -webkit-perspective: 900px;
    
    white-space: nowrap;
}

.wordIcon.word-flip-host.wordIcon--yt-overlay-host {
    position: relative;
}
.wordIcon.word-flip-host .word-flip-inner {
    display: inline-grid;
    vertical-align: middle;
    min-width: 100%;
    min-height: 100%;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    transition: transform 0.52s cubic-bezier(0.4, 0.2, 0.2, 1);
}
.wordIcon.word-flip-host.is-flipped .word-flip-inner {
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
}
.wordIcon.word-flip-host .word-flip-front,
.wordIcon.word-flip-host .word-flip-back {
    grid-area: 1 / 1;
    justify-self: center;
    align-self: center;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    isolation: isolate;
}
.wordIcon.word-flip-host .word-flip-back {
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
}

.story-content-view .wordIcon .word-ar-layer,
.word-card-content-view .wordIcon .word-ar-layer {
    display: inline;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    font-weight: inherit;
    vertical-align: baseline;
}
.story-content-view .wordIcon .word-ar-layer .tashkeel-red,
.word-card-content-view .wordIcon .word-ar-layer .tashkeel-red {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
    font-weight: inherit;
    vertical-align: baseline;
}

.story-content-view .wordIcon,
.story-content-view .interaction-icon,
.word-card-content-view .wordIcon,
.word-card-content-view .interaction-icon {
    resize: none !important;
    overflow: visible !important;
}

.wordIcon:hover { border-color: #3498db; }
.tashkeel-black { color: #000 !important; font-weight: bold; }

@media (max-width: 860px) {
    .embed-only-content,
    .embed-only-content .content-zoom-shell,
    .embed-only-content .content-zoom-viewport,
    .embed-only-content .content-zoom-layer {
        width: 100% !important;
        max-width: 100% !important;
        min-height: calc(100vh - 64px) !important;
        height: calc(100vh - 64px) !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .embed-only-frame {
        min-height: calc(100vh - 64px) !important;
    }
}

.interaction-icon { 
    width: 42px; height: 42px; font-size: 18px; color: white; border-radius: 50%; 
    display: flex; align-items: center; justify-content: center; cursor: move; 
    border: 2px solid #fff; box-shadow: 0 3px 6px rgba(0,0,0,0.2); transition: 0.3s;
    resize: both; overflow: hidden;
}
.interaction-icon:hover { transform: scale(1.15); }

.translate-bg { background: var(--accent-color); position: absolute; top: -35px; left: 50%; transform: translateX(-50%); z-index: 5; }
.link-bg { background: #e67e22; position: absolute; top: -35px; left: 50%; transform: translateX(-50%); text-decoration: none; z-index: 5; }
.link-bg[href*="youtube.com"], .link-bg[href*="youtu.be"] { background: #ff0000 !important; box-shadow: 0 4px 10px rgba(255,0,0,0.4); }

.translation-tooltip { visibility: hidden; background: #333; color: #fff; border-radius: 6px; padding: 5px 10px; position: absolute; z-index: 10; bottom: 125%; left: 50%; transform: translateX(-50%); opacity: 0; transition: 0.3s; white-space: nowrap; font-family: sans-serif; font-size: 14px; }
.translation-tooltip.show { visibility: visible; opacity: 1; }

.pagination-container { display: flex; justify-content: center; align-items: center; gap: 0; margin: 30px 0; direction: ltr; }
.page-btn { width: 45px; height: 45px; display: flex; align-items: center; justify-content: center; background: white; border: 2px solid var(--main-color); color: var(--main-color); border-radius: 50%; font-weight: bold; font-size: 1.1rem; transition: 0.3s; box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.page-btn.active { background: var(--main-color); color: white; box-shadow: 0 4px 12px rgba(44,62,80,0.3); }
.page-btn:hover:not(.active) { background: #f0f0f0; transform: translateY(-3px); }

.question-box { background: white; padding: 20px; border-radius: 15px; margin-bottom: 20px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); }
.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 15px; }
.opt-btn { background: #f8f9fa; padding: 15px; text-align: center; border-radius: 10px; border: 2px solid #ddd; transition: 0.3s; font-weight: bold; cursor: pointer; }
.opt-btn:hover { background: #eef1f4; border-color: var(--accent-color); }

#editor-overlay, #word-editor-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1000; justify-content: center; align-items: center; }
.modal-box { background: white; width: 95%; max-width: 650px; padding: 25px; border-radius: 15px; max-height: 90vh; overflow-y: auto; }

textarea, input[type="text"] { width: 100%; padding: 12px; margin-bottom: 10px; border: 1px solid #ddd; border-radius: 8px; box-sizing: border-box; font-family: inherit; white-space: pre-wrap; }

.admin-only { display: none; }
#move-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); z-index: 2000; justify-content: center; align-items: center; }
.move-box { background: white; padding: 25px; border-radius: 15px; width: 90%; max-width: 400px; text-align: center; }
select { width: 100%; padding: 10px; margin: 15px 0; border-radius: 8px; border: 1px solid #ccc; font-family: inherit; background: white; }

.nav-controls { display: flex; justify-content: flex-start; gap: 0; margin-top: 0; padding-top: 0; border-top: none; }

.content-fixed-ui.content-nav-fixed .nav-controls { margin: 0 !important; padding: 0 !important; border: 0 !important; }
.content-fixed-ui.content-nav-fixed .nav-nav-btn { margin: 0 !important; }

.nav-nav-btn { background: var(--main-color); color: white; padding: 10px 20px; border-radius: 10px; font-size: 0.9rem; }

:root {
    --cz-scale: 1;
    --cz-inverse-scale: 1;
}
body {
    --cz-scale: 1;
    zoom: 1;
}
.content-zoom-shell {
    width: 100%;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    transform: none;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.content-zoom-viewport {
    position: relative;
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    flex: 1;
    min-height: auto;
    max-height: none;
    margin-bottom: 8px;
    box-sizing: border-box;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
}
.content-zoom-layer {
    position: relative;
    width: 100%;
    box-sizing: border-box;
    margin-left: auto;
    margin-right: auto;
}

#pen-overlay-root {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    pointer-events: none;
    isolation: isolate;
    contain: layout style;
}
#pen-overlay-root #pen-toolbar-float {
    pointer-events: auto;
}
.content-fixed-ui {
    position: relative;
    z-index: 20;
    flex-shrink: 0;
}
.content-nav-fixed {
    z-index: 20;
}

.pen-toolbar-float {
    position: fixed;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 5px 4px;
    max-height: calc(100dvh - 24px);
    overflow-y: auto;
    overflow-x: hidden;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.24);
}
.pen-toolbar-float--visible {
    display: flex;
}
.pen-toolbar {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
    padding: 4px 6px;
    background: #2c3e50;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}
.pen-toolbar--collapsed {
    justify-content: center;
    width: auto;
    padding: 4px;
}
.pen-toolbar--collapsed .pen-tool-btn:not(.pen-tool-btn--toggle),
.pen-toolbar--collapsed .pen-toolbar-sep,
.pen-toolbar--collapsed .pen-zoom-level {
    display: none !important;
}
.pen-toolbar-float.pen-toolbar {
    flex-wrap: nowrap;
    margin: 0;
}

@media (max-width: 767px) {
    #pen-toolbar-float {
        display: none !important;
    }
}

.pen-tool-btn {
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border: none;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 0.75rem;
    cursor: pointer;
    line-height: 1;
    transition: background 0.15s, transform 0.1s;
}
.pen-tool-btn:hover {
    background: rgba(255, 255, 255, 0.22);
}
.pen-tool-btn--toggle {
    min-width: 18px;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
}
.pen-tool-btn--toggle:hover {
    background: rgba(255, 255, 255, 0.32);
}
.pen-tool-btn--active {
    background: var(--accent-color, #3498db);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.pen-tool-btn--text {
    font-size: 0.65rem;
    font-weight: 700;
}
.pen-toolbar-sep {
    width: 1px;
    height: 18px;
    background: rgba(255, 255, 255, 0.25);
    margin: 0 3px;
}
.pen-toolbar-float .pen-toolbar-sep {
    width: 18px;
    height: 1px;
    margin: 2px 0;
}
.pen-color-btn {
    padding: 0 !important;
    min-width: 18px !important;
}
.pen-color-swatch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: none;
    font-size: 13px;
    line-height: 1;
    background: transparent;
    color: #fff;
    box-sizing: border-box;
}
.pen-color-swatch::before {
    content: '🖊';
}
.pen-color-btn--red .pen-color-swatch {
    color: #e74c3c;
}
.pen-color-btn--black .pen-color-swatch {
    color: #000;
}
.pen-zoom-level {
    min-width: 32px;
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: #ecf0f1;
    user-select: none;
}
.pen-draw-canvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 5;
    pointer-events: none;
    touch-action: none;
}
.pen-draw-canvas--pen {
    cursor: crosshair;
}

.story-content-view,
.word-card-content-view {
    min-height: calc(100vh - 140px) !important;
}

@media (min-width: 861px) {
    .story-content-view,
    .word-card-content-view {
        min-height: calc(100vh - 90px) !important;
    }
}
.pen-draw-canvas--eraser {
    cursor: cell;
}

.last-visited-page-wrap {
    width: 100%;
    max-width: 420px;
    margin: 12px auto 20px;
    padding: 0 6px;
    box-sizing: border-box;
}
.last-visited-page-btn {
    position: relative;
    width: 100%;
    border: none;
    border-radius: 18px;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    background: linear-gradient(145deg, #1a237e 0%, #3949ab 40%, #5c6bc0 100%);
    box-shadow: 0 8px 28px rgba(57, 73, 171, 0.45), 0 0 0 1px rgba(255,255,255,0.12) inset;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.last-visited-page-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(57, 73, 171, 0.55), 0 0 0 1px rgba(255,255,255,0.2) inset;
}
.last-visited-page-btn:active { transform: translateY(0); }
.last-visited-page-btn__glow {
    position: absolute;
    inset: -40%;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.35) 0%, transparent 45%);
    pointer-events: none;
    opacity: 0.9;
}
.last-visited-page-btn__inner {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    color: #fff;
    text-align: start;
}
.last-visited-page-btn__icon {
    font-size: 1.75rem;
    line-height: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
}
.last-visited-page-btn__text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.last-visited-page-btn__en {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    opacity: 0.92;
}
.last-visited-page-btn__ar {
    font-size: 1.05rem;
    font-weight: bold;
    font-family: 'Traditional Arabic', 'Segoe UI', Tahoma, sans-serif;
    line-height: 1.3;
}
.last-visited-page-btn__num {
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0.88;
    margin-top: 4px;
}
.last-visited-page-btn__chev {
    font-size: 1.25rem;
    opacity: 0.85;
}

.multi-box-container { background: #f0f0f0; padding: 10px; border-radius: 10px; margin-bottom: 15px; border: 1px dashed #ccc; }
.multi-box-title { font-weight: bold; color: #555; margin-bottom: 5px; display: block; font-size: 0.9rem; }

.auto-box { background: #e3f2fd; border: 2px solid #2196f3; padding: 10px; border-radius: 10px; margin-bottom: 15px; }
.word-grid-input { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.word-grid-input label { grid-column: span 2; font-size: 0.8rem; font-weight: bold; color: #666; }
.edit-item-row { display: flex; align-items: center; gap: 5px; background: #fff; padding: 5px; margin-bottom: 5px; border: 1px solid #eee; border-radius: 5px; }
.edit-item-row .edit-word-val { width: 40%; }
.edit-item-row .edit-trans-val { width: 50%; }

.btn-sound-manager {
    display: block; width: 100%; padding: 14px 18px; font-size: 1rem; font-weight: bold;
    font-family: 'Traditional Arabic', 'Segoe UI', Tahoma, sans-serif;
    color: #fff; background: linear-gradient(135deg, #8e44ad, #9b59b6); border: none; border-radius: 12px;
    cursor: pointer; box-shadow: 0 4px 14px rgba(155, 89, 182, 0.35);
}
.btn-sound-manager:hover { filter: brightness(1.06); transform: translateY(-1px); }

.sound-manager-overlay {
    position: fixed; inset: 0; z-index: 10050; background: rgba(0,0,0,0.45);
    display: none; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box;
}
.sound-manager-modal { max-width: 640px; width: 100%; max-height: 90vh; overflow: hidden; display: flex; flex-direction: column; }
.sound-manager-list { overflow-y: auto; flex: 1; min-height: 120px; max-height: 55vh; border: 1px solid #e0e0e0; border-radius: 10px; padding: 8px; background: #fafafa; }
.sound-manager-row { display: flex; align-items: center; gap: 10px; padding: 8px; margin-bottom: 6px; background: #fff; border-radius: 8px; border: 1px solid #eee; flex-wrap: wrap; }
.sound-manager-row .sm-word { flex: 0 0 28%; min-width: 90px; font-weight: bold; font-family: 'Traditional Arabic', serif; word-break: break-word; }
.sound-manager-row .sm-url { flex: 1; min-width: 160px; padding: 8px; border: 1px solid #ccc; border-radius: 8px; font-size: 0.8rem; box-sizing: border-box; }
.sound-manager-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.btn-sound-save { background: var(--sub-color, #2ecc71); color: #fff; border: none; padding: 10px 22px; border-radius: 10px; font-weight: bold; cursor: pointer; font-size: 0.95rem; }
.btn-sound-cancel { background: #95a5a6; color: #fff; border: none; padding: 10px 18px; border-radius: 10px; cursor: pointer; }

.stats-footer .embedded-videos {
    width: 100%;
    max-width: 720px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    align-items: stretch;
}

.stats-footer .video-embed-block {
    width: 100%;
    text-align: center;
}

.stats-footer .video-embed-label {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--main-color);
    margin-bottom: 8px;
}

.responsive-video-wrap {
    position: relative;
    width: 100%;
    max-width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    background: #000;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.page-number-badge {
    background: #28a745;
    color: white;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
}

.page-number-badge.admin-draggable {
    cursor: move;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.page-number-badge.admin-draggable:hover {
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.5);
}

.page-number-badge.topbar-dragging {
    opacity: 0.8;
    box-shadow: 0 6px 16px rgba(40, 167, 69, 0.7);
    z-index: 1100;
}

.jump-page-badge-slot {
    width: auto;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 0;
    padding: 0 8px;
}

.jump-page-badge-slot[hidden] {
    display: none !important;
}

#main-content {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

#main-content > .story-content-view,
#main-content > .word-card-content-view {
    margin-top: 0 !important;
}

.responsive-video-wrap iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
    z-index: 999999 !important;
    clip-path: none !important;
    background: #000 !important;
    resize: none !important;
    min-width: 100% !important;
    max-width: 100% !important;
    min-height: 100% !important;
    max-height: 100% !important;
    pointer-events: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.responsive-video-wrap.admin-resizable {
    position: relative;
    resize: both;
    overflow: auto;
    min-width: 200px;
    min-height: 112px;
    max-width: 100%;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.responsive-video-wrap.admin-resizable:hover {
    border-color: rgba(52, 152, 219, 0.3);
}

.responsive-video-wrap.admin-resizable::before,
.responsive-video-wrap.admin-resizable::after,
.responsive-video-wrap.admin-resizable .resize-handle-nw,
.responsive-video-wrap.admin-resizable .resize-handle-ne,
.responsive-video-wrap.admin-resizable .resize-handle-sw,
.responsive-video-wrap.admin-resizable .resize-handle-se {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--accent-color, #3498db);
    border: 2px solid white;
    border-radius: 50%;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.responsive-video-wrap.admin-resizable:hover::before,
.responsive-video-wrap.admin-resizable:hover::after,
.responsive-video-wrap.admin-resizable:hover .resize-handle-nw,
.responsive-video-wrap.admin-resizable:hover .resize-handle-ne,
.responsive-video-wrap.admin-resizable:hover .resize-handle-sw,
.responsive-video-wrap.admin-resizable:hover .resize-handle-se {
    opacity: 1;
}

.responsive-video-wrap.admin-resizable::before {
    top: -6px;
    left: -6px;
    cursor: nw-resize;
}

.responsive-video-wrap.admin-resizable::after {
    top: -6px;
    right: -6px;
    cursor: ne-resize;
}

.responsive-video-wrap.admin-resizable .resize-handle-sw {
    bottom: -6px;
    left: -6px;
    cursor: sw-resize;
}

.responsive-video-wrap.admin-resizable .resize-handle-se {
    bottom: -6px;
    right: -6px;
    cursor: se-resize;
}

.responsive-video-wrap.admin-resizable::before:hover,
.responsive-video-wrap.admin-resizable::after:hover,
.responsive-video-wrap.admin-resizable .resize-handle-nw:hover,
.responsive-video-wrap.admin-resizable .resize-handle-ne:hover,
.responsive-video-wrap.admin-resizable .resize-handle-sw:hover,
.responsive-video-wrap.admin-resizable .resize-handle-se:hover {
    transform: scale(1.2);
    background: var(--main-color, #2c3e50);
}

.responsive-video-wrap.admin-resizable.resizing {
    border-color: var(--accent-color, #3498db);
    box-shadow: 0 0 20px rgba(52, 152, 219, 0.4);
}

.responsive-video-wrap.admin-resizable.resizing::before,
.responsive-video-wrap.admin-resizable.resizing::after,
.responsive-video-wrap.admin-resizable.resizing .resize-handle-nw,
.responsive-video-wrap.admin-resizable.resizing .resize-handle-ne,
.responsive-video-wrap.admin-resizable.resizing .resize-handle-sw,
.responsive-video-wrap.admin-resizable.resizing .resize-handle-se {
    opacity: 1;
    transform: scale(1.1);
}

.admin-resize-indicator {
    position: absolute;
    top: -30px;
    right: 0;
    background: var(--accent-color, #3498db);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    z-index: 11;
    white-space: nowrap;
}

.responsive-video-wrap.admin-resizable:hover .admin-resize-indicator {
    opacity: 1;
}

@media (max-width: 768px) {
    .responsive-video-wrap.admin-resizable::before,
    .responsive-video-wrap.admin-resizable::after,
    .responsive-video-wrap.admin-resizable .resize-handle-nw,
    .responsive-video-wrap.admin-resizable .resize-handle-ne,
    .responsive-video-wrap.admin-resizable .resize-handle-sw,
    .responsive-video-wrap.admin-resizable .resize-handle-se {
        width: 16px;
        height: 16px;
        border-width: 3px;
    }
    
    .admin-resize-indicator {
        font-size: 10px;
        padding: 3px 6px;
    }

    .pen-toolbar-float {
        right: 12px !important;
        left: auto !important;
        top: auto !important;
        bottom: 12px !important;
        transform: none !important;
        flex-direction: row;
        max-width: calc(100vw - 24px);
        max-height: 40px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 6px 8px;
    }
    .pen-toolbar-float.pen-toolbar {
        flex-wrap: nowrap;
    }
    .pen-toolbar-float .pen-tool-btn {
        min-width: 28px;
        height: 28px;
    }
}

    /* Move the floating pen toolbar down by 3cm so it doesn't cover the exit button. */
    .pen-toolbar-float {
        top: calc(50% - 3cm) !important;
        bottom: auto !important;
        transform: translateY(-50%) !important;
    }

    @media (max-width: 768px) {
        .pen-toolbar-float {
            top: auto !important;
            bottom: calc(12px + 3cm) !important;
            transform: none !important;
        }
    }

@media (max-width: 860px) {
    #pen-toolbar-float.pen-toolbar,
    .pen-toolbar-float.pen-toolbar {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-start !important;
        width: max-content !important;
        max-width: calc(100vw - 24px) !important;
        max-height: 44px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        white-space: nowrap !important;
    }
}

.stats-footer .video-fallback-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px 16px;
    background: #e67e22;
    color: white;
    border-radius: 10px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}

.stats-footer .video-fallback-link:hover {
    opacity: 0.92;
}

.word-pron-video-modal {
    position: fixed;
    inset: 0;
    z-index: 10060;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 12px;
    box-sizing: border-box;
}
.word-pron-video-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}
.word-pron-video-modal__panel {
    position: relative;
    z-index: 1;
    width: min(92vw, 440px);
    max-width: 100%;
    background: #0d0d0d;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
}
.word-pron-video-modal__close {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 3;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.word-pron-video-modal__close:hover {
    background: rgba(0, 0, 0, 0.75);
}
.word-pron-video-modal__player-root {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    height: 0;
    background: #000;
}
.word-pron-video-modal__player-root > div[id^="word-pron-yt-inner"] {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
}
.word-pron-video-modal__player-root iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
body.word-pron-modal-open {
    overflow: hidden;
}

#admin-tools {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin-bottom: 8px;
}
.btn-word-pron-mgmt {
    width: 100%;
    margin: 0;
    padding: 12px 16px;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(155, 89, 182, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}
.btn-word-pron-mgmt:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(155, 89, 182, 0.45);
}
.word-pron-mgmt-overlay {
    position: fixed;
    inset: 0;
    z-index: 10055;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 14px;
    box-sizing: border-box;
    background: rgba(15, 15, 20, 0.55);
    backdrop-filter: blur(4px);
}
.word-pron-mgmt-modal {
    width: min(96vw, 640px);
    max-height: min(88vh, 720px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(155, 89, 182, 0.35);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.word-pron-mgmt-title {
    margin: 0 0 8px 0;
    font-size: 1.15rem;
    color: #2c3e50;
}
.word-pron-mgmt-hint {
    margin: 0 0 12px 0;
    font-size: 0.78rem;
    color: #666;
    line-height: 1.45;
}
.word-pron-mgmt-list {
    flex: 1;
    overflow-y: auto;
    margin: 0 -4px;
    padding: 4px;
}
.word-pron-mgmt-section {
    margin-bottom: 18px;
}
.word-pron-mgmt-section-title {
    font-weight: 800;
    font-size: 0.9rem;
    color: var(--word-color, #e67e22);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 2px dashed #eee;
}
.word-pron-mgmt-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.word-pron-mgmt-word {
    flex: 0 1 140px;
    min-width: 80px;
    font-family: 'Traditional Arabic', serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: #2c3e50;
}
.word-pron-mgmt-url {
    flex: 1;
    min-width: 160px;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.78rem;
    box-sizing: border-box;
}
.word-pron-mgmt-url:focus {
    outline: none;
    border-color: var(--accent-color, #3498db);
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.15);
}
.word-pron-mgmt-empty,
.word-pron-mgmt-no-words {
    padding: 12px;
    color: #888;
    font-size: 0.85rem;
}
.word-pron-mgmt-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}
.btn-word-pron-mgmt-cancel {
    padding: 10px 18px;
    border-radius: 10px;
    border: 1px solid #ccc;
    background: #f8f9fa;
    cursor: pointer;
    font-weight: 600;
}
.btn-word-pron-mgmt-save {
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    background: var(--accent-color, #3498db);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}

.modal-overlay, .admin-sub-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
}

.modal-box {
    background: white;
    padding: 30px;
    border-radius: 20px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    text-align: center;
}

.subscription-modal h2 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.subscription-modal p {
    color: #555;
    margin-bottom: 20px;
}

.subscription-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.subscription-tabs button {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: #f0f0f0;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.subscription-tabs button.active {
    background: #2563eb;
    color: white;
}

.subscription-tabs button:hover {
    opacity: 0.9;
}

.subscription-modal input[type="email"],
.subscription-modal input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    margin: 10px 0;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    box-sizing: border-box;
    direction: ltr;
}

.subscription-modal input:focus {
    outline: none;
    border-color: #2563eb;
}

.subscription-modal .btn-main-add,
.subscription-modal .btn-del {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s ease;
}

.subscription-modal .btn-main-add {
    background: #27ae60;
    color: white;
}

.subscription-modal .btn-main-add:hover {
    background: #219a52;
}

.subscription-modal .google-login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 54px;
    margin-top: 12px;
    margin-bottom: 8px;
    background: #ffffff;
    color: #202124;
    border: 2px solid #d7dce3;
    box-shadow: 0 4px 12px rgba(32, 33, 36, 0.12);
    font-size: 16px;
    letter-spacing: 0.1px;
}

.subscription-modal .google-login-btn:hover {
    background: #f8fafc;
    border-color: #9aa0a6;
    box-shadow: 0 6px 16px rgba(32, 33, 36, 0.18);
    transform: translateY(-1px);
}

.subscription-modal .google-login-btn:focus-visible {
    outline: 3px solid rgba(66, 133, 244, 0.35);
    outline-offset: 2px;
}

.subscription-modal .google-login-btn:disabled {
    opacity: 0.65;
    cursor: wait;
    transform: none;
}

.google-brand-mark {
    flex: 0 0 30px;
    width: 30px;
    height: 30px;
    display: block;
    object-fit: contain;
}

.google-login-label {
    white-space: nowrap;
}

.subscription-modal .btn-del {
    background: #e74c3c;
    color: white;
}

.subscription-modal .btn-del:hover {
    background: #c0392b;
}

#paypal-button-container {
    margin: 15px 0;
    width: 100%;
}

.sub-list {
    text-align: right;
    margin-top: 20px;
}

.sub-list h3 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.sub-gate-modal,
.admin-sub-box,
.payment-result-box {
    direction: ltr;
    text-align: left;
}

.sub-gate-modal {
    max-width: 440px;
}

.sub-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    color: #94a3b8;
    cursor: pointer;
}

.sub-gate-modal,
.admin-sub-box {
    position: relative;
}

.sub-gate-header {
    text-align: center;
    margin-bottom: 18px;
}

.sub-gate-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 8px;
}

.sub-remember-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 4px;
    font-size: 0.9rem;
    color: #475569;
    cursor: pointer;
}

.sub-free-note {
    color: #64748b;
    font-size: 0.9rem;
    margin-top: 12px;
}

.sub-payment-note {
    font-size: 0.8rem;
    color: #94a3b8;
    text-align: center;
    margin-top: 10px;
}

.payment-result-box {
    text-align: center;
    max-width: 420px;
}

.payment-result-icon {
    font-size: 3.5rem;
    margin-bottom: 12px;
}

.admin-sub-box {
    max-width: 720px;
    width: 94%;
    max-height: 92vh;
    overflow-y: auto;
}

.admin-pay-settings {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 20px;
}

.admin-pay-settings h3 {
    margin: 0 0 12px;
    color: #1e293b;
}

.admin-settings-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px 12px;
    align-items: center;
    margin-bottom: 14px;
}

.admin-settings-grid input[type="text"],
.admin-settings-grid input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    box-sizing: border-box;
}

.admin-checkbox-label {
    align-self: center;
}

.admin-checkbox-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.admin-save-settings-btn {
    width: auto !important;
    min-width: 160px;
    margin-top: 0 !important;
}

.sub-user-row {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    margin: 10px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.sub-user-info {
    flex: 1;
    min-width: 220px;
    font-size: 0.88rem;
    line-height: 1.6;
    color: #334155;
}

.sub-user-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sub-btn-activate,
.sub-btn-deactivate,
.sub-btn-delete {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
}

.sub-btn-activate { background: #27ae60; color: #fff; }
.sub-btn-deactivate { background: #e67e22; color: #fff; }
.sub-btn-delete { background: #e74c3c; color: #fff; }

.sub-status-ok { color: #16a34a; font-weight: 600; }
.sub-status-fail { color: #dc2626; font-weight: 600; }
.sub-status-pending { color: #d97706; font-weight: 600; }

.admin-draggable {
    position: relative;
    cursor: default;
    user-select: none;
    transition: transform 0.12s ease, opacity 0.12s ease;
}

.admin-draggable.topbar-dragging {
    opacity: 0.8;
    z-index: 1100;
}

.nav-header-btn,
.nav-nav-btn,
.mini-arrow {
    cursor: pointer !important;
}

.topbar-control-label {
    display: inline-flex;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--main-color);
    white-space: nowrap;
}

.btn-admin-sub-header {
    background: #8e44ad !important;
    color: #fff !important;
    padding: 6px 12px !important;
    font-size: 0.72rem !important;
    font-weight: 700;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.admin-subscription-bar {
    display: flex;
    width: 100%;
    justify-content: center;
    margin-bottom: 10px;
}

.btn-admin-sub-panel {
    width: 100%;
    max-width: 480px;
    padding: 14px 20px;
    border: none;
    border-radius: 14px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    color: #fff;
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    box-shadow: 0 4px 14px rgba(142, 68, 173, 0.35);
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-admin-sub-panel:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(142, 68, 173, 0.45);
}

.btn-student-auth {
    background: #2563eb !important;
    color: #fff !important;
    padding: 6px 12px !important;
    font-size: 0.72rem !important;
    font-weight: 700;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.btn-student-logout {
    background: #e74c3c !important;
}

/* Golden Light responsive header */
.app-header {
    position: relative;
    width: calc(100% - 20px);
    max-width: 1400px;
    background: linear-gradient(135deg, #eef2ff 0%, #f5f7fa 48%, #e8eefb 100%);
    border: 1px solid #d5ddec;
    border-radius: 16px;
    padding: 8px 12px;
    margin: 8px auto 6px;
    box-shadow: 0 4px 14px rgba(71, 85, 105, .08), inset 0 1px 2px rgba(255, 255, 255, .85);
    overflow: visible;
}

.nav-bar {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
}

.gold-header-content {
    position: relative;
    width: 100%;
    max-width: 100%;
    text-align: center;
    overflow: visible;
}

.brand-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0 0 5px;
    direction: ltr;
    font-family: 'Cinzel Decorative', serif;
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: 1px;
    line-height: 1.15;
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 50%, #475569 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 1px 1px rgba(255, 255, 255, .8));
}

.brand-title h1 {
    margin: 0;
    font: inherit;
    color: inherit;
}

.brand-title > span {
    font-family: sans-serif;
    font-size: 1rem;
    -webkit-text-fill-color: initial;
}

.actions-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 0 0 5px;
    direction: ltr;
}

.actions-row .login-wrap {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 6px;
}

.home-page-btn {
    padding: 5px 13px;
    border: 1.5px solid #d4af37;
    border-radius: 30px;
    background: linear-gradient(180deg, #fff 0%, #fbe8bd 100%);
    color: #5c420b;
    font-family: 'Cairo', sans-serif;
    font-size: .72rem;
    font-weight: 700;
    box-shadow: 0 3px 8px rgba(184, 134, 11, .2);
}

.home-page-btn:hover {
    background: linear-gradient(180deg, #fff 0%, #f7d893 100%);
    transform: translateY(-2px);
}

.btn-student-auth {
    padding: 6px 13px !important;
    border-radius: 30px;
    background: linear-gradient(180deg, #fff 0%, #fbe8bd 100%) !important;
    border: 1.5px solid #d4af37 !important;
    color: #5c420b !important;
    font-family: 'Cairo', sans-serif;
    font-size: .72rem !important;
    box-shadow: 0 3px 8px rgba(184, 134, 11, .2);
}

.header-google-auth {
    gap: 6px;
    background: #fff !important;
    color: #202124 !important;
    border-color: #9aa0a6 !important;
}

.header-google-auth img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.feature-strip {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    padding: 5px 10px;
    border: 1px solid #d5ddec;
    border-radius: 14px;
    background: linear-gradient(90deg, rgba(255,255,255,.52), rgba(238,242,255,.68), rgba(255,255,255,.52));
    box-shadow: inset 0 1px 3px rgba(255, 255, 255, .9);
    direction: ltr;
}

.feature-item {
    color: #64748b;
    font-family: 'Cairo', sans-serif;
    font-size: .68rem;
    font-weight: 700;
    line-height: 1.25;
}

.dot-separator {
    color: #94a3b8;
    font-size: .65rem;
}

@media (max-width: 560px) {
    .app-header { width: calc(100% - 12px); border-radius: 12px; padding: 6px 7px; margin-top: 6px; }
    .brand-title { font-size: .82rem; letter-spacing: .5px; }
    .brand-title > span { font-size: .85rem; }
    .actions-row { gap: 5px; }
    .home-page-btn, .btn-student-auth { padding: 4px 9px !important; font-size: .64rem !important; }
    .feature-strip { gap: 4px; padding: 4px 6px; }
    .feature-item { font-size: .58rem; }
    .dot-separator { font-size: .55rem; }
}

.admin-paypal-hint {
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.5;
    margin: 0 0 12px;
}

/* Keep the supplied manuscript layout responsive without affecting admin controls. */
@media (max-width: 860px) {
    #main-content:has(.prophet-sub-card) > .card {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 18px 30px !important;
        margin: 0 !important;
    }

    #main-content:has(.prophet-sub-card) {
        display: flex !important;
        gap: 18px !important;
        padding: 40px 20px !important;
    }

    .prophet-sub-card {
        display: flex !important;
        flex-direction: row !important;
    }

    .prophet-sub-card .card-title { font-size: 28px; }
}

@media (max-width: 600px) {
    .prophet-sub-card,
    .prophet-word-card,
    .prophet-content-card {
        height: auto !important;
        min-height: 118px !important;
        max-height: none !important;
        padding: 18px 14px !important;
    }

    .prophet-sub-card .card-title,
    .prophet-word-card .card-title,
    .prophet-content-card .card-title {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        font-size: clamp(22px, 7vw, 30px) !important;
        line-height: 1.35 !important;
        white-space: normal !important;
        overflow-wrap: anywhere !important;
        word-break: normal !important;
        text-align: center !important;
    }

    .prophet-sub-card__admin-tools {
        top: 4px;
        left: 4px;
        transform: scale(.85);
        transform-origin: top left;
    }
}

@media (max-width: 560px) {
    .prophet-sub-card {
        flex-direction: column !important;
        text-align: center;
    }

    .prophet-sub-card .card-title { font-size: 26px; }
}

@media (max-width: 860px) {
    #main-content:has(.quran-exam-card) {
        gap: 20px !important;
        padding: 40px 20px !important;
    }

    #main-content:has(.quran-exam-card) > .quran-exam-card {
        width: 100% !important;
        max-width: 850px !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 24px 30px !important;
    }
}

@media (max-width: 560px) {
    #main-content:has(.quran-exam-card) > .quran-exam-card {
        padding: 20px !important;
    }

    .quran-exam-card__title { font-size: 21px; }
    .quran-exam-card__description { font-size: 14px; }
    .quran-exam-card__footer { align-items: flex-start; flex-direction: column; gap: 8px; }
}
