/* ============================================================
   HUNT4HELP – GLOBAL MOBILE FIXES (Handy & iPad)
   ============================================================
   Einbindung (in header_links.php + header_profil_links.php,
   ganz am Ende der Datei einfügen):

   <link rel="stylesheet" href="/mobile_fixes.css?v=1">
   <script src="/mobile_fixes.js?v=1" defer></script>
   ============================================================ */

/* Basis-Schutz: nie horizontal scrollen */
html, body { overflow-x: hidden; }
img, video { max-width: 100%; }

/* ============================================================
   1) HEADER – funktioniert auf Handy & iPad
   ============================================================ */
@media (max-width: 1200px) {
    /* Einige Seiten verstecken die Desktop-Nav schon ab 1200px,
       aber zeigen den Burger-Button erst ab 768px -> Lücke auf
       dem iPad (768-1200). Burger-Button hier global aktivieren. */
    .header .mobile-nav-toggle,
    .mobile-nav-toggle { display: flex !important; align-items: center; justify-content: center; }
    .header { padding-right: 16px; }
}

@media (max-width: 900px) {
    .header { padding: 0 12px !important; gap: 8px; height: 64px !important; }
    .header .logo img { height: 56px !important; }
    .header .search-wrapper,
    .header .user-stats,
    .header .header-divider { display: none !important; }
    .header .discord-user { gap: 8px; }
    .header .discord-user > div[style*="flex-direction"] { display: none !important; }
    .header .discord-avatar { width: 34px !important; height: 34px !important; }
    .header .discord-login-btn { padding: 8px 14px !important; font-size: 10px !important; letter-spacing: 1px !important; }
    .header .profil-link-anim { font-size: 10px !important; margin-right: 6px; letter-spacing: 1px; }
}

@media (max-width: 480px) {
    .header { height: 60px !important; }
    .header .logo img { height: 48px !important; }
}

/* ============================================================
   2) iPAD (hochkant & quer, 769–1024px)
   ============================================================ */
@media (min-width: 769px) and (max-width: 1024px) {
    .page-shell { padding-left: 20px !important; padding-right: 20px !important; }
    .hero-grid { gap: 28px !important; padding: 40px 32px !important; }
    .hero-title { font-size: 40px !important; }
    .stats-strip { grid-template-columns: repeat(3, 1fr) !important; }
    .news-layout { grid-template-columns: 1fr !important; }
    .guides-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .turnier-grid, .community-grid, .points-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .spielplan-grid, .team-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .weapons-grid, .tools-grid, .consumables-grid { grid-template-columns: repeat(4, 1fr) !important; }
    .traits-grid { grid-template-columns: repeat(3, 1fr) !important; }
    .tarot-grid { grid-template-columns: repeat(4, 1fr) !important; }
    .streamer-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .booster-grid { grid-template-columns: repeat(4, 1fr) !important; }
    .news-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .loadout-builder, .main-wrapper { grid-template-columns: 1fr !important; }
    .fact-wrap { grid-template-columns: 1fr !important; }
    .sim-layout .card { height: 520px; }
    .saloon-col { order: -1; }
}

/* ============================================================
   3) HANDY (max. 768px)
   ============================================================ */
@media (max-width: 768px) {
    .page-shell { padding: 78px 12px 0 !important; }
    .section { margin-top: 40px; }

    /* ---- Hero ---- */
    .hero-round { min-height: 0 !important; border-radius: 20px !important; }
    .hero-grid { padding: 26px 18px !important; gap: 20px; }
    .hero-content-inner { padding: 30px 18px !important; }
    .hero-title { font-size: 30px !important; letter-spacing: 1px; }
    .hero-desc { font-size: 14px; margin-bottom: 20px; }
    .hero-kicker { font-size: 10px; letter-spacing: 2px; }
    .hero-stats { gap: 8px; }
    .hero-stat-pill { padding: 8px 14px; }
    .hero-stat-pill .num { font-size: 15px; }
    .info-card { padding: 18px; }
    .btn { padding: 12px 22px; font-size: 11px; }

    /* ---- Stat-Pillen ---- */
    .stats-strip { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
    .stat-pill { padding: 12px 14px; gap: 10px; }
    .stat-pill-icon { width: 34px; height: 34px; font-size: 14px; }
    .stat-pill-number { font-size: 16px; }
    .stat-pill-label { font-size: 9px; letter-spacing: 1px; }

    /* ---- Section-Heads ---- */
    .section-head { flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
    .section-title { font-size: 20px !important; white-space: normal; }
    .section-line { display: none; }
    .section-count { font-size: 11px; }
    .section-head-center .section-title { font-size: 22px !important; white-space: normal; }
    .section-subtitle { font-size: 13px; margin-bottom: 26px; }

    /* ---- Karten-Paddings ---- */
    .glass-box { border-radius: 16px; }
    .form-card, .legal-card, .ban-info-card, .ban-form-card, .donation-info, .paypal-card,
    .slot-machine-card, .leaderboard-card, .win-panel, .rules-box, .point-card, .loadout-panel,
    .howto, .map-sidebar-card, .card, .edit-card, .total-card, .source-card, .hint-box {
        padding: 18px 14px !important;
    }

    /* ---- Grids: 1 Spalte ---- */
    .why-row, .news-layout, .guides-grid, .streamer-grid, .banner-grid, .fact-wrap,
    .team-grid, .rules-grid, .rules-container, .donation-grid, .community-grid, .turnier-grid,
    .spielplan-grid, .points-grid, .saved-grid, .loadout-builder, .main-wrapper, .sim-layout,
    .challenge-grid, .upload-zones, .profile-grid, .form-grid, .status-minis,
    .news-grid, .clips-grid, .lb-grid, .tips-grid, .footer-container {
        grid-template-columns: 1fr !important;
    }

    /* ---- Grids: 2 Spalten ---- */
    .booster-grid, .members-grid, .selector-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }
    .tarot-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 12px; }
    .weapons-grid, .tools-grid, .consumables-grid { grid-template-columns: repeat(3, 1fr) !important; gap: 10px; }
    .traits-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }
    .gear-grid { grid-template-columns: repeat(4, 1fr) !important; gap: 8px; }
    .weapon-card, .tool-card, .consumable-card { padding: 14px 8px; }

    /* ---- Filter / Suche ---- */
    .filter-bar-wrap { padding: 0 12px; }
    .filter-bar { flex-direction: column; align-items: stretch; gap: 12px; }
    .filter-tabs { justify-content: center; flex-wrap: wrap; }
    .filter-tab { padding: 9px 16px; font-size: 11px; }
    .filter-search input { width: 100%; }
    .streamer-section { padding: 0 12px 40px; }

    /* ---- News ---- */
    .featured-card { min-height: 0; }
    .featured-image { min-height: 180px; }
    .featured-content { padding: 20px 18px; }
    .featured-title { font-size: 22px; }
    .news-featured { min-height: 260px; }
    .news-featured-title { font-size: 22px; }
    .news-list-thumb { width: 76px; height: 58px; }

    /* ---- Boss-Karten ---- */
    .boss-card-header { grid-template-columns: 1fr !important; min-height: 0; }
    .boss-image-wrap { height: 200px; }
    .boss-info { padding: 20px 18px; }
    .boss-card-body { padding: 0 18px 22px; }
    .boss-stats-row { grid-template-columns: 1fr; gap: 12px; }
    .boss-name { font-size: 24px; }

    /* ---- Team-Karten ---- */
    .team-card-image-frame { height: 130px; }
    .team-card-image-frame img { width: 100px; height: 100px; }
    .team-card-name { font-size: 18px; }
    .turnier-card-img { height: 150px; }

    /* ---- Regeln / Punktesystem ---- */
    .rule-card { flex-direction: column; gap: 14px; padding: 20px; }
    .rule-card.fun { padding: 28px 18px; }
    .point-value { font-size: 12px; }

    /* ---- Loadout Builder ---- */
    .selector-content { max-height: 55vh; padding: 14px; }
    .stash-drop-zone { min-height: 110px; }
    .consumable-slots { grid-template-columns: repeat(4, 1fr) !important; gap: 8px; }
    .qm-bar { padding: 16px !important; flex-direction: column; align-items: stretch; gap: 14px; }
    .slot-indicator-wrap { justify-content: center; }
    .cancel-edit-btn { display: flex !important; }
    .saved-cons-row { grid-template-columns: repeat(4, 1fr) !important; }

    /* ---- Cash Register ---- */
    .slot-display { width: 200px !important; height: 200px !important; }
    .user-stats-display { grid-template-columns: 1fr !important; }
    .command-input { font-size: 14px; }

    /* ---- Maps ---- */
    .map-layout { flex-direction: column; }
    .map-sidebar { width: 100%; }
    .map-area { min-height: 60vw; }
    .marker-tooltip { width: 200px; padding: 12px; }
    .my-marker-actions { flex-wrap: wrap; }
    .map-container img { max-height: 70vw; }

    /* ---- Streamer ---- */
    .streamer-card-stats { gap: 8px; }
    .streamer-card-actions { flex-wrap: wrap; }
    .streamer-avatar { width: 56px; height: 56px; }

    /* ---- Soul Survivor ---- */
    .sim-layout .card { height: auto !important; max-height: none; }
    .sim-log { max-height: 50vh; font-size: 12px; }
    .hunter-grid { grid-template-columns: 1fr 1fr !important; }
    .cooldown-timer { font-size: 30px; }
    .skin-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .sim-timer { font-size: 24px; }

    /* ---- Trader ---- */
    .inventory-grid-h .inv-item { width: 70px; }
    .shop-grid, .inventory-grid { grid-template-columns: repeat(3, 1fr) !important; max-height: 260px; }
    .trade-footer { flex-direction: column; gap: 12px; }
    .btn-trade { width: 100%; justify-content: center; }
    .sell-slot, .buy-slot { width: 42px !important; height: 42px !important; }
    .slots-bar { gap: 4px !important; padding: 5px !important; }
    .sell-slot-item img { width: 28px !important; height: 28px !important; }
    .howto-steps { grid-template-columns: 1fr !important; }

    /* ---- Profil ---- */
    .hero-inner { flex-direction: column; text-align: center; padding: 24px 18px; }
    .level-badge { justify-content: center; }
    .total-card { flex-direction: column; text-align: center; gap: 12px; }
    .total-left { flex-direction: column; text-align: center; }

    /* ---- Mitglieder ---- */
    .member-avatar-wrap, .member-avatar { width: 64px !important; height: 64px !important; }

    /* ---- Screenshots ---- */
    .upload-zone { min-height: 190px; padding: 20px 14px; }

    /* ---- Pagination & Footer ---- */
    .page-numbers { gap: 5px; }
    .page-number, .page-dots { width: 34px; height: 34px; font-size: 12px; }
    .page-btn { padding: 10px 16px; font-size: 11px; }
    .footer { padding: 40px 18px 24px !important; margin-top: 50px; }
    .footer-bottom { flex-direction: column; gap: 10px; text-align: center; }
    .footer-bottom-links { justify-content: center; }

    /* ---- Cookie Banner & Modals ---- */
    .cookie-banner { padding: 14px !important; }
    .cookie-banner-inner { flex-direction: column; gap: 12px; }
    .cookie-banner-actions { width: 100%; }
    .cookie-btn { flex: 1; justify-content: center; padding: 10px 8px; font-size: 11px; }
    .modal, .news-modal, .cookie-modal { max-width: calc(100vw - 20px) !important; }
    .news-modal-image { height: 180px; }
    .news-modal-body { padding: 22px 18px; }
    .news-modal-title { font-size: 22px; }

    /* ---- Waffen-Popup: am unteren Rand (Tap statt Hover) ---- */
    .weapon-stats-popup {
        position: fixed !important;
        left: 50% !important; right: auto !important; top: auto !important;
        bottom: 12px !important;
        transform: translateX(-50%) translateY(12px) !important;
        width: min(330px, calc(100vw - 24px)) !important;
        max-height: 62vh;
        overflow-y: auto;
        z-index: 99999;
        pointer-events: auto;
    }
    .weapon-card.open .weapon-stats-popup {
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateX(-50%) translateY(0) !important;
    }
    .weapon-stats-popup::after { display: none; }
}

/* ============================================================
   4) KLEINE HANDYS (max. 480px)
   ============================================================ */
@media (max-width: 480px) {
    .hero-title { font-size: 26px !important; }
    .weapons-grid, .tools-grid, .consumables-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .tarot-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .gear-grid, .consumable-slots, .saved-cons-row { grid-template-columns: repeat(3, 1fr) !important; }
    .hunter-grid { grid-template-columns: 1fr !important; }
    .members-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 10px; }
    .section-count { display: none; }
    .teams-row.row-5, .teams-row.row-6 { grid-template-columns: repeat(2, 1fr) !important; }
    .weapon-card, .tool-card, .consumable-card { padding: 12px 6px; }
    .weapon-image-wrapper { height: 52px; }
    .stash-slots { gap: 3px; }
    .stash-slot { width: 8px; height: 8px; }
    .cooldown-digits { font-size: 22px !important; }
    .level-number { font-size: 32px; }
    .total-xp, .loadout-total-value { font-size: 28px; }
    .captcha-box { font-size: 18px; letter-spacing: 4px; min-width: 140px; }
}



/* ============================================================
   5) DROPDOWN-MENÜS per TAP öffnen (Handy & iPad)
   JS setzt body.hpl-touch und .hpl-open am Dropdown.
   ============================================================ */
.hpl-nav-dropdown.hpl-open .hpl-nav-dropdown-menu { display: block !important; }
.nav-dropdown.hpl-open .nav-dropdown-menu { opacity: 1 !important; visibility: visible !important; }

/* Auf Touch-Geraeten die Hover-Oeffnung abschalten, sonst oeffnet/
   schliesst das Menue sich beim Antippen von selbst */
body.hpl-touch .hpl-nav-dropdown:hover .hpl-nav-dropdown-menu,
body.hpl-touch .hpl-nav-dropdown:focus-within .hpl-nav-dropdown-menu { display: none !important; }
body.hpl-touch .hpl-nav-dropdown.hpl-open .hpl-nav-dropdown-menu { display: block !important; }
body.hpl-touch .nav-dropdown:hover .nav-dropdown-menu { opacity: 0 !important; visibility: hidden !important; }
body.hpl-touch .nav-dropdown.hpl-open .nav-dropdown-menu { opacity: 1 !important; visibility: visible !important; }

@media (max-width: 1024px) {
    /* Portal-Dropdowns (Imperium, Marktsystem) zentriert unter dem Header,
       damit sie am Handy nicht über den Bildschirmrand ragen */
    .hpl-nav-dropdown-menu {
        position: fixed !important;
        left: 50% !important; right: auto !important;
        top: 66px !important;
        transform: translateX(-50%) !important;
        min-width: min(240px, 86vw) !important;
        max-width: 86vw;
        max-height: 65vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 999999;
    }
    .hpl-nav-dropdown-item { white-space: normal; }
}


/* ============================================================
   6) PORTAL-PILL-LEISTE horizontal scrollbar (Handy & iPad)
   ============================================================ */
@media (max-width: 1024px) {
    .hpl-nav-center {
        /* WICHTIG: backdrop-filter erzeugt einen Containing-Block fuer
           position:fixed -> Dropdown wuerde unsichtbar. Auf Mobile entfernen. */
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        left: 8px !important;
        right: 62px !important;          /* Platz für Message-Icon rechts */
        transform: none !important;
        justify-content: flex-start !important;
        overflow-x: auto !important;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .hpl-nav-center::-webkit-scrollbar { display: none; }
    .hpl-nav-link { flex: 0 0 auto; }    /* Links nicht quetschen */
}
@media (max-width: 768px) {
    .hpl-nav-center { right: 54px !important; }
}
