/* ============================================================
   HentaiNova — Mobile Responsive Styles
   ALL rules are inside @media (max-width: 768px).
   ZERO impact on desktop (769px+).
   ============================================================ */

@media (max-width: 768px) {

  /* ──────────────────────────────────────────────────────────
     1. HEADER — Hamburger menu layout
     ────────────────────────────────────────────────────────── */

  /* Header: exact 56px tall (no extra padding) so content below fits below it */
  .hd {
    padding-top: 0;
    padding-bottom: 0;
  }

  /* Header container: just logo + avatar + hamburger in one row */
  .hd .cont {
    flex-wrap: nowrap;
    padding: 0 14px;
    height: 56px;
    min-height: 56px;
    position: relative;
  }

  /* Logo stays left, same size */
  .hd .menu {
    flex: 1;
    min-width: 0;
  }

  .hd .menu .logo img,
  .hd .menu .logo svg {
    max-height: 28px;
    width: auto;
  }

  /* Hide search, social, catalog in the regular header flow on mobile */
  .hd .cont > form,
  .hd .cont > .hd-search,
  .hd .cont > [class*="soc-drp"],
  .hd .cont > .social,
  .hd .cont > [class*="cat-drp"],
  .hd .cont > .nf-drp1 {
    display: none !important;
  }

  /* Hamburger button — shown only on mobile, positioned FIRST (left) */
  .hn-hamburger {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    margin: 0 10px 0 0;
    border-radius: 6px;
    color: inherit;
    flex-shrink: 0;
    order: -1;
    z-index: 1201;
    transition: background 0.2s;
  }

  .hn-hamburger:hover,
  .hn-hamburger:focus {
    background: rgba(255, 255, 255, 0.08);
    outline: none;
  }

  /* Three-line icon bars */
  .hn-hamburger span,
  .hn-hamburger span::before,
  .hn-hamburger span::after {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform 0.25s ease, opacity 0.2s ease;
    position: relative;
  }

  .hn-hamburger span::before,
  .hn-hamburger span::after {
    content: '';
    position: absolute;
    left: 0;
  }

  .hn-hamburger span::before { top: -7px; }
  .hn-hamburger span::after  { top:  7px; }

  /* Animate to X when open */
  .hn-hamburger.is-open span           { background: transparent; }
  .hn-hamburger.is-open span::before   { transform: rotate(45deg) translate(5px, 5px); }
  .hn-hamburger.is-open span::after    { transform: rotate(-45deg) translate(5px, -5px); }

  /* Mobile navigation drawer */
  .hn-mobile-nav {
    display: block !important;
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1200;
    pointer-events: none;
    visibility: hidden;
  }

  /* Overlay backdrop */
  .hn-mobile-nav::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .hn-mobile-nav.is-open {
    pointer-events: auto;
    visibility: visible;
  }

  .hn-mobile-nav.is-open::before {
    opacity: 1;
  }

  /* Sliding panel from the top */
  .hn-mobile-nav__panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg2, #121212);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 16px 16px 20px;
    transform: translateY(-110%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 0 14px 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .hn-mobile-nav.is-open .hn-mobile-nav__panel {
    transform: translateY(0);
  }

  /* Search inside mobile nav — narrower, centered */
  .hn-mobile-nav__panel .hn-mob-search {
    display: block;
    width: 88%;
    max-width: 340px;
    margin: 0 auto 16px;
  }

  .hn-mobile-nav__panel .hn-mob-search form {
    display: flex !important;
    width: 100%;
    position: static !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    overflow: hidden;
  }

  .hn-mobile-nav__panel .hn-mob-search input[type="search"],
  .hn-mobile-nav__panel .hn-mob-search input[type="text"] {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 14px;
    color: inherit;
    font-size: 14px;
    outline: none;
  }

  /* Hide the magnifier submit button so it only shows "Search..." text */
  .hn-mobile-nav__panel .hn-mob-search button {
    display: none;
  }

  /* Mobile nav link items */
  .hn-mobile-nav__links {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .hn-mobile-nav__links a,
  .hn-mobile-nav__links button {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    transition: background 0.18s;
  }

  .hn-mobile-nav__links a:hover,
  .hn-mobile-nav__links a:focus,
  .hn-mobile-nav__links button:hover,
  .hn-mobile-nav__links button:focus {
    background: rgba(255, 255, 255, 0.07);
    outline: none;
  }

  .hn-mobile-nav__links i,
  .hn-mobile-nav__links svg {
    width: 20px;
    flex-shrink: 0;
    text-align: center;
  }

  /* Divider inside mobile nav */
  .hn-mobile-nav__sep {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 8px 0;
  }

  /* ──────────────────────────────────────────────────────────
     2. MAIN CAROUSEL — Fix overlap with header
     ────────────────────────────────────────────────────────── */

  /* The slider starts right after header; push it below the 56px header */
  .home-slider {
    margin-top: 56px;
    position: relative;
  }

  /* Hide thumbnail row on mobile — main slider becomes a visual
     autoplay slider, glued to the "Coming Soon" title below. */
  .home-slider .home-thumbs,
  .home-slider .z-10,
  .home-thumbs {
    display: none;
  }

  /* Swiper main slide — compact but not squashed on mobile */
  .home-slider .swiper.mySwiper2 .swiper-wrapper .swiper-slide,
  .home-slider > .swiper:first-child {
    min-height: 0;
    height: 46vw;
    max-height: 340px;
    aspect-ratio: 16 / 9;
  }

  /* Slide content — compact: only title + backdrop + Watch button.
     Hide description and metadata (rating, year, genres, duration). */
  .home-slider .post.home {
    aspect-ratio: 16 / 9;
    max-height: none;
  }

  .home-slider .post.home .entry-header,
  .home-slider .post.home .entry-content {
    width: 70%;
    max-width: none;
  }

  .home-slider .post.home .entry-title {
    font-size: 1.35rem;
    margin-bottom: 0.4rem;
  }

  .home-slider .post.home .entry-meta,
  .home-slider .post.home .entry-content {
    display: none !important;
  }

  .home-slider .post.home .entry-content + ul {
    font-size: 0.8rem;
    margin-top: 0;
  }

  .home-slider .post.home .btn {
    font-size: 0.75rem;
    padding: 0.4rem 0.9rem;
  }

  /* Watch button and slide overlay — ensure they appear above header */
  .home-slider .swiper-slide .sldr-overlay,
  .home-slider .swiper-slide [class*="watch"],
  .home-slider .swiper-slide .btn {
    z-index: 5;
    position: relative;
  }

  /* ──────────────────────────────────────────────────────────
     3. SECTION SPACING — Coming Soon closer to Latest Episodes
     ────────────────────────────────────────────────────────── */

  /* Reduce gap between hentai-coming-section and episodes below it */
  .hentai-coming-section {
    margin: 0.5rem 0 8px !important;
    padding-bottom: 4px;
  }

  /* Tighten section-header titles on mobile */
  .section-header {
    margin-bottom: 10px;
  }

  .section-title {
    font-size: 1.1rem;
  }

  /* Reduce outer container padding */
  .bd.cont {
    padding-top: 60px;
  }

  /* On home keep content tight under the carousel */
  .home .bd.cont {
    padding-top: 6px;
  }

  /* ──────────────────────────────────────────────────────────
     4. EPISODE PLAYER — Search bar behind player (header fix
        handles it). Extra safeguard for player layout.
     ────────────────────────────────────────────────────────── */

  .player.movie.dfxb {
    flex-direction: column;
    gap: 0;
    margin-bottom: 1.25rem;
  }

  .hn-player-note {
    margin-bottom: 0.5rem;
  }

  /* Keep the page title below the player from touching it */
  .section.single {
    margin-top: 1rem;
  }

  /* Server list sidebar becomes horizontal scrollable strip */
  .player .bx.options {
    width: 100%;
    order: 2;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0 0 8px 8px;
  }

  .player .bx.options .bx-lst {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 4px;
    padding: 8px;
  }

  .player .bx.options .bx-lst li {
    flex-shrink: 0;
  }

  .player .bx.options .bx-lst a {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 10px;
    min-width: 72px;
    font-size: 12px;
    text-align: center;
    border-radius: 8px;
  }

  .player .fg1.video-options {
    width: 100%;
    order: 1;
  }

  /* Keep iframe aspect ratio on mobile */
  .player .video iframe {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 9;
    min-height: 200px;
    display: block;
  }

  /* ──────────────────────────────────────────────────────────
     5. EPISODE PLAYER — Report button BELOW nav buttons
     ────────────────────────────────────────────────────────── */

  /* Wrap report bar and nav together so we can reorder */
  .hn-player-controls {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  /* Nav buttons first */
  .episodes__nav {
    order: 1;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 0 6px;
    justify-content: center;
  }

  /* Report bar second (below nav) */
  .hn-report-bar {
    order: 2;
    text-align: center;
    padding: 6px 0 10px;
  }

  /* Report button styling tweak for mobile */
  .hn-report-btn {
    font-size: 12px;
    padding: 6px 14px;
    opacity: 0.75;
  }

  .hn-report-btn:hover {
    opacity: 1;
  }

  /* Episode nav buttons size */
  .episodes__btn {
    padding: 8px 16px;
    font-size: 13px;
  }

  /* ──────────────────────────────────────────────────────────
     6. SEARCH inside hentai detail page — keep away from content
     ────────────────────────────────────────────────────────── */

  /* Any stray search form that leaks outside the header */
  body:not(.home) .hd-search,
  body:not(.home) form[role="search"] {
    position: static !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
  }

  /* ──────────────────────────────────────────────────────────
     7. GENERAL — Prevent horizontal overflow on mobile
     ────────────────────────────────────────────────────────── */

  #aa-wp,
  body {
    overflow-x: hidden;
    max-width: 100vw;
  }

  .cont {
    padding-left: 14px;
    padding-right: 14px;
  }

  /* Single post article layout */
  .post.single .dfxb {
    flex-direction: column;
  }

  .post.single aside {
    width: 100% !important;
    max-width: 220px;
    margin: 0 0 16px;
  }

  /* ──────────────────────────────────────────────────────────
     8. EPISODE GRID (Latest Episodes) — 2 columns on mobile
     ────────────────────────────────────────────────────────── */

  .hentai-episodes-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
  }

  .hentai-episode-card {
    border-radius: 8px;
  }

  /* ──────────────────────────────────────────────────────────
     9. AVATAR / LOGIN BUTTON — always visible beside hamburger
     ────────────────────────────────────────────────────────── */

  /* sr-drp1 (avatar) and sr-drp2 (login) stay visible in header */
  .hd .cont > .sr-drp1,
  .hd .cont > .sr-drp2 {
    display: flex !important;
    margin-left: auto;
    flex-shrink: 0;
  }

}

/* Hide hamburger on desktop — it should never show on big screens */
@media (min-width: 769px) {
  .hn-hamburger {
    display: none !important;
  }

  .hn-mobile-nav {
    display: none !important;
  }
}
