


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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: #0f1729;
    color: #fff;
    overflow: hidden;
    height: 100vh;
}


.game-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}


.sidebar {
    width: 238px;
    min-width: 238px;
    background:
        radial-gradient(130% 42% at 50% -10%, rgba(var(--accent-rgb),0.34), transparent 70%),
        linear-gradient(180deg, #18213b, #0b1120);
    display: flex;
    flex-direction: column;
    padding: 14px 12px;
    z-index: 10;
    border-right: 3px solid rgba(0,0,0,0.40);
    box-shadow: inset -1px 0 0 rgba(var(--accent-rgb),0.40), inset 4px 0 8px rgba(0,0,0,0.25);
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 6px 4px 14px;
    border-bottom: 2px dashed rgba(var(--accent-rgb),0.35);
    margin-bottom: 12px;
}
.sidebar-lesson-no {
    font-family: 'Baloo 2', sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    color: #fff;
    background: linear-gradient(180deg, rgba(var(--accent-rgb),1), rgba(var(--accent-rgb),0.65));
    padding: 10px 12px;
    border-radius: 14px;
    letter-spacing: 0.5px;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.28);
    box-shadow: 0 4px 0 rgba(0,0,0,0.30), 0 6px 14px rgba(var(--accent-rgb),0.45), inset 0 2px 0 rgba(255,255,255,0.35);
    text-shadow: 0 2px 0 rgba(0,0,0,0.25);
}
.sidebar-titles { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sidebar-title {
    font-family: 'Baloo 2', sans-serif;
    color: #fff; font-weight: 800; font-size: 1.02rem; line-height: 1.12;
    text-shadow: 0 2px 0 rgba(0,0,0,0.30);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-title-ur {
    font-family: 'Noto Nastaliq Urdu', serif;
    color: rgba(var(--accent-rgb),1);
    font-size: 0.82rem; line-height: 2.1; direction: rtl;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    padding-bottom: 3px;
    filter: brightness(1.45);
}


.stage-list { flex: 1; display: flex; flex-direction: column; gap: 7px; overflow-y: auto; padding: 2px 2px 4px; }

.stage-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 14px;
    cursor: pointer;
    position: relative;
    text-decoration: none;
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
    border: 2px solid rgba(0,0,0,0.28);
    box-shadow: 0 3px 0 rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.07);
    transition: transform 0.12s, box-shadow 0.12s, background 0.2s;
}
.stage-item:hover { transform: translateY(-1px); background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.03)); }
.stage-item:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.22); }

.stage-num {
    width: 26px; height: 26px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: 'Baloo 2', sans-serif; font-weight: 800; font-size: 0.82rem;
    border-radius: 50%;
    background: linear-gradient(180deg, #2d3958, #1b2540);
    color: rgba(255,255,255,0.6);
    border: 2px solid rgba(0,0,0,0.30);
    box-shadow: inset 0 2px 0 rgba(255,255,255,0.14);
}
.stage-item .stage-item-icon { font-size: 1.2rem; flex-shrink: 0; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.45)); }
.stage-item .stage-item-name {
    font-family: 'Baloo 2', sans-serif;
    font-size: 0.88rem; font-weight: 700; color: rgba(255,255,255,0.62);
    text-shadow: 0 1px 0 rgba(0,0,0,0.35);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.stage-item.active {
    background: linear-gradient(180deg, rgba(var(--accent-rgb),0.95), rgba(var(--accent-rgb),0.55));
    border-color: rgba(255,255,255,0.40);
    box-shadow: 0 4px 0 rgba(0,0,0,0.30), 0 7px 18px rgba(var(--accent-rgb),0.50), inset 0 2px 0 rgba(255,255,255,0.35);
    transform: translateY(-1px);
}
.stage-item.active .stage-item-name { color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,0.28); }
.stage-item.active .stage-num { background: #fff; color: var(--accent); border-color: rgba(255,255,255,0.7); }

.stage-item .check {
    margin-left: auto;
    color: #7CFFB0;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s;
    text-shadow: 0 1px 0 rgba(0,0,0,0.4);
}
.stage-item.done .check { opacity: 1; }
.stage-item.done .stage-num { background: linear-gradient(180deg, #2ee06e, #1c9e4d); color: #fff; border-color: rgba(255,255,255,0.4); }


.stage-item.locked { opacity: 0.4; filter: grayscale(1); cursor: not-allowed; }
.stage-item.locked:hover { transform: none; background: none; }
.stage-item.locked .check { display: none; }
.stage-item.locked::after { content: '\1F512'; margin-left: auto; font-size: 0.82rem; line-height: 1; }


#lockToast {
    position: fixed; left: 50%; bottom: 78px; transform: translate(-50%, 10px);
    background: rgba(12,20,38,0.96); color: #fff; border: 1px solid rgba(255,255,255,0.16);
    border-radius: 14px; padding: 10px 18px; font-size: 0.9rem; font-weight: 700;
    z-index: 2147483090; opacity: 0; pointer-events: none;
    transition: opacity 0.2s, transform 0.2s; max-width: 80vw; text-align: center;
}
#lockToast.show { opacity: 1; transform: translate(-50%, 0); }


.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 2px dashed rgba(var(--accent-rgb),0.30); display: flex; flex-direction: column; gap: 10px; }

.btn-save {
    width: 100%;
    padding: 12px;
    border: 2px solid rgba(255,255,255,0.28);
    border-radius: 13px;
    background: linear-gradient(180deg, rgba(var(--accent-rgb),1), rgba(var(--accent-rgb),0.65));
    color: #fff;
    font-family: 'Baloo 2', sans-serif;
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
    cursor: pointer;
    text-shadow: 0 2px 0 rgba(0,0,0,0.25);
    box-shadow: 0 5px 0 rgba(0,0,0,0.30), 0 8px 16px rgba(var(--accent-rgb),0.4), inset 0 2px 0 rgba(255,255,255,0.35);
    transition: transform 0.1s, box-shadow 0.1s, filter 0.15s;
}
.btn-save:hover { filter: brightness(1.06); }
.btn-save:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,0.30), inset 0 2px 0 rgba(255,255,255,0.25); }

.btn-dashboard {
    display: block;
    text-align: center;
    padding: 11px;
    border-radius: 13px;
    background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.03));
    color: rgba(255,255,255,0.7);
    font-family: 'Baloo 2', sans-serif;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    border: 2px solid rgba(0,0,0,0.28);
    box-shadow: 0 4px 0 rgba(0,0,0,0.22), inset 0 1px 0 rgba(255,255,255,0.08);
    text-shadow: 0 1px 0 rgba(0,0,0,0.3);
    transition: transform 0.1s, box-shadow 0.1s, filter 0.15s;
}
.btn-dashboard:hover { color: #fff; filter: brightness(1.1); }
.btn-dashboard:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,0.22); }

.sidebar-brand {
    text-align: center;
    font-family: 'Baloo 2', sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    color: rgba(255,255,255,0.4);
    margin-top: 2px;
    display: flex; align-items: center; justify-content: center; gap: 5px;
}
.brand-part {
    font-size: 0.56rem; letter-spacing: 1px; font-weight: 800;
    background: rgba(var(--accent-rgb),0.28); color: #fff;
    padding: 2px 6px; border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
}

.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; }
.user-name { font-size: 0.82rem; font-weight: 700; }
.user-badge { font-size: 0.65rem; color: rgba(255,255,255,0.4); letter-spacing: 0.5px; }
.sidebar-icon { font-size: 1.3rem; }


.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}


.top-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 9px 16px;
    background: linear-gradient(180deg, #141d33, #0e1526);
    border-bottom: 3px solid rgba(0,0,0,0.40);
    box-shadow: 0 3px 0 rgba(var(--accent-rgb),0.35), 0 8px 20px rgba(0,0,0,0.35);
    z-index: 5;
}


.tb-game { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.tb-icon {
    font-size: 1.55rem; line-height: 1;
    width: 46px; height: 46px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(180deg, rgba(var(--accent-rgb),0.55), rgba(var(--accent-rgb),0.15));
    border: 2px solid rgba(255,255,255,0.25);
    box-shadow: 0 4px 0 rgba(0,0,0,0.28), 0 6px 14px rgba(var(--accent-rgb),0.4), inset 0 2px 0 rgba(255,255,255,0.30);
}

img.tb-icon { object-fit: contain; padding: 3px; }
img.stage-item-icon { width: 2.2rem; height: 2.2rem; object-fit: contain; }

.splash-img { width: min(190px, 40vw); height: auto; display: block; margin: 0 auto 6px; filter: drop-shadow(0 8px 20px rgba(0,0,0,0.5)); }
.splash-img.splash-sm { width: min(120px, 26vw); }
@media (max-height: 520px) { .splash-img { width: min(120px, 22vh); } .splash-img.splash-sm { width: min(90px, 18vh); } }
.tb-titles { display: flex; flex-direction: column; gap: 0; }
.tb-name {
    font-family: 'Baloo 2', sans-serif;
    font-weight: 800; font-size: 1.18rem; line-height: 1.05; color: #fff;
    letter-spacing: 0.3px; text-shadow: 0 2px 0 rgba(0,0,0,0.35);
}
.tb-crumb {
    font-family: 'Baloo 2', sans-serif;
    font-size: 0.72rem; font-weight: 600;
    color: rgba(var(--accent-rgb),1); letter-spacing: 0.3px; filter: brightness(1.35);
}


.tb-lesson {
    display: flex; flex-direction: column; align-items: flex-end; gap: 0;
    margin-left: auto; text-align: right; min-width: 0;
}
.tb-lesson-en {
    font-family: 'Baloo 2', sans-serif;
    font-weight: 700; font-size: 0.9rem; color: #fff; text-shadow: 0 1px 0 rgba(0,0,0,0.3);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px;
}
.tb-lesson-ur {
    font-family: 'Noto Nastaliq Urdu', serif;
    font-size: 0.82rem; color: rgba(var(--accent-rgb),1); direction: rtl;
    line-height: 2.1; filter: brightness(1.45);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 240px;
    padding-bottom: 3px;
}


.progress-track {
    width: 170px; flex-shrink: 0;
    height: 16px;
    background: linear-gradient(180deg, #0a0f1c, #131c30);
    border-radius: 9px;
    overflow: hidden;
    border: 2px solid rgba(0,0,0,0.45);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.6);
    position: relative;
}
.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(180deg, rgba(var(--accent-rgb),1), rgba(var(--accent-rgb),0.6));
    border-radius: 7px;
    box-shadow: 0 0 10px rgba(var(--accent-rgb),0.8), inset 0 2px 0 rgba(255,255,255,0.4);
    transition: width 0.5s ease;
    position: relative;
}
.progress-fill::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.45), transparent);
    transform: translateX(-100%);
    animation: xpShine 2.4s ease-in-out infinite;
}
@keyframes xpShine { 0% { transform: translateX(-100%);} 55%,100% { transform: translateX(340%);} }


.stage-badge {
    display: flex; align-items: baseline; gap: 1px;
    background: linear-gradient(180deg, rgba(var(--accent-rgb),1), rgba(var(--accent-rgb),0.6));
    padding: 7px 13px;
    border-radius: 12px;
    font-family: 'Baloo 2', sans-serif;
    white-space: nowrap; flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.28);
    box-shadow: 0 4px 0 rgba(0,0,0,0.28), 0 6px 12px rgba(var(--accent-rgb),0.4), inset 0 2px 0 rgba(255,255,255,0.35);
    color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,0.25);
}
.stage-badge .sb-num { font-size: 1.05rem; font-weight: 800; }
.stage-badge .sb-tot { font-size: 0.72rem; font-weight: 700; opacity: 0.85; }


.game-canvas {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}


.bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: linear-gradient(0deg, #141d33, #0e1526);
    border-top: 3px solid rgba(0,0,0,0.40);
    box-shadow: 0 -3px 0 rgba(var(--accent-rgb),0.30), 0 -8px 20px rgba(0,0,0,0.30);
    z-index: 5;
}

.btn-nav {
    padding: 11px 28px;
    border: 2px solid rgba(0,0,0,0.28);
    border-radius: 13px;
    background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04));
    color: rgba(255,255,255,0.75);
    font-family: 'Baloo 2', sans-serif;
    font-weight: 800;
    font-size: 0.9rem;
    letter-spacing: 0.3px;
    cursor: pointer;
    text-decoration: none;
    text-shadow: 0 1px 0 rgba(0,0,0,0.35);
    box-shadow: 0 4px 0 rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.10);
    transition: transform 0.1s, box-shadow 0.1s, filter 0.15s;
}
.btn-nav:hover { color: #fff; filter: brightness(1.12); }
.btn-nav:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,0.25); }
.btn-nav:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-next {
    background: linear-gradient(180deg, rgba(var(--accent-rgb),1), rgba(var(--accent-rgb),0.6));
    border-color: rgba(255,255,255,0.28);
    color: #fff;
    box-shadow: 0 5px 0 rgba(0,0,0,0.28), 0 8px 16px rgba(var(--accent-rgb),0.45), inset 0 2px 0 rgba(255,255,255,0.35);
}
.btn-next:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0,0,0,0.28), inset 0 2px 0 rgba(255,255,255,0.25); }
.btn-finish {
    background: linear-gradient(180deg, #ffd83b, #e0a90c);
    border-color: rgba(255,255,255,0.4);
    color: #4a2f00;
    text-shadow: 0 1px 0 rgba(255,255,255,0.4);
    box-shadow: 0 5px 0 rgba(120,80,0,0.5), 0 8px 16px rgba(241,196,15,0.45), inset 0 2px 0 rgba(255,255,255,0.5);
}
.btn-finish:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(120,80,0,0.5); }

.stage-name {
    font-family: 'Baloo 2', sans-serif;
    font-size: 0.9rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-shadow: 0 2px 0 rgba(0,0,0,0.4), 0 0 12px rgba(var(--accent-rgb),0.7);
    opacity: 0.92;
}


.stage-frame-zone {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #05070d;
    min-height: 0;
}
#stageFrame {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #05070d;
}
.frame-loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: radial-gradient(circle at 50% 42%, rgba(var(--accent-rgb),0.16), transparent 60%),
                linear-gradient(180deg, #0e1526, #0a0f1c);
    z-index: 20;
    transition: opacity 0.35s ease;
}
.frame-loader.hidden { opacity: 0; pointer-events: none; }
.frame-spinner {
    width: 54px; height: 54px; border-radius: 50%;
    border: 5px solid rgba(var(--accent-rgb),0.22);
    border-top-color: var(--accent);
    box-shadow: 0 0 22px rgba(var(--accent-rgb),0.45);
    animation: spin 0.8s linear infinite;
}
.frame-loader-text {
    font-family: 'Baloo 2', sans-serif; font-weight: 700; font-size: 0.9rem;
    letter-spacing: 2px; text-transform: uppercase;
    color: rgba(255,255,255,0.78);
    text-shadow: 0 2px 0 rgba(0,0,0,0.4);
}
@keyframes spin { to { transform: rotate(360deg); } }


body.embedded { background: #000; }
.embedded .game-container { height: 100vh; width: 100vw; }
.embedded .bottom-bar { display: none !important; }
.embedded .game-canvas { flex: 1; }


.loading-screen {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 16px; color: rgba(255,255,255,0.5);
}
.loader {
    width: 40px; height: 40px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }




.game-canvas.stage-1 {
    background: linear-gradient(180deg, #1a0533 0%, #2d1b4e 40%, #4a2d6e 100%);
}


.game-canvas.stage-2 {
    background: linear-gradient(180deg, #87CEEB 0%, #5DADE2 40%, #2E86C1 70%, #4a7a3a 85%, #3d6b2e 100%);
}


.game-canvas.stage-3 {
    background: linear-gradient(180deg, #0a1628 0%, #1a2a4a 50%, #0d3b2e 100%);
}


.game-canvas.stage-4 {
    background: linear-gradient(180deg, #0a0a2e 0%, #1a1a4e 50%, #0a0a2e 100%);
}


.game-canvas.stage-5 {
    background: linear-gradient(180deg, #0a3d5c 0%, #0d6e8a 30%, #0a8a7a 60%, #0d5e4a 100%);
}


.game-canvas.stage-6 {
    background: linear-gradient(180deg, #0a0a3a 0%, #1a1a5a 40%, #2a0a4a 100%);
}


.game-canvas.stage-7 {
    background: linear-gradient(180deg, #1a0a2e 0%, #2d1b4e 40%, #1a0a2e 100%);
}




.instruction {
    background: rgba(255,255,255,0.95);
    color: #1a1a2e;
    padding: 10px 28px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.92rem;
    margin: 16px 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    text-align: center;
}


.badge-score, .badge-timer {
    position: absolute;
    top: 16px;
    background: rgba(0,0,0,0.4);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
}
.badge-score { right: 20px; color: #f1c40f; border: 2px solid #f1c40f; }
.badge-timer { right: 20px; color: #e74c3c; border: 2px solid #e74c3c; }


.lives { position: absolute; top: 16px; right: 20px; font-size: 1.2rem; display: flex; gap: 4px; }


.urdu-prompt {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(0,0,0,0.25);
    border-radius: 20px;
    padding: 16px 30px;
    margin: 12px 0;
}
.urdu-prompt .emoji { font-size: 2.6rem; }
.urdu-prompt .urdu-text {
    color: #fff;
    font-size: 1.6rem;
    font-weight: 700;
    direction: rtl;
    font-family: 'Noto Nastaliq Urdu', serif;
}


.btn-audio {
    width: 48px; height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.btn-audio:hover { background: rgba(255,255,255,0.15); transform: scale(1.1); }


.sentence-display {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 16px 24px;
    background: rgba(0,0,0,0.3);
    border-radius: 16px;
    margin: 10px 0;
}
.sentence-display .word {
    font-size: 1.5rem;
    font-weight: 700;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.word.subject    { color: #4A90D9; }
.word.verb       { color: #27AE60; }
.word.complement { color: #E67E22; }


.color-legend {
    display: flex;
    gap: 14px;
    font-size: 0.72rem;
    margin-top: 6px;
}
.color-legend span::before { content: '● '; }
.color-legend .l-subject    { color: #4A90D9; }
.color-legend .l-verb       { color: #27AE60; }
.color-legend .l-complement { color: #E67E22; }


.flashcard-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding: 20px;
}

.flashcard {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 24px;
    padding: 30px 50px;
    display: flex;
    align-items: center;
    gap: 40px;
    min-width: 400px;
    backdrop-filter: blur(5px);
}
.flashcard .card-image {
    width: 120px;
    height: 120px;
    border-radius: 20px;
    background: linear-gradient(135deg, #f5e6d3, #ffd9b3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}
.flashcard .card-text { display: flex; flex-direction: column; gap: 4px; }
.flashcard .card-label { color: #aaa; font-size: 0.85rem; }
.flashcard .card-urdu {
    color: #fff;
    font-size: 1.7rem;
    font-weight: 700;
    direction: rtl;
    font-family: 'Noto Nastaliq Urdu', serif;
}

.card-dots {
    display: flex;
    gap: 8px;
    margin: 14px 0;
}
.card-dots .dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    transition: background 0.3s;
    cursor: pointer;
}
.card-dots .dot.active { background: #9B59B6; }

.card-arrows {
    display: flex;
    gap: 20px;
}
.card-arrows button {
    width: 44px; height: 44px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.06);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
}
.card-arrows button:hover { background: rgba(255,255,255,0.15); }


.drop-zone {
    display: flex;
    gap: 10px;
    min-height: 60px;
    padding: 14px 20px;
    border-radius: 16px;
    background: rgba(0,0,0,0.2);
    border: 2px dashed rgba(255,255,255,0.15);
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin: 16px 0;
    min-width: 350px;
    transition: border-color 0.2s;
}
.drop-zone.drag-over { border-color: #3498db; background: rgba(52,152,219,0.1); }

.word-bank {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 20px;
    background: rgba(0,0,0,0.15);
    border-radius: 20px;
    border: 1px dashed rgba(255,255,255,0.1);
    margin-top: 20px;
    max-width: 500px;
}
.word-bank-label {
    width: 100%;
    text-align: center;
    color: rgba(255,255,255,0.3);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.word-block {
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    cursor: grab;
    border: 2px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    user-select: none;
    transition: transform 0.15s, opacity 0.2s;
}
.word-block:active { cursor: grabbing; transform: scale(1.05); }
.word-block.dragging { opacity: 0.5; }
.word-block.placed { opacity: 0.4; pointer-events: none; }

.word-block.role-subject    { background: linear-gradient(135deg, #4A90D9, #357ABD); }
.word-block.role-verb       { background: linear-gradient(135deg, #27AE60, #1E8449); }
.word-block.role-complement { background: linear-gradient(135deg, #E67E22, #D35400); }
.word-block.role-distractor { background: linear-gradient(135deg, #7F8C8D, #616A6B); }


.drop-slot {
    min-width: 70px;
    min-height: 44px;
    border: 2px dashed rgba(255,255,255,0.2);
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    font-size: 1.05rem;
    font-weight: 700;
    color: rgba(255,255,255,0.2);
    transition: all 0.2s;
}
.drop-slot.filled {
    border-style: solid;
    border-color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: #fff;
}


.gap-sentence {
    font-size: 1.7rem;
    font-weight: 700;
    text-align: center;
    padding: 24px 40px;
    background: rgba(255,255,255,0.06);
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.1);
    margin: 20px 0;
}
.gap-blank {
    display: inline-block;
    min-width: 80px;
    padding: 4px 18px;
    border: 2px dashed #27AE60;
    border-radius: 10px;
    background: rgba(39,174,96,0.15);
    color: #27AE60;
    margin: 0 4px;
    text-align: center;
}

.options-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 24px;
}

.option-btn {
    padding: 14px 32px;
    border-radius: 14px;
    border: 2px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-weight: 700;
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 90px;
    text-align: center;
}
.option-btn:hover { background: rgba(255,255,255,0.15); border-color: rgba(255,255,255,0.3); }

.option-btn.correct {
    background: linear-gradient(135deg, #27AE60, #1E8449);
    border-color: #2ECC71;
    animation: popIn 0.3s ease;
}
.option-btn.wrong {
    background: linear-gradient(135deg, #E74C3C, #C0392B);
    border-color: #E74C3C;
    animation: shake 0.4s ease;
}


.blaster-area {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.floating-sentence {
    position: absolute;
    padding: 14px 28px;
    border-radius: 14px;
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    transition: transform 0.1s, opacity 0.3s;
    animation: floatIn 0.6s ease;
}
.floating-sentence:hover { transform: scale(1.05); }

.floating-sentence.correct-sentence {
    background: rgba(39,174,96,0.12);
    border: 2px solid rgba(39,174,96,0.4);
    color: #fff;
}
.floating-sentence.wrong-sentence {
    background: rgba(231,76,60,0.12);
    border: 2px solid rgba(231,76,60,0.4);
    color: #fff;
}
.floating-sentence.tapped-correct {
    background: rgba(39,174,96,0.5) !important;
    border-color: #2ecc71 !important;
    animation: popIn 0.3s ease;
}
.floating-sentence.tapped-wrong {
    background: rgba(231,76,60,0.5) !important;
    border-color: #e74c3c !important;
    animation: shake 0.4s ease;
}


.star-particle {
    position: absolute;
    pointer-events: none;
    font-size: 1.2rem;
    animation: starBurst 0.6s ease forwards;
}


.swim-area {
    position: relative;
    width: 100%;
    flex: 1;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.25);
    transition: transform 0.15s;
    animation: bobble 3s ease-in-out infinite;
}
.bubble:hover { transform: scale(1.15); }
.bubble.popped {
    animation: pop 0.3s ease forwards;
    pointer-events: none;
}

.sentence-bar {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 12px;
    background: rgba(0,0,0,0.3);
    border-radius: 14px;
    margin: 10px 20px;
    min-height: 50px;
    align-items: center;
}
.sentence-bar .slot {
    padding: 8px 16px;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.3);
    font-weight: 700;
    font-size: 1rem;
    min-width: 50px;
    text-align: center;
}
.sentence-bar .slot.filled {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.3);
    color: #fff;
}


.translator-prompt {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 24px 40px;
    text-align: center;
    margin: 20px 0;
}
.translator-prompt .prompt-label {
    color: rgba(255,255,255,0.35);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
}
.translator-prompt .prompt-urdu {
    color: #fff;
    font-size: 2rem;
    font-weight: 700;
    direction: rtl;
    font-family: 'Noto Nastaliq Urdu', serif;
}

.answer-zone {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 14px;
    background: rgba(0,0,0,0.2);
    border-radius: 14px;
    border: 2px dashed rgba(255,255,255,0.12);
    min-height: 56px;
    min-width: 300px;
    margin: 12px 0;
    align-items: center;
}

.answer-chip {
    padding: 10px 18px;
    border-radius: 10px;
    background: rgba(26,188,156,0.2);
    border: 1px solid rgba(26,188,156,0.4);
    color: #fff;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
}
.answer-chip:hover { background: rgba(26,188,156,0.3); }

.word-chips {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 16px 24px;
    background: rgba(255,255,255,0.04);
    border-radius: 20px;
    max-width: 480px;
    margin-top: 16px;
}

.chip {
    padding: 10px 18px;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}
.chip:hover { background: rgba(255,255,255,0.15); }
.chip.used { opacity: 0.3; pointer-events: none; }


.test-header {
    text-align: center;
    margin: 12px 0;
}
.test-header .trophy { font-size: 2rem; }
.test-header .test-title {
    color: #F1C40F;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.test-progress {
    display: flex;
    gap: 6px;
    margin: 10px 0;
}
.test-progress .pip {
    width: 40px;
    height: 6px;
    border-radius: 3px;
    background: rgba(255,255,255,0.12);
    transition: background 0.3s;
}
.test-progress .pip.pass { background: #27AE60; }
.test-progress .pip.fail { background: #E74C3C; }
.test-progress .pip.current { background: #F1C40F; }

.test-question-type {
    color: rgba(255,255,255,0.4);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.test-stats {
    display: flex;
    gap: 30px;
    margin-top: 16px;
}
.test-stats .stat { text-align: center; }
.test-stats .stat-num { font-weight: 800; font-size: 1.3rem; }
.test-stats .stat-label { color: rgba(255,255,255,0.4); font-size: 0.7rem; }
.stat-num.green { color: #27AE60; }
.stat-num.red { color: #E74C3C; }
.stat-num.gold { color: #F1C40F; }


.feedback-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    z-index: 20;
    animation: fadeIn 0.3s ease;
}
.feedback-overlay .fb-icon { font-size: 4rem; margin-bottom: 12px; }
.feedback-overlay .fb-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 8px;
}
.feedback-overlay .fb-subtitle { color: rgba(255,255,255,0.6); font-size: 0.95rem; }
.feedback-overlay .fb-btn {
    margin-top: 24px;
    padding: 12px 36px;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    color: #fff;
}
.fb-btn.success { background: linear-gradient(135deg, #27AE60, #1E8449); }
.fb-btn.retry   { background: linear-gradient(135deg, #E74C3C, #C0392B); }


@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn   { 0% { transform: scale(0.8); } 50% { transform: scale(1.1); } 100% { transform: scale(1); } }
@keyframes shake   { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes floatIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bobble  { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes pop     { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes starBurst { 0% { transform: translate(0,0) scale(1); opacity: 1; } 100% { transform: translate(var(--tx), var(--ty)) scale(0); opacity: 0; } }


@media (max-width: 768px) {
    
    .sidebar { width: 58px; min-width: 58px; padding: 10px 4px; }
    .sidebar-header { justify-content: center; padding: 0 0 12px; }
    .sidebar-titles, .btn-dashboard, .sidebar-brand,
    .stage-item .stage-item-name, .stage-item .check { display: none; }
    .stage-item { justify-content: center; padding: 9px 6px; gap: 0; }
    .stage-item .stage-num { display: none; }
    .stage-item .stage-item-icon { font-size: 1.4rem; }
    .sidebar-lesson-no { padding: 7px 8px; font-size: 0.78rem; }
    .btn-save { font-size: 0; padding: 11px 0; }
    .btn-save::before { content: '💾'; font-size: 1.2rem; }

    
    .top-bar { gap: 10px; padding: 8px 12px; }
    .tb-game { min-width: 0; flex-shrink: 1; }
    .tb-titles { min-width: 0; }
    .tb-icon { width: 38px; height: 38px; font-size: 1.25rem; border-radius: 11px; }
    .tb-name { font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .tb-crumb { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .tb-lesson { display: none; }
    .progress-track { width: auto; flex: 1; min-width: 40px; }

    .bottom-bar { padding: 8px 12px; }
    .btn-nav { padding: 9px 20px; font-size: 0.82rem; }
    .stage-name { font-size: 0.72rem; letter-spacing: 1px; }

    .flashcard { flex-direction: column; min-width: auto; padding: 20px; }
}



.menu-btn {
    position: fixed; left: 12px; bottom: 64px; z-index: 100002;
    width: 46px; height: 46px; border-radius: 14px;
    border: 2px solid rgba(255,255,255,0.28); background: rgba(10,16,28,0.72);
    color: #fff; font-size: 1.45rem; line-height: 1; cursor: pointer;
    display: none; align-items: center; justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.menu-btn:active { transform: scale(0.94); }
.drawer-backdrop {
    position: fixed; inset: 0; z-index: 100000; background: rgba(0,0,0,0.5);
    opacity: 0; pointer-events: none; transition: opacity 0.25s;
    -webkit-backdrop-filter: blur(1px); backdrop-filter: blur(1px);
}
body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }

@media (pointer: coarse) {
    .menu-btn { display: flex; }

    
    .sidebar {
        position: fixed; left: 0; top: 0; height: 100%; height: 100dvh;
        width: min(88vw, 330px); min-width: 0;
        padding: 12px 12px calc(14px + env(safe-area-inset-bottom, 0px));
        transform: translateX(-100%); transition: transform 0.28s cubic-bezier(0.4,0,0.2,1);
        z-index: 100001; overflow-y: auto; box-shadow: 6px 0 26px rgba(0,0,0,0.55);
    }
    body.drawer-open .sidebar { transform: translateX(0); }
    .sidebar-header { padding: 2px 2px 10px; margin-bottom: 10px; }
    .sidebar-titles { display: flex; }
    .sidebar-title  { font-size: 0.92rem; }

    
    .stage-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 2px; overflow: visible; }
    .stage-item { flex-direction: column; justify-content: center; align-items: center; gap: 4px; padding: 11px 4px 8px; text-align: center; min-height: 68px; }
    .stage-item .stage-num       { display: flex; position: absolute; top: 4px; left: 4px; width: 17px; height: 17px; font-size: 0.56rem; }
    .stage-item .stage-item-icon { display: block; font-size: 1.75rem; }
    .stage-item .stage-item-name { display: block; font-size: 0.6rem; line-height: 1.12; white-space: normal; max-height: 2.3em; overflow: hidden; }
    .stage-item .check           { display: block; position: absolute; top: 3px; right: 5px; margin: 0; font-size: 0.72rem; }

    
    .sidebar-footer { flex-direction: row; flex-wrap: wrap; gap: 8px; }
    .btn-save       { display: block; flex: 1 1 45%; font-size: 0.78rem; padding: 11px 8px; }
    .btn-save::before { content: none; }
    .btn-dashboard  { display: block; flex: 1 1 45%; font-size: 0.76rem; padding: 11px 8px; }
    .sidebar-brand  { display: flex; width: 100%; }
}

body.fs-on .menu-btn { display: flex; bottom: 12px; }
body.fs-on.drawer-open .sidebar { display: flex !important; }



.fs-btn {
    position: fixed; right: 12px; bottom: 64px; z-index: 99999;
    width: 46px; height: 46px; border-radius: 14px;
    border: 2px solid rgba(255,255,255,0.28); background: rgba(10,16,28,0.72);
    color: #fff; font-size: 1.35rem; line-height: 1; cursor: pointer;
    display: none; align-items: center; justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.fs-btn:active { transform: scale(0.94); }

@media (pointer: coarse) and (orientation: landscape) { body:not(.portrait-stage) .fs-btn { display: flex; } }

@media (pointer: coarse) and (orientation: portrait)  { body.portrait-stage .fs-btn { display: flex; } }


body.fs-on .top-bar,
body.fs-on .bottom-bar,
body.fs-on .sidebar { display: none !important; }
body.fs-on .game-container { height: 100vh; height: 100dvh; width: 100vw; }
body.fs-on .fs-btn { bottom: 12px; }


.rotate-hint {
    position: fixed; inset: 0; z-index: 99998; display: none;
    flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    background: linear-gradient(180deg, #0e1730, #070b16); color: #fff; text-align: center; padding: 24px;
    font-family: 'Baloo 2', system-ui, sans-serif;
}
.rotate-hint .rh-ic { font-size: 4.2rem; transform-origin: center; animation: rh-rot 1.9s ease-in-out infinite; }
.rotate-hint .rh-t { font-size: 1.5rem; font-weight: 800; color: #ffd452; }
.rotate-hint .rh-s { font-size: 1rem; color: rgba(255,255,255,0.82); max-width: 300px; }
.rotate-hint .rh-btn {
    margin-top: 6px; padding: 13px 30px; border: none; border-radius: 15px; cursor: pointer;
    font-family: inherit; font-size: 1.1rem; font-weight: 800; color: #fff;
    background: linear-gradient(135deg, var(--accent, #4a90d9), rgba(var(--accent-rgb,74,144,217),0.7));
    box-shadow: 0 6px 0 rgba(0,0,0,0.3);
}
.rotate-hint .rh-btn:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0,0,0,0.3); }
.rotate-hint .rh-u { font-family: 'Noto Nastaliq Urdu', serif; direction: rtl; font-size: 1.05rem; color: #bcdcff; line-height: 1.9; max-width: 320px; margin-top: 4px; }
@keyframes rh-rot { 0%, 35% { transform: rotate(0); } 65%, 100% { transform: rotate(-90deg); } }

@media (pointer: coarse) and (orientation: portrait) { .rotate-hint:not(.upright) { display: flex; } }


body.portrait-stage .rotate-hint:not(.upright) { display: none !important; }
@media (pointer: coarse) and (orientation: landscape) { body.portrait-stage .rotate-hint.upright { display: flex; } }
.rotate-hint.upright .rh-ic { animation-name: rh-rot-up; }
@keyframes rh-rot-up { 0%, 35% { transform: rotate(-90deg); } 65%, 100% { transform: rotate(0); } }
