/* ===================== RESET & BASE ===================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Nunito', Arial, sans-serif;
}

body {
    background: linear-gradient(180deg, #f3e8ff 0%, #e8f4fd 50%, #fff8e8 100%);
    padding-bottom: 24px;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}

html {
    overflow-x: hidden;
    scroll-behavior: smooth;
}

.hint {
    color: #888;
    font-size: 14px;
    margin-bottom: 12px;
}

/* ===================== HEADER ===================== */
header {
    background: linear-gradient(135deg, #7c4dff, #448aff, #00bcd4);
    color: white;
    padding: 20px 20px 16px;
    text-align: center;
    box-shadow: 0 4px 18px rgba(0,0,0,0.2);
}

header h1 {
    font-family: 'Fredoka', 'Nunito', sans-serif;
    font-size: 28px;
    font-weight: 700;
    text-shadow: 2px 2px 6px rgba(0,0,0,0.2);
    letter-spacing: 0.5px;
}

.tagline {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 2px;
    opacity: 0.88;
    margin-top: 3px;
    text-transform: uppercase;
}

.top-bar {
    display: flex;
    justify-content: center;
    gap: 14px;
    margin-top: 12px;
    font-weight: 700;
    font-size: 16px;
    flex-wrap: wrap;
    position: relative;
}

.top-bar span {
    background: rgba(255,255,255,0.22);
    padding: 5px 16px;
    border-radius: 20px;
    backdrop-filter: blur(6px);
    min-width: 70px;
    text-align: center;
}

.point-pop {
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ffd54f, #ffb300);
    color: #333;
    font-weight: 800;
    font-size: 14px;
    padding: 4px 12px;
    border-radius: 20px;
    animation: pointPopFly 0.85s ease forwards;
    pointer-events: none;
    z-index: 5;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

@keyframes pointPopFly {
    0% { opacity: 0; transform: translateX(-50%) translateY(8px) scale(0.8); }
    25% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.1); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-30px) scale(1); }
}

.settings-panel {
    background: white;
    border-radius: 16px;
    padding: 8px 16px;
    margin: 16px 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
    font-size: 16px;
}

.settings-row:last-child { border-bottom: none; }

body.dark .settings-panel { background: #1e2d4e; }
body.dark .settings-row { border-color: #2a3a5e; }

/* ===================== REWARD BOX ===================== */
.reward-box {
    text-align: center;
    margin: 16px 20px 8px;
}

.btn-reward {
    padding: 13px 32px;
    font-size: 17px;
    font-weight: 800;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    background: linear-gradient(135deg, #ff9800, #f4511e);
    color: white;
    box-shadow: 0 5px 16px rgba(255,152,0,0.45);
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: 'Nunito', sans-serif;
}

.btn-reward:hover {
    transform: scale(1.06);
    box-shadow: 0 8px 22px rgba(255,152,0,0.55);
}

.btn-reward:active { transform: scale(0.97); }

/* ===================== MENU ===================== */
.menu {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 11px;
    padding: 14px 18px;
}

.btn-menu {
    padding: 17px 10px;
    font-size: 15px;
    font-weight: 700;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    color: white;
    text-shadow: 0 1px 4px rgba(0,0,0,0.25);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: 'Nunito', sans-serif;
    line-height: 1.3;
}

.btn-menu:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 10px 24px rgba(0,0,0,0.22);
}

.btn-menu:active { transform: scale(0.96); }

.btn-english   { background: linear-gradient(135deg, #43a047, #76c442); }
.btn-urdu      { background: linear-gradient(135deg, #8e24aa, #ce93d8 80%); }
.btn-numbers   { background: linear-gradient(135deg, #1e88e5, #64b5f6 90%); }
.btn-colors    { background: linear-gradient(135deg, #f4511e, #ff8a65 90%); }
.btn-animals   { background: linear-gradient(135deg, #fb8c00, #ffb74d 90%); }
.btn-birds     { background: linear-gradient(135deg, #00acc1, #4dd0e1 90%); }
.btn-islamic   { background: linear-gradient(135deg, #00897b, #4db6ac 90%); }
.btn-stories   { background: linear-gradient(135deg, #d81b60, #f48fb1 90%); }
.btn-memory    { background: linear-gradient(135deg, #5e35b1, #9575cd 90%); }
.btn-balloon   { background: linear-gradient(135deg, #e53935, #ef9a9a 90%); }
.btn-adventure { background: linear-gradient(135deg, #6d4c41, #a1887f 90%); }
.btn-dashboard { background: linear-gradient(135deg, #546e7a, #90a4ae 90%); }
.btn-cert      { background: linear-gradient(135deg, #f9a825, #ffd54f 90%); color: #333; text-shadow: none; }

/* ===================== CONTENT AREA ===================== */
#content {
    background: white;
    margin: 10px 18px 18px;
    padding: 22px;
    border-radius: 20px;
    min-height: 250px;
    box-shadow: 0 4px 18px rgba(0,0,0,0.08);
    max-width: 100%;
    overflow-x: hidden;
}

#content h2 {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 14px;
    color: #333;
}

.welcome {
    text-align: center;
    padding: 28px 10px;
}

.welcome-icon {
    font-size: 64px;
    animation: bounce 2s ease-in-out infinite;
    display: inline-block;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-12px); }
}

.welcome h2 {
    font-size: 26px;
    color: #43a047;
    margin: 10px 0 8px;
}

.welcome p {
    font-size: 16px;
    color: #888;
}

.welcome-badges {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.welcome-badges span {
    background: linear-gradient(135deg, #ede7f6, #e3f2fd);
    color: #5e35b1;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
}

/* ===================== LETTER GRID ===================== */
.letter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 9px;
    margin-top: 14px;
}

.letter-card {
    background: linear-gradient(135deg, #43a047, #76c442);
    color: white;
    padding: 16px 6px;
    text-align: center;
    font-size: 26px;
    font-weight: 800;
    border-radius: 13px;
    cursor: pointer;
    box-shadow: 0 3px 9px rgba(67,160,71,0.32);
    transition: transform 0.18s, box-shadow 0.18s;
    user-select: none;
}

.letter-card:hover {
    transform: scale(1.12);
    box-shadow: 0 7px 18px rgba(67,160,71,0.42);
}

.letter-card:active { transform: scale(0.94); }

.urdu {
    font-size: 28px;
    line-height: 1.4;
    background: linear-gradient(135deg, #8e24aa, #ab47bc);
    box-shadow: 0 3px 9px rgba(142,36,170,0.32);
    padding: 12px 4px 8px;
}

.urdu .urdu-name {
    font-size: 10px;
    font-weight: 600;
    opacity: 0.85;
    display: block;
    margin-top: 3px;
}

.number-card {
    background: linear-gradient(135deg, #1e88e5, #42a5f5);
    color: white;
    padding: 16px 6px;
    text-align: center;
    font-size: 20px;
    font-weight: 800;
    border-radius: 13px;
    cursor: pointer;
    box-shadow: 0 3px 9px rgba(30,136,229,0.32);
    transition: transform 0.18s, box-shadow 0.18s;
    user-select: none;
}

.number-card:hover {
    transform: scale(1.12);
    box-shadow: 0 7px 18px rgba(30,136,229,0.42);
}

.number-card:active { transform: scale(0.94); }

/* ===================== CREATURE CARDS (Animals & Birds) ===================== */
.creature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 14px;
    margin-top: 10px;
}

.creature-card {
    background: white;
    border-radius: 22px;
    text-align: center;
    cursor: pointer;
    padding: 18px 10px 14px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.10);
    transition: transform 0.25s, box-shadow 0.25s;
    border: 3px solid transparent;
    border-top: 5px solid var(--cc, #43a047);
    user-select: none;
    position: relative;
    overflow: hidden;
}

.creature-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(160deg, var(--cc, #43a047) 0%, transparent 55%);
    opacity: 0.08;
    pointer-events: none;
}

.creature-card:hover {
    transform: translateY(-8px) scale(1.06);
    box-shadow: 0 16px 32px rgba(0,0,0,0.18);
    border-color: var(--cc, #43a047);
}

.creature-card:active { transform: scale(0.96); }

.creature-emoji {
    font-size: 72px;
    line-height: 1.1;
    display: block;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.12));
    transition: transform 0.2s;
}

.creature-card:hover .creature-emoji { transform: scale(1.12) rotate(-4deg); }

.creature-name {
    font-size: 16px;
    font-weight: 800;
    margin-top: 10px;
    color: #333;
    letter-spacing: 0.3px;
}

.bird-card { border-top-color: var(--cc, #00acc1); }

.bird-visual-wrap {
    position: relative;
    width: 100%;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
}

.bird-img {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    background: white;
    padding: 2px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.12);
    object-fit: contain;
}

.bird-emoji-tag {
    position: absolute;
    bottom: -2px;
    right: 8px;
    font-size: 22px;
    background: white;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.bird-grid .creature-card { min-height: 150px; }

.mem-pair-img {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: block;
    margin: 0 auto 4px;
    object-fit: contain;
}

.mem-card.mem-matched .mem-pair-img {
    animation: bounce 0.4s ease;
}

/* ===================== COLOR CARDS ===================== */
.color-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
    gap: 11px;
    margin-top: 14px;
}

.color-card {
    padding: 28px 8px 18px;
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    font-size: 15px;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
}

.color-card:hover {
    transform: scale(1.1);
    box-shadow: 0 9px 20px rgba(0,0,0,0.25);
}

.color-card:active { transform: scale(0.95); }

/* ===================== BALLOON GAME ===================== */
#balloonArea {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 18px;
}

.balloon {
    font-size: 58px;
    cursor: pointer;
    animation: float 2s ease-in-out infinite;
    display: inline-block;
    user-select: none;
    transition: transform 0.15s;
}

.balloon:nth-child(2n)   { animation-delay: 0.35s; filter: hue-rotate(60deg); }
.balloon:nth-child(3n)   { animation-delay: 0.7s;  filter: hue-rotate(120deg); }
.balloon:nth-child(4n)   { animation-delay: 1.05s; filter: hue-rotate(200deg); }
.balloon:nth-child(5n)   { animation-delay: 0.5s;  filter: hue-rotate(270deg); }
.balloon:nth-child(6n)   { animation-delay: 0.9s;  filter: hue-rotate(320deg); }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(-3deg); }
    50%       { transform: translateY(-12px) rotate(3deg); }
}

.balloon:hover  { transform: scale(1.32); }
.balloon:active { transform: scale(0.88); }

.score-display {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: #e53935;
    margin: 8px 0;
}

/* ===================== MEMORY GAME ===================== */
.memory-number {
    font-size: 80px;
    font-weight: 800;
    color: #43a047;
    text-align: center;
    margin: 18px 0;
    letter-spacing: 5px;
    transition: all 0.3s;
}

.memory-input-area {
    text-align: center;
    margin-top: 18px;
}

.memory-input-area input {
    padding: 12px 18px;
    font-size: 24px;
    border: 3px solid #43a047;
    border-radius: 14px;
    width: 190px;
    text-align: center;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    outline: none;
    color: #333;
}

.memory-input-area input:focus { border-color: #1e88e5; }

.timer-badge {
    display: inline-block;
    background: linear-gradient(135deg, #f4511e, #ff8a65);
    color: white;
    font-size: 18px;
    font-weight: 800;
    padding: 4px 14px;
    border-radius: 20px;
    margin-left: 6px;
}

/* ===================== ACTION BUTTONS ===================== */
.action-btn {
    display: inline-block;
    margin: 10px 6px 0;
    padding: 12px 22px;
    font-size: 16px;
    font-weight: 700;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    background: linear-gradient(135deg, #43a047, #76c442);
    color: white;
    box-shadow: 0 4px 12px rgba(67,160,71,0.35);
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: 'Nunito', sans-serif;
    text-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.action-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 7px 18px rgba(67,160,71,0.42);
}

.action-btn:active { transform: scale(0.96); }

.btn-sm { padding: 7px 14px !important; font-size: 13px !important; margin: 0 !important; }
.btn-gray { background: linear-gradient(135deg,#546e7a,#90a4ae) !important; }
.btn-danger { background: linear-gradient(135deg,#e53935,#ef9a9a) !important; margin-top: 14px; }

.sc-orange { background: linear-gradient(135deg,#fb8c00,#ffb74d) !important; }
.sc-blue   { background: linear-gradient(135deg,#1e88e5,#64b5f6) !important; }
.sc-purple { background: linear-gradient(135deg,#8e24aa,#ce93d8) !important; }

.win-panel { text-align: center; padding: 16px 0; }
.win-emoji { font-size: 50px; }
.win-btns  { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; }

/* ===================== ISLAMIC SECTION ===================== */
.islamic-card {
    background: linear-gradient(135deg, #00897b, #4db6ac);
    color: white;
    padding: 18px 20px;
    border-radius: 16px;
    margin-bottom: 14px;
    box-shadow: 0 4px 14px rgba(0,137,123,0.3);
}

.islamic-card h3 {
    font-size: 17px;
    font-weight: 800;
    margin-bottom: 10px;
}

.islamic-card .arabic {
    font-size: 22px;
    direction: rtl;
    line-height: 2;
    margin: 8px 0;
    font-weight: 600;
}

.islamic-card .transliteration {
    font-size: 13px;
    opacity: 0.88;
    font-style: italic;
    margin-bottom: 6px;
}

.islamic-card .translation {
    font-size: 13px;
    background: rgba(255,255,255,0.2);
    padding: 6px 12px;
    border-radius: 8px;
    margin-top: 6px;
}

/* ===================== STORIES ===================== */
.story-card {
    background: linear-gradient(160deg, #fff9f9, #fff0f5);
    border: 2px solid #f48fb1;
    border-radius: 18px;
    padding: 22px;
    line-height: 1.85;
}

.story-card h3 {
    color: #d81b60;
    font-size: 20px;
    margin-bottom: 14px;
    font-weight: 800;
}

.story-card p {
    font-size: 15px;
    color: #444;
    margin-bottom: 12px;
}

.story-moral {
    font-weight: 800;
    font-size: 15px;
    color: #5e35b1;
    background: #f3e5f5;
    padding: 10px 14px;
    border-radius: 10px;
    margin-top: 14px;
}

.story-nav {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.story-nav button {
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 700;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    color: white;
    transition: transform 0.2s;
    font-family: 'Nunito', sans-serif;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
}

.btn-prev  { background: linear-gradient(135deg,#546e7a,#90a4ae); }
.btn-next  { background: linear-gradient(135deg,#d81b60,#f48fb1); }
.btn-play  { background: linear-gradient(135deg,#43a047,#76c442); }
.btn-stop  { background: linear-gradient(135deg,#e53935,#ef5350); animation: pulse-stop 1s ease-in-out infinite; }

@keyframes pulse-stop {
    0%, 100% { box-shadow: 0 3px 10px rgba(229,57,53,0.3); }
    50%       { box-shadow: 0 3px 18px rgba(229,57,53,0.6); }
}

.story-nav button:hover  { transform: scale(1.06); }
.story-nav button:active { transform: scale(0.96); }

.story-counter {
    font-size: 13px;
    color: #aaa;
    margin-top: 10px;
}

/* ===================== ADVENTURE ===================== */
.level-card {
    background: linear-gradient(135deg, #6d4c41, #a1887f);
    color: white;
    border-radius: 18px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 5px 16px rgba(109,76,65,0.35);
}

.level-card h3 { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.level-card p  { font-size: 15px; opacity: 0.92; margin-bottom: 10px; }
.level-card .task { font-style: italic; font-size: 14px; opacity: 0.82; margin-top: 4px; }

/* ===================== CERTIFICATE ===================== */
.certificate {
    background: linear-gradient(160deg, #fffde7, #fff8e1);
    padding: 30px 24px;
    border: 5px solid gold;
    border-radius: 22px;
    margin-top: 20px;
    text-align: center;
    box-shadow: 0 8px 28px rgba(255,193,7,0.35);
}

.certificate h1 { font-size: 30px; color: #f9a825; margin-bottom: 10px; }
.certificate h2 { font-size: 28px; color: #333; margin: 8px 0; }
.certificate p  { font-size: 15px; color: #666; margin: 4px 0; }
.certificate .cert-date { font-size: 13px; color: #bbb; margin-top: 14px; }
.certificate .cert-stars { font-size: 20px; margin: 10px 0; }

#content input[type="text"] {
    padding: 12px 16px;
    font-size: 17px;
    border: 2px solid #ddd;
    border-radius: 13px;
    outline: none;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    width: 100%;
    max-width: 300px;
    color: #333;
    transition: border-color 0.2s;
}

#content input[type="text"]:focus { border-color: #43a047; }

/* ===================== PARENT DASHBOARD ===================== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.stat-card {
    background: linear-gradient(135deg, #43a047, #76c442);
    color: white;
    padding: 18px 14px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(67,160,71,0.3);
}

.stat-card h3 { font-size: 13px; opacity: 0.88; margin-bottom: 6px; }
.stat-card p  { font-size: 34px; font-weight: 800; }

/* ===================== TOAST NOTIFICATIONS ===================== */
.toast {
    position: fixed;
    bottom: max(24px, env(safe-area-inset-bottom, 24px));
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #333;
    color: white;
    padding: 13px 26px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 700;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
    pointer-events: none;
    box-shadow: 0 5px 18px rgba(0,0,0,0.3);
    max-width: 90vw;
    text-align: center;
    white-space: normal;
    word-wrap: break-word;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===================== SUCCESS MESSAGE ===================== */
.success-msg {
    font-size: 20px;
    font-weight: 800;
    color: #43a047;
    text-align: center;
    margin: 12px 0;
}

.error-msg {
    font-size: 18px;
    font-weight: 800;
    color: #e53935;
    text-align: center;
    margin: 12px 0;
}

/* ===================== THEME BUTTON ===================== */
.theme-btn {
    position: fixed;
    right: 15px;
    bottom: max(20px, env(safe-area-inset-bottom, 20px));
    padding: 13px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    background: white;
    box-shadow: 0 3px 14px rgba(0,0,0,0.22);
    transition: transform 0.2s;
    z-index: 100;
    min-width: 48px;
    min-height: 48px;
}

.theme-btn:hover { transform: scale(1.12) rotate(22deg); }

/* ===================== DARK MODE ===================== */
body.dark {
    background: #1a1a2e;
    color: #eee;
}

body.dark #content {
    background: #16213e;
    color: #eee;
    box-shadow: 0 4px 18px rgba(0,0,0,0.35);
}

body.dark #content h2 { color: #eee; }

body.dark .creature-card {
    background: #1e2d4e;
    border-color: #2d3f6e;
}

body.dark .creature-name { color: #eee; }

body.dark .story-card {
    background: #1e2d4e;
    border-color: #4a3040;
}

body.dark .story-card p { color: #ccc; }

body.dark .welcome h2 { color: #66bb6a; }
body.dark .welcome p  { color: #90a4ae; }

body.dark #content input[type="text"] {
    background: #2d3f6e;
    border-color: #3d5080;
    color: #eee;
}

body.dark .memory-input-area input {
    background: #2d3f6e;
    border-color: #43a047;
    color: #eee;
}

body.dark .story-moral {
    background: #2d1f3f;
    color: #ce93d8;
}

/* ===================== MEMORY MATCHING GAME ===================== */

.mem-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #f3e5f5, #ede7f6);
    padding: 10px 14px;
    border-radius: 14px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 700;
    flex-wrap: wrap;
    gap: 6px;
}

/* Memory level select */
.level-select-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.level-select-card {
    background: linear-gradient(135deg, #5e35b1, #7e57c2);
    color: white;
    border-radius: 18px;
    padding: 20px 14px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 5px 16px rgba(94,53,177,0.35);
    transition: transform 0.2s;
}

.level-select-card:hover { transform: translateY(-5px) scale(1.04); }
.level-select-card.locked { background: linear-gradient(135deg,#bdbdbd,#e0e0e0); color:#888; cursor:not-allowed; opacity:0.7; }

.lvl-num   { font-size: 32px; font-weight: 800; }
.lvl-title { font-size: 15px; font-weight: 700; margin: 6px 0 4px; }
.lvl-info  { font-size: 12px; opacity: 0.85; }

.memory-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
    margin-top: 6px;
}

.mem-card {
    aspect-ratio: 1 / 1.05;
    cursor: pointer;
    perspective: 500px;
    user-select: none;
    width: 100%;
}

.mem-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.42s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 8px;
}

.mem-card.mem-flipped .mem-inner,
.mem-card.mem-matched .mem-inner {
    transform: rotateY(180deg);
}

.mem-front,
.mem-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.mem-front {
    background: linear-gradient(135deg, #5e35b1, #7e57c2);
    color: white;
    font-size: 18px;
    border-radius: 8px;
}

.mem-back {
    background: linear-gradient(135deg, #43a047, #76c442);
    color: white;
    transform: rotateY(180deg);
    padding: 2px;
    font-size: 18px;
    border-radius: 8px;
}

.mem-back span {
    font-size: 8px;
    font-weight: 700;
    margin-top: 2px;
    text-align: center;
    line-height: 1.1;
}

.mem-card.mem-matched .mem-inner {
    transform: rotateY(180deg) !important;
    opacity: 1 !important;
}

.mem-card.mem-matched {
    pointer-events: none;
    outline: 3px solid #43a047;
    outline-offset: 2px;
    border-radius: 14px;
    animation: memMatchPop 0.45s ease;
}

@keyframes memMatchPop {
    0% { transform: scale(1); }
    40% { transform: scale(1.08); }
    100% { transform: scale(1); }
}

.mem-card.mem-matched .mem-back {
    background: linear-gradient(135deg, #c8e6c9, #a5d6a7);
    color: #1b5e20;
    box-shadow: inset 0 0 0 2px #43a047;
}

/* ===================== BALLOON SKY GAME ===================== */

.balloon-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    padding: 10px 16px;
    border-radius: 14px;
    margin-bottom: 10px;
    font-size: 15px;
    font-weight: 700;
}

.balloon-timer-box {
    background: linear-gradient(135deg, #e53935, #ef9a9a);
    color: white;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 16px;
}

.balloon-sky {
    position: relative;
    height: 340px;
    background: linear-gradient(180deg, #87ceeb 0%, #b8e4f8 60%, #ddf0fb 100%);
    border-radius: 18px;
    overflow: hidden;
    border: 2px solid #b0d8f0;
}

.sky-balloon {
    position: absolute;
    cursor: pointer;
    user-select: none;
    animation: sway 2.5s ease-in-out infinite;
    transition: transform 0.15s;
    line-height: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.balloon-letter {
    font-family: 'Fredoka', sans-serif;
    font-size: 28px;
    font-weight: 700;
    background: white;
    border-radius: 50%;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.2);
    border: 3px solid rgba(255,255,255,0.8);
    position: relative;
}

.balloon-letter::after {
    content: '🎈';
    font-size: 22px;
    position: absolute;
    bottom: -20px;
    left: 50%;
    transform: translateX(-50%);
}

.balloon-pop { font-size: 36px; display: block; }

.sky-balloon:hover  { transform: scale(1.2); }
.sky-balloon:active { transform: scale(0.85); }

@keyframes sway {
    0%, 100% { margin-left: 0;    }
    25%       { margin-left: 10px; }
    75%       { margin-left: -10px;}
}

.balloon-end-emoji {
    text-align: center;
    font-size: 80px;
    padding-top: 110px;
    animation: bounce 1s ease-in-out infinite;
}

/* ===================== ISLAMIC 6 KALIMAS ===================== */

.kalima-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.kalima-num {
    font-size: 36px;
    font-weight: 800;
    min-width: 44px;
    text-align: center;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 6px 10px;
    line-height: 1;
}

.kalima-urdu {
    font-size: 18px;
    font-weight: 800;
    direction: rtl;
    text-align: right;
}

.kalima-en {
    font-size: 13px;
    opacity: 0.85;
    margin-top: 2px;
    font-weight: 600;
}

.kalima-arabic {
    font-size: 24px !important;
    line-height: 2.2 !important;
    text-align: center;
    padding: 10px 0;
    background: rgba(255,255,255,0.12);
    border-radius: 10px;
    margin: 8px 0;
}

.kalima-btn {
    background: rgba(255,255,255,0.25) !important;
    box-shadow: none !important;
    font-size: 14px !important;
    padding: 8px 18px !important;
    margin: 6px 0 0 !important;
    backdrop-filter: blur(4px);
}

.kalima-btn:hover {
    background: rgba(255,255,255,0.4) !important;
    transform: scale(1.04);
}

/* ===================== ADVENTURE MINI GAMES ===================== */

.adventure-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 10px;
}

.adventure-card {
    background: white;
    border-radius: 22px;
    padding: 28px 18px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 6px 22px rgba(0,0,0,0.12);
    border-top: 6px solid var(--ac, #7c4dff);
    transition: transform 0.22s, box-shadow 0.22s;
    user-select: none;
    min-height: 170px;
}

.adventure-card:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 16px 36px rgba(0,0,0,0.2);
}

.adv-icon { font-size: 58px; margin-bottom: 12px; }
.adv-name { font-size: 17px; font-weight: 800; color: #333; margin-bottom: 6px; }
.adv-desc { font-size: 13px; color: #888; line-height: 1.45; }

.adv-score-bar {
    background: linear-gradient(135deg, #e8eaf6, #e3f2fd);
    padding: 10px 16px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 14px;
    text-align: center;
}

/* Treasure Hunt */
.treasure-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-top: 14px;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

.treasure-box {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #8d6e63, #a1887f);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    cursor: pointer;
    box-shadow: 0 5px 16px rgba(0,0,0,0.18);
    transition: transform 0.2s;
    user-select: none;
    min-height: 80px;
}

.treasure-box:hover { transform: scale(1.08); }
.treasure-found { background: linear-gradient(135deg,#ffd700,#ffab00) !important; animation: bounce 0.5s ease; }
.treasure-miss  { background: linear-gradient(135deg,#bdbdbd,#e0e0e0) !important; opacity: 0.6; }

/* Color Pop */
.color-question { text-align: center; font-size: 18px; font-weight: 700; margin: 14px 0; }
.color-quiz-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.color-quiz-btn {
    padding: 36px 12px;
    border-radius: 18px;
    text-align: center;
    font-size: 20px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 5px 16px rgba(0,0,0,0.18);
    transition: transform 0.2s;
    user-select: none;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.color-quiz-btn:hover { transform: scale(1.06); }

/* Number Ninja */
.ninja-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.ninja-btn {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #1e88e5, #42a5f5);
    color: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 5px 14px rgba(30,136,229,0.35);
    transition: transform 0.15s, background 0.2s;
    user-select: none;
    min-height: 64px;
}

.ninja-btn:hover { transform: scale(1.1); }
.ninja-done { background: linear-gradient(135deg,#43a047,#66bb6a) !important; opacity: 0.5; pointer-events: none; }

/* Letter Catch */
.catch-zone {
    position: relative;
    height: 420px;
    background: linear-gradient(180deg, #e8eaf6, #f3e5f5);
    border-radius: 20px;
    overflow: hidden;
    border: 3px solid #d1c4e9;
    margin-top: 12px;
}

.catch-letter {
    position: absolute;
    font-family: 'Fredoka', sans-serif;
    font-size: 44px;
    font-weight: 700;
    cursor: pointer;
    animation: fall-down 2.5s linear forwards;
    user-select: none;
    text-shadow: 0 2px 6px rgba(0,0,0,0.15);
    transition: transform 0.15s;
}

.catch-letter:hover { transform: scale(1.2); }

@keyframes fall-down {
    from { top: -40px; }
    to   { top: 110%; }
}

.catch-good { color: #43a047 !important; }
.catch-bad  { color: #e53935 !important; }

/* Animal Quiz */
.quiz-emoji {
    font-size: 120px;
    text-align: center;
    margin: 20px 0;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.12));
    animation: bounce 2s ease-in-out infinite;
    display: block;
}

.quiz-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.quiz-btn {
    padding: 20px 14px;
    font-size: 18px;
    font-weight: 700;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    background: linear-gradient(135deg, #43a047, #66bb6a);
    color: white;
    box-shadow: 0 5px 14px rgba(67,160,71,0.3);
    transition: transform 0.2s;
    font-family: 'Nunito', sans-serif;
    min-height: 60px;
}

.quiz-btn:hover { transform: scale(1.05); }

/* Star Dash */
.star-zone {
    position: relative;
    height: 420px;
    background: linear-gradient(180deg, #1a237e, #3949ab, #5c6bc0);
    border-radius: 20px;
    overflow: hidden;
    margin-top: 12px;
}

.dash-star {
    position: absolute;
    font-size: 52px;
    cursor: pointer;
    animation: twinkle 0.8s ease-in-out infinite alternate;
    user-select: none;
    transition: transform 0.15s;
}

.dash-star:hover { transform: scale(1.4) rotate(15deg); }

@keyframes twinkle {
    from { opacity: 0.7; transform: scale(0.9); }
    to   { opacity: 1;   transform: scale(1.1); }
}

body.dark .adventure-card { background: #1e2d4e; }
body.dark .adv-name { color: #eee; }
body.dark .catch-zone { background: linear-gradient(180deg,#1a1a2e,#2d1f4e); border-color:#4a3070; }

/* ===================== FOOTER & LEGAL ===================== */
.site-footer {
    background: linear-gradient(135deg, #311b92, #512da8);
    color: white;
    text-align: center;
    padding: 20px 16px max(24px, env(safe-area-inset-bottom, 24px));
    margin-top: 10px;
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.footer-links button {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    transition: background 0.2s;
}

.footer-links button:hover { background: rgba(255,255,255,0.3); }

.about-benefits {
    background: linear-gradient(135deg, #f3e5f5, #e8eaf6);
    padding: 16px 18px;
    border-radius: 14px;
    border-left: 5px solid #7c4dff;
}

.footer-copy { font-size: 12px; opacity: 0.85; margin: 6px 0; }
.footer-email a { color: #ffd54f; text-decoration: none; font-weight: 700; }

.legal-page h3 { margin: 16px 0 8px; color: #5e35b1; font-size: 17px; }
.legal-page p { line-height: 1.7; margin-bottom: 10px; color: #444; }
.legal-page a { color: #7c4dff; }
.legal-list { margin: 8px 0 8px 20px; line-height: 1.8; color: #555; }

.contact-card {
    background: linear-gradient(135deg, #e8eaf6, #ede7f6);
    padding: 24px;
    border-radius: 18px;
    text-align: center;
    margin: 16px 0;
}

.contact-email { font-size: 20px; font-weight: 800; color: #5e35b1; text-decoration: none; }

/* ===================== ISLAMIC TABS & 99 NAMES ===================== */
.islamic-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.islamic-tab {
    padding: 10px 16px;
    border: none;
    border-radius: 20px;
    background: #ede7f6;
    color: #5e35b1;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    transition: all 0.2s;
}

.islamic-tab.active {
    background: linear-gradient(135deg, #5e35b1, #7e57c2);
    color: white;
}

.kursi-card { background: linear-gradient(135deg, #1b5e20, #388e3c) !important; }
.kursi-text { font-size: 20px !important; line-height: 2.4 !important; }
.kursi-urdu { direction: rtl; font-size: 15px; opacity: 0.9; margin-top: 12px; line-height: 1.8; }

.iman-card { background: linear-gradient(135deg, #0d47a1, #1976d2) !important; }
.iman-card-2 { background: linear-gradient(135deg, #004d40, #00796b) !important; }
.iman-title { font-size: 20px; font-weight: 800; margin-bottom: 14px; direction: rtl; text-align: center; }
.iman-text { font-size: 22px !important; line-height: 2.4 !important; text-align: center; }

.names-counter-bar {
    text-align: center;
    font-size: 18px;
    font-weight: 800;
    background: linear-gradient(135deg, #ffd700, #ffb300);
    color: #333;
    padding: 10px;
    border-radius: 14px;
    margin-bottom: 14px;
}

.name-display {
    background: linear-gradient(160deg, #1a237e, #3949ab);
    color: white;
    border-radius: 22px;
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 8px 28px rgba(26,35,126,0.4);
    transition: transform 0.2s;
    user-select: none;
}

.name-display:hover { transform: scale(1.02); }
.name-display.name-flash { animation: nameFlash 0.4s ease; }

@keyframes nameFlash {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); box-shadow: 0 12px 36px rgba(255,215,0,0.4); }
}

.name-num { font-size: 14px; opacity: 0.7; margin-bottom: 8px; }
.name-arabic { font-size: 36px; line-height: 1.6; margin: 10px 0; }
.name-trans { font-size: 22px; font-weight: 800; color: #ffd54f; }
.name-meaning { font-size: 16px; opacity: 0.9; margin-top: 8px; }
.tap-hint { margin-top: 14px; font-size: 13px; opacity: 0.7; }

/* ===================== STORIES LIST ===================== */
.lang-toggle { display: flex; gap: 10px; margin-bottom: 14px; }
.lang-toggle button {
    flex: 1; padding: 12px; border: none; border-radius: 14px;
    font-weight: 700; cursor: pointer; font-family: 'Nunito', sans-serif;
    background: #ede7f6; color: #5e35b1; transition: all 0.2s;
}
.lang-toggle button.active { background: linear-gradient(135deg, #d81b60, #f48fb1); color: white; }

.story-list { display: flex; flex-direction: column; gap: 8px; }
.story-list-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; background: linear-gradient(135deg, #fce4ec, #f3e5f5);
    border-radius: 14px; cursor: pointer; font-weight: 700; transition: transform 0.2s;
}
.story-list-item:hover { transform: translateX(4px); }

/* ===================== MEMORY BIG — 20 CARDS ===================== */
.mem-card-big {
    max-width: none !important;
    width: 100%;
    min-height: 88px;
}

.mem-back-big {
    font-size: 46px !important;
    padding: 8px 4px !important;
}

.mem-back-big span {
    font-size: 11px !important;
    font-weight: 800;
    margin-top: 4px;
}

.mem-front.mem-front-big,
.mem-card-big .mem-front {
    font-size: 28px !important;
}

.memory-grid.mem-big {
    gap: 10px;
    max-width: 100%;
}

.memory-grid.mem-20 {
    grid-template-columns: repeat(5, 1fr) !important;
}

@media (min-width: 600px) {
    .mem-card-big { min-height: 100px; }
    .mem-back-big { font-size: 52px !important; }
}

/* ===================== BALLOON BIG ===================== */
.balloon-sky-big { height: 380px !important; }
.balloon-letter-big {
    font-size: 36px !important;
    width: 68px !important;
    height: 68px !important;
}
.sky-balloon-big { animation: sway 3s ease-in-out infinite; }

/* ===================== CERTIFICATE BIG ===================== */
.cert-form { display: flex; flex-direction: column; gap: 12px; max-width: 360px; margin-bottom: 16px; }
.cert-form select { padding: 12px; border-radius: 13px; border: 2px solid #ddd; font-family: 'Nunito', sans-serif; font-weight: 600; }
.cert-gen-btn { width: 100%; padding: 16px !important; font-size: 18px !important; }

.certificate-big {
    position: relative;
    background: linear-gradient(160deg, #fffde7, #fff8e1, #fff3e0) !important;
    padding: 0 !important;
    border: 6px double gold !important;
    border-radius: 24px !important;
    overflow: hidden;
    box-shadow: 0 16px 48px rgba(255,193,7,0.35) !important;
}

.cert-ribbon {
    background: linear-gradient(135deg, #7c4dff, #448aff);
    color: white;
    padding: 10px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 2px;
}

.cert-border-inner { padding: 28px 24px 32px; position: relative; }
.cert-stars-top { font-size: 24px; margin-bottom: 8px; }
.certificate-big h1 { font-size: 26px !important; color: #5e35b1 !important; margin: 8px 0 !important; }
.cert-presented { font-size: 14px; color: #888; }
.cert-name { font-size: 36px !important; color: #d81b60 !important; margin: 12px 0 !important; font-family: 'Fredoka', sans-serif; }
.cert-badge { display: inline-block; background: linear-gradient(135deg, #ffd700, #ffb300); color: #333; padding: 8px 20px; border-radius: 20px; font-weight: 800; margin: 10px 0; }
.cert-body { font-size: 15px; color: #555; margin: 12px 0; }
.cert-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0; }
.cert-stats div { background: white; border-radius: 14px; padding: 12px 8px; box-shadow: 0 3px 10px rgba(0,0,0,0.08); }
.cert-stats span { font-size: 22px; display: block; }
.cert-stats strong { font-size: 22px; color: #5e35b1; display: block; }
.cert-stats small { font-size: 11px; color: #888; }
.cert-footer { display: flex; justify-content: space-between; font-size: 12px; color: #aaa; margin-top: 16px; }
.cert-seal { position: absolute; bottom: 20px; right: 24px; font-size: 48px; opacity: 0.3; }

.cert-star .cert-ribbon { background: linear-gradient(135deg, #ffd700, #ff8f00); color: #333; }
.cert-islamic .cert-ribbon { background: linear-gradient(135deg, #1b5e20, #388e3c); }

.sc-red { background: linear-gradient(135deg, #e53935, #ef9a9a) !important; }

/* ===================== PUZZLE, SHAPES, BUBBLES ===================== */
.puzzle-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 340px;
    margin: 20px auto;
}

.puzzle-tile {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #795548, #a1887f);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: 800;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 5px 14px rgba(0,0,0,0.18);
    transition: transform 0.15s;
    user-select: none;
    min-height: 90px;
}

.puzzle-tile:hover { transform: scale(1.05); }
.puzzle-tile.empty { background: transparent; box-shadow: none; cursor: default; }

.shape-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-width: 280px; margin: 0 auto; }
.shape-btn {
    font-size: 72px; padding: 28px; text-align: center; background: white;
    border-radius: 20px; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    transition: transform 0.2s; user-select: none; min-height: 110px;
    display: flex; align-items: center; justify-content: center;
}
.shape-btn:hover { transform: scale(1.08); }

.scramble-word {
    font-size: 36px; font-weight: 800; letter-spacing: 8px; text-align: center;
    color: #7c4dff; margin: 20px 0; font-family: 'Fredoka', sans-serif;
}
.scr-input {
    display: block; width: 100%; max-width: 280px; margin: 0 auto 12px;
    padding: 14px; font-size: 20px; text-align: center; border: 3px solid #7c4dff;
    border-radius: 14px; font-family: 'Nunito', sans-serif; font-weight: 700;
}

.bubble-zone {
    position: relative; height: 420px;
    background: linear-gradient(180deg, #e0f7fa, #b2ebf2);
    border-radius: 20px; overflow: hidden; margin-top: 12px;
}

.dash-bubble {
    position: absolute; width: 64px; height: 64px; border-radius: 50%;
    cursor: pointer; box-shadow: inset -5px -5px 12px rgba(0,0,0,0.15), 0 5px 12px rgba(0,0,0,0.12);
    animation: bubbleFloat 1.5s ease-in-out infinite alternate; user-select: none;
}

@keyframes bubbleFloat {
    from { transform: translateY(0) scale(1); }
    to { transform: translateY(-8px) scale(1.05); }
}

.dash-bubble:hover { transform: scale(1.2); }
.bubble-wrong { animation: shake 0.3s ease; }

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

.tg-4 { grid-template-columns: repeat(4, 1fr) !important; }
.tg-5 {
    grid-template-columns: repeat(5, 1fr) !important;
    max-width: 520px !important;
    gap: 12px !important;
}

.treasure-box-big {
    font-size: 48px !important;
    min-height: 88px !important;
    border-radius: 20px !important;
}

.color-quiz-big { max-width: 520px; margin: 0 auto; }
.color-quiz-btn-big {
    padding: 48px 16px !important;
    font-size: 24px !important;
    min-height: 120px !important;
}

.ninja-grid-big {
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 12px !important;
    max-width: 520px;
    margin: 0 auto;
}

.ninja-btn-big {
    font-size: 28px !important;
    min-height: 72px !important;
}

.catch-zone-big { height: 500px !important; }
.catch-letter-big { font-size: 56px !important; }

.quiz-emoji-big { font-size: 120px !important; text-align: center; margin: 16px 0; min-height: 120px; display: flex; align-items: center; justify-content: center; }
.quiz-bird-img { width: 110px; height: 110px; object-fit: contain; border-radius: 16px; background: white; padding: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.quiz-options-big { max-width: 520px; margin: 0 auto; }
.quiz-options-big .quiz-btn {
    padding: 28px 16px !important;
    font-size: 22px !important;
    min-height: 80px !important;
}

.star-zone-big { height: 500px !important; }
.dash-star-big { font-size: 64px !important; }

.puzzle-grid-big {
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: auto;
    margin-right: auto;
}

/* Block puzzle — 15 tiles, 40% smaller, colorful shapes */
.puzzle-grid-kids {
    gap: 6px !important;
    max-width: min(92vw, 320px) !important;
    margin: 12px auto !important;
}

.puzzle-tile-kids {
    min-height: 43px !important;
    font-size: clamp(13px, 3.2vw, 20px) !important;
    border-radius: 12px !important;
    background: var(--tile-color, #795548) !important;
    color: #fff !important;
    position: relative;
    overflow: hidden;
    border: 2px solid rgba(255,255,255,0.45);
    box-shadow: 0 3px 10px rgba(0,0,0,0.18), inset 0 -3px 0 rgba(0,0,0,0.12);
}

.puzzle-tile-kids.shape-flower { border-radius: 50% 50% 50% 12%; }
.puzzle-tile-kids.shape-star { clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.puzzle-tile-kids.shape-diamond { clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); border-radius: 4px; }
.puzzle-tile-kids.shape-bunny { border-radius: 42% 42% 48% 48%; }
.puzzle-tile-kids.shape-circle { border-radius: 50%; }

.puzzle-tile-kids .tile-deco {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 0.55em;
    opacity: 0.9;
    line-height: 1;
}

.puzzle-tile-kids .tile-num {
    font-weight: 800;
    z-index: 1;
    text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}

.puzzle-tile-kids.empty {
    background: rgba(0,0,0,0.04) !important;
    border: 2px dashed rgba(0,0,0,0.12);
    box-shadow: none;
}

.puzzle-hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.puzzle-timer-box {
    background: linear-gradient(135deg, #e53935, #ef5350);
    color: #fff;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 14px;
}

.puzzle-timer-box.puzzle-time-warn,
.puzzle-time-warn {
    animation: puzzleTimePulse 0.6s ease infinite;
}

@keyframes puzzleTimePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

.puzzle-celebrate {
    animation: puzzleCelebrate 0.65s ease;
    text-align: center;
}

.celebrate-burst {
    font-size: 2.2rem;
    animation: celebrateBurst 1s ease infinite alternate;
}

@keyframes celebrateBurst {
    from { transform: scale(1) rotate(-3deg); }
    to { transform: scale(1.12) rotate(3deg); }
}

@keyframes puzzleCelebrate {
    0% { transform: scale(0.85); opacity: 0; }
    60% { transform: scale(1.04); opacity: 1; }
    100% { transform: scale(1); }
}

.shabash-text {
    font-size: 2rem;
    color: #2e7d32;
    margin: 8px 0;
}

.puzzle-tile-big {
    font-size: clamp(22px, 4vw, 36px) !important;
    min-height: 72px !important;
    border-radius: 14px !important;
}

.shape-grid-big {
    max-width: 420px !important;
    gap: 16px !important;
}
.shape-grid-big .shape-btn {
    font-size: 88px !important;
    min-height: 140px !important;
    padding: 36px !important;
}

.scramble-word-big { font-size: 44px !important; letter-spacing: 10px !important; }
.scr-input-big { max-width: 360px !important; padding: 18px !important; font-size: 24px !important; }

.bubble-zone-big { height: 500px !important; }
.dash-bubble-big {
    width: 80px !important;
    height: 80px !important;
}

.adv-game-wrap { max-width: 640px; margin: 0 auto; }

body.dark .legal-page p { color: #ccc; }
body.dark .story-list-item { background: #1e2d4e; color: #eee; }
body.dark .contact-card { background: #1e2d4e; }
body.dark .site-footer { background: linear-gradient(135deg, #1a1a2e, #311b92); }
body.dark .about-benefits { background: linear-gradient(135deg, #1e2d4e, #2d1f4e); color: #ddd; }

/* ===================== FULL-SCREEN MODULE VIEW ===================== */
.hidden { display: none !important; }

.app-loader {
    position: fixed;
    inset: 0;
    background: rgba(124, 77, 255, 0.92);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.app-loader.active {
    opacity: 1;
    pointer-events: all;
}

.loader-spinner {
    width: 52px;
    height: 52px;
    border: 5px solid rgba(255,255,255,0.3);
    border-top-color: #ffd54f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.app-loader p {
    color: white;
    font-weight: 700;
    margin-top: 14px;
    font-size: 16px;
}

.module-screen {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: linear-gradient(180deg, #f3e8ff 0%, #e8f4fd 50%, #fff8e8 100%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.module-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    padding-top: max(12px, env(safe-area-inset-top));
    background: linear-gradient(135deg, #7c4dff, #448aff);
    color: white;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.back-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    min-height: 44px;
}

.back-btn:hover { background: rgba(255,255,255,0.35); }

.module-title {
    flex: 1;
    font-weight: 800;
    font-size: 16px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-toggle {
    background: rgba(255,255,255,0.2);
    border: none;
    font-size: 20px;
    padding: 8px 12px;
    border-radius: 12px;
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
}

.module-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    background: white;
    margin: 0;
    padding: 16px 14px 24px;
    border-radius: 0;
    box-shadow: none;
    min-height: 0;
}

body.dark .module-screen {
    background: #1a1a2e;
}

body.dark .module-content {
    background: #16213e;
    color: #eee;
}

/* Urdu Nastaleeq font */
.urdu-text,
.urdu-name,
.story-fullscreen.urdu-text,
.story-reader.urdu-text,
.kalima-urdu,
.kursi-urdu {
    font-family: 'Noto Nastaliq Urdu', 'Jameel Noori Nastaleeq', serif;
    direction: rtl;
    line-height: 2;
}

.letter-card.urdu {
    font-family: 'Noto Nastaliq Urdu', serif;
    font-size: 36px;
}

/* Dashboard */
.dash-streak {
    background: linear-gradient(135deg, #ff6f00, #ff9800);
    color: white;
    padding: 14px 18px;
    border-radius: 16px;
    text-align: center;
    font-size: 18px;
    margin-bottom: 16px;
}

.dash-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 18px;
}

.dash-stat {
    background: linear-gradient(135deg, #e8eaf6, #f3e5f5);
    border-radius: 16px;
    padding: 16px 12px;
    text-align: center;
}

.dash-stat span { font-size: 28px; display: block; }
.dash-stat strong { font-size: 26px; color: #5e35b1; display: block; }
.dash-stat small { font-size: 12px; color: #888; }

.dash-section-title { margin: 16px 0 10px; font-size: 17px; color: #5e35b1; }

.prog-row { margin-bottom: 12px; }
.prog-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.prog-bar { height: 12px; background: #e0e0e0; border-radius: 8px; overflow: hidden; }
.prog-fill { height: 100%; background: linear-gradient(90deg, #7c4dff, #448aff); border-radius: 8px; transition: width 0.4s; }

.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.badge-card {
    background: #f5f5f5;
    border-radius: 14px;
    padding: 12px 10px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    opacity: 0.55;
}

.badge-card.earned {
    opacity: 1;
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    border: 2px solid gold;
}

.badge-icon { font-size: 28px; display: block; margin-bottom: 4px; }
.badge-card small { display: block; font-size: 11px; color: #888; margin-top: 4px; }

/* Memory enhancements */
.mem-stars-live { color: #ffd700; font-size: 16px; letter-spacing: 2px; }
.mem-time-warn { color: #e53935 !important; animation: pulse 0.5s infinite; }
@keyframes pulse { 50% { opacity: 0.6; } }
.mem-pop { animation: memPop 0.4s ease; }
@keyframes memPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

/* Adventure storyline */
.adv-story-intro {
    background: linear-gradient(135deg, #1a237e, #3949ab);
    color: white;
    padding: 18px 16px;
    border-radius: 18px;
    margin-bottom: 16px;
}

.adv-story-text { font-size: 14px; line-height: 1.6; margin: 10px 0; opacity: 0.95; }
.adv-rewards-bar { background: rgba(255,255,255,0.15); padding: 10px; border-radius: 12px; font-size: 14px; }

/* Story fullscreen reader */
.story-fullscreen { min-height: 100%; }
.story-reader .story-card { font-size: 17px; line-height: 1.85; }
.story-reader.urdu-text .story-card { font-size: 20px; line-height: 2.2; text-align: right; }
.story-reader.urdu-text h2 { text-align: right; }
.story-reader.urdu-text .story-moral { text-align: right; }
.story-back { margin-bottom: 12px; }

.home-welcome {
    text-align: center;
    padding: 20px 16px 10px;
}

/* ===================== RESPONSIVE — TABLET & PHONE ===================== */
@media (max-width: 768px) {
    header { padding: 16px 14px 14px; }
    header h1 { font-size: 24px; }
    .menu { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; padding: 12px 14px; }
    #content { margin: 8px 12px 14px; padding: 18px 14px; }
    .adventure-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
    .level-select-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
    .mem-topbar { flex-wrap: wrap; gap: 8px; justify-content: center; }
    .color-quiz-big { max-width: 100%; }
    .ninja-grid-big { max-width: 100%; }
    .quiz-options-big { max-width: 100%; }
    .shape-grid-big { max-width: 100%; }
    .catch-zone-big,
    .star-zone-big,
    .bubble-zone-big { height: 360px !important; }
    .balloon-sky-big { height: 320px !important; }
}

@media (max-width: 480px) {
    header h1 { font-size: 20px; }
    .tagline { font-size: 11px; letter-spacing: 1px; }
    .top-bar { gap: 8px; font-size: 14px; }
    .top-bar span { padding: 5px 12px; min-width: 60px; }
    .reward-box { margin: 12px 14px 6px; }
    .btn-reward { width: 100%; max-width: 320px; padding: 14px 20px; font-size: 16px; }
    .menu { grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 10px 12px; }
    .btn-menu { font-size: 13px; padding: 14px 6px; min-height: 48px; }
    #content { margin: 6px 10px 12px; padding: 16px 12px; border-radius: 16px; }
    #content h2 { font-size: 18px; }
    .welcome { padding: 20px 4px; }
    .welcome h2 { font-size: 22px; }
    .welcome-badges { flex-direction: column; align-items: center; gap: 8px; }
    .letter-grid { grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: 8px; }
    .memory-grid { gap: 5px; }
    .mem-card { width: 100%; }
    .mem-front { font-size: 14px; }
    .mem-back  { font-size: 14px; }
    .mem-back span { font-size: 7px; }
    .mem-pair-img { width: 36px; height: 36px; }
    .creature-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
    .creature-emoji { font-size: 52px; }
    .creature-name { font-size: 13px; }
    .bird-img { width: 64px; height: 64px; }
    .balloon-sky { height: 260px; }
    .balloon-letter { font-size: 20px; width: 42px; height: 42px; }
    .balloon-sky-big { height: 280px !important; }
    .balloon-letter-big { font-size: 26px !important; width: 52px !important; height: 52px !important; }
    .kalima-arabic { font-size: 18px !important; }
    .quiz-emoji { font-size: 64px; }
    .quiz-emoji-big { min-height: 90px; }
    .quiz-bird-img { width: 80px; height: 80px; }
    .treasure-grid { grid-template-columns: repeat(4, 1fr); max-width: 100% !important; }
    .tg-5 { grid-template-columns: repeat(5, 1fr) !important; max-width: 100% !important; gap: 8px !important; }
    .treasure-box-big { font-size: 36px !important; min-height: 64px !important; }
    .ninja-grid { grid-template-columns: repeat(5, 1fr); gap: 6px; }
    .ninja-btn-big { font-size: 22px !important; min-height: 52px !important; }
    .color-quiz-btn-big { padding: 32px 10px !important; font-size: 18px !important; min-height: 90px !important; }
    .color-question strong { font-size: 22px !important; }
    .catch-zone { height: 300px; }
    .catch-zone-big { height: 300px !important; }
    .catch-letter-big { font-size: 44px !important; }
    .star-zone-big { height: 300px !important; }
    .bubble-zone-big { height: 300px !important; }
    .dash-bubble-big { width: 60px !important; height: 60px !important; }
    .mem-card-big { min-height: 64px; }
    .mem-back-big { font-size: 28px !important; }
    .memory-grid.mem-20 { grid-template-columns: repeat(4, 1fr) !important; }
    .puzzle-tile-kids { min-height: 38px !important; font-size: 12px !important; }
    .puzzle-grid-kids { max-width: min(96vw, 280px) !important; gap: 5px !important; }
    .puzzle-tile-big { min-height: 44px !important; font-size: clamp(16px, 4vw, 28px) !important; border-radius: 10px !important; }
    .puzzle-grid-big { gap: 5px !important; padding: 0 4px; }
    .shape-grid-big .shape-btn { font-size: 64px !important; min-height: 100px !important; padding: 20px !important; }
    .scramble-word-big { font-size: 28px !important; letter-spacing: 4px !important; }
    .scr-input-big { max-width: 100% !important; font-size: 18px !important; }
    .action-btn { min-height: 44px; }
    .cert-stats { grid-template-columns: repeat(2, 1fr); }
    .cert-name { font-size: 26px !important; }
    .cert-border-inner { padding: 20px 16px 24px; }
    .name-arabic { font-size: 26px; }
    .name-trans { font-size: 18px; }
    .islamic-tabs { gap: 6px; }
    .islamic-tab { padding: 8px 12px; font-size: 12px; }
    .footer-links { gap: 6px; }
    .footer-links button { font-size: 11px; padding: 8px 10px; min-height: 40px; }
    .theme-btn { right: 12px; }
    .toast { left: 10px; right: 10px; max-width: calc(100% - 20px); transform: translateX(0) translateY(20px); margin: 0 auto; width: calc(100% - 20px); }
    .toast.show { transform: translateX(0) translateY(0); }
    .adventure-card { min-height: 140px; padding: 14px 10px; }
    .adv-icon { font-size: 44px; }
    .adv-name { font-size: 15px; }
}

@media (max-width: 360px) {
    .menu { grid-template-columns: repeat(2, 1fr); }
    .btn-menu { font-size: 12px; }
    .memory-grid.mem-20 { grid-template-columns: repeat(4, 1fr) !important; }
    .tg-5 { grid-template-columns: repeat(4, 1fr) !important; }
    .ninja-grid-big { grid-template-columns: repeat(4, 1fr) !important; }
    .puzzle-tile-big { min-height: 38px !important; font-size: 14px !important; }
}
