/* =============================================================
   BROPRO LEARNING HUB — NATIVE LEARNING EXPERIENCE
   Device-adaptive application shell loaded after all hub styles.
   ============================================================= */

:root {
    --learn-native-bar-height: 64px;
    --learn-app-max: 1520px;
    --learn-gutter: clamp(0.75rem, 2.4vw, 2rem);
    --learn-spring: cubic-bezier(0.16, 1, 0.3, 1);
    --learn-press: 0.97;
}

html {
    min-height: 100%;
    scroll-padding-top: 76px;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body[data-auth-theme="learn"] {
    min-height: 100vh;
    min-height: 100dvh;
    overscroll-behavior-y: none;
    -webkit-tap-highlight-color: transparent;
}

body[data-auth-theme="learn"] button,
body[data-auth-theme="learn"] a,
body[data-auth-theme="learn"] [role="button"] {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

body[data-auth-theme="learn"] button,
body[data-auth-theme="learn"] input,
body[data-auth-theme="learn"] textarea,
body[data-auth-theme="learn"] select {
    font: inherit;
}

body[data-auth-theme="learn"] :focus-visible {
    outline: 3px solid color-mix(in srgb, var(--hub-emerald-bright) 72%, transparent);
    outline-offset: 3px;
}

.navbar {
    min-height: 66px;
    padding-inline: max(var(--learn-gutter), env(safe-area-inset-left, 0px)) max(var(--learn-gutter), env(safe-area-inset-right, 0px));
}

.nav-container {
    width: 100%;
}

.nav-logo,
.nav-essential,
.nav-essential > * {
    flex: 0 0 auto;
}

.auth-btn,
.theme-toggle,
.sound-toggle,
.mobile-menu-btn {
    min-width: 44px;
    min-height: 44px;
}

/* The first screen gets students to learning quickly. */
.hero {
    width: min(100%, var(--learn-app-max));
    min-height: 500px;
    padding: 106px var(--learn-gutter) 2.6rem;
    gap: clamp(1.5rem, 5vw, 4rem);
}

.hero-content {
    max-width: 760px;
}

.hero-badge {
    margin-bottom: 1rem;
}

.hero-title {
    max-width: 13ch;
    margin-bottom: 1rem;
    font-size: clamp(2.8rem, 5vw, 4.8rem);
    line-height: 0.98;
    text-wrap: balance;
}

.hero-subtitle {
    max-width: 58ch;
    margin-bottom: 1.25rem;
    font-size: 1.05rem;
}

.hero-cta {
    margin-bottom: 1rem;
}

.hero-cta .btn {
    min-height: 48px;
    border-radius: 15px;
}

.hero-stats {
    min-height: 66px;
}

.orbit-container {
    width: 270px;
    height: 270px;
}

.orbit {
    width: 250px;
    height: 250px;
    margin: -125px 0 0 -125px;
}

.center-icon {
    width: 80px;
    height: 80px;
    border-radius: 24px;
    font-size: 3.2rem;
}

.activity-ticker-section {
    padding-block: 0.9rem;
}

.activity-ticker-container {
    max-width: var(--learn-app-max);
    padding-inline: var(--learn-gutter);
}

.ticker-header {
    margin-bottom: 0.55rem;
}

.ticker-item {
    min-height: 48px;
    padding: 0.55rem 0.9rem;
}

.section-container {
    max-width: var(--learn-app-max);
    padding: clamp(2.6rem, 5vw, 4.5rem) var(--learn-gutter);
}

.section-header {
    margin-bottom: clamp(1.3rem, 2.7vw, 2.2rem);
}

.section-title {
    font-size: clamp(1.7rem, 3vw, 2.55rem);
}

.section-subtitle {
    max-width: 64ch;
    font-size: 1rem;
    line-height: 1.55;
}

/* Compact, premium subject catalogue. */
.subjects-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(0.7rem, 1.35vw, 1rem);
}

.subject-card {
    position: relative;
    min-width: 0;
    min-height: 285px;
    border-radius: 20px;
    cursor: pointer;
    transform: translateZ(0);
    transition: transform 340ms var(--learn-spring), border-color 220ms ease, box-shadow 340ms var(--learn-spring);
}

.subject-card-hit-area,
.competitive-card-hit-area {
    position: absolute;
    z-index: 5;
    inset: 0;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: inherit;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    cursor: pointer;
}

.subject-card-hit-area:focus-visible,
.competitive-card-hit-area:focus-visible {
    outline: none !important;
    box-shadow: inset 0 0 0 3px var(--hub-emerald-bright);
}

.subject-card:active,
.competitive-corner-card:active {
    transform: scale(var(--learn-press));
}

.card-content {
    min-width: 0;
    padding: 1rem;
}

.card-icon-wrapper {
    width: 48px;
    height: 48px;
    margin-bottom: 0.8rem;
    border-radius: 14px;
}

.card-icon {
    font-size: 1.5rem;
}

.card-title {
    margin-bottom: 0.35rem;
    font-size: 1.08rem;
    line-height: 1.3;
}

.card-description {
    display: -webkit-box;
    min-height: 2.85em;
    margin-bottom: 0.6rem;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 0.9rem;
    line-height: 1.45;
}

.card-topics {
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.topic-tag {
    padding: 0.25rem 0.5rem;
    border-radius: 8px;
    font-size: 0.76rem;
}

.card-footer {
    gap: 0.5rem;
    padding-top: 0.7rem;
}

.card-stats {
    min-width: 0;
    gap: 0.55rem;
    font-size: 0.76rem;
}

.card-btn {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0.5rem 0.7rem;
    border-radius: 11px;
    font-size: 0.82rem;
}

.card-badge {
    top: 0.8rem;
    right: 0.8rem;
    max-width: calc(100% - 4.6rem);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.features-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}

.feature-card {
    min-width: 0;
    padding: 1.2rem;
    text-align: left;
    transition: transform 300ms var(--learn-spring), border-color 200ms ease, box-shadow 300ms ease;
}

.feature-icon {
    margin-bottom: 0.6rem;
    font-size: 1.7rem;
}

.feature-title {
    margin-bottom: 0.35rem;
    font-size: 1rem;
}

.feature-description {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* One focused practice gateway instead of an oversized decorative block. */
.competitive-corner-card {
    position: relative;
    min-height: 390px;
    padding: 2rem;
    border-radius: 24px;
    transform: translateZ(0);
    transition: transform 340ms var(--learn-spring), border-color 220ms ease, box-shadow 340ms var(--learn-spring);
}

.corner-center-icon {
    width: 112px;
    height: 112px;
    margin-bottom: 0.8rem;
}

.icon-outer-ring {
    width: 112px;
    height: 112px;
}

.icon-inner-ring {
    width: 86px;
    height: 86px;
}

.icon-core {
    width: 66px;
    height: 66px;
}

.crossed-swords {
    font-size: 2rem;
}

.corner-title {
    font-size: clamp(1.75rem, 3vw, 2.45rem);
}

.corner-stats {
    margin: 1.2rem 0;
}

.corner-cta {
    min-height: 46px;
    border-radius: 14px;
}

/* Native bottom navigation for phone and tablet. */
.learning-native-tabbar {
    display: none;
}

.learning-native-tab {
    position: relative;
    min-width: 0;
    min-height: 52px;
    padding: 5px 4px 3px;
    border: 0;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    color: var(--hub-text-muted);
    background: transparent;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: color 180ms ease, background 180ms ease, transform 160ms ease;
}

.learning-native-icon {
    font-family: ui-sans-serif, system-ui, sans-serif;
    font-size: 1.3rem;
    line-height: 1;
}

.learning-native-tab.active {
    color: var(--hub-emerald-bright);
    background: rgba(16, 185, 129, 0.13);
}

[data-theme="light"] .learning-native-tab.active {
    color: #047857;
    background: rgba(5, 150, 105, 0.1);
}

.learning-native-tab:active {
    transform: scale(0.92);
}

/* Drawers and dialogs behave like app surfaces. */
.mobile-menu-overlay {
    padding: 0;
    border: 0;
    appearance: none;
    -webkit-appearance: none;
}

.mobile-menu {
    width: min(90vw, 390px);
    right: min(-90vw, -390px);
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

body.learning-menu-open {
    overflow: hidden;
}

.modal-overlay,
.auth-modal,
.premium-alert-overlay,
.welcome-modal-overlay,
.confirm-modal-overlay,
.goodbye-modal-overlay {
    padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
    overscroll-behavior: contain;
}

.modal-content,
.profile-modal-content,
.leaderboard-modal-content,
.auth-container,
.bhai-chat-modal {
    max-height: calc(100dvh - max(1.5rem, env(safe-area-inset-top, 0px)) - max(1.5rem, env(safe-area-inset-bottom, 0px)));
}

@media (min-width: 1440px) {
    .subjects-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 1200px) {
    .subjects-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 968px) {
    :root {
        --learn-gutter: 0.85rem;
    }

    html {
        scroll-padding-top: 70px;
        scroll-padding-bottom: calc(var(--learn-native-bar-height) + env(safe-area-inset-bottom, 0px) + 12px);
    }

    body[data-auth-theme="learn"] {
        padding-bottom: calc(var(--learn-native-bar-height) + env(safe-area-inset-bottom, 0px));
    }

    .learning-native-tabbar {
        position: fixed;
        z-index: 1000;
        left: max(8px, env(safe-area-inset-left, 0px));
        right: max(8px, env(safe-area-inset-right, 0px));
        bottom: max(7px, env(safe-area-inset-bottom, 0px));
        min-height: var(--learn-native-bar-height);
        padding: 5px 6px;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 3px;
        border: 1px solid rgba(255, 255, 255, 0.11);
        border-radius: 20px;
        background: rgba(7, 13, 16, 0.92);
        box-shadow: 0 22px 54px rgba(0, 0, 0, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.06);
        -webkit-backdrop-filter: blur(28px) saturate(165%);
        backdrop-filter: blur(28px) saturate(165%);
        transition: opacity 180ms ease, transform 260ms var(--learn-spring), visibility 180ms ease;
    }

    [data-theme="light"] .learning-native-tabbar {
        border-color: rgba(15, 23, 42, 0.1);
        background: rgba(255, 255, 255, 0.93);
        box-shadow: 0 18px 48px rgba(15, 23, 42, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.88);
    }

    body.learning-menu-open .learning-native-tabbar,
    body:has(.modal-overlay.active) .learning-native-tabbar,
    body:has(.auth-modal.active) .learning-native-tabbar {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transform: translateY(110%);
    }

    .hero {
        min-height: 420px;
        padding: 94px var(--learn-gutter) 2rem !important;
        text-align: left;
    }

    .hero-content {
        padding: 0 !important;
    }

    .hero-visual {
        display: none;
    }

    .hero-stats {
        margin-inline: 0;
    }

    .subjects-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    .bhai-container {
        z-index: 980 !important;
        right: max(0.75rem, env(safe-area-inset-right, 0px)) !important;
        bottom: calc(var(--learn-native-bar-height) + env(safe-area-inset-bottom, 0px) + 16px) !important;
    }

    .bhai-btn {
        width: 58px !important;
        height: 58px !important;
        padding: 3px !important;
    }

    .bhai-tooltip {
        display: none !important;
    }

}

@media (max-width: 680px) {
    :root {
        --learn-native-bar-height: 62px;
        --learn-gutter: 0.7rem;
    }

    .navbar,
    .navbar.scrolled {
        min-height: 60px;
        padding: 0 max(0.6rem, env(safe-area-inset-right, 0px)) 0 max(0.6rem, env(safe-area-inset-left, 0px)) !important;
    }

    .nav-container {
        min-height: 60px;
    }

    .logo-3d-container {
        width: 38px;
        height: 38px;
    }

    .logo-avatar-wrapper {
        width: 34px;
        height: 34px;
    }

    .logo-text-main {
        font-size: 1rem !important;
    }

    .logo-badge-pro {
        display: none;
    }

    .nav-essential {
        gap: 0.3rem;
    }

    .nav-essential .auth-btn,
    .nav-essential .theme-toggle,
    .nav-essential .sound-toggle,
    .mobile-menu-btn {
        width: 42px;
        min-width: 42px;
        height: 42px;
        min-height: 42px;
    }

    .hero {
        min-height: 374px;
        padding: 82px var(--learn-gutter) 1.35rem !important;
    }

    .hero-badge {
        margin-bottom: 0.7rem;
        padding: 0.42rem 0.9rem;
        font-size: 0.76rem;
    }

    .hero-title {
        max-width: 14ch;
        margin-bottom: 0.75rem;
        font-size: clamp(2rem, 10.5vw, 3rem) !important;
        line-height: 1.01;
    }

    .hero-subtitle {
        display: -webkit-box;
        margin-bottom: 0.8rem;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        font-size: 0.95rem !important;
        line-height: 1.42;
    }

    .hero-cta {
        margin-bottom: 0.75rem;
    }

    .hero-cta .btn {
        width: auto;
        min-height: 44px;
        padding: 0.65rem 1rem;
        font-size: 0.9rem;
    }

    .hero-stats {
        width: min(100%, 390px);
        min-height: 56px;
        margin: 0;
        padding: 0.55rem 0.7rem;
    }

    .stat-number {
        font-size: 1.35rem;
    }

    .stat-label {
        font-size: 0.72rem;
    }

    .activity-ticker-section {
        padding-block: 0.65rem;
    }

    .ticker-header {
        justify-content: flex-start;
        margin-bottom: 0.35rem;
    }

    .ticker-item {
        min-height: 42px;
        padding: 0.45rem 0.7rem;
    }

    .section-container {
        padding: 2rem var(--learn-gutter) !important;
    }

    .section-header {
        margin-bottom: 1rem;
        text-align: left;
    }

    .section-badge {
        margin-bottom: 0.55rem;
        font-size: 0.76rem;
    }

    .section-title {
        margin-bottom: 0.45rem;
        font-size: 1.55rem !important;
    }

    .section-subtitle {
        margin: 0;
        font-size: 0.92rem;
    }

    .subjects-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.55rem !important;
    }

    .subject-card {
        min-height: 202px;
        border-radius: 16px !important;
    }

    .card-content {
        padding: 0.72rem !important;
    }

    .card-icon-wrapper {
        width: 42px;
        height: 42px;
        margin-bottom: 0.55rem;
        border-radius: 12px;
    }

    .card-icon {
        font-size: 1.3rem;
    }

    .card-title {
        min-height: 2.55em;
        margin-bottom: 0.3rem;
        font-size: 0.9rem;
        line-height: 1.28;
    }

    .card-description,
    .card-topics {
        display: none;
    }

    .card-footer {
        margin-top: auto;
        padding-top: 0.5rem;
    }

    .card-stats {
        flex-direction: column;
        gap: 0.1rem;
        font-size: 0.72rem;
    }

    .card-stats .stat:last-child {
        display: none;
    }

    .card-btn {
        width: 38px;
        min-width: 38px;
        min-height: 38px;
        padding: 0;
        display: grid;
        place-items: center;
    }

    .card-btn > span:first-child {
        display: none;
    }

    .card-badge {
        top: 0.65rem;
        right: 0.55rem;
        max-width: calc(100% - 3.7rem);
        padding: 0.2rem 0.38rem;
        font-size: 0.75rem;
    }

    .competitive-tabs,
    .floating-exam-icons,
    .corner-stars {
        display: none;
    }

    .competitive-corner-card {
        min-height: 300px;
        margin: 0;
        padding: 1.25rem 0.9rem;
        border-radius: 20px;
    }

    .corner-center-icon,
    .icon-outer-ring {
        width: 86px;
        height: 86px;
    }

    .icon-inner-ring {
        width: 66px;
        height: 66px;
    }

    .icon-core {
        width: 52px;
        height: 52px;
    }

    .corner-title {
        font-size: 1.55rem;
    }

    .corner-subtitle {
        font-size: 0.82rem;
    }

    .corner-stats {
        gap: 0.5rem;
        margin: 0.85rem 0;
    }

    .corner-stat {
        min-width: 0;
        padding: 0.5rem;
    }

    .corner-cta {
        width: min(100%, 270px);
    }

    .features-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 0.55rem;
    }

    .feature-card {
        padding: 0.9rem !important;
        border-radius: 16px;
    }

    .feature-icon {
        font-size: 1.45rem;
    }

    .feature-title {
        font-size: 0.9rem;
    }

    .feature-description {
        display: -webkit-box;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        font-size: 0.875rem;
    }

    .mobile-menu {
        padding: max(1rem, env(safe-area-inset-top, 0px)) 1rem max(1rem, env(safe-area-inset-bottom, 0px));
    }
}

@media (max-width: 430px) {
    .nav-essential .sound-toggle {
        display: none !important;
    }

    .learning-native-tab {
        font-size: 0.7rem;
    }
}

@media (max-width: 370px) {
    .logo-text-premium {
        display: none;
    }

    .subjects-grid {
        grid-template-columns: 1fr !important;
    }

    .subject-card {
        min-height: 176px;
    }

    .card-description {
        display: -webkit-box;
        min-height: auto;
        -webkit-line-clamp: 1;
    }
}

@media (max-height: 520px) and (orientation: landscape) and (max-width: 968px) {
    :root {
        --learn-native-bar-height: 54px;
    }

    .learning-native-tabbar {
        min-height: 52px;
        padding-block: 3px;
    }

    .learning-native-tab {
        min-height: 44px;
        flex-direction: row;
    }

    .learning-native-icon {
        font-size: 1rem;
    }

    .hero {
        min-height: 315px;
    }

    .modal-content,
    .profile-modal-content,
    .leaderboard-modal-content,
    .auth-container,
    .bhai-chat-modal {
        max-height: 96dvh;
    }
}

@media (hover: hover) and (pointer: fine) {
    .subject-card:hover,
    .competitive-corner-card:hover {
        transform: translateY(-6px) scale(1.008);
    }

    .feature-card:hover {
        transform: translateY(-4px);
    }

    .subject-card:hover .card-icon-wrapper {
        transform: translateY(-2px) scale(1.04);
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    body[data-auth-theme="learn"] *,
    body[data-auth-theme="learn"] *::before,
    body[data-auth-theme="learn"] *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: more) {
    .subject-card,
    .feature-card,
    .competitive-corner-card,
    .learning-native-tabbar,
    .hero-stats {
        border-color: currentColor !important;
    }
}

@media (display-mode: standalone) {
    .navbar {
        padding-top: env(safe-area-inset-top, 0px);
    }
}
