/**
 * FaucetSpy — Mobile / tablet responsive ONLY
 * All rules are inside max-width media queries so desktop layout stays unchanged.
 */
@media (max-width: 991.98px) {
    /* ---- Global ---- */
    html, body {
        overflow-x: clip;
        max-width: 100%;
    }
    .container,
    .container-fluid {
        max-width: 100%;
    }
    img, video, iframe, .fs-proof-img, .fs-thread-thumb {
        max-width: 100%;
        height: auto;
    }

    /* Soften card hover lift on touch devices */
    .hover-effect:hover {
        transform: none;
    }

    /* ---- Header / nav ---- */
    .fs-nav > .container-fluid {
        flex-wrap: wrap !important;
        align-items: center;
    }
    .fs-nav .navbar-brand {
        font-size: 1.25rem;
        padding-left: 0;
        margin-right: auto;
    }
    .fs-nav .logo-icon {
        font-size: 1.25rem;
    }
    .fs-nav .navbar-toggler {
        margin-left: 8px;
        padding: 6px 8px;
        border: 1px solid rgba(0, 0, 0, 0.12) !important;
        border-radius: 10px;
    }
    body.dark-mode .fs-nav .navbar-toggler {
        border-color: #444 !important;
    }
    /*
     * Do NOT force display:none/flex !important — that breaks Bootstrap .collapsing
     * and leaves the mobile menu stuck open.
     */
    .fs-nav .navbar-collapse {
        flex-basis: 100%;
        flex-grow: 1;
        width: 100%;
        max-width: 100%;
    }
    .fs-nav .navbar-collapse.collapsing,
    .fs-nav .navbar-collapse.show {
        margin-top: 10px;
        padding: 12px 4px 20px;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
        max-height: min(78vh, 640px);
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    body.dark-mode .fs-nav .navbar-collapse.collapsing,
    body.dark-mode .fs-nav .navbar-collapse.show {
        border-top-color: #333;
    }
    .fs-nav .navbar-nav.mx-auto {
        width: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
        gap: 2px;
        margin-bottom: 10px;
        flex-direction: column;
        align-items: stretch;
    }
    .fs-nav .nav-link {
        padding: 10px 12px !important;
        font-size: 0.92rem;
        border-radius: 10px;
    }
    .fs-nav .navbar-nav.align-items-lg-center {
        width: 100%;
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px !important;
        padding-top: 8px;
        border-top: 1px solid rgba(0, 0, 0, 0.06);
    }
    body.dark-mode .fs-nav .navbar-nav.align-items-lg-center {
        border-top-color: #333;
    }
    .fs-nav-toolbar,
    .fs-nav-auth,
    .fs-nav-account {
        width: 100%;
    }
    .fs-nav-toolbar-inner {
        display: flex;
        flex-wrap: nowrap;
        align-items: center;
        gap: 10px;
        width: 100%;
    }
    .fs-nav-fsp {
        padding: 6px 10px;
        font-size: 0.78rem;
        margin-right: auto;
    }
    /* Profile: full-width row + arrow; details only when open */
    .fs-nav-account {
        position: relative;
        margin-bottom: 4px;
    }
    .fs-nav-account .fs-nav-user {
        width: 100%;
        max-width: none;
        margin: 0;
        padding: 10px 12px !important;
        border-radius: 10px;
        background: rgba(0, 123, 255, 0.08);
        border: 1px solid rgba(0, 123, 255, 0.2);
    }
    .fs-nav-account .fs-nav-user.dropdown-toggle::after {
        display: none !important; /* use custom chevron */
    }
    .fs-nav-account-caret {
        display: inline-block !important;
        margin-left: auto;
        flex-shrink: 0;
        font-size: 0.78rem;
        color: #4da3ff;
        transition: transform 0.2s ease;
    }
    .fs-nav-account.show .fs-nav-account-caret,
    .fs-nav-account .fs-nav-user[aria-expanded="true"] .fs-nav-account-caret {
        transform: rotate(180deg);
    }
    body.dark-mode .fs-nav-account .fs-nav-user {
        background: rgba(0, 123, 255, 0.12);
        border-color: rgba(77, 163, 255, 0.28);
        color: #e8e8e8 !important;
    }
    .fs-nav-account .fs-nav-username {
        max-width: none;
        flex: 1;
        min-width: 0;
    }
    /* Closed by default — only .show reveals the menu */
    .fs-nav-account-menu,
    .fs-nav-account .dropdown-menu {
        position: static !important;
        inset: auto !important;
        transform: none !important;
        float: none !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 6px 0 0 !important;
        padding: 6px !important;
        border-radius: 12px !important;
        border: 1px solid rgba(0, 0, 0, 0.08) !important;
        box-shadow: none !important;
    }
    .fs-nav-account .dropdown-menu:not(.show) {
        display: none !important;
    }
    body.dark-mode .fs-nav-account-menu,
    body.dark-mode .fs-nav-account .dropdown-menu {
        background: #1e1e1e !important;
        border-color: #333 !important;
    }
    .fs-nav-account-menu .dropdown-item {
        border-radius: 8px;
        padding: 11px 12px;
        font-weight: 600;
        font-size: 0.9rem;
    }
    .fs-nav-account-menu .dropdown-divider {
        margin: 4px 6px;
        opacity: 0.35;
    }
    .fs-nav-account-menu .fs-nav-logout {
        margin-bottom: 2px;
    }

    /* Notifications: mobile bottom sheet (viewport-safe) */
    .fs-nav-toolbar .fs-notif-wrap {
        position: static;
    }
    .fs-notif-backdrop {
        position: fixed;
        inset: 0;
        z-index: 1090;
        background: rgba(0, 0, 0, 0.6);
        border: 0;
        padding: 0;
        margin: 0;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    .fs-notif-panel.fs-notif-sheet,
    .fs-notif-panel.dropdown-menu.show.fs-notif-sheet {
        position: fixed !important;
        top: auto !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        inset: auto 0 0 0 !important;
        transform: none !important;
        float: none !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        max-height: min(78vh, 560px) !important;
        margin: 0 !important;
        padding: 0 !important;
        z-index: 1100 !important;
        display: flex !important;
        flex-direction: column;
        overflow: hidden;
        border-radius: 18px 18px 0 0 !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
        border-bottom: 0 !important;
        box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.45) !important;
        background: #1a1a1a !important;
    }
    body:not(.dark-mode) .fs-notif-panel.fs-notif-sheet {
        background: #fff !important;
        border-color: rgba(0, 0, 0, 0.08) !important;
        box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.18) !important;
    }
    .fs-notif-sheet .fs-notif-head {
        flex: 0 0 auto;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        padding: 14px 16px;
        border-bottom: 1px solid #333;
    }
    body:not(.dark-mode) .fs-notif-sheet .fs-notif-head {
        border-bottom-color: #e5e9ef;
    }
    .fs-notif-sheet .fs-notif-head strong {
        font-size: 1rem;
    }
    .fs-notif-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        margin-left: 4px;
        border: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.08);
        color: #cbd5e1;
        cursor: pointer;
        flex-shrink: 0;
    }
    body:not(.dark-mode) .fs-notif-close {
        background: #f1f5f9;
        color: #475569;
    }
    .fs-notif-close:hover {
        background: rgba(0, 123, 255, 0.2);
        color: #4da3ff;
    }
    .fs-notif-sheet .fs-notif-list {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none !important;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    .fs-notif-sheet .fs-notif-item {
        align-items: flex-start;
        gap: 12px;
        padding: 12px 16px;
    }
    .fs-notif-sheet .fs-notif-avatar {
        width: 40px;
        height: 40px;
    }
    .fs-notif-sheet .fs-notif-item-title {
        font-size: 0.9rem;
        line-height: 1.4;
        word-break: break-word;
        overflow-wrap: anywhere;
    }
    .fs-notif-sheet .fs-notif-item-time {
        font-size: 0.75rem;
        margin-top: 4px;
    }
    body.fs-notif-open {
        overflow: hidden !important;
    }

    /* ---- Hero ---- */
    .hero-bg {
        padding: 36px 0 28px;
        border-radius: 0 0 28px 28px;
        margin-bottom: 24px;
    }
    .main-title {
        font-size: 1.55rem !important;
        line-height: 1.25;
        letter-spacing: -0.5px;
        padding: 0 6px;
    }
    .sub-title {
        font-size: 0.95rem !important;
        padding: 0 8px;
    }
    .hero-trust-line {
        font-size: 0.8rem;
        line-height: 1.45;
        padding: 0 8px;
    }

    /* ---- Home category filters ---- */
    .fs-home-cat-filters {
        gap: 8px !important;
        justify-content: flex-start !important;
        overflow-x: auto;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 6px;
        margin-left: -4px;
        margin-right: -4px;
        padding-left: 4px;
        padding-right: 4px;
        scrollbar-width: thin;
    }
    .fs-home-cat-btn {
        flex: 0 0 auto;
        font-size: 0.78rem;
        padding: 0.4rem 0.9rem !important;
        white-space: nowrap;
    }
    .fs-home-cat-btn i {
        margin-right: 0.35rem !important;
    }

    /* ---- Stats bar ---- */
    .stats-wrapper {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        align-items: stretch !important;
        margin-top: 8px;
        padding: 12px 8px !important;
        gap: 10px 4px !important;
        border-radius: 14px;
    }
    .stat-item {
        flex: 1 1 30%;
        width: auto !important;
        max-width: 33.33%;
        min-width: 0;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 6px;
        text-align: center;
        padding: 4px 2px;
    }
    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 0.95rem;
        flex-shrink: 0;
        margin: 0 auto;
        border-radius: 10px;
    }
    .stat-info h4 {
        font-size: 1.05rem;
        line-height: 1.2;
    }
    .stat-info .uppercase-tracking {
        font-size: 0.58rem;
        letter-spacing: 0.4px;
        line-height: 1.2;
    }

    /* ---- Home cards ---- */
    .site-verified-ribbon {
        font-size: 0.5rem;
        padding: 2px 6px 2px 5px;
        top: 6px;
        left: 6px;
        gap: 3px;
    }
    .site-verified-ribbon i {
        font-size: 0.52rem;
    }
    .site-owner-chip {
        font-size: 0.72rem;
        max-width: calc(100% - 48px);
    }
    .site-card.is-verified-card .site-owner-chip {
        top: 26px;
    }
    #sites-container .card {
        margin-bottom: 0;
    }
    .vote-container {
        gap: 14px;
    }
    .btn-vote {
        width: 42px;
        height: 42px;
    }

    /* ---- Sidebar ---- */
    .fs-sidebar {
        margin-top: 8px;
    }
    .fs-side-block {
        margin-bottom: 1rem;
    }

    /* ---- Footer ---- */
    footer.bg-dark {
        padding-top: 2rem !important;
        padding-bottom: 1.5rem !important;
        text-align: center !important;
    }
    footer .text-md-start {
        text-align: center !important;
    }

    /* ---- Back to top (floating dark toggle removed) ---- */
    #backToTop {
        bottom: 20px !important;
        right: 16px !important;
        width: 44px !important;
        height: 44px !important;
    }

    /* ---- Toast ---- */
    .fs-toast {
        left: 12px;
        right: 12px;
        top: 12px;
        max-width: none;
    }

    /* ---- Forum ---- */
    .fs-thread-view {
        padding: 14px !important;
        border-radius: 14px;
    }
    .fs-thread-view h1.h4 {
        font-size: 1.15rem;
    }
    .fs-thread-media {
        padding: 10px;
        border-radius: 12px;
    }
    .fs-proof-img {
        border-radius: 10px;
        width: auto;
        max-width: 100%;
        max-height: min(70vh, 520px);
        object-fit: contain;
    }
    .fs-thread-author:not(.fs-reply-author) {
        width: 48px;
        height: 48px;
        margin-right: 4px;
        padding: 0;
    }
    .fs-thread-author:not(.fs-reply-author) .fs-avatar.lg {
        width: 48px;
        height: 48px;
    }
    .fs-avatar-follow-btn {
        left: 50% !important;
        right: auto !important;
        bottom: 0 !important;
        transform: translate(-50%, 50%) !important;
        width: 18px;
        height: 18px;
        font-size: 0.55rem;
    }
    .fs-reply-author .fs-avatar-follow-btn {
        width: 16px;
        height: 16px;
    }
    .fs-reply-block {
        overflow: visible;
    }
    .fs-nested-replies,
    .fs-nested-rail {
        margin-left: 0 !important;
        padding-left: 8px;
    }
    .fs-replies-toggle {
        margin-left: 0 !important;
    }
    .fs-vote-btn {
        min-height: 40px;
        padding: 8px 14px;
        font-size: 0.9rem;
    }
    .fs-composer-bar {
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 0 8px;
    }
    .fs-reply-hint {
        width: 100%;
        font-size: 0.75rem;
        margin-bottom: 4px;
    }
    .fs-comment-row {
        width: 100%;
        align-items: flex-end;
        gap: 8px;
    }
    .fs-comment-avatar {
        width: 32px;
        height: 32px;
    }
    .fs-comment-field {
        flex: 1 1 0;
        min-width: 0;
        gap: 4px;
        padding: 4px 10px 4px 4px;
        min-height: 42px;
        border-radius: 22px;
    }
    .fs-comment-tool {
        width: 30px;
        height: 30px;
    }
    .fs-mention-chip {
        display: none !important;
    }
    .fs-comment-input {
        font-size: 0.9rem;
        min-height: 28px;
        max-height: 88px;
    }
    .fs-comment-send {
        width: 40px;
        height: 40px;
        box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    }
    .fs-comment-attach:not(:empty) {
        margin-left: 40px;
    }
    /* Avatar + image icon + Publish on one row */
    .fs-thread-publish-bar {
        flex-wrap: nowrap;
        align-items: center;
        gap: 10px;
    }
    .fs-thread-publish-avatar {
        width: 36px;
        height: 36px;
    }
    .fs-thread-image-btn {
        width: 36px;
        height: 36px;
    }
    .fs-thread-publish-btn {
        flex: 1 1 auto;
        width: auto;
        min-width: 0;
        justify-content: center;
        padding: 10px 14px;
        font-size: 0.88rem;
        white-space: nowrap;
    }
    .fs-thread-publish-btn span {
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .fs-profile-hero {
        padding: 16px;
        gap: 14px;
    }
    .fs-profile-hero .fs-avatar.xl {
        width: 64px;
        height: 64px;
    }
    .fs-profile-stats {
        gap: 10px;
    }
    .fs-profile-stats strong {
        font-size: 1rem;
    }

    /* Recent / forum thread cards — readable on phone */
    .fs-thread-card {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 12px 14px;
        margin-bottom: 10px;
    }
    .fs-thread-card-link {
        display: grid;
        grid-template-columns: 56px 1fr;
        align-items: start;
        gap: 12px;
        width: 100%;
        min-width: 0;
        flex: 0 0 auto;
        overflow: visible;
        height: auto;
    }
    .fs-thread-card-link:not(:has(.fs-thread-thumb)) {
        grid-template-columns: 1fr;
    }
    .fs-thread-card-link > div {
        overflow: visible;
        min-width: 0;
        width: 100%;
    }
    .fs-thread-thumb {
        width: 56px;
        height: 56px;
        border-radius: 10px;
    }
    .fs-thread-card-link .badge {
        display: inline-block;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.68rem;
        margin-bottom: 4px !important;
    }
    .fs-thread-card-link h3,
    .fs-thread-card-link .h6,
    .fs-thread-card-link h2,
    .fs-thread-title,
    .fs-thread-card-link .text-truncate {
        white-space: normal !important;
        overflow: hidden;
        text-overflow: unset;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        font-size: 0.95rem;
        line-height: 1.35;
        margin-bottom: 2px !important;
    }
    .fs-thread-card-link .small.text-muted {
        font-size: 0.75rem;
    }
    .fs-stats {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 10px 14px;
        width: 100%;
        min-width: 0;
        padding-top: 8px;
        border-top: 1px solid #2a2a2a;
        font-size: 0.78rem;
        text-align: left;
    }
    body:not(.dark-mode) .fs-stats {
        border-top-color: #eef2f6;
    }
    .fs-stats > div {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        white-space: nowrap;
    }
    .fs-stats .fs-thread-menu {
        margin-left: auto;
        width: auto;
    }

    .fs-wallet-stat .value {
        font-size: 1.25rem;
    }
    .fs-ref-link-row {
        flex-direction: column;
        align-items: stretch;
    }
    .fs-ref-link-row .btn {
        width: 100%;
    }
    .fs-category-card {
        padding: 14px;
    }
    .fs-home-layout > [class*="col-"] {
        width: 100%;
        max-width: 100%;
    }
}

@media (max-width: 767.98px) {
    .main-title {
        font-size: 1.35rem !important;
    }
    .hero-bg {
        padding: 28px 0 22px;
        margin-bottom: 16px;
    }
    .stats-wrapper {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        margin-top: 0;
    }
    .fs-ref-stat-row {
        grid-template-columns: 1fr !important;
    }
    .fs-wallet-grid {
        grid-template-columns: 1fr !important;
    }
    .pagination .page-link {
        padding: 6px 8px;
        font-size: 0.85rem;
        margin: 0 2px;
    }
    .fs-link-prompt {
        width: calc(100vw - 28px);
        padding: 16px;
    }
    /* Site cards: slightly less padding */
    #sites-container .card.p-3 {
        padding: 0.9rem !important;
    }
}

@media (max-width: 575.98px) {
    .main-title {
        font-size: 1.22rem !important;
    }
    .sub-title {
        font-size: 0.88rem !important;
    }
    .hero-trust-line {
        font-size: 0.74rem;
    }
    .fs-home-cat-btn {
        font-size: 0.72rem;
        padding: 0.35rem 0.75rem !important;
    }
    .fs-home-cat-btn i.me-2 {
        margin-right: 0.25rem !important;
    }
    .site-verified-ribbon span {
        /* keep label — short is fine */
    }
    .fs-notif-bell {
        width: 38px;
        height: 38px;
    }
    footer h5 {
        font-size: 1rem;
    }
}

/* Prefer reduced motion on small screens / accessibility */
@media (max-width: 991.98px) and (prefers-reduced-motion: reduce) {
    .hover-effect,
    .btn-vote,
    .fs-home-cat-btn {
        transition: none !important;
    }
}
