:root {
    /* 🎨 TOKEN SYSTEM — "Certificate" palette */
    --ink: #0f2340;          /* primary navy */
    --ink-2: #1b3a63;        /* secondary navy */
    --gold: #b8873d;         /* brass accent */
    --gold-light: #d9a757;   /* gold gradient highlight */
    --gold-wash: #fbf3e4;    /* pale gold background wash */
    --paper: #eef0f4;        /* page background */
    --card: #ffffff;
    --ink-soft: #56637a;     /* secondary text */
    --line: #e2e6ee;
    --success: #1f9d6c;
    --danger: #c7443b;
    --font-display: 'Fraunces', serif;
    --font-body: 'Hind Vadodara', 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-body); background-color: var(--paper); color: var(--ink); position: relative; overflow-x: hidden; }

/* HEADER & MENU BAR  */
.top-navbar {
    background: var(--ink);
    color: white;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    border-bottom: 3px solid var(--gold);
}
.menu-trigger { font-size: 1.4rem; cursor: pointer; background: none; border: none; color: var(--gold-light); line-height: 1; }

header {
    background: linear-gradient(160deg, var(--ink) 0%, var(--ink-2) 100%);
    color: white; text-align: center; padding: 2.8rem 1.2rem 2.2rem;
    border-bottom: 3px solid var(--gold);
    border-radius: 0 0 22px 22px; margin-bottom: 1.8rem;
    position: relative;
}
header h1 { font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; letter-spacing: 0.2px; }
header p { color: #c7d2e3; margin-top: 8px; font-size: 0.95rem; }

/* SCREENS SYSTEM */
.screen { display: none; padding: 1rem; max-width: 800px; margin: 0 auto; }
.active { display: block; }

/* BRANCH BANNER HEADER CARD */
.branch-header-card {
    background: linear-gradient(135deg, #0f2340 0%, #1b3a63 100%);
    border-radius: 18px;
    padding: 1.2rem;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 35, 64, 0.2);
    margin-bottom: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.header-main-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.2rem;
}

.header-icon-box {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.header-text-box h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.header-text-box p {
    font-size: 0.85rem;
    color: #a0aec0;
    margin-top: 2px;
}

/* CLEAN BRANCH BANNER HEADER */
.branch-header-card {
    background: linear-gradient(135deg, #0f2340 0%, #1b3a63 100%);
    border-radius: 18px;
    padding: 1.2rem;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(15, 35, 64, 0.2);
    margin-bottom: 1.5rem;
}

.header-main-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.2rem;
}

.header-icon-box {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.header-text-box h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0;
}

.header-text-box p {
    font-size: 0.85rem;
    color: #a0aec0;
    margin-top: 2px;
}

.header-stats-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 10px 12px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.stat-icon {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
}

.blue-bg { background-color: #3182ce; }
.green-bg { background-color: #38a169; }
.orange-bg { background-color: #dd6b20; }

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.68rem;
    color: #cbd5e0;
    white-space: nowrap;
}

.stat-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
}

.stat-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.15);
}


/* BANNER PROGRESS BAR */
.header-progress-section {
    width: 100%;
}

.progress-bar-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff7a00 0%, #ff9e00 100%);
    border-radius: 10px;
    transition: width 0.4s ease;
}

.progress-footer-text {
    text-align: center;
    font-size: 0.8rem;
    color: #e2e8f0;
    margin-top: 6px;
    font-weight: 500;
}

/* SUBJECT / BRANCH CARDS */
.grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-top: 1.5rem; }
@media(min-width: 600px) { .grid { grid-template-columns: 1fr 1fr; } }

/* --- SUBJECT CARD STYLING WITH 3D ICON --- */
.card {
    background: var(--card);
    padding: 0.9rem 1.1rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--gold);
    box-shadow: 0 4px 12px rgba(15, 35, 64, 0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 35, 64, 0.1);
}
.card-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}
/* 3D ICON CONTAINER BOX */
.card-icon-box {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f0f4f9 0%, #e1e8f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.8), 0 2px 6px rgba(0,0,0,0.05);
}
.card-img-icon {
    width: 50px;
    height: 50px;
    object-fit: contain;
    position: absolute; /* Emoji ke upar image perfectly fit karne ke liye */
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}
.card-num {
    font-family: var(--font-mono); font-size: 0.75rem; font-weight: 700; color: var(--gold);
    background: var(--gold-wash); border-radius: 8px; padding: 4px 8px; flex-shrink: 0;
}
.card-title {
    font-weight: 700;
    font-size: 1.02rem;
    color: var(--ink);
    line-height: 1.3;
}
/* FALLBACK EMOJI STYLING */
.fallback-emoji {
    font-size: 1.4rem;
    line-height: 1;
}
.card:active {
    transform: scale(0.98);
}
.card-arrow { color: var(--gold); font-size: 1.1rem; flex-shrink: 0; }

/* CIRCULAR RING PROGRESS */
.ring {
    --pct: 0;
    width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
    background: conic-gradient(var(--gold) calc(var(--pct) * 3.6deg), #e5e8ee 0deg);
    display: flex; align-items: center; justify-content: center; padding: 3px;
}
.ring-lg { width: 56px; height: 56px; padding: 4px; }
.ring-inner {
    width: 100%; height: 100%; border-radius: 50%; background: var(--card);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-mono); font-weight: 700; color: var(--ink); font-size: 0.68rem;
}
.ring-lg .ring-inner { font-size: 0.78rem; }

/* BRANCH SLIM BAR */
.branch-bar-track { width: 100%; height: 6px; border-radius: 4px; background: #e5e8ee; margin-top: 6px; overflow: hidden; }
.branch-bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold) 0%, var(--gold-light) 100%); border-radius: 4px; }
.sub-perc { font-size: 0.8rem; color: var(--ink-soft); font-weight: 500; display: inline-block; margin-top: 6px; }

/* LIST ITEMS */
.list-item {
    background: var(--card); padding: 1rem 1.2rem; margin-bottom: 0.7rem;
    border-radius: 12px; display: flex; justify-content: space-between; align-items: center;
    border: 1px solid var(--line); cursor: pointer; font-weight: 500; transition: 0.15s;
}
.list-item:hover { border-color: var(--gold); }
.list-item.locked { color: #94a0b3; background: #f2f3f6; }
.list-item .score-chip {
    font-family: var(--font-mono); font-weight: 700; font-size: 0.85rem;
    color: var(--gold); background: var(--gold-wash); padding: 3px 10px; border-radius: 20px;
}

/* BUTTONS */
.btn {
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
    color: #2a1c04; border: none; padding: 13px 28px;
    font-size: 1rem; font-weight: 700; border-radius: 12px; cursor: pointer;
    box-shadow: 0 6px 16px rgba(184, 135, 61, 0.28);
}
.back-btn { background: none; border: none; color: var(--ink-2); font-weight: 600; cursor: pointer; margin-bottom: 1rem; font-size: 0.95rem; }

/* SIDEBAR DRAWER */
.sidebar {
    position: fixed; top: 0; left: -300px; width: 280px; height: 100%;
    background-color: var(--ink); color: white; z-index: 2000;
    transition: 0.3s ease; padding: 20px; box-shadow: 5px 0 25px rgba(0,0,0,0.3);
    display: flex; flex-direction: column;
}
.sidebar.open { left: 0; }
.sidebar-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(6, 14, 28, 0.55); z-index: 1999; display: none;
}
.sidebar-overlay.show { display: block; }

.sidebar-close { align-self: flex-end; background: none; border: none; color: #8b97ad; font-size: 1.5rem; cursor: pointer; }
.sidebar-brand { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: var(--gold-light); margin-bottom: 20px; border-bottom: 1px solid #2a3f5f; padding-bottom: 12px; }

/* PROFILE SECTION */
.profile-section { background: #16294a; padding: 14px; border-radius: 14px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 25px; border: 1px solid #26385a; }
.profile-left { display: flex; align-items: center; gap: 12px; }
.avatar { width: 40px; height: 40px; background: linear-gradient(135deg, var(--gold-light), var(--gold)); color: #2a1c04; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1rem; flex-shrink: 0; }
.profile-info { text-align: left; }
.profile-name { font-weight: 600; font-size: 0.92rem; color: #f3f4f6; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-status { font-size: 0.72rem; color: #8b97ad; margin-top: 2px; }

/* SIDEBAR MENU */
.sidebar-menu { list-style: none; flex-grow: 1; }
.sidebar-item { padding: 12px 14px; border-radius: 10px; margin-bottom: 6px; cursor: pointer; display: flex; align-items: center; gap: 12px; color: #9aa5ba; font-weight: 500; font-size: 0.92rem; transition: 0.2s; }
.sidebar-item:hover, .sidebar-item.active-menu { background: #1e2f4d; color: var(--gold-light); }

/* MODAL */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(6, 14, 28, 0.65); align-items: center; justify-content: center; z-index: 3000; backdrop-filter: blur(3px); }
.modal-content {
    background: var(--card); padding: 2rem 1.8rem; border-radius: 18px; text-align: center;
    max-width: 380px; margin: 1rem; color: var(--ink); position: relative; overflow: hidden;
    border-top: 4px solid var(--gold);
}
.modal-content h3 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; }
.modal-content p { color: var(--ink-soft); font-size: 0.92rem; margin-top: 10px; line-height: 1.5; }
.modal-content h2 { font-family: var(--font-display); font-size: 2.1rem; }

/* --- SUBJECTS BANNER HEADER CARD --- */
.subject-header-card {
    background: linear-gradient(135deg, #071e3d 0%, #0f2340 50%, #16325c 100%);
    border-radius: 20px;
    padding: 1.5rem;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px; /* Text aur Image ke beech safe distance */
    box-shadow: 0 10px 25px rgba(7, 30, 61, 0.25);
    margin-bottom: 1.8rem;
    position: relative;
    overflow: hidden;
    border-bottom: 4px solid #f97316;
}

.subject-header-left {
    flex: 1; /* Text apni jagah khud adjust karega */
    z-index: 2;
}

.subject-header-left h1 {
    font-family: var(--font-body);
    font-size: 1.4rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
    margin: 0;
}

.subject-title-line {
    width: 45px;
    height: 4px;
    background-color: var(--gold-light, #d9a757);
    border-radius: 4px;
    margin: 8px 0 10px 0;
}

.subject-header-left p {
    font-size: 0.85rem;
    color: #cbd5e0;
    line-height: 1.4;
    margin: 0;
}

/* RIGHT IMAGE CONTAINER */
.subject-header-right {
    flex-shrink: 0; /* Image text ko push nahi karegi */
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.subject-header-img {
    width: 130px; /* Perfect transparent icon size */
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 8px 18px rgba(0,0,0,0.4));
}

/* MOBILE RESPONSIVENESS */
@media (max-width: 480px) {
    .subject-header-card {
        padding: 1.2rem 1rem;
    }
    .subject-header-left h1 {
        font-size: 1.15rem;
    }
    .subject-header-left p {
        font-size: 0.75rem;
    }
    .subject-header-img {
        width: 100px;
    }
}
    
/* --- SCREEN 3: TYPE SELECT CARDS --- */
.type-cards-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.type-card {
    background: var(--card);
    border-radius: 16px;
    padding: 1.2rem;
    border: 1px solid var(--line);
    border-left: 4px solid var(--gold);
    box-shadow: 0 4px 15px rgba(15, 35, 64, 0.05);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.type-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 35, 64, 0.1);
}

.type-card:active {
    transform: scale(0.98);
}

.type-card-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
}

.type-icon-box {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.quiz-bg {
    background: #fff7ed;
    border: 1px solid #ffedd5;
}

.mock-bg {
    background: #f0fdf4;
    border: 1px solid #dcfce7;
}

.type-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.type-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--ink);
}

.type-subtext {
    font-size: 0.8rem;
    color: var(--ink-soft);
}

.type-card-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

.type-perc-badge {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gold);
    background: var(--gold-wash);
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

/* --- SCREEN 4: QUIZ LIST CARDS --- */
.quiz-list-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 1rem;
}

/* --- QUIZ CARD LAYOUT FIX --- */
.quiz-row-card {
    background: var(--card);
    border-radius: 14px;
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    box-shadow: 0 3px 10px rgba(15, 35, 64, 0.04);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.quiz-row-card:hover {
    transform: translateY(-2px);
    border-color: var(--gold);
}

.quiz-row-card.locked {
    background: #f8fafc;
    opacity: 0.85;
}

.quiz-card-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.quiz-status-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: bold;
    flex-shrink: 0;
}

.start-bg { background: #eff6ff; color: #2563eb; }
.done-bg { background: #f0fdf4; color: #16a34a; }
.lock-bg { background: #f1f5f9; color: #64748b; }

/* --- CLEAN QUIZ CARD ALIGNMENT FIX --- */
.quiz-card-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.quiz-card-title {
    font-weight: 700;
    font-size: 1rem;
    color: var(--ink);
}

/* TIME & SCORE STACK (Time Niche Aa Gaya) */
.quiz-stats-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.stats-pill-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap; /* Text ko kabi bhi doosri line me jaane nahi dega */
}

.stat-pill {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.score-pill {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.time-pill {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
    font-family: var(--font-mono);
}

.status-tag {
    font-size: 0.78rem;
    color: var(--ink-soft);
}

.quiz-card-subtext {
    font-size: 0.78rem;
    color: var(--ink-soft);
}

/* --- BUTTON FIX (SAME FIXED SIZE & NO OVERFLOW) --- */
.quiz-card-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-shrink: 0;
}

.quiz-action-btn {
    width: 82px;            /* Fixed Same Width for Retest, Start, Unlock */
    height: 34px;           /* Fixed Same Height */
    font-size: 0.78rem;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.btn-play { background: var(--gold-wash); color: var(--gold); }
.btn-lock { background: #e2e8f0; color: #475569; }
