/* The same top-edge notch on phones and tablets, with touch-sized actions. */
.mobile-header-notifications { display: none; }
@media (max-width: 1100px) {
  :root { --mobile-topbar-height: calc(56px + env(safe-area-inset-top, 0px)); }

  html body[class] :is(.topbar, .premium-nav),
  html body[class] :is(.topbar, .premium-nav).scrolled,
  html body.watch-page.search-open .topbar {
    position: fixed !important;
    top: 0 !important;
    left: 50% !important;
    right: auto !important;
    width: min(300px, calc(100% - 40px)) !important;
    height: var(--mobile-topbar-height) !important;
    min-height: var(--mobile-topbar-height) !important;
    box-sizing: border-box;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 44px 44px;
    align-items: center;
    gap: 4px;
    margin: 0 !important;
    padding: env(safe-area-inset-top, 0px) 10px 0 !important;
    border: 1px solid rgba(255,255,255,.08) !important;
    border-top: 0 !important;
    border-radius: 0 0 18px 18px !important;
    background: rgba(8,8,8,.72) !important;
    box-shadow: 0 6px 20px rgba(0,0,0,.12) !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    overflow: visible !important;
    transform: translateX(-50%) !important;
    transition: background-color .4s ease, border-color .4s ease, box-shadow .4s ease !important;
  }
  html body[class] :is(.topbar, .premium-nav).scrolled {
    background: #080808 !important;
    border-color: rgba(255,255,255,.2) !important;
    box-shadow: 0 10px 28px rgba(0,0,0,.4), 0 2px 12px rgba(255,255,255,.07), inset 0 -1px 0 rgba(255,255,255,.05) !important;
  }
  html body[class] :is(.topbar, .premium-nav)::before,
  html body[class] :is(.topbar, .premium-nav)::after {
    content: '' !important;
    position: absolute;
    top: 0;
    bottom: auto;
    width: 14px;
    height: 14px;
    opacity: .72 !important;
    pointer-events: none;
    transform: none !important;
    box-shadow: none !important;
    transition: opacity .4s ease !important;
  }
  html body[class] :is(.topbar, .premium-nav)::before {
    left: -14px;
    right: auto;
    background: radial-gradient(circle at 0 100%, transparent 13.5px, #080808 14px);
  }
  html body[class] :is(.topbar, .premium-nav)::after {
    right: -14px;
    left: auto;
    background: radial-gradient(circle at 100% 100%, transparent 13.5px, #080808 14px);
  }
  html body[class] :is(.topbar, .premium-nav).scrolled::before,
  html body[class] :is(.topbar, .premium-nav).scrolled::after { opacity: 1 !important; }

  html body[class] .topbar > .center,
  html body[class] .topbar > .right,
  html body.premium-page .premium-nav > .center { display: none !important; }

  html body[class] .topbar :is(.left, .logo-link, .logo),
  html body.premium-page .premium-nav > .brand {
    display: flex !important;
    align-items: center;
    height: 56px !important;
    min-width: 0;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
  }
  html body[class] .topbar .logo img,
  html body[class] .topbar:not(.scrolled) .logo img,
  html body[class] .topbar.scrolled .logo img,
  html body.watch-page.search-open .topbar .logo img,
  html body.watch-page.search-open .topbar:not(.scrolled) .logo img,
  html body.watch-page.search-open .topbar.scrolled .logo img,
  html body.premium-page .premium-nav .brand img {
    width: 140px !important;
    max-width: 100%;
    height: 56px !important;
    margin: 0 !important;
    object-fit: cover;
    object-position: center 47%;
    transform: none !important;
  }
  html body[class] .topbar :is(.mobile-header-search, .mobile-header-notifications) {
    position: static;
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 44px !important;
    height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 12px !important;
    background: transparent !important;
    box-shadow: none !important;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  html body[class] .topbar > .left { grid-column: 1; grid-row: 1; }
  html body[class] .topbar .mobile-header-search { grid-column: 2; grid-row: 1; }
  html body[class] .topbar .mobile-menu-toggle { display: none !important; }
  html body[class] .topbar .mobile-header-notifications { grid-column: 3; grid-row: 1; }
  html body[class] .topbar .mobile-header-notifications img {
    width: 21px;
    height: 21px;
    object-fit: contain;
    filter: grayscale(1) brightness(0) invert(1);
  }
  html body[class] .topbar .mobile-header-search img { width: 20px !important; height: 20px !important; }
  html body[class] .topbar :is(a, button):focus-visible {
    outline: 2px solid #c8c8c8;
    outline-offset: 2px;
  }
  html body.premium-page .premium-nav { grid-template-columns: minmax(0, 1fr) auto; }
  html body.premium-page .premium-nav > .right { display: flex; align-items: center; min-width: 0; }
  html body.premium-page .premium-nav .nav-login {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 10px;
    font-size: 12px;
    border-radius: 12px;
  }
  html body.premium-page .premium-nav .premium-account-name { display: none; }
}

@media (max-width: 1100px) and (prefers-reduced-motion: reduce) {
  html body[class] :is(.topbar, .premium-nav),
  html body[class] :is(.topbar, .premium-nav).scrolled,
  html body.watch-page.search-open .topbar,
  html body[class] :is(.topbar, .premium-nav)::before,
  html body[class] :is(.topbar, .premium-nav)::after { transition: none !important; }
}
