:root {
    --bg-primary: #f8fafc;
    --bg-card: #ffffff;
    --bg-subtle: #f1f5f9;
    --text-main: #0f172a;
    --text-muted: #475569;
    --indigo-deep: #1e1b4b;
    --indigo-mid: #312e81;
    --saffron-main: #ea580c;
    --saffron-hover: #c2410c;
    --saffron-soft: #fff7ed;
    --border-color: #e2e8f0;
    --success: #16a34a;
    --radius-xl: 22px;
    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow-sm: 0 4px 16px rgba(15, 23, 42, 0.06);
    --shadow-lg: 0 18px 42px rgba(15, 23, 42, 0.12);
}

[data-theme="dark"] {
    --bg-primary: #090d16;
    --bg-card: #111827;
    --bg-subtle: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --indigo-deep: #1e1b4b;
    --indigo-mid: #3730a3;
    --saffron-main: #f97316;
    --saffron-hover: #ea580c;
    --saffron-soft: rgba(249, 115, 22, 0.14);
    --border-color: #1f2937;
}

/* CRITICAL FIX: Ensure HTML [hidden] attribute always overrides flex/grid rules */
[hidden] {
    display: none !important;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
}

body.samarthya-app-body {
    margin: 0;
    padding: 0;
    background: var(--bg-primary);
    color: var(--text-main);
    font-family: 'Mukta', 'Plus Jakarta Sans', sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* 1. FAVICON PRELOADER & LAZY-LOADER */
.sam-preloader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.sam-preloader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-inner {
    position: relative;
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preloader-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3.5px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--saffron-main);
    animation: samSpin 0.95s linear infinite;
}

.preloader-favicon {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    object-fit: cover;
    animation: samPulse 1.5s ease-in-out infinite;
}

.preloader-caption {
    margin-top: 14px;
    color: #f8fafc;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

@keyframes samSpin {
    to { transform: rotate(360deg); }
}

@keyframes samPulse {
    0%, 100% { transform: scale(0.95); }
    50% { transform: scale(1.06); }
}

.sam-lazy-img {
    opacity: 0;
    transition: opacity 0.4s ease;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 36px 36px;
}

.sam-lazy-img.loaded {
    opacity: 1;
}

/* 2. RUNNING PUBLIC INTEREST DISCLOSURE MARQUEE STRIP */
.public-disclosure-strip {
    background: #fef3c7;
    color: #92400e;
    border-bottom: 1px solid #fde68a;
    font-size: 12.5px;
    overflow: hidden;
    white-space: nowrap;
    padding: 6px 0;
    position: relative;
    z-index: 60;
}

[data-theme="dark"] .public-disclosure-strip {
    background: #1e1b4b;
    color: #fde68a;
    border-bottom-color: #312e81;
}

.marquee-track {
    display: inline-flex;
    gap: 56px;
    padding-left: 100%;
    animation: samMarquee 38s linear infinite;
}

.public-disclosure-strip:hover .marquee-track {
    animation-play-state: paused;
}

@keyframes samMarquee {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

/* 3. APP SHELL & HEADER */
.app-shell {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--indigo-deep);
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.header-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.brand-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.brand-favicon-img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    border: 2px solid var(--saffron-main);
    background: #fff;
}

.brand-title {
    margin: 0;
    font-size: 18px;
    line-height: 1.15;
    font-weight: 800;
}

.offline-pill {
    font-size: 11px;
    color: #fed7aa;
    display: block;
}

.desktop-nav-links {
    display: none;
    align-items: center;
    gap: 20px;
}

.desktop-nav-links a {
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 600;
    transition: color 0.15s;
}

.desktop-nav-links a:hover {
    color: #fed7aa;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pill-btn {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 6px 11px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
}

.btn-header-auth {
    display: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.btn-header-exam {
    display: none;
    background: var(--saffron-main);
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(234, 88, 12, 0.35);
}

/* 4. VIEWPORT & RESPONSIVE CONTAINER */
.app-viewport {
    flex: 1;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    padding: 14px 14px 96px;
}

@media (min-width: 960px) {
    .desktop-nav-links {
        display: flex;
    }
    .btn-header-auth,
    .btn-header-exam {
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }
    .app-viewport {
        max-width: 1240px;
        padding: 32px 24px 64px;
    }
    .bottom-nav {
        display: none !important;
    }
}

/* 5. HOMEPAGE SECTIONS */
.home-hero-grid {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 60%, #4338ca 100%);
    color: #ffffff;
    border-radius: var(--radius-xl);
    padding: 24px 20px;
    margin-bottom: 22px;
    box-shadow: var(--shadow-lg);
    display: grid;
    gap: 24px;
}

@media (min-width: 960px) {
    .home-hero-grid {
        grid-template-columns: 1.35fr 1fr;
        align-items: center;
        padding: 48px 44px;
        margin-bottom: 36px;
    }
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.24);
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 14px;
}

.hero-headline {
    margin: 0 0 12px;
    font-size: clamp(24px, 3.5vw, 42px);
    line-height: 1.2;
    font-weight: 800;
}

.hero-subtext {
    margin: 0 0 22px;
    font-size: clamp(14.5px, 1.4vw, 17px);
    opacity: 0.92;
    line-height: 1.65;
}

.hero-cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.hero-cta-row .btn-primary {
    width: auto;
    min-width: 210px;
}

.hero-cta-row .btn-ghost-light {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    padding: 13px 20px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}

.hero-QuickBracketCard {
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.sec-block {
    margin-bottom: 28px;
}

@media (min-width: 960px) {
    .sec-block {
        margin-bottom: 48px;
    }
}

.sec-header {
    margin-bottom: 16px;
}

.sec-tag {
    display: inline-block;
    color: var(--saffron-main);
    background: var(--saffron-soft);
    padding: 4px 10px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.sec-title {
    margin: 0;
    font-size: clamp(20px, 2.4vw, 30px);
    font-weight: 800;
}

.responsive-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

@media (min-width: 768px) {
    .responsive-card-grid.cols-3 {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
    .responsive-card-grid.cols-4 {
        grid-template-columns: repeat(4, 1fr);
        gap: 18px;
    }
    .responsive-card-grid.cols-2 {
        grid-template-columns: repeat(2, 1fr);
        gap: 22px;
    }
}

.sam-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.sam-card.interactive-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.step-badge {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--saffron-soft);
    color: var(--saffron-main);
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
}

/* 6. SPLIT LOGIN / SIGNUP PAGE */
.split-auth-wrapper {
    display: grid;
    grid-template-columns: 1fr;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    margin-bottom: 24px;
}

@media (min-width: 900px) {
    .split-auth-wrapper {
        grid-template-columns: 1.05fr 1.25fr;
        min-height: 620px;
    }
    .split-auth-wrapper.mode-register .split-brand-pane {
        order: 2;
    }
    .split-auth-wrapper.mode-register .split-form-pane {
        order: 1;
    }
}

.split-brand-pane {
    background: linear-gradient(145deg, #1e1b4b 0%, #312e81 100%);
    color: #ffffff;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

@media (min-width: 900px) {
    .split-brand-pane {
        padding: 42px 36px;
    }
}

.split-form-pane {
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

@media (min-width: 900px) {
    .split-form-pane {
        padding: 40px 44px;
    }
}

.auth-mode-switcher {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--bg-subtle);
    padding: 5px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.auth-switch-tab {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 10px 12px;
    border-radius: 9px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-switch-tab.active {
    background: var(--saffron-main);
    color: #ffffff;
    box-shadow: 0 3px 10px rgba(234, 88, 12, 0.25);
}

/* 7. BUTTONS, FORMS & QUIZ CONTROLS */
.btn-primary {
    width: 100%;
    background: var(--saffron-main);
    color: #ffffff;
    border: none;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 15.5px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.12s ease;
}

.btn-primary:hover {
    background: var(--saffron-hover);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-outline {
    width: 100%;
    background: transparent;
    color: var(--text-main);
    border: 1.5px solid var(--border-color);
    padding: 12px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.option-btn {
    width: 100%;
    text-align: left;
    background: var(--bg-card);
    color: var(--text-main);
    border: 2px solid var(--border-color);
    padding: 13px 15px;
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    font-size: 14.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.option-btn:hover,
.option-btn.selected {
    border-color: var(--saffron-main);
    background: var(--saffron-soft);
}

.option-key {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--indigo-deep);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.progress-track {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-fill {
    height: 100%;
    background: var(--saffron-main);
    transition: width 0.25s ease;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 640px) {
    .form-grid-2 {
        grid-template-columns: 1fr 1fr;
    }
}

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-muted);
}

.form-input {
    width: 100%;
    padding: 11px 13px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-main);
    font-size: 14.5px;
}

/* FAQ Accordion */
.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    overflow: hidden;
}

.faq-item summary {
    padding: 15px 18px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item p {
    margin: 0;
    padding: 0 18px 16px;
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.65;
}

/* Paywall & Price Anchor */
.paywall-blur-box {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    padding: 20px;
    background: var(--bg-card);
}

.paywall-blurred-content {
    filter: blur(6px);
    user-select: none;
    pointer-events: none;
    opacity: 0.55;
}

.paywall-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    text-align: center;
    color: #ffffff;
}

.price-strike {
    text-decoration: line-through;
    color: #94a3b8;
    font-size: 14px;
    margin-right: 6px;
}

/* 8. FOOTER */
.sam-footer {
    background: var(--indigo-deep);
    color: #e2e8f0;
    border-radius: var(--radius-xl);
    padding: 32px 22px;
    margin-top: 28px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    padding-bottom: 22px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

@media (min-width: 840px) {
    .footer-grid {
        grid-template-columns: 1.5fr 1fr 1fr;
    }
}

.footer-link-btn {
    background: none;
    border: none;
    color: #fed7aa;
    padding: 4px 0;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    display: block;
    text-align: left;
    text-decoration: underline;
}

/* 9. FLOATING SCROLL-TO-TOP, CONFETTI CANVAS & LEGAL MODAL */
.scroll-top-btn {
    position: fixed;
    right: 18px;
    bottom: 84px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--saffron-main);
    color: #ffffff;
    border: none;
    font-size: 20px;
    font-weight: 800;
    cursor: pointer;
    z-index: 80;
    box-shadow: 0 8px 22px rgba(234, 88, 12, 0.4);
}

@media (min-width: 960px) {
    .scroll-top-btn {
        bottom: 28px;
        right: 28px;
    }
}

.confetti-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9990;
}

.legal-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(9, 13, 22, 0.72);
    backdrop-filter: blur(5px);
    z-index: 9500;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.legal-modal-backdrop.is-open {
    display: flex;
}

.legal-modal-card {
    background: var(--bg-card);
    color: var(--text-main);
    width: 100%;
    max-width: 720px;
    max-height: 84vh;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.legal-modal-header {
    padding: 16px 22px;
    background: var(--indigo-deep);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.legal-modal-header h3 {
    margin: 0;
    font-size: 17px;
}

.icon-btn-close {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
}

.legal-modal-body {
    padding: 22px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.7;
}

/* Sticky Mobile Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
    z-index: 55;
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
}

.nav-item.active {
    color: var(--saffron-main);
    font-weight: 800;
}

.nav-icon {
    font-size: 19px;
}

.app-toast {
    position: fixed;
    bottom: 82px;
    left: 50%;
    transform: translateX(-50%);
    background: #0f172a;
    color: #fff;
    padding: 11px 20px;
    border-radius: 999px;
    font-size: 13.5px;
    font-weight: 600;
    z-index: 9800;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}