/* Netlify Drawer & Injected Element Blocker */
    #netlify-drawer, [data-netlify-drawer], div[class*="netlify-drawer"], iframe[src*="netlify"], netlify-drawer {
      display: none !important; visibility: hidden !important; opacity: 0 !important; pointer-events: none !important;
    }

    :root {
      --navy-dark: #081430;
      --navy-card: #0f224a;
      --navy-accent: #1e3a8a;
      --accent-gold: #f59e0b;
      --accent-green: #10b981;
      --accent-red: #ef4444;
      --bg-light: #f1f5f9;
      --card-white: #ffffff;
      --text-dark: #1e293b;
      --text-muted: #64748b;
      --app-font: 'Poppins', 'Noto Sans Devanagari', sans-serif;
    }

    * { margin: 0; padding: 0; box-sizing: border-box; font-family: var(--app-font); -webkit-tap-highlight-color: transparent; }
    body { background-color: var(--bg-light); color: var(--text-dark); min-height: 100vh; overflow-x: hidden; padding-bottom: 135px; }

    /* Splash Screen */
    #splashScreen {
      position: fixed; inset: 0; background: var(--navy-dark);
      z-index: 10000005 !important; display: none !important; flex-direction: column; align-items: center; justify-content: center;
      padding: 24px; text-align: center; color: #fff;
    }
    .splash-logo-ring {
      width: 130px; height: 130px; border-radius: 50%; padding: 4px;
      background: linear-gradient(135deg, var(--accent-gold), #3b82f6);
      box-shadow: 0 10px 30px rgba(0,0,0,0.5); margin-bottom: 20px;
    }
    .splash-logo { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: #fff; }
    .splash-title { font-size: 24px; font-weight: 800; color: #ffffff; margin-bottom: 4px; }
    .splash-tagline { font-size: 13px; color: var(--accent-gold); font-weight: 600; margin-bottom: 24px; }
    .splash-progress-track { width: 180px; height: 5px; background: rgba(255,255,255,0.15); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
    .splash-progress-bar { width: 0%; height: 100%; background: var(--accent-gold); border-radius: 10px; transition: width 0.8s ease; }
    .splash-skip-btn { margin-top: 15px; padding: 6px 18px; font-size: 12px; color: #cbd5e1; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15); border-radius: 20px; cursor: pointer; }

    /* Student Registration Modal */
    #studentRegModal {
      position: fixed; inset: 0; background: rgba(8, 20, 48, 0.85); backdrop-filter: blur(5px);
      z-index: 90000; display: none; align-items: center; justify-content: center; padding: 20px;
    }
    .reg-card {
      background: #ffffff; width: 100%; max-width: 380px; border-radius: 16px; padding: 24px 20px;
      box-shadow: 0 15px 35px rgba(0,0,0,0.3); text-align: center;
    }

    /* App Header */
    .app-header {
      background: var(--navy-dark); color: #fff; padding: 12px 16px;
      display: flex; align-items: center; justify-content: space-between;
      position: sticky; top: 0; z-index: 100; box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    }
    .header-left { display: flex; align-items: center; gap: 12px; }
    .header-btn { background: none; border: none; color: #fff; font-size: 19px; cursor: pointer; padding: 4px; display: flex; align-items: center; justify-content: center; }
    .header-brand { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 800; }
    .header-logo-mini { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; border: 1.5px solid var(--accent-gold); background:#fff; }
    .header-right { display: flex; align-items: center; gap: 14px; }
    .cloud-live-indicator { display: flex; align-items: center; gap: 5px; font-size: 11px; color: #10b981; font-weight: 600; background: rgba(16,185,129,0.15); padding: 3px 8px; border-radius: 12px; }
    .cloud-dot { width: 7px; height: 7px; border-radius: 50%; background: #10b981; box-shadow: 0 0 8px #10b981; }

    /* Drawer */
    .drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
    .drawer-overlay.active { opacity: 1; pointer-events: auto; }
    .side-drawer {
      position: fixed; top: 0; left: 0; bottom: 0; width: 285px; background: #ffffff;
      z-index: 1001; transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      display: flex; flex-direction: column; overflow-y: auto;
    }
    .drawer-overlay.active .side-drawer { transform: translateX(0); }
    .drawer-header { background: var(--navy-dark); color: #fff; padding: 22px 16px; display: flex; align-items: center; gap: 12px; }
    .drawer-avatar { width: 50px; height: 50px; border-radius: 50%; border: 2px solid var(--accent-gold); object-fit: cover; background: #fff; }
    .drawer-user h4 { font-size: 15px; font-weight: 700; }
    .drawer-user p { font-size: 11px; color: #cbd5e1; }
    .drawer-menu { padding: 10px 0; }
    .drawer-item { display: flex; align-items: center; gap: 14px; padding: 12px 18px; color: #334155; font-size: 13.5px; font-weight: 500; cursor: pointer; text-decoration: none; border-left: 3px solid transparent; }
    .drawer-item:hover, .drawer-item.active { background: #f8fafc; border-left-color: var(--accent-gold); color: var(--navy-dark); font-weight: 600; }
    .drawer-item i { width: 20px; font-size: 16px; color: var(--navy-accent); }

    /* Containers */
    .page-container { padding: 14px; max-width: 600px; margin: 0 auto; display: none; }
    .page-container.active { display: block; }

    /* Welcome Banner */
    .welcome-card {
      background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy-card) 100%);
      color: #fff; border-radius: 16px; padding: 18px; display: flex;
      align-items: center; justify-content: space-between; margin-bottom: 14px;
      position: relative; overflow: hidden; box-shadow: 0 4px 15px rgba(8,20,48,0.12);
    }
    .welcome-text h3 { font-size: 17px; font-weight: 700; margin-bottom: 3px; }
    .welcome-text p { font-size: 12px; color: #cbd5e1; }
    .welcome-avatar { width: 54px; height: 54px; border-radius: 50%; border: 2px solid #fff; object-fit: cover; background: #fff; }

    /* Ad Slider */
    .ad-slider-wrapper {
      position: relative; width: 100%; border-radius: 16px; overflow: hidden;
      margin-bottom: 16px; box-shadow: 0 4px 15px rgba(8,20,48,0.12);
      background: #081430; aspect-ratio: 16 / 7.5; display: none;
    }
    .ad-slider-track { display: flex; height: 100%; transition: transform 0.45s ease-in-out; }
    .ad-slide-item { min-width: 100%; width: 100%; height: 100%; }
    .ad-slide-item img { width: 100%; height: 100%; object-fit: cover; }
    .ad-slider-dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
    .ad-dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,0.4); }
    .ad-dot.active { width: 20px; border-radius: 10px; background: var(--accent-gold); }

    /* Notice Board */
    .notice-board-section { background: #fff; border-radius: 14px; padding: 14px; margin-bottom: 16px; border: 1px solid #e2e8f0; display: none; }
    .notice-posters-scroll { display: flex; gap: 10px; overflow-x: auto; padding-top: 8px; scrollbar-width: none; }
    .notice-posters-scroll::-webkit-scrollbar { display: none; }
    .notice-poster-card { min-width: 200px; max-width: 200px; border-radius: 10px; overflow: hidden; background: #f8fafc; border: 1px solid #cbd5e1; cursor: pointer; flex-shrink: 0; }
    .notice-poster-card img { width: 100%; height: 130px; object-fit: cover; }
    .notice-poster-title { font-size: 11.5px; font-weight: 700; color: #1e293b; padding: 8px; }

    /* Social Section */
    .social-share-section { background: #fff; border-radius: 14px; padding: 14px; margin-bottom: 16px; border: 1px solid #e2e8f0; text-align: center; display: none; }
    .social-icons-wrap { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
    .social-link-btn { display: flex; flex-direction: column; align-items: center; text-decoration: none; }
    .social-icon-img { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; border: 1.5px solid #e2e8f0; }
    .social-icon-label { font-size: 10.5px; font-weight: 600; color: #475569; margin-top: 4px; }

    /* Series Shortcuts */
    .grid-shortcuts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
    .grid-item { background: #fff; border-radius: 14px; padding: 12px 6px; display: flex; flex-direction: column; align-items: center; text-align: center; cursor: pointer; border: 1px solid #eef2f6; }
    .grid-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 19px; margin-bottom: 6px; overflow: hidden; }
    .grid-icon img { width: 100%; height: 100%; object-fit: cover; }
    .grid-label { font-size: 11px; font-weight: 600; color: #334155; }

    /* Subcat pills */
    .subcat-pills-bar { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 14px 0; margin-bottom: 8px; scrollbar-width: none; }
    .subcat-pills-bar::-webkit-scrollbar { display: none; }
    .subcat-pill { padding: 6px 14px; border-radius: 20px; background: #e2e8f0; color: #334155; font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer; }
    .subcat-pill.active { background: var(--navy-accent); color: #fff; }

    /* Cards */
    .section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
    .section-title { font-size: 15px; font-weight: 700; color: var(--text-dark); display: flex; align-items: center; gap: 6px; }
    .test-card { background: #fff; border-radius: 14px; padding: 14px; margin-bottom: 12px; border: 1px solid #eef2f6; }
    .test-badge-row { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; flex-wrap: wrap; }
    .badge { font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 6px; text-transform: uppercase; }
    .badge-paid { background: #fee2e2; color: #b91c1c; border: 1px solid #f87171; }
    .badge-free { background: #dcfce7; color: #166534; }
    .badge-locked { background: #fef2f2; color: #991b1b; border: 1px solid #fca5a5; }
    .test-title { font-size: 14px; font-weight: 700; color: #1e293b; margin-bottom: 2px; }
    .test-subtitle { font-size: 11.5px; color: var(--text-muted); margin-bottom: 10px; }
    .test-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: 1px dashed #f1f5f9; gap: 8px; flex-wrap: wrap; }
    .btn-start { background: var(--navy-accent); color: #fff; border: none; padding: 6px 14px; border-radius: 8px; font-size: 11.5px; font-weight: 600; cursor: pointer; }
    .btn-start:disabled { background: #94a3b8 !important; cursor: not-allowed; }

    .admin-inline-actions { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
    .btn-admin-direct { padding: 4px 8px; border-radius: 6px; font-size: 10.5px; font-weight: 700; cursor: pointer; border: 1px solid; display: inline-flex; align-items: center; gap: 3px; }
    .reorder-btn { background: #e2e8f0; border: none; padding: 4px 8px; border-radius: 4px; cursor: pointer; font-size: 11px; font-weight: bold; }

    /* Bottom Nav & Contact Bar */
    .bottom-nav {
      position: fixed; bottom: 56px; left: 0; right: 0; height: 60px;
      background: #ffffff; border-top: 1px solid #e2e8f0; display: flex;
      justify-content: space-around; align-items: center; z-index: 99999;
      box-shadow: 0 -3px 12px rgba(0,0,0,0.12);
    }
    .nav-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); font-size: 10.5px; font-weight: 600; cursor: pointer; flex: 1; height: 100%; border: none; background: none; }
    .nav-tab i { font-size: 18px; margin-bottom: 2px; }
    .nav-tab.active { color: var(--navy-accent); }

    .bottom-whatsapp-bar {
      position: fixed; bottom: 0; left: 0; right: 0; height: 56px;
      background: #081430; color: #ffffff; display: flex; align-items: center;
      justify-content: space-between; padding: 0 16px; z-index: 99998;
      border-top: 1px solid rgba(255,255,255,0.12);
    }
    .bottom-whatsapp-btn {
      display: inline-flex; align-items: center; gap: 8px; background: #25d366;
      color: #ffffff; text-decoration: none; padding: 6px 14px; border-radius: 20px;
      font-size: 12.5px; font-weight: 700;
    }

    /* Modals */
    .fullscreen-modal { position: fixed; inset: 0; background: #fff; z-index: 9999999 !important; display: none; flex-direction: column; }
    #quizRunnerModal .quiz-frame-wrapper {
      flex: 1;
      width: 100%;
      height: calc(100dvh - 52px);
      padding-bottom: 72px;
      box-sizing: border-box;
      position: relative;
      background: #ffffff;
      overflow: hidden;
    }
    #quizRunnerModal #htmlQuizFrame {
      width: 100%;
      height: 100%;
      border: none;
      display: block;
    }
    .home-install-card {
      background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
      border: 1.5px solid #f59e0b;
      border-radius: 14px;
      padding: 12px 14px;
      margin-bottom: 18px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      box-shadow: 0 3px 10px rgba(245, 158, 11, 0.14);
    }
    .fullscreen-modal.active { display: flex !important; }
    .modal-nav { background: var(--navy-dark); color: #fff; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 10000000; }
    .close-btn { background: none; border: none; color: #fff; font-size: 28px; cursor: pointer; line-height: 1; font-weight: bold; }
    .logout-btn { background: var(--accent-red); color: #fff; border: none; padding: 5px 12px; border-radius: 6px; font-size: 11px; font-weight: 700; cursor: pointer; }

    /* Admin Tabs */
    .admin-nav-tabs { display: flex; background: #e2e8f0; border-bottom: 1px solid #cbd5e1; overflow-x: auto; }
    .admin-nav-btn { flex: 1; min-width: 125px; padding: 10px 4px; font-size: 11.5px; font-weight: 700; border: none; background: transparent; cursor: pointer; color: #475569; white-space: nowrap; }
    .admin-nav-btn.active { background: #fff; color: var(--navy-accent); border-bottom: 2.5px solid var(--navy-accent); }
    .admin-section { display: none; padding: 16px; overflow-y: auto; flex: 1; }
    .admin-section.active { display: block; }

    .form-group { margin-bottom: 12px; text-align: left; }
    .form-group label { display: block; font-size: 12px; font-weight: 600; color: #334155; margin-bottom: 4px; }
    .form-control { width: 100%; padding: 10px 12px; border: 1.5px solid #cbd5e1; border-radius: 8px; font-size: 13px; outline: none; }
    .btn-submit { width: 100%; background: var(--navy-accent); color: #fff; border: none; padding: 11px; border-radius: 8px; font-size: 13px; font-weight: 700; cursor: pointer; }
    .card-box { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 12px; padding: 14px; margin-bottom: 14px; }
    .card-title { font-size: 13.5px; font-weight: 700; color: var(--navy-dark); margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }

    .batch-checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; background: #fff; border: 1px solid #cbd5e1; padding: 10px; border-radius: 8px; max-height: 150px; overflow-y: auto; }
    .batch-check-item { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: #334155; cursor: pointer; }

    .thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; margin-top: 8px; }
    .thumb-item { position: relative; border-radius: 8px; overflow: hidden; height: 65px; border: 1px solid #cbd5e1; }
    .thumb-item img { width: 100%; height: 100%; object-fit: cover; }
    .thumb-del-btn { position: absolute; top: 3px; right: 3px; background: rgba(239,68,68,0.85); color: #fff; border: none; border-radius: 50%; width: 20px; height: 20px; font-size: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

    .switch-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; }
    .switch-ui { position: relative; width: 42px; height: 22px; background: #cbd5e1; border-radius: 20px; transition: background 0.3s; }
    .switch-ui::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform 0.3s; }
    input[type="checkbox"].switch-checkbox { display: none; }
    input[type="checkbox"].switch-checkbox:checked + .switch-ui { background: var(--accent-green); }
    input[type="checkbox"].switch-checkbox:checked + .switch-ui::after { transform: translateX(20px); }

    /* Quiz Question & Option Editor Grid */
    .editor-q-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
      gap: 7px;
      max-height: 175px;
      overflow-y: auto;
      padding: 6px;
      background: #f8fafc;
      border-radius: 8px;
      border: 1px solid #e2e8f0;
    }
    .editor-q-num-btn {
      height: 38px;
      border-radius: 8px;
      border: 1.5px solid #cbd5e1;
      background: #ffffff;
      color: #1e293b;
      font-size: 12.5px;
      font-weight: 700;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.15s ease;
    }
    .editor-q-num-btn:hover {
      border-color: var(--navy-accent);
      background: #eff6ff;
    }
    .editor-q-num-btn.active {
      background: var(--navy-accent);
      color: #ffffff;
      border-color: var(--navy-accent);
      box-shadow: 0 2px 6px rgba(30, 58, 138, 0.3);
    }
    .editor-opt-row {
      display: flex;
      align-items: center;
      gap: 8px;
      background: #f8fafc;
      padding: 8px 10px;
      border-radius: 8px;
      border: 1.5px solid #e2e8f0;
    }
    .editor-opt-row.is-correct {
      background: #f0fdf4;
      border-color: #22c55e;
    }
    .editor-opt-badge {
      width: 26px;
      height: 26px;
      border-radius: 50%;
      background: #e2e8f0;
      color: #334155;
      font-size: 12px;
      font-weight: 800;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }
    .editor-opt-row.is-correct .editor-opt-badge {
      background: #16a34a;
      color: #ffffff;
    }

    /* Custom High-Z-Index Popup Overlay (Report & Move Series Modals) */
    .custom-popup-overlay {
      position: fixed;
      inset: 0;
      background: rgba(8, 20, 48, 0.78);
      backdrop-filter: blur(4px);
      z-index: 10000010 !important;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 16px;
    }
    .custom-popup-overlay.active {
      display: flex !important;
    }
    .custom-popup-card {
      background: #ffffff;
      width: 100%;
      max-width: 420px;
      border-radius: 14px;
      padding: 18px;
      box-shadow: 0 20px 45px rgba(0,0,0,0.35);
      animation: popScaleIn 0.2s ease;
    }
    @keyframes popScaleIn {
      from { transform: scale(0.94); opacity: 0; }
      to { transform: scale(1); opacity: 1; }
    }

    /* Notice Board / Announcement Launcher Card (Below Series, Install & Latest) */
    .notice-board-launcher-card {
      background: linear-gradient(135deg, #ffffff 0%, #fef2f2 100%);
      border: 1.5px solid #fca5a5;
      border-left: 5px solid #ef4444;
      border-radius: 14px;
      padding: 13px 14px;
      margin-top: 6px;
      margin-bottom: 18px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      cursor: pointer;
      box-shadow: 0 4px 12px rgba(239, 68, 68, 0.1);
      transition: transform 0.15s ease, box-shadow 0.15s ease;
    }
    .notice-board-launcher-card:active {
      transform: scale(0.985);
    }
    .notice-launcher-icon {
      width: 42px;
      height: 42px;
      border-radius: 11px;
      background: #fee2e2;
      color: #dc2626;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      flex-shrink: 0;
    }

    /* Sub-Series Folder Grid & Pills */
    .folder-cards-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
      margin-bottom: 14px;
    }
    .folder-card-item {
      background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
      border: 1.5px solid #fcd34d;
      border-radius: 12px;
      padding: 11px 12px;
      display: flex;
      align-items: center;
      gap: 10px;
      cursor: pointer;
      transition: all 0.15s ease;
    }
    .folder-card-item.active {
      background: linear-gradient(135deg, #081430 0%, #1e3a8a 100%);
      border-color: #f59e0b;
      color: #ffffff;
    }
    .folder-card-item.active .folder-card-title {
      color: #ffffff;
    }
    .folder-card-item.active .folder-card-sub {
      color: #fde68a;
    }
    .folder-card-icon {
      width: 36px;
      height: 36px;
      border-radius: 9px;
      background: #f59e0b;
      color: #081430;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      flex-shrink: 0;
    }
    .folder-card-title {
      font-size: 12.5px;
      font-weight: 700;
      color: #1e293b;
      line-height: 1.25;
    }
    .folder-card-sub {
      font-size: 10.5px;
      color: #92400e;
      font-weight: 600;
      margin-top: 2px;
    }
    .admin-folder-chip {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: #ffffff;
      border: 1px solid #f59e0b;
      border-radius: 8px;
      padding: 4px 8px;
      font-size: 11.5px;
      font-weight: 700;
      color: #1e293b;
    }
