/* Jack's Flicks: phone layout. Only applies to screens up to 768px wide,
   so the Windows desktop and iPad look stay exactly as they are. */
@media (max-width: 768px) {

  /* ----- General ----- */
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); -webkit-tap-highlight-color: transparent; }
  .container { padding-left: 12px; padding-right: 12px; }
  h2 { font-size: 1.1rem; margin: 1.1rem 0 0.5rem; }

  /* ----- Top bar: just the logo ----- */
  .topnav { position: sticky; top: 0; z-index: 30; padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 12px;
            background: linear-gradient(#000 0%, rgba(0, 0, 0, 0.88) 70%, rgba(0, 0, 0, 0)); border-bottom: 0; }
  .topnav .brand { font-size: 1.45rem; }

  /* ----- Bottom tab bar (the menu moves here) ----- */
  .nav-links { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; justify-content: space-around;
               align-items: stretch; gap: 0; margin: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
               background: rgba(18, 18, 18, 0.97); border-top: 1px solid #262626; }
  .nav-links a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; margin: 0 !important;
                 padding: 4px 0; font-size: 0.7rem; font-weight: 500; color: #9a9a9a; text-decoration: none; }
  .nav-links a::before { content: ""; width: 24px; height: 24px; background: currentColor;
                         -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
  .nav-links a.active { color: #fff; }
  .nav-links a.kids-on { color: #2ecc71; }
  .nav-links a[href="/library.php"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 10.5 12 3l9 7.5V21h-6v-6H9v6H3z'/%3E%3C/svg%3E"); }
  .nav-links a[href="/settings.php"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 6h11v2H3zm14-1.5h2V6h2v2h-2v1.5h-2zM3 16h5v2H3zm7-1.5h2V16h9v2h-9v1.5h-2zM3 11h3v2H3zm5-1.5h2V11h11v2H10v1.5H8z'/%3E%3C/svg%3E"); }
  .nav-links a[href="/kids.php"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='9' cy='7.5' r='3.5'/%3E%3Ccircle cx='17' cy='9' r='2.5'/%3E%3Cpath d='M2 20c0-4 3.1-6.5 7-6.5s7 2.5 7 6.5zm15.2 0c0-2.3-.8-4.1-2.3-5.3.7-.3 1.4-.4 2.1-.4 2.8 0 5 1.7 5 5.7z'/%3E%3C/svg%3E"); }
  .nav-links a[href="/logout.php"] { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M10 3h9a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-9v-2h9V5h-9zM9 7.5l1.4 1.4L8.3 11H16v2H8.3l2.1 2.1L9 16.5 4.5 12z'/%3E%3C/svg%3E"); }

  /* ----- Library ----- */
  .search-box { font-size: 16px; padding: 10px 14px; border-radius: 6px; }
  .genre-chip { padding: 0.35rem 0.85rem; font-size: 0.85rem; }
  .lib-toolbar { margin-bottom: 0.5rem; font-size: 0.85rem; }
  .grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 8px; }

  /* Netflix-style rows: on the "All" library view, each section scrolls left and right */
  .jf-rows .grid { display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; padding-bottom: 6px;
                   margin-right: -12px; padding-right: 12px; scroll-snap-type: x proximity;
                   -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .jf-rows .grid::-webkit-scrollbar, .continue-scroller::-webkit-scrollbar { display: none; }
  .jf-rows .grid .card { flex: 0 0 30%; min-width: 0; scroll-snap-align: start; }
  .continue-scroller { scrollbar-width: none; }
  .card .poster, .card .poster-placeholder { border-radius: 4px; }
  .card-title { font-size: 0.75rem; line-height: 1.25; margin-top: 4px; overflow: hidden; display: -webkit-box;
                -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .continue-card { flex: 0 0 30%; }
  .continue-scroller { gap: 8px; scroll-snap-type: x proximity; }
  .continue-card { scroll-snap-align: start; }
  .cw-title { font-size: 0.75rem; }
  .has-rail main.container { padding-right: 2.2rem; }
  .az-rail button { padding: 2px 5px; font-size: 0.62rem; }

  /* Featured poster at the top of the library */
  .jf-hero { position: relative; width: 72%; max-width: 340px; aspect-ratio: 2 / 3; margin: 0.5rem auto 1.25rem;
             border-radius: 8px; overflow: hidden; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.65); }
  .jf-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .jf-hero-shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0) 55%); }
  .jf-hero-info { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px; display: flex; flex-direction: column;
                  align-items: center; gap: 8px; text-align: center; }
  .jf-hero-tag { font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: #e50914; font-weight: 700; }
  .jf-hero-title { font-size: 1rem; font-weight: 700; color: #fff; }
  .jf-hero-actions { display: flex; gap: 8px; width: 100%; }
  .jf-hero-actions a { flex: 1; padding: 0.55rem 0.4rem; border-radius: 4px; font-weight: 700; font-size: 0.9rem;
                       text-decoration: none; text-align: center; }
  .jf-hero-play { background: #fff; color: #000; }
  .jf-hero-more { background: rgba(109, 109, 110, 0.75); color: #fff; }

  /* ----- Movie page ----- */
  .details-layout { flex-direction: column; gap: 1rem; }
  .details-poster { flex: none !important; width: 55%; margin: 0 auto; }
  .details-info { min-width: 0 !important; }
  .details-info h1 { font-size: 1.45rem; text-align: center; }
  .details-meta { justify-content: center; flex-wrap: wrap; }
  .genre-line { text-align: center; }
  .play-btn { display: block; text-align: center; background: #fff; color: #000; padding: 0.75rem; margin: 0.75rem 0 0.5rem; }
  .play-btn:hover { background: #e6e6e6; }
  .trailer-embed { max-width: none; }

  /* ----- Player ----- */
  .watch-page main.container { padding-left: 0; padding-right: 0; }
  .watch-page h1 { font-size: 1.15rem; padding: 0 12px; margin: 0.25rem 0 0.75rem; }
  .video-player { width: 100%; border-radius: 0; }
  .player-bar, .quality-note { padding: 0 12px; }
  .watch-page .hint { display: none; }
}